Commit 43305ba9be44cb8eaf71249771a07ae692f83f43

Authored by wdn127929
1 parent 47f54a42

添加桌位OK

1 ///桌位区域 1 ///桌位区域
2 -class Area{  
3 - 2 +class Area {
4 String name; 3 String name;
5 int count; 4 int count;
  5 + String rid;
6 6
7 Area(); 7 Area();
8 8
9 - factory Area.fromJson(Map<String,dynamic> json)=>Area()..name=json["name"]..count=json["count"]; 9 + factory Area.fromJson(Map<String, dynamic> json) => Area()
  10 + ..name = json["name"]
  11 + ..count = json["count"];
10 12
11 - Map<String,dynamic> toJson()=><String,dynamic>{"name":name,"count":count};  
12 -}  
  13 + Map<String, dynamic> toJson() =>
  14 + <String, dynamic>{"name": name, "count": count};
  15 +}
1 import 'package:one_key/models/table.dart'; 1 import 'package:one_key/models/table.dart';
2 2
3 -class TableOuter{ 3 +class TableOuter {
4 String name; 4 String name;
5 List<Table> list; 5 List<Table> list;
  6 + String rid;
6 7
7 TableOuter(); 8 TableOuter();
8 9
9 - factory TableOuter.fromJson(Map<String,dynamic> json)=>TableOuter()..name=json["name"]..list=json["list"] ; 10 + factory TableOuter.fromJson(Map<String, dynamic> json) => TableOuter()
  11 + ..name = json["name"]
  12 + ..list = json["list"];
10 13
11 - Map<String,dynamic> toJson()=>{"name":name,"list":list}; 14 + Map<String, dynamic> toJson() => {"name": name, "list": list};
12 15
13 @override 16 @override
14 String toString() { 17 String toString() {
15 return 'TableOuter{name: $name, list: $list}'; 18 return 'TableOuter{name: $name, list: $list}';
16 } 19 }
17 -  
18 -  
19 -}  
  20 +}
