Commit 4902c54177623fa4f24bca0161496d36517ad0b4

Authored by wdn127929
1 parent 0c444caf

门店收款码 OK

@@ -449,7 +449,7 @@ @@ -449,7 +449,7 @@
449 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 449 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
450 CLANG_ENABLE_MODULES = YES; 450 CLANG_ENABLE_MODULES = YES;
451 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 451 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
452 - CURRENT_PROJECT_VERSION = 5505; 452 + CURRENT_PROJECT_VERSION = 5507;
453 DEVELOPMENT_TEAM = 8J59HM8B82; 453 DEVELOPMENT_TEAM = 8J59HM8B82;
454 ENABLE_BITCODE = NO; 454 ENABLE_BITCODE = NO;
455 INFOPLIST_FILE = Runner/Info.plist; 455 INFOPLIST_FILE = Runner/Info.plist;
@@ -632,7 +632,7 @@ @@ -632,7 +632,7 @@
632 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 632 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
633 CLANG_ENABLE_MODULES = YES; 633 CLANG_ENABLE_MODULES = YES;
634 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 634 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
635 - CURRENT_PROJECT_VERSION = 5505; 635 + CURRENT_PROJECT_VERSION = 5507;
636 DEVELOPMENT_TEAM = 8J59HM8B82; 636 DEVELOPMENT_TEAM = 8J59HM8B82;
637 ENABLE_BITCODE = NO; 637 ENABLE_BITCODE = NO;
638 INFOPLIST_FILE = Runner/Info.plist; 638 INFOPLIST_FILE = Runner/Info.plist;
@@ -658,7 +658,7 @@ @@ -658,7 +658,7 @@
658 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 658 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
659 CLANG_ENABLE_MODULES = YES; 659 CLANG_ENABLE_MODULES = YES;
660 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 660 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
661 - CURRENT_PROJECT_VERSION = 5505; 661 + CURRENT_PROJECT_VERSION = 5507;
662 DEVELOPMENT_TEAM = 8J59HM8B82; 662 DEVELOPMENT_TEAM = 8J59HM8B82;
663 ENABLE_BITCODE = NO; 663 ENABLE_BITCODE = NO;
664 INFOPLIST_FILE = Runner/Info.plist; 664 INFOPLIST_FILE = Runner/Info.plist;
@@ -207,6 +207,10 @@ class Constant { @@ -207,6 +207,10 @@ class Constant {
207 '管理员', 207 '管理员',
208 '店长', 208 '店长',
209 ], 209 ],
  210 + '收银管理': [
  211 + '管理员',
  212 + '店长',
  213 + ],
