Commit 16ad7e6d352e19189d05512cd12cd4790622cb56

Authored by wdn127929
1 parent b27c8743

批量修改

@@ -446,8 +446,8 @@ class DioUtil { @@ -446,8 +446,8 @@ class DioUtil {
446 static BaseOptions getDefOptions() { 446 static BaseOptions getDefOptions() {
447 BaseOptions options = new BaseOptions(); 447 BaseOptions options = new BaseOptions();
448 options.contentType = Headers.formUrlEncodedContentType; 448 options.contentType = Headers.formUrlEncodedContentType;
449 - options.connectTimeout = 1000 * 300; //默认30s  
450 - options.receiveTimeout = 1000 * 300; //默认30s 449 + options.connectTimeout = 1000 * 50; //默认30s 50s
  450 + options.receiveTimeout = 1000 * 50; //默认30s 50s
451 return options; 451 return options;
452 } 452 }
453 } 453 }
@@ -232,5 +232,7 @@ class HttpUrl { @@ -232,5 +232,7 @@ class HttpUrl {
232 "?service=App.Tables.SetTableRegionById"; // 修改商家桌位区域 232 "?service=App.Tables.SetTableRegionById"; // 修改商家桌位区域
233 static const String del_table_region = 233 static const String del_table_region =
234 "?service=App.Tables.DelTableRegion"; // 删除区域同时删除区域下面的桌位 234 "?service=App.Tables.DelTableRegion"; // 删除区域同时删除区域下面的桌位
  235 + static const String batch_set_table =
  236 + "?service=App.Tables.BatchSetTable"; // 批量修改桌位信息
235 237
236 } 238 }
@@ -60,8 +60,7 @@ class _MyAreaManagePageState extends State<MyAreaManagePage> { @@ -60,8 +60,7 @@ class _MyAreaManagePageState extends State<MyAreaManagePage> {
60 body: SafeArea(child: 60 body: SafeArea(child:
61 Consumer<MyTableManageHomeModel>(builder: (context, model, child) { 61 Consumer<MyTableManageHomeModel>(builder: (context, model, child) {
62 return model.pageState != PageState.Success 62 return model.pageState != PageState.Success
63 - ? Expanded(  
64 - child: ExceptionPage( 63 + ? ExceptionPage(
65 pageState: model.pageState, 64 pageState: model.pageState,
66 callback: () { 65 callback: () {
67 // if (tableManagerModel.tableOuterList.isEmpty) { 66 // if (tableManagerModel.tableOuterList.isEmpty) {
@@ -73,7 +72,7 @@ class _MyAreaManagePageState extends State<MyAreaManagePage> { @@ -73,7 +72,7 @@ class _MyAreaManagePageState extends State<MyAreaManagePage> {
73 emptyMsg: "暂时没有区域数据哦", 72 emptyMsg: "暂时没有区域数据哦",
74 emptyImg: "table_manage_empty", 73 emptyImg: "table_manage_empty",
75 showMsg: "加载中,请稍后...", 74 showMsg: "加载中,请稍后...",
76 - )) 75 + )
77 : ListView.builder( 76 : ListView.builder(
78 padding: EdgeInsets.symmetric( 77 padding: EdgeInsets.symmetric(
79 horizontal: ScreenUtil().setWidth(32), 78 horizontal: ScreenUtil().setWidth(32),
@@ -480,10 +480,14 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -480,10 +480,14 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
480 tableManagerModel.areas.length == 480 tableManagerModel.areas.length ==
481 0) { 481 0) {
482 return tableManagerModel 482 return tableManagerModel
483 - .tableOuterList[  
484 - tableManagerModel  
485 - .selectNumber]  
486 - .isSelect 483 + .tableOuterList
  484 + .length >
  485 + 0 &&
  486 + tableManagerModel
  487 + .tableOuterList[
  488 + tableManagerModel
  489 + .selectNumber]
  490 + .isSelect
487 ? SizedBox() 491 ? SizedBox()
488 : InkWell( 492 : InkWell(
489 onTap: () async { 493 onTap: () async {
@@ -686,7 +690,7 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -686,7 +690,7 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
686 onTap: () async { 690 onTap: () async {
687 //添加区域弹框 691 //添加区域弹框
688 await DialogUtil 692 await DialogUtil
689 - .openCreateAreaDialog( 693 + .openTableManageCreateAreaDialog(
690 context, onTap: 694 context, onTap:
691 (value) async { 695 (value) async {
692 print(value); 696 print(value);
@@ -766,143 +770,59 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -766,143 +770,59 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
766 ], 770 ],
767 )) 771 ))
768 : SizedBox(), 772 : SizedBox(),
769 - Expanded(  
770 - // flex: 2,  
771 - child: Container(  
772 - constraints: BoxConstraints(  
773 - minHeight:  
774 - ScreenUtil().setWidth(100)),  
775 - color: MyColours.color_ffffff,  
776 - padding: EdgeInsets.symmetric(  
777 - vertical: ScreenUtil().setWidth(20),  
778 - horizontal:  
779 - ScreenUtil().setWidth(48)),  
780 - child: Column(  
781 - children: [  
782 - VEmptyView(26),  
783 - tableManagerModel  
784 - .tableOuterList[  
785 - tableManagerModel  
786 - .selectNumber]  
787 - .list  
788 - .length ==  
789 - 0  
790 - ? SizedBox()  
791 - : Row(children: [  
792 - InkWell(  
793 - onTap: () {  
794 - tableManagerModel  
795 - .tableOuterList[  
796 - tableManagerModel  
797 - .selectNumber]  
798 - .isSelect =  
799 - !tableManagerModel  
800 - .tableOuterList[  
801 - tableManagerModel  
802 - .selectNumber]  
803 - .isSelect;  
804 -  
805 - if (!tableManagerModel  
806 - .tableOuterList[  
807 - tableManagerModel  
808 - .selectNumber]  
809 - .isSelect &&  
810 - tableManagerModel  
811 - .tableOuterList[  
812 - tableManagerModel  
813 - .selectNumber]  
814 - .selectTables  
815 - .length >  
816 - 1) {  
817 - for (t.Table item  
818 - in tableManagerModel  
819 - .tableOuterList[  
820 - tableManagerModel  
821 - .selectNumber]  
822 - .list) {  
823 - item.selected =  
824 - false;  
825 - }  
826 - tableManagerModel 773 + tableManagerModel.tableOuterList.length == 0
  774 + ? SizedBox()
  775 + : Expanded(
  776 + // flex: 2,
  777 + child: Container(
  778 + constraints: BoxConstraints(
  779 + minHeight:
  780 + ScreenUtil().setWidth(100)),
  781 + color: MyColours.color_ffffff,
  782 + padding: EdgeInsets.symmetric(
  783 + vertical:
  784 + ScreenUtil().setWidth(20),
  785 + horizontal:
  786 + ScreenUtil().setWidth(48)),
  787 + child: Column(
  788 + children: [
  789 + VEmptyView(26),
  790 + tableManagerModel
  791 + .selectNumber !=
  792 + null &&
  793 + tableManagerModel
827 .tableOuterList[ 794 .tableOuterList[
828 tableManagerModel 795 tableManagerModel
829 .selectNumber] 796 .selectNumber]
830 - .selectTables = [];  
831 - }  
832 - setState(() {});  
833 - },  
834 - child: Row(  
835 - children: [  
836 - Image.asset(  
837 - Utils.getImgPath(tableManagerModel  
838 - .tableOuterList[  
839 - tableManagerModel  
840 - .selectNumber]  
841 - .isSelect  
842 - ? 'base_radio_sel'  
843 - : 'base_radio_un'),  
844 - width:  
845 - ScreenUtil()  
846 - .setWidth(  
847 - 40),  
848 - ),  
849 - HEmptyView(10),  
850 - Text(  
851 - '批量选择桌位',  
852 - style: TextStyle(  
853 - fontSize:  
854 - ScreenUtil()  
855 - .setSp(  
856 - 32),  
857 - color: MyColours  
858 - .color_000000),  
859 - ),  
860 - ],  
861 - )),  
862 - Spacer(),  
863 - tableManagerModel  
864 - .tableOuterList[  
865 - tableManagerModel  
866 - .selectNumber]  
867 - .isSelect  
868 - ? InkWell( 797 + .list
  798 + .length ==
  799 + 0
  800 + ? SizedBox()
  801 + : Row(children: [
  802 + InkWell(
869 onTap: () { 803 onTap: () {
870 tableManagerModel 804 tableManagerModel
871 - .tableOuterList[  
872 - tableManagerModel  
873 - .selectNumber]  
874 - .selectTables = [];  
875 - tableManagerModel  
876 .tableOuterList[ 805 .tableOuterList[
877 tableManagerModel 806 tableManagerModel
878 .selectNumber] 807 .selectNumber]
879 - .isAll = 808 + .isSelect =
880 !tableManagerModel 809 !tableManagerModel
881 .tableOuterList[ 810 .tableOuterList[
882 tableManagerModel 811 tableManagerModel
883 .selectNumber] 812 .selectNumber]
884 - .isAll;  
885 - if (tableManagerModel  
886 - .tableOuterList[  
887 - tableManagerModel  
888 - .selectNumber]  
889 - .isAll) {  
890 - for (t.Table item  
891 - in tableManagerModel  
892 - .tableOuterList[  
893 - tableManagerModel.selectNumber]  
894 - .list) {  
895 - item.selected =  
896 - true;  
897 - tableManagerModel 813 + .isSelect;
  814 +
  815 + if (!tableManagerModel
898 .tableOuterList[ 816 .tableOuterList[
899 tableManagerModel 817 tableManagerModel
900 .selectNumber] 818 .selectNumber]
901 - .selectTables  
902 - .add(  
903 - item);  
904 - }  
905 - } else { 819 + .isSelect &&
  820 + tableManagerModel
  821 + .tableOuterList[
  822 + tableManagerModel.selectNumber]
  823 + .selectTables
  824 + .length >
  825 + 0) {
906 for (t.Table item 826 for (t.Table item
907 in tableManagerModel 827 in tableManagerModel
908 .tableOuterList[ 828 .tableOuterList[
@@ -911,195 +831,422 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -911,195 +831,422 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
911 item.selected = 831 item.selected =
912 false; 832 false;
913 } 833 }
  834 + tableManagerModel
  835 + .tableOuterList[
  836 + tableManagerModel
  837 + .selectNumber]
  838 + .selectTables = [];
914 } 839 }
915 setState(() {}); 840 setState(() {});
916 }, 841 },
917 child: Row( 842 child: Row(
918 - crossAxisAlignment:  
919 - CrossAxisAlignment  
920 - .center,  
921 children: [ 843 children: [
922 Image.asset( 844 Image.asset(
923 - Utils.getImgPath(tableManagerModel  
924 - .tableOuterList[tableManagerModel  
925 - .selectNumber]  
926 - .isAll  
927 - ? 'mine_radio_sel'  
928 - : 'mine_radio_nor'),  
929 - width: ScreenUtil()  
930 - .setWidth(  
931 - 34)), 845 + Utils.getImgPath(tableManagerModel
  846 + .tableOuterList[
  847 + tableManagerModel.selectNumber]
  848 + .isSelect
  849 + ? 'base_radio_sel'
  850 + : 'base_radio_un'),
  851 + width: ScreenUtil()
  852 + .setWidth(
  853 + 40),
  854 + ),
  855 + HEmptyView(10),
932 Text( 856 Text(
933 - '全选', 857 + '批量选择桌位',
934 style: TextStyle( 858 style: TextStyle(
  859 + fontSize: ScreenUtil()
  860 + .setSp(
  861 + 32),
935 color: MyColours 862 color: MyColours
936 - .color_515151,  
937 - fontSize:  
938 - ScreenUtil()  
939 - .setSp(32)),  
940 - ) 863 + .color_000000),
  864 + ),
941 ], 865 ],
942 - ))  
943 - : SizedBox()  
944 - ]),  
945 - tableManagerModel  
946 - .tableOuterList[  
947 - tableManagerModel  
948 - .selectNumber]  
949 - .list  
950 - .length ==  
951 - 0  
952 - ? VEmptyView(20)  
953 - : VEmptyView(60),  
954 - Expanded(  
955 - child: item(tableManagerModel  
956 - .selectNumber)),  
957 - tableManagerModel  
958 - .tableOuterList[  
959 - tableManagerModel  
960 - .selectNumber]  
961 - .list  
962 - .length ==  
963 - 0  
964 - ? Padding(  
965 - padding: EdgeInsets.only(  
966 - left: ScreenUtil()  
967 - .setWidth(50)),  
968 - child: Column(  
969 - crossAxisAlignment:  
970 - CrossAxisAlignment  
971 - .start,  
972 - children: [  
973 - VEmptyView(60),  
974 - Row( 866 + )),
  867 + Spacer(),
  868 + tableManagerModel
  869 + .tableOuterList
  870 + .length >
  871 + 0 &&
  872 + tableManagerModel
  873 + .tableOuterList[
  874 + tableManagerModel
  875 + .selectNumber]
  876 + .isSelect
  877 + ? InkWell(
  878 + onTap: () {
  879 + tableManagerModel
  880 + .tableOuterList[
  881 + tableManagerModel
  882 + .selectNumber]
  883 + .selectTables = [];
  884 + tableManagerModel
  885 + .tableOuterList[tableManagerModel
  886 + .selectNumber]
  887 + .isAll =
  888 + !tableManagerModel
  889 + .tableOuterList[
  890 + tableManagerModel.selectNumber]
  891 + .isAll;
  892 + if (tableManagerModel
  893 + .tableOuterList[
  894 + tableManagerModel
  895 + .selectNumber]
  896 + .isAll) {
  897 + for (t.Table item in tableManagerModel
  898 + .tableOuterList[
  899 + tableManagerModel.selectNumber]
  900 + .list) {
  901 + item.selected =
  902 + true;
  903 + tableManagerModel
  904 + .tableOuterList[tableManagerModel
  905 + .selectNumber]
  906 + .selectTables
  907 + .add(
  908 + item);
  909 + }
  910 + } else {
  911 + for (t.Table item in tableManagerModel
  912 + .tableOuterList[
  913 + tableManagerModel.selectNumber]
  914 + .list) {
  915 + item.selected =
  916 + false;
  917 + }
  918 + }
  919 + setState(
  920 + () {});
  921 + },
  922 + child: Row(
  923 + crossAxisAlignment:
  924 + CrossAxisAlignment
  925 + .center,
  926 + children: [
  927 + Image.asset(
  928 + Utils.getImgPath(tableManagerModel.tableOuterList[tableManagerModel.selectNumber].isAll
  929 + ? 'mine_radio_sel'
  930 + : 'mine_radio_nor'),
  931 + width: ScreenUtil()
  932 + .setWidth(34)),
  933 + Text(
  934 + '全选',
  935 + style: TextStyle(
  936 + color: MyColours
  937 + .color_515151,
  938 + fontSize:
  939 + ScreenUtil().setSp(32)),
  940 + )
  941 + ],
  942 + ))
  943 + : SizedBox()
  944 + ]),
  945 + tableManagerModel
  946 + .tableOuterList[
  947 + tableManagerModel
  948 + .selectNumber]
  949 + .list
  950 + .length ==
  951 + 0
  952 + ? VEmptyView(20)
  953 + : VEmptyView(60),
  954 + Expanded(
  955 + child: item(
  956 + tableManagerModel
  957 + .selectNumber)),
  958 + tableManagerModel
  959 + .tableOuterList[
  960 + tableManagerModel
  961 + .selectNumber]
  962 + .list
  963 + .length ==
  964 + 0
  965 + ? Padding(
  966 + padding: EdgeInsets.only(
  967 + left: ScreenUtil()
  968 + .setWidth(50)),
  969 + child: Column(
  970 + crossAxisAlignment:
  971 + CrossAxisAlignment
  972 + .start,
975 children: [ 973 children: [
976 - Text(  
977 - '1、添加区域(如:一楼、二楼、东厅等)', 974 + VEmptyView(60),
  975 + Row(
  976 + children: [
  977 + Text(
  978 + '1、添加区域(如:一楼、二楼、东厅等)',
  979 + style: TextStyle(
  980 + decoration:
  981 + TextDecoration
  982 + .lineThrough,
  983 + fontSize:
  984 + ScreenUtil().setSp(
  985 + 32),
  986 + color: MyColours
  987 + .color_BFC4D4))
  988 + ],
  989 + ),
  990 + VEmptyView(40),
  991 + Text('2、选择要添加桌位的区域',
978 style: TextStyle( 992 style: TextStyle(
979 - decoration:  
980 - TextDecoration  
981 - .lineThrough,  
982 fontSize: ScreenUtil() 993 fontSize: ScreenUtil()
983 .setSp( 994 .setSp(
984 32), 995 32),
985 color: MyColours 996 color: MyColours
986 - .color_BFC4D4))  
987 - ],  
988 - ),  
989 - VEmptyView(40),  
990 - Text('2、选择要添加桌位的区域',  
991 - style: TextStyle(  
992 - fontSize:  
993 - ScreenUtil()  
994 - .setSp(  
995 - 32),  
996 - color: MyColours  
997 - .color_BFC4D4)),  
998 - VEmptyView(40),  
999 - Text('3、点击“+”号添加桌位',  
1000 - style: TextStyle(  
1001 - fontSize:  
1002 - ScreenUtil() 997 + .color_BFC4D4)),
  998 + VEmptyView(40),
  999 + Text('3、点击“+”号添加桌位',
  1000 + style: TextStyle(
  1001 + fontSize: ScreenUtil()
1003 .setSp( 1002 .setSp(
1004 32), 1003 32),
1005 - color: MyColours  
1006 - .color_BFC4D4)),  
1007 - VEmptyView(120),  
1008 - Image.asset(  
1009 - "assets/empty_search.png",  
1010 - width: ScreenUtil()  
1011 - .setWidth(520),  
1012 - height: ScreenUtil()  
1013 - .setWidth(384),  
1014 - ),  
1015 - VEmptyView(40),  
1016 - ],  
1017 - ))  
1018 - : SizedBox(),  
1019 - ],  
1020 - ))), 1004 + color: MyColours
  1005 + .color_BFC4D4)),
  1006 + VEmptyView(120),
  1007 + Image.asset(
  1008 + "assets/empty_search.png",
  1009 + width:
  1010 + ScreenUtil()
  1011 + .setWidth(
  1012 + 520),
  1013 + height:
  1014 + ScreenUtil()
  1015 + .setWidth(
  1016 + 384),
  1017 + ),
  1018 + VEmptyView(40),
  1019 + ],
  1020 + ))
  1021 + : SizedBox(),
  1022 + ],
  1023 + ))),
1021 ])), 1024 ])),
1022 - model.pageState == PageState.Success &&  
1023 - tableManagerModel  
1024 - .tableOuterList[tableManagerModel.selectNumber]  
1025 - .isSelect  
1026 - ? Padding(  
1027 - padding: EdgeInsets.symmetric(  
1028 - horizontal: ScreenUtil().setWidth(48)),  
1029 - child: Column(  
1030 - children: [  
1031 - Row(  
1032 - mainAxisAlignment:  
1033 - MainAxisAlignment.spaceBetween, 1025 + tableManagerModel.tableOuterList.length == 0
  1026 + ? SizedBox()
  1027 + : model.pageState == PageState.Success &&
  1028 + tableManagerModel
  1029 + .tableOuterList[
  1030 + tableManagerModel.selectNumber]
  1031 + .isSelect
  1032 + ? Padding(
  1033 + padding: EdgeInsets.symmetric(
  1034 + horizontal: ScreenUtil().setWidth(48)),
  1035 + child: Column(
1034 children: [ 1036 children: [
1035 - CommonButton(  
1036 - content: "修改名称",  
1037 - width: 200,  
1038 - height: 72,  
1039 - fontSize: 32,  
1040 - onPress: () async {  
1041 - if (tableManagerModel  
1042 - .tableOuterList[  
1043 - tableManagerModel  
1044 - .selectNumber]  
1045 - .selectTables  
1046 - .length ==  
1047 - 0) {  
1048 - Utils.showToast('请选择桌位');  
1049 - return;  
1050 - } 1037 + Row(
  1038 + mainAxisAlignment:
  1039 + MainAxisAlignment.spaceBetween,
  1040 + children: [
  1041 + CommonButton(
  1042 + content: "修改名称",
  1043 + width: 200,
  1044 + height: 72,
  1045 + fontSize: 32,
  1046 + onPress: () async {
  1047 + if (tableManagerModel
  1048 + .tableOuterList[
  1049 + tableManagerModel
  1050 + .selectNumber]
  1051 + .selectTables
  1052 + .length ==
  1053 + 0) {
  1054 + Utils.showToast('请选择桌位');
  1055 + return;
  1056 + }
1051 1057
1052 - DialogUtil  
1053 - .openMyTableManageModifyTableNameDialog(  
1054 - context,  
1055 - onTap: (Map<String, String>  
1056 - value) async {  
1057 - Map<String, String> params = {  
1058 - 'name': value['name'],  
1059 - }; 1058 + DialogUtil
  1059 + .openMyTableManageModifyTableNameDialog(
  1060 + context,
  1061 + onTap: (Map<String, String>
  1062 + value) async {
  1063 + String tids = '';
  1064 + for (t.Table item
  1065 + in tableManagerModel
  1066 + .tableOuterList[
  1067 + tableManagerModel
  1068 + .selectNumber]
  1069 + .selectTables) {
  1070 + tids += '${item.id},';
  1071 + }
  1072 + if (tids.endsWith(',')) {
  1073 + tids = tids.substring(
  1074 + 0, tids.length - 1);
  1075 + }
  1076 + Map<String, String> params = {
  1077 + 'name': value['name'],
  1078 + 'tableids': tids,
  1079 + 'skip_four':
  1080 + value['skip_four'],
  1081 + 'skip_seven':
  1082 + value['skip_seven'],
  1083 + };
1060 1084
1061 - // bool success =  
1062 - // await tableManagerModel  
1063 - // .setTableById(  
1064 - // context, params);  
1065 - // print(success);  
1066 - // if (success) {  
1067 - // Utils.showToast('修改成功!'); 1085 + bool success =
  1086 + await tableManagerModel
  1087 + .batchSetTable(
  1088 + context, params);
  1089 + print(success);
  1090 + if (success) {
  1091 + Utils.showToast('修改成功!');
1068 1092
1069 - // await tableManagerModel  
1070 - // .refreshTable(context);  
1071 - // }  
1072 - },  
1073 - );  
1074 - }),  
1075 - CommonButton(  
1076 - content: "修改人数",  
1077 - width: 200,  
1078 - height: 72,  
1079 - fontSize: 32,  
1080 - onPress: () async {  
1081 - await DialogUtil  
1082 - .openMyTableManageModifyTableNumDialog(  
1083 - context,  
1084 - personNumList,  
1085 - pnumMin: '',  
1086 - pnumMax: '',  
1087 - onTap: (Map<String, String>  
1088 - value) async {  
1089 - // if (value['pnumMin'] != '') {  
1090 - // params['table_pnum'] = value['pnumMin'];  
1091 - // }  
1092 - // if (value['pnumMax'] != '') {  
1093 - // params['most_pnum'] = value['pnumMax'];  
1094 - // }  
1095 - },  
1096 - );  
1097 - }), 1093 + await tableManagerModel
  1094 + .refreshTable(context);
  1095 + }
  1096 + },
  1097 + );
  1098 + }),
  1099 + CommonButton(
  1100 + content: "修改人数",
  1101 + width: 200,
  1102 + height: 72,
  1103 + fontSize: 32,
  1104 + onPress: () async {
  1105 + if (tableManagerModel
  1106 + .tableOuterList[
  1107 + tableManagerModel
  1108 + .selectNumber]
  1109 + .selectTables
  1110 + .length ==
  1111 + 0) {
  1112 + Utils.showToast('请选择桌位');
  1113 + return;
  1114 + }
  1115 + await DialogUtil
  1116 + .openMyTableManageModifyTableNumDialog(
  1117 + context,
  1118 + personNumList,
  1119 + pnumMin: '',
  1120 + pnumMax: '',
  1121 + onTap: (Map<String, String>
  1122 + value) async {
  1123 + String tids = '';
  1124 + for (t.Table item
  1125 + in tableManagerModel
  1126 + .tableOuterList[
  1127 + tableManagerModel
  1128 + .selectNumber]
  1129 + .selectTables) {
  1130 + tids += '${item.id},';
  1131 + }
  1132 + if (tids.endsWith(',')) {
  1133 + tids = tids.substring(
  1134 + 0, tids.length - 1);
  1135 + }
  1136 + Map<String, String> params = {
  1137 + 'tableids': tids,
  1138 + };
  1139 + if (value['pnumMin'] != '') {
  1140 + params['table_pnum'] =
  1141 + value['pnumMin'];
  1142 + }
  1143 + if (value['pnumMax'] != '') {
  1144 + params['most_pnum'] =
  1145 + value['pnumMax'];
  1146 + }
  1147 +
  1148 + bool success =
  1149 + await tableManagerModel
  1150 + .batchSetTable(
  1151 + context, params);
  1152 + print(success);
  1153 + if (success) {
  1154 + Utils.showToast('修改成功!');
  1155 +
  1156 + await tableManagerModel
  1157 + .refreshTable(context);
  1158 + }
  1159 + },
  1160 + );
  1161 + }),
  1162 + CommonButton(
  1163 + content: "修改类型",
  1164 + width: 200,
  1165 + height: 72,
  1166 + fontSize: 32,
  1167 + onPress: () async {
  1168 + if (tableManagerModel
  1169 + .tableOuterList[
  1170 + tableManagerModel
  1171 + .selectNumber]
  1172 + .selectTables
  1173 + .length ==
  1174 + 0) {
  1175 + Utils.showToast('请选择桌位');
  1176 + return;
  1177 + }
  1178 + List<String> tableTypeS = [];
  1179 + for (int i = 0;
  1180 + i <
  1181 + tableManagerModel
  1182 + .tableTypeList.length;
  1183 + i++) {
  1184 + tableTypeS.add(tableManagerModel
  1185 + .tableTypeList[i].name);
  1186 + }
  1187 + DialogUtil
  1188 + .openMyTableManageModifyTableTypeDialog(
  1189 + context,
  1190 + tableTypeS,
  1191 + onTap: (Map<String, String>
  1192 + value) async {
  1193 + String tid;
  1194 + String tids = '';
  1195 + for (t.Table item
  1196 + in tableManagerModel
  1197 + .tableOuterList[
  1198 + tableManagerModel
  1199 + .selectNumber]
  1200 + .selectTables) {
  1201 + tids += '${item.id},';
  1202 + }
  1203 + if (tids.endsWith(',')) {
  1204 + tids = tids.substring(
  1205 + 0, tids.length - 1);
  1206 + }
  1207 + for (int i = 0;
  1208 + i <
  1209 + tableManagerModel
  1210 + .tableTypeList
  1211 + .length;
  1212 + i++) {
  1213 + if (value['bjtype'] ==
  1214 + tableManagerModel
  1215 + .tableTypeList[i]
  1216 + .name) {
  1217 + tid = tableManagerModel
  1218 + .tableTypeList[i].id;
  1219 + }
  1220 + }
  1221 + Map<String, String> params = {
  1222 + 'tableids': tids,
  1223 + 'tid': tid
  1224 + };
  1225 +
  1226 + bool success =
  1227 + await tableManagerModel
  1228 + .batchSetTable(
  1229 + context, params);
  1230 + print(success);
  1231 + if (success) {
  1232 + Utils.showToast('修改成功!');
  1233 +
  1234 + await tableManagerModel
  1235 + .refreshTable(context);
  1236 + }
  1237 + },
  1238 + );
  1239 + },
  1240 + ),
  1241 + ],
  1242 + ),
  1243 + VEmptyView(44),
1098 CommonButton( 1244 CommonButton(
1099 - content: "修改类型", 1245 + content: "删除桌位",
1100 width: 200, 1246 width: 200,
1101 height: 72, 1247 height: 72,
1102 fontSize: 32, 1248 fontSize: 32,
  1249 + state: -3,
1103 onPress: () async { 1250 onPress: () async {
1104 if (tableManagerModel 1251 if (tableManagerModel
1105 .tableOuterList[ 1252 .tableOuterList[
@@ -1111,135 +1258,70 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -1111,135 +1258,70 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
1111 Utils.showToast('请选择桌位'); 1258 Utils.showToast('请选择桌位');
1112 return; 1259 return;
1113 } 1260 }
1114 - List<String> tableTypeS = [];  
1115 - for (int i = 0;  
1116 - i <  
1117 - tableManagerModel  
1118 - .tableTypeList.length;  
1119 - i++) {  
1120 - tableTypeS.add(tableManagerModel  
1121 - .tableTypeList[i].name);  
1122 - }  
1123 - DialogUtil  
1124 - .openMyTableManageModifyTableTypeDialog(  
1125 - context,  
1126 - tableTypeS,  
1127 - onTap: (Map<String, String>  
1128 - value) async {  
1129 - String tid;  
1130 - for (int i = 0;  
1131 - i <  
1132 - tableManagerModel  
1133 - .tableTypeList.length;  
1134 - i++) {  
1135 - if (value['bjtype'] ==  
1136 - tableManagerModel  
1137 - .tableTypeList[i].name) {  
1138 - tid = tableManagerModel  
1139 - .tableTypeList[i].id;  
1140 - }  
1141 - }  
1142 - // Map<String, String> params = {  
1143 - // 'id': table.id,  
1144 - // 'tid': tid  
1145 - // };  
1146 -  
1147 - // bool success =  
1148 - // await tableManagerModel  
1149 - // .setTableById(  
1150 - // context, params);  
1151 - // print(success);  
1152 - // if (success) {  
1153 - // Utils.showToast('修改成功!');  
1154 -  
1155 - // await tableManagerModel  
1156 - // .refreshTable(context);  
1157 - // }  
1158 - },  
1159 - );  
1160 - },  
1161 - ),  
1162 - ],  
1163 - ),  
1164 - VEmptyView(44),  
1165 - CommonButton(  
1166 - content: "删除桌位",  
1167 - width: 200,  
1168 - height: 72,  
1169 - fontSize: 32,  
1170 - state: -3,  
1171 - onPress: () async {  
1172 - if (tableManagerModel 1261 + String tids = '';
  1262 + for (t.Table item in tableManagerModel
1173 .tableOuterList[ 1263 .tableOuterList[
1174 tableManagerModel.selectNumber] 1264 tableManagerModel.selectNumber]
1175 - .selectTables  
1176 - .length ==  
1177 - 0) {  
1178 - Utils.showToast('请选择桌位');  
1179 - return;  
1180 - }  
1181 - String tids = '';  
1182 - for (t.Table item in tableManagerModel  
1183 - .tableOuterList[  
1184 - tableManagerModel.selectNumber]  
1185 - .selectTables) {  
1186 - tids += '${item.id},';  
1187 - }  
1188 - if (tids.endsWith(',')) {  
1189 - tids = tids.substring(0, tids.length - 1);  
1190 - } 1265 + .selectTables) {
  1266 + tids += '${item.id},';
  1267 + }
  1268 + if (tids.endsWith(',')) {
  1269 + tids = tids.substring(
  1270 + 0, tids.length - 1);
  1271 + }
1191 1272
1192 - DialogUtil.cupertinoAlertDialog(context,  
1193 - title: "",  
1194 - content:  
1195 - "是否确定删除${tids.split(',').length}个桌位",  
1196 - lTitle: "取消",  
1197 - rTitle: "确认删除",  
1198 - isBold: true,  
1199 - isBoldContent: true,  
1200 - rColor: MyColours.color_E34D59,  
1201 - lCallback: () {  
1202 - print("取消");  
1203 - }, rCallback: () async {  
1204 - print("确定"); 1273 + DialogUtil.cupertinoAlertDialog(context,
  1274 + title: "",
  1275 + content:
  1276 + "是否确定删除${tids.split(',').length}个桌位",
  1277 + lTitle: "取消",
  1278 + rTitle: "确认删除",
  1279 + isBold: true,
  1280 + isBoldContent: true,
  1281 + rColor: MyColours.color_E34D59,
  1282 + lCallback: () {
  1283 + print("取消");
  1284 + }, rCallback: () async {
  1285 + print("确定");
1205 1286
1206 - Map<String, String> params = {  
1207 - 'sid': Provider.of<UserModel>(context,  
1208 - listen: false)  
1209 - .user  
1210 - .sellerid,  
1211 - 'tid': tids  
1212 - }; 1287 + Map<String, String> params = {
  1288 + 'sid': Provider.of<UserModel>(
  1289 + context,
  1290 + listen: false)
  1291 + .user
  1292 + .sellerid,
  1293 + 'tid': tids
  1294 + };
1213 1295
1214 - bool success = await tableManagerModel  
1215 - .delSellerTables(context, params);  
1216 - print(success);  
1217 - if (success) {  
1218 - Utils.showToast('删除成功!');  
1219 - // TableOuter tableOuter = TableOuter();  
1220 - // tableOuter.name = value;  
1221 - // tableOuter.list = [];  
1222 - // tableManagerModel.tableOuterList.add(tableOuter);  
1223 - // tableManagerModel.initData();  
1224 - // Timer(  
1225 - // Duration(milliseconds: 500),  
1226 - // () => _areaController.jumpTo(  
1227 - // _areaController.position.maxScrollExtent)); 1296 + bool success = await tableManagerModel
  1297 + .delSellerTables(context, params);
  1298 + print(success);
  1299 + if (success) {
  1300 + Utils.showToast('删除成功!');
  1301 + // TableOuter tableOuter = TableOuter();
  1302 + // tableOuter.name = value;
  1303 + // tableOuter.list = [];
  1304 + // tableManagerModel.tableOuterList.add(tableOuter);
  1305 + // tableManagerModel.initData();
  1306 + // Timer(
  1307 + // Duration(milliseconds: 500),
  1308 + // () => _areaController.jumpTo(
  1309 + // _areaController.position.maxScrollExtent));
1228 1310
1229 - // await tableManagerModel  
1230 - // .getTableList(context);  
1231 - // await tableManagerModel  
1232 - // .initData();  
1233 - await tableManagerModel  
1234 - .refreshTable(context);  
1235 - }  
1236 - });  
1237 - },  
1238 - ),  
1239 - VEmptyView(32),  
1240 - ],  
1241 - ))  
1242 - : SizedBox() 1311 + // await tableManagerModel
  1312 + // .getTableList(context);
  1313 + // await tableManagerModel
  1314 + // .initData();
  1315 + await tableManagerModel
  1316 + .refreshTable(context);
  1317 + }
  1318 + });
  1319 + },
  1320 + ),
  1321 + VEmptyView(32),
  1322 + ],
  1323 + ))
  1324 + : SizedBox()
1243 ], 1325 ],
1244 ); 1326 );
1245 }, 1327 },
@@ -178,7 +178,9 @@ class MyTableManageHomeModel with ChangeNotifier { @@ -178,7 +178,9 @@ class MyTableManageHomeModel with ChangeNotifier {
178 areas.add(area); 178 areas.add(area);
179 } 179 }
180 180
181 - if (currentArea != null && currentArea != '') { 181 + if (currentArea != null &&
  182 + currentArea != '' &&
  183 + tempList.contains(currentArea)) {
182 // tablesShow = areaTableMapShow[currentArea]; 184 // tablesShow = areaTableMapShow[currentArea];
183 selectNumber = tempList.indexOf(currentArea); 185 selectNumber = tempList.indexOf(currentArea);
184 } else { 186 } else {
@@ -322,7 +324,7 @@ class MyTableManageHomeModel with ChangeNotifier { @@ -322,7 +324,7 @@ class MyTableManageHomeModel with ChangeNotifier {
322 324
323 if (baseResp.code == Constant.status_success) { 325 if (baseResp.code == Constant.status_success) {
324 if (baseResp.responseData['data'] != null && 326 if (baseResp.responseData['data'] != null &&
325 - baseResp.responseData['data'] > 0) { 327 + baseResp.responseData['data'] > -1) {
326 return true; 328 return true;
327 } else { 329 } else {
328 Utils.showToast(baseResp.msg ?? '删除区域失败!'); 330 Utils.showToast(baseResp.msg ?? '删除区域失败!');
@@ -447,6 +449,44 @@ class MyTableManageHomeModel with ChangeNotifier { @@ -447,6 +449,44 @@ class MyTableManageHomeModel with ChangeNotifier {
447 return false; 449 return false;
448 } 450 }
449 451
  452 + //批量修改桌位信息
  453 + Future<bool> batchSetTable(
  454 + BuildContext context, Map<String, String> params) async {
  455 + BaseResp<dynamic> baseResp = await DioUtil()
  456 + .request<dynamic>(context, Method.get, HttpUrl.batch_set_table,
  457 + data: params, showLoading: true)
  458 + .catchError((error) {
  459 + print(error.toString());
  460 + // if (error is MyError) {
  461 + // switch (error.type) {
  462 + // case 1:
  463 + // pageState = PageState.ConnectivityError;
  464 + // break;
  465 + // case 2:
  466 + // pageState = PageState.ConnectivityTimeOut;
  467 + // break;
  468 + // default:
  469 + // pageState = PageState.ConnectivityError;
  470 + // break;
  471 + // }
  472 + // }
  473 + // notifyListeners();
  474 + return false;
  475 + });
  476 +
  477 + if (baseResp.code == Constant.status_success) {
  478 + if (baseResp.responseData['data'] != null &&
  479 + baseResp.responseData['data'] == 1) {
  480 + return true;
  481 + } else {
  482 + Utils.showToast(baseResp.msg ?? '修改桌位失败!');
  483 + }
  484 + } else {
  485 + Utils.showToast(baseResp.msg ?? '修改桌位失败!');
  486 + }
  487 + return false;
  488 + }
  489 +
450 //商户端删除桌位 490 //商户端删除桌位
451 Future<bool> delSellerTables( 491 Future<bool> delSellerTables(
452 BuildContext context, Map<String, String> params) async { 492 BuildContext context, Map<String, String> params) async {
@@ -1147,6 +1147,21 @@ class DialogUtil { @@ -1147,6 +1147,21 @@ class DialogUtil {
1147 Utils.showToast('请输入数量!'); 1147 Utils.showToast('请输入数量!');
1148 return; 1148 return;
1149 } 1149 }
  1150 + if (mulCreate &&
  1151 + !Utils.isNumber(
  1152 + _norNumController
  1153 + .text)) {
  1154 + Utils.showToast('请输入数字!');
  1155 + return;
  1156 + }
  1157 + if (mulCreate &&
  1158 + int.parse(_norNumController
  1159 + .text) >
  1160 + 20) {
  1161 + Utils.showToast(
  1162 + '最多可创建20个桌位!');
  1163 + return;
  1164 + }
1150 if (!mulCreate && 1165 if (!mulCreate &&
1151 controller.text.trim() == 1166 controller.text.trim() ==
1152 '') { 1167 '') {
@@ -1672,8 +1687,7 @@ class DialogUtil { @@ -1672,8 +1687,7 @@ class DialogUtil {
1672 return Container( 1687 return Container(
1673 padding: 1688 padding:
1674 EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(50)), 1689 EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(50)),
1675 - height:  
1676 - ScreenUtil().setWidth(226 * 2), 1690 + height: ScreenUtil().setWidth(226 * 2),
1677 decoration: BoxDecoration( 1691 decoration: BoxDecoration(
1678 borderRadius: 1692 borderRadius:
1679 BorderRadius.circular(ScreenUtil().setWidth(10))), 1693 BorderRadius.circular(ScreenUtil().setWidth(10))),
@@ -1785,7 +1799,7 @@ class DialogUtil { @@ -1785,7 +1799,7 @@ class DialogUtil {
1785 : MyColours.color_438E93, 1799 : MyColours.color_438E93,
1786 fontSize: 34, 1800 fontSize: 34,
1787 onPressed: () { 1801 onPressed: () {
1788 - if (pnumMax == '' || pnumMin == '') { 1802 + if (pnumMax == '' && pnumMin == '') {
1789 Utils.showToast('请选择人数!'); 1803 Utils.showToast('请选择人数!');
1790 return; 1804 return;
1791 } 1805 }
@@ -2094,6 +2108,7 @@ class DialogUtil { @@ -2094,6 +2108,7 @@ class DialogUtil {
2094 fontSize: ScreenUtil().setSp(32), 2108 fontSize: ScreenUtil().setSp(32),
2095 ), 2109 ),
2096 ), 2110 ),
  2111 + keyboardType: TextInputType.number,
2097 onChanged: (value) { 2112 onChanged: (value) {
2098 state(() {}); 2113 state(() {});
2099 }, 2114 },
@@ -2101,7 +2116,6 @@ class DialogUtil { @@ -2101,7 +2116,6 @@ class DialogUtil {
2101 FocusScope.of(context) 2116 FocusScope.of(context)
2102 .requestFocus(FocusNode()); //点击空白处隐藏键盘 2117 .requestFocus(FocusNode()); //点击空白处隐藏键盘
2103 }, 2118 },
2104 - keyboardType: TextInputType.text,  
2105 ), 2119 ),
2106 ) 2120 )
2107 ], 2121 ],
@@ -2167,9 +2181,9 @@ class DialogUtil { @@ -2167,9 +2181,9 @@ class DialogUtil {
2167 margin: EdgeInsets.symmetric( 2181 margin: EdgeInsets.symmetric(
2168 horizontal: ScreenUtil().setWidth(44)), 2182 horizontal: ScreenUtil().setWidth(44)),
2169 child: Row(children: [ 2183 child: Row(children: [
2170 - Image.asset(Utils.getImgPath('mine_radio_nor'),  
2171 - width: ScreenUtil().setWidth(36)),  
2172 - HEmptyView(8), 2184 + // Image.asset(Utils.getImgPath('mine_radio_nor'),
  2185 + // width: ScreenUtil().setWidth(36)),
  2186 + // HEmptyView(8),
2173 Text( 2187 Text(
2174 '批量改名累加只适合纯数字桌位,如101', 2188 '批量改名累加只适合纯数字桌位,如101',
2175 style: TextStyle( 2189 style: TextStyle(
@@ -2220,6 +2234,10 @@ class DialogUtil { @@ -2220,6 +2234,10 @@ class DialogUtil {
2220 Utils.showToast('请输入桌位名称!'); 2234 Utils.showToast('请输入桌位名称!');
2221 return; 2235 return;
2222 } 2236 }
  2237 + if (!Utils.isNumber(controller.text)) {
  2238 + Utils.showToast('请输入纯数字!');
  2239 + return;
  2240 + }
2223 // 当前选中区域 2241 // 当前选中区域
2224 // areas[currentAreaIndex] 2242 // areas[currentAreaIndex]
2225 //最低人数 2243 //最低人数
@@ -2229,6 +2247,8 @@ class DialogUtil { @@ -2229,6 +2247,8 @@ class DialogUtil {
2229 2247
2230 onTap({ 2248 onTap({
2231 'name': controller.text, 2249 'name': controller.text,
  2250 + 'skip_four': jumpFour ? '1' : '0',
  2251 + 'skip_seven': jumpSeven ? '1' : '0'
2232 }); 2252 });
2233 Navigator.pop(context); 2253 Navigator.pop(context);
2234 }), 2254 }),
@@ -30,6 +30,12 @@ import '../app.dart'; @@ -30,6 +30,12 @@ import '../app.dart';
30 typedef BookTimeSetCallback = void Function(bool needChange); 30 typedef BookTimeSetCallback = void Function(bool needChange);
31 31
32 class Utils { 32 class Utils {
  33 + // 验证是否为数字
  34 + static bool isNumber(String str) {
  35 + final reg = RegExp(r'^-?[0-9]+');
  36 + print('$str 是否数字:${reg.hasMatch(str)}');
  37 + return reg.hasMatch(str);
  38 + }
33 // 39 //
34 40
35 //时间转换 41 //时间转换