Showing
27 changed files
with
631 additions
and
175 deletions
| @@ -14,6 +14,7 @@ if (flutterRoot == null) { | @@ -14,6 +14,7 @@ if (flutterRoot == null) { | ||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | + | ||
| 17 | def flutterVersionCode = "480" | 18 | def flutterVersionCode = "480" |
| 18 | if (flutterVersionCode == null) { | 19 | if (flutterVersionCode == null) { |
| 19 | flutterVersionCode = '480' | 20 | flutterVersionCode = '480' |
| @@ -21,6 +22,7 @@ if (flutterVersionCode == null) { | @@ -21,6 +22,7 @@ if (flutterVersionCode == null) { | ||
| 21 | 22 | ||
| 22 | 23 | ||
| 23 | 24 | ||
| 25 | + | ||
| 24 | def flutterVersionName = "4.8.0" | 26 | def flutterVersionName = "4.8.0" |
| 25 | if (flutterVersionName == null) { | 27 | if (flutterVersionName == null) { |
| 26 | flutterVersionName = '4.8.0' | 28 | flutterVersionName = '4.8.0' |
| @@ -21,6 +21,54 @@ class TableOuter { | @@ -21,6 +21,54 @@ class TableOuter { | ||
| 21 | 21 | ||
| 22 | Map<String, dynamic> toJson() => {"name": name, "list": list}; | 22 | Map<String, dynamic> toJson() => {"name": name, "list": list}; |
| 23 | 23 | ||
| 24 | + // Setmeal.fromJson(Map<String, dynamic> json) { | ||
| 25 | + // setmealId = json['setmeal_id']; | ||
| 26 | + // price = json['price']; | ||
| 27 | + // finalPrice = json['final_price']; | ||
| 28 | + // pnum = json['pnum']; | ||
| 29 | + // min = json['min']; | ||
| 30 | + // spare = json['spare']; | ||
| 31 | + // name = json['name']; | ||
| 32 | + // select = json['select']; | ||
| 33 | + // bargaining = json['bargaining']; | ||
| 34 | + // // if (json['cooklist'] != null) { | ||
| 35 | + // // cooklist = <Cooklist>[]; | ||
| 36 | + // // json['cooklist'].forEach((v) { | ||
| 37 | + // // cooklist.add(new Cooklist.fromJson(v)); | ||
| 38 | + // // }); | ||
| 39 | + // // } | ||
| 40 | + // if (json['cooklist'] != null && json['cooklist'].length > 0) { | ||
| 41 | + // cooklist = <Cooklist>[]; | ||
| 42 | + // dataMenu = {}; | ||
| 43 | + // Map map = json['cooklist']; | ||
| 44 | + | ||
| 45 | + // map.forEach((key, v) { | ||
| 46 | + // List<Cook> cooktemp = []; | ||
| 47 | + // v.forEach((v1) { | ||
| 48 | + // cooklist.add(new Cooklist.fromJson(v1)); | ||
| 49 | + // cooktemp.add(new Cook.fromJson(v1)); | ||
| 50 | + // }); | ||
| 51 | + // dataMenu[key] = cooktemp; | ||
| 52 | + // }); | ||
| 53 | + // print(dataMenu); | ||
| 54 | + // } | ||
| 55 | + | ||
| 56 | + // // finalPriceC = json['finalPriceC']; | ||
| 57 | + // // pnumC = json['pnumC']; | ||
| 58 | + // // minC = json['minC']; | ||
| 59 | + // // spareC = json['spareC']; | ||
| 60 | + // } | ||
| 61 | + | ||
| 62 | + TableOuter.fromJson2(Map<String, dynamic> json) { | ||
| 63 | + name = json["name"]; | ||
| 64 | + if (json['list'] != null && json['list'].length > 0) { | ||
| 65 | + list = <Table>[]; | ||
| 66 | + json['list'].forEach((element) { | ||
| 67 | + list.add(Table.fromJson(element)); | ||
| 68 | + }); | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + | ||
| 24 | @override | 72 | @override |
| 25 | String toString() { | 73 | String toString() { |
| 26 | return 'TableOuter{name: $name, list: $list}'; | 74 | return 'TableOuter{name: $name, list: $list}'; |
| @@ -178,13 +178,17 @@ class DioUtil { | @@ -178,13 +178,17 @@ class DioUtil { | ||
| 178 | Options options, | 178 | Options options, |
| 179 | CancelToken cancelToken, | 179 | CancelToken cancelToken, |
| 180 | bool showLoading = true, | 180 | bool showLoading = true, |
| 181 | - bool needHeader = true}) async { | 181 | + bool needHeader = true, |
| 182 | + bool selfDismiss = false}) async { | ||
| 182 | bool connectivity = await Utils.checkConnectiviy(); | 183 | bool connectivity = await Utils.checkConnectiviy(); |
| 183 | if (!connectivity) { | 184 | if (!connectivity) { |
| 184 | Utils.showToast("网络错误,请稍后重试"); | 185 | Utils.showToast("网络错误,请稍后重试"); |
| 185 | throw MyError(type: 1); | 186 | throw MyError(type: 1); |
| 186 | } | 187 | } |
| 187 | - if (showLoading) Loading.showLoading(context); | 188 | + if (showLoading) |
| 189 | + Loading.showLoading( | ||
| 190 | + context, | ||
| 191 | + ); | ||
| 188 | try { | 192 | try { |
| 189 | print('--------' + path + '---------'); | 193 | print('--------' + path + '---------'); |
| 190 | Response response = await _dio.request(path, | 194 | Response response = await _dio.request(path, |
| @@ -223,7 +227,10 @@ class DioUtil { | @@ -223,7 +227,10 @@ class DioUtil { | ||
| 223 | _responseData = _dataMap; | 227 | _responseData = _dataMap; |
| 224 | } | 228 | } |
| 225 | 229 | ||
| 226 | - Loading.hideLoading(context); | 230 | + if (!selfDismiss) { |
| 231 | + Loading.hideLoading(context); | ||
| 232 | + } | ||
| 233 | + | ||
| 227 | return new BaseResp(_status, _code, _msg, _data, _responseData); | 234 | return new BaseResp(_status, _code, _msg, _data, _responseData); |
| 228 | } catch (e) { | 235 | } catch (e) { |
| 229 | Loading.hideLoading(context); | 236 | Loading.hideLoading(context); |
| @@ -128,7 +128,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -128,7 +128,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 128 | Map<String, String> params = { | 128 | Map<String, String> params = { |
| 129 | "uid": Provider.of<UserModel>(context, listen: false).user.openid | 129 | "uid": Provider.of<UserModel>(context, listen: false).user.openid |
| 130 | }; | 130 | }; |
| 131 | - await remarkManagerModel.getRemarks(context, params); | 131 | + await remarkManagerModel.getRemarks(context, params, |
| 132 | + showPageLoading: true); | ||
| 132 | managers = await detailModel.getManagers(context); | 133 | managers = await detailModel.getManagers(context); |
| 133 | //添加listener监听 | 134 | //添加listener监听 |
| 134 | //对应的TextField失去或者获取焦点都会回调此监听 | 135 | //对应的TextField失去或者获取焦点都会回调此监听 |
| @@ -336,7 +337,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -336,7 +337,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 336 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 337 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 337 | Map<String, String> params = {"rid": widget.rid}; | 338 | Map<String, String> params = {"rid": widget.rid}; |
| 338 | //remark信息获取 | 339 | //remark信息获取 |
| 339 | - await _onlineCheckEditProvider.getOrderInfo(context, params); | 340 | + await _onlineCheckEditProvider.getOrderInfo(context, params, |
| 341 | + isShowLoading: false); | ||
| 340 | } | 342 | } |
| 341 | 343 | ||
| 342 | ///订座详情 | 344 | ///订座详情 |
| @@ -28,6 +28,7 @@ import 'package:one_key/provider/tools.dart'; | @@ -28,6 +28,7 @@ import 'package:one_key/provider/tools.dart'; | ||
| 28 | import 'package:one_key/provider/update_model.dart'; | 28 | import 'package:one_key/provider/update_model.dart'; |
| 29 | import 'package:one_key/provider/user_model.dart'; | 29 | import 'package:one_key/provider/user_model.dart'; |
| 30 | import 'package:one_key/res/colors.dart'; | 30 | import 'package:one_key/res/colors.dart'; |
| 31 | +import 'package:one_key/route/route_handles.dart'; | ||
| 31 | import 'package:one_key/utils/dialog_util.dart'; | 32 | import 'package:one_key/utils/dialog_util.dart'; |
| 32 | 33 | ||
| 33 | import 'package:one_key/route/navigator_util.dart'; | 34 | import 'package:one_key/route/navigator_util.dart'; |
| @@ -65,7 +66,7 @@ class HomePage extends StatefulWidget { | @@ -65,7 +66,7 @@ class HomePage extends StatefulWidget { | ||
| 65 | 66 | ||
| 66 | class HomePageState extends State<HomePage> with WidgetsBindingObserver { | 67 | class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
| 67 | List<Widget> pages = List<Widget>(); | 68 | List<Widget> pages = List<Widget>(); |
| 68 | - int _currIndex = 1; | 69 | + int _currIndex = 2; |
| 69 | Color _activeColor = MyColours.color_199095; | 70 | Color _activeColor = MyColours.color_199095; |
| 70 | Color _defaultColor = MyColours.color_999999; | 71 | Color _defaultColor = MyColours.color_999999; |
| 71 | int numPush = 0; //推送消息个数 | 72 | int numPush = 0; //推送消息个数 |
| @@ -154,6 +155,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -154,6 +155,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 154 | )); | 155 | )); |
| 155 | WidgetsBinding.instance.addPostFrameCallback((_) { | 156 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 156 | initPlatformState(); | 157 | initPlatformState(); |
| 158 | + _getTableList(); | ||
| 157 | 159 | ||
| 158 | List<PullMarketingByUidSunModel> data = | 160 | List<PullMarketingByUidSunModel> data = |
| 159 | Provider.of<UserModel>(context, listen: false) | 161 | Provider.of<UserModel>(context, listen: false) |
| @@ -204,6 +206,15 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -204,6 +206,15 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 204 | }); | 206 | }); |
| 205 | } | 207 | } |
| 206 | 208 | ||
| 209 | + _getTableList() async { | ||
| 210 | + TableManagerModel tableManagerModel = | ||
| 211 | + Provider.of<TableManagerModel>(context, listen: false); | ||
| 212 | + await tableManagerModel.getTableList( | ||
| 213 | + context, | ||
| 214 | + needLoading: false, | ||
| 215 | + ); | ||
| 216 | + } | ||
| 217 | + | ||
| 207 | _initNotification() async { | 218 | _initNotification() async { |
| 208 | Map param = await Tools().getIntent(); | 219 | Map param = await Tools().getIntent(); |
| 209 | _getIntent(param); | 220 | _getIntent(param); |
| @@ -345,7 +356,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -345,7 +356,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 345 | break; | 356 | break; |
| 346 | } | 357 | } |
| 347 | } else { | 358 | } else { |
| 348 | - _getAllUnMessages(); | 359 | + // _getAllUnMessages(); |
| 349 | } | 360 | } |
| 350 | } | 361 | } |
| 351 | 362 | ||
| @@ -467,13 +478,13 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -467,13 +478,13 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 467 | fromNotify: true); | 478 | fromNotify: true); |
| 468 | break; | 479 | break; |
| 469 | case "10": | 480 | case "10": |
| 470 | - //处理客户在线预订 | 481 | + //处理客户在线预订 |
| 471 | NavigatorUtil.goHandleOnlinePage( | 482 | NavigatorUtil.goHandleOnlinePage( |
| 472 | context, custom["rid"].toString(), custom['mid'].toString(), | 483 | context, custom["rid"].toString(), custom['mid'].toString(), |
| 473 | fromNotify: true); | 484 | fromNotify: true); |
| 474 | break; | 485 | break; |
| 475 | case "11": | 486 | case "11": |
| 476 | - //订单详情 | 487 | + //订单详情 |
| 477 | NavigatorUtil.goNotebookDetailPage( | 488 | NavigatorUtil.goNotebookDetailPage( |
| 478 | context, custom['rid'].toString(), custom["uid"].toString(), | 489 | context, custom['rid'].toString(), custom["uid"].toString(), |
| 479 | mid: custom['mid'].toString(), fromNotify: true); | 490 | mid: custom['mid'].toString(), fromNotify: true); |
| @@ -542,7 +553,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -542,7 +553,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 542 | mid: custom['mid'].toString(), fromNotify: true); | 553 | mid: custom['mid'].toString(), fromNotify: true); |
| 543 | break; | 554 | break; |
| 544 | case "1": | 555 | case "1": |
| 545 | - //提前点餐消息 | 556 | + //提前点餐消息 |
| 546 | NavigatorUtil.goHasOrderFoodPage(context, | 557 | NavigatorUtil.goHasOrderFoodPage(context, |
| 547 | rid: custom["rid"], fromNotify: true); | 558 | rid: custom["rid"], fromNotify: true); |
| 548 | // bus.emit("remove_untreated_message_order", notifyParam["rid"]); | 559 | // bus.emit("remove_untreated_message_order", notifyParam["rid"]); |
| @@ -660,12 +671,12 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -660,12 +671,12 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 660 | super.didChangeAppLifecycleState(state); | 671 | super.didChangeAppLifecycleState(state); |
| 661 | switch (state) { | 672 | switch (state) { |
| 662 | case AppLifecycleState.resumed: //应用前台可见 | 673 | case AppLifecycleState.resumed: //应用前台可见 |
| 663 | - if (widget.initialIndex == 1 && needRefreshTemp == false) { | ||
| 664 | - } else { | ||
| 665 | - _clearBadge(() { | ||
| 666 | - _getAllUnMessages(); | ||
| 667 | - }); | ||
| 668 | - } | 674 | + // if (widget.initialIndex == 1 && needRefreshTemp == false) { |
| 675 | + // } else { | ||
| 676 | + // _clearBadge(() { | ||
| 677 | + // _getAllUnMessages(); | ||
| 678 | + // }); | ||
| 679 | + // } | ||
| 669 | 680 | ||
| 670 | break; | 681 | break; |
| 671 | case AppLifecycleState.inactive: | 682 | case AppLifecycleState.inactive: |
| @@ -801,6 +812,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -801,6 +812,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 801 | // ), | 812 | // ), |
| 802 | BottomNavigationBarItem( | 813 | BottomNavigationBarItem( |
| 803 | icon: Stack( | 814 | icon: Stack( |
| 815 | + clipBehavior: Clip.none, | ||
| 804 | children: [ | 816 | children: [ |
| 805 | Image( | 817 | Image( |
| 806 | image: AssetImage("assets/message_default.png"), | 818 | image: AssetImage("assets/message_default.png"), |
| @@ -808,22 +820,42 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -808,22 +820,42 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 808 | height: ScreenUtil().setWidth(48), | 820 | height: ScreenUtil().setWidth(48), |
| 809 | ), | 821 | ), |
| 810 | Positioned( | 822 | Positioned( |
| 811 | - top: 0, | ||
| 812 | - right: 0, | ||
| 813 | - child: Container( | ||
| 814 | - width: ScreenUtil().setWidth(16), | ||
| 815 | - height: ScreenUtil().setWidth(16), | ||
| 816 | - decoration: BoxDecoration( | ||
| 817 | - borderRadius: BorderRadius.circular( | ||
| 818 | - ScreenUtil().setWidth(16)), | ||
| 819 | - color: _getUnMsgNumUI() | ||
| 820 | - ? MyColours.color_fa5151 | ||
| 821 | - : Colors.transparent), | ||
| 822 | - ), | 823 | + top: -8, |
| 824 | + right: -8, | ||
| 825 | + child: _getUnMsgNumUI() | ||
| 826 | + ? Container( | ||
| 827 | + width: ScreenUtil().setWidth(36), | ||
| 828 | + height: ScreenUtil().setWidth(36), | ||
| 829 | + margin: EdgeInsets.only( | ||
| 830 | + left: ScreenUtil().setWidth(20)), | ||
| 831 | + decoration: BoxDecoration( | ||
| 832 | + borderRadius: BorderRadius.circular( | ||
| 833 | + ScreenUtil().setWidth(36)), | ||
| 834 | + color: MyColours.color_E34D59), | ||
| 835 | + alignment: Alignment.center, | ||
| 836 | + child: Text( | ||
| 837 | + "${Provider.of<MessageModel>(context, listen: true).allUnNum}", | ||
| 838 | + style: TextStyle( | ||
| 839 | + color: MyColours.color_ffffff, | ||
| 840 | + fontSize: ScreenUtil().setSp(28), | ||
| 841 | + )), | ||
| 842 | + ) | ||
| 843 | + : SizedBox(), | ||
| 844 | + // child: Container( | ||
| 845 | + // width: ScreenUtil().setWidth(16), | ||
| 846 | + // height: ScreenUtil().setWidth(16), | ||
| 847 | + // decoration: BoxDecoration( | ||
| 848 | + // borderRadius: BorderRadius.circular( | ||
| 849 | + // ScreenUtil().setWidth(16)), | ||
| 850 | + // color: _getUnMsgNumUI() | ||
| 851 | + // ? MyColours.color_fa5151 | ||
| 852 | + // : Colors.transparent), | ||
| 853 | + // ), | ||
| 823 | ) | 854 | ) |
| 824 | ], | 855 | ], |
| 825 | ), | 856 | ), |
| 826 | activeIcon: Stack( | 857 | activeIcon: Stack( |
| 858 | + clipBehavior: Clip.none, | ||
| 827 | children: [ | 859 | children: [ |
| 828 | Image( | 860 | Image( |
| 829 | image: AssetImage("assets/message_selected.png"), | 861 | image: AssetImage("assets/message_selected.png"), |
| @@ -831,18 +863,37 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -831,18 +863,37 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 831 | height: ScreenUtil().setWidth(48), | 863 | height: ScreenUtil().setWidth(48), |
| 832 | ), | 864 | ), |
| 833 | Positioned( | 865 | Positioned( |
| 834 | - top: 0, | ||
| 835 | - right: 0, | ||
| 836 | - child: Container( | ||
| 837 | - width: ScreenUtil().setWidth(16), | ||
| 838 | - height: ScreenUtil().setWidth(16), | ||
| 839 | - decoration: BoxDecoration( | ||
| 840 | - borderRadius: BorderRadius.circular( | ||
| 841 | - ScreenUtil().setWidth(16)), | ||
| 842 | - color: _getUnMsgNumUI() | ||
| 843 | - ? MyColours.color_fa5151 | ||
| 844 | - : Colors.transparent), | ||
| 845 | - ), | 866 | + top: -8, |
| 867 | + right: -8, | ||
| 868 | + child: _getUnMsgNumUI() | ||
| 869 | + ? Container( | ||
| 870 | + width: ScreenUtil().setWidth(36), | ||
| 871 | + height: ScreenUtil().setWidth(36), | ||
| 872 | + margin: EdgeInsets.only( | ||
| 873 | + left: ScreenUtil().setWidth(20)), | ||
| 874 | + decoration: BoxDecoration( | ||
| 875 | + borderRadius: BorderRadius.circular( | ||
| 876 | + ScreenUtil().setWidth(36)), | ||
| 877 | + color: MyColours.color_E34D59), | ||
| 878 | + alignment: Alignment.center, | ||
| 879 | + child: Text( | ||
| 880 | + "${Provider.of<MessageModel>(context, listen: true).allUnNum}", | ||
| 881 | + style: TextStyle( | ||
| 882 | + color: MyColours.color_ffffff, | ||
| 883 | + fontSize: ScreenUtil().setSp(28), | ||
| 884 | + )), | ||
| 885 | + ) | ||
| 886 | + : SizedBox(), | ||
| 887 | + // child: Container( | ||
| 888 | + // width: ScreenUtil().setWidth(16), | ||
| 889 | + // height: ScreenUtil().setWidth(16), | ||
| 890 | + // decoration: BoxDecoration( | ||
| 891 | + // borderRadius: BorderRadius.circular( | ||
| 892 | + // ScreenUtil().setWidth(16)), | ||
| 893 | + // color: _getUnMsgNumUI() | ||
| 894 | + // ? MyColours.color_fa5151 | ||
| 895 | + // : Colors.transparent), | ||
| 896 | + // ), | ||
| 846 | ) | 897 | ) |
| 847 | ], | 898 | ], |
| 848 | ), | 899 | ), |
| @@ -19,6 +19,8 @@ import 'package:one_key/widgets/system_app_bar.dart'; | @@ -19,6 +19,8 @@ import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 19 | import 'package:one_key/widgets/v_empty_view.dart'; | 19 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 20 | import 'package:provider/provider.dart'; | 20 | import 'package:provider/provider.dart'; |
| 21 | 21 | ||
| 22 | +import '../../../provider/table_manager_model.dart'; | ||
| 23 | + | ||
| 22 | class TablePhotoManagerPage extends StatefulWidget { | 24 | class TablePhotoManagerPage extends StatefulWidget { |
| 23 | final String tid; | 25 | final String tid; |
| 24 | final String tname; | 26 | final String tname; |
| @@ -81,6 +83,12 @@ class _TablePhotoManagerPageState extends State<TablePhotoManagerPage> { | @@ -81,6 +83,12 @@ class _TablePhotoManagerPageState extends State<TablePhotoManagerPage> { | ||
| 81 | } | 83 | } |
| 82 | bus.emit("refresh_photo_manager"); | 84 | bus.emit("refresh_photo_manager"); |
| 83 | bus.emit("refresh_photo_invication"); | 85 | bus.emit("refresh_photo_invication"); |
| 86 | + TableManagerModel tableManagerModel1 = | ||
| 87 | + Provider.of<TableManagerModel>(context, listen: false); | ||
| 88 | + tableManagerModel1.getTableList( | ||
| 89 | + context, | ||
| 90 | + needLoading: false, | ||
| 91 | + ); | ||
| 84 | } | 92 | } |
| 85 | 93 | ||
| 86 | print(_uploadImageProvider.tableImageList); | 94 | print(_uploadImageProvider.tableImageList); |
| @@ -11,6 +11,8 @@ import 'package:one_key/widgets/page_exception.dart'; | @@ -11,6 +11,8 @@ import 'package:one_key/widgets/page_exception.dart'; | ||
| 11 | import 'package:one_key/widgets/system_app_bar.dart'; | 11 | import 'package:one_key/widgets/system_app_bar.dart'; |
| 12 | import 'package:provider/provider.dart'; | 12 | import 'package:provider/provider.dart'; |
| 13 | 13 | ||
| 14 | +import '../../../provider/table_manager_model.dart'; | ||
| 15 | + | ||
| 14 | /* | 16 | /* |
| 15 | **** 区域管理 | 17 | **** 区域管理 |
| 16 | */ | 18 | */ |
| @@ -117,6 +119,15 @@ class _MyAreaManagePageState extends State<MyAreaManagePage> { | @@ -117,6 +119,15 @@ class _MyAreaManagePageState extends State<MyAreaManagePage> { | ||
| 117 | Utils.showToast('修改成功!'); | 119 | Utils.showToast('修改成功!'); |
| 118 | tableManagerModel.currentArea = value; | 120 | tableManagerModel.currentArea = value; |
| 119 | 121 | ||
| 122 | + TableManagerModel tableManagerModel1 = | ||
| 123 | + Provider.of<TableManagerModel>( | ||
| 124 | + context, | ||
| 125 | + listen: false); | ||
| 126 | + tableManagerModel1.getTableList( | ||
| 127 | + context, | ||
| 128 | + needLoading: false, | ||
| 129 | + ); | ||
| 130 | + | ||
| 120 | await tableManagerModel | 131 | await tableManagerModel |
| 121 | .refreshTable(context); | 132 | .refreshTable(context); |
| 122 | EventBus().emit("refresh_table_area"); | 133 | EventBus().emit("refresh_table_area"); |
| @@ -175,6 +186,13 @@ class _MyAreaManagePageState extends State<MyAreaManagePage> { | @@ -175,6 +186,13 @@ class _MyAreaManagePageState extends State<MyAreaManagePage> { | ||
| 175 | // .getTableList(context); | 186 | // .getTableList(context); |
| 176 | // await tableManagerModel | 187 | // await tableManagerModel |
| 177 | // .initData(); | 188 | // .initData(); |
| 189 | + TableManagerModel tableManagerModel = | ||
| 190 | + Provider.of<TableManagerModel>(context, | ||
| 191 | + listen: false); | ||
| 192 | + tableManagerModel.getTableList( | ||
| 193 | + context, | ||
| 194 | + needLoading: false, | ||
| 195 | + ); | ||
| 178 | 196 | ||
| 179 | await tableManagerModel | 197 | await tableManagerModel |
| 180 | .refreshTable(context); | 198 | .refreshTable(context); |
| @@ -38,6 +38,8 @@ import 'dart:convert' as convert; | @@ -38,6 +38,8 @@ import 'dart:convert' as convert; | ||
| 38 | import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; | 38 | import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; |
| 39 | import 'package:one_key/models/table_list.dart' as table; | 39 | import 'package:one_key/models/table_list.dart' as table; |
| 40 | 40 | ||
| 41 | +import '../../../provider/table_manager_model.dart'; | ||
| 42 | + | ||
| 41 | const scrollDuration = Duration(microseconds: 500); | 43 | const scrollDuration = Duration(microseconds: 500); |
| 42 | 44 | ||
| 43 | class MyTableManagerHomePage extends StatefulWidget { | 45 | class MyTableManagerHomePage extends StatefulWidget { |
| @@ -163,16 +165,34 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | @@ -163,16 +165,34 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | ||
| 163 | .then((results) async { | 165 | .then((results) async { |
| 164 | print(results[0]); | 166 | print(results[0]); |
| 165 | if (results[0] && results[1]) { | 167 | if (results[0] && results[1]) { |
| 168 | + TableManagerModel tableManagerModel1 = | ||
| 169 | + Provider.of<TableManagerModel>(context, listen: false); | ||
| 170 | + tableManagerModel1.getTableList( | ||
| 171 | + context, | ||
| 172 | + needLoading: false, | ||
| 173 | + ); | ||
| 166 | await tableManagerModel.refreshTable(context); | 174 | await tableManagerModel.refreshTable(context); |
| 167 | } else { | 175 | } else { |
| 168 | if (results[0]) { | 176 | if (results[0]) { |
| 169 | //修改桌位信息成功 | 177 | //修改桌位信息成功 |
| 178 | + TableManagerModel tableManagerModel1 = | ||
| 179 | + Provider.of<TableManagerModel>(context, listen: false); | ||
| 180 | + tableManagerModel1.getTableList( | ||
| 181 | + context, | ||
| 182 | + needLoading: false, | ||
| 183 | + ); | ||
| 170 | await tableManagerModel.refreshTable(context, needLoading: true); | 184 | await tableManagerModel.refreshTable(context, needLoading: true); |
| 171 | } else { | 185 | } else { |
| 172 | //修改桌位信息失败 | 186 | //修改桌位信息失败 |
| 173 | } | 187 | } |
| 174 | if (results[1]) { | 188 | if (results[1]) { |
| 175 | //合并桌位成功 | 189 | //合并桌位成功 |
| 190 | + TableManagerModel tableManagerModel = | ||
| 191 | + Provider.of<TableManagerModel>(context, listen: false); | ||
| 192 | + tableManagerModel.getTableList( | ||
| 193 | + context, | ||
| 194 | + needLoading: false, | ||
| 195 | + ); | ||
| 176 | } else { | 196 | } else { |
| 177 | //合并桌位失败 | 197 | //合并桌位失败 |
| 178 | } | 198 | } |
| @@ -316,6 +336,13 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | @@ -316,6 +336,13 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | ||
| 316 | // .getTableList(context); | 336 | // .getTableList(context); |
| 317 | // await tableManagerModel | 337 | // await tableManagerModel |
| 318 | // .initData(); | 338 | // .initData(); |
| 339 | + TableManagerModel tableManagerModel = | ||
| 340 | + Provider.of<TableManagerModel>(context, | ||
| 341 | + listen: false); | ||
| 342 | + tableManagerModel.getTableList( | ||
| 343 | + context, | ||
| 344 | + needLoading: false, | ||
| 345 | + ); | ||
| 319 | await tableManagerModel.refreshTable(context); | 346 | await tableManagerModel.refreshTable(context); |
| 320 | } | 347 | } |
| 321 | }); | 348 | }); |
| @@ -440,6 +467,13 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | @@ -440,6 +467,13 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | ||
| 440 | // .getTableList(context); | 467 | // .getTableList(context); |
| 441 | // await tableManagerModel | 468 | // await tableManagerModel |
| 442 | // .initData(); | 469 | // .initData(); |
| 470 | + TableManagerModel tableManagerModel = | ||
| 471 | + Provider.of<TableManagerModel>(context, | ||
| 472 | + listen: false); | ||
| 473 | + tableManagerModel.getTableList( | ||
| 474 | + context, | ||
| 475 | + needLoading: false, | ||
| 476 | + ); | ||
| 443 | await tableManagerModel.refreshTable(context); | 477 | await tableManagerModel.refreshTable(context); |
| 444 | } | 478 | } |
| 445 | }, onTap: (Map<String, String> value) async { | 479 | }, onTap: (Map<String, String> value) async { |
| @@ -590,6 +624,19 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | @@ -590,6 +624,19 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | ||
| 590 | .currentArea = | 624 | .currentArea = |
| 591 | value; | 625 | value; |
| 592 | 626 | ||
| 627 | + TableManagerModel | ||
| 628 | + tableManagerModel1 = | ||
| 629 | + Provider.of< | ||
| 630 | + TableManagerModel>( | ||
| 631 | + context, | ||
| 632 | + listen: | ||
| 633 | + false); | ||
| 634 | + tableManagerModel1 | ||
| 635 | + .getTableList( | ||
| 636 | + context, | ||
| 637 | + needLoading: false, | ||
| 638 | + ); | ||
| 639 | + | ||
| 593 | await tableManagerModel | 640 | await tableManagerModel |
| 594 | .refreshTable( | 641 | .refreshTable( |
| 595 | context); | 642 | context); |
| @@ -787,6 +834,18 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | @@ -787,6 +834,18 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | ||
| 787 | .currentArea = | 834 | .currentArea = |
| 788 | value; | 835 | value; |
| 789 | 836 | ||
| 837 | + TableManagerModel | ||
| 838 | + tableManagerModel1 = | ||
| 839 | + Provider.of< | ||
| 840 | + TableManagerModel>( | ||
| 841 | + context, | ||
| 842 | + listen: false); | ||
| 843 | + tableManagerModel1 | ||
| 844 | + .getTableList( | ||
| 845 | + context, | ||
| 846 | + needLoading: false, | ||
| 847 | + ); | ||
| 848 | + | ||
| 790 | await tableManagerModel | 849 | await tableManagerModel |
| 791 | .refreshTable( | 850 | .refreshTable( |
| 792 | context); | 851 | context); |
| @@ -1168,6 +1227,17 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | @@ -1168,6 +1227,17 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | ||
| 1168 | print(success); | 1227 | print(success); |
| 1169 | if (success) { | 1228 | if (success) { |
| 1170 | Utils.showToast('修改成功!'); | 1229 | Utils.showToast('修改成功!'); |
| 1230 | + TableManagerModel | ||
| 1231 | + tableManagerModel1 = | ||
| 1232 | + Provider.of< | ||
| 1233 | + TableManagerModel>( | ||
| 1234 | + context, | ||
| 1235 | + listen: false); | ||
| 1236 | + tableManagerModel1 | ||
| 1237 | + .getTableList( | ||
| 1238 | + context, | ||
| 1239 | + needLoading: false, | ||
| 1240 | + ); | ||
| 1171 | 1241 | ||
| 1172 | await tableManagerModel | 1242 | await tableManagerModel |
| 1173 | .refreshTable(context); | 1243 | .refreshTable(context); |
| @@ -1231,6 +1301,17 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | @@ -1231,6 +1301,17 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | ||
| 1231 | print(success); | 1301 | print(success); |
| 1232 | if (success) { | 1302 | if (success) { |
| 1233 | Utils.showToast('修改成功!'); | 1303 | Utils.showToast('修改成功!'); |
| 1304 | + TableManagerModel | ||
| 1305 | + tableManagerModel = | ||
| 1306 | + Provider.of< | ||
| 1307 | + TableManagerModel>( | ||
| 1308 | + context, | ||
| 1309 | + listen: false); | ||
| 1310 | + tableManagerModel | ||
| 1311 | + .getTableList( | ||
| 1312 | + context, | ||
| 1313 | + needLoading: false, | ||
| 1314 | + ); | ||
| 1234 | 1315 | ||
| 1235 | await tableManagerModel | 1316 | await tableManagerModel |
| 1236 | .refreshTable(context); | 1317 | .refreshTable(context); |
| @@ -1309,6 +1390,17 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | @@ -1309,6 +1390,17 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | ||
| 1309 | print(success); | 1390 | print(success); |
| 1310 | if (success) { | 1391 | if (success) { |
| 1311 | Utils.showToast('修改成功!'); | 1392 | Utils.showToast('修改成功!'); |
| 1393 | + TableManagerModel | ||
| 1394 | + tableManagerModel = | ||
| 1395 | + Provider.of< | ||
| 1396 | + TableManagerModel>( | ||
| 1397 | + context, | ||
| 1398 | + listen: false); | ||
| 1399 | + tableManagerModel | ||
| 1400 | + .getTableList( | ||
| 1401 | + context, | ||
| 1402 | + needLoading: false, | ||
| 1403 | + ); | ||
| 1312 | 1404 | ||
| 1313 | await tableManagerModel | 1405 | await tableManagerModel |
| 1314 | .refreshTable(context); | 1406 | .refreshTable(context); |
| @@ -1391,6 +1483,17 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | @@ -1391,6 +1483,17 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { | ||
| 1391 | // .getTableList(context); | 1483 | // .getTableList(context); |
| 1392 | // await tableManagerModel | 1484 | // await tableManagerModel |
| 1393 | // .initData(); | 1485 | // .initData(); |
| 1486 | + | ||
| 1487 | + TableManagerModel | ||
| 1488 | + tableManagerModel = | ||
| 1489 | + Provider.of<TableManagerModel>( | ||
| 1490 | + context, | ||
| 1491 | + listen: false); | ||
| 1492 | + tableManagerModel.getTableList( | ||
| 1493 | + context, | ||
| 1494 | + needLoading: false, | ||
| 1495 | + ); | ||
| 1496 | + | ||
| 1394 | await tableManagerModel | 1497 | await tableManagerModel |
| 1395 | .refreshTable(context); | 1498 | .refreshTable(context); |
| 1396 | } | 1499 | } |
| @@ -83,11 +83,13 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -83,11 +83,13 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 83 | WidgetsBinding.instance.addPostFrameCallback((_) { | 83 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 84 | _initTime(); | 84 | _initTime(); |
| 85 | setState(() {}); | 85 | setState(() {}); |
| 86 | - _getReserveList(); | 86 | + _getReserveList(needLoading: true, showLoading: false); |
| 87 | _reserveCountDay(); | 87 | _reserveCountDay(); |
| 88 | }); | 88 | }); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | + | ||
| 92 | + | ||
| 91 | /// 第一个显示今天 | 93 | /// 第一个显示今天 |
| 92 | _initStartingDayOfWeek() { | 94 | _initStartingDayOfWeek() { |
| 93 | switch (DateTime.now().weekday.toString()) { | 95 | switch (DateTime.now().weekday.toString()) { |
| @@ -204,7 +206,7 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -204,7 +206,7 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 204 | } | 206 | } |
| 205 | 207 | ||
| 206 | //获取已预订列表 | 208 | //获取已预订列表 |
| 207 | - _getReserveList() async { | 209 | + _getReserveList({bool needLoading = false, bool showLoading = true}) async { |
| 208 | Map<String, String> params = { | 210 | Map<String, String> params = { |
| 209 | "sid": userModel.user.sellerid, | 211 | "sid": userModel.user.sellerid, |
| 210 | "rdate": _getRdate(), | 212 | "rdate": _getRdate(), |
| @@ -218,7 +220,8 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -218,7 +220,8 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 218 | params["account"] = userModel.user.account; | 220 | params["account"] = userModel.user.account; |
| 219 | } | 221 | } |
| 220 | 222 | ||
| 221 | - await noteBookModel.getReserveList(context, params); | 223 | + await noteBookModel.getReserveList(context, params, |
| 224 | + needLoading: needLoading, showLoading: showLoading); | ||
| 222 | _simpleState(); | 225 | _simpleState(); |
| 223 | } | 226 | } |
| 224 | 227 |
| @@ -533,86 +533,120 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { | @@ -533,86 +533,120 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { | ||
| 533 | : '', | 533 | : '', |
| 534 | fontsize: 20), | 534 | fontsize: 20), |
| 535 | Offstage( | 535 | Offstage( |
| 536 | - offstage: _onlineCheckEditProvider.orderInfoSunModel != null | ||
| 537 | - ? _onlineCheckEditProvider | ||
| 538 | - .orderInfoSunModel.invoice?.taxnumber ?? | ||
| 539 | - '' == '' | ||
| 540 | - : true, | 536 | + offstage: |
| 537 | + _onlineCheckEditProvider.orderInfoSunModel != null && | ||
| 538 | + _onlineCheckEditProvider | ||
| 539 | + .orderInfoSunModel.invoice?.taxnumber != | ||
| 540 | + null && | ||
| 541 | + _onlineCheckEditProvider | ||
| 542 | + .orderInfoSunModel.invoice?.taxnumber != | ||
| 543 | + '' | ||
| 544 | + ? false | ||
| 545 | + : true, | ||
| 541 | child: Padding( | 546 | child: Padding( |
| 542 | padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)), | 547 | padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)), |
| 543 | child: _customInfoItemWidget( | 548 | child: _customInfoItemWidget( |
| 544 | '税号', | 549 | '税号', |
| 545 | - _onlineCheckEditProvider.orderInfoSunModel != null | ||
| 546 | - ? _onlineCheckEditProvider | ||
| 547 | - .orderInfoSunModel.invoice?.taxnumber ??'' | 550 | + _onlineCheckEditProvider.orderInfoSunModel != null && |
| 551 | + _onlineCheckEditProvider | ||
| 552 | + .orderInfoSunModel.invoice?.taxnumber != | ||
| 553 | + null && | ||
| 554 | + _onlineCheckEditProvider | ||
| 555 | + .orderInfoSunModel.invoice?.taxnumber != | ||
| 556 | + '' | ||
| 557 | + ? false | ||
| 548 | : '', | 558 | : '', |
| 549 | fontsize: 20), | 559 | fontsize: 20), |
| 550 | ), | 560 | ), |
| 551 | ), | 561 | ), |
| 552 | Offstage( | 562 | Offstage( |
| 553 | - offstage: _onlineCheckEditProvider.orderInfoSunModel != null | ||
| 554 | - ? _onlineCheckEditProvider | ||
| 555 | - .orderInfoSunModel.invoice?.companyaddress ??'' == | ||
| 556 | - '' | ||
| 557 | - : true, | 563 | + offstage: |
| 564 | + _onlineCheckEditProvider.orderInfoSunModel != null && | ||
| 565 | + _onlineCheckEditProvider.orderInfoSunModel.invoice | ||
| 566 | + ?.companyaddress != | ||
| 567 | + null && | ||
| 568 | + _onlineCheckEditProvider.orderInfoSunModel.invoice | ||
| 569 | + ?.companyaddress != | ||
| 570 | + '' | ||
| 571 | + ? false | ||
| 572 | + : true, | ||
| 558 | child: Padding( | 573 | child: Padding( |
| 559 | padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)), | 574 | padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)), |
| 560 | child: _customInfoItemWidget( | 575 | child: _customInfoItemWidget( |
| 561 | '地址', | 576 | '地址', |
| 562 | _onlineCheckEditProvider.orderInfoSunModel != null | 577 | _onlineCheckEditProvider.orderInfoSunModel != null |
| 563 | - ? _onlineCheckEditProvider | ||
| 564 | - .orderInfoSunModel.invoice?.companyaddress ??'' | 578 | + ? _onlineCheckEditProvider.orderInfoSunModel.invoice |
| 579 | + ?.companyaddress ?? | ||
| 580 | + '' | ||
| 565 | : '', | 581 | : '', |
| 566 | fontsize: 20), | 582 | fontsize: 20), |
| 567 | ), | 583 | ), |
| 568 | ), | 584 | ), |
| 569 | Offstage( | 585 | Offstage( |
| 570 | - offstage: _onlineCheckEditProvider.orderInfoSunModel != null | ||
| 571 | - ? _onlineCheckEditProvider | ||
| 572 | - .orderInfoSunModel.invoice?.telephone ??'' == | ||
| 573 | - '' | ||
| 574 | - : true, | 586 | + offstage: |
| 587 | + _onlineCheckEditProvider.orderInfoSunModel != null && | ||
| 588 | + _onlineCheckEditProvider | ||
| 589 | + .orderInfoSunModel.invoice?.telephone != | ||
| 590 | + null && | ||
| 591 | + _onlineCheckEditProvider | ||
| 592 | + .orderInfoSunModel.invoice?.telephone != | ||
| 593 | + '' | ||
| 594 | + ? false | ||
| 595 | + : true, | ||
| 575 | child: Padding( | 596 | child: Padding( |
| 576 | padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)), | 597 | padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)), |
| 577 | child: _customInfoItemWidget( | 598 | child: _customInfoItemWidget( |
| 578 | '电话', | 599 | '电话', |
| 579 | _onlineCheckEditProvider.orderInfoSunModel != null | 600 | _onlineCheckEditProvider.orderInfoSunModel != null |
| 580 | ? _onlineCheckEditProvider | 601 | ? _onlineCheckEditProvider |
| 581 | - .orderInfoSunModel.invoice?.telephone ??'' | 602 | + .orderInfoSunModel.invoice?.telephone ?? |
| 603 | + '' | ||
| 582 | : '', | 604 | : '', |
| 583 | fontsize: 20), | 605 | fontsize: 20), |
| 584 | ), | 606 | ), |
| 585 | ), | 607 | ), |
| 586 | Offstage( | 608 | Offstage( |
| 587 | - offstage: _onlineCheckEditProvider.orderInfoSunModel != null | ||
| 588 | - ? _onlineCheckEditProvider | ||
| 589 | - .orderInfoSunModel.invoice?.bankname ??'' == | ||
| 590 | - '' | ||
| 591 | - : true, | 609 | + offstage: |
| 610 | + _onlineCheckEditProvider.orderInfoSunModel != null && | ||
| 611 | + _onlineCheckEditProvider | ||
| 612 | + .orderInfoSunModel.invoice?.bankname != | ||
| 613 | + null && | ||
| 614 | + _onlineCheckEditProvider | ||
| 615 | + .orderInfoSunModel.invoice?.bankname != | ||
| 616 | + '' | ||
| 617 | + ? false | ||
| 618 | + : true, | ||
| 592 | child: Padding( | 619 | child: Padding( |
| 593 | padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)), | 620 | padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)), |
| 594 | child: _customInfoItemWidget( | 621 | child: _customInfoItemWidget( |
| 595 | '开户行', | 622 | '开户行', |
| 596 | _onlineCheckEditProvider.orderInfoSunModel != null | 623 | _onlineCheckEditProvider.orderInfoSunModel != null |
| 597 | ? _onlineCheckEditProvider | 624 | ? _onlineCheckEditProvider |
| 598 | - .orderInfoSunModel.invoice?.bankname ??'' | 625 | + .orderInfoSunModel.invoice?.bankname ?? |
| 626 | + '' | ||
| 599 | : '', | 627 | : '', |
| 600 | fontsize: 20), | 628 | fontsize: 20), |
| 601 | ), | 629 | ), |
| 602 | ), | 630 | ), |
| 603 | Offstage( | 631 | Offstage( |
| 604 | - offstage: _onlineCheckEditProvider.orderInfoSunModel != null | ||
| 605 | - ? _onlineCheckEditProvider | ||
| 606 | - .orderInfoSunModel.invoice?.bankaccount ??'' == | ||
| 607 | - '' | ||
| 608 | - : true, | 632 | + offstage: |
| 633 | + _onlineCheckEditProvider.orderInfoSunModel != null && | ||
| 634 | + _onlineCheckEditProvider | ||
| 635 | + .orderInfoSunModel.invoice?.bankaccount != | ||
| 636 | + null && | ||
| 637 | + _onlineCheckEditProvider | ||
| 638 | + .orderInfoSunModel.invoice?.bankaccount != | ||
| 639 | + '' | ||
| 640 | + ? false | ||
| 641 | + : true, | ||
| 609 | child: Padding( | 642 | child: Padding( |
| 610 | padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)), | 643 | padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)), |
| 611 | child: _customInfoItemWidget( | 644 | child: _customInfoItemWidget( |
| 612 | '账号', | 645 | '账号', |
| 613 | _onlineCheckEditProvider.orderInfoSunModel != null | 646 | _onlineCheckEditProvider.orderInfoSunModel != null |
| 614 | ? _onlineCheckEditProvider | 647 | ? _onlineCheckEditProvider |
| 615 | - .orderInfoSunModel.invoice?.bankaccount ??'' | 648 | + .orderInfoSunModel.invoice?.bankaccount ?? |
| 649 | + '' | ||
| 616 | : '', | 650 | : '', |
| 617 | fontsize: 20), | 651 | fontsize: 20), |
| 618 | ), | 652 | ), |
| @@ -45,6 +45,8 @@ import 'dart:convert' as convert; | @@ -45,6 +45,8 @@ import 'dart:convert' as convert; | ||
| 45 | import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; | 45 | import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; |
| 46 | import 'package:one_key/models/table_list.dart' as table; | 46 | import 'package:one_key/models/table_list.dart' as table; |
| 47 | 47 | ||
| 48 | +import '../../app.dart'; | ||
| 49 | +import '../../widgets/loading.dart'; | ||
| 48 | import '../../widgets/special_text/my_extended_text_selection_controls.dart'; | 50 | import '../../widgets/special_text/my_extended_text_selection_controls.dart'; |
| 49 | 51 | ||
| 50 | const scrollDuration = Duration(microseconds: 500); | 52 | const scrollDuration = Duration(microseconds: 500); |
| @@ -126,6 +128,14 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -126,6 +128,14 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 126 | 128 | ||
| 127 | WidgetsBinding.instance.addPostFrameCallback((_) { | 129 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 128 | // couponProvider.sendSMS = false; | 130 | // couponProvider.sendSMS = false; |
| 131 | + String tableSp = App.sp.getString('table_list'); | ||
| 132 | + if (tableSp != null) { | ||
| 133 | + //有缓存数据 | ||
| 134 | + tableManagerModel.showLoading = true; | ||
| 135 | + Loading.showLoading(context); | ||
| 136 | + } else { | ||
| 137 | + tableManagerModel.showLoading = false; | ||
| 138 | + } | ||
| 129 | 139 | ||
| 130 | _myExtendedMaterialTextSelectionControls = | 140 | _myExtendedMaterialTextSelectionControls = |
| 131 | MyTextSelectionControls(callback: (value) { | 141 | MyTextSelectionControls(callback: (value) { |
| @@ -137,7 +147,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -137,7 +147,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 137 | }); | 147 | }); |
| 138 | 148 | ||
| 139 | tableManagerModel.initTime(context); | 149 | tableManagerModel.initTime(context); |
| 140 | - _couponNetworkData(); | 150 | + _couponNetworkData(selfDismiss: true); |
| 141 | _getSmsInfo(context); | 151 | _getSmsInfo(context); |
| 142 | 152 | ||
| 143 | EventBus().on("refresh_tablemanager", (arg) { | 153 | EventBus().on("refresh_tablemanager", (arg) { |
| @@ -168,7 +178,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -168,7 +178,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 168 | 178 | ||
| 169 | ///获取短信余量 | 179 | ///获取短信余量 |
| 170 | _getSmsInfo(context) async { | 180 | _getSmsInfo(context) async { |
| 171 | - smsInfoData = await myModel.getSmsInfo(context); | 181 | + smsInfoData = await myModel.getSmsInfo(context,selfDismiss: true); |
| 172 | if (myModel.smsInfo == '0') { | 182 | if (myModel.smsInfo == '0') { |
| 173 | if (!mounted) { | 183 | if (!mounted) { |
| 174 | return; | 184 | return; |
| @@ -195,14 +205,15 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -195,14 +205,15 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 195 | } | 205 | } |
| 196 | 206 | ||
| 197 | ///消费券 | 207 | ///消费券 |
| 198 | - _couponNetworkData({bool isShowLoading = true}) async { | 208 | + _couponNetworkData( |
| 209 | + {bool isShowLoading = true, bool selfDismiss = false}) async { | ||
| 199 | couponSelectIndex = 0; | 210 | couponSelectIndex = 0; |
| 200 | Map<String, String> params = { | 211 | Map<String, String> params = { |
| 201 | "uid": Provider.of<UserModel>(context, listen: false).user.openid, | 212 | "uid": Provider.of<UserModel>(context, listen: false).user.openid, |
| 202 | 'status': '1' | 213 | 'status': '1' |
| 203 | }; | 214 | }; |
| 204 | await couponProvider.getCustomerSelectActivityNew(context, params, | 215 | await couponProvider.getCustomerSelectActivityNew(context, params, |
| 205 | - isShowLoading: isShowLoading); | 216 | + isShowLoading: isShowLoading, selfDismiss: selfDismiss); |
| 206 | //此人已经新建好券 | 217 | //此人已经新建好券 |
| 207 | if (couponProvider.couponListSelect.length > 0) { | 218 | if (couponProvider.couponListSelect.length > 0) { |
| 208 | // couponProvider.initCouponSelect(context); | 219 | // couponProvider.initCouponSelect(context); |
| @@ -2720,8 +2731,13 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -2720,8 +2731,13 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 2720 | tableManagerModel.returnDayDateStr(tableManagerModel.dateTimeSelect); | 2731 | tableManagerModel.returnDayDateStr(tableManagerModel.dateTimeSelect); |
| 2721 | tableManagerModel.selectWeekAndLunarCalendar = tableManagerModel | 2732 | tableManagerModel.selectWeekAndLunarCalendar = tableManagerModel |
| 2722 | .returnWeekAndLunarCalendar(tableManagerModel.dateTimeSelect, context); | 2733 | .returnWeekAndLunarCalendar(tableManagerModel.dateTimeSelect, context); |
| 2723 | - await tableManagerModel.getReserveList(context, | ||
| 2724 | - needLoading: true, showMsg: true); | 2734 | + bool success = await tableManagerModel.getReserveList(context, |
| 2735 | + needLoading: false, | ||
| 2736 | + showMsg: true, | ||
| 2737 | + showloading: true, | ||
| 2738 | + selfDismiss: true); | ||
| 2739 | + | ||
| 2740 | + Loading.hideLoading(context); | ||
| 2725 | } | 2741 | } |
| 2726 | 2742 | ||
| 2727 | @override | 2743 | @override |
| @@ -2773,9 +2789,15 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -2773,9 +2789,15 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 2773 | context, tableManagerModel.dateTime) | 2789 | context, tableManagerModel.dateTime) |
| 2774 | .then((day) async { | 2790 | .then((day) async { |
| 2775 | if (day != null) { | 2791 | if (day != null) { |
| 2776 | - tableManagerModel.createDateText(context, day); | ||
| 2777 | - await tableManagerModel.getReserveList(context, | ||
| 2778 | - needLoading: true, showMsg: true); | 2792 | + tableManagerModel.createDateText1(context, day); |
| 2793 | + bool success = await tableManagerModel | ||
| 2794 | + .getReserveList(context, | ||
| 2795 | + needLoading: false, | ||
| 2796 | + showMsg: true, | ||
| 2797 | + showloading: true, | ||
| 2798 | + selfDismiss: true); | ||
| 2799 | + | ||
| 2800 | + Loading.hideLoading(context); | ||
| 2779 | } | 2801 | } |
| 2780 | }); | 2802 | }); |
| 2781 | }, | 2803 | }, |
| @@ -3189,14 +3211,16 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -3189,14 +3211,16 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 3189 | ], | 3211 | ], |
| 3190 | ), | 3212 | ), |
| 3191 | ), | 3213 | ), |
| 3192 | - Expanded( | ||
| 3193 | - // flex: 2, | ||
| 3194 | - child: Container( | ||
| 3195 | - constraints: BoxConstraints( | ||
| 3196 | - minHeight: ScreenUtil().setWidth(100)), | ||
| 3197 | - color: Color.fromRGBO(249, 249, 249, 1), | ||
| 3198 | - child: | ||
| 3199 | - item(tableManagerModel.selectNumber))), | 3214 | + if (tableManagerModel.currentArea != null) |
| 3215 | + Expanded( | ||
| 3216 | + // flex: 2, | ||
| 3217 | + child: Container( | ||
| 3218 | + constraints: BoxConstraints( | ||
| 3219 | + minHeight: | ||
| 3220 | + ScreenUtil().setWidth(100)), | ||
| 3221 | + color: Color.fromRGBO(249, 249, 249, 1), | ||
| 3222 | + child: item( | ||
| 3223 | + tableManagerModel.selectNumber))), | ||
| 3200 | tableManagerModel.selectTables.length > 0 | 3224 | tableManagerModel.selectTables.length > 0 |
| 3201 | ? wechatNotification | 3225 | ? wechatNotification |
| 3202 | ? _selectTableWidgetWechat() | 3226 | ? _selectTableWidgetWechat() |
| @@ -277,14 +277,14 @@ class CouponProvider with ChangeNotifier { | @@ -277,14 +277,14 @@ class CouponProvider with ChangeNotifier { | ||
| 277 | ///客户经理获取所创建活动列表(选择优惠券) | 277 | ///客户经理获取所创建活动列表(选择优惠券) |
| 278 | Future<List<CouponSunModel>> getCustomerSelectActivityNew( | 278 | Future<List<CouponSunModel>> getCustomerSelectActivityNew( |
| 279 | BuildContext context, Map<String, String> params, | 279 | BuildContext context, Map<String, String> params, |
| 280 | - {isShowLoading = true}) async { | 280 | + {isShowLoading = true, bool selfDismiss = false}) async { |
| 281 | if (isShowLoading) { | 281 | if (isShowLoading) { |
| 282 | pageStateSelect = PageState.Loading; | 282 | pageStateSelect = PageState.Loading; |
| 283 | notifyListeners(); | 283 | notifyListeners(); |
| 284 | } | 284 | } |
| 285 | BaseResp<dynamic> baseResp = await DioUtil() | 285 | BaseResp<dynamic> baseResp = await DioUtil() |
| 286 | .request<dynamic>(context, Method.get, HttpUrl.get_customer_activity, | 286 | .request<dynamic>(context, Method.get, HttpUrl.get_customer_activity, |
| 287 | - data: params, showLoading: false) | 287 | + data: params, showLoading: false, selfDismiss: selfDismiss) |
| 288 | .catchError((error) { | 288 | .catchError((error) { |
| 289 | print(error.toString()); | 289 | print(error.toString()); |
| 290 | if (error is MyError) { | 290 | if (error is MyError) { |
| @@ -1770,7 +1770,10 @@ class CustomerProvider extends ChangeNotifier { | @@ -1770,7 +1770,10 @@ class CustomerProvider extends ChangeNotifier { | ||
| 1770 | {bool showLoading = false}) async { | 1770 | {bool showLoading = false}) async { |
| 1771 | BaseResp<dynamic> baseResp = await DioUtil() | 1771 | BaseResp<dynamic> baseResp = await DioUtil() |
| 1772 | .request<dynamic>(context, Method.get, HttpUrl.get_marketing_by_seller, | 1772 | .request<dynamic>(context, Method.get, HttpUrl.get_marketing_by_seller, |
| 1773 | - data: params, showLoading: showLoading) | 1773 | + data: params, |
| 1774 | + showLoading: pageStateMarketingRecord == PageState.Loading | ||
| 1775 | + ? false | ||
| 1776 | + : showLoading) | ||
| 1774 | .catchError((error) { | 1777 | .catchError((error) { |
| 1775 | print(error.toString()); | 1778 | print(error.toString()); |
| 1776 | if (error is MyError) { | 1779 | if (error is MyError) { |
| @@ -1812,7 +1815,10 @@ class CustomerProvider extends ChangeNotifier { | @@ -1812,7 +1815,10 @@ class CustomerProvider extends ChangeNotifier { | ||
| 1812 | {bool showLoading = false}) async { | 1815 | {bool showLoading = false}) async { |
| 1813 | BaseResp<dynamic> baseResp = await DioUtil() | 1816 | BaseResp<dynamic> baseResp = await DioUtil() |
| 1814 | .request<dynamic>(context, Method.get, HttpUrl.get_marketing_by_id, | 1817 | .request<dynamic>(context, Method.get, HttpUrl.get_marketing_by_id, |
| 1815 | - data: params, showLoading: showLoading) | 1818 | + data: params, |
| 1819 | + showLoading: pageStateMarketingRecordDetail == PageState.Loading | ||
| 1820 | + ? false | ||
| 1821 | + : showLoading) | ||
| 1816 | .catchError((error) { | 1822 | .catchError((error) { |
| 1817 | print(error.toString()); | 1823 | print(error.toString()); |
| 1818 | if (error is MyError) { | 1824 | if (error is MyError) { |
| @@ -281,7 +281,9 @@ class FeastModel extends ChangeNotifier { | @@ -281,7 +281,9 @@ class FeastModel extends ChangeNotifier { | ||
| 281 | {isShowLoading = true}) async { | 281 | {isShowLoading = true}) async { |
| 282 | BaseResp<dynamic> baseResp = await DioUtil() | 282 | BaseResp<dynamic> baseResp = await DioUtil() |
| 283 | .request<dynamic>(context, Method.get, HttpUrl.get_banquet_be_follow, | 283 | .request<dynamic>(context, Method.get, HttpUrl.get_banquet_be_follow, |
| 284 | - data: params, showLoading: isShowLoading) | 284 | + data: params, |
| 285 | + showLoading: | ||
| 286 | + pageStateFollowUp == PageState.Loading ? false : isShowLoading) | ||
| 285 | .catchError((error) { | 287 | .catchError((error) { |
| 286 | print(error.toString()); | 288 | print(error.toString()); |
| 287 | if (error is MyError) { | 289 | if (error is MyError) { |
| @@ -337,7 +339,8 @@ class FeastModel extends ChangeNotifier { | @@ -337,7 +339,8 @@ class FeastModel extends ChangeNotifier { | ||
| 337 | {isShowLoading = true}) async { | 339 | {isShowLoading = true}) async { |
| 338 | BaseResp<dynamic> baseResp = await DioUtil() | 340 | BaseResp<dynamic> baseResp = await DioUtil() |
| 339 | .request<dynamic>(context, Method.get, HttpUrl.get_banquet_by_time, | 341 | .request<dynamic>(context, Method.get, HttpUrl.get_banquet_by_time, |
| 340 | - data: params, showLoading: isShowLoading) | 342 | + data: params, |
| 343 | + showLoading: pageState == PageState.Loading ? false : isShowLoading) | ||
| 341 | .catchError((error) { | 344 | .catchError((error) { |
| 342 | print(error.toString()); | 345 | print(error.toString()); |
| 343 | if (error is MyError) { | 346 | if (error is MyError) { |
| @@ -655,7 +658,9 @@ class FeastModel extends ChangeNotifier { | @@ -655,7 +658,9 @@ class FeastModel extends ChangeNotifier { | ||
| 655 | {isShowLoading = true}) async { | 658 | {isShowLoading = true}) async { |
| 656 | BaseResp<dynamic> baseResp = await DioUtil() | 659 | BaseResp<dynamic> baseResp = await DioUtil() |
| 657 | .request<dynamic>(context, Method.get, HttpUrl.get_banquet_by_id, | 660 | .request<dynamic>(context, Method.get, HttpUrl.get_banquet_by_id, |
| 658 | - data: params, showLoading: isShowLoading) | 661 | + data: params, |
| 662 | + showLoading: | ||
| 663 | + pageStateBanquet == PageState.Loading ? false : isShowLoading) | ||
| 659 | .catchError((error) { | 664 | .catchError((error) { |
| 660 | print(error.toString()); | 665 | print(error.toString()); |
| 661 | if (error is MyError) { | 666 | if (error is MyError) { |
| @@ -860,7 +865,10 @@ class FeastModel extends ChangeNotifier { | @@ -860,7 +865,10 @@ class FeastModel extends ChangeNotifier { | ||
| 860 | }; | 865 | }; |
| 861 | BaseResp<dynamic> baseResp = await DioUtil() | 866 | BaseResp<dynamic> baseResp = await DioUtil() |
| 862 | .request<dynamic>(context, Method.get, HttpUrl.get_auth_user_lists, | 867 | .request<dynamic>(context, Method.get, HttpUrl.get_auth_user_lists, |
| 863 | - data: params, showLoading: showLoading) | 868 | + data: params, |
| 869 | + showLoading: pageStatePersonnalHome == PageState.Loading | ||
| 870 | + ? false | ||
| 871 | + : showLoading) | ||
| 864 | .catchError((error) { | 872 | .catchError((error) { |
| 865 | print(error.toString()); | 873 | print(error.toString()); |
| 866 | if (error is MyError) { | 874 | if (error is MyError) { |
| @@ -1021,7 +1029,9 @@ class FeastModel extends ChangeNotifier { | @@ -1021,7 +1029,9 @@ class FeastModel extends ChangeNotifier { | ||
| 1021 | }; | 1029 | }; |
| 1022 | BaseResp<dynamic> baseResp = await DioUtil() | 1030 | BaseResp<dynamic> baseResp = await DioUtil() |
| 1023 | .request<dynamic>(context, Method.get, HttpUrl.get_classify, | 1031 | .request<dynamic>(context, Method.get, HttpUrl.get_classify, |
| 1024 | - data: params, showLoading: isShowLoading) | 1032 | + data: params, |
| 1033 | + showLoading: | ||
| 1034 | + pageStateType == PageState.Loading ? false : isShowLoading) | ||
| 1025 | .catchError((error) { | 1035 | .catchError((error) { |
| 1026 | print(error.toString()); | 1036 | print(error.toString()); |
| 1027 | if (error is MyError) { | 1037 | if (error is MyError) { |
| @@ -1121,7 +1131,9 @@ class FeastModel extends ChangeNotifier { | @@ -1121,7 +1131,9 @@ class FeastModel extends ChangeNotifier { | ||
| 1121 | }; | 1131 | }; |
| 1122 | BaseResp<dynamic> baseResp = await DioUtil() | 1132 | BaseResp<dynamic> baseResp = await DioUtil() |
| 1123 | .request<dynamic>(context, Method.get, HttpUrl.get_wine, | 1133 | .request<dynamic>(context, Method.get, HttpUrl.get_wine, |
| 1124 | - data: params, showLoading: isShowLoading) | 1134 | + data: params, |
| 1135 | + showLoading: | ||
| 1136 | + pageStateWine == PageState.Loading ? false : isShowLoading) | ||
| 1125 | .catchError((error) { | 1137 | .catchError((error) { |
| 1126 | print(error.toString()); | 1138 | print(error.toString()); |
| 1127 | if (error is MyError) { | 1139 | if (error is MyError) { |
| @@ -1223,7 +1235,9 @@ class FeastModel extends ChangeNotifier { | @@ -1223,7 +1235,9 @@ class FeastModel extends ChangeNotifier { | ||
| 1223 | }; | 1235 | }; |
| 1224 | BaseResp<dynamic> baseResp = await DioUtil() | 1236 | BaseResp<dynamic> baseResp = await DioUtil() |
| 1225 | .request<dynamic>(context, Method.get, HttpUrl.get_other, | 1237 | .request<dynamic>(context, Method.get, HttpUrl.get_other, |
| 1226 | - data: params, showLoading: isShowLoading) | 1238 | + data: params, |
| 1239 | + showLoading: | ||
| 1240 | + pageStateOther == PageState.Loading ? false : isShowLoading) | ||
| 1227 | .catchError((error) { | 1241 | .catchError((error) { |
| 1228 | print(error.toString()); | 1242 | print(error.toString()); |
| 1229 | if (error is MyError) { | 1243 | if (error is MyError) { |
| @@ -1324,7 +1338,7 @@ class FeastModel extends ChangeNotifier { | @@ -1324,7 +1338,7 @@ class FeastModel extends ChangeNotifier { | ||
| 1324 | }; | 1338 | }; |
| 1325 | BaseResp<dynamic> baseResp = await DioUtil() | 1339 | BaseResp<dynamic> baseResp = await DioUtil() |
| 1326 | .request<dynamic>(context, Method.get, HttpUrl.get_setmeal, | 1340 | .request<dynamic>(context, Method.get, HttpUrl.get_setmeal, |
| 1327 | - data: params, showLoading: isShowLoading) | 1341 | + data: params, showLoading:pageStateSetmeal == PageState.Loading ? false: isShowLoading) |
| 1328 | .catchError((error) { | 1342 | .catchError((error) { |
| 1329 | print(error.toString()); | 1343 | print(error.toString()); |
| 1330 | if (error is MyError) { | 1344 | if (error is MyError) { |
| @@ -1393,7 +1407,7 @@ class FeastModel extends ChangeNotifier { | @@ -1393,7 +1407,7 @@ class FeastModel extends ChangeNotifier { | ||
| 1393 | {isShowLoading = true}) async { | 1407 | {isShowLoading = true}) async { |
| 1394 | BaseResp<dynamic> baseResp = await DioUtil() | 1408 | BaseResp<dynamic> baseResp = await DioUtil() |
| 1395 | .request<dynamic>(context, Method.get, HttpUrl.get_setmeal_by_id, | 1409 | .request<dynamic>(context, Method.get, HttpUrl.get_setmeal_by_id, |
| 1396 | - data: params, showLoading: isShowLoading) | 1410 | + data: params, showLoading:pageStateMenu == PageState.Loading ? false: isShowLoading) |
| 1397 | .catchError((error) { | 1411 | .catchError((error) { |
| 1398 | print(error.toString()); | 1412 | print(error.toString()); |
| 1399 | if (error is MyError) { | 1413 | if (error is MyError) { |
| @@ -1681,7 +1695,7 @@ class FeastModel extends ChangeNotifier { | @@ -1681,7 +1695,7 @@ class FeastModel extends ChangeNotifier { | ||
| 1681 | }; | 1695 | }; |
| 1682 | BaseResp<dynamic> baseResp = await DioUtil() | 1696 | BaseResp<dynamic> baseResp = await DioUtil() |
| 1683 | .request<dynamic>(context, Method.get, HttpUrl.get_deposit, | 1697 | .request<dynamic>(context, Method.get, HttpUrl.get_deposit, |
| 1684 | - data: params, showLoading: isShowLoading) | 1698 | + data: params, showLoading:pageStateDeposit == PageState.Loading ? false: isShowLoading) |
| 1685 | .catchError((error) { | 1699 | .catchError((error) { |
| 1686 | print(error.toString()); | 1700 | print(error.toString()); |
| 1687 | if (error is MyError) { | 1701 | if (error is MyError) { |
| @@ -90,7 +90,7 @@ class MarketingCenterProvider extends ChangeNotifier { | @@ -90,7 +90,7 @@ class MarketingCenterProvider extends ChangeNotifier { | ||
| 90 | Map<String, String> params = {"sid": userModel.user.sellerid}; | 90 | Map<String, String> params = {"sid": userModel.user.sellerid}; |
| 91 | BaseResp<dynamic> baseResp = await DioUtil() | 91 | BaseResp<dynamic> baseResp = await DioUtil() |
| 92 | .request<dynamic>(context, Method.get, HttpUrl.get_seller_template_conf, | 92 | .request<dynamic>(context, Method.get, HttpUrl.get_seller_template_conf, |
| 93 | - data: params, showLoading: showLoading) | 93 | + data: params, showLoading:pageState == PageState.Loading? false: showLoading) |
| 94 | .catchError((error) { | 94 | .catchError((error) { |
| 95 | pageState = PageState.ConnectivityError; | 95 | pageState = PageState.ConnectivityError; |
| 96 | print(error.toString()); | 96 | print(error.toString()); |
| @@ -162,7 +162,7 @@ class MarketingCenterProvider extends ChangeNotifier { | @@ -162,7 +162,7 @@ class MarketingCenterProvider extends ChangeNotifier { | ||
| 162 | }; | 162 | }; |
| 163 | BaseResp<dynamic> baseResp = await DioUtil() | 163 | BaseResp<dynamic> baseResp = await DioUtil() |
| 164 | .request<dynamic>(context, Method.get, HttpUrl.get_new_recharge_list, | 164 | .request<dynamic>(context, Method.get, HttpUrl.get_new_recharge_list, |
| 165 | - data: params, showLoading: showLoading) | 165 | + data: params, showLoading:pageStateRechargeHome == PageState.Loading ? false: showLoading) |
| 166 | .catchError((error) { | 166 | .catchError((error) { |
| 167 | pageStateRechargeHome = PageState.ConnectivityError; | 167 | pageStateRechargeHome = PageState.ConnectivityError; |
| 168 | print(error.toString()); | 168 | print(error.toString()); |
| @@ -195,7 +195,7 @@ class MarketingCenterProvider extends ChangeNotifier { | @@ -195,7 +195,7 @@ class MarketingCenterProvider extends ChangeNotifier { | ||
| 195 | }; | 195 | }; |
| 196 | BaseResp<dynamic> baseResp = await DioUtil() | 196 | BaseResp<dynamic> baseResp = await DioUtil() |
| 197 | .request<dynamic>(context, Method.get, HttpUrl.get_new_recharge_detail, | 197 | .request<dynamic>(context, Method.get, HttpUrl.get_new_recharge_detail, |
| 198 | - data: params, showLoading: showLoading) | 198 | + data: params, showLoading:pageStateDetail == PageState.Loading?false: showLoading) |
| 199 | .catchError((error) { | 199 | .catchError((error) { |
| 200 | pageStateDetail = PageState.ConnectivityError; | 200 | pageStateDetail = PageState.ConnectivityError; |
| 201 | print(error.toString()); | 201 | print(error.toString()); |
| @@ -65,7 +65,7 @@ class MenuManageProvider extends ChangeNotifier { | @@ -65,7 +65,7 @@ class MenuManageProvider extends ChangeNotifier { | ||
| 65 | {showLoading = false}) async { | 65 | {showLoading = false}) async { |
| 66 | BaseResp<dynamic> baseResp = await DioUtil() | 66 | BaseResp<dynamic> baseResp = await DioUtil() |
| 67 | .request<dynamic>(context, Method.get, HttpUrl.get_cookbook_by_class, | 67 | .request<dynamic>(context, Method.get, HttpUrl.get_cookbook_by_class, |
| 68 | - data: params, showLoading: showLoading) | 68 | + data: params, showLoading:pageState == PageState.Loading? false: showLoading) |
| 69 | .catchError((error) { | 69 | .catchError((error) { |
| 70 | print(error.toString()); | 70 | print(error.toString()); |
| 71 | if (error is MyError) { | 71 | if (error is MyError) { |
| @@ -109,7 +109,7 @@ class MenuManageProvider extends ChangeNotifier { | @@ -109,7 +109,7 @@ class MenuManageProvider extends ChangeNotifier { | ||
| 109 | BaseResp<dynamic> baseResp = await DioUtil() | 109 | BaseResp<dynamic> baseResp = await DioUtil() |
| 110 | .request<dynamic>( | 110 | .request<dynamic>( |
| 111 | context, Method.get, HttpUrl.get_cookbook_by_seller_id, | 111 | context, Method.get, HttpUrl.get_cookbook_by_seller_id, |
| 112 | - data: params, showLoading: showLoading) | 112 | + data: params, showLoading:pageStateCategory == PageState.Loading?false: showLoading) |
| 113 | .catchError((error) { | 113 | .catchError((error) { |
| 114 | print(error.toString()); | 114 | print(error.toString()); |
| 115 | if (error is MyError) { | 115 | if (error is MyError) { |
| @@ -18,13 +18,13 @@ class MyModel extends ChangeNotifier { | @@ -18,13 +18,13 @@ class MyModel extends ChangeNotifier { | ||
| 18 | String reserveTotal = ''; | 18 | String reserveTotal = ''; |
| 19 | 19 | ||
| 20 | /// 短信余量查询及套餐查询接口 | 20 | /// 短信余量查询及套餐查询接口 |
| 21 | - Future<SmsInfoData> getSmsInfo(BuildContext context) async { | 21 | + Future<SmsInfoData> getSmsInfo(BuildContext context,{bool selfDismiss = false}) async { |
| 22 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 22 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 23 | Map<String, String> params = {"seller_id": userModel.user.sellerid}; | 23 | Map<String, String> params = {"seller_id": userModel.user.sellerid}; |
| 24 | try { | 24 | try { |
| 25 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | 25 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() |
| 26 | .request<Map<String, dynamic>>(context, Method.get, HttpUrl.sms_info, | 26 | .request<Map<String, dynamic>>(context, Method.get, HttpUrl.sms_info, |
| 27 | - data: params, showLoading: false) | 27 | + data: params, showLoading: false,selfDismiss:selfDismiss) |
| 28 | .catchError((error) { | 28 | .catchError((error) { |
| 29 | print(error.toString()); | 29 | print(error.toString()); |
| 30 | }); | 30 | }); |
| @@ -81,7 +81,7 @@ class NotebookDetailModel extends ChangeNotifier { | @@ -81,7 +81,7 @@ class NotebookDetailModel extends ChangeNotifier { | ||
| 81 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | 81 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() |
| 82 | .request<Map<String, dynamic>>( | 82 | .request<Map<String, dynamic>>( |
| 83 | context, Method.get, HttpUrl.reserve_detail, | 83 | context, Method.get, HttpUrl.reserve_detail, |
| 84 | - data: params, showLoading: showCircle) | 84 | + data: params, showLoading:isShowLoading ? false: showCircle) |
| 85 | .catchError((error) { | 85 | .catchError((error) { |
| 86 | print(error.toString()); | 86 | print(error.toString()); |
| 87 | if (error is MyError) { | 87 | if (error is MyError) { |
| @@ -20,21 +20,20 @@ class NoteBookModel extends ChangeNotifier { | @@ -20,21 +20,20 @@ class NoteBookModel extends ChangeNotifier { | ||
| 20 | String totalnight = ""; //一天统计 | 20 | String totalnight = ""; //一天统计 |
| 21 | 21 | ||
| 22 | PageState pageState = PageState.Loading; | 22 | PageState pageState = PageState.Loading; |
| 23 | - | ||
| 24 | 23 | ||
| 25 | //获取已预订订单 | 24 | //获取已预订订单 |
| 26 | Future<List<Notebook>> getReserveList( | 25 | Future<List<Notebook>> getReserveList( |
| 27 | BuildContext context, Map<String, String> params, | 26 | BuildContext context, Map<String, String> params, |
| 28 | - {needLoading = true}) async { | 27 | + {bool needLoading = false, bool showLoading = true}) async { |
| 29 | if (needLoading) { | 28 | if (needLoading) { |
| 30 | pageState = PageState.Loading; | 29 | pageState = PageState.Loading; |
| 31 | notifyListeners(); | 30 | notifyListeners(); |
| 32 | } | 31 | } |
| 33 | - pageState = PageState.Loading; | ||
| 34 | - notifyListeners(); | 32 | + // pageState = PageState.Loading; |
| 33 | + // notifyListeners(); | ||
| 35 | BaseResp<List> baseResp = await DioUtil() | 34 | BaseResp<List> baseResp = await DioUtil() |
| 36 | .request<List>(context, Method.get, HttpUrl.get_reserve_list, | 35 | .request<List>(context, Method.get, HttpUrl.get_reserve_list, |
| 37 | - data: params, showLoading: false) | 36 | + data: params, showLoading:needLoading ? false: showLoading) |
| 38 | .catchError((error) { | 37 | .catchError((error) { |
| 39 | print(error.toString()); | 38 | print(error.toString()); |
| 40 | if (error is MyError) { | 39 | if (error is MyError) { |
| @@ -48,7 +48,7 @@ class OtherLoginProvider extends ChangeNotifier { | @@ -48,7 +48,7 @@ class OtherLoginProvider extends ChangeNotifier { | ||
| 48 | {isShowLoading = true, showLoading = false}) async { | 48 | {isShowLoading = true, showLoading = false}) async { |
| 49 | BaseResp<dynamic> baseResp = await DioUtil() | 49 | BaseResp<dynamic> baseResp = await DioUtil() |
| 50 | .request<dynamic>(context, Method.get, HttpUrl.check_seller_acc, | 50 | .request<dynamic>(context, Method.get, HttpUrl.check_seller_acc, |
| 51 | - data: params, showLoading: showLoading) | 51 | + data: params, showLoading:pageState == PageState.Loading ? false:showLoading) |
| 52 | .catchError((error) { | 52 | .catchError((error) { |
| 53 | print(error); | 53 | print(error); |
| 54 | }); | 54 | }); |
| @@ -50,7 +50,7 @@ class PlanDishProvider extends ChangeNotifier { | @@ -50,7 +50,7 @@ class PlanDishProvider extends ChangeNotifier { | ||
| 50 | {showLoading = false}) async { | 50 | {showLoading = false}) async { |
| 51 | BaseResp<dynamic> baseResp = await DioUtil() | 51 | BaseResp<dynamic> baseResp = await DioUtil() |
| 52 | .request<dynamic>(context, Method.get, HttpUrl.get_cookbook_by_class, | 52 | .request<dynamic>(context, Method.get, HttpUrl.get_cookbook_by_class, |
| 53 | - data: params, showLoading: showLoading) | 53 | + data: params, showLoading:pageState == PageState.Loading? false: showLoading) |
| 54 | .catchError((error) { | 54 | .catchError((error) { |
| 55 | print(error.toString()); | 55 | print(error.toString()); |
| 56 | if (error is MyError) { | 56 | if (error is MyError) { |
| @@ -268,7 +268,7 @@ class PlanDishProvider extends ChangeNotifier { | @@ -268,7 +268,7 @@ class PlanDishProvider extends ChangeNotifier { | ||
| 268 | {showLoading = false}) async { | 268 | {showLoading = false}) async { |
| 269 | BaseResp<dynamic> baseResp = await DioUtil() | 269 | BaseResp<dynamic> baseResp = await DioUtil() |
| 270 | .request<dynamic>(context, Method.get, HttpUrl.get_plan_cook_list, | 270 | .request<dynamic>(context, Method.get, HttpUrl.get_plan_cook_list, |
| 271 | - data: params, showLoading: showLoading) | 271 | + data: params, showLoading: false) |
| 272 | .catchError((error) { | 272 | .catchError((error) { |
| 273 | print(error.toString()); | 273 | print(error.toString()); |
| 274 | if (error is MyError) {} | 274 | if (error is MyError) {} |
| @@ -126,7 +126,9 @@ class StoreWineProvider with ChangeNotifier { | @@ -126,7 +126,9 @@ class StoreWineProvider with ChangeNotifier { | ||
| 126 | {bool showLoading = true}) async { | 126 | {bool showLoading = true}) async { |
| 127 | BaseResp<dynamic> baseResp = await DioUtil() | 127 | BaseResp<dynamic> baseResp = await DioUtil() |
| 128 | .request<dynamic>(context, Method.get, HttpUrl.get_store_wine_by_seller, | 128 | .request<dynamic>(context, Method.get, HttpUrl.get_store_wine_by_seller, |
| 129 | - data: params, showLoading: showLoading) | 129 | + data: params, |
| 130 | + showLoading: | ||
| 131 | + pageStateAll == PageState.Loading ? false : showLoading) | ||
| 130 | .catchError((error) { | 132 | .catchError((error) { |
| 131 | pageStateAll = PageState.ConnectivityError; | 133 | pageStateAll = PageState.ConnectivityError; |
| 132 | print(error.toString()); | 134 | print(error.toString()); |
| @@ -186,7 +188,9 @@ class StoreWineProvider with ChangeNotifier { | @@ -186,7 +188,9 @@ class StoreWineProvider with ChangeNotifier { | ||
| 186 | {bool showLoading = true}) async { | 188 | {bool showLoading = true}) async { |
| 187 | BaseResp<dynamic> baseResp = await DioUtil() | 189 | BaseResp<dynamic> baseResp = await DioUtil() |
| 188 | .request<dynamic>(context, Method.get, HttpUrl.get_store_wine_by_id, | 190 | .request<dynamic>(context, Method.get, HttpUrl.get_store_wine_by_id, |
| 189 | - data: params, showLoading: showLoading) | 191 | + data: params, |
| 192 | + showLoading: | ||
| 193 | + pageStateDetail == PageState.Loading ? false : showLoading) | ||
| 190 | .catchError((error) { | 194 | .catchError((error) { |
| 191 | pageStateDetail = PageState.ConnectivityError; | 195 | pageStateDetail = PageState.ConnectivityError; |
| 192 | print(error.toString()); | 196 | print(error.toString()); |
| @@ -218,7 +222,9 @@ class StoreWineProvider with ChangeNotifier { | @@ -218,7 +222,9 @@ class StoreWineProvider with ChangeNotifier { | ||
| 218 | BaseResp<dynamic> baseResp = await DioUtil() | 222 | BaseResp<dynamic> baseResp = await DioUtil() |
| 219 | .request<dynamic>( | 223 | .request<dynamic>( |
| 220 | context, Method.get, HttpUrl.get_store_wine_check_by_wid, | 224 | context, Method.get, HttpUrl.get_store_wine_check_by_wid, |
| 221 | - data: params, showLoading: showLoading) | 225 | + data: params, |
| 226 | + showLoading: | ||
| 227 | + pageStateRecord == PageState.Loading ? false : showLoading) | ||
| 222 | .catchError((error) { | 228 | .catchError((error) { |
| 223 | pageStateRecord = PageState.ConnectivityError; | 229 | pageStateRecord = PageState.ConnectivityError; |
| 224 | print(error.toString()); | 230 | print(error.toString()); |
| @@ -252,7 +258,9 @@ class StoreWineProvider with ChangeNotifier { | @@ -252,7 +258,9 @@ class StoreWineProvider with ChangeNotifier { | ||
| 252 | BaseResp<dynamic> baseResp = await DioUtil() | 258 | BaseResp<dynamic> baseResp = await DioUtil() |
| 253 | .request<dynamic>( | 259 | .request<dynamic>( |
| 254 | context, Method.get, HttpUrl.get_store_wine_check_list, | 260 | context, Method.get, HttpUrl.get_store_wine_check_list, |
| 255 | - data: params, showLoading: showLoading) | 261 | + data: params, |
| 262 | + showLoading: | ||
| 263 | + pageStateRecordHome == PageState.Loading ? false : showLoading) | ||
| 256 | .catchError((error) { | 264 | .catchError((error) { |
| 257 | pageStateRecordHome = PageState.ConnectivityError; | 265 | pageStateRecordHome = PageState.ConnectivityError; |
| 258 | print(error.toString()); | 266 | print(error.toString()); |
| 1 | +import 'dart:convert'; | ||
| 2 | + | ||
| 1 | import 'package:common_utils/common_utils.dart'; | 3 | import 'package:common_utils/common_utils.dart'; |
| 2 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
| 5 | +import 'package:one_key/app.dart'; | ||
| 3 | import 'package:one_key/constant/constant.dart'; | 6 | import 'package:one_key/constant/constant.dart'; |
| 4 | import 'package:one_key/constant/error.dart'; | 7 | import 'package:one_key/constant/error.dart'; |
| 5 | import 'package:one_key/constant/state.dart'; | 8 | import 'package:one_key/constant/state.dart'; |
| @@ -21,6 +24,7 @@ import 'package:one_key/utils/utils.dart'; | @@ -21,6 +24,7 @@ import 'package:one_key/utils/utils.dart'; | ||
| 21 | import 'package:provider/provider.dart'; | 24 | import 'package:provider/provider.dart'; |
| 22 | 25 | ||
| 23 | import '../models/get_board_model.dart'; | 26 | import '../models/get_board_model.dart'; |
| 27 | +import '../widgets/loading.dart'; | ||
| 24 | import 'notebook_model.dart'; | 28 | import 'notebook_model.dart'; |
| 25 | 29 | ||
| 26 | class TableManagerModel with ChangeNotifier { | 30 | class TableManagerModel with ChangeNotifier { |
| @@ -55,8 +59,6 @@ class TableManagerModel with ChangeNotifier { | @@ -55,8 +59,6 @@ class TableManagerModel with ChangeNotifier { | ||
| 55 | String night; //晚市时间段 | 59 | String night; //晚市时间段 |
| 56 | UserModel userModel; | 60 | UserModel userModel; |
| 57 | 61 | ||
| 58 | - PageState pageState = PageState.Loading; | ||
| 59 | - | ||
| 60 | Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 | 62 | Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 |
| 61 | bool swichState = false; //仅看空座 | 63 | bool swichState = false; //仅看空座 |
| 62 | String selectDateStr = ''; | 64 | String selectDateStr = ''; |
| @@ -67,15 +69,67 @@ class TableManagerModel with ChangeNotifier { | @@ -67,15 +69,67 @@ class TableManagerModel with ChangeNotifier { | ||
| 67 | List dailyList = []; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 | 69 | List dailyList = []; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 |
| 68 | List<FeastBoardModel> banquetByDateData = []; //宴会看板数据/宴会预订的数据 | 70 | List<FeastBoardModel> banquetByDateData = []; //宴会看板数据/宴会预订的数据 |
| 69 | List<Notebook> noteBooks; | 71 | List<Notebook> noteBooks; |
| 72 | + PageState pageState; | ||
| 73 | + bool showLoading = false; | ||
| 74 | + | ||
| 75 | + TableManagerModel() { | ||
| 76 | + print('fdsfs'); | ||
| 77 | + String tableSp = App.sp.getString('table_list'); | ||
| 78 | + | ||
| 79 | + if (tableSp == null) { | ||
| 80 | + pageState = PageState.Loading; | ||
| 81 | + } else { | ||
| 82 | + tableOuterList = getSpTableList(); | ||
| 83 | + tablesAll = getSpTableAll(); | ||
| 84 | + pageState = PageState.Success; | ||
| 85 | + initData(needKeep: false); | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + List<TableOuter> getSpTableList() { | ||
| 90 | + String tableList = App.sp.getString('table_list'); | ||
| 91 | + if (tableList == null) { | ||
| 92 | + return []; | ||
| 93 | + } | ||
| 94 | + List<TableOuter> temp = []; | ||
| 95 | + List list = json.decode(tableList); | ||
| 96 | + list.forEach((element) { | ||
| 97 | + temp.add(TableOuter.fromJson2(element)); | ||
| 98 | + }); | ||
| 99 | + return temp; | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + List<t.Table> getSpTableAll() { | ||
| 103 | + String tableList = App.sp.getString('table_list'); | ||
| 104 | + if (tableList == null) { | ||
| 105 | + return []; | ||
| 106 | + } else { | ||
| 107 | + List<t.Table> temp = []; | ||
| 108 | + // // List list = json.decode(tableAll); | ||
| 109 | + // // list.forEach((element) { | ||
| 110 | + // // temp.add(t.Table.fromJson(element)); | ||
| 111 | + // // }); | ||
| 112 | + // // return temp; | ||
| 113 | + // // List<TableOuter> temp = []; | ||
| 114 | + // List list = json.decode(tableList); | ||
| 115 | + // list.forEach((element) { | ||
| 116 | + // temp.addAll(TableOuter.fromJson2(element).list); | ||
| 117 | + // }); | ||
| 118 | + tableOuterList.forEach((element) { | ||
| 119 | + temp.addAll(element.list); | ||
| 120 | + }); | ||
| 121 | + return temp; | ||
| 122 | + } | ||
| 123 | + } | ||
| 70 | 124 | ||
| 71 | //指定日期、时段宴会预定 | 125 | //指定日期、时段宴会预定 |
| 72 | 126 | ||
| 73 | Future<bool> getBanquetByDate( | 127 | Future<bool> getBanquetByDate( |
| 74 | BuildContext context, Map<String, String> params, | 128 | BuildContext context, Map<String, String> params, |
| 75 | - {showLoading = false}) async { | 129 | + {showLoading = false, bool selfDismiss = false}) async { |
| 76 | BaseResp<dynamic> baseResp = await DioUtil() | 130 | BaseResp<dynamic> baseResp = await DioUtil() |
| 77 | .request<dynamic>(context, Method.get, HttpUrl.get_banquet_by_date, | 131 | .request<dynamic>(context, Method.get, HttpUrl.get_banquet_by_date, |
| 78 | - data: params, showLoading: showLoading) | 132 | + data: params, showLoading: showLoading, selfDismiss: selfDismiss) |
| 79 | .catchError((error) { | 133 | .catchError((error) { |
| 80 | print(error.toString()); | 134 | print(error.toString()); |
| 81 | if (error is MyError) {} | 135 | if (error is MyError) {} |
| @@ -174,9 +228,29 @@ class TableManagerModel with ChangeNotifier { | @@ -174,9 +228,29 @@ class TableManagerModel with ChangeNotifier { | ||
| 174 | } | 228 | } |
| 175 | selectDateStr = returnDayDateStr(dateTime); | 229 | selectDateStr = returnDayDateStr(dateTime); |
| 176 | selectWeekAndLunarCalendar = returnWeekAndLunarCalendar(dateTime, context); | 230 | selectWeekAndLunarCalendar = returnWeekAndLunarCalendar(dateTime, context); |
| 177 | - List temp = await getTableList(context); | 231 | + |
| 232 | + List temp = []; | ||
| 233 | + String tableSp = App.sp.getString('table_list'); | ||
| 234 | + if (tableSp == null) { | ||
| 235 | + temp = await getTableList(context); | ||
| 236 | + } else { | ||
| 237 | + // List list = json.decode(tableSp); | ||
| 238 | + // list.forEach((element) { | ||
| 239 | + // temp.add(TableOuter.fromJson2(element)); | ||
| 240 | + // }); | ||
| 241 | + temp = getSpTableList(); | ||
| 242 | + } | ||
| 243 | + | ||
| 178 | if (temp.length > 0) { | 244 | if (temp.length > 0) { |
| 179 | - getReserveList(context); | 245 | + await getReserveList(context, selfDismiss: true); |
| 246 | + // await getReserveList(context, | ||
| 247 | + // needLoading: false, | ||
| 248 | + // showMsg: true, | ||
| 249 | + // showloading: true, | ||
| 250 | + // selfDismiss: true); | ||
| 251 | + if (showLoading) { | ||
| 252 | + Loading.hideLoading(context); | ||
| 253 | + } | ||
| 180 | } else { | 254 | } else { |
| 181 | // pageState = PageState.Empty; | 255 | // pageState = PageState.Empty; |
| 182 | pageState = PageState.Success; | 256 | pageState = PageState.Success; |
| @@ -289,7 +363,6 @@ class TableManagerModel with ChangeNotifier { | @@ -289,7 +363,6 @@ class TableManagerModel with ChangeNotifier { | ||
| 289 | /*获取结束分钟*/ | 363 | /*获取结束分钟*/ |
| 290 | int endMinute = int.parse(endTemp[1]); | 364 | int endMinute = int.parse(endTemp[1]); |
| 291 | if (endMinute == 15) { | 365 | if (endMinute == 15) { |
| 292 | - | ||
| 293 | endDate = '${endHour}:00'; | 366 | endDate = '${endHour}:00'; |
| 294 | } else if (endMinute == 45) { | 367 | } else if (endMinute == 45) { |
| 295 | endDate = '${endHour}:30'; | 368 | endDate = '${endHour}:30'; |
| @@ -339,8 +412,13 @@ class TableManagerModel with ChangeNotifier { | @@ -339,8 +412,13 @@ class TableManagerModel with ChangeNotifier { | ||
| 339 | Utils.showToast('请选择桌位'); | 412 | Utils.showToast('请选择桌位'); |
| 340 | return null; | 413 | return null; |
| 341 | } | 414 | } |
| 342 | - bool sucess = await getReserveList(context, | ||
| 343 | - showMsg: true, needLoading: false, needKeep: true, showloading: true); | 415 | + bool sucess = await getReserveList( |
| 416 | + context, | ||
| 417 | + showMsg: true, | ||
| 418 | + needLoading: false, | ||
| 419 | + needKeep: true, | ||
| 420 | + showloading: true, | ||
| 421 | + ); | ||
| 344 | if (sucess) { | 422 | if (sucess) { |
| 345 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 423 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 346 | // | 424 | // |
| @@ -456,16 +534,22 @@ class TableManagerModel with ChangeNotifier { | @@ -456,16 +534,22 @@ class TableManagerModel with ChangeNotifier { | ||
| 456 | 534 | ||
| 457 | //获取桌位数据 | 535 | //获取桌位数据 |
| 458 | Future<List<TableOuter>> getTableList(BuildContext context, | 536 | Future<List<TableOuter>> getTableList(BuildContext context, |
| 459 | - {bool needLoading = true}) async { | 537 | + {bool needLoading = true, |
| 538 | + bool selfDismiss = false, | ||
| 539 | + String sellerid}) async { | ||
| 460 | if (needLoading) { | 540 | if (needLoading) { |
| 461 | pageState = PageState.Loading; | 541 | pageState = PageState.Loading; |
| 462 | notifyListeners(); | 542 | notifyListeners(); |
| 463 | } | 543 | } |
| 464 | 544 | ||
| 465 | - Map<String, String> params = {"sellerid": userModel.user.sellerid}; | 545 | + Map<String, String> params = { |
| 546 | + "sellerid": sellerid == null | ||
| 547 | + ? Provider.of<UserModel>(context, listen: false).user.sellerid | ||
| 548 | + : sellerid | ||
| 549 | + }; | ||
| 466 | BaseResp<List> baseResp = await DioUtil() | 550 | BaseResp<List> baseResp = await DioUtil() |
| 467 | .request<List>(context, Method.get, HttpUrl.table_list, | 551 | .request<List>(context, Method.get, HttpUrl.table_list, |
| 468 | - data: params, showLoading: false) | 552 | + data: params, showLoading: false, selfDismiss: selfDismiss) |
| 469 | .catchError((error) { | 553 | .catchError((error) { |
| 470 | print(error.toString()); | 554 | print(error.toString()); |
| 471 | if (error is MyError) { | 555 | if (error is MyError) { |
| @@ -541,11 +625,15 @@ class TableManagerModel with ChangeNotifier { | @@ -541,11 +625,15 @@ class TableManagerModel with ChangeNotifier { | ||
| 541 | } | 625 | } |
| 542 | } | 626 | } |
| 543 | 627 | ||
| 628 | + App.sp.setString('table_list', json.encode(tableOuterList)); | ||
| 629 | + // App.sp.setString('table_all', json.encode(tablesAll)); | ||
| 630 | + | ||
| 544 | return tableOuterList; | 631 | return tableOuterList; |
| 545 | } | 632 | } |
| 546 | 633 | ||
| 547 | //获取预订(原来普通预订和宴会预订) | 634 | //获取预订(原来普通预订和宴会预订) |
| 548 | - _getReserveListAndFeastData(context, params, showloading) async { | 635 | + _getReserveListAndFeastData(context, params, showloading, |
| 636 | + {bool selfDismiss = false}) async { | ||
| 549 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 637 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 550 | String timeStrStart = dateTime.year.toString() + | 638 | String timeStrStart = dateTime.year.toString() + |
| 551 | "-" + | 639 | "-" + |
| @@ -571,8 +659,9 @@ class TableManagerModel with ChangeNotifier { | @@ -571,8 +659,9 @@ class TableManagerModel with ChangeNotifier { | ||
| 571 | 'ddate_interval': currTimeIndex.toString() | 659 | 'ddate_interval': currTimeIndex.toString() |
| 572 | }; | 660 | }; |
| 573 | return await Future.wait<bool>([ | 661 | return await Future.wait<bool>([ |
| 574 | - _getOldReserve(context, params, showloading), | ||
| 575 | - getBanquetByDate(context, banquetmap, showLoading: showloading) | 662 | + _getOldReserve(context, params, showloading, selfDismiss: selfDismiss), |
| 663 | + getBanquetByDate(context, banquetmap, | ||
| 664 | + showLoading: showloading, selfDismiss: selfDismiss) | ||
| 576 | ]).then((results) { | 665 | ]).then((results) { |
| 577 | if (results[0] && results[1]) { | 666 | if (results[0] && results[1]) { |
| 578 | //成功 | 667 | //成功 |
| @@ -591,9 +680,10 @@ class TableManagerModel with ChangeNotifier { | @@ -591,9 +680,10 @@ class TableManagerModel with ChangeNotifier { | ||
| 591 | }); | 680 | }); |
| 592 | } | 681 | } |
| 593 | 682 | ||
| 594 | - Future<bool> _getOldReserve(context, params, showloading) async { | ||
| 595 | - List<Notebook> noteBooks = | ||
| 596 | - await newGetReserveList(context, params, showLoading: showloading); | 683 | + Future<bool> _getOldReserve(context, params, showloading, |
| 684 | + {bool selfDismiss = false}) async { | ||
| 685 | + List<Notebook> noteBooks = await newGetReserveList(context, params, | ||
| 686 | + showLoading: showloading, selfDismiss: selfDismiss); | ||
| 597 | return true; | 687 | return true; |
| 598 | } | 688 | } |
| 599 | 689 | ||
| @@ -602,7 +692,8 @@ class TableManagerModel with ChangeNotifier { | @@ -602,7 +692,8 @@ class TableManagerModel with ChangeNotifier { | ||
| 602 | {bool needLoading = true, | 692 | {bool needLoading = true, |
| 603 | bool needKeep = false, | 693 | bool needKeep = false, |
| 604 | bool showMsg = false, | 694 | bool showMsg = false, |
| 605 | - bool showloading = false}) async { | 695 | + bool showloading = false, |
| 696 | + bool selfDismiss = false}) async { | ||
| 606 | tableMap.clear(); | 697 | tableMap.clear(); |
| 607 | NoteBookModel model = new NoteBookModel(); | 698 | NoteBookModel model = new NoteBookModel(); |
| 608 | Map<String, String> params = { | 699 | Map<String, String> params = { |
| @@ -614,13 +705,15 @@ class TableManagerModel with ChangeNotifier { | @@ -614,13 +705,15 @@ class TableManagerModel with ChangeNotifier { | ||
| 614 | "keywords": "", | 705 | "keywords": "", |
| 615 | "sort": "1" | 706 | "sort": "1" |
| 616 | }; | 707 | }; |
| 617 | - if (needLoading) { | 708 | + String tableSp = App.sp.getString('table_list'); |
| 709 | + if (needLoading && tableSp == null) { | ||
| 618 | pageState = PageState.Loading; | 710 | pageState = PageState.Loading; |
| 619 | notifyListeners(); | 711 | notifyListeners(); |
| 620 | } | 712 | } |
| 621 | 713 | ||
| 622 | - bool success = | ||
| 623 | - await _getReserveListAndFeastData(context, params, showloading); | 714 | + bool success = await _getReserveListAndFeastData( |
| 715 | + context, params, (needLoading && tableSp == null) ? false : showloading, | ||
| 716 | + selfDismiss: selfDismiss); | ||
| 624 | if (success) { | 717 | if (success) { |
| 625 | List<FeastBoardModel> banquetByDateDataTemp = []; //转换为桌子id为key,data为value | 718 | List<FeastBoardModel> banquetByDateDataTemp = []; //转换为桌子id为key,data为value |
| 626 | banquetByDateData.forEach((element) { | 719 | banquetByDateData.forEach((element) { |
| @@ -693,25 +786,28 @@ class TableManagerModel with ChangeNotifier { | @@ -693,25 +786,28 @@ class TableManagerModel with ChangeNotifier { | ||
| 693 | Utils.showToast('${msg}已被预订,请选择其他桌位!'); | 786 | Utils.showToast('${msg}已被预订,请选择其他桌位!'); |
| 694 | print(tableMap); | 787 | print(tableMap); |
| 695 | initData(needKeep: needKeep); | 788 | initData(needKeep: needKeep); |
| 789 | + | ||
| 696 | // notifyListeners(); | 790 | // notifyListeners(); |
| 697 | return false; | 791 | return false; |
| 698 | } | 792 | } |
| 699 | 793 | ||
| 700 | print(tableMap); | 794 | print(tableMap); |
| 701 | initData(needKeep: needKeep); | 795 | initData(needKeep: needKeep); |
| 796 | + | ||
| 702 | return true; | 797 | return true; |
| 703 | } | 798 | } |
| 799 | + | ||
| 704 | return false; | 800 | return false; |
| 705 | } | 801 | } |
| 706 | 802 | ||
| 707 | //获取已预订订单 | 803 | //获取已预订订单 |
| 708 | Future<List<Notebook>> newGetReserveList( | 804 | Future<List<Notebook>> newGetReserveList( |
| 709 | BuildContext context, Map<String, String> params, | 805 | BuildContext context, Map<String, String> params, |
| 710 | - {showLoading = false}) async { | 806 | + {showLoading = false, bool selfDismiss = false}) async { |
| 711 | noteBooks = []; | 807 | noteBooks = []; |
| 712 | BaseResp<List> baseResp = await DioUtil() | 808 | BaseResp<List> baseResp = await DioUtil() |
| 713 | .request<List>(context, Method.get, HttpUrl.get_reserve_list, | 809 | .request<List>(context, Method.get, HttpUrl.get_reserve_list, |
| 714 | - data: params, showLoading: false) | 810 | + data: params, showLoading: false, selfDismiss: selfDismiss) |
| 715 | .catchError((error) { | 811 | .catchError((error) { |
| 716 | print(error.toString()); | 812 | print(error.toString()); |
| 717 | if (error is MyError) { | 813 | if (error is MyError) { |
| @@ -901,7 +997,18 @@ class TableManagerModel with ChangeNotifier { | @@ -901,7 +997,18 @@ class TableManagerModel with ChangeNotifier { | ||
| 901 | selectDateStr = returnDayDateStr(day); | 997 | selectDateStr = returnDayDateStr(day); |
| 902 | selectWeekAndLunarCalendar = returnWeekAndLunarCalendar(day, context); | 998 | selectWeekAndLunarCalendar = returnWeekAndLunarCalendar(day, context); |
| 903 | dateTime = day; | 999 | dateTime = day; |
| 904 | - getReserveList(context, needLoading: true); | 1000 | + getReserveList(context, needLoading: false, showloading: true); |
| 1001 | + } | ||
| 1002 | + | ||
| 1003 | + //生成日期文本 | ||
| 1004 | + createDateText1(BuildContext context, DateTime day) { | ||
| 1005 | + if (Utils.isOneDay(day, dateTime)) return; //日期没变 | ||
| 1006 | + dateTimeSelect = day; | ||
| 1007 | + dateText = _returnDate(day); | ||
| 1008 | + selectDateStr = returnDayDateStr(day); | ||
| 1009 | + selectWeekAndLunarCalendar = returnWeekAndLunarCalendar(day, context); | ||
| 1010 | + dateTime = day; | ||
| 1011 | + // getReserveList(context, needLoading: false, showloading: true); | ||
| 905 | } | 1012 | } |
| 906 | 1013 | ||
| 907 | _returnDate(DateTime day) { | 1014 | _returnDate(DateTime day) { |
| @@ -1043,7 +1150,9 @@ class TableManagerModel with ChangeNotifier { | @@ -1043,7 +1150,9 @@ class TableManagerModel with ChangeNotifier { | ||
| 1043 | 1150 | ||
| 1044 | //获取区域数据 | 1151 | //获取区域数据 |
| 1045 | Future<List<AreaSunModel>> getRegionBySellerid(BuildContext context) async { | 1152 | Future<List<AreaSunModel>> getRegionBySellerid(BuildContext context) async { |
| 1046 | - Map<String, String> params = {"sellerid": userModel.user.sellerid}; | 1153 | + Map<String, String> params = { |
| 1154 | + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid | ||
| 1155 | + }; | ||
| 1047 | BaseResp<List> baseResp = await DioUtil() | 1156 | BaseResp<List> baseResp = await DioUtil() |
| 1048 | .request<List>(context, Method.get, HttpUrl.get_area_by_sellerid, | 1157 | .request<List>(context, Method.get, HttpUrl.get_area_by_sellerid, |
| 1049 | data: params, showLoading: false) | 1158 | data: params, showLoading: false) |
| @@ -9,6 +9,7 @@ import 'package:one_key/models/user.dart'; | @@ -9,6 +9,7 @@ import 'package:one_key/models/user.dart'; | ||
| 9 | import 'package:one_key/net/base_resp.dart'; | 9 | import 'package:one_key/net/base_resp.dart'; |
| 10 | import 'package:one_key/net/dio_util.dart'; | 10 | import 'package:one_key/net/dio_util.dart'; |
| 11 | import 'package:one_key/net/http_url.dart'; | 11 | import 'package:one_key/net/http_url.dart'; |
| 12 | +import 'package:one_key/provider/table_manager_model.dart'; | ||
| 12 | import 'package:one_key/res/colors.dart'; | 13 | import 'package:one_key/res/colors.dart'; |
| 13 | import 'package:one_key/route/navigator_util.dart'; | 14 | import 'package:one_key/route/navigator_util.dart'; |
| 14 | import 'package:one_key/utils/utils.dart'; | 15 | import 'package:one_key/utils/utils.dart'; |
| @@ -93,6 +94,7 @@ class UserModel with ChangeNotifier { | @@ -93,6 +94,7 @@ class UserModel with ChangeNotifier { | ||
| 93 | 'nickname': user['nick_name'], | 94 | 'nickname': user['nick_name'], |
| 94 | }; | 95 | }; |
| 95 | await saveUserInfo(User.fromJson(userMap)); | 96 | await saveUserInfo(User.fromJson(userMap)); |
| 97 | + | ||
| 96 | return getSellerInfo( | 98 | return getSellerInfo( |
| 97 | context, | 99 | context, |
| 98 | {"seller_id": seller['id'], "seller_openid": seller['openid']}, | 100 | {"seller_id": seller['id'], "seller_openid": seller['openid']}, |
| @@ -334,6 +336,11 @@ class UserModel with ChangeNotifier { | @@ -334,6 +336,11 @@ class UserModel with ChangeNotifier { | ||
| 334 | App.sp.remove('openid'); | 336 | App.sp.remove('openid'); |
| 335 | App.sp.remove("unionid"); | 337 | App.sp.remove("unionid"); |
| 336 | } | 338 | } |
| 339 | + if (App.sp.containsKey('table_list')) { | ||
| 340 | + //退出清空桌位数据 | ||
| 341 | + App.sp.remove('table_list'); | ||
| 342 | + } | ||
| 343 | + | ||
| 337 | App.sp.setBool("isLogin", false); | 344 | App.sp.setBool("isLogin", false); |
| 338 | // XgFlutterPlugin().stopXg(); | 345 | // XgFlutterPlugin().stopXg(); |
| 339 | NavigatorUtil.goLoginPage(context); | 346 | NavigatorUtil.goLoginPage(context); |
| @@ -65,7 +65,7 @@ class NavigatorUtil { | @@ -65,7 +65,7 @@ class NavigatorUtil { | ||
| 65 | 65 | ||
| 66 | /// 首页 | 66 | /// 首页 |
| 67 | static void goHomePage(BuildContext context, | 67 | static void goHomePage(BuildContext context, |
| 68 | - {int initialIndex = 1, | 68 | + {int initialIndex = 2, |
| 69 | needRefresh = true, | 69 | needRefresh = true, |
| 70 | mine = false, | 70 | mine = false, |
| 71 | int dateTime, | 71 | int dateTime, |
| @@ -246,12 +246,14 @@ var homeHandler = new Handler( | @@ -246,12 +246,14 @@ var homeHandler = new Handler( | ||
| 246 | ? null | 246 | ? null |
| 247 | : DateTime.fromMillisecondsSinceEpoch( | 247 | : DateTime.fromMillisecondsSinceEpoch( |
| 248 | int.parse(params["dateTime"].first)); | 248 | int.parse(params["dateTime"].first)); |
| 249 | - return HomePage( | ||
| 250 | - initialIndex: int.parse(initialIndex), | ||
| 251 | - needReresh: needRefresh, | ||
| 252 | - mine: mine, | ||
| 253 | - date: dateTime, | ||
| 254 | - solt: solt); | 249 | + return ChangeNotifierProvider<TableManagerModel>( |
| 250 | + create: (_) => TableManagerModel(), | ||
| 251 | + child: HomePage( | ||
| 252 | + initialIndex: int.parse(initialIndex), | ||
| 253 | + needReresh: needRefresh, | ||
| 254 | + mine: mine, | ||
| 255 | + date: dateTime, | ||
| 256 | + solt: solt)); | ||
| 255 | }); | 257 | }); |
| 256 | 258 | ||
| 257 | // 跳转预订详情页 | 259 | // 跳转预订详情页 |
| @@ -800,7 +802,10 @@ var tablePhotoManagerHandler = new Handler( | @@ -800,7 +802,10 @@ var tablePhotoManagerHandler = new Handler( | ||
| 800 | FromPage.values, params["fromPage"].first); | 802 | FromPage.values, params["fromPage"].first); |
| 801 | return ChangeNotifierProvider<TablePhotoManagerModel>( | 803 | return ChangeNotifierProvider<TablePhotoManagerModel>( |
| 802 | create: (_) => TablePhotoManagerModel(), | 804 | create: (_) => TablePhotoManagerModel(), |
| 803 | - child: TablePhotoManagerPage(tid: tid, tname: tname, fromPage: fromPage)); | 805 | + child: ChangeNotifierProvider<TableManagerModel>( |
| 806 | + create: (_) => TableManagerModel(), | ||
| 807 | + child: TablePhotoManagerPage( | ||
| 808 | + tid: tid, tname: tname, fromPage: fromPage))); | ||
| 804 | // return ChangeNotifierProvider<UploadImageProvider>( | 809 | // return ChangeNotifierProvider<UploadImageProvider>( |
| 805 | // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage()); | 810 | // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage()); |
| 806 | }); | 811 | }); |
| @@ -1375,9 +1380,11 @@ var myTableManagerHomePageHandle = new Handler( | @@ -1375,9 +1380,11 @@ var myTableManagerHomePageHandle = new Handler( | ||
| 1375 | // FluroConvertUtils.fluroCnParamsDecode( | 1380 | // FluroConvertUtils.fluroCnParamsDecode( |
| 1376 | // params["userHistoryEntity"].first))); | 1381 | // params["userHistoryEntity"].first))); |
| 1377 | return ChangeNotifierProvider<MyTableManageHomeModel>( | 1382 | return ChangeNotifierProvider<MyTableManageHomeModel>( |
| 1378 | - create: (_) => MyTableManageHomeModel(), | ||
| 1379 | - child: MyTableManagerHomePage(), | ||
| 1380 | - ); | 1383 | + create: (_) => MyTableManageHomeModel(), |
| 1384 | + child: ChangeNotifierProvider<TableManagerModel>( | ||
| 1385 | + create: (_) => TableManagerModel(), | ||
| 1386 | + child: MyTableManagerHomePage(), | ||
| 1387 | + )); | ||
| 1381 | }); | 1388 | }); |
| 1382 | 1389 | ||
| 1383 | ///我的---区域管理 | 1390 | ///我的---区域管理 |
| @@ -1389,9 +1396,11 @@ var myAreaManagePageHandle = new Handler( | @@ -1389,9 +1396,11 @@ var myAreaManagePageHandle = new Handler( | ||
| 1389 | // FluroConvertUtils.fluroCnParamsDecode( | 1396 | // FluroConvertUtils.fluroCnParamsDecode( |
| 1390 | // params["userHistoryEntity"].first))); | 1397 | // params["userHistoryEntity"].first))); |
| 1391 | return ChangeNotifierProvider<MyTableManageHomeModel>( | 1398 | return ChangeNotifierProvider<MyTableManageHomeModel>( |
| 1392 | - create: (_) => MyTableManageHomeModel(), | ||
| 1393 | - child: MyAreaManagePage(), | ||
| 1394 | - ); | 1399 | + create: (_) => MyTableManageHomeModel(), |
| 1400 | + child: ChangeNotifierProvider<TableManagerModel>( | ||
| 1401 | + create: (_) => TableManagerModel(), | ||
| 1402 | + child: MyAreaManagePage(), | ||
| 1403 | + )); | ||
| 1395 | }); | 1404 | }); |
| 1396 | 1405 | ||
| 1397 | ///选择优惠券类型 | 1406 | ///选择优惠券类型 |
| 1 | import 'package:flutter/cupertino.dart'; | 1 | import 'package:flutter/cupertino.dart'; |
| 2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 3 | +import 'package:one_key/res/colors.dart'; | ||
| 3 | 4 | ||
| 4 | class Loading { | 5 | class Loading { |
| 5 | static bool isLoading = false; | 6 | static bool isLoading = false; |
| @@ -10,6 +11,7 @@ class Loading { | @@ -10,6 +11,7 @@ class Loading { | ||
| 10 | showGeneralDialog( | 11 | showGeneralDialog( |
| 11 | context: context, | 12 | context: context, |
| 12 | barrierDismissible: false, | 13 | barrierDismissible: false, |
| 14 | + barrierColor: Colors.transparent, | ||
| 13 | barrierLabel: | 15 | barrierLabel: |
| 14 | MaterialLocalizations.of(context).modalBarrierDismissLabel, | 16 | MaterialLocalizations.of(context).modalBarrierDismissLabel, |
| 15 | transitionDuration: const Duration(milliseconds: 150), | 17 | transitionDuration: const Duration(milliseconds: 150), |
| @@ -17,14 +19,16 @@ class Loading { | @@ -17,14 +19,16 @@ class Loading { | ||
| 17 | Animation secondaryAnimation) { | 19 | Animation secondaryAnimation) { |
| 18 | return Align( | 20 | return Align( |
| 19 | child: ClipRRect( | 21 | child: ClipRRect( |
| 20 | - borderRadius: BorderRadius.circular(10), | ||
| 21 | - child: Container( | ||
| 22 | - width: 100, | ||
| 23 | - height: 100, | ||
| 24 | - color: Colors.black54, | ||
| 25 | - child: CupertinoActivityIndicator(), | ||
| 26 | - ), | ||
| 27 | - ), | 22 | + borderRadius: BorderRadius.circular(10), |
| 23 | + child: Container( | ||
| 24 | + width: 200, | ||
| 25 | + height: 200, | ||
| 26 | + color: Colors.transparent, | ||
| 27 | + child: CupertinoActivityIndicator( | ||
| 28 | + color: MyColours.color_000000, | ||
| 29 | + radius: 30, | ||
| 30 | + ), | ||
| 31 | + )), | ||
| 28 | ); | 32 | ); |
| 29 | }).then((v) { | 33 | }).then((v) { |
| 30 | isLoading = false; | 34 | isLoading = false; |
-
Please register or login to post a comment