Showing
4 changed files
with
53 additions
and
33 deletions
| @@ -311,6 +311,7 @@ class SelectTableFPageState extends State<SelectTableFPage> { | @@ -311,6 +311,7 @@ class SelectTableFPageState extends State<SelectTableFPage> { | ||
| 311 | _chooseTableModel.areaTableMapShow = areaTableMap; | 311 | _chooseTableModel.areaTableMapShow = areaTableMap; |
| 312 | _chooseTableModel.tablesShow = _chooseTableModel.tablesAll; | 312 | _chooseTableModel.tablesShow = _chooseTableModel.tablesAll; |
| 313 | } | 313 | } |
| 314 | + print(currentArea); | ||
| 314 | if (widget.tid == '') { | 315 | if (widget.tid == '') { |
| 315 | if (!needRetain) { | 316 | if (!needRetain) { |
| 316 | // currentArea = areaTableMap.keys.first; | 317 | // currentArea = areaTableMap.keys.first; |
| @@ -696,6 +697,7 @@ class SelectTableFPageState extends State<SelectTableFPage> { | @@ -696,6 +697,7 @@ class SelectTableFPageState extends State<SelectTableFPage> { | ||
| 696 | isSelected = false; | 697 | isSelected = false; |
| 697 | _selectNumber = index - 1; | 698 | _selectNumber = index - 1; |
| 698 | currentArea = areas[index - 1].name; | 699 | currentArea = areas[index - 1].name; |
| 700 | + | ||
| 699 | _chooseTableModel.currentTables = | 701 | _chooseTableModel.currentTables = |
| 700 | _chooseTableModel | 702 | _chooseTableModel |
| 701 | .areaTableMapShow[currentArea]; | 703 | .areaTableMapShow[currentArea]; |
| @@ -55,7 +55,6 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -55,7 +55,6 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 55 | List<String> personNumList = []; | 55 | List<String> personNumList = []; |
| 56 | bool isSelected = true; //全部按钮 | 56 | bool isSelected = true; //全部按钮 |
| 57 | 57 | ||
| 58 | - int _selectNumber; | ||
| 59 | ScrollController _scrollCrl = ScrollController(); | 58 | ScrollController _scrollCrl = ScrollController(); |
| 60 | final ItemPositionsListener itemPositionsListener = | 59 | final ItemPositionsListener itemPositionsListener = |
| 61 | ItemPositionsListener.create(); | 60 | ItemPositionsListener.create(); |
| @@ -76,7 +75,8 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -76,7 +75,8 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 76 | tableManagerModel.initTime(context); | 75 | tableManagerModel.initTime(context); |
| 77 | EventBus().on("refresh_tablemanager", (arg) { | 76 | EventBus().on("refresh_tablemanager", (arg) { |
| 78 | //订座-完成预订 刷新管理桌位 | 77 | //订座-完成预订 刷新管理桌位 |
| 79 | - tableManagerModel.getReserveList(context); | 78 | + tableManagerModel.getReserveList(context, |
| 79 | + needLoading: false, needKeep: true); | ||
| 80 | print(tableManagerModel); | 80 | print(tableManagerModel); |
| 81 | }); | 81 | }); |
| 82 | EventBus().on("refresh_tablePhoto", (arg) { | 82 | EventBus().on("refresh_tablePhoto", (arg) { |
| @@ -145,7 +145,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -145,7 +145,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 145 | itemCount: tableManagerModel.currentArea == '全部' | 145 | itemCount: tableManagerModel.currentArea == '全部' |
| 146 | ? tableManagerModel.tablesShow.length | 146 | ? tableManagerModel.tablesShow.length |
| 147 | : tableManagerModel | 147 | : tableManagerModel |
| 148 | - .areaTableMapShow[tableManagerModel.areas[i].name].length + | 148 | + .areaTableMapShow[tableManagerModel.currentArea].length + |
| 149 | 1, | 149 | 1, |
| 150 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( | 150 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
| 151 | crossAxisCount: 4, | 151 | crossAxisCount: 4, |
| @@ -214,7 +214,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -214,7 +214,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 214 | // .getTableList(context); | 214 | // .getTableList(context); |
| 215 | // await tableManagerModel | 215 | // await tableManagerModel |
| 216 | // .initData(); | 216 | // .initData(); |
| 217 | - tableManagerModel.refreshTable(context); | 217 | + await tableManagerModel.refreshTable(context); |
| 218 | } | 218 | } |
| 219 | }); | 219 | }); |
| 220 | }, | 220 | }, |
| @@ -434,8 +434,8 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -434,8 +434,8 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 434 | children: [ | 434 | children: [ |
| 435 | RoundButton( | 435 | RoundButton( |
| 436 | onPressed: () async { | 436 | onPressed: () async { |
| 437 | - SunReserveInfoModel _model = | ||
| 438 | - await tableManagerModel.setReserveInfo(context); | 437 | + SunReserveInfoModel _model = await tableManagerModel |
| 438 | + .setReserveInfo(context, needKeep: true); | ||
| 439 | if (_model != null && | 439 | if (_model != null && |
| 440 | ObjectUtil.isNotEmpty(_model.row) && | 440 | ObjectUtil.isNotEmpty(_model.row) && |
| 441 | ObjectUtil.isNotEmpty(_model.row.id)) { | 441 | ObjectUtil.isNotEmpty(_model.row.id)) { |
| @@ -880,11 +880,15 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -880,11 +880,15 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 880 | print(success); | 880 | print(success); |
| 881 | if (success) { | 881 | if (success) { |
| 882 | Utils.showToast('添加成功!'); | 882 | Utils.showToast('添加成功!'); |
| 883 | + tableManagerModel.currentArea = | ||
| 884 | + value; | ||
| 883 | 885 | ||
| 884 | await tableManagerModel | 886 | await tableManagerModel |
| 885 | - .getTableList(context, | ||
| 886 | - needLoading: false); | ||
| 887 | - tableManagerModel.initData(); | 887 | + .refreshTable(context); |
| 888 | + // await tableManagerModel | ||
| 889 | + // .getTableList(context, | ||
| 890 | + // needLoading: false); | ||
| 891 | + // tableManagerModel.initData(); | ||
| 888 | 892 | ||
| 889 | // setState(() { | 893 | // setState(() { |
| 890 | // updateMenu(); | 894 | // updateMenu(); |
| @@ -945,12 +949,9 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -945,12 +949,9 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 945 | isSelected = true; | 949 | isSelected = true; |
| 946 | tableManagerModel.currentArea = | 950 | tableManagerModel.currentArea = |
| 947 | '全部'; | 951 | '全部'; |
| 948 | - tableManagerModel | ||
| 949 | - .currentTables = | ||
| 950 | - tableManagerModel | ||
| 951 | - .areaTableMapShow[ | ||
| 952 | - tableManagerModel | ||
| 953 | - .currentArea]; | 952 | + // tableManagerModel.tablesShow = |
| 953 | + // tableManagerModel | ||
| 954 | + // .tabl; | ||
| 954 | }); | 955 | }); |
| 955 | }, | 956 | }, |
| 956 | child: Container( | 957 | child: Container( |
| @@ -1001,15 +1002,16 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -1001,15 +1002,16 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 1001 | (area) { | 1002 | (area) { |
| 1002 | setState(() { | 1003 | setState(() { |
| 1003 | isSelected = false; | 1004 | isSelected = false; |
| 1004 | - _selectNumber = index - 1; | 1005 | + tableManagerModel.selectNumber = |
| 1006 | + index - 1; | ||
| 1005 | tableManagerModel.currentArea = | 1007 | tableManagerModel.currentArea = |
| 1006 | tableManagerModel | 1008 | tableManagerModel |
| 1007 | .areas[index - 1].name; | 1009 | .areas[index - 1].name; |
| 1008 | - tableManagerModel.currentTables = | ||
| 1009 | - tableManagerModel | ||
| 1010 | - .areaTableMapShow[ | ||
| 1011 | - tableManagerModel | ||
| 1012 | - .currentArea]; | 1010 | + // tableManagerModel.currentTables = |
| 1011 | + // tableManagerModel | ||
| 1012 | + // .areaTableMapShow[ | ||
| 1013 | + // tableManagerModel | ||
| 1014 | + // .currentArea]; | ||
| 1013 | // _anmationMenu(); | 1015 | // _anmationMenu(); |
| 1014 | }); | 1016 | }); |
| 1015 | }); | 1017 | }); |
| @@ -1078,7 +1080,8 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -1078,7 +1080,8 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 1078 | constraints: BoxConstraints( | 1080 | constraints: BoxConstraints( |
| 1079 | minHeight: ScreenUtil().setWidth(100)), | 1081 | minHeight: ScreenUtil().setWidth(100)), |
| 1080 | color: Color.fromRGBO(249, 249, 249, 1), | 1082 | color: Color.fromRGBO(249, 249, 249, 1), |
| 1081 | - child: item(_selectNumber))), | 1083 | + child: |
| 1084 | + item(tableManagerModel.selectNumber))), | ||
| 1082 | tableManagerModel.selectTables.length > 0 | 1085 | tableManagerModel.selectTables.length > 0 |
| 1083 | ? _selectTableWidget() | 1086 | ? _selectTableWidget() |
| 1084 | : SizedBox() | 1087 | : SizedBox() |
| @@ -60,6 +60,7 @@ class TableManagerModel with ChangeNotifier { | @@ -60,6 +60,7 @@ class TableManagerModel with ChangeNotifier { | ||
| 60 | String selectDateStr = ''; | 60 | String selectDateStr = ''; |
| 61 | 61 | ||
| 62 | DateTime dateTimeSelect; | 62 | DateTime dateTimeSelect; |
| 63 | + int selectNumber; | ||
| 63 | 64 | ||
| 64 | //初始化时间 | 65 | //初始化时间 |
| 65 | initTime(BuildContext context) async { | 66 | initTime(BuildContext context) async { |
| @@ -244,13 +245,14 @@ class TableManagerModel with ChangeNotifier { | @@ -244,13 +245,14 @@ class TableManagerModel with ChangeNotifier { | ||
| 244 | } | 245 | } |
| 245 | 246 | ||
| 246 | ///录入更改内部预订 | 247 | ///录入更改内部预订 |
| 247 | - Future<SunReserveInfoModel> setReserveInfo(BuildContext context) async { | 248 | + Future<SunReserveInfoModel> setReserveInfo(BuildContext context, |
| 249 | + {needKeep = false}) async { | ||
| 248 | if (selectTables.length == 0) { | 250 | if (selectTables.length == 0) { |
| 249 | Utils.showToast('请选择桌位'); | 251 | Utils.showToast('请选择桌位'); |
| 250 | return null; | 252 | return null; |
| 251 | } | 253 | } |
| 252 | - bool sucess = | ||
| 253 | - await getReserveList(context, showMsg: true, needLoading: false); | 254 | + bool sucess = await getReserveList(context, |
| 255 | + showMsg: true, needLoading: false, needKeep: true, showloading: true); | ||
| 254 | if (sucess) { | 256 | if (sucess) { |
| 255 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 257 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 256 | // | 258 | // |
| @@ -440,7 +442,8 @@ class TableManagerModel with ChangeNotifier { | @@ -440,7 +442,8 @@ class TableManagerModel with ChangeNotifier { | ||
| 440 | getReserveList(BuildContext context, | 442 | getReserveList(BuildContext context, |
| 441 | {bool needLoading = true, | 443 | {bool needLoading = true, |
| 442 | bool needKeep = false, | 444 | bool needKeep = false, |
| 443 | - bool showMsg = false}) async { | 445 | + bool showMsg = false, |
| 446 | + bool showloading = false}) async { | ||
| 444 | tableMap.clear(); | 447 | tableMap.clear(); |
| 445 | NoteBookModel model = new NoteBookModel(); | 448 | NoteBookModel model = new NoteBookModel(); |
| 446 | Map<String, String> params = { | 449 | Map<String, String> params = { |
| @@ -457,7 +460,8 @@ class TableManagerModel with ChangeNotifier { | @@ -457,7 +460,8 @@ class TableManagerModel with ChangeNotifier { | ||
| 457 | notifyListeners(); | 460 | notifyListeners(); |
| 458 | } | 461 | } |
| 459 | 462 | ||
| 460 | - List<Notebook> noteBooks = await newGetReserveList(context, params); | 463 | + List<Notebook> noteBooks = |
| 464 | + await newGetReserveList(context, params, showLoading: showloading); | ||
| 461 | List<t.Table> tempSelectTables = []; | 465 | List<t.Table> tempSelectTables = []; |
| 462 | tempSelectTables.addAll(selectTables); | 466 | tempSelectTables.addAll(selectTables); |
| 463 | String msg = ''; | 467 | String msg = ''; |
| @@ -504,7 +508,8 @@ class TableManagerModel with ChangeNotifier { | @@ -504,7 +508,8 @@ class TableManagerModel with ChangeNotifier { | ||
| 504 | 508 | ||
| 505 | //获取已预订订单 | 509 | //获取已预订订单 |
| 506 | Future<List<Notebook>> newGetReserveList( | 510 | Future<List<Notebook>> newGetReserveList( |
| 507 | - BuildContext context, Map<String, String> params) async { | 511 | + BuildContext context, Map<String, String> params, |
| 512 | + {showLoading = false}) async { | ||
| 508 | List<Notebook> notebooks = []; | 513 | List<Notebook> notebooks = []; |
| 509 | BaseResp<List> baseResp = await DioUtil() | 514 | BaseResp<List> baseResp = await DioUtil() |
| 510 | .request<List>(context, Method.get, HttpUrl.get_reserve_list, | 515 | .request<List>(context, Method.get, HttpUrl.get_reserve_list, |
| @@ -661,15 +666,25 @@ class TableManagerModel with ChangeNotifier { | @@ -661,15 +666,25 @@ class TableManagerModel with ChangeNotifier { | ||
| 661 | } | 666 | } |
| 662 | } | 667 | } |
| 663 | 668 | ||
| 664 | - if (areaTableMap.isNotEmpty) { | 669 | + if (areaTableMapShow.isNotEmpty) { |
| 665 | if (!needKeep) { | 670 | if (!needKeep) { |
| 666 | // currentArea = areaTableMap.keys.first; | 671 | // currentArea = areaTableMap.keys.first; |
| 667 | // currentTables = areaTableMap[currentArea]; | 672 | // currentTables = areaTableMap[currentArea]; |
| 668 | currentArea = '全部'; | 673 | currentArea = '全部'; |
| 669 | - currentTables = tablesAll; | 674 | + // currentTables = tablesAll; |
| 670 | pageState = PageState.Success; | 675 | pageState = PageState.Success; |
| 676 | + } else { | ||
| 677 | + if (currentArea != null && currentArea != '') { | ||
| 678 | + // tablesShow = areaTableMapShow[currentArea]; | ||
| 679 | + List keys = areaTableMapShow.keys.toList(); | ||
| 680 | + selectNumber = keys.indexOf(currentArea) + 1; | ||
| 681 | + } | ||
| 671 | } | 682 | } |
| 672 | } else { | 683 | } else { |
| 684 | + if (currentArea != null && currentArea != '') { | ||
| 685 | + tablesShow = areaTableMapShow[currentArea]; | ||
| 686 | + selectNumber = areaTableMapShow.length; | ||
| 687 | + } | ||
| 673 | // pageState = PageState.Empty; | 688 | // pageState = PageState.Empty; |
| 674 | pageState = PageState.Success; | 689 | pageState = PageState.Success; |
| 675 | } | 690 | } |
| @@ -848,7 +863,7 @@ class TableManagerModel with ChangeNotifier { | @@ -848,7 +863,7 @@ class TableManagerModel with ChangeNotifier { | ||
| 848 | refreshTable(context) async { | 863 | refreshTable(context) async { |
| 849 | List temp = await getTableList(context, needLoading: false); | 864 | List temp = await getTableList(context, needLoading: false); |
| 850 | if (temp.length > 0) { | 865 | if (temp.length > 0) { |
| 851 | - getReserveList(context, needLoading: false); | 866 | + getReserveList(context, needLoading: false, needKeep: true); |
| 852 | } else { | 867 | } else { |
| 853 | // pageState = PageState.Empty; | 868 | // pageState = PageState.Empty; |
| 854 | pageState = PageState.Success; | 869 | pageState = PageState.Success; |
| @@ -289,7 +289,7 @@ class DialogUtil { | @@ -289,7 +289,7 @@ class DialogUtil { | ||
| 289 | child: Container( | 289 | child: Container( |
| 290 | padding: | 290 | padding: |
| 291 | EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(50)), | 291 | EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(50)), |
| 292 | - height: ScreenUtil().setWidth(207 * 2), | 292 | + height: ScreenUtil().setWidth(207 * 2 + 10), |
| 293 | decoration: BoxDecoration( | 293 | decoration: BoxDecoration( |
| 294 | borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))), | 294 | borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))), |
| 295 | child: Card( | 295 | child: Card( |
| @@ -529,7 +529,7 @@ class DialogUtil { | @@ -529,7 +529,7 @@ class DialogUtil { | ||
| 529 | padding: EdgeInsets.symmetric( | 529 | padding: EdgeInsets.symmetric( |
| 530 | horizontal: ScreenUtil().setWidth(50)), | 530 | horizontal: ScreenUtil().setWidth(50)), |
| 531 | height: ScreenUtil().setWidth(326 * 2) + | 531 | height: ScreenUtil().setWidth(326 * 2) + |
| 532 | - ScreenUtil().setWidth(45 * 2), | 532 | + ScreenUtil().setWidth(50 * 2), |
| 533 | decoration: BoxDecoration( | 533 | decoration: BoxDecoration( |
| 534 | borderRadius: | 534 | borderRadius: |
| 535 | BorderRadius.circular(ScreenUtil().setWidth(10))), | 535 | BorderRadius.circular(ScreenUtil().setWidth(10))), |
-
Please register or login to post a comment