210 '订座详情-电话': [ 214 '订座详情-电话': [
211 '管理员', 215 '管理员',
212 '前台', 216 '前台',
  1 +class PaymentCodeModel {
  2 + int? ret;
  3 + String? data;
  4 + String? msg;
  5 +
  6 + PaymentCodeModel({this.ret, this.data, this.msg});
  7 +
  8 + PaymentCodeModel.fromJson(Map<dynamic, dynamic> json) {
  9 + ret = json['ret'];
  10 + data = json['data'];
  11 + msg = json['msg'];
  12 + }
  13 +
  14 + Map<dynamic, dynamic> toJson() {
  15 + final Map<dynamic, dynamic> data = new Map<dynamic, dynamic>();
  16 + data['ret'] = this.ret;
  17 + data['data'] = this.data;
  18 + data['msg'] = this.msg;
  19 + return data;
  20 + }
  21 +}
@@ -595,11 +595,11 @@ class HttpUrl { @@ -595,11 +595,11 @@ class HttpUrl {
595 static const get_seller_cuisine = 595 static const get_seller_cuisine =
596 "?service=App.Seller.GetSellerCuisine"; // 获取商家所属菜系 596 "?service=App.Seller.GetSellerCuisine"; // 获取商家所属菜系
597 597
598 - static const set_seller_config_by_pc = 598 + static const set_seller_config_by_pc =
599 "?service=App.Seller.SetSellerConfigByPC"; // PC维护商家基本信息,保存人均消费 599 "?service=App.Seller.SetSellerConfigByPC"; // PC维护商家基本信息,保存人均消费
600 - static const set_seller_cuisine = 600 + static const set_seller_cuisine =
601 "?service=App.Seller.SetSellerCuisine"; // 设置商家所属菜系 601 "?service=App.Seller.SetSellerCuisine"; // 设置商家所属菜系
602 602
603 -  
604 - 603 + static const create_pay_qrcode =
  604 + "?service=App.Seller.CreatePayQrcode"; // 生成商家收款二维码
605 } 605 }
@@ -462,13 +462,16 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -462,13 +462,16 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
462 //输入文本的样式 462 //输入文本的样式
463 inputFormatters: title == '券名称' 463 inputFormatters: title == '券名称'
464 ? [LengthLimitingTextInputFormatter(15)] 464 ? [LengthLimitingTextInputFormatter(15)]
465 - : title == '券金额' ||  
466 - title == '领取后有效天数' ||  
467 - title == '消费要求(0为无门槛)' ||  
468 - title == '分享佣金' ||  
469 - title == '发放总量限制' 465 + : title == '领取后有效天数' || title == '发放总量限制'
470 ? [FilteringTextInputFormatter.digitsOnly] 466 ? [FilteringTextInputFormatter.digitsOnly]
471 - : [], // 限制输入为数字, 467 + : title == '券金额' ||
  468 + title == '分享佣金' ||
  469 + title == '消费要求(0为无门槛)'
  470 + ? [
  471 + FilteringTextInputFormatter.allow(
  472 + RegExp("[0-9.]")),
  473 + ]
  474 + : [], // 限制输入为数字,
472 style: TextStyle( 475 style: TextStyle(
473 color: MyColours.color_515151, 476 color: MyColours.color_515151,
474 fontSize: ScreenUtil().setSp(28), 477 fontSize: ScreenUtil().setSp(28),
@@ -1629,13 +1632,24 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1629,13 +1632,24 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1629 Utils.showToast('请填写发放总量限制'); 1632 Utils.showToast('请填写发放总量限制');
1630 return; 1633 return;
1631 } 1634 }
1632 - // bool isNumber = Utils.isInteger(  
1633 - // _limitNumControl.text.trim()); //判断输入的内容是否是数字  
1634 - // if (!isNumber) {  
1635 - // Utils.showToast('发放总量限制请输入数字');  
1636 - // _limitNumControl.text = '';  
1637 - // return;  
1638 - // } 1635 +
  1636 + if (!Utils.isInteger(_priceControl.text.trim())) {
  1637 + Utils.showToast('券金额请输入数字');
  1638 + _priceControl.text = '';
  1639 + return;
  1640 + }
  1641 +
  1642 + if (!Utils.isInteger(
  1643 + _couponRequireEditControl.text.trim())) {
  1644 + Utils.showToast('消费要求请输入数字');
  1645 + _couponRequireEditControl.text = '';
  1646 + return;
  1647 + }
  1648 + if (!Utils.isInteger(_commissionControl.text.trim())) {
  1649 + Utils.showToast('分享佣金请输入数字');
  1650 + _commissionControl.text = '';
  1651 + return;
  1652 + }
1639 1653
1640 // ***参数*** 1654 // ***参数***
1641 // _couponNameEditControl.text 1655 // _couponNameEditControl.text
@@ -407,9 +407,10 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -407,9 +407,10 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
407 //输入文本的样式 407 //输入文本的样式
408 inputFormatters: title == '券名称' 408 inputFormatters: title == '券名称'
409 ? [LengthLimitingTextInputFormatter(15)] 409 ? [LengthLimitingTextInputFormatter(15)]
410 - : title == '销售价'  
411 - ? [FilteringTextInputFormatter.digitsOnly]  
412 - : [], 410 + :title == '销售价'? [
  411 + FilteringTextInputFormatter.allow(
  412 + RegExp("[0-9.]")),
  413 + ]: [],
413 style: TextStyle( 414 style: TextStyle(
414 color: MyColours.color_515151, 415 color: MyColours.color_515151,
415 fontSize: ScreenUtil().setSp(32), 416 fontSize: ScreenUtil().setSp(32),
@@ -1325,6 +1326,12 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -1325,6 +1326,12 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
1325 Utils.showToast('请输入销售价,且必须大于0'); 1326 Utils.showToast('请输入销售价,且必须大于0');
1326 return; 1327 return;
1327 } 1328 }
  1329 + if (!Utils.isInteger(
  1330 + _priceControl.text.trim())) {
  1331 + Utils.showToast('销售价请输入数字');
  1332 + _priceControl.text = '';
  1333 + return;
  1334 + }
1328 if (!widget.isMine) { 1335 if (!widget.isMine) {
1329 if (money && moneyControl.text.trim().length == 0) { 1336 if (money && moneyControl.text.trim().length == 0) {
1330 Utils.showToast('请输入代金券金额!'); 1337 Utils.showToast('请输入代金券金额!');
@@ -1358,15 +1365,15 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -1358,15 +1365,15 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
1358 } 1365 }
1359 } 1366 }
1360 if (_couponRequireEditControl.text.trim().length == 0) { 1367 if (_couponRequireEditControl.text.trim().length == 0) {
1361 - Utils.showToast('请填写券要求'); 1368 + Utils.showToast('请填写消费要求');
1362 return; 1369 return;
1363 } 1370 }
1364 if (fromDate == '点击选择') { 1371 if (fromDate == '点击选择') {
1365 - Utils.showToast('请选择有效期起始时间'); 1372 + Utils.showToast('请选择活动开始时间');
1366 return; 1373 return;
1367 } 1374 }
1368 if (endDate == '点击选择') { 1375 if (endDate == '点击选择') {
1369 - Utils.showToast('请选择有效期结束时间'); 1376 + Utils.showToast('请选择活动结束时间');
1370 return; 1377 return;
1371 } 1378 }
1372 if (DateUtil.getDateTime(endDate) 1379 if (DateUtil.getDateTime(endDate)
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/route/navigator_util.dart';
  4 +import 'package:one_key/widgets/system_app_bar.dart';
  5 +
  6 +import '../../../res/colors.dart';
  7 +import '../../../utils/screen_util.dart';
  8 +import '../../../utils/utils.dart';
  9 +import '../../../widgets/h_empty_view.dart';
  10 +
  11 +/**
  12 + * 收银管理主页
  13 + */
  14 +
  15 +class FinanceManageHomePage extends StatefulWidget {
  16 + const FinanceManageHomePage({super.key});
  17 +
  18 + @override
  19 + State<FinanceManageHomePage> createState() => _FinanceManageHomePageState();
  20 +}
  21 +
  22 +class _FinanceManageHomePageState extends State<FinanceManageHomePage> {
  23 + ///时间选择
  24 + Widget _item(String title, GestureTapCallback onTap) {
  25 + return InkWell(
  26 + onTap: onTap,
  27 + child: Container(
  28 + padding: EdgeInsets.only(
  29 + left: w(16),
  30 + bottom: w(12),
  31 + top: w(12),
  32 + ),
  33 + margin: EdgeInsets.only(bottom: w(12)),
  34 + decoration: BoxDecoration(
  35 + border: Border(
  36 + bottom:
  37 + BorderSide(color: MyColours.color_E7E7E7, width: w(0.5)))),
  38 + child: Row(
  39 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  40 + crossAxisAlignment: CrossAxisAlignment.center,
  41 + children: [
  42 + Container(
  43 + child: Text(
  44 + title,
  45 + style: TextStyle(
  46 + color: MyColours.color_515151,
  47 + fontSize: ScreenUtil().setSp(32)),
  48 + ),
  49 + ),
  50 + Spacer(),
  51 + Image.asset(
  52 + Utils.getImgPath('arrow_right_new'),
  53 + width: ScreenUtil().setWidth(20),
  54 + ),
  55 + HEmptyView(24),
  56 + ],
  57 + ),
  58 + ),
  59 + );
  60 + }
  61 +
  62 + @override
  63 + Widget build(BuildContext context) {
  64 + return Scaffold(
  65 + appBar: SystemAppBar('收银管理'),
  66 + backgroundColor: MyColours.color_ffffff,
  67 + body: SingleChildScrollView(
  68 + child: Column(
  69 + children: [
  70 + _item('收银资料上传', () {}),
  71 + _item('微信商户账户开通结果查询', () {}),
  72 + _item('支付返券', () {}),
  73 + _item('门店收款码', () {
  74 + NavigatorUtil.goPaymentCodePage(context);
  75 + }),
  76 + _item('资金明细', () {}),
  77 + _item('提现设置', () {})
  78 + ],
  79 + ),
  80 + ),
  81 + );
  82 + }
  83 +}
  1 +import 'dart:io';
  2 +import 'dart:typed_data';
  3 +import 'dart:ui';
  4 +
  5 +import 'package:cached_network_image/cached_network_image.dart';
  6 +import 'package:flutter/cupertino.dart';
  7 +import 'package:flutter/material.dart';
  8 +import 'package:flutter/rendering.dart';
  9 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  10 +import 'package:image_gallery_saver/image_gallery_saver.dart';
  11 +import 'package:one_key/provider/user_model.dart';
  12 +import 'package:one_key/widgets/round_button.dart';
  13 +import 'package:one_key/widgets/system_app_bar.dart';
  14 +import 'package:one_key/widgets/v_empty_view.dart';
  15 +import 'package:permission_handler/permission_handler.dart';
  16 +import 'package:provider/provider.dart';
  17 +
  18 +import '../../../constant/state.dart';
  19 +import '../../../provider/finance_provider.dart';
  20 +import '../../../res/colors.dart';
  21 +import '../../../utils/screen_util.dart';
  22 +import '../../../utils/utils.dart';
  23 +import '../../../widgets/h_empty_view.dart';
  24 +import '../../../widgets/loading.dart';
  25 +import 'dart:ui' as ui;
  26 +
  27 +/**
  28 + * 收款码
  29 + */
  30 +
  31 +class PaymentCodePage extends StatefulWidget {
  32 + const PaymentCodePage({super.key});
  33 +
  34 + @override
  35 + State<PaymentCodePage> createState() => _PaymentCodePageState();
  36 +}
  37 +
  38 +class _PaymentCodePageState extends State<PaymentCodePage> {
  39 + FinanceProvider? financeProvider;
  40 +
  41 + final GlobalKey globalKey = GlobalKey();
  42 +
  43 + @override
  44 + void initState() {
  45 + super.initState();
  46 +
  47 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  48 + _createPayQrcode();
  49 + });
  50 + }
  51 +
  52 + _createPayQrcode() {
  53 + financeProvider!.createPayQrcode(context);
  54 + }
  55 +
  56 + /// 截图
  57 + Future<Uint8List?> _capturePng(
  58 + GlobalKey globalKey,
  59 + // {
  60 + // double pixelRatio = 2.0, //截屏的图片与原图的比例
  61 + // }
  62 + ) async {
  63 + try {
  64 + RenderRepaintBoundary boundary =
  65 + globalKey.currentContext?.findRenderObject() as RenderRepaintBoundary;
  66 + double dpr = ui.window.devicePixelRatio; // 获取当前设备的像素比
  67 + var image = await boundary.toImage(pixelRatio: dpr);
  68 + ByteData? byteData = await image.toByteData(format: ImageByteFormat.png);
  69 + Uint8List? pngBytes = byteData?.buffer.asUint8List();
  70 + return pngBytes;
  71 + } catch (e) {
  72 + print(e);
  73 + }
  74 + return null;
  75 + }
  76 +
  77 + @override
  78 + Widget build(BuildContext context) {
  79 + financeProvider = Provider.of<FinanceProvider>(context, listen: true);
  80 + return Scaffold(
  81 + appBar: SystemAppBar('门店收款码'),
  82 + backgroundColor: MyColours.color_ffffff,
  83 + body: Column(
  84 + children: [
  85 + Expanded(
  86 + child: SingleChildScrollView(
  87 + child: Column(
  88 + crossAxisAlignment: CrossAxisAlignment.start,
  89 + children: [
  90 + //二维码图片
  91 +
  92 + //
  93 + RepaintBoundary(
  94 + key: globalKey,
  95 + child: Column(
  96 + children: [
  97 + Container(
  98 + margin: EdgeInsets.symmetric(horizontal: w(57)),
  99 + padding: EdgeInsets.symmetric(
  100 + horizontal: w(25), vertical: w(35)),
  101 + color: MyColours.color_09BB07,
  102 + child: Column(
  103 + children: [
  104 + Text(
  105 + '请使用微信扫一扫',
  106 + style: TextStyle(
  107 + color: MyColours.color_ffffff,
  108 + fontSize: font(16),
  109 + fontWeight: FontWeight.bold),
  110 + ),
  111 + VEmptyView(20),
  112 + Consumer<FinanceProvider>(
  113 + builder: (context, model, _) {
  114 + if (model.pageState != PageState.Success) {
  115 + return Center(
  116 + child: SizedBox(
  117 + width: ScreenUtil().setWidth(80),
  118 + height: ScreenUtil().setWidth(80),
  119 + child:
  120 + CupertinoActivityIndicator()),
  121 + );
  122 + } else {
  123 + return Container(
  124 + padding: EdgeInsets.symmetric(
  125 + horizontal: w(21),
  126 + vertical: w(16)),
  127 + color: MyColours.color_ffffff,
  128 + child: Column(
  129 + children: [
  130 + CachedNetworkImage(
  131 + imageUrl: financeProvider!
  132 + .paymentCodeUrl),
  133 + // VEmptyView(28),
  134 + Text(
  135 + '${Provider.of<UserModel>(context).user!.sellername}',
  136 + maxLines: 3,
  137 + overflow: TextOverflow.ellipsis,
  138 + style: TextStyle(
  139 + color:
  140 + MyColours.color_000000,
  141 + fontSize: font(14)),
  142 + )
  143 + ],
  144 + ));
  145 + }
  146 + })
  147 + ],
  148 + ),
  149 + ),
  150 + Container(
  151 + margin: EdgeInsets.symmetric(horizontal: w(57)),
  152 + padding: EdgeInsets.symmetric(
  153 + horizontal: w(25), vertical: w(11)),
  154 + decoration: BoxDecoration(
  155 + color: MyColours.color_ffffff,
  156 + border: Border.all(
  157 + color: MyColours.color_09BB07,
  158 + width: w(2))),
  159 + child: Row(
  160 + mainAxisAlignment: MainAxisAlignment.center,
  161 + children: [
  162 + Image.asset(
  163 + Utils.getImgPath('vector'),
  164 + width: w(37),
  165 + ),
  166 + HEmptyView(12),
  167 + Text(
  168 + '微信支付',
  169 + style: TextStyle(
  170 + color: MyColours.color_515151,
  171 + fontSize: font(28)),
  172 + )
  173 + ],
  174 + )),
  175 + ],
  176 + )),
  177 +
  178 + VEmptyView(160),
  179 + Padding(
  180 + padding: EdgeInsets.symmetric(horizontal: w(16)),
  181 + child: Text(
  182 + '提示:',
  183 + textAlign: TextAlign.left,
  184 + style: TextStyle(
  185 + fontSize: w(16),
  186 + height: 1.5,
  187 + fontWeight: FontWeight.bold,
  188 + color: MyColours.color_000000),
  189 + )),
  190 + Padding(
  191 + padding: EdgeInsets.symmetric(horizontal: w(16)),
  192 + child: Text(
  193 + '请将收款码出示给顾客,顾客扫码支付时可以自动识别拥有的代金券,并自动在餐厅设定的规则下使用。',
  194 + textAlign: TextAlign.left,
  195 + style: TextStyle(
  196 + fontSize: w(14),
  197 + height: 1.5,
  198 + color: MyColours.color_000000),
  199 + ))
  200 + ],
  201 + ),
  202 + ),
  203 + ),
  204 + Container(
  205 + padding: EdgeInsets.symmetric(vertical: w(13), horizontal: w(79)),
  206 + child: RoundButton(
  207 + text: '保存收款码图片',
  208 + height: w(43),
  209 + radius: r(5),
  210 + gradientStart: MyColours.color_ffffff,
  211 + gradientEnd: MyColours.color_ffffff,
  212 + borderColor: MyColours.color_438E93,
  213 + textColor: MyColours.color_438E93,
  214 + isBold: true,
  215 + fontSize: 32,
  216 + onPressed: () {
  217 + Utils.getPickPermission(context, () async {
  218 + //获取截屏图像
  219 + //添加到图片数组中
  220 + Loading.showLoading(
  221 + context,
  222 + );
  223 + Uint8List? value = await _capturePng(globalKey);
  224 + if (value != null) {
  225 + print(value);
  226 + final result = await ImageGallerySaver.saveImage(value,
  227 + quality: 100);
  228 + if (result != null) {
  229 + Utils.showToast("保存成功");
  230 + } else {
  231 + print('error');
  232 + Utils.showToast("保存失败");
  233 + // toast("");
  234 + }
  235 + Loading.hideLoading(context);
  236 + // setState(() {});
  237 + }
  238 + }, Platform.isIOS ? Permission.photos : Permission.storage);
  239 + },
  240 + ),
  241 + )
  242 + ],
  243 + ));
  244 + }
  245 +}
1 -  
2 import 'dart:convert'; 1 import 'dart:convert';
3 2
4 import 'package:common_utils/common_utils.dart'; 3 import 'package:common_utils/common_utils.dart';
@@ -246,7 +245,6 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -246,7 +245,6 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
246 edate = DateTime.fromMillisecondsSinceEpoch( 245 edate = DateTime.fromMillisecondsSinceEpoch(
247 int.parse(collectStoreProvider.sellerNormalEdate!) * 1000); 246 int.parse(collectStoreProvider.sellerNormalEdate!) * 1000);
248 247
249 -  
250 DateTime datenow = DateTime.now(); 248 DateTime datenow = DateTime.now();
251 249
252 //比较相差的天数 250 //比较相差的天数
@@ -358,14 +356,14 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -358,14 +356,14 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
358 356
359 int differenceSeconds = edate!.difference(datenow).inSeconds; 357 int differenceSeconds = edate!.difference(datenow).inSeconds;
360 358
361 - if (difference < 0 || (difference == 0 && differenceSeconds <= 0)) {  
362 - //过期  
363 - outDay = '0';  
364 - } else if (difference == 0 && differenceSeconds > 0) {  
365 - outDay = '1';  
366 - } else {  
367 - outDay = difference.toString();  
368 - } 359 + if (difference < 0 || (difference == 0 && differenceSeconds <= 0)) {
  360 + //过期
  361 + outDay = '0';
  362 + } else if (difference == 0 && differenceSeconds > 0) {
  363 + outDay = '1';
  364 + } else {
  365 + outDay = difference.toString();
  366 + }
369 367
370 // print(outDay); 368 // print(outDay);
371 } else { 369 } else {
@@ -392,14 +390,14 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -392,14 +390,14 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
392 edate = DateTime.fromMillisecondsSinceEpoch( 390 edate = DateTime.fromMillisecondsSinceEpoch(
393 int.parse(collectStoreProvider.sellerNormalEdate!) * 1000); 391 int.parse(collectStoreProvider.sellerNormalEdate!) * 1000);
394 392
395 - DateTime datenow = DateTime.now(); 393 + DateTime datenow = DateTime.now();
396 394
397 //比较相差的天数 395 //比较相差的天数
398 int difference = edate!.difference(datenow).inDays; 396 int difference = edate!.difference(datenow).inDays;
399 397
400 int differenceSeconds = edate!.difference(datenow).inSeconds; 398 int differenceSeconds = edate!.difference(datenow).inSeconds;
401 399
402 - if (difference < 0 || (difference == 0 && differenceSeconds <= 0)) { 400 + if (difference < 0 || (difference == 0 && differenceSeconds <= 0)) {
403 //过期 401 //过期
404 outDay = '0'; 402 outDay = '0';
405 } else if (difference == 0 && differenceSeconds > 0) { 403 } else if (difference == 0 && differenceSeconds > 0) {
@@ -527,7 +525,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -527,7 +525,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
527 ScreenUtil().setWidth(40)), 525 ScreenUtil().setWidth(40)),
528 child: model.user!.sellerimage == 526 child: model.user!.sellerimage ==
529 null || 527 null ||
530 - model.user!.sellerimage == '' 528 + model.user!.sellerimage ==
  529 + ''
531 ? Image.asset( 530 ? Image.asset(
532 Utils.getImgPath( 531 Utils.getImgPath(
533 'base_tx_mr'), 532 'base_tx_mr'),
@@ -571,8 +570,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -571,8 +570,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
571 Text( 570 Text(
572 '店铺编号:' + 571 '店铺编号:' +
573 model.user!.sellerid!.padLeft(6, '0'), 572 model.user!.sellerid!.padLeft(6, '0'),
574 - style:  
575 - TextStyle( 573 + style: TextStyle(
576 fontWeight: FontWeight.bold, 574 fontWeight: FontWeight.bold,
577 color: MyColours.color_ffffff, 575 color: MyColours.color_ffffff,
578 fontSize: font(10)), 576 fontSize: font(10)),
@@ -582,8 +580,9 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -582,8 +580,9 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
582 '员工编号:' + 580 '员工编号:' +
583 model.user!.account! + 581 model.user!.account! +
584 " " + 582 " " +
585 - (model.user!.role_name_addition ?? ''),  
586 - style: TextStyle( 583 + (model.user!.role_name_addition ??
  584 + ''),
  585 + style: TextStyle(
587 fontWeight: FontWeight.bold, 586 fontWeight: FontWeight.bold,
588 color: MyColours.color_ffffff, 587 color: MyColours.color_ffffff,
589 fontSize: font(10)), 588 fontSize: font(10)),
@@ -1612,10 +1611,30 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -1612,10 +1611,30 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
1612 isRowLow: outDay == '0' || 1611 isRowLow: outDay == '0' ||
1613 !Utils.getAuthority( 1612 !Utils.getAuthority(
1614 context, '评价管理'))), 1613 context, '评价管理'))),
1615 - // InkWell(  
1616 - // onTap: () {}, child: _item('', '空空空空')),  
1617 InkWell( 1614 InkWell(
1618 - onTap: () {}, child: _item('', '空空空空')), 1615 + onTap: () {
  1616 + if (outDay == '0') {
  1617 + return;
  1618 + }
  1619 + if (Utils.getAuthority(
  1620 + context, '收银管理')) {
  1621 + NavigatorUtil
  1622 + .goFinanceManageHomePage(
  1623 + context);
  1624 + }
  1625 + },
  1626 + child: _item(
  1627 + outDay == '0' ||
  1628 + !Utils.getAuthority(
  1629 + context, '收银管理')
  1630 + ? Utils.getImgPath(
  1631 + 'my_comment_un')
  1632 + : Utils.getImgPath(
  1633 + 'my_comment'),
  1634 + '收银管理',
  1635 + isRowLow: outDay == '0' ||
  1636 + !Utils.getAuthority(
  1637 + context, '收银管理'))),
1619 ], 1638 ],
1620 ) 1639 )
1621 ], 1640 ],
  1 +import 'package:flutter/material.dart';
  2 +import 'package:one_key/provider/user_model.dart';
  3 +import 'package:provider/provider.dart';
  4 +
  5 +import '../constant/constant.dart';
  6 +import '../constant/error.dart';
  7 +import '../constant/state.dart';
  8 +import '../models/payment_code_model.dart';
  9 +import '../net/base_resp.dart';
  10 +import '../net/dio_util.dart';
  11 +import '../net/http_url.dart';
  12 +import '../utils/utils.dart';
  13 +
  14 +class FinanceProvider extends ChangeNotifier {
  15 + PageState pageState = PageState.Loading;
  16 +
  17 + String paymentCodeUrl = '';
  18 +
  19 + ///客户经理获取所创建活动列表
  20 + Future createPayQrcode(
  21 + BuildContext context,
  22 + {isShowLoading = true}) async {
  23 + try {
  24 + Map<String, String?> params = {
  25 + 'sellerid':Provider.of<UserModel>(context,listen: false).user!.sellerid,
  26 + };
  27 + BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
  28 + context, Method.post, HttpUrl.create_pay_qrcode,
  29 + data: params, showLoading: false);
  30 + if (baseResp.code == Constant.status_success) {
  31 + if (baseResp.data.isEmpty) {
  32 + // if (isShowLoading) {
  33 + pageState = PageState.Empty;
  34 + // }
  35 + } else {
  36 + // if (isShowLoading) {
  37 + pageState = PageState.Success;
  38 + // }
  39 + }
  40 + paymentCodeUrl =
  41 + PaymentCodeModel.fromJson(baseResp.responseData!).data ?? '';
  42 + } else {
  43 + if (isShowLoading) {
  44 + pageState = PageState.ConnectivityError;
  45 + }
  46 + if (baseResp != null) {
  47 + Utils.showToast(baseResp.msg ?? "");
  48 + }
  49 + }
  50 +
  51 + notifyListeners();
  52 + } catch (error) {
  53 + print(error.toString());
  54 +
  55 + if (error is MyError) {
  56 + if (isShowLoading) {
  57 + switch (error.type) {
  58 + case 1:
  59 + pageState = PageState.ConnectivityError;
  60 + break;
  61 + case 2:
  62 + pageState = PageState.ConnectivityTimeOut;
  63 + break;
  64 + default:
  65 + pageState = PageState.ConnectivityError;
  66 + break;
  67 + }
  68 + }
  69 + }
  70 + notifyListeners();
  71 + }
  72 + }
  73 +}
