Commit bc96f8cb8a744be41bbc5a354b6c5c249d312605

Authored by wdn127929
1 parent e2320b5f

优惠券使用限制不适配多时段

@@ -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 = 5543; 452 + CURRENT_PROJECT_VERSION = 5544;
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 = 5543; 635 + CURRENT_PROJECT_VERSION = 5544;
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 = 5543; 661 + CURRENT_PROJECT_VERSION = 5544;
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;
@@ -10,10 +10,10 @@ class Constant { @@ -10,10 +10,10 @@ class Constant {
10 * 10 *
11 * 测试账号变更,已经删除0001 账户 代替为 0019!!!!!!!注意!!!!!!!!!!!!!! 11 * 测试账号变更,已经删除0001 账户 代替为 0019!!!!!!!注意!!!!!!!!!!!!!!
12 * */ 12 * */
13 - static const WXMiniProgramType wxMiniProgramType =  
14 - WXMiniProgramType.release; //正式版  
15 // static const WXMiniProgramType wxMiniProgramType = 13 // static const WXMiniProgramType wxMiniProgramType =
16 - // WXMiniProgramType.preview; //体验版 14 + // WXMiniProgramType.release; //正式版
  15 + static const WXMiniProgramType wxMiniProgramType =
  16 + WXMiniProgramType.preview; //体验版
17 // static const WXMiniProgramType wxMiniProgramType = 17 // static const WXMiniProgramType wxMiniProgramType =
18 // WXMiniProgramType.test; //开发版 18 // WXMiniProgramType.test; //开发版
19 19
@@ -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/seller_info.dart';
27 import '../../models/upload_img_model.dart'; 28 import '../../models/upload_img_model.dart';
  29 +import '../../provider/book_set_time_model.dart';
28 import '../../provider/store_base_info_provider.dart'; 30 import '../../provider/store_base_info_provider.dart';
29 import '../../provider/upload_img_provider.dart'; 31 import '../../provider/upload_img_provider.dart';
30 import '../../utils/screen_util.dart'; 32 import '../../utils/screen_util.dart';
@@ -120,7 +122,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -120,7 +122,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
120 bool isShareHave = true; //分享好友后继续拥有此券 122 bool isShareHave = true; //分享好友后继续拥有此券
121 // bool isCommission = true; //返佣金 123 // bool isCommission = true; //返佣金
122 124
123 - late StoreBaseIndoProvider storeBaseIndoProvider; 125 + // late StoreBaseIndoProvider storeBaseIndoProvider;
124 126
125 bool validForever = false; 127 bool validForever = false;
126 bool validForeverCus = false; 128 bool validForeverCus = false;
@@ -136,6 +138,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -136,6 +138,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
136 138
137 TextEditingController fromDayC = TextEditingController(); 139 TextEditingController fromDayC = TextEditingController();
138 TextEditingController endDayC = TextEditingController(); 140 TextEditingController endDayC = TextEditingController();
  141 +
  142 + late BookSetTimeModel bookSetTimeModel;
  143 + List<MealDayDateSunModel> mealDayList = [];
139 @override 144 @override
140 void initState() { 145 void initState() {
141 super.initState(); 146 super.initState();
@@ -371,7 +376,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -371,7 +376,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
371 376
372 WidgetsBinding.instance.addPostFrameCallback((_) { 377 WidgetsBinding.instance.addPostFrameCallback((_) {
373 // _couponNetworkData(0); 378 // _couponNetworkData(0);
374 - getMealSectionByDay(); 379 + _getDailyTime();
375 if (weekData.length == 0) { 380 if (weekData.length == 0) {
376 _initWeekData(); 381 _initWeekData();
377 } 382 }
@@ -387,16 +392,44 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -387,16 +392,44 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
387 _uploadImageProvider!.qiniuInfoSunModel!.token = null; 392 _uploadImageProvider!.qiniuInfoSunModel!.token = null;
388 } 393 }
389 394
390 - getMealSectionByDay({bool showLoading = false}) async {  
391 - Map<String, String?> pramas = {  
392 - 'sellerid': Provider.of<UserModel>(context, listen: false).user!.sellerid,  
393 - 'day':  
394 - '${DateTime.now().year}-${Utils.addZeroNumber(DateTime.now().month)}-${Utils.addZeroNumber(DateTime.now().day)}'  
395 - };  
396 - await storeBaseIndoProvider.getMealSectionByDay(context, pramas,  
397 - showLoading: showLoading); 395 + /// 从接口获取可订时段信息 daily
  396 + _getDailyTime() async {
  397 + mealDayList = [];
  398 + SunSellerInfoModel? model = await bookSetTimeModel.getManagersInfo(context);
  399 +
  400 + if (model!.daily!.morning!.isNotEmpty) {
  401 + MealDayDateSunModel mealDayDateSunModel = MealDayDateSunModel();
  402 + mealDayDateSunModel.mdate = model.daily!.morning!;
  403 + mealDayDateSunModel.mname = '早餐';
  404 + mealDayDateSunModel.ddateSolt = '1';
  405 + mealDayList.add(mealDayDateSunModel);
  406 + }
  407 + if (model.daily!.noon!.isNotEmpty) {
  408 + MealDayDateSunModel mealDayDateSunModel = MealDayDateSunModel();
  409 + mealDayDateSunModel.mdate = model.daily!.noon!;
  410 + mealDayDateSunModel.mname = '午餐';
  411 + mealDayDateSunModel.ddateSolt = '2';
  412 + mealDayList.add(mealDayDateSunModel);
  413 + }
  414 + if (model.daily!.night!.isNotEmpty) {
  415 + MealDayDateSunModel mealDayDateSunModel = MealDayDateSunModel();
  416 + mealDayDateSunModel.mdate = model.daily!.night!;
  417 + mealDayDateSunModel.mname = '晚餐';
  418 + mealDayDateSunModel.ddateSolt = '3';
  419 + mealDayList.add(mealDayDateSunModel);
  420 + }
398 } 421 }
399 422
  423 + // getMealSectionByDay({bool showLoading = false}) async {
  424 + // Map<String, String?> pramas = {
  425 + // 'sellerid': Provider.of<UserModel>(context, listen: false).user!.sellerid,
  426 + // 'day':
  427 + // '${DateTime.now().year}-${Utils.addZeroNumber(DateTime.now().month)}-${Utils.addZeroNumber(DateTime.now().day)}'
  428 + // };
  429 + // await storeBaseIndoProvider.getMealSectionByDay(context, pramas,
  430 + // showLoading: showLoading);
  431 + // }
  432 +
400 ///获取七牛云token 433 ///获取七牛云token
401 /// 434 ///
402 _getQiniuInfo() async { 435 _getQiniuInfo() async {
@@ -1010,12 +1043,11 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1010,12 +1043,11 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1010 1043
1011 @override 1044 @override
1012 Widget build(BuildContext context) { 1045 Widget build(BuildContext context) {
  1046 + bookSetTimeModel = Provider.of<BookSetTimeModel>(context, listen: true);
1013 couponProvider = Provider.of<CouponProvider>(context, listen: true); 1047 couponProvider = Provider.of<CouponProvider>(context, listen: true);
1014 _uploadImageProvider = 1048 _uploadImageProvider =
1015 Provider.of<UploadImageProvider>(context, listen: true); 1049 Provider.of<UploadImageProvider>(context, listen: true);
1016 1050
1017 - storeBaseIndoProvider =  
1018 - Provider.of<StoreBaseIndoProvider>(context, listen: true);  
1019 return Scaffold( 1051 return Scaffold(
1020 backgroundColor: MyColours.color_ffffff, 1052 backgroundColor: MyColours.color_ffffff,
1021 key: scaffoldKey, 1053 key: scaffoldKey,
@@ -1397,10 +1429,12 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1397,10 +1429,12 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1397 // VEmptyView(24), 1429 // VEmptyView(24),
1398 1430
1399 _select('不可用日期', weekShow, () async { 1431 _select('不可用日期', weekShow, () async {
1400 - if (storeBaseIndoProvider.dayDateData == null ||  
1401 - storeBaseIndoProvider.dayDateData?.length ==  
1402 - 0) {  
1403 - await getMealSectionByDay(showLoading: true); 1432 + if (mealDayList.length == 0) {
  1433 + await _getDailyTime();
  1434 + }
  1435 + if (mealDayList.length == 0) {
  1436 + Utils.showToast('请开启餐段后重试');
  1437 + return;
1404 } 1438 }
1405 FocusScope.of(context) 1439 FocusScope.of(context)
1406 .requestFocus(FocusNode()); //点击空白处隐藏键盘 1440 .requestFocus(FocusNode()); //点击空白处隐藏键盘
@@ -1410,10 +1444,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1410,10 +1444,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1410 1444
1411 List<FilterBtnModel>? data = await DialogUtil 1445 List<FilterBtnModel>? data = await DialogUtil
1412 .openCoponsWeekSelectModalBottomSheet( 1446 .openCoponsWeekSelectModalBottomSheet(
1413 - context,  
1414 - weekData,  
1415 - storeBaseIndoProvider.dayDateData ??  
1416 - []); 1447 + context, weekData, mealDayList);
1417 if (data != null) { 1448 if (data != null) {
1418 //改变了 1449 //改变了
1419 weekData = []; 1450 weekData = [];
@@ -1433,8 +1464,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1433,8 +1464,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1433 .any((e) => e.selectMor == true)) { 1464 .any((e) => e.selectMor == true)) {
1434 //有选中的早餐 1465 //有选中的早餐
1435 List<MealDayDateSunModel>? mortemp = 1466 List<MealDayDateSunModel>? mortemp =
1436 - storeBaseIndoProvider.dayDateData  
1437 - ?.where((e) => e.ddateSolt == '1') 1467 + mealDayList
  1468 + .where((e) => e.ddateSolt == '1')
1438 .toList(); 1469 .toList();
1439 1470
1440 morStr = (mortemp != null && 1471 morStr = (mortemp != null &&
@@ -1448,8 +1479,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1448,8 +1479,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1448 .any((e) => e.selectNoon == true)) { 1479 .any((e) => e.selectNoon == true)) {
1449 //有选中的午餐 1480 //有选中的午餐
1450 List<MealDayDateSunModel>? mortemp = 1481 List<MealDayDateSunModel>? mortemp =
1451 - storeBaseIndoProvider.dayDateData  
1452 - ?.where((e) => e.ddateSolt == '2') 1482 + mealDayList
  1483 + .where((e) => e.ddateSolt == '2')
1453 .toList(); 1484 .toList();
1454 1485
1455 noonStr = (mortemp != null && 1486 noonStr = (mortemp != null &&
@@ -1462,8 +1493,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1462,8 +1493,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1462 .any((e) => e.selectNig == true)) { 1493 .any((e) => e.selectNig == true)) {
1463 //有选中的晚餐 1494 //有选中的晚餐
1464 List<MealDayDateSunModel>? mortemp = 1495 List<MealDayDateSunModel>? mortemp =
1465 - storeBaseIndoProvider.dayDateData  
1466 - ?.where((e) => e.ddateSolt == '3') 1496 + mealDayList
  1497 + .where((e) => e.ddateSolt == '3')
1467 .toList(); 1498 .toList();
1468 1499
1469 nigStr = (mortemp != null && 1500 nigStr = (mortemp != null &&
@@ -1471,34 +1502,34 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1471,34 +1502,34 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1471 ? '${mortemp[0].mname}:' 1502 ? '${mortemp[0].mname}:'
1472 : '晚餐:'; 1503 : '晚餐:';
1473 } 1504 }
1474 - String? meal1Str;  
1475 - if (weekData  
1476 - .any((e) => e.selectMeal1 == true)) {  
1477 - //有选中的晚餐1  
1478 - List<MealDayDateSunModel>? mortemp =  
1479 - storeBaseIndoProvider.dayDateData  
1480 - ?.where((e) => e.ddateSolt == '4')  
1481 - .toList();  
1482 -  
1483 - meal1Str = (mortemp != null &&  
1484 - mortemp.length > 0)  
1485 - ? '${mortemp[0].mname}:'  
1486 - : '晚餐1:';  
1487 - }  
1488 - String? meal2Str;  
1489 - if (weekData  
1490 - .any((e) => e.selectMeal2 == true)) {  
1491 - //有选中的晚餐2  
1492 - List<MealDayDateSunModel>? mortemp =  
1493 - storeBaseIndoProvider.dayDateData  
1494 - ?.where((e) => e.ddateSolt == '5')  
1495 - .toList();  
1496 -  
1497 - meal2Str = (mortemp != null &&  
1498 - mortemp.length > 0)  
1499 - ? '${mortemp[0].mname}:'  
1500 - : '晚餐2:';  
1501 - } 1505 + // String? meal1Str;
  1506 + // if (weekData
  1507 + // .any((e) => e.selectMeal1 == true)) {
  1508 + // //有选中的晚餐1
  1509 + // List<MealDayDateSunModel>? mortemp =
  1510 + // mealDayList
  1511 + // .where((e) => e.ddateSolt == '4')
  1512 + // .toList();
  1513 +
  1514 + // meal1Str = (mortemp != null &&
  1515 + // mortemp.length > 0)
  1516 + // ? '${mortemp[0].mname}:'
  1517 + // : '晚餐1:';
  1518 + // }
  1519 + // String? meal2Str;
  1520 + // if (weekData
  1521 + // .any((e) => e.selectMeal2 == true)) {
  1522 + // //有选中的晚餐2
  1523 + // List<MealDayDateSunModel>? mortemp =
  1524 + // mealDayList
  1525 + // .where((e) => e.ddateSolt == '5')
  1526 + // .toList();
  1527 +
  1528 + // meal2Str = (mortemp != null &&
  1529 + // mortemp.length > 0)
  1530 + // ? '${mortemp[0].mname}:'
  1531 + // : '晚餐2:';
  1532 + // }
1502 1533
1503 weekData.forEach((element) { 1534 weekData.forEach((element) {
1504 if (morStr != null && 1535 if (morStr != null &&
@@ -1514,16 +1545,16 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1514,16 +1545,16 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1514 element.selectNig!) { 1545 element.selectNig!) {
1515 nigStr = nigStr! + '${element.title} '; 1546 nigStr = nigStr! + '${element.title} ';
1516 } 1547 }
1517 - if (meal1Str != null &&  
1518 - element.selectMeal1!) {  
1519 - meal1Str =  
1520 - meal1Str! + '${element.title} ';  
1521 - }  
1522 - if (meal2Str != null &&  
1523 - element.selectMeal2!) {  
1524 - meal2Str =  
1525 - meal2Str! + '${element.title} ';  
1526 - } 1548 + // if (meal1Str != null &&
  1549 + // element.selectMeal1!) {
  1550 + // meal1Str =
  1551 + // meal1Str! + '${element.title} ';
  1552 + // }
  1553 + // if (meal2Str != null &&
  1554 + // element.selectMeal2!) {
  1555 + // meal2Str =
  1556 + // meal2Str! + '${element.title} ';
  1557 + // }
1527 }); 1558 });
1528 if (morStr != null) { 1559 if (morStr != null) {
1529 if (morStr!.endsWith(' ')) { 1560 if (morStr!.endsWith(' ')) {
@@ -1543,19 +1574,19 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1543,19 +1574,19 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1543 .substring(0, nigStr!.length - 1); 1574 .substring(0, nigStr!.length - 1);
1544 } 1575 }
1545 } 1576 }
1546 - if (meal1Str != null) {  
1547 - if (meal1Str!.endsWith(' ')) {  
1548 - meal1Str = meal1Str!  
1549 - .substring(0, meal1Str!.length - 1);  
1550 - }  
1551 - }  
1552 -  
1553 - if (meal2Str != null) {  
1554 - if (meal2Str!.endsWith(' ')) {  
1555 - meal2Str = meal2Str!  
1556 - .substring(0, meal2Str!.length - 1);  
1557 - }  
1558 - } 1577 + // if (meal1Str != null) {
  1578 + // if (meal1Str!.endsWith(' ')) {
  1579 + // meal1Str = meal1Str!
  1580 + // .substring(0, meal1Str!.length - 1);
  1581 + // }
  1582 + // }
  1583 +
  1584 + // if (meal2Str != null) {
  1585 + // if (meal2Str!.endsWith(' ')) {
  1586 + // meal2Str = meal2Str!
  1587 + // .substring(0, meal2Str!.length - 1);
  1588 + // }
  1589 + // }
1559 1590
1560 String show = ''; 1591 String show = '';
1561 1592
@@ -1563,17 +1594,26 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -1563,17 +1594,26 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
1563 show += morStr!; 1594 show += morStr!;
1564 } 1595 }
1565 if (noonStr != null) { 1596 if (noonStr != null) {
1566 - show += ('\n' + noonStr!); 1597 + if (show.length > 0) {
  1598 + show += ('\n' + noonStr!);
  1599 + } else {
  1600 + show += noonStr!;
  1601 + }
1567 } 1602 }
1568 if (nigStr != null) { 1603 if (nigStr != null) {
1569 - show += ('\n' + nigStr!);  
1570 - }  
1571 - if (meal1Str != null) {  
1572 - show += ('\n' + meal1Str!);  
1573 - }  
1574 - if (meal2Str != null) {  
1575 - show += ('\n' + meal2Str!); 1604 + if (show.length > 0) {
  1605 + show += ('\n' + nigStr!);
  1606 + } else {
  1607 + show += nigStr!;
  1608 + }
1576 } 1609 }
  1610 + // if (meal1Str != null) {
  1611 + // show += ('\n' + meal1Str!);
  1612 + // }
  1613 + // if (meal2Str != null) {
  1614 + // show += ('\n' + meal2Str!);
  1615 + // }
  1616 +
1577 1617
1578 weekShow = show; 1618 weekShow = show;
1579 } 1619 }
@@ -25,7 +25,9 @@ import 'package:provider/provider.dart'; @@ -25,7 +25,9 @@ import 'package:provider/provider.dart';
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/meal_day_date_model.dart';
  28 +import '../../models/seller_info.dart';
28 import '../../models/upload_img_model.dart'; 29 import '../../models/upload_img_model.dart';
  30 +import '../../provider/book_set_time_model.dart';
29 import '../../provider/store_base_info_provider.dart'; 31 import '../../provider/store_base_info_provider.dart';
30 import '../../provider/upload_img_provider.dart'; 32 import '../../provider/upload_img_provider.dart';
31 import '../../utils/screen_util.dart'; 33 import '../../utils/screen_util.dart';
@@ -97,7 +99,9 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -97,7 +99,9 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
97 99
98 List<String> imgAll = []; 100 List<String> imgAll = [];
99 101
100 - late StoreBaseIndoProvider storeBaseIndoProvider; 102 + // late StoreBaseIndoProvider storeBaseIndoProvider;
  103 + List<MealDayDateSunModel> mealDayList = [];
  104 + late BookSetTimeModel bookSetTimeModel;
101 105
102 @override 106 @override
103 void initState() { 107 void initState() {
@@ -239,7 +243,8 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -239,7 +243,8 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
239 243
240 WidgetsBinding.instance.addPostFrameCallback((_) { 244 WidgetsBinding.instance.addPostFrameCallback((_) {
241 // _couponNetworkData(0); 245 // _couponNetworkData(0);
242 - getMealSectionByDay(); 246 + // getMealSectionByDay();
  247 + _getDailyTime();
243 if (weekData.length == 0) { 248 if (weekData.length == 0) {
244 _initWeekData(); 249 _initWeekData();
245 } 250 }
@@ -255,17 +260,15 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -255,17 +260,15 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
255 _uploadImageProvider!.qiniuInfoSunModel!.token = null; 260 _uploadImageProvider!.qiniuInfoSunModel!.token = null;
256 } 261 }
257 262
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 - } 263 + // getMealSectionByDay({bool needInit = true, bool showLoading = false}) async {
  264 + // Map<String, String?> pramas = {
  265 + // 'sellerid': Provider.of<UserModel>(context, listen: false).user!.sellerid,
  266 + // 'day':
  267 + // '${DateTime.now().year}-${Utils.addZeroNumber(DateTime.now().month)}-${Utils.addZeroNumber(DateTime.now().day)}'
  268 + // };
  269 + // await storeBaseIndoProvider.getMealSectionByDay(context, pramas,
  270 + // showLoading: showLoading);
  271 + // }
269 272
270 ///获取七牛云token 273 ///获取七牛云token
271 /// 274 ///
@@ -308,6 +311,34 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -308,6 +311,34 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
308 } 311 }
309 } 312 }
310 313
  314 + /// 从接口获取可订时段信息 daily
  315 + _getDailyTime() async {
  316 + mealDayList = [];
  317 + SunSellerInfoModel? model = await bookSetTimeModel.getManagersInfo(context);
  318 +
  319 + if (model!.daily!.morning!.isNotEmpty) {
  320 + MealDayDateSunModel mealDayDateSunModel = MealDayDateSunModel();
  321 + mealDayDateSunModel.mdate = model.daily!.morning!;
  322 + mealDayDateSunModel.mname = '早餐';
  323 + mealDayDateSunModel.ddateSolt = '1';
  324 + mealDayList.add(mealDayDateSunModel);
  325 + }
  326 + if (model.daily!.noon!.isNotEmpty) {
  327 + MealDayDateSunModel mealDayDateSunModel = MealDayDateSunModel();
  328 + mealDayDateSunModel.mdate = model.daily!.noon!;
  329 + mealDayDateSunModel.mname = '午餐';
  330 + mealDayDateSunModel.ddateSolt = '2';
  331 + mealDayList.add(mealDayDateSunModel);
  332 + }
  333 + if (model.daily!.night!.isNotEmpty) {
  334 + MealDayDateSunModel mealDayDateSunModel = MealDayDateSunModel();
  335 + mealDayDateSunModel.mdate = model.daily!.night!;
  336 + mealDayDateSunModel.mname = '晚餐';
  337 + mealDayDateSunModel.ddateSolt = '3';
  338 + mealDayList.add(mealDayDateSunModel);
  339 + }
  340 + }
  341 +
311 //创建新券 客户经理创建活动 342 //创建新券 客户经理创建活动
312 _createNewCoupon() async { 343 _createNewCoupon() async {
313 FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 344 FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
@@ -790,11 +821,12 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -790,11 +821,12 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
790 821
791 @override 822 @override
792 Widget build(BuildContext context) { 823 Widget build(BuildContext context) {
  824 + bookSetTimeModel = Provider.of<BookSetTimeModel>(context, listen: true);
793 couponProvider = Provider.of<CouponProvider>(context, listen: true); 825 couponProvider = Provider.of<CouponProvider>(context, listen: true);
794 _uploadImageProvider = 826 _uploadImageProvider =
795 Provider.of<UploadImageProvider>(context, listen: true); 827 Provider.of<UploadImageProvider>(context, listen: true);
796 - storeBaseIndoProvider =  
797 - Provider.of<StoreBaseIndoProvider>(context, listen: true); 828 + // storeBaseIndoProvider =
  829 + // Provider.of<StoreBaseIndoProvider>(context, listen: true);
798 return Scaffold( 830 return Scaffold(
799 backgroundColor: MyColours.color_ffffff, 831 backgroundColor: MyColours.color_ffffff,
800 key: scaffoldKey, 832 key: scaffoldKey,
@@ -1222,13 +1254,12 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -1222,13 +1254,12 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
1222 1254
1223 if (limitWeek) 1255 if (limitWeek)
1224 _select1(weekShow, '', () async { 1256 _select1(weekShow, '', () async {
1225 - if (storeBaseIndoProvider.dayDateData ==  
1226 - null ||  
1227 - storeBaseIndoProvider  
1228 - .dayDateData?.length ==  
1229 - 0) {  
1230 - await getMealSectionByDay(  
1231 - showLoading: true); 1257 + if (mealDayList.length == 0) {
  1258 + await _getDailyTime();
  1259 + }
  1260 + if (mealDayList.length == 0) {
  1261 + Utils.showToast('请开启餐段后重试');
  1262 + return;
1232 } 1263 }
1233 FocusScope.of(context).requestFocus( 1264 FocusScope.of(context).requestFocus(
1234 FocusNode()); //点击空白处隐藏键盘 1265 FocusNode()); //点击空白处隐藏键盘
@@ -1241,9 +1272,7 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -1241,9 +1272,7 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
1241 .openCoponsWeekSelectModalBottomSheet( 1272 .openCoponsWeekSelectModalBottomSheet(
1242 context, 1273 context,
1243 weekData, 1274 weekData,
1244 - storeBaseIndoProvider  
1245 - .dayDateData ??  
1246 - []); 1275 + mealDayList);
1247 if (data != null) { 1276 if (data != null) {
1248 //改变了 1277 //改变了
1249 weekData = []; 1278 weekData = [];
@@ -1263,10 +1292,8 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -1263,10 +1292,8 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
1263 (e) => e.selectMor == true)) { 1292 (e) => e.selectMor == true)) {
1264 //有选中的早餐 1293 //有选中的早餐
1265 List<MealDayDateSunModel>? 1294 List<MealDayDateSunModel>?
1266 - mortemp =  
1267 - storeBaseIndoProvider  
1268 - .dayDateData  
1269 - ?.where((e) => 1295 + mortemp = mealDayList
  1296 + .where((e) =>
1270 e.ddateSolt == '1') 1297 e.ddateSolt == '1')
1271 .toList(); 1298 .toList();
1272 1299
@@ -1281,10 +1308,8 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -1281,10 +1308,8 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
1281 (e) => e.selectNoon == true)) { 1308 (e) => e.selectNoon == true)) {
1282 //有选中的午餐 1309 //有选中的午餐
1283 List<MealDayDateSunModel>? 1310 List<MealDayDateSunModel>?
1284 - mortemp =  
1285 - storeBaseIndoProvider  
1286 - .dayDateData  
1287 - ?.where((e) => 1311 + mortemp = mealDayList
  1312 + .where((e) =>
1288 e.ddateSolt == '2') 1313 e.ddateSolt == '2')
1289 .toList(); 1314 .toList();
1290 1315
@@ -1298,10 +1323,8 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -1298,10 +1323,8 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
1298 (e) => e.selectNig == true)) { 1323 (e) => e.selectNig == true)) {
1299 //有选中的晚餐 1324 //有选中的晚餐
1300 List<MealDayDateSunModel>? 1325 List<MealDayDateSunModel>?
1301 - mortemp =  
1302 - storeBaseIndoProvider  
1303 - .dayDateData  
1304 - ?.where((e) => 1326 + mortemp = mealDayList
  1327 + .where((e) =>
1305 e.ddateSolt == '3') 1328 e.ddateSolt == '3')
1306 .toList(); 1329 .toList();
1307 1330
@@ -1310,40 +1333,36 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -1310,40 +1333,36 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
1310 ? '${mortemp[0].mname}:' 1333 ? '${mortemp[0].mname}:'
1311 : '晚餐:'; 1334 : '晚餐:';
1312 } 1335 }
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:';  
1346 - } 1336 + // String? meal1Str;
  1337 + // if (weekData.any(
  1338 + // (e) => e.selectMeal1 == true)) {
  1339 + // //有选中的晚餐1
  1340 + // List<MealDayDateSunModel>?
  1341 + // mortemp = mealDayList
  1342 + // .where((e) =>
  1343 + // e.ddateSolt == '4')
  1344 + // .toList();
  1345 +
  1346 + // meal1Str = (mortemp != null &&
  1347 + // mortemp.length > 0)
  1348 + // ? '${mortemp[0].mname}:'
  1349 + // : '晚餐1:';
  1350 + // }
  1351 + // String? meal2Str;
  1352 + // if (weekData.any(
  1353 + // (e) => e.selectMeal2 == true)) {
  1354 + // //有选中的晚餐2
  1355 + // List<MealDayDateSunModel>?
  1356 + // mortemp = mealDayList
  1357 + // .where((e) =>
  1358 + // e.ddateSolt == '5')
  1359 + // .toList();
  1360 +
  1361 + // meal2Str = (mortemp != null &&
  1362 + // mortemp.length > 0)
  1363 + // ? '${mortemp[0].mname}:'
  1364 + // : '晚餐2:';
  1365 + // }
1347 1366
1348 weekData.forEach((element) { 1367 weekData.forEach((element) {
1349 if (morStr != null && 1368 if (morStr != null &&
@@ -1361,16 +1380,16 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -1361,16 +1380,16 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
1361 nigStr = nigStr! + 1380 nigStr = nigStr! +
1362 '${element.title} '; 1381 '${element.title} ';
1363 } 1382 }
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 - } 1383 + // if (meal1Str != null &&
  1384 + // element.selectMeal1!) {
  1385 + // meal1Str = meal1Str! +
  1386 + // '${element.title} ';
  1387 + // }
  1388 + // if (meal2Str != null &&
  1389 + // element.selectMeal2!) {
  1390 + // meal2Str = meal2Str! +
  1391 + // '${element.title} ';
  1392 + // }
1374 }); 1393 });
1375 if (morStr != null) { 1394 if (morStr != null) {
1376 if (morStr!.endsWith(' ')) { 1395 if (morStr!.endsWith(' ')) {
@@ -1390,19 +1409,19 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -1390,19 +1409,19 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
1390 0, nigStr!.length - 1); 1409 0, nigStr!.length - 1);
1391 } 1410 }
1392 } 1411 }
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 - } 1412 + // if (meal1Str != null) {
  1413 + // if (meal1Str!.endsWith(' ')) {
  1414 + // meal1Str = meal1Str!.substring(
  1415 + // 0, meal1Str!.length - 1);
  1416 + // }
  1417 + // }
  1418 +
  1419 + // if (meal2Str != null) {
  1420 + // if (meal2Str!.endsWith(' ')) {
  1421 + // meal2Str = meal2Str!.substring(
  1422 + // 0, meal2Str!.length - 1);
  1423 + // }
  1424 + // }
1406 1425
1407 String show = ''; 1426 String show = '';
1408 1427
@@ -1410,17 +1429,25 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> { @@ -1410,17 +1429,25 @@ class _CouponEidtPayPageState extends State<CouponEidtPayPage> {
1410 show += morStr!; 1429 show += morStr!;
1411 } 1430 }
1412 if (noonStr != null) { 1431 if (noonStr != null) {
1413 - show += ('\n' + noonStr!); 1432 + if (show.length > 0) {
  1433 + show += ('\n' + noonStr!);
  1434 + } else {
  1435 + show += noonStr!;
  1436 + }
1414 } 1437 }
1415 if (nigStr != null) { 1438 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!); 1439 + if (show.length > 0) {
  1440 + show += ('\n' + nigStr!);
  1441 + } else {
  1442 + show += nigStr!;
  1443 + }
1423 } 1444 }
  1445 + // if (meal1Str != null) {
  1446 + // show += ('\n' + meal1Str!);
  1447 + // }
  1448 + // if (meal2Str != null) {
  1449 + // show += ('\n' + meal2Str!);
  1450 + // }
1424 1451
1425 weekShow = show; 1452 weekShow = show;
1426 } 1453 }
@@ -904,8 +904,8 @@ var handleCouponEditPageHandler = new Handler( @@ -904,8 +904,8 @@ var handleCouponEditPageHandler = new Handler(
904 904
905 return ChangeNotifierProvider<UploadImageProvider>( 905 return ChangeNotifierProvider<UploadImageProvider>(
906 create: (_) => UploadImageProvider(), 906 create: (_) => UploadImageProvider(),
907 - child: ChangeNotifierProvider<StoreBaseIndoProvider>(  
908 - create: (_) => StoreBaseIndoProvider(), 907 + child: ChangeNotifierProvider<BookSetTimeModel>(
  908 + create: (_) => BookSetTimeModel(),
909 child: CouponEidtPage( 909 child: CouponEidtPage(
910 isMine: isMine, 910 isMine: isMine,
911 from: from, 911 from: from,
@@ -4122,8 +4122,8 @@ var couponEidtPayPageHandle = new Handler( @@ -4122,8 +4122,8 @@ var couponEidtPayPageHandle = new Handler(
4122 4122
4123 return ChangeNotifierProvider<UploadImageProvider>( 4123 return ChangeNotifierProvider<UploadImageProvider>(
4124 create: (_) => UploadImageProvider(), 4124 create: (_) => UploadImageProvider(),
4125 - child: ChangeNotifierProvider<StoreBaseIndoProvider>(  
4126 - create: (_) => StoreBaseIndoProvider(), 4125 + child: ChangeNotifierProvider<BookSetTimeModel>(
  4126 + create: (_) => BookSetTimeModel(),
4127 child: CouponEidtPayPage( 4127 child: CouponEidtPayPage(
4128 isMine: false, couponSunModel: couponSunModel))); 4128 isMine: false, couponSunModel: couponSunModel)));
4129 }); 4129 });