Commit 646dbe443922cbc67143f0d35b3f431517eaae27

Authored by wdn127929
1 parent 94cef44b

付费券可复用&&不可用日期灵活使用

1 -  
2 ///title 和select 1 ///title 和select
3 class FilterBtnModel { 2 class FilterBtnModel {
4 String? id; 3 String? id;
@@ -10,6 +9,8 @@ class FilterBtnModel { @@ -10,6 +9,8 @@ class FilterBtnModel {
10 bool? selectMor = false; 9 bool? selectMor = false;
11 bool? selectNoon = false; 10 bool? selectNoon = false;
12 bool? selectNig = false; 11 bool? selectNig = false;
  12 + bool? selectMeal1 = false;
  13 + bool? selectMeal2 = false;
13 14
14 FilterBtnModel(); 15 FilterBtnModel();
15 16
@@ -22,7 +23,9 @@ class FilterBtnModel { @@ -22,7 +23,9 @@ class FilterBtnModel {
22 ..account = json["account"] 23 ..account = json["account"]
23 ..selectMor = json["selectMor"] 24 ..selectMor = json["selectMor"]
24 ..selectNoon = json["selectNoon"] 25 ..selectNoon = json["selectNoon"]
25 - ..selectNig = json["selectNig"]; 26 + ..selectNig = json["selectNig"]
  27 + ..selectMeal1 = json["selectMeal1"]
  28 + ..selectMeal2 = json["selectMeal2"];
26 29
27 Map<String, dynamic> toJson() => <String, dynamic>{ 30 Map<String, dynamic> toJson() => <String, dynamic>{
28 "id": id, 31 "id": id,
@@ -33,6 +36,8 @@ class FilterBtnModel { @@ -33,6 +36,8 @@ class FilterBtnModel {
33 'account': account, 36 'account': account,
34 'selectMor': selectMor, 37 'selectMor': selectMor,
35 'selectNoon': selectNoon, 38 'selectNoon': selectNoon,
36 - 'selectNig': selectNig 39 + 'selectNig': selectNig,
  40 + 'selectMeal1': selectMeal1,
  41 + 'selectMeal2': selectMeal2,
37 }; 42 };
38 } 43 }
1 -  
2 import 'package:cached_network_image/cached_network_image.dart'; 1 import 'package:cached_network_image/cached_network_image.dart';
3 2
4 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
@@ -301,7 +300,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -301,7 +300,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
301 // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png'; 300 // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
302 // } 301 // }
303 Utils.setBarStatus(false, color: Colors.black); 302 Utils.setBarStatus(false, color: Colors.black);
304 - await showGeneralDialog( 303 + await showGeneralDialog(
305 context: context, 304 context: context,
306 barrierDismissible: false, 305 barrierDismissible: false,
307 // barrierColor: Colors.red, 306 // barrierColor: Colors.red,
@@ -403,7 +402,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -403,7 +402,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
403 color: MyColours.color_E7E7E7, 402 color: MyColours.color_E7E7E7,
404 ), 403 ),
405 VEmptyView(24), 404 VEmptyView(24),
406 - 405 +
407 if (couponProvider.couponSunModel!.isType == '1' || 406 if (couponProvider.couponSunModel!.isType == '1' ||
408 couponProvider.couponSunModel!.isType == '3' || 407 couponProvider.couponSunModel!.isType == '3' ||
409 couponProvider.couponSunModel!.isType == '4') 408 couponProvider.couponSunModel!.isType == '4')
@@ -411,7 +410,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -411,7 +410,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
411 children: [ 410 children: [
412 _canUse( 411 _canUse(
413 '是否核销', 412 '是否核销',
414 - couponProvider.couponSunModel!.isExamine == 413 + couponProvider
  414 + .couponSunModel!.isExamine ==
415 '1' 415 '1'
416 ? true 416 ? true
417 : false), 417 : false),
@@ -451,11 +451,11 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -451,11 +451,11 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
451 '券用途', 451 '券用途',
452 couponProvider.couponSunModel!.use!.isCash 452 couponProvider.couponSunModel!.use!.isCash
453 ? '代金券' 453 ? '代金券'
454 - : couponProvider  
455 - .couponSunModel!.use!.isDiscount 454 + : couponProvider.couponSunModel!.use!
  455 + .isDiscount
456 ? '折扣券' 456 ? '折扣券'
457 - : couponProvider  
458 - .couponSunModel!.use!.isDish 457 + : couponProvider.couponSunModel!
  458 + .use!.isDish
459 ? '菜品券' 459 ? '菜品券'
460 : ''), 460 : ''),
461 Container( 461 Container(
@@ -466,22 +466,24 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -466,22 +466,24 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
466 _item( 466 _item(
467 couponProvider.couponSunModel!.use!.isCash 467 couponProvider.couponSunModel!.use!.isCash
468 ? '金额' 468 ? '金额'
469 - : couponProvider  
470 - .couponSunModel!.use!.isDiscount 469 + : couponProvider.couponSunModel!.use!
  470 + .isDiscount
471 ? '折扣率' 471 ? '折扣率'
472 - : couponProvider  
473 - .couponSunModel!.use!.isDish 472 + : couponProvider.couponSunModel!
  473 + .use!.isDish
474 ? '菜品' 474 ? '菜品'
475 : '', 475 : '',
476 couponProvider.couponSunModel!.use!.isCash 476 couponProvider.couponSunModel!.use!.isCash
477 ? '${couponProvider.couponSunModel!.use!.cash}元' 477 ? '${couponProvider.couponSunModel!.use!.cash}元'
478 - : couponProvider  
479 - .couponSunModel!.use!.isDiscount 478 + : couponProvider.couponSunModel!.use!
  479 + .isDiscount
480 ? '${couponProvider.couponSunModel!.use!.discount}折' 480 ? '${couponProvider.couponSunModel!.use!.discount}折'
481 - : couponProvider  
482 - .couponSunModel!.use!.isDish 481 + : couponProvider.couponSunModel!
  482 + .use!.isDish
483 ? couponProvider 483 ? couponProvider
484 - .couponSunModel!.use!.dish! 484 + .couponSunModel!
  485 + .use!
  486 + .dish!
485 : ''), 487 : ''),
486 if (couponProvider 488 if (couponProvider
487 .couponSunModel!.use!.isDish && 489 .couponSunModel!.use!.isDish &&
@@ -505,7 +507,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -505,7 +507,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
505 couponProvider.couponSunModel!.isType == '1' || 507 couponProvider.couponSunModel!.isType == '1' ||
506 couponProvider.couponSunModel!.isType == 508 couponProvider.couponSunModel!.isType ==
507 '2' 509 '2'
508 - ? couponProvider.couponSunModel!.desc??'' 510 + ? couponProvider.couponSunModel!.desc ?? ''
509 : '消费满${couponProvider.couponSunModel!.desc}元可用'), 511 : '消费满${couponProvider.couponSunModel!.desc}元可用'),
510 Container( 512 Container(
511 height: ScreenUtil().setWidth(2), 513 height: ScreenUtil().setWidth(2),
@@ -533,8 +535,10 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -533,8 +535,10 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
533 VEmptyView(24), 535 VEmptyView(24),
534 if (couponProvider.couponSunModel!.isType == '3' || 536 if (couponProvider.couponSunModel!.isType == '3' ||
535 couponProvider.couponSunModel!.isType == '4') 537 couponProvider.couponSunModel!.isType == '4')
536 - _item('领取后有效天数',  
537 - couponProvider.couponSunModel!.aexpiration??''), 538 + _item(
  539 + '领取后有效天数',
  540 + couponProvider.couponSunModel!.aexpiration ??
  541 + ''),
538 542
539 if ((couponProvider.couponSunModel!.isType == '3' || 543 if ((couponProvider.couponSunModel!.isType == '3' ||
540 couponProvider.couponSunModel!.isType == 544 couponProvider.couponSunModel!.isType ==
@@ -548,8 +552,9 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -548,8 +552,9 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
548 VEmptyView(24), 552 VEmptyView(24),
549 _item( 553 _item(
550 '不可用日期', 554 '不可用日期',
551 - couponProvider  
552 - .couponSunModel!.expDate!.weekShow??''), 555 + couponProvider.couponSunModel!.expDate!
  556 + .weekShow ??
  557 + ''),
553 Container( 558 Container(
554 height: ScreenUtil().setWidth(2), 559 height: ScreenUtil().setWidth(2),
555 color: MyColours.color_E7E7E7, 560 color: MyColours.color_E7E7E7,
@@ -566,10 +571,11 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -566,10 +571,11 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
566 VEmptyView(24), 571 VEmptyView(24),
567 _item( 572 _item(
568 '使用限制', 573 '使用限制',
569 - couponProvider.couponSunModel!.expDate!.isNone 574 + couponProvider
  575 + .couponSunModel!.expDate!.isNone
570 ? '无' 576 ? '无'
571 - : couponProvider.couponSunModel!.expDate!  
572 - .isBirthday 577 + : couponProvider.couponSunModel!
  578 + .expDate!.isBirthday
573 ? '会员生日当天' 579 ? '会员生日当天'
574 : couponProvider.couponSunModel! 580 : couponProvider.couponSunModel!
575 .expDate!.isWeek 581 .expDate!.isWeek
@@ -582,8 +588,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -582,8 +588,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
582 child: Padding( 588 child: Padding(
583 padding: EdgeInsets.only(left: w(16)), 589 padding: EdgeInsets.only(left: w(16)),
584 child: Text( 590 child: Text(
585 - couponProvider  
586 - .couponSunModel!.expDate!.weekShow!, 591 + couponProvider.couponSunModel!
  592 + .expDate!.weekShow!,
587 textAlign: TextAlign.left, 593 textAlign: TextAlign.left,
588 style: TextStyle( 594 style: TextStyle(
589 height: 1.5, 595 height: 1.5,
@@ -635,8 +641,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -635,8 +641,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
635 children: [ 641 children: [
636 _canUse( 642 _canUse(
637 '领取当日可用', 643 '领取当日可用',
638 - couponProvider.couponSunModel!.arule!  
639 - .isSameDay), 644 + couponProvider.couponSunModel!
  645 + .arule!.isSameDay),
640 _canUse( 646 _canUse(
641 '可以叠加使用其他优惠券', 647 '可以叠加使用其他优惠券',
642 couponProvider.couponSunModel!.arule! 648 couponProvider.couponSunModel!.arule!
@@ -644,8 +650,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -644,8 +650,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
644 ), 650 ),
645 _canUse( 651 _canUse(
646 '可使用包间', 652 '可使用包间',
647 - couponProvider.couponSunModel!.arule!  
648 - .isCompartment), 653 + couponProvider.couponSunModel!
  654 + .arule!.isCompartment),
649 _canUse( 655 _canUse(
650 '堂食可用', 656 '堂食可用',
651 couponProvider 657 couponProvider
@@ -653,12 +659,12 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -653,12 +659,12 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
653 ), 659 ),
654 _canUse( 660 _canUse(
655 '外带可用', 661 '外带可用',
656 - couponProvider.couponSunModel!.arule!  
657 - .isTakeout), 662 + couponProvider.couponSunModel!
  663 + .arule!.isTakeout),
658 _canUse( 664 _canUse(
659 '是否需要提前预约', 665 '是否需要提前预约',
660 - couponProvider.couponSunModel!.arule!  
661 - .isAppointment), 666 + couponProvider.couponSunModel!
  667 + .arule!.isAppointment),
662 ], 668 ],
663 ), 669 ),
664 ), 670 ),
@@ -682,12 +688,12 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -682,12 +688,12 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
682 children: [ 688 children: [
683 _canUse( 689 _canUse(
684 '用户可以分享给好友', 690 '用户可以分享给好友',
685 - couponProvider.couponSunModel!.arule!  
686 - .isShareLose), 691 + couponProvider.couponSunModel!
  692 + .arule!.isShareLose),
687 _canUse( 693 _canUse(
688 '用户分享给好友后继续拥有此券', 694 '用户分享给好友后继续拥有此券',
689 - couponProvider  
690 - .couponSunModel!.arule!.isShareHave, 695 + couponProvider.couponSunModel!.arule!
  696 + .isShareHave,
691 ), 697 ),
692 // _canUse( 698 // _canUse(
693 // '分享核销后,分享用户获得佣金', 699 // '分享核销后,分享用户获得佣金',
@@ -756,8 +762,10 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -756,8 +762,10 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
756 : SizedBox(), 762 : SizedBox(),
757 couponProvider.couponSunModel!.explain != null && 763 couponProvider.couponSunModel!.explain != null &&
758 couponProvider.couponSunModel!.explain != '' 764 couponProvider.couponSunModel!.explain != ''
759 - ? _item('券说明',  
760 - couponProvider.couponSunModel!.explain??'') 765 + ? _item(
  766 + '券说明',
  767 + couponProvider.couponSunModel!.explain ??
  768 + '')
761 : SizedBox(), 769 : SizedBox(),
762 Container( 770 Container(
763 height: ScreenUtil().setWidth(2), 771 height: ScreenUtil().setWidth(2),
@@ -864,7 +872,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -864,7 +872,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
864 if (couponProvider.couponSunModel!.liteQrcode != null) 872 if (couponProvider.couponSunModel!.liteQrcode != null)
865 HEmptyView(30), 873 HEmptyView(30),
866 if (couponProvider.couponSunModel!.isType == '3' || 874 if (couponProvider.couponSunModel!.isType == '3' ||
867 - couponProvider.couponSunModel!.isType == '4') 875 + couponProvider.couponSunModel!.isType == '1')
868 RoundButton( 876 RoundButton(
869 text: '复用', 877 text: '复用',
870 width: w(100), 878 width: w(100),
@@ -877,19 +885,38 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -877,19 +885,38 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
877 isBold: true, 885 isBold: true,
878 fontSize: 28, 886 fontSize: 28,
879 onPressed: () async { 887 onPressed: () async {
880 - //复用,跳转至编辑页面  
881 - dynamic needRefresh =  
882 - await NavigatorUtil.goCouponEditPage(context,  
883 - isMine:  
884 - couponProvider.couponSunModel!.isType ==  
885 - '4'  
886 - ? false  
887 - : true,  
888 - couponSunModel:  
889 - couponProvider.couponSunModel);  
890 - if (needRefresh != null && needRefresh) {  
891 - if (Navigator.canPop(context)) {  
892 - Navigator.pop(context); 888 + if (couponProvider.couponSunModel!.isType == '3') {
  889 + //复用,跳转至编辑页面
  890 + dynamic needRefresh =
  891 + await NavigatorUtil.goCouponEditPage(context,
  892 + isMine: couponProvider
  893 + .couponSunModel!.isType ==
  894 + '1'
  895 + ? false
  896 + : true,
  897 + couponSunModel:
  898 + couponProvider.couponSunModel);
  899 + if (needRefresh != null && needRefresh) {
  900 + if (Navigator.canPop(context)) {
  901 + Navigator.pop(context);
  902 + }
  903 + }
  904 + } else {
  905 + //复用,跳转至编辑页面
  906 + dynamic needRefresh =
  907 + await NavigatorUtil.goCouponEditPayPage(
  908 + context,
  909 + isMine: couponProvider
  910 + .couponSunModel!.isType ==
  911 + '1'
  912 + ? false
  913 + : true,
  914 + couponSunModel:
  915 + couponProvider.couponSunModel);
  916 + if (needRefresh != null && needRefresh) {
  917 + if (Navigator.canPop(context)) {
  918 + Navigator.pop(context);
  919 + }
893 } 920 }
894 } 921 }
895 }, 922 },
@@ -908,7 +935,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -908,7 +935,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
908 return; 935 return;
909 } 936 }
910 if (couponProvider.couponSunModel!.status == '1') { 937 if (couponProvider.couponSunModel!.status == '1') {
911 - if (couponProvider.couponSunModel!.isType == '3') { 938 + if (couponProvider.couponSunModel!.isType ==
  939 + '3') {
912 Utils.goShareBuyCouponToWeChat( 940 Utils.goShareBuyCouponToWeChat(
913 context, 941 context,
914 widget.idstr, 942 widget.idstr,
@@ -6,6 +6,7 @@ import 'package:flutter/services.dart'; @@ -6,6 +6,7 @@ import 'package:flutter/services.dart';
6 // import 'package:flutter_picker_plus/flutter_picker_plus.dart'; 6 // import 'package:flutter_picker_plus/flutter_picker_plus.dart';
7 import 'package:flutter_picker_plus/flutter_picker_plus.dart'; 7 import 'package:flutter_picker_plus/flutter_picker_plus.dart';
8 import 'package:flutter_screenutil/flutter_screenutil.dart'; 8 import 'package:flutter_screenutil/flutter_screenutil.dart';
  9 +import 'package:one_key/models/meal_day_date_model.dart';
9 10
10 import 'package:one_key/provider/coupon_provider.dart'; 11 import 'package:one_key/provider/coupon_provider.dart';
11 import 'package:one_key/provider/user_model.dart'; 12 import 'package:one_key/provider/user_model.dart';
@@ -24,6 +25,7 @@ import 'package:provider/provider.dart'; @@ -24,6 +25,7 @@ import 'package:provider/provider.dart';
24 import '../../models/coupon_model.dart'; 25 import '../../models/coupon_model.dart';
25 import '../../models/filter_btn_model.dart'; 26 import '../../models/filter_btn_model.dart';
26 import '../../models/upload_img_model.dart'; 27 import '../../models/upload_img_model.dart';
  28 +import '../../provider/store_base_info_provider.dart';
27 import '../../provider/upload_img_provider.dart'; 29 import '../../provider/upload_img_provider.dart';
28 import '../../utils/screen_util.dart'; 30 import '../../utils/screen_util.dart';
29 import '../../utils/upload_image_util.dart'; 31 import '../../utils/upload_image_util.dart';
@@ -94,10 +96,11 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -94,10 +96,11 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
94 List<FilterBtnModel> weekData = []; 96 List<FilterBtnModel> weekData = [];
95 97
96 // morning == "00:00-00:00" 98 // morning == "00:00-00:00"
97 - String? morning;  
98 - String? noon;  
99 - String? night;  
100 - 99 + // String morning = "00:00-00:00";
  100 + // String noon = "00:00-00:00";
  101 + // String night = "00:00-00:00";
  102 + // String meal1 = "00:00-00:00";
  103 + // String meal2 = "00:00-00:00";
101 UploadImageProvider? _uploadImageProvider; 104 UploadImageProvider? _uploadImageProvider;
102 List<UploadImgModel> img = []; 105 List<UploadImgModel> img = [];
103 106
@@ -117,6 +120,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -117,6 +120,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
117 bool isShareHave = true; //分享好友后继续拥有此券 120 bool isShareHave = true; //分享好友后继续拥有此券
118 // bool isCommission = true; //返佣金 121 // bool isCommission = true; //返佣金
119 122
  123 + late StoreBaseIndoProvider storeBaseIndoProvider;
  124 +
120 @override 125 @override
121 void initState() { 126 void initState() {
122 super.initState(); 127 super.initState();
@@ -220,6 +225,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -220,6 +225,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
220 swichState = widget.couponSunModel!.status == '1' ? true : false; 225 swichState = widget.couponSunModel!.status == '1' ? true : false;
221 _priceControl.text = widget.couponSunModel!.price; 226 _priceControl.text = widget.couponSunModel!.price;
222 _limitDay.text = widget.couponSunModel!.aexpiration ?? ''; 227 _limitDay.text = widget.couponSunModel!.aexpiration ?? '';
  228 +
223 229
224 isSameDay = widget.couponSunModel!.arule!.isSameDay; 230 isSameDay = widget.couponSunModel!.arule!.isSameDay;
225 isAccumulation = widget.couponSunModel!.arule!.isAccumulation; 231 isAccumulation = widget.couponSunModel!.arule!.isAccumulation;
@@ -266,6 +272,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -266,6 +272,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
266 272
267 WidgetsBinding.instance.addPostFrameCallback((_) { 273 WidgetsBinding.instance.addPostFrameCallback((_) {
268 // _couponNetworkData(0); 274 // _couponNetworkData(0);
  275 + getMealSectionByDay();
269 if (weekData.length == 0) { 276 if (weekData.length == 0) {
270 _initWeekData(); 277 _initWeekData();
271 } 278 }
@@ -281,6 +288,16 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -281,6 +288,16 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
281 _uploadImageProvider!.qiniuInfoSunModel!.token = null; 288 _uploadImageProvider!.qiniuInfoSunModel!.token = null;
282 } 289 }
283 290
  291 + getMealSectionByDay({bool showLoading = false}) async {
  292 + Map<String, String?> pramas = {
  293 + 'sellerid': Provider.of<UserModel>(context, listen: false).user!.sellerid,
  294 + 'day':
  295 + '${DateTime.now().year}-${Utils.addZeroNumber(DateTime.now().month)}-${Utils.addZeroNumber(DateTime.now().day)}'
  296 + };
  297 + await storeBaseIndoProvider.getMealSectionByDay(context, pramas,
  298 + showLoading: showLoading);
  299 + }
  300 +
284 ///获取七牛云token 301 ///获取七牛云token
285 /// 302 ///
286 _getQiniuInfo() async { 303 _getQiniuInfo() async {
@@ -861,6 +878,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -861,6 +878,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
861 couponProvider = Provider.of<CouponProvider>(context, listen: true); 878 couponProvider = Provider.of<CouponProvider>(context, listen: true);
862 _uploadImageProvider = 879 _uploadImageProvider =
863 Provider.of<UploadImageProvider>(context, listen: true); 880 Provider.of<UploadImageProvider>(context, listen: true);
  881 +
  882 + storeBaseIndoProvider =
  883 + Provider.of<StoreBaseIndoProvider>(context, listen: true);
864 return Scaffold( 884 return Scaffold(
865 backgroundColor: MyColours.color_ffffff, 885 backgroundColor: MyColours.color_ffffff,
866 key: scaffoldKey, 886 key: scaffoldKey,
@@ -1242,51 +1262,185 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1242,51 +1262,185 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1242 VEmptyView(24), 1262 VEmptyView(24),
1243 1263
1244 _select('不可用日期', weekShow, () async { 1264 _select('不可用日期', weekShow, () async {
  1265 + if (storeBaseIndoProvider.dayDateData == null ||
  1266 + storeBaseIndoProvider.dayDateData?.length ==
  1267 + 0) {
  1268 + await getMealSectionByDay(showLoading: true);
  1269 + }
1245 FocusScope.of(context) 1270 FocusScope.of(context)
1246 .requestFocus(FocusNode()); //点击空白处隐藏键盘 1271 .requestFocus(FocusNode()); //点击空白处隐藏键盘
1247 //弹出时间选择器 1272 //弹出时间选择器
1248 // showPickerDateTime(context); 1273 // showPickerDateTime(context);
1249 showDateSelWidget = false; 1274 showDateSelWidget = false;
1250 1275
1251 - List<FilterBtnModel> data = await DialogUtil 1276 + List<FilterBtnModel>? data = await DialogUtil
1252 .openCoponsWeekSelectModalBottomSheet( 1277 .openCoponsWeekSelectModalBottomSheet(
1253 - context, weekData); 1278 + context,
  1279 + weekData,
  1280 + storeBaseIndoProvider.dayDateData ??
  1281 + []);
1254 if (data != null) { 1282 if (data != null) {
1255 //改变了 1283 //改变了
1256 weekData = []; 1284 weekData = [];
1257 weekData.addAll(data); 1285 weekData.addAll(data);
1258 weekShow = ''; 1286 weekShow = '';
1259 1287
1260 - String noonStr = '午餐:';  
1261 - String nightStr = '晚餐:'; 1288 + if (weekData.every((e) =>
  1289 + e.selectMor == false &&
  1290 + e.selectNoon == false &&
  1291 + e.selectNig == false &&
  1292 + e.selectMeal1 == false &&
  1293 + e.selectMeal2 == false)) {
  1294 + weekShow = '无';
  1295 + } else {
  1296 + String? morStr;
  1297 + if (weekData
  1298 + .any((e) => e.selectMor == true)) {
  1299 + //有选中的早餐
  1300 + List<MealDayDateSunModel>? mortemp =
  1301 + storeBaseIndoProvider.dayDateData
  1302 + ?.where((e) => e.ddateSolt == '1')
  1303 + .toList();
  1304 +
  1305 + morStr = (mortemp != null &&
  1306 + mortemp.length > 0)
  1307 + ? '${mortemp[0].mname}:'
  1308 + : '早餐:';
  1309 + }
1262 1310
1263 - weekData.forEach((element) {  
1264 - if (element.selectNoon!) {  
1265 - noonStr += '${element.title} '; 1311 + String? noonStr;
  1312 + if (weekData
  1313 + .any((e) => e.selectNoon == true)) {
  1314 + //有选中的午餐
  1315 + List<MealDayDateSunModel>? mortemp =
  1316 + storeBaseIndoProvider.dayDateData
  1317 + ?.where((e) => e.ddateSolt == '2')
  1318 + .toList();
  1319 +
  1320 + noonStr = (mortemp != null &&
  1321 + mortemp.length > 0)
  1322 + ? '${mortemp[0].mname}:'
  1323 + : '午餐:';
1266 } 1324 }
1267 - if (element.selectNig!) {  
1268 - nightStr += '${element.title} '; 1325 + String? nigStr;
  1326 + if (weekData
  1327 + .any((e) => e.selectNig == true)) {
  1328 + //有选中的晚餐
  1329 + List<MealDayDateSunModel>? mortemp =
  1330 + storeBaseIndoProvider.dayDateData
  1331 + ?.where((e) => e.ddateSolt == '3')
  1332 + .toList();
  1333 +
  1334 + nigStr = (mortemp != null &&
  1335 + mortemp.length > 0)
  1336 + ? '${mortemp[0].mname}:'
  1337 + : '晚餐:';
  1338 + }
  1339 + String? meal1Str;
  1340 + if (weekData
  1341 + .any((e) => e.selectMeal1 == true)) {
  1342 + //有选中的晚餐1
  1343 + List<MealDayDateSunModel>? mortemp =
  1344 + storeBaseIndoProvider.dayDateData
  1345 + ?.where((e) => e.ddateSolt == '4')
  1346 + .toList();
  1347 +
  1348 + meal1Str = (mortemp != null &&
  1349 + mortemp.length > 0)
  1350 + ? '${mortemp[0].mname}:'
  1351 + : '晚餐1:';
  1352 + }
  1353 + String? meal2Str;
  1354 + if (weekData
  1355 + .any((e) => e.selectMeal2 == true)) {
  1356 + //有选中的晚餐2
  1357 + List<MealDayDateSunModel>? mortemp =
  1358 + storeBaseIndoProvider.dayDateData
  1359 + ?.where((e) => e.ddateSolt == '5')
  1360 + .toList();
  1361 +
  1362 + meal2Str = (mortemp != null &&
  1363 + mortemp.length > 0)
  1364 + ? '${mortemp[0].mname}:'
  1365 + : '晚餐2:';
1269 } 1366 }
1270 - });  
1271 - if (noonStr.endsWith(' ')) {  
1272 - noonStr = noonStr.substring(  
1273 - 0, noonStr.length - 1);  
1274 - }  
1275 - if (nightStr.endsWith(' ')) {  
1276 - nightStr = nightStr.substring(  
1277 - 0, nightStr.length - 1);  
1278 - }  
1279 1367
1280 - if (noonStr == '午餐:' && nightStr == '晚餐:') {  
1281 - weekShow = '无';  
1282 - } else {  
1283 - if (noonStr != '午餐:' && nightStr != '晚餐:') {  
1284 - weekShow = noonStr + '\n' + nightStr;  
1285 - } else if (noonStr != '午餐:') {  
1286 - weekShow = noonStr;  
1287 - } else {  
1288 - weekShow = nightStr; 1368 + weekData.forEach((element) {
  1369 + if (morStr != null &&
  1370 + element.selectMor!) {
  1371 + morStr = morStr! + '${element.title} ';
  1372 + }
  1373 + if (noonStr != null &&
  1374 + element.selectNoon!) {
  1375 + noonStr =
  1376 + noonStr! + '${element.title} ';
  1377 + }
  1378 + if (nigStr != null &&
  1379 + element.selectNig!) {
  1380 + nigStr = nigStr! + '${element.title} ';
  1381 + }
  1382 + if (meal1Str != null &&
  1383 + element.selectMeal1!) {
  1384 + meal1Str =
  1385 + meal1Str! + '${element.title} ';
  1386 + }
  1387 + if (meal2Str != null &&
  1388 + element.selectMeal2!) {
  1389 + meal2Str =
  1390 + meal2Str! + '${element.title} ';
  1391 + }
  1392 + });
  1393 + if (morStr != null) {
  1394 + if (morStr!.endsWith(' ')) {
  1395 + morStr = morStr!
  1396 + .substring(0, morStr!.length - 1);
  1397 + }
  1398 + }
  1399 + if (noonStr != null) {
  1400 + if (noonStr!.endsWith(' ')) {
  1401 + noonStr = noonStr!
  1402 + .substring(0, noonStr!.length - 1);
  1403 + }
  1404 + }
  1405 + if (nigStr != null) {
  1406 + if (nigStr!.endsWith(' ')) {
  1407 + nigStr = nigStr!
  1408 + .substring(0, nigStr!.length - 1);
  1409 + }
  1410 + }
  1411 + if (meal1Str != null) {
  1412 + if (meal1Str!.endsWith(' ')) {
  1413 + meal1Str = meal1Str!
  1414 + .substring(0, meal1Str!.length - 1);
  1415 + }
  1416 + }
  1417 +
  1418 + if (meal2Str != null) {
  1419 + if (meal2Str!.endsWith(' ')) {
  1420 + meal2Str = meal2Str!
  1421 + .substring(0, meal2Str!.length - 1);
  1422 + }
  1423 + }
  1424 +
  1425 + String show = '';
  1426 +
  1427 + if (morStr != null) {
  1428 + show += morStr!;
1289 } 1429 }
  1430 + if (noonStr != null) {
  1431 + show += ('\n' + noonStr!);
  1432 + }
  1433 + if (nigStr != null) {
  1434 + show += ('\n' + nigStr!);
  1435 + }
  1436 + if (meal1Str != null) {
  1437 + show += ('\n' + meal1Str!);
  1438 + }
  1439 + if (meal2Str != null) {
  1440 + show += ('\n' + meal2Str!);
  1441 + }
  1442 +
  1443 + weekShow = show;
1290 } 1444 }
1291 1445
1292 setState(() {}); 1446 setState(() {});
@@ -1608,7 +1762,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1608,7 +1762,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1608 return; 1762 return;
1609 } 1763 }
1610 // 券开始早于活动开始 && 券结束大于活动结束 1764 // 券开始早于活动开始 && 券结束大于活动结束
1611 - if (widget.from != null&& widget.from != 'null') { 1765 + if (widget.from != null && widget.from != 'null') {
1612 if (DateUtil.getDateTime(fromDate) 1766 if (DateUtil.getDateTime(fromDate)
1613 .compareTo(DateUtil.getDateTime(widget.from!)) > 1767 .compareTo(DateUtil.getDateTime(widget.from!)) >
1614 0) { 1768 0) {
@@ -24,7 +24,9 @@ import 'package:provider/provider.dart'; @@ -24,7 +24,9 @@ import 'package:provider/provider.dart';
24 24
25 import '../../models/coupon_model.dart'; 25 import '../../models/coupon_model.dart';
26 import '../../models/filter_btn_model.dart'; 26 import '../../models/filter_btn_model.dart';
  27 +import '../../models/meal_day_date_model.dart';
27 import '../../models/upload_img_model.dart'; 28 import '../../models/upload_img_model.dart';
  29 +import '../../provider/store_base_info_provider.dart';
28 import '../../provider/upload_img_provider.dart'; 30 import '../../provider/upload_img_provider.dart';
29 import '../../utils/screen_util.dart'; 31 import '../../utils/screen_util.dart';
30 import '../../utils/upload_image_util.dart'; 32 import '../../utils/upload_image_util.dart';
@@ -84,15 +86,19 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -84,15 +86,19 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
84 List<FilterBtnModel> weekData = []; 86 List<FilterBtnModel> weekData = [];
85 87
86 // morning == "00:00-00:00" 88 // morning == "00:00-00:00"
87 - String? morning;  
88 - String? noon;  
89 - String? night; 89 + // String morning = "00:00-00:00";
  90 + // String noon = "00:00-00:00";
  91 + // String night = "00:00-00:00";
  92 + // String meal1 = "00:00-00:00";
  93 + // String meal2 = "00:00-00:00";
90 94
91 UploadImageProvider? _uploadImageProvider; 95 UploadImageProvider? _uploadImageProvider;
92 List<UploadImgModel> img = []; 96 List<UploadImgModel> img = [];
93 97
94 List<String> imgAll = []; 98 List<String> imgAll = [];
95 99
  100 + late StoreBaseIndoProvider storeBaseIndoProvider;
  101 +
96 @override 102 @override
97 void initState() { 103 void initState() {
98 super.initState(); 104 super.initState();
@@ -233,6 +239,7 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -233,6 +239,7 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
233 239
234 WidgetsBinding.instance.addPostFrameCallback((_) { 240 WidgetsBinding.instance.addPostFrameCallback((_) {
235 // _couponNetworkData(0); 241 // _couponNetworkData(0);
  242 + getMealSectionByDay();
236 if (weekData.length == 0) { 243 if (weekData.length == 0) {
237 _initWeekData(); 244 _initWeekData();
238 } 245 }
@@ -248,6 +255,18 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -248,6 +255,18 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
248 _uploadImageProvider!.qiniuInfoSunModel!.token = null; 255 _uploadImageProvider!.qiniuInfoSunModel!.token = null;
249 } 256 }
250 257
  258 + getMealSectionByDay({bool needInit = true, bool showLoading = false}) async {
  259 + Map<String, String?> pramas = {
  260 + 'sellerid': Provider.of<UserModel>(context, listen: false).user!.sellerid,
  261 + 'day':
  262 + '${DateTime.now().year}-${Utils.addZeroNumber(DateTime.now().month)}-${Utils.addZeroNumber(DateTime.now().day)}'
  263 + };
  264 + await storeBaseIndoProvider.getMealSectionByDay(context, pramas,
  265 + showLoading: showLoading);
  266 +
  267 +
  268 + }
  269 +
251 ///获取七牛云token 270 ///获取七牛云token
252 /// 271 ///
253 _getQiniuInfo() async { 272 _getQiniuInfo() async {
@@ -407,10 +426,11 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -407,10 +426,11 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
407 //输入文本的样式 426 //输入文本的样式
408 inputFormatters: title == '券名称' 427 inputFormatters: title == '券名称'
409 ? [LengthLimitingTextInputFormatter(15)] 428 ? [LengthLimitingTextInputFormatter(15)]
410 - :title == '销售价'? [  
411 - FilteringTextInputFormatter.allow(  
412 - RegExp("[0-9.]")),  
413 - ]: [], 429 + : title == '销售价'
  430 + ? [
  431 + FilteringTextInputFormatter.allow(RegExp("[0-9.]")),
  432 + ]
  433 + : [],
414 style: TextStyle( 434 style: TextStyle(
415 color: MyColours.color_515151, 435 color: MyColours.color_515151,
416 fontSize: ScreenUtil().setSp(32), 436 fontSize: ScreenUtil().setSp(32),
@@ -773,6 +793,8 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -773,6 +793,8 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
773 couponProvider = Provider.of<CouponProvider>(context, listen: true); 793 couponProvider = Provider.of<CouponProvider>(context, listen: true);
774 _uploadImageProvider = 794 _uploadImageProvider =
775 Provider.of<UploadImageProvider>(context, listen: true); 795 Provider.of<UploadImageProvider>(context, listen: true);
  796 + storeBaseIndoProvider =
  797 + Provider.of<StoreBaseIndoProvider>(context, listen: true);
776 return Scaffold( 798 return Scaffold(
777 backgroundColor: MyColours.color_ffffff, 799 backgroundColor: MyColours.color_ffffff,
778 key: scaffoldKey, 800 key: scaffoldKey,
@@ -1200,54 +1222,207 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -1200,54 +1222,207 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
1200 1222
1201 if (limitWeek) 1223 if (limitWeek)
1202 _select1(weekShow, '', () async { 1224 _select1(weekShow, '', () async {
  1225 + if (storeBaseIndoProvider.dayDateData ==
  1226 + null ||
  1227 + storeBaseIndoProvider
  1228 + .dayDateData?.length ==
  1229 + 0) {
  1230 + await getMealSectionByDay(
  1231 + showLoading: true);
  1232 + }
1203 FocusScope.of(context).requestFocus( 1233 FocusScope.of(context).requestFocus(
1204 FocusNode()); //点击空白处隐藏键盘 1234 FocusNode()); //点击空白处隐藏键盘
1205 //弹出时间选择器 1235 //弹出时间选择器
1206 // showPickerDateTime(context); 1236 // showPickerDateTime(context);
1207 showDateSelWidget = false; 1237 showDateSelWidget = false;
1208 1238
1209 - List<FilterBtnModel> data = await DialogUtil  
1210 - .openCoponsWeekSelectModalBottomSheet(  
1211 - context, weekData); 1239 + List<FilterBtnModel>? data =
  1240 + await DialogUtil
  1241 + .openCoponsWeekSelectModalBottomSheet(
  1242 + context,
  1243 + weekData,
  1244 + storeBaseIndoProvider
  1245 + .dayDateData ??
  1246 + []);
1212 if (data != null) { 1247 if (data != null) {
1213 //改变了 1248 //改变了
1214 weekData = []; 1249 weekData = [];
1215 weekData.addAll(data); 1250 weekData.addAll(data);
1216 weekShow = ''; 1251 weekShow = '';
1217 1252
1218 - String noonStr = '午餐:';  
1219 - String nightStr = '晚餐:'; 1253 + if (weekData.every((e) =>
  1254 + e.selectMor == false &&
  1255 + e.selectNoon == false &&
  1256 + e.selectNig == false &&
  1257 + e.selectMeal1 == false &&
  1258 + e.selectMeal2 == false)) {
  1259 + weekShow = '无';
  1260 + } else {
  1261 + String? morStr;
  1262 + if (weekData.any(
  1263 + (e) => e.selectMor == true)) {
  1264 + //有选中的早餐
  1265 + List<MealDayDateSunModel>?
  1266 + mortemp =
  1267 + storeBaseIndoProvider
  1268 + .dayDateData
  1269 + ?.where((e) =>
  1270 + e.ddateSolt == '1')
  1271 + .toList();
  1272 +
  1273 + morStr = (mortemp != null &&
  1274 + mortemp.length > 0)
  1275 + ? '${mortemp[0].mname}:'
  1276 + : '早餐:';
  1277 + }
1220 1278
1221 - weekData.forEach((element) {  
1222 - if (element.selectNoon!) {  
1223 - noonStr += '${element.title} '; 1279 + String? noonStr;
  1280 + if (weekData.any(
  1281 + (e) => e.selectNoon == true)) {
  1282 + //有选中的午餐
  1283 + List<MealDayDateSunModel>?
  1284 + mortemp =
  1285 + storeBaseIndoProvider
  1286 + .dayDateData
  1287 + ?.where((e) =>
  1288 + e.ddateSolt == '2')
  1289 + .toList();
  1290 +
  1291 + noonStr = (mortemp != null &&
  1292 + mortemp.length > 0)
  1293 + ? '${mortemp[0].mname}:'
  1294 + : '午餐:';
1224 } 1295 }
1225 - if (element.selectNig!) {  
1226 - nightStr += '${element.title} '; 1296 + String? nigStr;
  1297 + if (weekData.any(
  1298 + (e) => e.selectNig == true)) {
  1299 + //有选中的晚餐
  1300 + List<MealDayDateSunModel>?
  1301 + mortemp =
  1302 + storeBaseIndoProvider
  1303 + .dayDateData
  1304 + ?.where((e) =>
  1305 + e.ddateSolt == '3')
  1306 + .toList();
  1307 +
  1308 + nigStr = (mortemp != null &&
  1309 + mortemp.length > 0)
  1310 + ? '${mortemp[0].mname}:'
  1311 + : '晚餐:';
  1312 + }
  1313 + String? meal1Str;
  1314 + if (weekData.any(
  1315 + (e) => e.selectMeal1 == true)) {
  1316 + //有选中的晚餐1
  1317 + List<MealDayDateSunModel>?
  1318 + mortemp =
  1319 + storeBaseIndoProvider
  1320 + .dayDateData
  1321 + ?.where((e) =>
  1322 + e.ddateSolt == '4')
  1323 + .toList();
  1324 +
  1325 + meal1Str = (mortemp != null &&
  1326 + mortemp.length > 0)
  1327 + ? '${mortemp[0].mname}:'
  1328 + : '晚餐1:';
  1329 + }
  1330 + String? meal2Str;
  1331 + if (weekData.any(
  1332 + (e) => e.selectMeal2 == true)) {
  1333 + //有选中的晚餐2
  1334 + List<MealDayDateSunModel>?
  1335 + mortemp =
  1336 + storeBaseIndoProvider
  1337 + .dayDateData
  1338 + ?.where((e) =>
  1339 + e.ddateSolt == '5')
  1340 + .toList();
  1341 +
  1342 + meal2Str = (mortemp != null &&
  1343 + mortemp.length > 0)
  1344 + ? '${mortemp[0].mname}:'
  1345 + : '晚餐2:';
1227 } 1346 }
1228 - });  
1229 - if (noonStr.endsWith(' ')) {  
1230 - noonStr = noonStr.substring(  
1231 - 0, noonStr.length - 1);  
1232 - }  
1233 - if (nightStr.endsWith(' ')) {  
1234 - nightStr = nightStr.substring(  
1235 - 0, nightStr.length - 1);  
1236 - }  
1237 1347
1238 - if (noonStr == '午餐:' &&  
1239 - nightStr == '晚餐:') {  
1240 - weekShow = '点击设置可用日期';  
1241 - } else {  
1242 - if (noonStr != '午餐:' &&  
1243 - nightStr != '晚餐:') {  
1244 - weekShow =  
1245 - noonStr + '\n' + nightStr;  
1246 - } else if (noonStr != '午餐:') {  
1247 - weekShow = noonStr;  
1248 - } else {  
1249 - weekShow = nightStr; 1348 + weekData.forEach((element) {
  1349 + if (morStr != null &&
  1350 + element.selectMor!) {
  1351 + morStr = morStr! +
  1352 + '${element.title} ';
  1353 + }
  1354 + if (noonStr != null &&
  1355 + element.selectNoon!) {
  1356 + noonStr = noonStr! +
  1357 + '${element.title} ';
  1358 + }
  1359 + if (nigStr != null &&
  1360 + element.selectNig!) {
  1361 + nigStr = nigStr! +
  1362 + '${element.title} ';
  1363 + }
  1364 + if (meal1Str != null &&
  1365 + element.selectMeal1!) {
  1366 + meal1Str = meal1Str! +
  1367 + '${element.title} ';
  1368 + }
  1369 + if (meal2Str != null &&
  1370 + element.selectMeal2!) {
  1371 + meal2Str = meal2Str! +
  1372 + '${element.title} ';
  1373 + }
  1374 + });
  1375 + if (morStr != null) {
  1376 + if (morStr!.endsWith(' ')) {
  1377 + morStr = morStr!.substring(
  1378 + 0, morStr!.length - 1);
  1379 + }
1250 } 1380 }
  1381 + if (noonStr != null) {
  1382 + if (noonStr!.endsWith(' ')) {
  1383 + noonStr = noonStr!.substring(
  1384 + 0, noonStr!.length - 1);
  1385 + }
  1386 + }
  1387 + if (nigStr != null) {
  1388 + if (nigStr!.endsWith(' ')) {
  1389 + nigStr = nigStr!.substring(
  1390 + 0, nigStr!.length - 1);
  1391 + }
  1392 + }
  1393 + if (meal1Str != null) {
  1394 + if (meal1Str!.endsWith(' ')) {
  1395 + meal1Str = meal1Str!.substring(
  1396 + 0, meal1Str!.length - 1);
  1397 + }
  1398 + }
  1399 +
  1400 + if (meal2Str != null) {
  1401 + if (meal2Str!.endsWith(' ')) {
  1402 + meal2Str = meal2Str!.substring(
  1403 + 0, meal2Str!.length - 1);
  1404 + }
  1405 + }
  1406 +
  1407 + String show = '';
  1408 +
  1409 + if (morStr != null) {
  1410 + show += morStr!;
  1411 + }
  1412 + if (noonStr != null) {
  1413 + show += ('\n' + noonStr!);
  1414 + }
  1415 + if (nigStr != null) {
  1416 + show += ('\n' + nigStr!);
  1417 + }
  1418 + if (meal1Str != null) {
  1419 + show += ('\n' + meal1Str!);
  1420 + }
  1421 + if (meal2Str != null) {
  1422 + show += ('\n' + meal2Str!);
  1423 + }
  1424 +
  1425 + weekShow = show;
1251 } 1426 }
1252 1427
1253 setState(() {}); 1428 setState(() {});
@@ -902,11 +902,13 @@ var handleCouponEditPageHandler = new Handler( @@ -902,11 +902,13 @@ var handleCouponEditPageHandler = new Handler(
902 902
903 return ChangeNotifierProvider<UploadImageProvider>( 903 return ChangeNotifierProvider<UploadImageProvider>(
904 create: (_) => UploadImageProvider(), 904 create: (_) => UploadImageProvider(),
905 - child: CouponEidtPage(  
906 - isMine: isMine,  
907 - from: from,  
908 - end: end,  
909 - couponSunModel: couponSunModel)); 905 + child: ChangeNotifierProvider<StoreBaseIndoProvider>(
  906 + create: (_) => StoreBaseIndoProvider(),
  907 + child: CouponEidtPage(
  908 + isMine: isMine,
  909 + from: from,
  910 + end: end,
  911 + couponSunModel: couponSunModel)));
910 }); 912 });
911 913
912 ///选择优惠券 914 ///选择优惠券
@@ -4115,7 +4117,10 @@ var couponEidtPayPageHandle = new Handler( @@ -4115,7 +4117,10 @@ var couponEidtPayPageHandle = new Handler(
4115 4117
4116 return ChangeNotifierProvider<UploadImageProvider>( 4118 return ChangeNotifierProvider<UploadImageProvider>(
4117 create: (_) => UploadImageProvider(), 4119 create: (_) => UploadImageProvider(),
4118 - child: CouponEidtPayPage(isMine: false, couponSunModel: couponSunModel)); 4120 + child: ChangeNotifierProvider<StoreBaseIndoProvider>(
  4121 + create: (_) => StoreBaseIndoProvider(),
  4122 + child: CouponEidtPayPage(
  4123 + isMine: false, couponSunModel: couponSunModel)));
4119 }); 4124 });
4120 4125
4121 ///收银管理首页 4126 ///收银管理首页
@@ -4254,8 +4259,8 @@ var paymentGiftSelectPageHandle = new Handler( @@ -4254,8 +4259,8 @@ var paymentGiftSelectPageHandle = new Handler(
4254 FluroConvertUtils.string2bool(params["mulSelect"]!.first as String); 4259 FluroConvertUtils.string2bool(params["mulSelect"]!.first as String);
4255 // NotebookDetail detailEntity = NotebookDetail.fromJson(json 4260 // NotebookDetail detailEntity = NotebookDetail.fromJson(json
4256 // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); 4261 // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first)));
4257 - return ChangeNotifierProvider< FinanceProvider>(  
4258 - create: (_) => FinanceProvider(), 4262 + return ChangeNotifierProvider<FinanceProvider>(
  4263 + create: (_) => FinanceProvider(),
4259 child: PaymentGiftSelectPage( 4264 child: PaymentGiftSelectPage(
4260 type: type, 4265 type: type,
4261 couponList: res, 4266 couponList: res,
@@ -4267,8 +4272,8 @@ var paymentGiftSelectPageHandle = new Handler( @@ -4267,8 +4272,8 @@ var paymentGiftSelectPageHandle = new Handler(
4267 ///企业资料上传 4272 ///企业资料上传
4268 var enterpriseInformationUploadPageHandle = new Handler( 4273 var enterpriseInformationUploadPageHandle = new Handler(
4269 handlerFunc: (BuildContext? context, Map<dynamic, List<Object>> params) { 4274 handlerFunc: (BuildContext? context, Map<dynamic, List<Object>> params) {
4270 - return ChangeNotifierProvider< FinanceProvider>(  
4271 - create: (_) => FinanceProvider(), 4275 + return ChangeNotifierProvider<FinanceProvider>(
  4276 + create: (_) => FinanceProvider(),
4272 child: ChangeNotifierProvider<UploadImageProvider>( 4277 child: ChangeNotifierProvider<UploadImageProvider>(
4273 create: (_) => UploadImageProvider(), 4278 create: (_) => UploadImageProvider(),
4274 child: EnterpriseInformationUploadPage())); 4279 child: EnterpriseInformationUploadPage()));
@@ -44,6 +44,7 @@ import '../models/all_cuisine.dart'; @@ -44,6 +44,7 @@ import '../models/all_cuisine.dart';
44 import '../models/cookbook_model.dart'; 44 import '../models/cookbook_model.dart';
45 import '../models/customer_label_model.dart'; 45 import '../models/customer_label_model.dart';
46 import '../models/get_reserve_type_field_model.dart'; 46 import '../models/get_reserve_type_field_model.dart';
  47 +import '../models/meal_day_date_model.dart';
47 import '../models/radio_model.dart'; 48 import '../models/radio_model.dart';
48 import '../models/seller_template_color_list_model.dart'; 49 import '../models/seller_template_color_list_model.dart';
49 import '../models/seller_user_account_type.dart'; 50 import '../models/seller_user_account_type.dart';
@@ -2655,13 +2656,44 @@ class DialogUtil { @@ -2655,13 +2656,44 @@ class DialogUtil {
2655 } 2656 }
2656 2657
2657 ///优惠券每周早餐午餐晚餐选择 2658 ///优惠券每周早餐午餐晚餐选择
2658 - static openCoponsWeekSelectModalBottomSheet(  
2659 - context, List<FilterBtnModel> weekData, 2659 + static openCoponsWeekSelectModalBottomSheet(context,
  2660 + List<FilterBtnModel> weekData, List<MealDayDateSunModel> dayDateData,
2660 {VoidCallback? lCallback, VoidCallback? rCallback}) async { 2661 {VoidCallback? lCallback, VoidCallback? rCallback}) async {
2661 List<FilterBtnModel> data = weekData.map((e) { 2662 List<FilterBtnModel> data = weekData.map((e) {
2662 return FilterBtnModel.fromJson(e.toJson()); 2663 return FilterBtnModel.fromJson(e.toJson());
2663 }).toList(); 2664 }).toList();
2664 2665
  2666 + if (!(dayDateData.any((e) => e.ddateSolt == '1'))) {
  2667 + //不存在早餐,data的selectMor = false
  2668 + data.forEach((v) {
  2669 + v.selectMor = false;
  2670 + });
  2671 + }
  2672 + if (!(dayDateData.any((e) => e.ddateSolt == '2'))) {
  2673 + //不存在早餐,data的selectMor = false
  2674 + data.forEach((v) {
  2675 + v.selectNoon = false;
  2676 + });
  2677 + }
  2678 + if (!(dayDateData.any((e) => e.ddateSolt == '3'))) {
  2679 + //不存在早餐,data的selectMor = false
  2680 + data.forEach((v) {
  2681 + v.selectNig = false;
  2682 + });
  2683 + }
  2684 + if (!(dayDateData.any((e) => e.ddateSolt == '4'))) {
  2685 + //不存在早餐,data的selectMor = false
  2686 + data.forEach((v) {
  2687 + v.selectMeal1 = false;
  2688 + });
  2689 + }
  2690 + if (!(dayDateData.any((e) => e.ddateSolt == '5'))) {
  2691 + //不存在早餐,data的selectMor = false
  2692 + data.forEach((v) {
  2693 + v.selectMeal2 = false;
  2694 + });
  2695 + }
  2696 +
2665 final option = await showModalBottomSheet( 2697 final option = await showModalBottomSheet(
2666 context: context, 2698 context: context,
2667 backgroundColor: Colors.transparent, 2699 backgroundColor: Colors.transparent,
@@ -2744,27 +2776,17 @@ class DialogUtil { @@ -2744,27 +2776,17 @@ class DialogUtil {
2744 width: w(1), 2776 width: w(1),
2745 color: MyColours.color_DBDBDB))), 2777 color: MyColours.color_DBDBDB))),
2746 child: Row( 2778 child: Row(
2747 - mainAxisAlignment:  
2748 - MainAxisAlignment.spaceBetween,  
2749 - children: [  
2750 - Spacer(),  
2751 - Container(  
2752 - width: w(34),  
2753 - alignment: Alignment.center,  
2754 - child: Text('午餐',  
2755 - style: TextStyle(  
2756 - color: MyColours.color_515151,  
2757 - fontSize: font(16)))),  
2758 - HEmptyView(90),  
2759 - Container(  
2760 - width: w(34),  
2761 - alignment: Alignment.center,  
2762 - child: Text('晚餐',  
2763 - style: TextStyle(  
2764 - color: MyColours.color_515151,  
2765 - fontSize: font(16)))),  
2766 - ],  
2767 - )); 2779 + mainAxisAlignment: MainAxisAlignment.end,
  2780 + children: dayDateData.map((e) {
  2781 + return Container(
  2782 + width: w(34),
  2783 + alignment: Alignment.center,
  2784 + margin: EdgeInsets.only(left: w(20)),
  2785 + child: Text(e.mname ?? '',
  2786 + style: TextStyle(
  2787 + color: MyColours.color_515151,
  2788 + fontSize: font(16))));
  2789 + }).toList()));
2768 } 2790 }
2769 return Container( 2791 return Container(
2770 margin: EdgeInsets.only(bottom: w(7)), 2792 margin: EdgeInsets.only(bottom: w(7)),
@@ -2781,46 +2803,101 @@ class DialogUtil { @@ -2781,46 +2803,101 @@ class DialogUtil {
2781 width: w(1), 2803 width: w(1),
2782 color: MyColours.color_DBDBDB))), 2804 color: MyColours.color_DBDBDB))),
2783 child: Row( 2805 child: Row(
2784 - mainAxisAlignment: MainAxisAlignment.spaceBetween, 2806 + mainAxisAlignment: MainAxisAlignment.end,
2785 children: [ 2807 children: [
2786 Text(data[index - 1].title!, 2808 Text(data[index - 1].title!,
2787 style: TextStyle( 2809 style: TextStyle(
2788 color: MyColours.color_515151, 2810 color: MyColours.color_515151,
2789 fontSize: font(16))), 2811 fontSize: font(16))),
2790 Spacer(), 2812 Spacer(),
2791 - InkWell(  
2792 - onTap: () {  
2793 - state(() {  
2794 - data[index - 1].selectNoon =  
2795 - !data[index - 1].selectNoon!;  
2796 - });  
2797 - },  
2798 - child: Container(  
2799 - width: w(34),  
2800 - alignment: Alignment.center,  
2801 - child: Image.asset(  
2802 - Utils.getImgPath(  
2803 - data[index - 1].selectNoon!  
2804 - ? 'c_mul_select'  
2805 - : 'c_mul_select_un'),  
2806 - width: w(20)))),  
2807 - HEmptyView(90),  
2808 - InkWell(  
2809 - onTap: () {  
2810 - state(() {  
2811 - data[index - 1].selectNig =  
2812 - !data[index - 1].selectNig!;  
2813 - });  
2814 - },  
2815 - child: Container(  
2816 - width: w(34),  
2817 - alignment: Alignment.center,  
2818 - child: Image.asset(  
2819 - Utils.getImgPath(  
2820 - data[index - 1].selectNig!  
2821 - ? 'c_mul_select'  
2822 - : 'c_mul_select_un'),  
2823 - width: w(20)))), 2813 +
  2814 + Row(
  2815 + children: dayDateData.map((e) {
  2816 + bool select = e.ddateSolt == '1'
  2817 + ? data[index - 1].selectMor!
  2818 + : e.ddateSolt == '2'
  2819 + ? data[index - 1].selectNoon!
  2820 + : e.ddateSolt == '3'
  2821 + ? data[index - 1].selectNig!
  2822 + : e.ddateSolt == '4'
  2823 + ? data[index - 1].selectMeal1!
  2824 + : e.ddateSolt == '5'
  2825 + ? data[index - 1]
  2826 + .selectMeal2!
  2827 + : data[index - 1]
  2828 + .selectMor!;
  2829 + return InkWell(
  2830 + onTap: () {
  2831 + if (e.ddateSolt == '1') {
  2832 + state(() {
  2833 + data[index - 1].selectMor =
  2834 + !data[index - 1].selectMor!;
  2835 + });
  2836 + } else if (e.ddateSolt == '2') {
  2837 + state(() {
  2838 + data[index - 1].selectNoon =
  2839 + !data[index - 1].selectNoon!;
  2840 + });
  2841 + } else if (e.ddateSolt == '3') {
  2842 + state(() {
  2843 + data[index - 1].selectNig =
  2844 + !data[index - 1].selectNig!;
  2845 + });
  2846 + } else if (e.ddateSolt == '4') {
  2847 + state(() {
  2848 + data[index - 1].selectMeal1 =
  2849 + !data[index - 1].selectMeal1!;
  2850 + });
  2851 + } else if (e.ddateSolt == '5') {
  2852 + state(() {
  2853 + data[index - 1].selectMeal2 =
  2854 + !data[index - 1].selectMeal2!;
  2855 + });
  2856 + }
  2857 + },
  2858 + child: Container(
  2859 + width: w(34),
  2860 + alignment: Alignment.center,
  2861 + margin: EdgeInsets.only(left: w(20)),
  2862 + child: Image.asset(
  2863 + Utils.getImgPath(select
  2864 + ? 'c_mul_select'
  2865 + : 'c_mul_select_un'),
  2866 + width: w(20))));
  2867 + }).toList())
  2868 + // InkWell(
  2869 + // onTap: () {
  2870 + // state(() {
  2871 + // data[index - 1].selectNoon =
  2872 + // !data[index - 1].selectNoon!;
  2873 + // });
  2874 + // },
  2875 + // child: Container(
  2876 + // width: w(34),
  2877 + // alignment: Alignment.center,
  2878 + // child: Image.asset(
  2879 + // Utils.getImgPath(
  2880 + // data[index - 1].selectNoon!
  2881 + // ? 'c_mul_select'
  2882 + // : 'c_mul_select_un'),
  2883 + // width: w(20)))),
  2884 + // HEmptyView(90),
  2885 + // InkWell(
  2886 + // onTap: () {
  2887 + // state(() {
  2888 + // data[index - 1].selectNig =
  2889 + // !data[index - 1].selectNig!;
  2890 + // });
  2891 + // },
  2892 + // child: Container(
  2893 + // width: w(34),
  2894 + // alignment: Alignment.center,
  2895 + // child: Image.asset(
  2896 + // Utils.getImgPath(
  2897 + // data[index - 1].selectNig!
  2898 + // ? 'c_mul_select'
  2899 + // : 'c_mul_select_un'),
  2900 + // width: w(20)))),
2824 ], 2901 ],
2825 )); 2902 ));
2826 }), 2903 }),