@@ -21,6 +21,8 @@ class MyColours { @@ -21,6 +21,8 @@ class MyColours {
21 static const Color color_EEAE74 = Color(0xFFEEAE74); 21 static const Color color_EEAE74 = Color(0xFFEEAE74);
22 static const Color color_C76216 = Color(0xFFC76216); 22 static const Color color_C76216 = Color(0xFFC76216);
23 static const Color color_0C0F0E = Color(0xFF0C0F0E); 23 static const Color color_0C0F0E = Color(0xFF0C0F0E);
  24 + static const Color color_09BB07 = Color(0xFF09BB07);
  25 +
24 static const Color color_0143A3 = Color(0xFF0143A3); 26 static const Color color_0143A3 = Color(0xFF0143A3);
25 static const Color color_438E93 = Color(0xFF438E93); 27 static const Color color_438E93 = Color(0xFF438E93);
26 static const Color color_28323B = Color(0xFF28323B); 28 static const Color color_28323B = Color(0xFF28323B);
@@ -377,7 +377,8 @@ class NavigatorUtil { @@ -377,7 +377,8 @@ class NavigatorUtil {
377 "${Routes.coupon_eidt_pay_page}?isMine=${isMine}&couponSunModel=${FluroConvertUtils.object2string(couponSunModel)}", 377 "${Routes.coupon_eidt_pay_page}?isMine=${isMine}&couponSunModel=${FluroConvertUtils.object2string(couponSunModel)}",
378 replace: replace); 378 replace: replace);
379 } 379 }
380 - return _navigateTo(context, "${Routes.coupon_eidt_pay_page}?isMine=${isMine}", 380 + return _navigateTo(
  381 + context, "${Routes.coupon_eidt_pay_page}?isMine=${isMine}",
381 replace: replace); 382 replace: replace);
382 } 383 }
383 384
@@ -2345,4 +2346,22 @@ class NavigatorUtil { @@ -2345,4 +2346,22 @@ class NavigatorUtil {
2345 context, "${Routes.birthday_sms_module_setting_page}?type=$type", 2346 context, "${Routes.birthday_sms_module_setting_page}?type=$type",
2346 replace: replace); 2347 replace: replace);
2347 } 2348 }
  2349 +
  2350 + ///收银管理首页
  2351 + static Future<dynamic> goFinanceManageHomePage(
  2352 + BuildContext context, {
  2353 + replace = false,
  2354 + }) {
  2355 + return _navigateTo(context, "${Routes.finance_manage_home_page}",
  2356 + replace: replace);
  2357 + }
  2358 +
  2359 + ///门店收款码
  2360 + static Future<dynamic> goPaymentCodePage(
  2361 + BuildContext context, {
  2362 + replace = false,
  2363 + }) {
  2364 + return _navigateTo(context, "${Routes.payment_code_page}",
  2365 + replace: replace);
  2366 + }
