Commit db9226adc2434b9fb9b986f987723bd09421a48a

Authored by wdn127929
1 parent 7833194f

桌位管理部分

@@ -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 * 10; //默认10s  
450 - options.receiveTimeout = 10000 * 10; //默认10s 449 + options.connectTimeout = 1000 * 300; //默认30s
  450 + options.receiveTimeout = 1000 * 300; //默认30s
451 return options; 451 return options;
452 } 452 }
453 } 453 }
@@ -224,5 +224,13 @@ class HttpUrl { @@ -224,5 +224,13 @@ class HttpUrl {
224 "?service=App.GuestManage.SendMarketingMsgByMid"; // 催促未完成任务经理发消息 224 "?service=App.GuestManage.SendMarketingMsgByMid"; // 催促未完成任务经理发消息
225 static const String get_table_type = 225 static const String get_table_type =
226 "?service=App.Tables.GetTabletype"; // 获取桌子类型列表 226 "?service=App.Tables.GetTabletype"; // 获取桌子类型列表
  227 + static const String set_table_by_id =
  228 + "?service=App.Tables.SetTableById"; // 修改桌位信息
  229 + static const String del_seller_tables =
  230 + "?service=App.Tables.DelSellerTables"; // 商户端删除桌位
  231 + static const String set_table_region_by_id =
  232 + "?service=App.Tables.SetTableRegionById"; // 修改商家桌位区域
  233 + static const String del_table_region =
  234 + "?service=App.Tables.DelTableRegion"; // 删除区域同时删除区域下面的桌位
227 235
228 } 236 }
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/constant/state.dart';
  4 +import 'package:one_key/provider/my_table_manage_home_model.dart';
  5 +import 'package:one_key/provider/user_model.dart';
  6 +import 'package:one_key/res/colors.dart';
  7 +import 'package:one_key/utils/dialog_util.dart';
  8 +import 'package:one_key/utils/event_bus.dart';
  9 +import 'package:one_key/utils/utils.dart';
  10 +import 'package:one_key/widgets/page_exception.dart';
  11 +import 'package:one_key/widgets/system_app_bar.dart';
  12 +import 'package:provider/provider.dart';
  13 +
  14 +/*
  15 +**** 区域管理
  16 +*/
  17 +class MyAreaManagePage extends StatefulWidget {
  18 + MyAreaManagePage({Key key}) : super(key: key);
  19 +
  20 + @override
  21 + _MyAreaManagePageState createState() => _MyAreaManagePageState();
  22 +}
  23 +
  24 +class _MyAreaManagePageState extends State<MyAreaManagePage> {
  25 + MyTableManageHomeModel tableManagerModel;
  26 + @override
  27 + void initState() {
  28 + // TODO: implement initState
  29 + super.initState();
  30 + WidgetsBinding.instance.addPostFrameCallback((_) {
  31 + tableManagerModel.initTime(context);
  32 +
  33 + // EventBus().on("refresh_tablemanager", (arg) {
  34 + // //订座-完成预订 刷新管理桌位
  35 + // tableManagerModel.getReserveList(context,
  36 + // needLoading: false, needKeep: true);
  37 + // print(tableManagerModel);
  38 + // });
  39 + // EventBus().on("refresh_tablePhoto", (arg) {
  40 + // ///刷新图片显示
  41 + // _refreshTablePhoto();
  42 + // });
  43 + });
  44 + }
  45 +
  46 + @override
  47 + Widget build(BuildContext context) {
  48 + tableManagerModel =
  49 + Provider.of<MyTableManageHomeModel>(context, listen: true);
  50 + return Scaffold(
  51 + resizeToAvoidBottomInset: false, //输入框抵住键盘
  52 + appBar: SystemAppBar(
  53 + "区域管理",
  54 + showLeading: true,
  55 + onTap: () {
  56 + Navigator.pop(context);
  57 + },
  58 + ),
  59 + backgroundColor: MyColours.color_ffffff,
  60 + body: SafeArea(child:
  61 + Consumer<MyTableManageHomeModel>(builder: (context, model, child) {
  62 + return model.pageState != PageState.Success
  63 + ? Expanded(
  64 + child: ExceptionPage(
  65 + pageState: model.pageState,
  66 + callback: () {
  67 + // if (tableManagerModel.tableOuterList.isEmpty) {
  68 + // tableManagerModel.getTableList(context);
  69 + // } else {
  70 + // tableManagerModel.getReserveList(context);
  71 + // }
  72 + },
  73 + emptyMsg: "暂时没有区域数据哦",
  74 + emptyImg: "table_manage_empty",
  75 + showMsg: "加载中,请稍后...",
  76 + ))
  77 + : ListView.builder(
  78 + padding: EdgeInsets.symmetric(
  79 + horizontal: ScreenUtil().setWidth(32),
  80 + vertical: ScreenUtil().setWidth(54)),
  81 + itemCount: tableManagerModel.areas.length,
  82 + shrinkWrap: true,
  83 + // scrollDirection: Axis.horizontal,
  84 + itemBuilder: (BuildContext contxt, int index) {
  85 + return Container(
  86 + padding: EdgeInsets.symmetric(
  87 + horizontal: ScreenUtil().setWidth(16),
  88 + vertical: ScreenUtil().setWidth(30)),
  89 + decoration: BoxDecoration(
  90 + border: Border(
  91 + bottom: BorderSide(
  92 + width: ScreenUtil().setWidth(2),
  93 + color: MyColours.color_E7E7E7))),
  94 + child: Row(
  95 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  96 + children: [
  97 + Expanded(
  98 + child: InkWell(
  99 + onTap: () async {
  100 + //修改区域弹框
  101 + await DialogUtil
  102 + .openTableManageCreateAreaDialog(
  103 + context,
  104 + title: '修改区域',
  105 + content: tableManagerModel
  106 + .areas[index]
  107 + .name, onTap: (value) async {
  108 + print(value);
  109 + //添加区域
  110 + bool success = await tableManagerModel
  111 + .setTableRegionById(
  112 + context,
  113 + value,
  114 + tableManagerModel
  115 + .areas[index].rid);
  116 + print(success);
  117 + if (success) {
  118 + Utils.showToast('修改成功!');
  119 + tableManagerModel.currentArea = value;
  120 +
  121 + await tableManagerModel
  122 + .refreshTable(context);
  123 + EventBus().emit("refresh_table_area");
  124 + // await tableManagerModel
  125 + // .getTableList(context,
  126 + // needLoading: false);
  127 + // tableManagerModel.initData();
  128 +
  129 + // setState(() {
  130 + // updateMenu();
  131 + // });
  132 + // _scrollToIndex(widget
  133 + // .tableManagerModel
  134 + // .areas
  135 + // .length);
  136 +
  137 + }
  138 + });
  139 + },
  140 + child: Text(
  141 + tableManagerModel.areas[index].name,
  142 + style: TextStyle(
  143 + color: MyColours.color_000000,
  144 + fontSize: ScreenUtil().setSp(32))))),
  145 + InkWell(
  146 + onTap: () {
  147 + DialogUtil.cupertinoAlertDialog(context,
  148 + title: "",
  149 + content: "是否确定删除该区域",
  150 + lTitle: "取消",
  151 + rTitle: "确认删除",
  152 + isBold: true,
  153 + isBoldContent: true,
  154 + rColor: MyColours.color_E34D59,
  155 + lCallback: () {
  156 + print("取消");
  157 + }, rCallback: () async {
  158 + bool success =
  159 + await tableManagerModel.delTableRegion(
  160 + context,
  161 + tableManagerModel.areas[index].rid);
  162 + print(success);
  163 + if (success) {
  164 + Utils.showToast('删除成功!');
  165 + // TableOuter tableOuter = TableOuter();
  166 + // tableOuter.name = value;
  167 + // tableOuter.list = [];
  168 + // tableManagerModel.tableOuterList.add(tableOuter);
  169 + // tableManagerModel.initData();
  170 + // Timer(
  171 + // Duration(milliseconds: 500),
  172 + // () => _areaController.jumpTo(
  173 + // _areaController.position.maxScrollExtent));
  174 +
  175 + // await tableManagerModel
  176 + // .getTableList(context);
  177 + // await tableManagerModel
  178 + // .initData();
  179 +
  180 + await tableManagerModel
  181 + .refreshTable(context);
  182 + EventBus().emit("refresh_table_area");
  183 + }
  184 + });
  185 + },
  186 + child: Text('删除',
  187 + style: TextStyle(
  188 + color: MyColours.color_438E93,
  189 + decoration: TextDecoration.underline,
  190 + fontSize: ScreenUtil().setSp(32))))
  191 + ],
  192 + ),
  193 + );
  194 + });
  195 + })));
  196 + }
  197 +}