@@ -180,7 +180,7 @@ class DioUtil { @@ -180,7 +180,7 @@ class DioUtil {
180 bool connectivity = await Utils.checkConnectiviy(); 180 bool connectivity = await Utils.checkConnectiviy();
181 if (!connectivity) { 181 if (!connectivity) {
182 Utils.showToast("网络错误,请稍后重试"); 182 Utils.showToast("网络错误,请稍后重试");
183 - throw MyError(type: 1); 183 + throw MyError(type: 1);
184 } 184 }
185 if (showLoading) Loading.showLoading(context); 185 if (showLoading) Loading.showLoading(context);
186 try { 186 try {
@@ -105,5 +105,6 @@ class HttpUrl { @@ -105,5 +105,6 @@ class HttpUrl {
105 "?service=App.Tables.AddTableRegion"; // 添加商家桌位区域 105 "?service=App.Tables.AddTableRegion"; // 添加商家桌位区域
106 static const String get_area_by_sellerid = 106 static const String get_area_by_sellerid =
107 "?service=App.Tables.GetRegionBySellerid"; // 获取区域列表 107 "?service=App.Tables.GetRegionBySellerid"; // 获取区域列表
  108 + static const String add_table = "?service=App.Tables.AddTable"; // 添加商家桌位信息
108 109
109 } 110 }
@@ -46,6 +46,7 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -46,6 +46,7 @@ class TableManagerPageState extends State<TableManagerPage> {
46 int max; 46 int max;
47 int _selectIndex; 47 int _selectIndex;
48 ScrollController _areaController = ScrollController(); 48 ScrollController _areaController = ScrollController();
  49 + List<String> personNumList = [];
49 50
50 final ItemPositionsListener itemPositionsListener = 51 final ItemPositionsListener itemPositionsListener =
51 ItemPositionsListener.create(); 52 ItemPositionsListener.create();
@@ -55,6 +56,10 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -55,6 +56,10 @@ class TableManagerPageState extends State<TableManagerPage> {
55 // TODO: implement initState 56 // TODO: implement initState
56 super.initState(); 57 super.initState();
57 LogUtil.v("table_manager_page initState"); 58 LogUtil.v("table_manager_page initState");
  59 + for (int i = 1; i < 31; i++) {
  60 + personNumList.add(i.toString());
  61 + }
  62 + // personNumList.add('30以上');
58 tableManagerModel = Provider.of<TableManagerModel>(context, listen: false); 63 tableManagerModel = Provider.of<TableManagerModel>(context, listen: false);
59 WidgetsBinding.instance.addPostFrameCallback((_) { 64 WidgetsBinding.instance.addPostFrameCallback((_) {
60 tableManagerModel.initTime(context); 65 tableManagerModel.initTime(context);
@@ -134,30 +139,52 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -134,30 +139,52 @@ class TableManagerPageState extends State<TableManagerPage> {
134 139
135 //添加桌位弹框 140 //添加桌位弹框
136 await DialogUtil.openCreateTableDialog( 141 await DialogUtil.openCreateTableDialog(
137 - context, areas, i, ['1', '2', '3'],  
138 - onTap: (value) async { 142 + context, areas, i, personNumList,
  143 + onTap: (Map<String, String> value) async {
139 print(value); 144 print(value);
  145 + // 'areaname':
  146 + // areas[currentAreaIndex],
  147 + // 'name': controller.text,
  148 + // 'pnumMin': pnumMin,
  149 + // 'pnumMax': pnumMax
140 //添加桌位 接口参数带整合??? 150 //添加桌位 接口参数带整合???
141 // 以下是旧的不去,明天添加桌位接口 151 // 以下是旧的不去,明天添加桌位接口
  152 + String rid;
  153 + for (Area item in tableManagerModel.areas) {
  154 + if (item.name == value['areaname']) {
  155 + rid = item.rid;
  156 + }
  157 + }
  158 + Map<String, String> params = {
  159 + 'rid': rid,
  160 + 'name': value['name'],
  161 + };
  162 + if (value['pnumMin'] != '') {
  163 + params['pnum'] = value['pnumMin'];
  164 + }
  165 + if (value['pnumMax'] != '') {
  166 + params['most_pnum'] = value['pnumMax'];
  167 + }
142 bool success = 168 bool success =
143 - await tableManagerModel.addTableAreas(context, value); 169 + await tableManagerModel.addTable(context, params);
144 print(success); 170 print(success);
145 if (success) { 171 if (success) {
146 Utils.showToast('添加成功!'); 172 Utils.showToast('添加成功!');
147 - TableOuter tableOuter = TableOuter();  
148 - tableOuter.name = value;  
149 - tableOuter.list = [];  
150 - tableManagerModel.tableOuterList.add(tableOuter);  
151 - tableManagerModel.initData();  
152 - Timer(  
153 - Duration(milliseconds: 500),  
154 - () => _areaController.jumpTo(  
155 - _areaController.position.maxScrollExtent)); 173 + // TableOuter tableOuter = TableOuter();
  174 + // tableOuter.name = value;
  175 + // tableOuter.list = [];
  176 + // tableManagerModel.tableOuterList.add(tableOuter);
  177 + // tableManagerModel.initData();
  178 + // Timer(
  179 + // Duration(milliseconds: 500),
  180 + // () => _areaController.jumpTo(
  181 + // _areaController.position.maxScrollExtent));
156 182
157 // await tableManagerModel 183 // await tableManagerModel
158 // .getTableList(context); 184 // .getTableList(context);
159 // await tableManagerModel 185 // await tableManagerModel
160 // .initData(); 186 // .initData();
  187 + tableManagerModel.refreshTable(context);
161 } 188 }
162 }); 189 });
163 }, 190 },
@@ -498,12 +525,15 @@ class TableManagerPageState extends State<TableManagerPage> { @@ -498,12 +525,15 @@ class TableManagerPageState extends State<TableManagerPage> {
498 print(success); 525 print(success);
499 if (success) { 526 if (success) {
500 Utils.showToast('添加成功!'); 527 Utils.showToast('添加成功!');
501 - TableOuter tableOuter =  
502 - TableOuter();  
503 - tableOuter.name = value;  
504 - tableOuter.list = [];  
505 - tableManagerModel.tableOuterList  
506 - .add(tableOuter); 528 + // TableOuter tableOuter =
  529 + // TableOuter();
  530 + // tableOuter.name = value;
  531 + // tableOuter.list = [];
  532 + // tableManagerModel.tableOuterList
  533 + // .add(tableOuter);
  534 + await tableManagerModel
  535 + .getTableList(context,
  536 + needLoading: false);
507 tableManagerModel.initData(); 537 tableManagerModel.initData();
508 Timer( 538 Timer(
509 Duration(milliseconds: 500), 539 Duration(milliseconds: 500),
@@ -231,9 +231,13 @@ class TableManagerModel with ChangeNotifier { @@ -231,9 +231,13 @@ class TableManagerModel with ChangeNotifier {
231 } 231 }
232 232
233 //获取桌位数据 233 //获取桌位数据
234 - Future<List<TableOuter>> getTableList(BuildContext context) async {  
235 - pageState = PageState.Loading;  
236 - notifyListeners(); 234 + Future<List<TableOuter>> getTableList(BuildContext context,
  235 + {bool needLoading = true}) async {
  236 + if (needLoading) {
  237 + pageState = PageState.Loading;
  238 + notifyListeners();
  239 + }
  240 +
237 Map<String, String> params = {"sellerid": userModel.user.sellerid}; 241 Map<String, String> params = {"sellerid": userModel.user.sellerid};
238 BaseResp<List> baseResp = await DioUtil() 242 BaseResp<List> baseResp = await DioUtil()
239 .request<List>(context, Method.get, HttpUrl.table_list, 243 .request<List>(context, Method.get, HttpUrl.table_list,
@@ -276,23 +280,31 @@ class TableManagerModel with ChangeNotifier { @@ -276,23 +280,31 @@ class TableManagerModel with ChangeNotifier {
276 }).toList(); 280 }).toList();
277 } 281 }
278 List<AreaSunModel> areaSunModelList = await getRegionBySellerid(context); 282 List<AreaSunModel> areaSunModelList = await getRegionBySellerid(context);
279 - List<String> tempTableName = [];  
280 - List<String> tempAreaName = [];  
281 - for (TableOuter itemTable in tableOuterList) {  
282 - tempTableName.add(itemTable.name);  
283 - }  
284 - for (AreaSunModel itemArea in areaSunModelList) {  
285 - tempAreaName.add(itemArea.name);  
286 - }  
287 - if (tempAreaName.length > tempTableName.length) {  
288 - for (var itemT in tempTableName) {  
289 - tempAreaName.removeWhere((element) => element == itemT); 283 + if (areaSunModelList != null && areaSunModelList.length > 0) {
  284 + List<String> tempTableName = []; //有桌子区域
  285 + List<String> tempAreaName = []; //全部区域
  286 + for (TableOuter itemTable in tableOuterList) {
  287 + tempTableName.add(itemTable.name);
290 } 288 }
291 - for (var item in tempAreaName) {  
292 - TableOuter tableOuter = TableOuter();  
293 - tableOuter.name = item;  
294 - tableOuter.list = [];  
295 - tableOuterList.add(tableOuter); 289 + for (AreaSunModel itemArea in areaSunModelList) {
  290 + tempAreaName.add(itemArea.name);
  291 + }
  292 + if (tempAreaName.length > tempTableName.length) {
  293 + for (var itemT in tempTableName) {
  294 + tempAreaName.removeWhere(
  295 + (element) => element == itemT); //全部区域移除有桌子的区域,剩下没有桌子的区域
  296 + }
  297 + for (var item in tempAreaName) {
  298 + for (AreaSunModel itemarea in areaSunModelList) {
  299 + if (item == itemarea.name) {
  300 + TableOuter tableOuter = TableOuter();
  301 + tableOuter.name = item;
  302 + tableOuter.list = [];
  303 + tableOuter.rid = itemarea.id;
  304 + tableOuterList.add(tableOuter); //区域信息包含有桌子和没有桌子两部分类型
  305 + }
  306 + }
  307 + }
296 } 308 }
297 } 309 }
298 310
@@ -300,7 +312,7 @@ class TableManagerModel with ChangeNotifier { @@ -300,7 +312,7 @@ class TableManagerModel with ChangeNotifier {
300 } 312 }
301 313
302 //获取已预订列表 314 //获取已预订列表
303 - getReserveList(BuildContext context) async { 315 + getReserveList(BuildContext context, {bool needLoading = true}) async {
304 tableMap.clear(); 316 tableMap.clear();
305 NoteBookModel model = new NoteBookModel(); 317 NoteBookModel model = new NoteBookModel();
306 Map<String, String> params = { 318 Map<String, String> params = {
@@ -312,8 +324,11 @@ class TableManagerModel with ChangeNotifier { @@ -312,8 +324,11 @@ class TableManagerModel with ChangeNotifier {
312 "keywords": "", 324 "keywords": "",
313 "sort": "1" 325 "sort": "1"
314 }; 326 };
315 - pageState = PageState.Loading;  
316 - notifyListeners(); 327 + if (needLoading) {
  328 + pageState = PageState.Loading;
  329 + notifyListeners();
  330 + }
  331 +
317 List<Notebook> noteBooks = await newGetReserveList(context, params); 332 List<Notebook> noteBooks = await newGetReserveList(context, params);
318 for (Notebook notebook in noteBooks) { 333 for (Notebook notebook in noteBooks) {
319 if (notebook.tid.isEmpty) continue; 334 if (notebook.tid.isEmpty) continue;
@@ -422,6 +437,7 @@ class TableManagerModel with ChangeNotifier { @@ -422,6 +437,7 @@ class TableManagerModel with ChangeNotifier {
422 Area area = Area(); 437 Area area = Area();
423 area.name = outer.name; 438 area.name = outer.name;
424 area.count = outer.list.length == 0 ? -1 : count; 439 area.count = outer.list.length == 0 ? -1 : count;
  440 + area.rid = outer.list.length == 0 ? outer.rid : outer.list[0].rid;
425 areas.add(area); 441 areas.add(area);
426 } 442 }
427 if (areaTableMap.isNotEmpty) { 443 if (areaTableMap.isNotEmpty) {
@@ -525,10 +541,60 @@ class TableManagerModel with ChangeNotifier { @@ -525,10 +541,60 @@ class TableManagerModel with ChangeNotifier {
525 }); 541 });
526 List<AreaSunModel> areaSunModelList; 542 List<AreaSunModel> areaSunModelList;
527 if (baseResp.code == Constant.status_success) { 543 if (baseResp.code == Constant.status_success) {
528 - if (baseResp.data.length > 0) { 544 + if (baseResp.data.length == 1 && baseResp.data[0] is String) {
  545 + return areaSunModelList;
  546 + } else if (baseResp.data.length > 0) {
529 areaSunModelList = AreaModel.fromJson(baseResp.responseData).data; 547 areaSunModelList = AreaModel.fromJson(baseResp.responseData).data;
530 } 548 }
531 } 549 }
532 return areaSunModelList; 550 return areaSunModelList;
533 } 551 }
  552 +
  553 + //添加商家桌位
  554 + Future<bool> addTable(
  555 + BuildContext context, Map<String, String> params) async {
  556 + params["sellerid"] = userModel.user.sellerid;
  557 + BaseResp<dynamic> baseResp = await DioUtil()
  558 + .request<dynamic>(context, Method.get, HttpUrl.add_table,
  559 + data: params, showLoading: true)
  560 + .catchError((error) {
  561 + print(error.toString());
  562 + // if (error is MyError) {
  563 + // switch (error.type) {
  564 + // case 1:
  565 + // pageState = PageState.ConnectivityError;
  566 + // break;
  567 + // case 2:
  568 + // pageState = PageState.ConnectivityTimeOut;
  569 + // break;
  570 + // default:
  571 + // pageState = PageState.ConnectivityError;
  572 + // break;
  573 + // }
  574 + // }
  575 + // notifyListeners();
  576 + return false;
  577 + });
  578 +
  579 + if (baseResp.code == Constant.status_success) {
  580 + if (baseResp.responseData['data'] != null &&
  581 + baseResp.responseData['data'].length > 0) {
  582 + return true;
  583 + } else {
  584 + Utils.showToast(baseResp.msg ?? '新增桌位失败!');
  585 + }
  586 + }
  587 + return false;
  588 + }
  589 +
  590 + refreshTable(context) async {
  591 + List temp = await getTableList(context, needLoading: false);
  592 + if (temp.length > 0) {
  593 + getReserveList(context, needLoading: false);
  594 + } else {
  595 + // pageState = PageState.Empty;
  596 + pageState = PageState.Success;
  597 + notifyListeners();
  598 + }
  599 + }
534 } 600 }
@@ -27,6 +27,7 @@ import 'package:one_key/models/table.dart' as t; @@ -27,6 +27,7 @@ import 'package:one_key/models/table.dart' as t;
27 import 'package:url_launcher/url_launcher.dart'; 27 import 'package:url_launcher/url_launcher.dart';
28 28
29 typedef CustomCallBack = void Function(Object object); 29 typedef CustomCallBack = void Function(Object object);
  30 +typedef CustomCallBackMap = void Function(Map<String, String> object);
30 31
31 class DialogUtil { 32 class DialogUtil {
32 static Future openCreateAreaDialog(BuildContext context, 33 static Future openCreateAreaDialog(BuildContext context,
@@ -245,7 +246,7 @@ class DialogUtil { @@ -245,7 +246,7 @@ class DialogUtil {
245 246
246 static Future openCreateTableDialog(BuildContext context, List<String> areas, 247 static Future openCreateTableDialog(BuildContext context, List<String> areas,
247 int currentAreaIndex, List<String> pnum, 248 int currentAreaIndex, List<String> pnum,
248 - {CustomCallBack onTap}) async { 249 + {CustomCallBackMap onTap}) async {
249 TextEditingController controller = TextEditingController(); 250 TextEditingController controller = TextEditingController();
250 FocusNode focusNode = FocusNode(); 251 FocusNode focusNode = FocusNode();
251 bool showArea = true; 252 bool showArea = true;
@@ -253,7 +254,7 @@ class DialogUtil { @@ -253,7 +254,7 @@ class DialogUtil {
253 bool showPnumMax = true; 254 bool showPnumMax = true;
254 String pnumMin = ''; 255 String pnumMin = '';
255 String pnumMax = ''; 256 String pnumMax = '';
256 - StateSetter globalState; 257 + // StateSetter globalState;
257 // //输入框焦点 258 // //输入框焦点
258 // focusNode.addListener(() { 259 // focusNode.addListener(() {
259 // if (!focusNode.hasFocus) { 260 // if (!focusNode.hasFocus) {
@@ -274,310 +275,314 @@ class DialogUtil { @@ -274,310 +275,314 @@ class DialogUtil {
274 barrierDismissible: false, 275 barrierDismissible: false,
275 builder: (BuildContext context) { 276 builder: (BuildContext context) {
276 return StatefulBuilder(builder: (context, state) { 277 return StatefulBuilder(builder: (context, state) {
277 - globalState = state; 278 + // globalState = state;
278 return Center( 279 return Center(
279 - child: Container(  
280 - padding:  
281 - EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(50)),  
282 - height: ScreenUtil().setWidth(326 * 2),  
283 - decoration: BoxDecoration(  
284 - borderRadius:  
285 - BorderRadius.circular(ScreenUtil().setWidth(10))),  
286 - child: Card(  
287 - shape: RoundedRectangleBorder(  
288 - borderRadius: BorderRadius.all(  
289 - Radius.circular(ScreenUtil().setWidth(10)))), //设置圆角  
290 - child: Stack(  
291 - overflow: Overflow.visible,  
292 - children: [  
293 - Container(  
294 - padding: EdgeInsets.all(ScreenUtil().setWidth(40)),  
295 - child: Column(  
296 - children: [  
297 - Container(  
298 - // height: ScreenUtil().setWidth(48),  
299 - alignment: Alignment.center,  
300 - child: Text('新建桌位',  
301 - style: TextStyle(  
302 - fontWeight: FontWeight.bold,  
303 - fontSize: ScreenUtil().setSp(34),  
304 - color: MyColours.color_333333)),  
305 - ),  
306 - VEmptyView(60),  
307 - Container(  
308 - height: ScreenUtil().setWidth(30 * 2),  
309 - child: Row(  
310 - crossAxisAlignment: CrossAxisAlignment.center,  
311 - children: [  
312 - Text(  
313 - '*',  
314 - style: TextStyle(  
315 - fontSize: ScreenUtil().setSp(32),  
316 - color: MyColours.color_E95750),  
317 - ),  
318 - Text(  
319 - '选择区域',  
320 - style: TextStyle(  
321 - fontSize: ScreenUtil().setSp(32),  
322 - color: MyColours.color_333333),  
323 - ),  
324 - HEmptyView(40),  
325 - // Stack(  
326 - // overflow: Overflow.visible,  
327 - // children: [  
328 - btnChoose(areas[currentAreaIndex],  
329 - ScreenUtil().setWidth(120 * 2), (value) {  
330 - state(() {  
331 - showPnumMin = true;  
332 - showPnumMax = true;  
333 - showArea = !showArea;  
334 - });  
335 - }),  
336 - ],  
337 - ),  
338 - ),  
339 - VEmptyView(60),  
340 - Container(  
341 - height: ScreenUtil().setWidth(28 * 2),  
342 - child: Row(  
343 - crossAxisAlignment: CrossAxisAlignment.start, 280 + child: Container(
  281 + padding: EdgeInsets.symmetric(
  282 + horizontal: ScreenUtil().setWidth(50)),
  283 + height: ScreenUtil().setWidth(326 * 2) +
  284 + ScreenUtil().setWidth(45 * 2),
  285 + decoration: BoxDecoration(
  286 + borderRadius:
  287 + BorderRadius.circular(ScreenUtil().setWidth(10))),
  288 + child: Stack(children: [
  289 + Column(
  290 + children: [
  291 + Card(
  292 + shape: RoundedRectangleBorder(
  293 + borderRadius: BorderRadius.all(
  294 + Radius.circular(
  295 + ScreenUtil().setWidth(10)))), //设置圆角
  296 + child: Stack(
  297 + overflow: Overflow.visible,
344 children: [ 298 children: [
345 - Text(  
346 - '*',  
347 - style: TextStyle(  
348 - fontSize: ScreenUtil().setSp(32),  
349 - color: MyColours.color_E95750),  
350 - ),  
351 - Text(  
352 - '桌位名称',  
353 - style: TextStyle(  
354 - fontSize: ScreenUtil().setSp(32),  
355 - color: MyColours.color_333333),  
356 - ),  
357 - HEmptyView(40),  
358 - Expanded(  
359 - child: TextField(  
360 - controller: controller,  
361 - maxLines: 1,  
362 - focusNode: focusNode,  
363 - // //光标颜色  
364 - // cursorColor:  
365 - // widget.isSelect ? Colors.white : MyColours.color_199095,  
366 - //输入文本的样式  
367 - style: TextStyle(  
368 - fontSize: ScreenUtil().setSp(30),  
369 - color: MyColours.color_333333),  
370 -  
371 - decoration: InputDecoration(  
372 - contentPadding: EdgeInsets.only(  
373 - bottom: ScreenUtil()  
374 - .setWidth(40)), //设置文字内容与边框距离  
375 - enabledBorder: UnderlineInputBorder(  
376 - borderSide: BorderSide(  
377 - color: MyColours.color_efefef), 299 + Container(
  300 + padding: EdgeInsets.all(
  301 + ScreenUtil().setWidth(40)),
  302 + child: Column(
  303 + children: [
  304 + Container(
  305 + // height: ScreenUtil().setWidth(48),
  306 + alignment: Alignment.center,
  307 + child: Text('新建桌位',
  308 + style: TextStyle(
  309 + fontWeight: FontWeight.bold,
  310 + fontSize:
  311 + ScreenUtil().setSp(34),
  312 + color:
  313 + MyColours.color_333333)),
378 ), 314 ),
379 - focusedBorder: UnderlineInputBorder(  
380 - borderSide: BorderSide(  
381 - color: MyColours.color_efefef,  
382 - width: ScreenUtil().setWidth(2)), 315 + VEmptyView(60),
  316 + Container(
  317 + height: ScreenUtil().setWidth(30 * 2),
  318 + child: Row(
  319 + crossAxisAlignment:
  320 + CrossAxisAlignment.center,
  321 + children: [
  322 + Text(
  323 + '*',
  324 + style: TextStyle(
  325 + fontSize:
  326 + ScreenUtil().setSp(32),
  327 + color:
  328 + MyColours.color_E95750),
  329 + ),
  330 + Text(
  331 + '选择区域',
  332 + style: TextStyle(
  333 + fontSize:
  334 + ScreenUtil().setSp(32),
  335 + color:
  336 + MyColours.color_333333),
  337 + ),
  338 + HEmptyView(40),
  339 + // Stack(
  340 + // overflow: Overflow.visible,
  341 + // children: [
  342 + btnChoose(
  343 + areas[currentAreaIndex],
  344 + ScreenUtil()
  345 + .setWidth(120 * 2),
  346 + (value) {
  347 + state(() {
  348 + showPnumMin = true;
  349 + showPnumMax = true;
  350 + showArea = !showArea;
  351 + });
  352 + }),
  353 + ],
  354 + ),
383 ), 355 ),
384 - hintText: '请输入桌位名称',  
385 - hintStyle: TextStyle(  
386 - color: MyColours.color_999999,  
387 - fontSize: ScreenUtil().setSp(30), 356 + VEmptyView(60),
  357 + Container(
  358 + height: ScreenUtil().setWidth(28 * 2),
  359 + child: Row(
  360 + crossAxisAlignment:
  361 + CrossAxisAlignment.start,
  362 + children: [
  363 + Text(
  364 + '*',
  365 + style: TextStyle(
  366 + fontSize:
  367 + ScreenUtil().setSp(32),
  368 + color:
  369 + MyColours.color_E95750),
  370 + ),
  371 + Text(
  372 + '桌位名称',
  373 + style: TextStyle(
  374 + fontSize:
  375 + ScreenUtil().setSp(32),
  376 + color:
  377 + MyColours.color_333333),
  378 + ),
  379 + HEmptyView(40),
  380 + Expanded(
  381 + child: TextField(
  382 + controller: controller,
  383 + maxLines: 1,
  384 + focusNode: focusNode,
  385 + // //光标颜色
  386 + // cursorColor:
  387 + // widget.isSelect ? Colors.white : MyColours.color_199095,
  388 + //输入文本的样式
  389 + style: TextStyle(
  390 + fontSize: ScreenUtil()
  391 + .setSp(30),
  392 + color: MyColours
  393 + .color_333333),
  394 +
  395 + decoration: InputDecoration(
  396 + contentPadding: EdgeInsets.only(
  397 + bottom: ScreenUtil()
  398 + .setWidth(
  399 + 40)), //设置文字内容与边框距离
  400 + enabledBorder:
  401 + UnderlineInputBorder(
  402 + borderSide: BorderSide(
  403 + color: MyColours
  404 + .color_efefef),
  405 + ),
  406 + focusedBorder:
  407 + UnderlineInputBorder(
  408 + borderSide: BorderSide(
  409 + color: MyColours
  410 + .color_efefef,
  411 + width: ScreenUtil()
  412 + .setWidth(2)),
  413 + ),
  414 + hintText: '请输入桌位名称',
  415 + hintStyle: TextStyle(
  416 + color: MyColours
  417 + .color_999999,
  418 + fontSize: ScreenUtil()
  419 + .setSp(30),
  420 + ),
  421 + ),
  422 + onChanged: (value) {},
  423 + onEditingComplete: () {
  424 + FocusScope.of(context)
  425 + .requestFocus(
  426 + FocusNode()); //点击空白处隐藏键盘
  427 + },
  428 + keyboardType:
  429 + TextInputType.text,
  430 + ),
  431 + )
  432 + ],
  433 + ),
388 ), 434 ),
389 - ),  
390 - onChanged: (value) {},  
391 - onEditingComplete: () {  
392 - FocusScope.of(context).requestFocus(  
393 - FocusNode()); //点击空白处隐藏键盘  
394 - },  
395 - keyboardType: TextInputType.text, 435 + VEmptyView(60),
  436 + Container(
  437 + height: ScreenUtil().setWidth(30 * 2),
  438 + child: Row(
  439 + crossAxisAlignment:
  440 + CrossAxisAlignment.center,
  441 + children: [
  442 + Text(
  443 + '人数(选填)',
  444 + style: TextStyle(
  445 + fontSize:
  446 + ScreenUtil().setSp(32),
  447 + color:
  448 + MyColours.color_333333),
  449 + ),
  450 + HEmptyView(40),
  451 + // Stack(
  452 + // overflow: Overflow.visible,
  453 + // children: [
  454 + btnChoose(pnumMin,
  455 + ScreenUtil().setWidth(54 * 2),
  456 + (value) {
  457 + state(() {
  458 + showArea = true;
  459 + showPnumMax = true;
  460 + showPnumMin = !showPnumMin;
  461 + });
  462 + }),
  463 + HEmptyView(20),
  464 + Text(
  465 + '至',
  466 + style: TextStyle(
  467 + fontSize:
  468 + ScreenUtil().setSp(30),
  469 + color:
  470 + MyColours.color_199095),
  471 + ),
  472 + HEmptyView(20),
  473 + btnChoose(pnumMax,
  474 + ScreenUtil().setWidth(54 * 2),
  475 + (value) {
  476 + state(() {
  477 + showArea = true;
  478 + showPnumMin = true;
  479 + showPnumMax = !showPnumMax;
  480 + });
  481 + }),
  482 + ],
  483 + ),
  484 + ),
  485 + VEmptyView(80),
  486 + RoundButton(
  487 + text: '保存',
  488 + width: ScreenUtil().setWidth(300),
  489 + height: ScreenUtil().setWidth(80),
  490 + radius: ScreenUtil().setWidth(10),
  491 + fontSize: 34,
  492 + onPressed: () {
  493 + if (controller.text.trim() ==
  494 + '') {
  495 + Utils.showToast('请输入桌位名称!');
  496 + return;
  497 + }
  498 + // 当前选中区域
  499 + // areas[currentAreaIndex]
  500 + //最低人数
  501 + // pnumMin
  502 + //最高人数
  503 + // pnumMax
  504 +
  505 + onTap({
  506 + 'areaname':
  507 + areas[currentAreaIndex],
  508 + 'name': controller.text,
  509 + 'pnumMin': pnumMin,
  510 + 'pnumMax': pnumMax
  511 + });
  512 + Navigator.pop(context);
  513 + })
  514 + ],
396 ), 515 ),
397 - )  
398 - ],  
399 - ),  
400 - ),  
401 - VEmptyView(60),  
402 - Container(  
403 - height: ScreenUtil().setWidth(30 * 2),  
404 - child: Row(  
405 - crossAxisAlignment: CrossAxisAlignment.center,  
406 - children: [  
407 - Text(  
408 - '*',  
409 - style: TextStyle(  
410 - fontSize: ScreenUtil().setSp(32),  
411 - color: MyColours.color_E95750),  
412 - ),  
413 - Text(  
414 - '人数(选填)',  
415 - style: TextStyle(  
416 - fontSize: ScreenUtil().setSp(32),  
417 - color: MyColours.color_333333),  
418 - ),  
419 - HEmptyView(40),  
420 - // Stack(  
421 - // overflow: Overflow.visible,  
422 - // children: [  
423 - btnChoose(  
424 - pnumMin, ScreenUtil().setWidth(52 * 2),  
425 - (value) {  
426 - state(() {  
427 - showArea = true;  
428 - showPnumMax = true;  
429 - showPnumMin = !showPnumMin;  
430 - });  
431 - }),  
432 - HEmptyView(20),  
433 - Text(  
434 - '至',  
435 - style: TextStyle(  
436 - fontSize: ScreenUtil().setSp(30),  
437 - color: MyColours.color_199095),  
438 ), 516 ),
439 - HEmptyView(20),  
440 - btnChoose(  
441 - pnumMax, ScreenUtil().setWidth(52 * 2),  
442 - (value) {  
443 - state(() {  
444 - showArea = true;  
445 - showPnumMin = true;  
446 - showPnumMax = !showPnumMax;  
447 - });  
448 - }), 517 + Positioned(
  518 + left: ScreenUtil().setWidth(113 * 2),
  519 + top: ScreenUtil().setWidth(105 * 2),
  520 + child: Offstage(
  521 + offstage: showArea,
  522 + child: selectWidget(areas, (index) {
  523 + state(() {
  524 + showArea = !showArea;
  525 + currentAreaIndex = index;
  526 + });
  527 + }),
  528 + )),
  529 + Positioned(
  530 + top: 0,
  531 + right: 0,
  532 + child: InkWell(
  533 + onTap: () {
  534 + Navigator.pop(context);
  535 + },
  536 + child: Container(
  537 + padding: EdgeInsets.only(
  538 + top: ScreenUtil().setWidth(30),
  539 + right: ScreenUtil().setWidth(40),
  540 + left: ScreenUtil().setWidth(40),
  541 + bottom: ScreenUtil().setWidth(40),
  542 + ),
  543 + child: Image.asset(
  544 + Utils.getImgPath('close'),
  545 + width: ScreenUtil().setWidth(28),
  546 + height: ScreenUtil().setWidth(28),
  547 + ),
  548 + )),
  549 + )
449 ], 550 ],
450 - ),  
451 - ),  
452 - VEmptyView(80),  
453 - RoundButton(  
454 - text: '保存',  
455 - width: ScreenUtil().setWidth(300),  
456 - height: ScreenUtil().setWidth(80),  
457 - radius: ScreenUtil().setWidth(10),  
458 - fontSize: 34,  
459 - onPressed: () {  
460 - if (controller.text.trim() == '') {  
461 - Utils.showToast('请输入桌位名称!');  
462 - return;  
463 - }  
464 - // 当前选中区域  
465 - // areas[currentAreaIndex]  
466 - //最低人数  
467 - // pnumMin  
468 - //最高人数  
469 - // pnumMax  
470 -  
471 - onTap(controller.text);  
472 - Navigator.pop(context, controller.text);  
473 - })  
474 - ],  
475 - ), 551 + )),
  552 + Container(
  553 + height: ScreenUtil().setWidth(45 * 2),
  554 + color: Colors.transparent)
  555 + ],
476 ), 556 ),
477 Positioned( 557 Positioned(
478 - left: ScreenUtil().setWidth(113 * 2),  
479 - top: ScreenUtil().setWidth(105 * 2),  
480 - child: Offstage(  
481 - offstage: showArea,  
482 - child: selectWidget(areas, (index) {  
483 - state(() {  
484 - showArea = !showArea;  
485 - currentAreaIndex = index;  
486 - });  
487 - }),  
488 - // child: Container(  
489 - // decoration: BoxDecoration(  
490 - // color: MyColours.color_ffffff,  
491 - // borderRadius: BorderRadius.circular(  
492 - // ScreenUtil().setWidth(10)),  
493 - // border: Border.all(  
494 - // color: MyColours.color_cccccc,  
495 - // width: ScreenUtil().setWidth(2))),  
496 - // width: ScreenUtil().setWidth(120 * 2),  
497 - // height: ScreenUtil().setWidth(140 * 2),  
498 - // child: ListView.builder(  
499 - // padding: EdgeInsets.symmetric(  
500 - // horizontal:  
501 - // ScreenUtil().setWidth(20)),  
502 - // itemCount: areas.length,  
503 - // itemBuilder: (context, index) {  
504 - // return InkWell(  
505 - // onTap: () {  
506 - // state(() {  
507 - // showArea = !showArea;  
508 - // currentAreaIndex = index;  
509 - // });  
510 - // },  
511 - // child: Container(  
512 - // padding: EdgeInsets.all(  
513 - // ScreenUtil().setWidth(20)),  
514 - // decoration: BoxDecoration(  
515 - // border: Border(  
516 - // bottom: BorderSide(  
517 - // color: MyColours  
518 - // .color_efefef,  
519 - // width: ScreenUtil()  
520 - // .setWidth(2)))),  
521 - // child: Text(areas[index],  
522 - // style: TextStyle(  
523 - // color:  
524 - // MyColours.color_199095,  
525 - // fontSize: ScreenUtil()  
526 - // .setSp(28))),  
527 - // ),  
528 - // );  
529 - // }))  
530 - )),  
531 - Positioned(  
532 left: ScreenUtil().setWidth(136 * 2), 558 left: ScreenUtil().setWidth(136 * 2),
533 top: ScreenUtil().setWidth(221 * 2), 559 top: ScreenUtil().setWidth(221 * 2),
534 child: Offstage( 560 child: Offstage(
535 - offstage: showPnumMin,  
536 - child: selectWidget(pnum, (index) {  
537 - state(() {  
538 - showPnumMin = !showPnumMin;  
539 - pnumMin = pnum[index];  
540 - });  
541 - }),  
542 - )), 561 + offstage: showPnumMin,
  562 + child: Material(
  563 + color: Colors.transparent,
  564 + child: selectWidget(pnum, (index) {
  565 + state(() {
  566 + showPnumMin = !showPnumMin;
  567 + pnumMin = pnum[index];
  568 + });
  569 + }),
  570 + ))),
543 Positioned( 571 Positioned(
544 left: ScreenUtil().setWidth(223 * 2), 572 left: ScreenUtil().setWidth(223 * 2),
545 top: ScreenUtil().setWidth(221 * 2), 573 top: ScreenUtil().setWidth(221 * 2),
546 - child: Offstage(  
547 - offstage: showPnumMax,  
548 - child: selectWidget(pnum, (index) {  
549 - state(() {  
550 - showPnumMax = !showPnumMax;  
551 - pnumMax = pnum[index];  
552 - });  
553 - }),  
554 - )),  
555 - Positioned(  
556 - top: 0,  
557 - right: 0,  
558 - child: InkWell(  
559 - onTap: () {  
560 - Navigator.pop(context);  
561 - },  
562 - child: Container(  
563 - padding: EdgeInsets.only(  
564 - top: ScreenUtil().setWidth(30),  
565 - right: ScreenUtil().setWidth(40),  
566 - left: ScreenUtil().setWidth(40),  
567 - bottom: ScreenUtil().setWidth(40),  
568 - ),  
569 - child: Image.asset(  
570 - Utils.getImgPath('close'),  
571 - width: ScreenUtil().setWidth(28),  
572 - height: ScreenUtil().setWidth(28),  
573 - ),  
574 - )),  
575 - )  
576 - ],  
577 - ),  
578 - ),  
579 - ),  
580 - ); 574 + child: Material(
  575 + color: Colors.transparent,
  576 + child: Offstage(
  577 + offstage: showPnumMax,
  578 + child: selectWidget(pnum, (index) {
  579 + state(() {
  580 + showPnumMax = !showPnumMax;
  581 + pnumMax = pnum[index];
  582 + });
  583 + }),
  584 + ))),
  585 + ])));
581 }); 586 });
582 }); 587 });
583 } 588 }
@@ -124,34 +124,38 @@ class NewTableItemState extends State<NewTableItem> { @@ -124,34 +124,38 @@ class NewTableItemState extends State<NewTableItem> {
124 // overflow: TextOverflow.ellipsis, 124 // overflow: TextOverflow.ellipsis,
125 // ), 125 // ),
126 VEmptyView(6), 126 VEmptyView(6),
127 - Text(  
128 - (table.reserver == null || table.reserver.isEmpty)  
129 - ? '${table.tablePnum}人'  
130 - : table.reserver,  
131 - style: TextStyle(  
132 - color: (table.reserver == null ||  
133 - table.reserver.isEmpty)  
134 - ? MyColours.color_353535  
135 - : MyColours.color_2bb5b7,  
136 - fontSize: ScreenUtil().setSp(26),  
137 - decoration: TextDecoration.none,  
138 - fontWeight: FontWeight.normal),  
139 - overflow: TextOverflow.ellipsis,  
140 - ), 127 + table.tablePnum == null
  128 + ? Container()
  129 + : Text(
  130 + (table.reserver == null || table.reserver.isEmpty)
  131 + ? '${table.tablePnum}人'
  132 + : table.reserver,
  133 + style: TextStyle(
  134 + color: (table.reserver == null ||
  135 + table.reserver.isEmpty)
  136 + ? MyColours.color_353535
  137 + : MyColours.color_2bb5b7,
  138 + fontSize: ScreenUtil().setSp(26),
  139 + decoration: TextDecoration.none,
  140 + fontWeight: FontWeight.normal),
  141 + overflow: TextOverflow.ellipsis,
  142 + ),
141 VEmptyView(6), 143 VEmptyView(6),
142 - Text(  
143 - table.lowStr,  
144 - style: TextStyle(  
145 - color: MyColours.color_777777,  
146 - fontSize: ScreenUtil().setSp(26),  
147 - decoration: TextDecoration.none,  
148 - fontWeight: FontWeight.normal),  
149 - overflow: TextOverflow.ellipsis,  
150 - ) 144 + table.lowStr == ''
  145 + ? Container()
  146 + : Text(
  147 + table.lowStr,
  148 + style: TextStyle(
  149 + color: MyColours.color_777777,
  150 + fontSize: ScreenUtil().setSp(26),
  151 + decoration: TextDecoration.none,
  152 + fontWeight: FontWeight.normal),
  153 + overflow: TextOverflow.ellipsis,
  154 + )
151 ], 155 ],
152 ), 156 ),
153 ), 157 ),
154 - widget.isRegionName 158 + widget.isRegionName && table.regionName != null
155 ? Positioned( 159 ? Positioned(
156 bottom: 0, 160 bottom: 0,
157 left: 0, 161 left: 0,