2348 } 2367 }
@@ -221,6 +221,8 @@ import '../pages/my/feast_manage/feast_setmeal_manage_edit_page.dart'; @@ -221,6 +221,8 @@ import '../pages/my/feast_manage/feast_setmeal_manage_edit_page.dart';
221 import '../pages/my/feast_manage/feast_type_page.dart'; 221 import '../pages/my/feast_manage/feast_type_page.dart';
222 import '../pages/my/feast_manage/feast_wine_manage_edit_page.dart'; 222 import '../pages/my/feast_manage/feast_wine_manage_edit_page.dart';
223 import '../pages/my/feast_manage/feast_wine_manage_page.dart'; 223 import '../pages/my/feast_manage/feast_wine_manage_page.dart';
  224 +import '../pages/my/finance_manage/finance_manage_home_page.dart';
  225 +import '../pages/my/finance_manage/payment_code_page.dart';
224 import '../pages/my/input_name_phone_setting_page.dart'; 226 import '../pages/my/input_name_phone_setting_page.dart';
225 import '../pages/my/marketing_center/birthday_setting_page.dart'; 227 import '../pages/my/marketing_center/birthday_setting_page.dart';
226 import '../pages/my/marketing_center/birthday_sms_module_setting_page.dart'; 228 import '../pages/my/marketing_center/birthday_sms_module_setting_page.dart';
@@ -304,6 +306,7 @@ import '../provider/SmsModel.dart'; @@ -304,6 +306,7 @@ import '../provider/SmsModel.dart';
304 import '../provider/collect_store_provider.dart'; 306 import '../provider/collect_store_provider.dart';
305 import '../provider/comment_manage_provider.dart'; 307 import '../provider/comment_manage_provider.dart';
306 import '../provider/feast_model.dart'; 308 import '../provider/feast_model.dart';
  309 +import '../provider/finance_provider.dart';