@@ -84,10 +84,9 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -84,10 +84,9 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
84 // needLoading: false, needKeep: true); 84 // needLoading: false, needKeep: true);
85 // print(tableManagerModel); 85 // print(tableManagerModel);
86 // }); 86 // });
87 - // EventBus().on("refresh_tablePhoto", (arg) {  
88 - // ///刷新图片显示  
89 - // _refreshTablePhoto();  
90 - // }); 87 + EventBus().on("refresh_table_area", (arg) {
  88 + tableManagerModel.refreshTable(context);
  89 + });
91 }); 90 });
92 } 91 }
93 92
@@ -95,7 +94,7 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -95,7 +94,7 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
95 void dispose() { 94 void dispose() {
96 // TODO: implement dispose 95 // TODO: implement dispose
97 super.dispose(); 96 super.dispose();
98 - // EventBus().off("refresh_tablemanager"); 97 + EventBus().off("refresh_table_area");
99 // EventBus().off("refresh_tablePhoto"); 98 // EventBus().off("refresh_tablePhoto");
100 } 99 }
101 100
@@ -162,13 +161,15 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -162,13 +161,15 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
162 child: InkWell( 161 child: InkWell(
163 onTap: () async { 162 onTap: () async {
164 List<String> tableTypeS = []; 163 List<String> tableTypeS = [];
165 - for (int i = 0; i < tableManagerModel.tableTypeList.length; i++) { 164 + for (int i = 0;
  165 + i < tableManagerModel.tableTypeList.length;
  166 + i++) {
166 tableTypeS.add(tableManagerModel.tableTypeList[i].name); 167 tableTypeS.add(tableManagerModel.tableTypeList[i].name);
167 } 168 }
168 169
169 //添加桌位弹框 170 //添加桌位弹框
170 await DialogUtil.openMyTableManageCreateTableDialog( 171 await DialogUtil.openMyTableManageCreateTableDialog(
171 - context, tableTypeS, personNumList, 172 + context, tableTypeS, personNumList,
172 onTap: (Map<String, String> value) async { 173 onTap: (Map<String, String> value) async {
173 print(value); 174 print(value);
174 // 'areaname': 175 // 'areaname':
@@ -178,24 +179,53 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -178,24 +179,53 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
178 // 'pnumMax': pnumMax 179 // 'pnumMax': pnumMax
179 //添加桌位 接口参数带整合??? 180 //添加桌位 接口参数带整合???
180 // 以下是旧的不去,明天添加桌位接口 181 // 以下是旧的不去,明天添加桌位接口
  182 + // 'bjtype': baojianList[
  183 + // currentBaojianIndex],
  184 + // 'name': controller.text,
  185 + // 'pnumMin': pnumMin,
  186 + // 'pnumMax': pnumMax,
  187 + // 'mulcreate':
  188 + // mulCreate.toString(),
  189 + // 'tablenum':
  190 + // _norNumController.text
181 String rid; 191 String rid;
182 for (Area item in tableManagerModel.areas) { 192 for (Area item in tableManagerModel.areas) {
183 - if (item.name == value['areaname']) { 193 + if (item.name == tableManagerModel.currentArea) {
184 rid = item.rid; 194 rid = item.rid;
185 } 195 }
186 } 196 }
  197 +
187 Map<String, String> params = { 198 Map<String, String> params = {
188 'rid': rid, 199 'rid': rid,
189 - 'name': value['name'],  
190 }; 200 };
191 - if (value['pnumMin'] != '') {  
192 - params['pnum'] = value['pnumMin']; 201 + String tid;
  202 + for (int i = 0;
  203 + i < tableManagerModel.tableTypeList.length;
  204 + i++) {
  205 + if (value['bjtype'] ==
  206 + tableManagerModel.tableTypeList[i].name) {
  207 + tid = tableManagerModel.tableTypeList[i].id;
  208 + }
193 } 209 }
194 - if (value['pnumMax'] != '') {  
195 - params['most_pnum'] = value['pnumMax']; 210 + if (value['mulcreate'] == 'true') {
  211 + //批量创建
  212 + params['tablenum'] = value['tablenum'];
  213 + params['pnum'] = '10';
  214 + params['most_pnum'] = '10';
  215 + // params['name'] = 'lll';
  216 + } else {
  217 + //单个创建
  218 + params['name'] = value['name'];
  219 + if (value['pnumMin'] != '') {
  220 + params['pnum'] = value['pnumMin'];
  221 + }
  222 + if (value['pnumMax'] != '') {
  223 + params['most_pnum'] = value['pnumMax'];
  224 + }
196 } 225 }
197 - bool success =  
198 - await tableManagerModel.addTable(context, params); 226 +
  227 + bool success = await tableManagerModel
  228 + .addTable(context, params, tid: tid);
199 print(success); 229 print(success);
200 if (success) { 230 if (success) {
201 Utils.showToast('添加成功!'); 231 Utils.showToast('添加成功!');
@@ -251,29 +281,127 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -251,29 +281,127 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
251 builder: (context, table, _) { 281 builder: (context, table, _) {
252 return ManageTableItem(table, 282 return ManageTableItem(table,
253 canMulSelected: tableManagerModel.tableOuterList[i].isSelect, 283 canMulSelected: tableManagerModel.tableOuterList[i].isSelect,
254 - onSelected: (table) { 284 + onSelected: (table) async {
255 if (tableManagerModel.tableOuterList[i].isSelect) { 285 if (tableManagerModel.tableOuterList[i].isSelect) {
256 //多选 286 //多选
257 setState(() { 287 setState(() {
258 table.selected = !(table.selected ?? false); 288 table.selected = !(table.selected ?? false);
259 }); 289 });
  290 + if (table.selected) {
  291 + tableManagerModel.tableOuterList[i].selectTables.add(table);
  292 + } else {
  293 + tableManagerModel.tableOuterList[i].selectTables
  294 + .removeWhere((t) => t.id == table.id);
  295 + }
260 } else { 296 } else {
261 - for (t.Table item  
262 - in tableManagerModel.tableOuterList[i].list) {  
263 - item.selected = false; 297 + // for (t.Table item
  298 + // in tableManagerModel.tableOuterList[i].list) {
  299 + // item.selected = false;
  300 + // }
  301 + // tableManagerModel.tableOuterList[i].selectTables = [];
  302 + // //单选
  303 + // setState(() {
  304 + // table.selected = true;
  305 + // });
  306 + //修改桌位
  307 + print(table);
  308 + List<String> tableTypeS = [];
  309 + for (int i = 0;
  310 + i < tableManagerModel.tableTypeList.length;
  311 + i++) {
  312 + tableTypeS.add(tableManagerModel.tableTypeList[i].name);
264 } 313 }
265 - tableManagerModel.tableOuterList[i].selectTables = [];  
266 - //单选  
267 - setState(() {  
268 - table.selected = true; 314 + await DialogUtil.openMyTableManageModifyTableDialog(
  315 + context, tableTypeS, personNumList,
  316 + name: table.name,
  317 + tidStr: table.tidStr,
  318 + pnumMin: table.table_pnum ?? '',
  319 + pnumMax: table.most_pnum ?? '',
  320 + onTapDel: (Map<String, String> value) async {
  321 + Map<String, String> params = {
  322 + 'sid': Provider.of<UserModel>(context, listen: false)
  323 + .user
  324 + .sellerid,
  325 + 'tid': table.id
  326 + };
  327 +
  328 + bool success = await tableManagerModel.delSellerTables(
  329 + context, params);
  330 + print(success);
  331 + if (success) {
  332 + Utils.showToast('删除成功!');
  333 + // TableOuter tableOuter = TableOuter();
  334 + // tableOuter.name = value;
  335 + // tableOuter.list = [];
  336 + // tableManagerModel.tableOuterList.add(tableOuter);
  337 + // tableManagerModel.initData();
  338 + // Timer(
  339 + // Duration(milliseconds: 500),
  340 + // () => _areaController.jumpTo(
  341 + // _areaController.position.maxScrollExtent));
  342 +
  343 + // await tableManagerModel
  344 + // .getTableList(context);
  345 + // await tableManagerModel
  346 + // .initData();
  347 + await tableManagerModel.refreshTable(context);
  348 + }
  349 + }, onTap: (Map<String, String> value) async {
  350 + // String rid;
  351 + // for (Area item in tableManagerModel.areas) {
  352 + // if (item.name == tableManagerModel.currentArea) {
  353 + // rid = item.rid;
  354 + // }
  355 + // }
  356 +
  357 + // Map<String, String> params = {
  358 + // 'rid': rid,
  359 + // };
  360 + String tid;
  361 + for (int i = 0;
  362 + i < tableManagerModel.tableTypeList.length;
  363 + i++) {
  364 + if (value['bjtype'] ==
  365 + tableManagerModel.tableTypeList[i].name) {
  366 + tid = tableManagerModel.tableTypeList[i].id;
  367 + }
  368 + }
  369 + Map<String, String> params = {
  370 + 'id': table.id,
  371 + 'name': value['name'],
  372 + 'tid': tid
  373 + };
  374 +
  375 + if (value['pnumMin'] != '') {
  376 + params['table_pnum'] = value['pnumMin'];
  377 + }
  378 + if (value['pnumMax'] != '') {
  379 + params['most_pnum'] = value['pnumMax'];
  380 + }
  381 +
  382 + bool success =
  383 + await tableManagerModel.setTableById(context, params);
  384 + print(success);
  385 + if (success) {
  386 + Utils.showToast('修改成功!');
  387 + // TableOuter tableOuter = TableOuter();
  388 + // tableOuter.name = value;
  389 + // tableOuter.list = [];
  390 + // tableManagerModel.tableOuterList.add(tableOuter);
  391 + // tableManagerModel.initData();
  392 + // Timer(
  393 + // Duration(milliseconds: 500),
  394 + // () => _areaController.jumpTo(
  395 + // _areaController.position.maxScrollExtent));
  396 +
  397 + // await tableManagerModel
  398 + // .getTableList(context);
  399 + // await tableManagerModel
  400 + // .initData();
  401 + await tableManagerModel.refreshTable(context);
  402 + }
269 }); 403 });
270 } 404 }
271 - if (table.selected) {  
272 - tableManagerModel.tableOuterList[i].selectTables.add(table);  
273 - } else {  
274 - tableManagerModel.tableOuterList[i].selectTables  
275 - .removeWhere((t) => t.id == table.id);  
276 - }  
277 }); 405 });
278 }, 406 },
279 ); 407 );
@@ -488,6 +616,10 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -488,6 +616,10 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
488 .selectNumber] 616 .selectNumber]
489 .isSelect) { 617 .isSelect) {
490 //区域管理页面跳转 618 //区域管理页面跳转
  619 +
  620 + NavigatorUtil
  621 + .goMyAreaManagerHomePage(
  622 + context);
491 } 623 }
492 }, 624 },
493 child: Container( 625 child: Container(
@@ -901,12 +1033,34 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -901,12 +1033,34 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
901 MainAxisAlignment.spaceBetween, 1033 MainAxisAlignment.spaceBetween,
902 children: [ 1034 children: [
903 CommonButton( 1035 CommonButton(
904 - content: "修改名称",  
905 - width: 200,  
906 - height: 72,  
907 - fontSize: 32,  
908 - onPress: () async {},  
909 - ), 1036 + content: "修改名称",
  1037 + width: 200,
  1038 + height: 72,
  1039 + fontSize: 32,
  1040 + onPress: () async {
  1041 + DialogUtil
  1042 + .openMyTableManageModifyTableNameDialog(
  1043 + context,
  1044 + onTap: (Map<String, String>
  1045 + value) async {
  1046 + Map<String, String> params = {
  1047 + 'name': value['name'],
  1048 + };
  1049 +
  1050 + bool success =
  1051 + await tableManagerModel
  1052 + .setTableById(
  1053 + context, params);
  1054 + print(success);
  1055 + if (success) {
  1056 + Utils.showToast('修改成功!');
  1057 +
  1058 + await tableManagerModel
  1059 + .refreshTable(context);
  1060 + }
  1061 + },
  1062 + );
  1063 + }),
910 CommonButton( 1064 CommonButton(
911 content: "修改人数", 1065 content: "修改人数",
912 width: 200, 1066 width: 200,
@@ -930,7 +1084,73 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -930,7 +1084,73 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
930 height: 72, 1084 height: 72,
931 fontSize: 32, 1085 fontSize: 32,
932 state: -3, 1086 state: -3,
933 - onPress: () async {}, 1087 + onPress: () async {
  1088 + if (tableManagerModel
  1089 + .tableOuterList[
  1090 + tableManagerModel.selectNumber]
  1091 + .selectTables
  1092 + .length ==
  1093 + 0) {
  1094 + Utils.showToast('请选择桌位');
  1095 + return;
  1096 + }
  1097 + String tids = '';
  1098 + for (t.Table item in tableManagerModel
  1099 + .tableOuterList[
  1100 + tableManagerModel.selectNumber]
  1101 + .selectTables) {
  1102 + tids += '${item.id},';
  1103 + }
  1104 + if (tids.endsWith(',')) {
  1105 + tids = tids.substring(0, tids.length - 1);
  1106 + }
  1107 +
  1108 + DialogUtil.cupertinoAlertDialog(context,
  1109 + title: "",
  1110 + content:
  1111 + "是否确定删除${tids.split(',').length}个桌位",
  1112 + lTitle: "取消",
  1113 + rTitle: "确认删除",
  1114 + isBold: true,
  1115 + isBoldContent: true,
  1116 + rColor: MyColours.color_E34D59,
  1117 + lCallback: () {
  1118 + print("取消");
  1119 + }, rCallback: () async {
  1120 + print("确定");
  1121 +
  1122 + Map<String, String> params = {
  1123 + 'sid': Provider.of<UserModel>(context,
  1124 + listen: false)
  1125 + .user
  1126 + .sellerid,
  1127 + 'tid': tids
  1128 + };
  1129 +
  1130 + bool success = await tableManagerModel
  1131 + .delSellerTables(context, params);
  1132 + print(success);
  1133 + if (success) {
  1134 + Utils.showToast('删除成功!');
  1135 + // TableOuter tableOuter = TableOuter();
  1136 + // tableOuter.name = value;
  1137 + // tableOuter.list = [];
  1138 + // tableManagerModel.tableOuterList.add(tableOuter);
  1139 + // tableManagerModel.initData();
  1140 + // Timer(
  1141 + // Duration(milliseconds: 500),
  1142 + // () => _areaController.jumpTo(
  1143 + // _areaController.position.maxScrollExtent));
  1144 +
  1145 + // await tableManagerModel
  1146 + // .getTableList(context);
  1147 + // await tableManagerModel
  1148 + // .initData();
  1149 + await tableManagerModel
  1150 + .refreshTable(context);
  1151 + }
  1152 + });
  1153 + },
934 ), 1154 ),
935 VEmptyView(32), 1155 VEmptyView(32),
936 ], 1156 ],
@@ -249,6 +249,90 @@ class MyTableManageHomeModel with ChangeNotifier { @@ -249,6 +249,90 @@ class MyTableManageHomeModel with ChangeNotifier {
249 return false; 249 return false;
250 } 250 }
251 251
  252 + ///修改商家桌位区域
  253 + Future<bool> setTableRegionById(
  254 + BuildContext context, String name, String areaid) async {
  255 + Map<String, String> params = {
  256 + "sellerid": userModel.user.sellerid,
  257 + "name": name,
  258 + "id": areaid
  259 + };
  260 + BaseResp<dynamic> baseResp = await DioUtil()
  261 + .request<dynamic>(context, Method.get, HttpUrl.set_table_region_by_id,
  262 + data: params, showLoading: true)
  263 + .catchError((error) {
  264 + print(error.toString());
  265 + // if (error is MyError) {
  266 + // switch (error.type) {
  267 + // case 1:
  268 + // pageState = PageState.ConnectivityError;
  269 + // break;
  270 + // case 2:
  271 + // pageState = PageState.ConnectivityTimeOut;
  272 + // break;
  273 + // default:
  274 + // pageState = PageState.ConnectivityError;
  275 + // break;
  276 + // }
  277 + // }
  278 + // notifyListeners();
  279 + return false;
  280 + });
  281 +
  282 + if (baseResp.code == Constant.status_success) {
  283 + if (baseResp.responseData['data'] != null &&
  284 + baseResp.responseData['data'].length > 0) {
  285 + return true;
  286 + } else {
  287 + Utils.showToast(baseResp.msg ?? '修改区域失败!');
  288 + }
  289 + } else {
  290 + Utils.showToast(baseResp.msg ?? '修改区域失败!');
  291 + }
  292 + return false;
  293 + }
  294 +
  295 + ///删除区域同时删除区域下面的桌位
  296 + Future<bool> delTableRegion(BuildContext context, String areaid) async {
  297 + Map<String, String> params = {
  298 + "sellerid": userModel.user.sellerid,
  299 + "regionid": areaid
  300 + };
  301 + BaseResp<dynamic> baseResp = await DioUtil()
  302 + .request<dynamic>(context, Method.get, HttpUrl.del_table_region,
  303 + data: params, showLoading: true)
  304 + .catchError((error) {
  305 + print(error.toString());
  306 + // if (error is MyError) {
  307 + // switch (error.type) {
  308 + // case 1:
  309 + // pageState = PageState.ConnectivityError;
  310 + // break;
  311 + // case 2:
  312 + // pageState = PageState.ConnectivityTimeOut;
  313 + // break;
  314 + // default:
  315 + // pageState = PageState.ConnectivityError;
  316 + // break;
  317 + // }
  318 + // }
  319 + // notifyListeners();
  320 + return false;
  321 + });
  322 +
  323 + if (baseResp.code == Constant.status_success) {
  324 + if (baseResp.responseData['data'] != null &&
  325 + baseResp.responseData['data'] > 0) {
  326 + return true;
  327 + } else {
  328 + Utils.showToast(baseResp.msg ?? '删除区域失败!');
  329 + }
  330 + } else {
  331 + Utils.showToast(baseResp.msg ?? '删除区域失败!');
  332 + }
  333 + return false;
  334 + }
  335 +
252 //获取区域数据 336 //获取区域数据
253 Future<List<AreaSunModel>> getRegionBySellerid(BuildContext context) async { 337 Future<List<AreaSunModel>> getRegionBySellerid(BuildContext context) async {
254 Map<String, String> params = {"sellerid": userModel.user.sellerid}; 338 Map<String, String> params = {"sellerid": userModel.user.sellerid};
@@ -286,10 +370,10 @@ class MyTableManageHomeModel with ChangeNotifier { @@ -286,10 +370,10 @@ class MyTableManageHomeModel with ChangeNotifier {
286 } 370 }
287 371
288 //添加商家桌位 372 //添加商家桌位
289 - Future<bool> addTable(  
290 - BuildContext context, Map<String, String> params) async { 373 + Future<bool> addTable(BuildContext context, Map<String, String> params,
  374 + {tid: '2'}) async {
291 params["sellerid"] = userModel.user.sellerid; 375 params["sellerid"] = userModel.user.sellerid;
292 - params["tid"] = '2'; 376 + params["tid"] = tid;
293 BaseResp<dynamic> baseResp = await DioUtil() 377 BaseResp<dynamic> baseResp = await DioUtil()
294 .request<dynamic>(context, Method.get, HttpUrl.add_table, 378 .request<dynamic>(context, Method.get, HttpUrl.add_table,
295 data: params, showLoading: true) 379 data: params, showLoading: true)
@@ -325,6 +409,82 @@ class MyTableManageHomeModel with ChangeNotifier { @@ -325,6 +409,82 @@ class MyTableManageHomeModel with ChangeNotifier {
325 return false; 409 return false;
326 } 410 }
327 411
  412 + //修改桌位信息
  413 + Future<bool> setTableById(
  414 + BuildContext context, Map<String, String> params) async {
  415 + BaseResp<dynamic> baseResp = await DioUtil()
  416 + .request<dynamic>(context, Method.get, HttpUrl.set_table_by_id,
  417 + data: params, showLoading: true)
  418 + .catchError((error) {
  419 + print(error.toString());
  420 + // if (error is MyError) {
  421 + // switch (error.type) {
  422 + // case 1:
  423 + // pageState = PageState.ConnectivityError;
  424 + // break;
  425 + // case 2:
  426 + // pageState = PageState.ConnectivityTimeOut;
  427 + // break;
  428 + // default:
  429 + // pageState = PageState.ConnectivityError;
  430 + // break;
  431 + // }
  432 + // }
  433 + // notifyListeners();
  434 + return false;
  435 + });
  436 +
  437 + if (baseResp.code == Constant.status_success) {
  438 + if (baseResp.responseData['data'] != null &&
  439 + baseResp.responseData['data']['id'] == 1) {
  440 + return true;
  441 + } else {
  442 + Utils.showToast(baseResp.msg ?? '修改桌位失败!');
  443 + }
  444 + } else {
  445 + Utils.showToast(baseResp.msg ?? '修改桌位失败!');
  446 + }
  447 + return false;
  448 + }
  449 +
  450 + //商户端删除桌位
  451 + Future<bool> delSellerTables(
  452 + BuildContext context, Map<String, String> params) async {
  453 + BaseResp<dynamic> baseResp = await DioUtil()
  454 + .request<dynamic>(context, Method.get, HttpUrl.del_seller_tables,
  455 + data: params, showLoading: true)
  456 + .catchError((error) {
  457 + print(error.toString());
  458 + // if (error is MyError) {
  459 + // switch (error.type) {
  460 + // case 1:
  461 + // pageState = PageState.ConnectivityError;
  462 + // break;
  463 + // case 2:
  464 + // pageState = PageState.ConnectivityTimeOut;
  465 + // break;
  466 + // default:
  467 + // pageState = PageState.ConnectivityError;
  468 + // break;
  469 + // }
  470 + // }
  471 + // notifyListeners();
  472 + return false;
  473 + });
  474 +
  475 + if (baseResp.code == Constant.status_success) {
  476 + if (baseResp.responseData['data'] != null &&
  477 + (baseResp.responseData['data'] > 0)) {
  478 + return true;
  479 + } else {
  480 + Utils.showToast(baseResp.msg ?? '删除桌位失败!');
  481 + }
  482 + } else {
  483 + Utils.showToast(baseResp.msg ?? '删除桌位失败!');
  484 + }
  485 + return false;
  486 + }
  487 +
328 refreshTable(context) async { 488 refreshTable(context) async {
329 List temp = await getTableList(context, needLoading: false); 489 List temp = await getTableList(context, needLoading: false);
330 // if (temp.length > 0) { 490 // if (temp.length > 0) {
@@ -18,6 +18,7 @@ import 'package:one_key/models/statics_model.dart'; @@ -18,6 +18,7 @@ import 'package:one_key/models/statics_model.dart';
18 import 'package:one_key/models/table_list.dart'; 18 import 'package:one_key/models/table_list.dart';
19 import 'package:one_key/models/user_history_entity.dart'; 19 import 'package:one_key/models/user_history_entity.dart';
20 import 'package:one_key/provider/customer_provider.dart'; 20 import 'package:one_key/provider/customer_provider.dart';
  21 +import 'package:one_key/provider/my_table_manage_home_model.dart';
21 import 'package:one_key/res/colors.dart'; 22 import 'package:one_key/res/colors.dart';
22 import 'package:one_key/route/routes.dart'; 23 import 'package:one_key/route/routes.dart';
23 import 'package:one_key/utils/fluro_convert_utils.dart'; 24 import 'package:one_key/utils/fluro_convert_utils.dart';
@@ -796,4 +797,13 @@ class NavigatorUtil { @@ -796,4 +797,13 @@ class NavigatorUtil {
796 return _navigateTo(context, "${Routes.my_table_manager_home_page}", 797 return _navigateTo(context, "${Routes.my_table_manager_home_page}",
797 replace: replace); 798 replace: replace);
798 } 799 }
  800 +
  801 + ///我的----区域管理
  802 + static Future<dynamic> goMyAreaManagerHomePage(
  803 + BuildContext context, {
  804 + replace = false,
  805 + }) {
  806 + return _navigateTo(context, "${Routes.my_area_manage_page}?",
  807 + replace: replace);
  808 + }
799 } 809 }
@@ -95,6 +95,7 @@ import 'package:one_key/pages/my/sms_manager.dart'; @@ -95,6 +95,7 @@ import 'package:one_key/pages/my/sms_manager.dart';
95 import 'package:one_key/pages/my/sms_recharge_page.dart'; 95 import 'package:one_key/pages/my/sms_recharge_page.dart';
96 import 'package:one_key/pages/my/store_base_info_page.dart'; 96 import 'package:one_key/pages/my/store_base_info_page.dart';
97 import 'package:one_key/pages/my/store_type_fill_manage_page.dart'; 97 import 'package:one_key/pages/my/store_type_fill_manage_page.dart';
  98 +import 'package:one_key/pages/my/table_manage/my_areas_manage_page.dart';
98 import 'package:one_key/pages/my/table_manage/my_table_manage_home_page.dart'; 99 import 'package:one_key/pages/my/table_manage/my_table_manage_home_page.dart';
99 import 'package:one_key/pages/notebook/statistics_page.dart'; 100 import 'package:one_key/pages/notebook/statistics_page.dart';
100 import 'package:one_key/pages/notebook/statistics_sms_page.dart'; 101 import 'package:one_key/pages/notebook/statistics_sms_page.dart';
@@ -1231,3 +1232,17 @@ var myTableManagerHomePageHandle = new Handler( @@ -1231,3 +1232,17 @@ var myTableManagerHomePageHandle = new Handler(
1231 child: MyTableManagerHomePage(), 1232 child: MyTableManagerHomePage(),
1232 ); 1233 );
1233 }); 1234 });
  1235 +
  1236 +///我的---区域管理
  1237 +var myAreaManagePageHandle = new Handler(
  1238 + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
  1239 + // Guest guest = Guest.fromJson(json
  1240 + // .decode(FluroConvertUtils.fluroCnParamsDecode(params["guest"].first)));
  1241 + // UserHistoryEntity userHistoryEntity = UserHistoryEntity.fromJson(json.decode(
  1242 + // FluroConvertUtils.fluroCnParamsDecode(
  1243 + // params["userHistoryEntity"].first)));
  1244 + return ChangeNotifierProvider<MyTableManageHomeModel>(
  1245 + create: (_) => MyTableManageHomeModel(),
  1246 + child: MyAreaManagePage(),
  1247 + );
  1248 +});
@@ -107,6 +107,9 @@ class Routes { @@ -107,6 +107,9 @@ class Routes {
107 static String table_manager_page = "/table_manager_page"; //客情再次预订跳转的桌位预订页面 107 static String table_manager_page = "/table_manager_page"; //客情再次预订跳转的桌位预订页面
108 static String account_login_page = "/account_login_page"; //账号登录页面 108 static String account_login_page = "/account_login_page"; //账号登录页面
109 static String my_table_manager_home_page = "/my_table_manager_home_page"; //我的---桌位管理 109 static String my_table_manager_home_page = "/my_table_manager_home_page"; //我的---桌位管理
  110 + static String my_area_manage_page = "/my_area_manage_page"; //我的---区域管理
  111 +
  112 +
110 113
111 114
112 115
@@ -219,6 +222,7 @@ class Routes { @@ -219,6 +222,7 @@ class Routes {
219 router.define(table_manager_page, handler: tableManagerPageHandle); 222 router.define(table_manager_page, handler: tableManagerPageHandle);
220 router.define(account_login_page, handler: accountLoginPageHandle); 223 router.define(account_login_page, handler: accountLoginPageHandle);
221 router.define(my_table_manager_home_page, handler: myTableManagerHomePageHandle); 224 router.define(my_table_manager_home_page, handler: myTableManagerHomePageHandle);
  225 + router.define(my_area_manage_page, handler: myAreaManagePageHandle);
222 226
223 227
224 } 228 }
@@ -282,9 +282,12 @@ class DialogUtil { @@ -282,9 +282,12 @@ class DialogUtil {
282 // } 282 // }
283 283
284 static Future openTableManageCreateAreaDialog(BuildContext context, 284 static Future openTableManageCreateAreaDialog(BuildContext context,
285 - {CustomCallBack onTap}) async { 285 + {CustomCallBack onTap,
  286 + String title = '添加区域',
  287 + String content = ''}) async {
286 TextEditingController controller = TextEditingController(); 288 TextEditingController controller = TextEditingController();
287 - bool isRed = true; 289 + controller.text = content;
  290 + bool isRed = content != '' ? false : true;
288 final action = await showDialog( 291 final action = await showDialog(
289 context: context, 292 context: context,
290 barrierDismissible: false, 293 barrierDismissible: false,
@@ -311,7 +314,7 @@ class DialogUtil { @@ -311,7 +314,7 @@ class DialogUtil {
311 Container( 314 Container(
312 // height: ScreenUtil().setWidth(48), 315 // height: ScreenUtil().setWidth(48),
313 alignment: Alignment.center, 316 alignment: Alignment.center,
314 - child: Text('添加区域', 317 + child: Text(title,
315 style: TextStyle( 318 style: TextStyle(
316 fontWeight: FontWeight.bold, 319 fontWeight: FontWeight.bold,
317 fontSize: ScreenUtil().setSp(34), 320 fontSize: ScreenUtil().setSp(34),
@@ -756,13 +759,15 @@ class DialogUtil { @@ -756,13 +759,15 @@ class DialogUtil {
756 TextEditingController controller = TextEditingController(); 759 TextEditingController controller = TextEditingController();
757 760
758 TextEditingController _norNumController = TextEditingController(); 761 TextEditingController _norNumController = TextEditingController();
  762 + _norNumController.text = '10';
759 FocusNode _norNumFocusNode = FocusNode(); 763 FocusNode _norNumFocusNode = FocusNode();
760 bool showBaojian = true; 764 bool showBaojian = true;
761 bool showPnumMin = true; 765 bool showPnumMin = true;
762 bool showPnumMax = true; 766 bool showPnumMax = true;
763 String pnumMin = ''; 767 String pnumMin = '';
764 String pnumMax = ''; 768 String pnumMax = '';
765 - int currentBaojianIndex = 0; 769 + int currentBaojianIndex =
  770 + baojianList.indexWhere((element) => element == '包间') ?? 0;
766 String baojian = baojianList[currentBaojianIndex]; 771 String baojian = baojianList[currentBaojianIndex];
767 bool mulCreate = false; 772 bool mulCreate = false;
768 // StateSetter globalState; 773 // StateSetter globalState;
@@ -789,7 +794,7 @@ class DialogUtil { @@ -789,7 +794,7 @@ class DialogUtil {
789 // globalState = state; 794 // globalState = state;
790 795
791 return Container( 796 return Container(
792 - margin: EdgeInsets.only(top: ScreenUtil().setWidth(300)), 797 + margin: EdgeInsets.only(top: ScreenUtil().setWidth(300)),
793 padding: 798 padding:
794 EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(50)), 799 EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(50)),
795 // height: ScreenUtil().setWidth(326 * 2) + 800 // height: ScreenUtil().setWidth(326 * 2) +
@@ -880,7 +885,8 @@ class DialogUtil { @@ -880,7 +885,8 @@ class DialogUtil {
880 '填写个数', 885 '填写个数',
881 _norNumController, 886 _norNumController,
882 _norNumFocusNode, 887 _norNumFocusNode,
883 - '人')) 888 + '个',
  889 + state))
884 : Container( 890 : Container(
885 margin: EdgeInsets.symmetric( 891 margin: EdgeInsets.symmetric(
886 horizontal: 892 horizontal:
@@ -1122,13 +1128,28 @@ class DialogUtil { @@ -1122,13 +1128,28 @@ class DialogUtil {
1122 MyColours.color_ffffff, 1128 MyColours.color_ffffff,
1123 gradientEnd: 1129 gradientEnd:
1124 MyColours.color_ffffff, 1130 MyColours.color_ffffff,
1125 - textColor: controller.text == '' 1131 + textColor: (!mulCreate &&
  1132 + controller.text ==
  1133 + '') ||
  1134 + (mulCreate &&
  1135 + _norNumController.text
  1136 + .trim() ==
  1137 + '')
1126 ? MyColours.color_999999 1138 ? MyColours.color_999999
1127 : MyColours.color_438E93, 1139 : MyColours.color_438E93,
1128 fontSize: 34, 1140 fontSize: 34,
1129 onPressed: () { 1141 onPressed: () {
1130 - if (controller.text.trim() ==  
1131 - '') { 1142 + if (mulCreate &&
  1143 + _norNumController.text
  1144 + .trim()
  1145 + .length ==
  1146 + 0) {
  1147 + Utils.showToast('请输入数量!');
  1148 + return;
  1149 + }
  1150 + if (!mulCreate &&
  1151 + controller.text.trim() ==
  1152 + '') {
1132 Utils.showToast('请输入桌位名称!'); 1153 Utils.showToast('请输入桌位名称!');
1133 return; 1154 return;
1134 } 1155 }
@@ -1140,11 +1161,15 @@ class DialogUtil { @@ -1140,11 +1161,15 @@ class DialogUtil {
1140 // pnumMax 1161 // pnumMax
1141 1162
1142 onTap({ 1163 onTap({
1143 - 'areaname': baojianList[ 1164 + 'bjtype': baojianList[
1144 currentBaojianIndex], 1165 currentBaojianIndex],
1145 'name': controller.text, 1166 'name': controller.text,
1146 'pnumMin': pnumMin, 1167 'pnumMin': pnumMin,
1147 - 'pnumMax': pnumMax 1168 + 'pnumMax': pnumMax,
  1169 + 'mulcreate':
  1170 + mulCreate.toString(),
  1171 + 'tablenum':
  1172 + _norNumController.text
1148 }); 1173 });
1149 Navigator.pop(context); 1174 Navigator.pop(context);
1150 }), 1175 }),
@@ -1204,6 +1229,674 @@ class DialogUtil { @@ -1204,6 +1229,674 @@ class DialogUtil {
1204 }); 1229 });
1205 } 1230 }
1206 1231
  1232 + static Future openMyTableManageModifyTableDialog(
  1233 + BuildContext context, List<String> baojianList, List<String> pnum,
  1234 + {String name,
  1235 + String tidStr,
  1236 + String pnumMin = '',
  1237 + String pnumMax = '',
  1238 + CustomCallBackMap onTap,
  1239 + CustomCallBackMap onTapDel}) async {
  1240 + TextEditingController controller = TextEditingController();
  1241 + controller.text = name;
  1242 + // TextEditingController _norNumController = TextEditingController();
  1243 + // _norNumController.text = '10';
  1244 + // FocusNode _norNumFocusNode = FocusNode();
  1245 + bool showBaojian = true;
  1246 + bool showPnumMin = true;
  1247 + bool showPnumMax = true;
  1248 +
  1249 + int currentBaojianIndex = tidStr == null
  1250 + ? 0
  1251 + : baojianList.indexWhere((element) => element == tidStr) ?? 0;
  1252 + String baojian = baojianList[currentBaojianIndex];
  1253 + // StateSetter globalState;
  1254 +// //输入框焦点
  1255 +// focusNode.addListener(() {
  1256 +// if (!focusNode.hasFocus) {
  1257 +// // print('失去焦点');
  1258 +
  1259 +// } else {
  1260 +// // print('得到焦点');
  1261 +// globalState(() {
  1262 +// showPnumMin = true;
  1263 +// showPnumMax = true;
  1264 +// showArea = true;
  1265 +// });
  1266 +// }
  1267 +// });
  1268 +
  1269 + final action = await showDialog(
  1270 + context: context,
  1271 + barrierDismissible: false,
  1272 + builder: (BuildContext context) {
  1273 + return Center(child: StatefulBuilder(builder: (context, state) {
  1274 + // globalState = state;
  1275 +
  1276 + return Container(
  1277 + margin: EdgeInsets.only(top: ScreenUtil().setWidth(300)),
  1278 + padding:
  1279 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(50)),
  1280 + // height: ScreenUtil().setWidth(326 * 2) +
  1281 + // ScreenUtil().setWidth(250 * 2),
  1282 + decoration: BoxDecoration(
  1283 + borderRadius:
  1284 + BorderRadius.circular(ScreenUtil().setWidth(10))),
  1285 + child: Stack(children: [
  1286 + Column(
  1287 + children: [
  1288 + Card(
  1289 + shape: RoundedRectangleBorder(
  1290 + borderRadius: BorderRadius.all(Radius.circular(
  1291 + ScreenUtil().setWidth(10)))), //设置圆角
  1292 + child: Stack(
  1293 + overflow: Overflow.visible,
  1294 + children: [
  1295 + Container(
  1296 + child: Column(
  1297 + children: [
  1298 + VEmptyView(64),
  1299 + Container(
  1300 + padding: EdgeInsets.symmetric(
  1301 + horizontal:
  1302 + ScreenUtil().setWidth(44)),
  1303 + // height: ScreenUtil().setWidth(48),
  1304 + alignment: Alignment.center,
  1305 + child: Text('修改桌位',
  1306 + style: TextStyle(
  1307 + fontWeight: FontWeight.bold,
  1308 + fontSize: ScreenUtil().setSp(34),
  1309 + color: MyColours.color_333333)),
  1310 + ),
  1311 + VEmptyView(60),
  1312 + Container(
  1313 + margin: EdgeInsets.symmetric(
  1314 + horizontal:
  1315 + ScreenUtil().setWidth(44)),
  1316 + height: ScreenUtil().setWidth(48 * 2),
  1317 + // margin: EdgeInsets.symmetric(
  1318 + // horizontal:
  1319 + // ScreenUtil().setWidth(40)),
  1320 + decoration: BoxDecoration(
  1321 + color: MyColours.color_f3f3f3,
  1322 + borderRadius: BorderRadius.circular(
  1323 + ScreenUtil().setWidth(10))),
  1324 + child: Row(
  1325 + crossAxisAlignment:
  1326 + CrossAxisAlignment.center,
  1327 + children: [
  1328 + HEmptyView(20),
  1329 + Expanded(
  1330 + child: TextField(
  1331 + controller: controller,
  1332 + maxLines: 1,
  1333 + // //光标颜色
  1334 + // cursorColor:
  1335 + // widget.isSelect ? Colors.white : MyColours.color_199095,
  1336 + //输入文本的样式
  1337 + style: TextStyle(
  1338 + fontSize:
  1339 + ScreenUtil().setSp(32),
  1340 + color:
  1341 + MyColours.color_515151),
  1342 +
  1343 + decoration: InputDecoration(
  1344 + contentPadding: EdgeInsets.only(
  1345 + bottom: ScreenUtil()
  1346 + .setWidth(
  1347 + 40)), //设置文字内容与边框距离
  1348 + // enabledBorder: UnderlineInputBorder(
  1349 + // borderSide: BorderSide(
  1350 + // color: MyColours.color_efefef),
  1351 + // ),
  1352 + // focusedBorder: UnderlineInputBorder(
  1353 + // borderSide: BorderSide(
  1354 + // color: MyColours.color_efefef,
  1355 + // width: ScreenUtil().setWidth(2)),
  1356 + // ),
  1357 + // prefixText: '*',
  1358 + // prefixStyle: TextStyle(
  1359 + // fontSize: ScreenUtil().setSp(32),
  1360 + // color: MyColours.color_E95750),
  1361 + border: OutlineInputBorder(
  1362 + borderSide:
  1363 + BorderSide.none),
  1364 + hintText: '桌位名称',
  1365 + hintStyle: TextStyle(
  1366 + color: MyColours.color_BFC4D4,
  1367 + fontSize:
  1368 + ScreenUtil().setSp(32),
  1369 + ),
  1370 + ),
  1371 + onChanged: (value) {
  1372 + state(() {});
  1373 + },
  1374 + onEditingComplete: () {
  1375 + FocusScope.of(context)
  1376 + .requestFocus(
  1377 + FocusNode()); //点击空白处隐藏键盘
  1378 + },
  1379 + keyboardType: TextInputType.text,
  1380 + ),
  1381 + )
  1382 + ],
  1383 + ),
  1384 + ),
  1385 + VEmptyView(32),
  1386 + InkWell(
  1387 + onTap: () {
  1388 + state(() {
  1389 + showPnumMax = true;
  1390 + showPnumMin = true;
  1391 + showBaojian = !showBaojian;
  1392 + });
  1393 + },
  1394 + child: Container(
  1395 + padding: EdgeInsets.symmetric(
  1396 + horizontal:
  1397 + ScreenUtil().setWidth(44)),
  1398 + height: ScreenUtil().setWidth(30 * 2),
  1399 + child: Row(
  1400 + crossAxisAlignment:
  1401 + CrossAxisAlignment.center,
  1402 + children: [
  1403 + HEmptyView(32),
  1404 + Text(
  1405 + '桌位类型',
  1406 + style: TextStyle(
  1407 + fontSize:
  1408 + ScreenUtil().setSp(32),
  1409 + color:
  1410 + MyColours.color_000000),
  1411 + ),
  1412 + Spacer(),
  1413 + // Stack(
  1414 + // overflow: Overflow.visible,
  1415 + // children: [
  1416 + Text(
  1417 + baojian,
  1418 + style: TextStyle(
  1419 + color:
  1420 + MyColours.color_515151,
  1421 + fontSize:
  1422 + ScreenUtil().setSp(32)),
  1423 + ),
  1424 + HEmptyView(12),
  1425 + Image.asset(
  1426 + Utils.getImgPath(
  1427 + 'table_manage_arrow_down'),
  1428 + width: ScreenUtil()
  1429 + .setWidth(40)),
  1430 + HEmptyView(32),
  1431 + ],
  1432 + ),
  1433 + )),
  1434 + Container(
  1435 + margin: EdgeInsets.only(
  1436 + top: ScreenUtil().setWidth(60)),
  1437 + padding: EdgeInsets.only(
  1438 + left: ScreenUtil().setWidth(44),
  1439 + right: ScreenUtil().setWidth(44)),
  1440 + height: ScreenUtil().setWidth(30 * 2),
  1441 + child: Row(
  1442 + crossAxisAlignment:
  1443 + CrossAxisAlignment.center,
  1444 + children: [
  1445 + HEmptyView(32),
  1446 + Text(
  1447 + '人数',
  1448 + style: TextStyle(
  1449 + fontSize:
  1450 + ScreenUtil().setSp(32),
  1451 + color: MyColours.color_000000),
  1452 + ),
  1453 + Spacer(),
  1454 + // Stack(
  1455 + // overflow: Overflow.visible,
  1456 + // children: [
  1457 + btnChooseTableManagePnum(
  1458 + pnumMin,
  1459 + 'min',
  1460 + ScreenUtil().setWidth(54 * 2),
  1461 + (value) {
  1462 + state(() {
  1463 + showBaojian = true;
  1464 + showPnumMax = true;
  1465 + showPnumMin = !showPnumMin;
  1466 + });
  1467 + }),
  1468 + HEmptyView(40),
  1469 + Text(
  1470 + '至',
  1471 + style: TextStyle(
  1472 + fontSize:
  1473 + ScreenUtil().setSp(32),
  1474 + color: MyColours.color_000000),
  1475 + ),
  1476 + HEmptyView(40),
  1477 + btnChooseTableManagePnum(
  1478 + pnumMax,
  1479 + 'max',
  1480 + ScreenUtil().setWidth(54 * 2),
  1481 + (value) {
  1482 + state(() {
  1483 + showBaojian = true;
  1484 + showPnumMin = true;
  1485 + showPnumMax = !showPnumMax;
  1486 + });
  1487 + }),
  1488 + HEmptyView(32),
  1489 + ],
  1490 + ),
  1491 + ),
  1492 + VEmptyView(60),
  1493 + RoundButton(
  1494 + text: '删除桌位',
  1495 + width: ScreenUtil().setWidth(88 * 2),
  1496 + height: ScreenUtil().setWidth(36 * 2),
  1497 + radius: ScreenUtil().setWidth(10),
  1498 + gradientStart: MyColours.color_E34D59,
  1499 + gradientEnd: MyColours.color_E34D59,
  1500 + textColor: MyColours.color_ffffff,
  1501 + isBold: false,
  1502 + fontSize: 28,
  1503 + onPressed: () {
  1504 + DialogUtil.cupertinoAlertDialog(
  1505 + context,
  1506 + title: "",
  1507 + content: "是否确定删除1个桌位",
  1508 + lTitle: "取消",
  1509 + rTitle: "确认删除",
  1510 + isBold: true,
  1511 + isBoldContent: true,
  1512 + rColor: MyColours.color_E34D59,
  1513 + lCallback: () {
  1514 + print("取消");
  1515 + }, rCallback: () {
  1516 + print("确定");
  1517 + onTapDel({
  1518 + 'bjtype': baojianList[
  1519 + currentBaojianIndex],
  1520 + 'name': controller.text,
  1521 + 'pnumMin': pnumMin,
  1522 + 'pnumMax': pnumMax,
  1523 + });
  1524 + Navigator.pop(context);
  1525 + });
  1526 + }),
  1527 + VEmptyView(52),
  1528 + MyDivider(double.infinity,
  1529 + ScreenUtil().setWidth(2),
  1530 + color: MyColours.color_f3f3f3),
  1531 + Row(
  1532 + mainAxisAlignment:
  1533 + MainAxisAlignment.spaceBetween,
  1534 + children: [
  1535 + RoundButton(
  1536 + text: '取消',
  1537 + width: (ScreenUtil.screenWidthDp -
  1538 + ScreenUtil()
  1539 + .setWidth(110) *
  1540 + 2) /
  1541 + 2,
  1542 + height:
  1543 + ScreenUtil().setWidth(112),
  1544 + // radius: ScreenUtil().setWidth(10),
  1545 + gradientStart:
  1546 + MyColours.color_ffffff,
  1547 + gradientEnd:
  1548 + MyColours.color_ffffff,
  1549 + textColor: MyColours.color_000000,
  1550 + isBold: false,
  1551 + fontSize: 34,
  1552 + onPressed: () {
  1553 + Navigator.pop(context);
  1554 + }),
  1555 + MyDivider(ScreenUtil().setWidth(2),
  1556 + ScreenUtil().setWidth(112),
  1557 + color: MyColours.color_f3f3f3),
  1558 + RoundButton(
  1559 + text: '确定',
  1560 + width: (ScreenUtil.screenWidthDp -
  1561 + ScreenUtil()
  1562 + .setWidth(110) *
  1563 + 2) /
  1564 + 2,
  1565 + height:
  1566 + ScreenUtil().setWidth(112),
  1567 + // radius: ScreenUtil().setWidth(10),
  1568 + gradientStart:
  1569 + MyColours.color_ffffff,
  1570 + gradientEnd:
  1571 + MyColours.color_ffffff,
  1572 + textColor: controller.text == ''
  1573 + ? MyColours.color_999999
  1574 + : MyColours.color_438E93,
  1575 + fontSize: 34,
  1576 + onPressed: () {
  1577 + if (controller.text.trim() ==
  1578 + '') {
  1579 + Utils.showToast('请输入桌位名称!');
  1580 + return;
  1581 + }
  1582 + // 当前选中区域
  1583 + // areas[currentAreaIndex]
  1584 + //最低人数
  1585 + // pnumMin
  1586 + //最高人数
  1587 + // pnumMax
  1588 +
  1589 + onTap({
  1590 + 'bjtype': baojianList[
  1591 + currentBaojianIndex],
  1592 + 'name': controller.text,
  1593 + 'pnumMin': pnumMin,
  1594 + 'pnumMax': pnumMax,
  1595 + });
  1596 + Navigator.pop(context);
  1597 + }),
  1598 + ])
  1599 + ],
  1600 + ),
  1601 + ),
  1602 + Positioned(
  1603 + left: ScreenUtil().setWidth(100 * 2),
  1604 + top: ScreenUtil().setWidth(65 * 2),
  1605 + child: Offstage(
  1606 + offstage: showBaojian,
  1607 + child: tableManageSelectWidget(
  1608 + baojianList, 210, (index) {
  1609 + state(() {
  1610 + showBaojian = !showBaojian;
  1611 + currentBaojianIndex = index;
  1612 + baojian =
  1613 + baojianList[currentBaojianIndex];
  1614 + });
  1615 + }),
  1616 + )),
  1617 + ],
  1618 + )),
  1619 + ],
  1620 + ),
  1621 + Positioned(
  1622 + left: ScreenUtil().setWidth(0),
  1623 + top: ScreenUtil().setWidth(90 * 2),
  1624 + child: Offstage(
  1625 + offstage: showPnumMin,
  1626 + child: Material(
  1627 + color: Colors.transparent,
  1628 + child: selectWidget(pnum, (index) {
  1629 + state(() {
  1630 + showPnumMin = !showPnumMin;
  1631 + pnumMin = pnum[index];
  1632 + });
  1633 + }),
  1634 + ))),
  1635 + Positioned(
  1636 + left: ScreenUtil().setWidth(106 * 2),
  1637 + top: ScreenUtil().setWidth(90 * 2),
  1638 + child: Material(
  1639 + color: Colors.transparent,
  1640 + child: Offstage(
  1641 + offstage: showPnumMax,
  1642 + child: selectWidget(pnum, (index) {
  1643 + state(() {
  1644 + showPnumMax = !showPnumMax;
  1645 + pnumMax = pnum[index];
  1646 + });
  1647 + }),
  1648 + ))),
  1649 + ]));
  1650 + }));
  1651 + });
  1652 + }
  1653 +
  1654 + ///批量改名
  1655 +
  1656 + static Future openMyTableManageModifyTableNameDialog(
  1657 + BuildContext context, {
  1658 + CustomCallBackMap onTap,
  1659 + }) async {
  1660 + TextEditingController controller = TextEditingController();
  1661 +
  1662 + final action = await showDialog(
  1663 + context: context,
  1664 + barrierDismissible: false,
  1665 + builder: (BuildContext context) {
  1666 + return Center(child: StatefulBuilder(builder: (context, state) {
  1667 + // globalState = state;
  1668 +
  1669 + return Container(
  1670 + margin: EdgeInsets.only(top: ScreenUtil().setWidth(300)),
  1671 + padding:
  1672 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(50)),
  1673 + // height: ScreenUtil().setWidth(326 * 2) +
  1674 + // ScreenUtil().setWidth(250 * 2),
  1675 + decoration: BoxDecoration(
  1676 + borderRadius:
  1677 + BorderRadius.circular(ScreenUtil().setWidth(10))),
  1678 + child: Stack(children: [
  1679 + Column(
  1680 + children: [
  1681 + Card(
  1682 + shape: RoundedRectangleBorder(
  1683 + borderRadius: BorderRadius.all(Radius.circular(
  1684 + ScreenUtil().setWidth(10)))), //设置圆角
  1685 + child: Stack(
  1686 + overflow: Overflow.visible,
  1687 + children: [
  1688 + Container(
  1689 + child: Column(
  1690 + children: [
  1691 + VEmptyView(64),
  1692 + Container(
  1693 + padding: EdgeInsets.symmetric(
  1694 + horizontal:
  1695 + ScreenUtil().setWidth(44)),
  1696 + // height: ScreenUtil().setWidth(48),
  1697 + alignment: Alignment.center,
  1698 + child: Text('批量改名',
  1699 + style: TextStyle(
  1700 + fontWeight: FontWeight.bold,
  1701 + fontSize: ScreenUtil().setSp(34),
  1702 + color: MyColours.color_333333)),
  1703 + ),
  1704 + VEmptyView(60),
  1705 + Container(
  1706 + margin: EdgeInsets.symmetric(
  1707 + horizontal:
  1708 + ScreenUtil().setWidth(44)),
  1709 + height: ScreenUtil().setWidth(48 * 2),
  1710 + // margin: EdgeInsets.symmetric(
  1711 + // horizontal:
  1712 + // ScreenUtil().setWidth(40)),
  1713 + decoration: BoxDecoration(
  1714 + color: MyColours.color_f3f3f3,
  1715 + borderRadius: BorderRadius.circular(
  1716 + ScreenUtil().setWidth(10))),
  1717 + child: Row(
  1718 + crossAxisAlignment:
  1719 + CrossAxisAlignment.center,
  1720 + children: [
  1721 + HEmptyView(20),
  1722 + Expanded(
  1723 + child: TextField(
  1724 + controller: controller,
  1725 + maxLines: 1,
  1726 + // //光标颜色
  1727 + // cursorColor:
  1728 + // widget.isSelect ? Colors.white : MyColours.color_199095,
  1729 + //输入文本的样式
  1730 + style: TextStyle(
  1731 + fontSize:
  1732 + ScreenUtil().setSp(32),
  1733 + color:
  1734 + MyColours.color_515151),
  1735 +
  1736 + decoration: InputDecoration(
  1737 + contentPadding: EdgeInsets.only(
  1738 + bottom: ScreenUtil()
  1739 + .setWidth(
  1740 + 40)), //设置文字内容与边框距离
  1741 + // enabledBorder: UnderlineInputBorder(
  1742 + // borderSide: BorderSide(
  1743 + // color: MyColours.color_efefef),
  1744 + // ),
  1745 + // focusedBorder: UnderlineInputBorder(
  1746 + // borderSide: BorderSide(
  1747 + // color: MyColours.color_efefef,
  1748 + // width: ScreenUtil().setWidth(2)),
  1749 + // ),
  1750 + // prefixText: '*',
  1751 + // prefixStyle: TextStyle(
  1752 + // fontSize: ScreenUtil().setSp(32),
  1753 + // color: MyColours.color_E95750),
  1754 + border: OutlineInputBorder(
  1755 + borderSide:
  1756 + BorderSide.none),
  1757 + hintText: '桌位名称',
  1758 + hintStyle: TextStyle(
  1759 + color: MyColours.color_BFC4D4,
  1760 + fontSize:
  1761 + ScreenUtil().setSp(32),
  1762 + ),
  1763 + ),
  1764 + onChanged: (value) {
  1765 + state(() {});
  1766 + },
  1767 + onEditingComplete: () {
  1768 + FocusScope.of(context)
  1769 + .requestFocus(
  1770 + FocusNode()); //点击空白处隐藏键盘
  1771 + },
  1772 + keyboardType: TextInputType.text,
  1773 + ),
  1774 + )
  1775 + ],
  1776 + ),
  1777 + ),
  1778 + VEmptyView(26),
  1779 + Row(
  1780 + children: [
  1781 + Row(
  1782 + crossAxisAlignment:
  1783 + CrossAxisAlignment.center,
  1784 + children: [
  1785 + Image.asset(
  1786 + (true
  1787 + ? 'mine_radio_sel'
  1788 + : 'mine_radio_nor'),
  1789 + width:
  1790 + ScreenUtil().setWidth(34)),
  1791 + Text(
  1792 + '跳过4',
  1793 + style: TextStyle(
  1794 + color: MyColours.color_515151,
  1795 + fontSize:
  1796 + ScreenUtil().setSp(32)),
  1797 + )
  1798 + ],
  1799 + ),
  1800 + Row(
  1801 + crossAxisAlignment:
  1802 + CrossAxisAlignment.center,
  1803 + children: [
  1804 + Image.asset(
  1805 + (true
  1806 + ? 'mine_radio_sel'
  1807 + : 'mine_radio_nor'),
  1808 + width:
  1809 + ScreenUtil().setWidth(34)),
  1810 + Text(
  1811 + '跳过7',
  1812 + style: TextStyle(
  1813 + color: MyColours.color_515151,
  1814 + fontSize:
  1815 + ScreenUtil().setSp(32)),
  1816 + )
  1817 + ],
  1818 + ),
  1819 + ],
  1820 + ),
  1821 + MyDivider(double.infinity,
  1822 + ScreenUtil().setWidth(2),
  1823 + color: MyColours.color_f3f3f3),
  1824 + Row(
  1825 + mainAxisAlignment:
  1826 + MainAxisAlignment.spaceBetween,
  1827 + children: [
  1828 + RoundButton(
  1829 + text: '取消',
  1830 + width: (ScreenUtil.screenWidthDp -
  1831 + ScreenUtil()
  1832 + .setWidth(110) *
  1833 + 2) /
  1834 + 2,
  1835 + height:
  1836 + ScreenUtil().setWidth(112),
  1837 + // radius: ScreenUtil().setWidth(10),
  1838 + gradientStart:
  1839 + MyColours.color_ffffff,
  1840 + gradientEnd:
  1841 + MyColours.color_ffffff,
  1842 + textColor: MyColours.color_000000,
  1843 + isBold: false,
  1844 + fontSize: 34,
  1845 + onPressed: () {
  1846 + Navigator.pop(context);
  1847 + }),
  1848 + MyDivider(ScreenUtil().setWidth(2),
  1849 + ScreenUtil().setWidth(112),
  1850 + color: MyColours.color_f3f3f3),
  1851 + RoundButton(
  1852 + text: '确定',
  1853 + width: (ScreenUtil.screenWidthDp -
  1854 + ScreenUtil()
  1855 + .setWidth(110) *
  1856 + 2) /
  1857 + 2,
  1858 + height:
  1859 + ScreenUtil().setWidth(112),
  1860 + // radius: ScreenUtil().setWidth(10),
  1861 + gradientStart:
  1862 + MyColours.color_ffffff,
  1863 + gradientEnd:
  1864 + MyColours.color_ffffff,
  1865 + textColor: controller.text == ''
  1866 + ? MyColours.color_999999
  1867 + : MyColours.color_438E93,
  1868 + fontSize: 34,
  1869 + onPressed: () {
  1870 + if (controller.text.trim() ==
  1871 + '') {
  1872 + Utils.showToast('请输入桌位名称!');
  1873 + return;
  1874 + }
  1875 + // 当前选中区域
  1876 + // areas[currentAreaIndex]
  1877 + //最低人数
  1878 + // pnumMin
  1879 + //最高人数
  1880 + // pnumMax
  1881 +
  1882 + onTap({
  1883 + 'name': controller.text,
  1884 + });
  1885 + Navigator.pop(context);
  1886 + }),
  1887 + ])
  1888 + ],
  1889 + ),
  1890 + ),
  1891 + ],
  1892 + )),
  1893 + ],
  1894 + ),
  1895 + ]));
  1896 + }));
  1897 + });
  1898 + }
  1899 +
1207 ///输入框 1900 ///输入框
1208 static Widget textfield( 1901 static Widget textfield(
1209 BuildContext context, 1902 BuildContext context,
@@ -1212,6 +1905,7 @@ class DialogUtil { @@ -1212,6 +1905,7 @@ class DialogUtil {
1212 TextEditingController editingController, 1905 TextEditingController editingController,
1213 FocusNode focusNode, 1906 FocusNode focusNode,
1214 String subTitle, 1907 String subTitle,
  1908 + state,
1215 {bool needStar = false, 1909 {bool needStar = false,
1216 TextInputType inputType = TextInputType.number}) { 1910 TextInputType inputType = TextInputType.number}) {
1217 return Container( 1911 return Container(
@@ -1277,7 +1971,9 @@ class DialogUtil { @@ -1277,7 +1971,9 @@ class DialogUtil {
1277 ), 1971 ),
1278 contentPadding: EdgeInsets.zero, 1972 contentPadding: EdgeInsets.zero,
1279 ), 1973 ),
1280 - onChanged: (value) {}, 1974 + onChanged: (value) {
  1975 + state(() {});
  1976 + },
1281 onEditingComplete: () { 1977 onEditingComplete: () {
1282 FocusScope.of(context) 1978 FocusScope.of(context)
1283 .requestFocus(FocusNode()); //点击空白处隐藏键盘 1979 .requestFocus(FocusNode()); //点击空白处隐藏键盘
@@ -3242,6 +3938,9 @@ class DialogUtil { @@ -3242,6 +3938,9 @@ class DialogUtil {
3242 String content = "内容", 3938 String content = "内容",
3243 String lTitle = "取消", 3939 String lTitle = "取消",
3244 String rTitle = "确定", 3940 String rTitle = "确定",
  3941 + Color rColor = MyColours.color_199095,
  3942 + bool isBold = false,
  3943 + bool isBoldContent = false,
3245 VoidCallback lCallback, 3944 VoidCallback lCallback,
3246 VoidCallback rCallback}) { 3945 VoidCallback rCallback}) {
3247 showCupertinoDialog( 3946 showCupertinoDialog(
@@ -3257,6 +3956,8 @@ class DialogUtil { @@ -3257,6 +3956,8 @@ class DialogUtil {
3257 : SizedBox(), 3956 : SizedBox(),
3258 content: Text(content, 3957 content: Text(content,
3259 style: TextStyle( 3958 style: TextStyle(
  3959 + fontWeight:
  3960 + isBoldContent ? FontWeight.bold : FontWeight.normal,
3260 fontSize: ScreenUtil().setSp(30), 3961 fontSize: ScreenUtil().setSp(30),
3261 color: MyColours.color_353535)), 3962 color: MyColours.color_353535)),
3262 actions: [ 3963 actions: [
@@ -3273,8 +3974,9 @@ class DialogUtil { @@ -3273,8 +3974,9 @@ class DialogUtil {
3273 CupertinoDialogAction( 3974 CupertinoDialogAction(
3274 child: Text(rTitle, 3975 child: Text(rTitle,
3275 style: TextStyle( 3976 style: TextStyle(
  3977 + fontWeight: isBold ? FontWeight.bold : FontWeight.normal,
3276 fontSize: ScreenUtil().setSp(34), 3978 fontSize: ScreenUtil().setSp(34),
3277 - color: MyColours.color_199095)), 3979 + color: rColor)),
3278 onPressed: () { 3980 onPressed: () {
3279 Navigator.of(context).pop(); 3981 Navigator.of(context).pop();
3280 rCallback(); 3982 rCallback();