Showing
9 changed files
with
650 additions
and
62 deletions
| @@ -73,6 +73,7 @@ class GetDzSellerConfSunModel { | @@ -73,6 +73,7 @@ class GetDzSellerConfSunModel { | ||
| 73 | String? isAddOver; //是否允许新建过去订单 | 73 | String? isAddOver; //是否允许新建过去订单 |
| 74 | String? isSetOver; //是否允许修改过去订单 | 74 | String? isSetOver; //是否允许修改过去订单 |
| 75 | String? isReserveOver; //是否允许变更订单到过去餐段 | 75 | String? isReserveOver; //是否允许变更订单到过去餐段 |
| 76 | + String? isReserveCancel; //允许取消过去餐段的订单 | ||
| 76 | 77 | ||
| 77 | String? cancelDay; | 78 | String? cancelDay; |
| 78 | String? cancelShopowner; | 79 | String? cancelShopowner; |
| @@ -117,6 +118,7 @@ class GetDzSellerConfSunModel { | @@ -117,6 +118,7 @@ class GetDzSellerConfSunModel { | ||
| 117 | this.isAddOver, | 118 | this.isAddOver, |
| 118 | this.isSetOver, | 119 | this.isSetOver, |
| 119 | this.isReserveOver, | 120 | this.isReserveOver, |
| 121 | + this.isReserveCancel, | ||
| 120 | this.cancelDay, | 122 | this.cancelDay, |
| 121 | this.cancelShopowner, | 123 | this.cancelShopowner, |
| 122 | this.cancelManager, | 124 | this.cancelManager, |
| @@ -174,6 +176,7 @@ class GetDzSellerConfSunModel { | @@ -174,6 +176,7 @@ class GetDzSellerConfSunModel { | ||
| 174 | isAddOver = json['is_add_over']; | 176 | isAddOver = json['is_add_over']; |
| 175 | isSetOver = json['is_set_over']; | 177 | isSetOver = json['is_set_over']; |
| 176 | isReserveOver = json['is_reserve_over']; | 178 | isReserveOver = json['is_reserve_over']; |
| 179 | + isReserveCancel = json['is_reserve_cancel']; | ||
| 177 | cancelDay = json['temp_cancel_day'] ?? '5'; | 180 | cancelDay = json['temp_cancel_day'] ?? '5'; |
| 178 | cancelShopowner = json['temp_for_shopowner'] ?? '1'; | 181 | cancelShopowner = json['temp_for_shopowner'] ?? '1'; |
| 179 | cancelManager = json['temp_for_manager'] ?? '1'; | 182 | cancelManager = json['temp_for_manager'] ?? '1'; |
| @@ -222,6 +225,7 @@ class GetDzSellerConfSunModel { | @@ -222,6 +225,7 @@ class GetDzSellerConfSunModel { | ||
| 222 | data['is_add_over'] = this.isAddOver; | 225 | data['is_add_over'] = this.isAddOver; |
| 223 | data['is_set_over'] = this.isSetOver; | 226 | data['is_set_over'] = this.isSetOver; |
| 224 | data['is_reserve_over'] = this.isReserveOver; | 227 | data['is_reserve_over'] = this.isReserveOver; |
| 228 | + data['is_reserve_cancel'] = this.isReserveCancel; | ||
| 225 | 229 | ||
| 226 | data['temp_cancel_day'] = this.cancelDay; | 230 | data['temp_cancel_day'] = this.cancelDay; |
| 227 | data['temp_for_shopowner'] = this.cancelShopowner; | 231 | data['temp_for_shopowner'] = this.cancelShopowner; |
| @@ -50,6 +50,7 @@ class NoteBookOnlySunModel { | @@ -50,6 +50,7 @@ class NoteBookOnlySunModel { | ||
| 50 | String? isSetDdate; | 50 | String? isSetDdate; |
| 51 | String? ddateSolt; | 51 | String? ddateSolt; |
| 52 | String? mname; | 52 | String? mname; |
| 53 | + String? mdate; | ||
| 53 | String? status; | 54 | String? status; |
| 54 | String? action; | 55 | String? action; |
| 55 | String? type; | 56 | String? type; |
| @@ -178,6 +179,7 @@ class NoteBookOnlySunModel { | @@ -178,6 +179,7 @@ class NoteBookOnlySunModel { | ||
| 178 | this.isSetDdate, | 179 | this.isSetDdate, |
| 179 | this.ddateSolt, | 180 | this.ddateSolt, |
| 180 | this.mname, | 181 | this.mname, |
| 182 | + this.mdate, | ||
| 181 | this.status, | 183 | this.status, |
| 182 | this.action, | 184 | this.action, |
| 183 | this.type, | 185 | this.type, |
| @@ -240,6 +242,10 @@ class NoteBookOnlySunModel { | @@ -240,6 +242,10 @@ class NoteBookOnlySunModel { | ||
| 240 | if (json["mname"] is String) { | 242 | if (json["mname"] is String) { |
| 241 | mname = json["mname"]; | 243 | mname = json["mname"]; |
| 242 | } | 244 | } |
| 245 | + | ||
| 246 | + if (json["mdate"] is String) { | ||
| 247 | + mdate = json["mdate"]; | ||
| 248 | + } | ||
| 243 | if (json["status"] is String) { | 249 | if (json["status"] is String) { |
| 244 | status = json["status"]; | 250 | status = json["status"]; |
| 245 | } | 251 | } |
| @@ -302,6 +308,7 @@ class NoteBookOnlySunModel { | @@ -302,6 +308,7 @@ class NoteBookOnlySunModel { | ||
| 302 | _data["is_set_ddate"] = isSetDdate; | 308 | _data["is_set_ddate"] = isSetDdate; |
| 303 | _data["ddate_solt"] = ddateSolt; | 309 | _data["ddate_solt"] = ddateSolt; |
| 304 | _data["mname"] = mname; | 310 | _data["mname"] = mname; |
| 311 | + _data["mdate"] = mdate; | ||
| 305 | _data["status"] = status; | 312 | _data["status"] = status; |
| 306 | _data["action"] = action; | 313 | _data["action"] = action; |
| 307 | _data["type"] = type; | 314 | _data["type"] = type; |
| @@ -152,6 +152,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> | @@ -152,6 +152,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> | ||
| 152 | 152 | ||
| 153 | bool cancelCan = true; | 153 | bool cancelCan = true; |
| 154 | 154 | ||
| 155 | + bool cancelOld = true; | ||
| 156 | + | ||
| 155 | late StoreBaseIndoProvider storeBaseIndoProvider; | 157 | late StoreBaseIndoProvider storeBaseIndoProvider; |
| 156 | 158 | ||
| 157 | OverlayEntry? overlayEntry; | 159 | OverlayEntry? overlayEntry; |
| @@ -525,6 +527,45 @@ class NotebookDetailPageState extends State<NotebookDetailPage> | @@ -525,6 +527,45 @@ class NotebookDetailPageState extends State<NotebookDetailPage> | ||
| 525 | setState(() {}); | 527 | setState(() {}); |
| 526 | } | 528 | } |
| 527 | 529 | ||
| 530 | + _getIsReserveCancel(bool isReserveCancel) { | ||
| 531 | + //判断时间是否可变更 | ||
| 532 | + | ||
| 533 | + bool reserveCancel = true; //默认允许变更过去餐段订单的时间 | ||
| 534 | + //如果不允许变更过去餐段订单的时间,则开始判断 | ||
| 535 | + //连个条件同时成立: 1.订单的时间是过去 2. 时间改变 | ||
| 536 | + if (!isReserveCancel) { | ||
| 537 | + //找到当前餐段对应的时间段 | ||
| 538 | + String? times = | ||
| 539 | + detailModel!.detailModelAllSunModel!.mdate ?? '00:00-00:00'; | ||
| 540 | + | ||
| 541 | + //组装时间戳 | ||
| 542 | + List<String> datas = times.split('-'); | ||
| 543 | + // DateTime selectStime = DateTime.parse('${dateTimeSelect.year}' + | ||
| 544 | + // '-' + | ||
| 545 | + // '${dateTimeSelect.month}' + | ||
| 546 | + // '-' + | ||
| 547 | + // '${dateTimeSelect.day}' + | ||
| 548 | + // ' ${datas[0]}:00'); //选中餐段开始时间戳 | ||
| 549 | + DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( | ||
| 550 | + int.parse(detailModel!.detailModelAllSunModel!.ddate!) * 1000); | ||
| 551 | + DateTime selectEtime = DateTime.parse('${dateTime.year}' + | ||
| 552 | + '-' + | ||
| 553 | + Utils.addZeroNumber(dateTime.month) + | ||
| 554 | + '-' + | ||
| 555 | + Utils.addZeroNumber(dateTime.day) + | ||
| 556 | + ' ${datas[1]}:00'); //选中餐段结束时间戳 | ||
| 557 | + // 过去的餐段界定 | ||
| 558 | + if (selectEtime.isBefore(DateTime.now())) { | ||
| 559 | +// 属于过去餐段 | ||
| 560 | + reserveCancel = false; | ||
| 561 | + } else { | ||
| 562 | + // 属于未来餐段 | ||
| 563 | + reserveCancel = true; | ||
| 564 | + } | ||
| 565 | + } | ||
| 566 | + return reserveCancel; | ||
| 567 | + } | ||
| 568 | + | ||
| 528 | ///删除订金 | 569 | ///删除订金 |
| 529 | _delReserveDepositByid(String? id) async { | 570 | _delReserveDepositByid(String? id) async { |
| 530 | Map<String, String?> params = { | 571 | Map<String, String?> params = { |
| @@ -1000,6 +1041,13 @@ class NotebookDetailPageState extends State<NotebookDetailPage> | @@ -1000,6 +1041,13 @@ class NotebookDetailPageState extends State<NotebookDetailPage> | ||
| 1000 | marketingCenterProvider.dzSellerConfModel!.cancelOther == '1' | 1041 | marketingCenterProvider.dzSellerConfModel!.cancelOther == '1' |
| 1001 | ? true | 1042 | ? true |
| 1002 | : false; | 1043 | : false; |
| 1044 | + bool isReserveCancel = | ||
| 1045 | + marketingCenterProvider.dzSellerConfModel!.isReserveCancel == '1' | ||
| 1046 | + ? true | ||
| 1047 | + : false; | ||
| 1048 | + | ||
| 1049 | + cancelOld = _getIsReserveCancel(isReserveCancel); | ||
| 1050 | + | ||
| 1003 | String? roleName = | 1051 | String? roleName = |
| 1004 | Provider.of<UserModel>(context, listen: false).user!.role_name; | 1052 | Provider.of<UserModel>(context, listen: false).user!.role_name; |
| 1005 | if (roleName == '管理员' || roleName == '前台') { | 1053 | if (roleName == '管理员' || roleName == '前台') { |
| @@ -4366,30 +4414,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> | @@ -4366,30 +4414,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> | ||
| 4366 | ? detailModel!.detailModelAllSunModel!.phone | 4414 | ? detailModel!.detailModelAllSunModel!.phone |
| 4367 | : Utils.starPhone(detailModel!.detailModelAllSunModel!.phone!), | 4415 | : Utils.starPhone(detailModel!.detailModelAllSunModel!.phone!), |
| 4368 | textColor: MyColours.color_515151, | 4416 | textColor: MyColours.color_515151, |
| 4369 | - textColorR:(Utils.getAuthority( | ||
| 4370 | - context, | ||
| 4371 | - '订座详情-电话') || | ||
| 4372 | - widget.uid == | ||
| 4373 | - userModel | ||
| 4374 | - .user! | ||
| 4375 | - .openid || | ||
| 4376 | - (userModel.user!.role_name == '店长' && | ||
| 4377 | - detailModel!.detailModelAllSunModel!.roleName != | ||
| 4378 | - '管理员' && | ||
| 4379 | - detailModel!.detailModelAllSunModel!.roleName != | ||
| 4380 | - '店长'))? MyColours.color_438E93:MyColours.color_999999, | ||
| 4381 | - imageName:(Utils.getAuthority( | ||
| 4382 | - context, | ||
| 4383 | - '订座详情-电话') || | ||
| 4384 | - widget.uid == | ||
| 4385 | - userModel | ||
| 4386 | - .user! | ||
| 4387 | - .openid || | ||
| 4388 | - (userModel.user!.role_name == '店长' && | ||
| 4389 | - detailModel!.detailModelAllSunModel!.roleName != | ||
| 4390 | - '管理员' && | ||
| 4391 | - detailModel!.detailModelAllSunModel!.roleName != | ||
| 4392 | - '店长'))? 'phone_detail':'h_call')), | 4417 | + textColorR: (Utils.getAuthority(context, '订座详情-电话') || widget.uid == userModel.user!.openid || (userModel.user!.role_name == '店长' && detailModel!.detailModelAllSunModel!.roleName != '管理员' && detailModel!.detailModelAllSunModel!.roleName != '店长')) ? MyColours.color_438E93 : MyColours.color_999999, |
| 4418 | + imageName: (Utils.getAuthority(context, '订座详情-电话') || widget.uid == userModel.user!.openid || (userModel.user!.role_name == '店长' && detailModel!.detailModelAllSunModel!.roleName != '管理员' && detailModel!.detailModelAllSunModel!.roleName != '店长')) ? 'phone_detail' : 'h_call')), | ||
| 4393 | RowMultiText("专属经理", | 4419 | RowMultiText("专属经理", |
| 4394 | '${detailModel!.detailModelAllSunModel!.placeOrderName ?? ''}', | 4420 | '${detailModel!.detailModelAllSunModel!.placeOrderName ?? ''}', |
| 4395 | textColor: MyColours | 4421 | textColor: MyColours |
| @@ -5480,16 +5506,22 @@ class NotebookDetailPageState extends State<NotebookDetailPage> | @@ -5480,16 +5506,22 @@ class NotebookDetailPageState extends State<NotebookDetailPage> | ||
| 5480 | .roleName != | 5506 | .roleName != |
| 5481 | '店长')) { | 5507 | '店长')) { |
| 5482 | //拥有权限的前提下 | 5508 | //拥有权限的前提下 |
| 5483 | - // 是否可以临餐取消 | ||
| 5484 | - if (cancelCan) { | ||
| 5485 | - _showCancelWidget( | ||
| 5486 | - context, | ||
| 5487 | - detailModel! | ||
| 5488 | - .detailModelAllSunModel! | ||
| 5489 | - .phone); | 5509 | + //拥有允许取消过去餐段的订单 |
| 5510 | + if (cancelOld) { | ||
| 5511 | + // 是否可以临餐取消 | ||
| 5512 | + if (cancelCan) { | ||
| 5513 | + _showCancelWidget( | ||
| 5514 | + context, | ||
| 5515 | + detailModel! | ||
| 5516 | + .detailModelAllSunModel! | ||
| 5517 | + .phone); | ||
| 5518 | + } else { | ||
| 5519 | + Utils.showToast( | ||
| 5520 | + '临餐不可取消预订!请与前台联系取消。'); | ||
| 5521 | + } | ||
| 5490 | } else { | 5522 | } else { |
| 5491 | Utils.showToast( | 5523 | Utils.showToast( |
| 5492 | - '临餐不可取消预订!请与前台联系取消。'); | 5524 | + '过去餐段的订单不可取消预订!请与前台联系取消。'); |
| 5493 | } | 5525 | } |
| 5494 | } | 5526 | } |
| 5495 | }, | 5527 | }, |
| @@ -118,6 +118,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -118,6 +118,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 118 | 118 | ||
| 119 | final XgFlutterPlugin tpush = new XgFlutterPlugin(); | 119 | final XgFlutterPlugin tpush = new XgFlutterPlugin(); |
| 120 | 120 | ||
| 121 | + | ||
| 122 | + | ||
| 121 | //实现监听 | 123 | //实现监听 |
| 122 | Future<dynamic> platformCallHandler(MethodCall call) async { | 124 | Future<dynamic> platformCallHandler(MethodCall call) async { |
| 123 | switch (call.method) { | 125 | switch (call.method) { |
| @@ -1798,6 +1800,82 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -1798,6 +1800,82 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 1798 | _pageController!.jumpToPage(index); | 1800 | _pageController!.jumpToPage(index); |
| 1799 | }); | 1801 | }); |
| 1800 | } | 1802 | } |
| 1803 | + if(_currIndex != 1){ | ||
| 1804 | + pages = []; | ||
| 1805 | + pages | ||
| 1806 | + // ..add(ChangeNotifierProvider<HomeEnterModel>( | ||
| 1807 | + // create: (_) => HomeEnterModel(), | ||
| 1808 | + // child: ChangeNotifierProvider<RemarkManagerModel>( | ||
| 1809 | + // create: (_) => RemarkManagerModel(), | ||
| 1810 | + // child: SafeArea(child: HomeEnterPage()), | ||
| 1811 | + // ))) | ||
| 1812 | + ..add(SafeArea( | ||
| 1813 | + child: MessagePage(), | ||
| 1814 | + )) | ||
| 1815 | +// ..add(ChangeNotifierProvider<EnterModel>( | ||
| 1816 | +// create: (_) => EnterModel(), | ||
| 1817 | +// child: SafeArea(child: EnterPage(detailEntity:NotebookDetail.def(context),rid: "-1",)), | ||
| 1818 | +// )) | ||
| 1819 | + ..add(ChangeNotifierProvider<NoteBookModel>( | ||
| 1820 | + create: (_) => NoteBookModel(), | ||
| 1821 | + child: ChangeNotifierProvider<MarketingCenterProvider>( | ||
| 1822 | + create: (_) => MarketingCenterProvider(), | ||
| 1823 | + child: ChangeNotifierProvider<NotebookDetailModel>( | ||
| 1824 | + create: (_) => NotebookDetailModel(), | ||
| 1825 | + child: ChangeNotifierProvider<CollectStoreProvider>( | ||
| 1826 | + create: (_) => CollectStoreProvider(), | ||
| 1827 | + child: ChangeNotifierProvider<StoreBaseIndoProvider>( | ||
| 1828 | + create: (_) => StoreBaseIndoProvider(), | ||
| 1829 | + child: SafeArea( | ||
| 1830 | + child: NoteBookPage( | ||
| 1831 | + | ||
| 1832 | + )))), | ||
| 1833 | + )))) | ||
| 1834 | + ..add(ChangeNotifierProvider<MyModel>( | ||
| 1835 | + create: (_) => MyModel(), | ||
| 1836 | + child: ChangeNotifierProvider<BaseIndoProvider>( | ||
| 1837 | + create: (_) => BaseIndoProvider(), | ||
| 1838 | + child: ChangeNotifierProvider<TableManagerModelOrReserve>( | ||
| 1839 | + create: (_) => TableManagerModelOrReserve(), | ||
| 1840 | + child: ChangeNotifierProvider<RemarkManagerModel>( | ||
| 1841 | + create: (_) => RemarkManagerModel(), | ||
| 1842 | + child: ChangeNotifierProvider<StoreBaseIndoProvider>( | ||
| 1843 | + create: (_) => StoreBaseIndoProvider(), | ||
| 1844 | + child: ChangeNotifierProvider<CustomerProvider>( | ||
| 1845 | + create: (_) => CustomerProvider(), | ||
| 1846 | + child: | ||
| 1847 | + ChangeNotifierProvider<MarketingCenterProvider>( | ||
| 1848 | + create: (_) => MarketingCenterProvider(), | ||
| 1849 | + child: ChangeNotifierProvider<SmsModel>( | ||
| 1850 | + create: (_) => SmsModel(), | ||
| 1851 | + child: ChangeNotifierProvider< | ||
| 1852 | + PersonnelProvider>( | ||
| 1853 | + create: (_) => PersonnelProvider(), | ||
| 1854 | + child: TableManagerPage()))))))), | ||
| 1855 | + ))) | ||
| 1856 | + ..add( | ||
| 1857 | + ChangeNotifierProvider<FeastModel>( | ||
| 1858 | + create: (_) => FeastModel(), child: FeastPage()), | ||
| 1859 | + ) | ||
| 1860 | + ..add(ChangeNotifierProvider<MyModel>( | ||
| 1861 | + create: (_) => MyModel(), | ||
| 1862 | + child: ChangeNotifierProvider<StoreBaseIndoProvider>( | ||
| 1863 | + create: (_) => StoreBaseIndoProvider(), | ||
| 1864 | + child: ChangeNotifierProvider<CollectStoreProvider>( | ||
| 1865 | + create: (_) => CollectStoreProvider(), | ||
| 1866 | + child: ChangeNotifierProvider<CustomerProvider>( | ||
| 1867 | + create: (_) => CustomerProvider(), | ||
| 1868 | + child: ChangeNotifierProvider<UserModel>( | ||
| 1869 | + create: (_) => UserModel(), | ||
| 1870 | + child: ChangeNotifierProvider<PersonnelProvider>( | ||
| 1871 | + create: (_) => PersonnelProvider(), | ||
| 1872 | + child: MyPage())))), | ||
| 1873 | + ))); | ||
| 1874 | + setState(() { | ||
| 1875 | + | ||
| 1876 | + }); | ||
| 1877 | + } | ||
| 1878 | + | ||
| 1801 | if (_currIndex == 4) { | 1879 | if (_currIndex == 4) { |
| 1802 | Utils.changeStatusColor(color: MyColours.color_199095); | 1880 | Utils.changeStatusColor(color: MyColours.color_199095); |
| 1803 | } else { | 1881 | } else { |
| @@ -67,6 +67,10 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | @@ -67,6 +67,10 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | ||
| 67 | marketingCenterProvider.dzSellerConfModel!.isReserveOver == '1' | 67 | marketingCenterProvider.dzSellerConfModel!.isReserveOver == '1' |
| 68 | ? true | 68 | ? true |
| 69 | : false; | 69 | : false; |
| 70 | + customerProvider.isReserveCancel = | ||
| 71 | + marketingCenterProvider.dzSellerConfModel!.isReserveCancel == '1' | ||
| 72 | + ? true | ||
| 73 | + : false; | ||
| 70 | 74 | ||
| 71 | customerProvider.ispcname = | 75 | customerProvider.ispcname = |
| 72 | marketingCenterProvider.dzSellerConfModel!.pcNotName == '1' | 76 | marketingCenterProvider.dzSellerConfModel!.pcNotName == '1' |
| @@ -126,6 +130,7 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | @@ -126,6 +130,7 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | ||
| 126 | "is_add_over": customerProvider.isAddOver ? '1' : '0', | 130 | "is_add_over": customerProvider.isAddOver ? '1' : '0', |
| 127 | "is_set_over": customerProvider.isSetOver ? '1' : '0', | 131 | "is_set_over": customerProvider.isSetOver ? '1' : '0', |
| 128 | "is_reserve_over": customerProvider.isReserveOver ? '1' : '0', | 132 | "is_reserve_over": customerProvider.isReserveOver ? '1' : '0', |
| 133 | + "is_reserve_cancel": customerProvider.isReserveCancel ? '1' : '0', | ||
| 129 | 'temp_cancel_day': controllerDay.text, | 134 | 'temp_cancel_day': controllerDay.text, |
| 130 | 'temp_for_shopowner': | 135 | 'temp_for_shopowner': |
| 131 | customerProvider.cancelOrderdayShopowner ? '1' : '0', | 136 | customerProvider.cancelOrderdayShopowner ? '1' : '0', |
| @@ -610,6 +615,42 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | @@ -610,6 +615,42 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | ||
| 610 | w(1), | 615 | w(1), |
| 611 | color: MyColours.color_E7E7E7, | 616 | color: MyColours.color_E7E7E7, |
| 612 | )), | 617 | )), |
| 618 | + VEmptyView(24), | ||
| 619 | + InkWell( | ||
| 620 | + onTap: () { | ||
| 621 | + setState(() { | ||
| 622 | + customerProvider.isReserveCancel = | ||
| 623 | + !customerProvider.isReserveCancel; | ||
| 624 | + }); | ||
| 625 | + }, | ||
| 626 | + child: Container( | ||
| 627 | + padding: EdgeInsets.symmetric( | ||
| 628 | + vertical: w(8), horizontal: w(14)), | ||
| 629 | + child: Row( | ||
| 630 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 631 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 632 | + children: [ | ||
| 633 | + Text('允许取消过去餐段的订单', | ||
| 634 | + style: TextStyle( | ||
| 635 | + color: MyColours.color_515151, | ||
| 636 | + fontSize: ScreenUtil().setSp(28))), | ||
| 637 | + Image.asset( | ||
| 638 | + customerProvider.isReserveCancel | ||
| 639 | + ? Utils.getImgPath('swich_on') | ||
| 640 | + : Utils.getImgPath('swich_off'), | ||
| 641 | + width: ScreenUtil().setWidth(88), | ||
| 642 | + // height: ScreenUtil().setWidth(82), | ||
| 643 | + ), | ||
| 644 | + ], | ||
| 645 | + ), | ||
| 646 | + )), | ||
| 647 | + Padding( | ||
| 648 | + padding: EdgeInsets.only(left: w(14), right: w(10)), | ||
| 649 | + child: MyDivider( | ||
| 650 | + double.infinity, | ||
| 651 | + w(1), | ||
| 652 | + color: MyColours.color_E7E7E7, | ||
| 653 | + )), | ||
| 613 | VEmptyView(48), | 654 | VEmptyView(48), |
| 614 | Row( | 655 | Row( |
| 615 | children: [ | 656 | children: [ |
| 1 | - | ||
| 2 | import 'dart:convert'; | 1 | import 'dart:convert'; |
| 3 | import 'dart:ui'; | 2 | import 'dart:ui'; |
| 4 | 3 | ||
| @@ -29,10 +28,26 @@ import '../../provider/marketing_center_provider.dart'; | @@ -29,10 +28,26 @@ import '../../provider/marketing_center_provider.dart'; | ||
| 29 | class NoteBookItemF extends StatefulWidget { | 28 | class NoteBookItemF extends StatefulWidget { |
| 30 | final num index; | 29 | final num index; |
| 31 | final NoteBookOnlySunModel notebook; | 30 | final NoteBookOnlySunModel notebook; |
| 32 | - final GestureTapCallback onTap; | ||
| 33 | final bool sellerPreserve; | 31 | final bool sellerPreserve; |
| 32 | + final GestureTapCallback onTap; | ||
| 34 | 33 | ||
| 35 | - NoteBookItemF(this.notebook, this.index,this.sellerPreserve, this.onTap); | 34 | + final String? cancelDay; |
| 35 | + final bool cancelShopowner; | ||
| 36 | + final bool cancelManager; | ||
| 37 | + | ||
| 38 | + final bool cancelOther; | ||
| 39 | + final bool isReserveCancel; | ||
| 40 | + | ||
| 41 | + NoteBookItemF( | ||
| 42 | + this.index, | ||
| 43 | + this.notebook, | ||
| 44 | + this.sellerPreserve, | ||
| 45 | + this.onTap, | ||
| 46 | + this.cancelDay, | ||
| 47 | + this.cancelShopowner, | ||
| 48 | + this.cancelManager, | ||
| 49 | + this.cancelOther, | ||
| 50 | + this.isReserveCancel); | ||
| 36 | 51 | ||
| 37 | @override | 52 | @override |
| 38 | State<StatefulWidget> createState() { | 53 | State<StatefulWidget> createState() { |
| @@ -42,8 +57,8 @@ class NoteBookItemF extends StatefulWidget { | @@ -42,8 +57,8 @@ class NoteBookItemF extends StatefulWidget { | ||
| 42 | } | 57 | } |
| 43 | 58 | ||
| 44 | class NoteBookItemFState extends State<NoteBookItemF> | 59 | class NoteBookItemFState extends State<NoteBookItemF> |
| 45 | - // with SingleTickerProviderStateMixin | ||
| 46 | - { | 60 | +// with SingleTickerProviderStateMixin |
| 61 | +{ | ||
| 47 | // bool _large = false; | 62 | // bool _large = false; |
| 48 | List cancelReasonList = []; | 63 | List cancelReasonList = []; |
| 49 | bool isShowTF = false; | 64 | bool isShowTF = false; |
| @@ -438,6 +453,44 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -438,6 +453,44 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 438 | }); | 453 | }); |
| 439 | } | 454 | } |
| 440 | 455 | ||
| 456 | + _getIsReserveCancel(bool isReserveCancel) { | ||
| 457 | + //判断时间是否可变更 | ||
| 458 | + | ||
| 459 | + bool reserveCancel = true; //默认允许变更过去餐段订单的时间 | ||
| 460 | + //如果不允许变更过去餐段订单的时间,则开始判断 | ||
| 461 | + //连个条件同时成立: 1.订单的时间是过去 2. 时间改变 | ||
| 462 | + if (!isReserveCancel) { | ||
| 463 | + //找到当前餐段对应的时间段 | ||
| 464 | + String? times = widget.notebook.mdate ?? '00:00-00:00'; | ||
| 465 | + | ||
| 466 | + //组装时间戳 | ||
| 467 | + List<String> datas = times.split('-'); | ||
| 468 | + // DateTime selectStime = DateTime.parse('${dateTimeSelect.year}' + | ||
| 469 | + // '-' + | ||
| 470 | + // '${dateTimeSelect.month}' + | ||
| 471 | + // '-' + | ||
| 472 | + // '${dateTimeSelect.day}' + | ||
| 473 | + // ' ${datas[0]}:00'); //选中餐段开始时间戳 | ||
| 474 | + DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( | ||
| 475 | + int.parse(widget.notebook.ddate!) * 1000); | ||
| 476 | + DateTime selectEtime = DateTime.parse('${dateTime.year}' + | ||
| 477 | + '-' + | ||
| 478 | + Utils.addZeroNumber(dateTime.month) + | ||
| 479 | + '-' + | ||
| 480 | + Utils.addZeroNumber(dateTime.day) + | ||
| 481 | + ' ${datas[1]}:00'); //选中餐段结束时间戳 | ||
| 482 | + // 过去的餐段界定 | ||
| 483 | + if (selectEtime.isBefore(DateTime.now())) { | ||
| 484 | +// 属于过去餐段 | ||
| 485 | + reserveCancel = false; | ||
| 486 | + } else { | ||
| 487 | + // 属于未来餐段 | ||
| 488 | + reserveCancel = true; | ||
| 489 | + } | ||
| 490 | + } | ||
| 491 | + return reserveCancel; | ||
| 492 | + } | ||
| 493 | + | ||
| 441 | @override | 494 | @override |
| 442 | Widget build(BuildContext context) { | 495 | Widget build(BuildContext context) { |
| 443 | // TODO: implement build | 496 | // TODO: implement build |
| @@ -505,7 +558,6 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -505,7 +558,6 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 505 | //离店和取消预订 | 558 | //离店和取消预订 |
| 506 | 559 | ||
| 507 | widthBtn = 208.0; //一个按钮 | 560 | widthBtn = 208.0; //一个按钮 |
| 508 | - | ||
| 509 | } else { | 561 | } else { |
| 510 | if (!Utils.getAuthority(context, '取消预订') || | 562 | if (!Utils.getAuthority(context, '取消预订') || |
| 511 | (!Utils.getAuthority(context, '取消预订') && | 563 | (!Utils.getAuthority(context, '取消预订') && |
| @@ -544,7 +596,7 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -544,7 +596,7 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 544 | width: ScreenUtil().setWidth(82 * 2), | 596 | width: ScreenUtil().setWidth(82 * 2), |
| 545 | alignment: Alignment.center, | 597 | alignment: Alignment.center, |
| 546 | child: Text( | 598 | child: Text( |
| 547 | - notebook.tablename??'', | 599 | + notebook.tablename ?? '', |
| 548 | maxLines: 1, | 600 | maxLines: 1, |
| 549 | overflow: TextOverflow.ellipsis, | 601 | overflow: TextOverflow.ellipsis, |
| 550 | style: TextStyle( | 602 | style: TextStyle( |
| @@ -693,7 +745,9 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -693,7 +745,9 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 693 | : HEmptyView(8), | 745 | : HEmptyView(8), |
| 694 | (notebook.rnameStr == '' && | 746 | (notebook.rnameStr == '' && |
| 695 | notebook.phoneStr!.isEmpty) || | 747 | notebook.phoneStr!.isEmpty) || |
| 696 | - notebook.label == null || notebook.label == "" ||!widget.sellerPreserve | 748 | + notebook.label == null || |
| 749 | + notebook.label == "" || | ||
| 750 | + !widget.sellerPreserve | ||
| 697 | ? SizedBox() | 751 | ? SizedBox() |
| 698 | : Container( | 752 | : Container( |
| 699 | padding: EdgeInsets.symmetric( | 753 | padding: EdgeInsets.symmetric( |
| @@ -905,8 +959,135 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -905,8 +959,135 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 905 | userModel.user!.openid)) | 959 | userModel.user!.openid)) |
| 906 | InkWell( | 960 | InkWell( |
| 907 | onTap: () { | 961 | onTap: () { |
| 908 | - _showCancelWidget( | ||
| 909 | - context, notebook.phone); | 962 | + bool isReserveCancel = |
| 963 | + _getIsReserveCancel(widget | ||
| 964 | + .isReserveCancel); | ||
| 965 | + | ||
| 966 | + if (isReserveCancel) { | ||
| 967 | + bool cancelCan = false; | ||
| 968 | + DateTime dateTime = DateTime | ||
| 969 | + .fromMillisecondsSinceEpoch( | ||
| 970 | + int.parse(widget | ||
| 971 | + .notebook | ||
| 972 | + .ddate!) * | ||
| 973 | + 1000); | ||
| 974 | + String roleName = | ||
| 975 | + Provider.of<UserModel>( | ||
| 976 | + context, | ||
| 977 | + listen: | ||
| 978 | + false) | ||
| 979 | + .user! | ||
| 980 | + .role_name ?? | ||
| 981 | + ''; | ||
| 982 | + | ||
| 983 | + if (roleName == '管理员' || | ||
| 984 | + roleName == '前台') { | ||
| 985 | + cancelCan = true; | ||
| 986 | + } else if (roleName == | ||
| 987 | + '店长') { | ||
| 988 | + if (widget | ||
| 989 | + .cancelShopowner) { | ||
| 990 | + cancelCan = true; | ||
| 991 | + } else { | ||
| 992 | + //临餐不可以取消 | ||
| 993 | + | ||
| 994 | + //比较相差的天数 | ||
| 995 | + | ||
| 996 | + int differenceSeconds = | ||
| 997 | + dateTime | ||
| 998 | + .difference( | ||
| 999 | + DateTime | ||
| 1000 | + .now()) | ||
| 1001 | + .inSeconds; | ||
| 1002 | + | ||
| 1003 | + if (int.parse(widget | ||
| 1004 | + .cancelDay!) != | ||
| 1005 | + 0 && | ||
| 1006 | + differenceSeconds < | ||
| 1007 | + int.parse(widget | ||
| 1008 | + .cancelDay!) * | ||
| 1009 | + 24 * | ||
| 1010 | + 60 * | ||
| 1011 | + 60) { | ||
| 1012 | + // 临餐时间内 | ||
| 1013 | + cancelCan = false; | ||
| 1014 | + } else { | ||
| 1015 | + cancelCan = true; | ||
| 1016 | + } | ||
| 1017 | + } | ||
| 1018 | + } else if (roleName == | ||
| 1019 | + '客户经理') { | ||
| 1020 | + if (widget | ||
| 1021 | + .cancelManager) { | ||
| 1022 | + cancelCan = true; | ||
| 1023 | + } else { | ||
| 1024 | + //临餐不可以取消 | ||
| 1025 | + | ||
| 1026 | + //比较相差的天数 | ||
| 1027 | + int differenceSeconds = | ||
| 1028 | + dateTime | ||
| 1029 | + .difference( | ||
| 1030 | + DateTime | ||
| 1031 | + .now()) | ||
| 1032 | + .inSeconds; | ||
| 1033 | + | ||
| 1034 | + if (int.parse(widget | ||
| 1035 | + .cancelDay!) != | ||
| 1036 | + 0 && | ||
| 1037 | + differenceSeconds < | ||
| 1038 | + int.parse(widget | ||
| 1039 | + .cancelDay!) * | ||
| 1040 | + 24 * | ||
| 1041 | + 60 * | ||
| 1042 | + 60) { | ||
| 1043 | + // 临餐时间内 | ||
| 1044 | + cancelCan = false; | ||
| 1045 | + } else { | ||
| 1046 | + cancelCan = true; | ||
| 1047 | + } | ||
| 1048 | + } | ||
| 1049 | + } else { | ||
| 1050 | + if (widget.cancelOther) { | ||
| 1051 | + cancelCan = true; | ||
| 1052 | + } else { | ||
| 1053 | + //临餐不可以取消 | ||
| 1054 | + | ||
| 1055 | + //比较相差的天数 | ||
| 1056 | + | ||
| 1057 | + int differenceSeconds = | ||
| 1058 | + dateTime | ||
| 1059 | + .difference( | ||
| 1060 | + DateTime | ||
| 1061 | + .now()) | ||
| 1062 | + .inSeconds; | ||
| 1063 | + | ||
| 1064 | + if (int.parse(widget | ||
| 1065 | + .cancelDay!) != | ||
| 1066 | + 0 && | ||
| 1067 | + differenceSeconds < | ||
| 1068 | + int.parse(widget | ||
| 1069 | + .cancelDay!) * | ||
| 1070 | + 24 * | ||
| 1071 | + 60 * | ||
| 1072 | + 60) { | ||
| 1073 | + // 临餐时间内 | ||
| 1074 | + cancelCan = false; | ||
| 1075 | + } else { | ||
| 1076 | + cancelCan = true; | ||
| 1077 | + } | ||
| 1078 | + } | ||
| 1079 | + } | ||
| 1080 | + if (cancelCan) { | ||
| 1081 | + _showCancelWidget(context, | ||
| 1082 | + notebook.phone); | ||
| 1083 | + } else { | ||
| 1084 | + Utils.showToast( | ||
| 1085 | + '临餐不可取消预订!请与前台联系取消。'); | ||
| 1086 | + } | ||
| 1087 | + } else { | ||
| 1088 | + Utils.showToast( | ||
| 1089 | + '过去餐段的订单不可取消预订!请与前台联系取消。'); | ||
| 1090 | + } | ||
| 910 | }, | 1091 | }, |
| 911 | child: Text( | 1092 | child: Text( |
| 912 | '取消预订', | 1093 | '取消预订', |
| @@ -928,7 +1109,8 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -928,7 +1109,8 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 928 | : Image.asset( | 1109 | : Image.asset( |
| 929 | Utils.getImgPath(canDo && | 1110 | Utils.getImgPath(canDo && |
| 930 | (Utils.getAuthority(context, '到店') || | 1111 | (Utils.getAuthority(context, '到店') || |
| 931 | - notebook.uid == userModel.user!.openid) | 1112 | + notebook.uid == |
| 1113 | + userModel.user!.openid) | ||
| 932 | ? 'ordered_open' | 1114 | ? 'ordered_open' |
| 933 | : 'ordered_off'), | 1115 | : 'ordered_off'), |
| 934 | width: ScreenUtil().setWidth(80), | 1116 | width: ScreenUtil().setWidth(80), |
| @@ -40,9 +40,25 @@ import '../../utils/screen_util.dart'; | @@ -40,9 +40,25 @@ import '../../utils/screen_util.dart'; | ||
| 40 | class NoteBookItemSimple extends StatefulWidget { | 40 | class NoteBookItemSimple extends StatefulWidget { |
| 41 | final num index; | 41 | final num index; |
| 42 | final NoteBookOnlySunModel notebook; | 42 | final NoteBookOnlySunModel notebook; |
| 43 | + | ||
| 43 | final GestureTapCallback onTap; | 44 | final GestureTapCallback onTap; |
| 44 | 45 | ||
| 45 | - NoteBookItemSimple(this.notebook, this.index, this.onTap); | 46 | + final String? cancelDay; |
| 47 | + final bool cancelShopowner; | ||
| 48 | + final bool cancelManager; | ||
| 49 | + | ||
| 50 | + final bool cancelOther; | ||
| 51 | + final bool isReserveCancel; | ||
| 52 | + | ||
| 53 | + NoteBookItemSimple( | ||
| 54 | + this.index, | ||
| 55 | + this.notebook, | ||
| 56 | + this.onTap, | ||
| 57 | + this.cancelDay, | ||
| 58 | + this.cancelShopowner, | ||
| 59 | + this.cancelManager, | ||
| 60 | + this.cancelOther, | ||
| 61 | + this.isReserveCancel); | ||
| 46 | 62 | ||
| 47 | @override | 63 | @override |
| 48 | State<StatefulWidget> createState() { | 64 | State<StatefulWidget> createState() { |
| @@ -447,6 +463,44 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | @@ -447,6 +463,44 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | ||
| 447 | }); | 463 | }); |
| 448 | } | 464 | } |
| 449 | 465 | ||
| 466 | + _getIsReserveCancel(bool isReserveCancel) { | ||
| 467 | + //判断时间是否可变更 | ||
| 468 | + | ||
| 469 | + bool reserveCancel = true; //默认允许变更过去餐段订单的时间 | ||
| 470 | + //如果不允许变更过去餐段订单的时间,则开始判断 | ||
| 471 | + //连个条件同时成立: 1.订单的时间是过去 2. 时间改变 | ||
| 472 | + if (!isReserveCancel) { | ||
| 473 | + //找到当前餐段对应的时间段 | ||
| 474 | + String? times = widget.notebook.mdate ?? '00:00-00:00'; | ||
| 475 | + | ||
| 476 | + //组装时间戳 | ||
| 477 | + List<String> datas = times.split('-'); | ||
| 478 | + // DateTime selectStime = DateTime.parse('${dateTimeSelect.year}' + | ||
| 479 | + // '-' + | ||
| 480 | + // '${dateTimeSelect.month}' + | ||
| 481 | + // '-' + | ||
| 482 | + // '${dateTimeSelect.day}' + | ||
| 483 | + // ' ${datas[0]}:00'); //选中餐段开始时间戳 | ||
| 484 | + DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( | ||
| 485 | + int.parse(widget.notebook.ddate!) * 1000); | ||
| 486 | + DateTime selectEtime = DateTime.parse('${dateTime.year}' + | ||
| 487 | + '-' + | ||
| 488 | + Utils.addZeroNumber(dateTime.month) + | ||
| 489 | + '-' + | ||
| 490 | + Utils.addZeroNumber(dateTime.day) + | ||
| 491 | + ' ${datas[1]}:00'); //选中餐段结束时间戳 | ||
| 492 | + // 过去的餐段界定 | ||
| 493 | + if (selectEtime.isBefore(DateTime.now())) { | ||
| 494 | +// 属于过去餐段 | ||
| 495 | + reserveCancel = false; | ||
| 496 | + } else { | ||
| 497 | + // 属于未来餐段 | ||
| 498 | + reserveCancel = true; | ||
| 499 | + } | ||
| 500 | + } | ||
| 501 | + return reserveCancel; | ||
| 502 | + } | ||
| 503 | + | ||
| 450 | @override | 504 | @override |
| 451 | Widget build(BuildContext context) { | 505 | Widget build(BuildContext context) { |
| 452 | // TODO: implement build | 506 | // TODO: implement build |
| @@ -868,8 +922,135 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | @@ -868,8 +922,135 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | ||
| 868 | userModel.user!.openid)) | 922 | userModel.user!.openid)) |
| 869 | InkWell( | 923 | InkWell( |
| 870 | onTap: () { | 924 | onTap: () { |
| 871 | - _showCancelWidget( | ||
| 872 | - context, notebook.phone); | 925 | + bool isReserveCancel = |
| 926 | + _getIsReserveCancel(widget | ||
| 927 | + .isReserveCancel); | ||
| 928 | + | ||
| 929 | + if (isReserveCancel) { | ||
| 930 | + bool cancelCan = false; | ||
| 931 | + DateTime dateTime = DateTime | ||
| 932 | + .fromMillisecondsSinceEpoch( | ||
| 933 | + int.parse(widget | ||
| 934 | + .notebook | ||
| 935 | + .ddate!) * | ||
| 936 | + 1000); | ||
| 937 | + String roleName = | ||
| 938 | + Provider.of<UserModel>( | ||
| 939 | + context, | ||
| 940 | + listen: | ||
| 941 | + false) | ||
| 942 | + .user! | ||
| 943 | + .role_name ?? | ||
| 944 | + ''; | ||
| 945 | + | ||
| 946 | + if (roleName == '管理员' || | ||
| 947 | + roleName == '前台') { | ||
| 948 | + cancelCan = true; | ||
| 949 | + } else if (roleName == | ||
| 950 | + '店长') { | ||
| 951 | + if (widget | ||
| 952 | + .cancelShopowner) { | ||
| 953 | + cancelCan = true; | ||
| 954 | + } else { | ||
| 955 | + //临餐不可以取消 | ||
| 956 | + | ||
| 957 | + //比较相差的天数 | ||
| 958 | + | ||
| 959 | + int differenceSeconds = | ||
| 960 | + dateTime | ||
| 961 | + .difference( | ||
| 962 | + DateTime | ||
| 963 | + .now()) | ||
| 964 | + .inSeconds; | ||
| 965 | + | ||
| 966 | + if (int.parse(widget | ||
| 967 | + .cancelDay!) != | ||
| 968 | + 0 && | ||
| 969 | + differenceSeconds < | ||
| 970 | + int.parse(widget | ||
| 971 | + .cancelDay!) * | ||
| 972 | + 24 * | ||
| 973 | + 60 * | ||
| 974 | + 60) { | ||
| 975 | + // 临餐时间内 | ||
| 976 | + cancelCan = false; | ||
| 977 | + } else { | ||
| 978 | + cancelCan = true; | ||
| 979 | + } | ||
| 980 | + } | ||
| 981 | + } else if (roleName == | ||
| 982 | + '客户经理') { | ||
| 983 | + if (widget | ||
| 984 | + .cancelManager) { | ||
| 985 | + cancelCan = true; | ||
| 986 | + } else { | ||
| 987 | + //临餐不可以取消 | ||
| 988 | + | ||
| 989 | + //比较相差的天数 | ||
| 990 | + int differenceSeconds = | ||
| 991 | + dateTime | ||
| 992 | + .difference( | ||
| 993 | + DateTime | ||
| 994 | + .now()) | ||
| 995 | + .inSeconds; | ||
| 996 | + | ||
| 997 | + if (int.parse(widget | ||
| 998 | + .cancelDay!) != | ||
| 999 | + 0 && | ||
| 1000 | + differenceSeconds < | ||
| 1001 | + int.parse(widget | ||
| 1002 | + .cancelDay!) * | ||
| 1003 | + 24 * | ||
| 1004 | + 60 * | ||
| 1005 | + 60) { | ||
| 1006 | + // 临餐时间内 | ||
| 1007 | + cancelCan = false; | ||
| 1008 | + } else { | ||
| 1009 | + cancelCan = true; | ||
| 1010 | + } | ||
| 1011 | + } | ||
| 1012 | + } else { | ||
| 1013 | + if (widget.cancelOther) { | ||
| 1014 | + cancelCan = true; | ||
| 1015 | + } else { | ||
| 1016 | + //临餐不可以取消 | ||
| 1017 | + | ||
| 1018 | + //比较相差的天数 | ||
| 1019 | + | ||
| 1020 | + int differenceSeconds = | ||
| 1021 | + dateTime | ||
| 1022 | + .difference( | ||
| 1023 | + DateTime | ||
| 1024 | + .now()) | ||
| 1025 | + .inSeconds; | ||
| 1026 | + | ||
| 1027 | + if (int.parse(widget | ||
| 1028 | + .cancelDay!) != | ||
| 1029 | + 0 && | ||
| 1030 | + differenceSeconds < | ||
| 1031 | + int.parse(widget | ||
| 1032 | + .cancelDay!) * | ||
| 1033 | + 24 * | ||
| 1034 | + 60 * | ||
| 1035 | + 60) { | ||
| 1036 | + // 临餐时间内 | ||
| 1037 | + cancelCan = false; | ||
| 1038 | + } else { | ||
| 1039 | + cancelCan = true; | ||
| 1040 | + } | ||
| 1041 | + } | ||
| 1042 | + } | ||
| 1043 | + if (cancelCan) { | ||
| 1044 | + _showCancelWidget(context, | ||
| 1045 | + notebook.phone); | ||
| 1046 | + } else { | ||
| 1047 | + Utils.showToast( | ||
| 1048 | + '临餐不可取消预订!请与前台联系取消。'); | ||
| 1049 | + } | ||
| 1050 | + } else { | ||
| 1051 | + Utils.showToast( | ||
| 1052 | + '过去餐段的订单不可取消预订!请与前台联系取消。'); | ||
| 1053 | + } | ||
| 873 | }, | 1054 | }, |
| 874 | child: Text( | 1055 | child: Text( |
| 875 | '取消预订', | 1056 | '取消预订', |
| @@ -29,6 +29,7 @@ import 'package:table_calendar/table_calendar.dart'; | @@ -29,6 +29,7 @@ import 'package:table_calendar/table_calendar.dart'; | ||
| 29 | 29 | ||
| 30 | import '../../models/note_book_only_model.dart'; | 30 | import '../../models/note_book_only_model.dart'; |
| 31 | import '../../provider/collect_store_provider.dart'; | 31 | import '../../provider/collect_store_provider.dart'; |
| 32 | +import '../../provider/marketing_center_provider.dart'; | ||
| 32 | import '../../provider/store_base_info_provider.dart'; | 33 | import '../../provider/store_base_info_provider.dart'; |
| 33 | import '../../provider/table_manage_model.dart'; | 34 | import '../../provider/table_manage_model.dart'; |
| 34 | import '../../utils/screen_util.dart'; | 35 | import '../../utils/screen_util.dart'; |
| @@ -77,11 +78,33 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -77,11 +78,33 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 77 | late StoreBaseIndoProvider storeBaseIndoProvider; | 78 | late StoreBaseIndoProvider storeBaseIndoProvider; |
| 78 | String ddateSoltSelect = ''; //切换日期之前的餐段 | 79 | String ddateSoltSelect = ''; //切换日期之前的餐段 |
| 79 | 80 | ||
| 81 | + String? cancelDay; | ||
| 82 | + bool cancelShopowner = false; | ||
| 83 | + bool cancelManager = false; | ||
| 84 | + | ||
| 85 | + bool cancelOther = false; | ||
| 86 | + bool isReserveCancel = false; | ||
| 87 | + | ||
| 88 | + DateTime? date; | ||
| 89 | + | ||
| 90 | + String? solt; | ||
| 91 | + | ||
| 92 | + | ||
| 93 | + // String? roleName = | ||
| 94 | + // Provider.of<UserModel>(context, listen: false).user!.role_name; | ||
| 95 | + | ||
| 80 | @override | 96 | @override |
| 81 | void initState() { | 97 | void initState() { |
| 82 | // TODO: implement initState | 98 | // TODO: implement initState |
| 83 | super.initState(); | 99 | super.initState(); |
| 84 | 100 | ||
| 101 | + | ||
| 102 | + date = widget.date; | ||
| 103 | + solt = widget.solt; | ||
| 104 | + | ||
| 105 | + | ||
| 106 | + | ||
| 107 | + | ||
| 85 | // tabIndex = widget.tabIndex; | 108 | // tabIndex = widget.tabIndex; |
| 86 | if (widget.tabIndex == 1) { | 109 | if (widget.tabIndex == 1) { |
| 87 | isall = false; | 110 | isall = false; |
| @@ -95,7 +118,7 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -95,7 +118,7 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 95 | }); | 118 | }); |
| 96 | startingDayOfWeek = _initStartingDayOfWeek(); | 119 | startingDayOfWeek = _initStartingDayOfWeek(); |
| 97 | // dateTimeNow = DateTime.now(); | 120 | // dateTimeNow = DateTime.now(); |
| 98 | - dateTimeNow = widget.date != null ? widget.date : DateTime.now(); | 121 | + dateTimeNow = date != null ? date : DateTime.now(); |
| 99 | Duration days = dateTimeNow!.difference(DateTime.now()); | 122 | Duration days = dateTimeNow!.difference(DateTime.now()); |
| 100 | print(days); | 123 | print(days); |
| 101 | 124 | ||
| @@ -108,8 +131,8 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -108,8 +131,8 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 108 | 131 | ||
| 109 | WidgetsBinding.instance.addPostFrameCallback((_) { | 132 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 110 | getMealSectionByDay( | 133 | getMealSectionByDay( |
| 111 | - first: true, | ||
| 112 | - ); | 134 | + first: true, |
| 135 | + ); | ||
| 113 | noteBookModel.isSimple = App.sp!.getBool("isSimple") ?? true; | 136 | noteBookModel.isSimple = App.sp!.getBool("isSimple") ?? true; |
| 114 | 137 | ||
| 115 | setState(() {}); | 138 | setState(() {}); |
| @@ -119,7 +142,7 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -119,7 +142,7 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 119 | }); | 142 | }); |
| 120 | } | 143 | } |
| 121 | 144 | ||
| 122 | - getMealSectionByDay({ bool first = false}) async { | 145 | + getMealSectionByDay({bool first = false}) async { |
| 123 | Map<String, String?> pramas = { | 146 | Map<String, String?> pramas = { |
| 124 | 'sellerid': Provider.of<UserModel>(context, listen: false).user!.sellerid, | 147 | 'sellerid': Provider.of<UserModel>(context, listen: false).user!.sellerid, |
| 125 | 'day': | 148 | 'day': |
| @@ -160,12 +183,15 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -160,12 +183,15 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 160 | void dispose() { | 183 | void dispose() { |
| 161 | super.dispose(); | 184 | super.dispose(); |
| 162 | bus.off("refresh_book_list"); | 185 | bus.off("refresh_book_list"); |
| 186 | + | ||
| 187 | + | ||
| 188 | + | ||
| 163 | // _calendarController.dispose(); | 189 | // _calendarController.dispose(); |
| 164 | } | 190 | } |
| 165 | 191 | ||
| 166 | //初始化时间 | 192 | //初始化时间 |
| 167 | _initTime({bool first = false}) { | 193 | _initTime({bool first = false}) { |
| 168 | - if (first && widget.date != null) { | 194 | + if (first && date != null) { |
| 169 | _refreshPageCalendar(dateTimeNow); | 195 | _refreshPageCalendar(dateTimeNow); |
| 170 | } | 196 | } |
| 171 | storeBaseIndoProvider.dayDateData!.forEach((element) { | 197 | storeBaseIndoProvider.dayDateData!.forEach((element) { |
| @@ -181,19 +207,18 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -181,19 +207,18 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 181 | meal2 = element.mdate; | 207 | meal2 = element.mdate; |
| 182 | } | 208 | } |
| 183 | }); | 209 | }); |
| 184 | - if (first ) { | 210 | + if (first) { |
| 185 | // | 211 | // |
| 186 | - if ( widget.solt == null || widget.solt == "null") { | ||
| 187 | - initCurruntIndex(); | ||
| 188 | - | 212 | + if (solt == null || solt == "null") { |
| 213 | + initCurruntIndex(); | ||
| 189 | } else { | 214 | } else { |
| 190 | - currTimeIndex = int.parse(widget.solt!); | 215 | + currTimeIndex = int.parse(solt!); |
| 191 | } | 216 | } |
| 192 | } else { | 217 | } else { |
| 193 | if (first) { | 218 | if (first) { |
| 194 | bool has = storeBaseIndoProvider.dayDateData! | 219 | bool has = storeBaseIndoProvider.dayDateData! |
| 195 | - .any((element) => element.ddateSolt == widget.solt); | ||
| 196 | - currTimeIndex = has ? int.parse(widget.solt!) : 1; | 220 | + .any((element) => element.ddateSolt == solt); |
| 221 | + currTimeIndex = has ? int.parse(solt!) : 1; | ||
| 197 | } else { | 222 | } else { |
| 198 | bool has = storeBaseIndoProvider.dayDateData! | 223 | bool has = storeBaseIndoProvider.dayDateData! |
| 199 | .any((element) => element.ddateSolt == ddateSoltSelect); | 224 | .any((element) => element.ddateSolt == ddateSoltSelect); |
| @@ -266,6 +291,32 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -266,6 +291,32 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 266 | } | 291 | } |
| 267 | } | 292 | } |
| 268 | 293 | ||
| 294 | + getDzSellerConfTemp() async { | ||
| 295 | + MarketingCenterProvider marketingCenterProvider = | ||
| 296 | + Provider.of<MarketingCenterProvider>(context, listen: false); | ||
| 297 | + bool success = await marketingCenterProvider.getDzSellerConf(context); | ||
| 298 | + if (success && marketingCenterProvider.dzSellerConfModel != null) { | ||
| 299 | + cancelDay = marketingCenterProvider.dzSellerConfModel!.cancelDay; | ||
| 300 | + cancelShopowner = | ||
| 301 | + marketingCenterProvider.dzSellerConfModel!.cancelShopowner == '1' | ||
| 302 | + ? true | ||
| 303 | + : false; | ||
| 304 | + cancelManager = | ||
| 305 | + marketingCenterProvider.dzSellerConfModel!.cancelManager == '1' | ||
| 306 | + ? true | ||
| 307 | + : false; | ||
| 308 | + | ||
| 309 | + cancelOther = | ||
| 310 | + marketingCenterProvider.dzSellerConfModel!.cancelOther == '1' | ||
| 311 | + ? true | ||
| 312 | + : false; | ||
| 313 | + isReserveCancel = | ||
| 314 | + marketingCenterProvider.dzSellerConfModel!.isReserveCancel == '1' | ||
| 315 | + ? true | ||
| 316 | + : false; | ||
| 317 | + } | ||
| 318 | + } | ||
| 319 | + | ||
| 269 | //获取已预订列表 | 320 | //获取已预订列表 |
| 270 | _getReserveList({bool needLoading = false, bool showLoading = true}) async { | 321 | _getReserveList({bool needLoading = false, bool showLoading = true}) async { |
| 271 | Map<String, String?> params = { | 322 | Map<String, String?> params = { |
| @@ -1251,19 +1302,29 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -1251,19 +1302,29 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 1251 | bottom: ScreenUtil().setWidth(24)), | 1302 | bottom: ScreenUtil().setWidth(24)), |
| 1252 | child: model.notebooksSort![index].issimple | 1303 | child: model.notebooksSort![index].issimple |
| 1253 | ? NoteBookItemSimple( | 1304 | ? NoteBookItemSimple( |
| 1254 | - model.notebooksSort![index], index, | 1305 | + index, model.notebooksSort![index], |
| 1255 | () { | 1306 | () { |
| 1256 | _itemChangeSimple( | 1307 | _itemChangeSimple( |
| 1257 | model.notebooksSort![index]); | 1308 | model.notebooksSort![index]); |
| 1258 | - }) | 1309 | + }, |
| 1310 | + cancelDay, | ||
| 1311 | + cancelShopowner, | ||
| 1312 | + cancelManager, | ||
| 1313 | + cancelOther, | ||
| 1314 | + isReserveCancel) | ||
| 1259 | : NoteBookItemF( | 1315 | : NoteBookItemF( |
| 1260 | - model.notebooksSort![index], | ||
| 1261 | index, | 1316 | index, |
| 1317 | + model.notebooksSort![index], | ||
| 1262 | collectStoreProvider.sellerPreserve, | 1318 | collectStoreProvider.sellerPreserve, |
| 1263 | () { | 1319 | () { |
| 1264 | _itemChangeSimple( | 1320 | _itemChangeSimple( |
| 1265 | model.notebooksSort![index]); | 1321 | model.notebooksSort![index]); |
| 1266 | - }), | 1322 | + }, |
| 1323 | + cancelDay, | ||
| 1324 | + cancelShopowner, | ||
| 1325 | + cancelManager, | ||
| 1326 | + cancelOther, | ||
| 1327 | + isReserveCancel), | ||
| 1267 | ); | 1328 | ); |
| 1268 | }, childCount: model.notebooksSort!.length), | 1329 | }, childCount: model.notebooksSort!.length), |
| 1269 | // itemExtent: ScreenUtil().setWidth(112), | 1330 | // itemExtent: ScreenUtil().setWidth(112), |
| @@ -133,6 +133,8 @@ class CustomerProvider extends ChangeNotifier { | @@ -133,6 +133,8 @@ class CustomerProvider extends ChangeNotifier { | ||
| 133 | bool isAddOver = true; | 133 | bool isAddOver = true; |
| 134 | bool isSetOver = true; | 134 | bool isSetOver = true; |
| 135 | bool isReserveOver = true; | 135 | bool isReserveOver = true; |
| 136 | + bool isReserveCancel = true; | ||
| 137 | + | ||
| 136 | 138 | ||
| 137 | bool cancelOrderdayShopowner = true; | 139 | bool cancelOrderdayShopowner = true; |
| 138 | bool cancelOrderdayManager = true; | 140 | bool cancelOrderdayManager = true; |
-
Please register or login to post a comment