307 import '../provider/marketing_center_provider.dart'; 310 import '../provider/marketing_center_provider.dart';
308 import '../provider/notebook_detail_change_model_only.dart'; 311 import '../provider/notebook_detail_change_model_only.dart';
309 312
@@ -4084,9 +4087,7 @@ var birthdaySmsModuleSettingPageHandle = new Handler( @@ -4084,9 +4087,7 @@ var birthdaySmsModuleSettingPageHandle = new Handler(
4084 child: BirthdaySmsModuleSettingPage(type: type)); 4087 child: BirthdaySmsModuleSettingPage(type: type));
4085 }); 4088 });
4086 4089
4087 -  
4088 -  
4089 - ///创建优惠券 4090 +///创建优惠券
4090 var couponEidtPayPageHandle = new Handler( 4091 var couponEidtPayPageHandle = new Handler(
4091 handlerFunc: (BuildContext? context, Map<String, List<Object>> params) { 4092 handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
4092 // String rid = params["rid"].first; 4093 // String rid = params["rid"].first;
@@ -4103,3 +4104,36 @@ var couponEidtPayPageHandle = new Handler( @@ -4103,3 +4104,36 @@ var couponEidtPayPageHandle = new Handler(
4103 create: (_) => UploadImageProvider(), 4104 create: (_) => UploadImageProvider(),
4104 child: CouponEidtPayPage(isMine: false, couponSunModel: couponSunModel)); 4105 child: CouponEidtPayPage(isMine: false, couponSunModel: couponSunModel));
4105 }); 4106 });
  4107 +
  4108 +///收银管理首页
  4109 +var financeManageHomePageHandle = new Handler(
  4110 + handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  4111 + // String rid = params["rid"].first;
  4112 + // bool isMine =
  4113 + // FluroConvertUtils.string2bool(params["isMine"]!.first as String);
  4114 + // CouponSunModel? couponSunModel;
  4115 + // if (params.keys.contains("couponSunModel")) {
  4116 + // couponSunModel = CouponSunModel.fromJson(json.decode(
  4117 + // FluroConvertUtils.fluroCnParamsDecode(
  4118 + // params["couponSunModel"]!.first as String)));
  4119 + // }
  4120 +
  4121 + return FinanceManageHomePage();
  4122 +});
  4123 +
  4124 +///门店收款码
  4125 +var paymentCodePageHandle = new Handler(
  4126 + handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
  4127 + // String rid = params["rid"].first;
  4128 + // bool isMine =
  4129 + // FluroConvertUtils.string2bool(params["isMine"]!.first as String);
  4130 + // CouponSunModel? couponSunModel;
  4131 + // if (params.keys.contains("couponSunModel")) {
  4132 + // couponSunModel = CouponSunModel.fromJson(json.decode(
  4133 + // FluroConvertUtils.fluroCnParamsDecode(
  4134 + // params["couponSunModel"]!.first as String)));
  4135 + // }
  4136 +
  4137 + return ChangeNotifierProvider<FinanceProvider>(
  4138 + create: (_) => FinanceProvider(), child: PaymentCodePage());
  4139 +});
1 -  
2 import 'package:fluro/fluro.dart'; 1 import 'package:fluro/fluro.dart';
3 import 'package:flutter/material.dart' hide Router; 2 import 'package:flutter/material.dart' hide Router;
4 import 'package:one_key/pages/login/login_page.dart'; 3 import 'package:one_key/pages/login/login_page.dart';
@@ -402,10 +401,11 @@ class Routes { @@ -402,10 +401,11 @@ class Routes {
402 401
403 static String birthday_sms_module_setting_page = 402 static String birthday_sms_module_setting_page =
404 "/birthday_sms_module_setting_page"; //客户生日提前通知短信设置 403 "/birthday_sms_module_setting_page"; //客户生日提前通知短信设置
405 - static String coupon_eidt_pay_page =  
406 - "/coupon_eidt_pay_page"; //老的店铺券创建页面 404 + static String coupon_eidt_pay_page = "/coupon_eidt_pay_page"; //老的店铺券创建页面
  405 +
  406 + static String finance_manage_home_page = "/finance_manage_home_page"; //收银管理首页
407 407
408 - 408 + static String payment_code_page = "/payment_code_page"; //门店收款码
409 409
410 static void configureRoutes(FluroRouter router) { 410 static void configureRoutes(FluroRouter router) {
411 router.notFoundHandler = new Handler( 411 router.notFoundHandler = new Handler(
@@ -764,8 +764,10 @@ class Routes { @@ -764,8 +764,10 @@ class Routes {
764 router.define(birthday_sms_module_setting_page, 764 router.define(birthday_sms_module_setting_page,
765 handler: birthdaySmsModuleSettingPageHandle); 765 handler: birthdaySmsModuleSettingPageHandle);
766 766
767 - router.define(coupon_eidt_pay_page,  
768 - handler: couponEidtPayPageHandle);  
769 - 767 + router.define(coupon_eidt_pay_page, handler: couponEidtPayPageHandle);
  768 +
  769 + router.define(finance_manage_home_page,
  770 + handler: financeManageHomePageHandle);
  771 + router.define(payment_code_page, handler: paymentCodePageHandle);
770 } 772 }
771 } 773 }