Showing
12 changed files
with
1364 additions
and
186 deletions
| @@ -27,6 +27,7 @@ class Table { | @@ -27,6 +27,7 @@ class Table { | ||
| 27 | int isPhoto; //桌位是否有照片 | 27 | int isPhoto; //桌位是否有照片 |
| 28 | String pnum; //预计人数 | 28 | String pnum; //预计人数 |
| 29 | String nickName; //操作人 | 29 | String nickName; //操作人 |
| 30 | + String noteName; //操作人 | ||
| 30 | 31 | ||
| 31 | //获取桌位类型 | 32 | //获取桌位类型 |
| 32 | String get tidStr { | 33 | String get tidStr { |
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
| @@ -13,6 +13,7 @@ import 'package:one_key/models/manager.dart'; | @@ -13,6 +13,7 @@ import 'package:one_key/models/manager.dart'; | ||
| 13 | import 'package:one_key/models/notebook_detail.dart'; | 13 | import 'package:one_key/models/notebook_detail.dart'; |
| 14 | import 'package:one_key/models/remark.dart'; | 14 | import 'package:one_key/models/remark.dart'; |
| 15 | import 'package:one_key/pages/detail/notebook_detail_change_page.dart'; | 15 | import 'package:one_key/pages/detail/notebook_detail_change_page.dart'; |
| 16 | +import 'package:one_key/pages/detail/notebook_detail_change_page_f.dart'; | ||
| 16 | import 'package:one_key/provider/message_dialog_model.dart'; | 17 | import 'package:one_key/provider/message_dialog_model.dart'; |
| 17 | import 'package:one_key/provider/notebook_detail_model.dart'; | 18 | import 'package:one_key/provider/notebook_detail_model.dart'; |
| 18 | import 'package:one_key/provider/online_check_edit_provider.dart'; | 19 | import 'package:one_key/provider/online_check_edit_provider.dart'; |
| @@ -3014,7 +3015,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -3014,7 +3015,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 3014 | userModel.user.openid) { | 3015 | userModel.user.openid) { |
| 3015 | } else { | 3016 | } else { |
| 3016 | NavigatorUtil | 3017 | NavigatorUtil |
| 3017 | - .goNoteBookChangePage( | 3018 | + .goNoteBookChangeFPage( |
| 3018 | context, | 3019 | context, |
| 3019 | detailEntity, | 3020 | detailEntity, |
| 3020 | widget.rid); | 3021 | widget.rid); |
lib/pages/detail/select_tables_f_page.dart
0 → 100644
| 1 | +import 'dart:ffi'; | ||
| 2 | + | ||
| 3 | +import 'package:dotted_border/dotted_border.dart'; | ||
| 4 | +import 'package:flutter/material.dart'; | ||
| 5 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 6 | +import 'package:one_key/constant/state.dart'; | ||
| 7 | +import 'package:one_key/models/area.dart'; | ||
| 8 | +import 'package:one_key/models/notebook.dart'; | ||
| 9 | +import 'package:one_key/models/tableOuter.dart'; | ||
| 10 | +import 'package:one_key/models/table_list.dart'; | ||
| 11 | +import 'package:one_key/pages/table/area_item_table.dart'; | ||
| 12 | +import 'package:one_key/provider/choose_table_model.dart'; | ||
| 13 | +import 'package:one_key/provider/notebook_detail_change_model.dart'; | ||
| 14 | +import 'package:one_key/provider/notebook_model.dart'; | ||
| 15 | +import 'package:one_key/provider/user_model.dart'; | ||
| 16 | +import 'package:one_key/res/colors.dart'; | ||
| 17 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 18 | +import 'package:one_key/utils/utils.dart'; | ||
| 19 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 20 | +import 'package:one_key/widgets/app_bar.dart'; | ||
| 21 | +import 'package:one_key/widgets/area_item.dart'; | ||
| 22 | +import 'package:one_key/widgets/common_button.dart'; | ||
| 23 | +import 'package:one_key/widgets/f_table_item.dart'; | ||
| 24 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 25 | +import 'package:one_key/widgets/page_exception.dart'; | ||
| 26 | +import 'package:one_key/widgets/table_item.dart'; | ||
| 27 | +import 'package:one_key/models/table.dart' as t; | ||
| 28 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 29 | +import 'package:provider/provider.dart'; | ||
| 30 | +import 'dart:convert' as convert; | ||
| 31 | + | ||
| 32 | +class SelectTableFPage extends StatefulWidget { | ||
| 33 | + final String rid; //预订id | ||
| 34 | + final DateTime dateTime; //日期 | ||
| 35 | + final String ddate_slot; //时段 | ||
| 36 | + final bool canChoose; //变更预订可以取消原来已预订的选中状态 | ||
| 37 | + final List<TableList> tableList; | ||
| 38 | + final String fromPage; | ||
| 39 | + final String tid; | ||
| 40 | + | ||
| 41 | + SelectTableFPage(this.rid, this.dateTime, this.ddate_slot, | ||
| 42 | + {this.canChoose = false, this.tableList, this.fromPage, this.tid}); | ||
| 43 | + | ||
| 44 | + @override | ||
| 45 | + State<StatefulWidget> createState() { | ||
| 46 | + // TODO: implement createState | ||
| 47 | + return new SelectTableFPageState(); | ||
| 48 | + } | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +class SelectTableFPageState extends State<SelectTableFPage> { | ||
| 52 | + List<Area> areas = []; //区域列表 | ||
| 53 | + List<t.Table> selectTables = []; //选择的桌位 | ||
| 54 | + | ||
| 55 | + List<TableOuter> tableOuterList = []; //区域-桌位列表 | ||
| 56 | + | ||
| 57 | + Map<String, List<t.Table>> areaTableMap = {}; //区域-桌位Map | ||
| 58 | + | ||
| 59 | + ChooseTableModel _chooseTableModel; | ||
| 60 | + | ||
| 61 | + Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单 | ||
| 62 | + | ||
| 63 | + String currentArea; //当前选中区域 | ||
| 64 | + List<String> personNumList = []; | ||
| 65 | + | ||
| 66 | + int selectNum = 0; | ||
| 67 | + bool isSelected = true; //全部按钮 | ||
| 68 | + int _selectNumber; | ||
| 69 | + | ||
| 70 | + @override | ||
| 71 | + void initState() { | ||
| 72 | + // TODO: implement initState | ||
| 73 | + super.initState(); | ||
| 74 | + for (int i = 1; i < 31; i++) { | ||
| 75 | + personNumList.add(i.toString()); | ||
| 76 | + } | ||
| 77 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 78 | + getTableList(); | ||
| 79 | + }); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + //获取桌位列表 | ||
| 83 | + getTableList({needLoading = true}) async { | ||
| 84 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 85 | + Map<String, String> params = {"sellerid": userModel.user.sellerid}; | ||
| 86 | + tableOuterList = await _chooseTableModel.getTableList(context, params, | ||
| 87 | + needLoading: needLoading); | ||
| 88 | + _chooseTableModel.tablesAll = []; | ||
| 89 | + for (TableOuter item in tableOuterList) { | ||
| 90 | + // if (item.name == "推荐") { | ||
| 91 | + // itemModelList.remove(item); | ||
| 92 | + // } | ||
| 93 | + for (var item1 in item.list) { | ||
| 94 | + item1.selected = false; | ||
| 95 | + for (var table in widget.tableList) { | ||
| 96 | + if (item1.id == table.id) { | ||
| 97 | + item1.selected = true; | ||
| 98 | + selectNum++; | ||
| 99 | + // if (!tableList.contains(item)) { | ||
| 100 | + // tableList.add(item); | ||
| 101 | + // } | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + _chooseTableModel.tablesAll.addAll(item.list); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + if (tableOuterList.isEmpty) { | ||
| 109 | + _chooseTableModel.pageState = PageState.Success; | ||
| 110 | + _chooseTableModel.notifyListeners(); | ||
| 111 | + } else { | ||
| 112 | + _getReserveList(userModel.user.sellerid, needLoading: needLoading); | ||
| 113 | + } | ||
| 114 | + // if (_chooseTableModel.pageState == PageState.Success) { | ||
| 115 | + | ||
| 116 | + // } | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + refreshTable(context) async { | ||
| 120 | + await getTableList(needLoading: false); | ||
| 121 | + // if (temp.length > 0) { | ||
| 122 | + // _getReserveList(context, needLoading: false); | ||
| 123 | + // } else { | ||
| 124 | + // // pageState = PageState.Empty; | ||
| 125 | + // _chooseTableModel.pageState = PageState.Success; | ||
| 126 | + // _chooseTableModel.notifyListeners(); | ||
| 127 | + // } | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + //获取已预订列表 | ||
| 131 | + _getReserveList(String sid, {needLoading = true}) async { | ||
| 132 | + NoteBookModel model = new NoteBookModel(); | ||
| 133 | + Map<String, String> params = { | ||
| 134 | + "sid": sid, | ||
| 135 | + "rdate": _getRdate(), | ||
| 136 | + "ddate_solt": widget.ddate_slot, | ||
| 137 | + "y": "200", | ||
| 138 | + "x": "1", | ||
| 139 | + "keywords": "", | ||
| 140 | + "sort": "1" | ||
| 141 | + }; | ||
| 142 | + List<Notebook> noteBooks = | ||
| 143 | + await model.getReserveList(context, params, needLoading: needLoading); | ||
| 144 | + for (Notebook notebook in noteBooks) { | ||
| 145 | + if (notebook.tid.isEmpty) continue; | ||
| 146 | + if (notebook.status == "1" || | ||
| 147 | + notebook.status == "2" || | ||
| 148 | + notebook.status == "5") { | ||
| 149 | + //已预订,用餐中,已安排 | ||
| 150 | + List<String> tids = notebook.tid.split(","); | ||
| 151 | + for (String tid in tids) { | ||
| 152 | + tableMap["$tid"] = notebook; | ||
| 153 | + } | ||
| 154 | + } | ||
| 155 | + } | ||
| 156 | + print(tableMap); | ||
| 157 | + if (needLoading) { | ||
| 158 | + initData(); | ||
| 159 | + } else { | ||
| 160 | + initData(needRetain: true); | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + //初始桌位数据 | ||
| 165 | + initData({bool needRetain = false}) { | ||
| 166 | + areas.clear(); | ||
| 167 | + areaTableMap.clear(); | ||
| 168 | + List<t.Table> tempTableAll = []; | ||
| 169 | + tempTableAll.addAll(_chooseTableModel.tablesAll); | ||
| 170 | + for (TableOuter outer in tableOuterList) { | ||
| 171 | + int count = 0; | ||
| 172 | + List<t.Table> tempList = []; | ||
| 173 | + tempList.addAll(outer.list); | ||
| 174 | + for (t.Table table in outer.list) { | ||
| 175 | + // table.selected = false; | ||
| 176 | + if (widget.tid != '' && table.id == widget.tid) { | ||
| 177 | + table.selected = true; | ||
| 178 | + currentArea = outer.name; | ||
| 179 | + } | ||
| 180 | + if (table.tablestatus == "0") { | ||
| 181 | + //没有用餐中 | ||
| 182 | + if (tableMap["${table.id}"] != null) { | ||
| 183 | + Notebook notebook = tableMap["${table.id}"]; | ||
| 184 | + table.sign = notebook.status; | ||
| 185 | + table.notebookId = notebook.id; | ||
| 186 | + table.reserver = notebook.rnameStr; | ||
| 187 | + table.pnum = notebook.actual_pnum; | ||
| 188 | + table.nickName = notebook.nick_name; | ||
| 189 | + table.noteName = notebook.note_name; | ||
| 190 | + //(不能移除自己定的桌子) | ||
| 191 | + String idNow = ''; | ||
| 192 | + if (tableMap.containsKey('${table.id}')) { | ||
| 193 | + //包含,证明该桌子已经被预订了 | ||
| 194 | + idNow = tableMap['${table.id}'].id; | ||
| 195 | + if (idNow != widget.rid) { | ||
| 196 | + //不是自己的当前订单 | ||
| 197 | + //剔除已经预订的桌子,剩下空桌子(仅看空座) | ||
| 198 | + tempList.remove(table); | ||
| 199 | + //全部 | ||
| 200 | + tempTableAll.remove(table); | ||
| 201 | + } | ||
| 202 | + } | ||
| 203 | + } else { | ||
| 204 | + table.sign = ""; | ||
| 205 | + table.notebookId = ""; | ||
| 206 | + if (table.enable == "1") { | ||
| 207 | + count++; | ||
| 208 | + } | ||
| 209 | + } | ||
| 210 | + } else { | ||
| 211 | + table.sign = "2"; | ||
| 212 | + table.notebookId = ""; | ||
| 213 | + } | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + areaTableMap["${outer.name}"] = outer.list; | ||
| 217 | + _chooseTableModel.areaTableMapCanNote["${outer.name}"] = tempList; | ||
| 218 | + Area area = Area(); | ||
| 219 | + area.name = outer.name; | ||
| 220 | + area.count = count; | ||
| 221 | + area.rid = outer.list.length == 0 ? outer.rid : outer.list[0].rid; | ||
| 222 | + areas.add(area); | ||
| 223 | + } | ||
| 224 | + _chooseTableModel.tablesCanNote = tempTableAll; | ||
| 225 | + if (_chooseTableModel.swichState) { | ||
| 226 | + _chooseTableModel.areaTableMapShow = | ||
| 227 | + _chooseTableModel.areaTableMapCanNote; | ||
| 228 | + _chooseTableModel.tablesShow = _chooseTableModel.tablesCanNote; | ||
| 229 | + } else { | ||
| 230 | + _chooseTableModel.areaTableMapShow = areaTableMap; | ||
| 231 | + _chooseTableModel.tablesShow = _chooseTableModel.tablesAll; | ||
| 232 | + } | ||
| 233 | + if (widget.tid == '') { | ||
| 234 | + if (!needRetain) { | ||
| 235 | + // currentArea = areaTableMap.keys.first; | ||
| 236 | + currentArea = '全部'; | ||
| 237 | + _chooseTableModel.currentTables = _chooseTableModel.tablesAll; | ||
| 238 | + } | ||
| 239 | + if (areas.length == 1) { | ||
| 240 | + currentArea = areaTableMap.keys.first; | ||
| 241 | + } | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + _chooseTableModel.pageState = PageState.Success; | ||
| 245 | + _chooseTableModel.notifyListeners(); | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | + //获取一天开始-结束时间字符串 | ||
| 249 | + String _getRdate() { | ||
| 250 | + //一天开始时间 | ||
| 251 | + double startDay = (DateTime.parse((widget.dateTime.year.toString() + | ||
| 252 | + "-" + | ||
| 253 | + Utils.addZeroNumber(widget.dateTime.month) + | ||
| 254 | + "-" + | ||
| 255 | + Utils.addZeroNumber(widget.dateTime.day) + | ||
| 256 | + " 00:00:00")) | ||
| 257 | + .millisecondsSinceEpoch) / | ||
| 258 | + 1000; | ||
| 259 | + //一天结束时间 | ||
| 260 | + double endDay = (DateTime.parse((widget.dateTime.year.toString() + | ||
| 261 | + "-" + | ||
| 262 | + Utils.addZeroNumber(widget.dateTime.month) + | ||
| 263 | + "-" + | ||
| 264 | + Utils.addZeroNumber(widget.dateTime.day) + | ||
| 265 | + " 23:59:59")) | ||
| 266 | + .millisecondsSinceEpoch) / | ||
| 267 | + 1000; | ||
| 268 | + return startDay.floor().toString() + "-" + endDay.floor().toString(); | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + Widget item(int i) { | ||
| 272 | + return GridView.builder( | ||
| 273 | + // controller: _areaController, | ||
| 274 | + // physics: NeverScrollableScrollPhysics(), | ||
| 275 | + padding: EdgeInsets.symmetric( | ||
| 276 | + vertical: ScreenUtil().setWidth(20), | ||
| 277 | + horizontal: ScreenUtil().setWidth(10)), | ||
| 278 | + shrinkWrap: true, | ||
| 279 | + itemCount: currentArea == '全部' | ||
| 280 | + ? _chooseTableModel.tablesShow.length | ||
| 281 | + : _chooseTableModel.areaTableMapShow[areas[i].name].length + 1, | ||
| 282 | + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( | ||
| 283 | + crossAxisCount: 4, | ||
| 284 | + childAspectRatio: 1, | ||
| 285 | + mainAxisSpacing: ScreenUtil().setWidth(30), | ||
| 286 | + crossAxisSpacing: ScreenUtil().setWidth(12), | ||
| 287 | + ), | ||
| 288 | + | ||
| 289 | + itemBuilder: (BuildContext context, int index) { | ||
| 290 | + List<t.Table> data = currentArea == '全部' | ||
| 291 | + ? _chooseTableModel.tablesShow | ||
| 292 | + : _chooseTableModel.areaTableMapShow[areas[i].name]; | ||
| 293 | + if (index == data.length || data.length == 0) { | ||
| 294 | + return InkWell( | ||
| 295 | + onTap: () async { | ||
| 296 | + List<String> areasTemp = []; | ||
| 297 | + for (int i = 0; i < areas.length; i++) { | ||
| 298 | + areasTemp.add(areas[i].name); | ||
| 299 | + } | ||
| 300 | + | ||
| 301 | + //添加桌位弹框 | ||
| 302 | + await DialogUtil.openCreateTableDialog( | ||
| 303 | + context, areasTemp, i, personNumList, | ||
| 304 | + onTap: (Map<String, String> value) async { | ||
| 305 | + print(value); | ||
| 306 | + // 'areaname': | ||
| 307 | + // areas[currentAreaIndex], | ||
| 308 | + // 'name': controller.text, | ||
| 309 | + // 'pnumMin': pnumMin, | ||
| 310 | + // 'pnumMax': pnumMax | ||
| 311 | + //添加桌位 接口参数带整合??? | ||
| 312 | + // 以下是旧的不去,明天添加桌位接口 | ||
| 313 | + String rid; | ||
| 314 | + for (Area item in areas) { | ||
| 315 | + if (item.name == value['areaname']) { | ||
| 316 | + rid = item.rid; | ||
| 317 | + } | ||
| 318 | + } | ||
| 319 | + Map<String, String> params = { | ||
| 320 | + 'rid': rid, | ||
| 321 | + 'name': value['name'], | ||
| 322 | + }; | ||
| 323 | + if (value['pnumMin'] != '') { | ||
| 324 | + params['pnum'] = value['pnumMin']; | ||
| 325 | + } | ||
| 326 | + if (value['pnumMax'] != '') { | ||
| 327 | + params['most_pnum'] = value['pnumMax']; | ||
| 328 | + } | ||
| 329 | + bool success = | ||
| 330 | + await _chooseTableModel.addTable(context, params); | ||
| 331 | + print(success); | ||
| 332 | + if (success) { | ||
| 333 | + Utils.showToast('添加成功!'); | ||
| 334 | + // TableOuter tableOuter = TableOuter(); | ||
| 335 | + // tableOuter.name = value; | ||
| 336 | + // tableOuter.list = []; | ||
| 337 | + // tableManagerModel.tableOuterList.add(tableOuter); | ||
| 338 | + // tableManagerModel.initData(); | ||
| 339 | + // Timer( | ||
| 340 | + // Duration(milliseconds: 500), | ||
| 341 | + // () => _areaController.jumpTo( | ||
| 342 | + // _areaController.position.maxScrollExtent)); | ||
| 343 | + | ||
| 344 | + // await tableManagerModel | ||
| 345 | + // .getTableList(context); | ||
| 346 | + // await tableManagerModel | ||
| 347 | + // .initData(); | ||
| 348 | + refreshTable(context); | ||
| 349 | + } | ||
| 350 | + }); | ||
| 351 | + }, | ||
| 352 | + child: Container( | ||
| 353 | + child: DottedBorder( | ||
| 354 | + dashPattern: [5, 5, 5, 5], | ||
| 355 | + borderType: BorderType.RRect, | ||
| 356 | + radius: Radius.circular(ScreenUtil().setWidth(20)), | ||
| 357 | + // padding: EdgeInsets.all(ScreenUtil().setWidth(70)), | ||
| 358 | + color: MyColours.color_E0E0E0, | ||
| 359 | + strokeWidth: ScreenUtil().setWidth(2), | ||
| 360 | + child: ClipRRect( | ||
| 361 | + borderRadius: BorderRadius.all( | ||
| 362 | + Radius.circular(ScreenUtil().setWidth(20))), | ||
| 363 | + child: Container( | ||
| 364 | + height: ScreenUtil.screenWidthDp - | ||
| 365 | + ScreenUtil().setWidth(12 * 3 - 10 * 2), | ||
| 366 | + width: ScreenUtil.screenWidthDp - | ||
| 367 | + ScreenUtil().setWidth(12 * 3 - 10 * 2), | ||
| 368 | + child: Column( | ||
| 369 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 370 | + children: [ | ||
| 371 | + Image.asset(Utils.getImgPath('add_store'), | ||
| 372 | + width: ScreenUtil().setWidth(32)), | ||
| 373 | + ], | ||
| 374 | + ), | ||
| 375 | + ), | ||
| 376 | + ), | ||
| 377 | + ))); | ||
| 378 | + } else { | ||
| 379 | + return Selector<ChooseTableModel, t.Table>( | ||
| 380 | + shouldRebuild: (pre, next) => true, | ||
| 381 | + selector: (context, model) => data[index], | ||
| 382 | + builder: (context, table, _) { | ||
| 383 | + return FTableItem(table, canSelected: true, | ||
| 384 | + onSelected: (t.Table table) { | ||
| 385 | + if (widget.fromPage == 'tablePhoto') { | ||
| 386 | + for (String item in areaTableMap.keys) { | ||
| 387 | + for (t.Table item in areaTableMap[item]) { | ||
| 388 | + item.selected = false; | ||
| 389 | + selectNum = 0; | ||
| 390 | + if (table.id == item.id) { | ||
| 391 | + item.selected = true; | ||
| 392 | + selectTables = []; | ||
| 393 | + selectNum++; | ||
| 394 | + selectTables.add(table); | ||
| 395 | + } | ||
| 396 | + } | ||
| 397 | + } | ||
| 398 | + setState(() {}); | ||
| 399 | + } else { | ||
| 400 | + if ((table as t.Table).selected) { | ||
| 401 | + selectTables.add(table); | ||
| 402 | + | ||
| 403 | + selectNum++; | ||
| 404 | + | ||
| 405 | + widget.tableList.add(tableToTableList(table)); | ||
| 406 | + } else { | ||
| 407 | + widget.tableList.removeWhere((t) => t.id == table.id); | ||
| 408 | + | ||
| 409 | + selectNum--; | ||
| 410 | + | ||
| 411 | + selectTables.removeWhere((t) => t.id == table.id); | ||
| 412 | + } | ||
| 413 | + setState(() {}); | ||
| 414 | + } | ||
| 415 | + }, | ||
| 416 | + fromPage: widget.fromPage, | ||
| 417 | + tableMap: tableMap, | ||
| 418 | + rid: widget.rid); | ||
| 419 | + }, | ||
| 420 | + ); | ||
| 421 | + } | ||
| 422 | + }, | ||
| 423 | + ); | ||
| 424 | + } | ||
| 425 | + | ||
| 426 | + @override | ||
| 427 | + Widget build(BuildContext context) { | ||
| 428 | + _chooseTableModel = Provider.of<ChooseTableModel>(context); | ||
| 429 | + return Scaffold( | ||
| 430 | + body: SafeArea( | ||
| 431 | + child: Column( | ||
| 432 | + children: <Widget>[ | ||
| 433 | + MyAppBar( | ||
| 434 | + "选择桌位", | ||
| 435 | + showBack: true, | ||
| 436 | + ), | ||
| 437 | + Expanded( | ||
| 438 | + child: Consumer<ChooseTableModel>(builder: (context, model, _) { | ||
| 439 | + if (model.pageState != PageState.Success) { | ||
| 440 | + return ExceptionPage( | ||
| 441 | + pageState: model.pageState, | ||
| 442 | + callback: () { | ||
| 443 | + getTableList(); | ||
| 444 | + }, | ||
| 445 | + emptyMsg: "暂时没有桌位哦", | ||
| 446 | + emptyImg: "empty_search", | ||
| 447 | + showMsg: "加载中,请稍后...", | ||
| 448 | + ); | ||
| 449 | + } else { | ||
| 450 | + return Column( | ||
| 451 | + // crossAxisAlignment: CrossAxisAlignment.center, | ||
| 452 | + children: [ | ||
| 453 | + Container( | ||
| 454 | + color: MyColours.color_ffffff, | ||
| 455 | + height: ScreenUtil().setWidth(92), | ||
| 456 | + margin: | ||
| 457 | + EdgeInsets.only(bottom: ScreenUtil().setWidth(30)), | ||
| 458 | + child: Row( | ||
| 459 | + children: [ | ||
| 460 | + HEmptyView(20), | ||
| 461 | + Expanded( | ||
| 462 | + child: ListView.builder( | ||
| 463 | + itemCount: | ||
| 464 | + areas.length == 0 ? 1 : areas.length + 2, | ||
| 465 | + shrinkWrap: true, | ||
| 466 | + scrollDirection: Axis.horizontal, | ||
| 467 | + itemBuilder: (BuildContext contxt, int index) { | ||
| 468 | + if (index == areas.length + 1 || | ||
| 469 | + areas.length == 0) { | ||
| 470 | + return InkWell( | ||
| 471 | + onTap: () async { | ||
| 472 | + //添加区域弹框 | ||
| 473 | + await DialogUtil.openCreateAreaDialog( | ||
| 474 | + context, onTap: (value) async { | ||
| 475 | + print(value); | ||
| 476 | + //添加区域 | ||
| 477 | + bool success = await _chooseTableModel | ||
| 478 | + .addTableAreas(context, value); | ||
| 479 | + print(success); | ||
| 480 | + if (success) { | ||
| 481 | + Utils.showToast('添加成功!'); | ||
| 482 | + UserModel userModel = | ||
| 483 | + Provider.of<UserModel>(context, | ||
| 484 | + listen: false); | ||
| 485 | + Map<String, String> params = { | ||
| 486 | + "sellerid": userModel.user.sellerid | ||
| 487 | + }; | ||
| 488 | + await _chooseTableModel.getTableList( | ||
| 489 | + context, params, | ||
| 490 | + needLoading: false); | ||
| 491 | + initData(); | ||
| 492 | + | ||
| 493 | + // setState(() { | ||
| 494 | + // updateMenu(); | ||
| 495 | + // }); | ||
| 496 | + // _scrollToIndex(widget | ||
| 497 | + // .tableManagerModel | ||
| 498 | + // .areas | ||
| 499 | + // .length); | ||
| 500 | + | ||
| 501 | + } | ||
| 502 | + }); | ||
| 503 | + }, | ||
| 504 | + child: Column( | ||
| 505 | + children: [ | ||
| 506 | + VEmptyView(20), | ||
| 507 | + DottedBorder( | ||
| 508 | + dashPattern: [5, 5, 5, 5], | ||
| 509 | + borderType: BorderType.RRect, | ||
| 510 | + radius: Radius.circular( | ||
| 511 | + ScreenUtil().setWidth(10)), | ||
| 512 | + // padding: EdgeInsets.all(ScreenUtil().setWidth(70)), | ||
| 513 | + color: MyColours.color_199095, | ||
| 514 | + strokeWidth: ScreenUtil().setWidth(2), | ||
| 515 | + child: ClipRRect( | ||
| 516 | + borderRadius: BorderRadius.all( | ||
| 517 | + Radius.circular( | ||
| 518 | + ScreenUtil().setWidth(10))), | ||
| 519 | + child: Container( | ||
| 520 | + height: | ||
| 521 | + ScreenUtil().setWidth(25 * 2), | ||
| 522 | + width: ScreenUtil() | ||
| 523 | + .setWidth(104 * 2), | ||
| 524 | + child: Column( | ||
| 525 | + mainAxisAlignment: | ||
| 526 | + MainAxisAlignment.center, | ||
| 527 | + children: [ | ||
| 528 | + Image.asset( | ||
| 529 | + Utils.getImgPath( | ||
| 530 | + 'add_area'), | ||
| 531 | + width: ScreenUtil() | ||
| 532 | + .setWidth(24)), | ||
| 533 | + ], | ||
| 534 | + ), | ||
| 535 | + ), | ||
| 536 | + ), | ||
| 537 | + ) | ||
| 538 | + ], | ||
| 539 | + ), | ||
| 540 | + ); | ||
| 541 | + } else { | ||
| 542 | + if (index == 0) { | ||
| 543 | + return InkWell( | ||
| 544 | + onTap: () { | ||
| 545 | + setState(() { | ||
| 546 | + isSelected = true; | ||
| 547 | + currentArea = '全部'; | ||
| 548 | + _chooseTableModel.currentTables = | ||
| 549 | + _chooseTableModel | ||
| 550 | + .areaTableMapShow[ | ||
| 551 | + currentArea]; | ||
| 552 | + }); | ||
| 553 | + }, | ||
| 554 | + child: Container( | ||
| 555 | + // width: ScreenUtil().setWidth(104 * 2), | ||
| 556 | + height: ScreenUtil().setWidth(80), | ||
| 557 | + margin: EdgeInsets.only( | ||
| 558 | + right: ScreenUtil().setWidth(20), | ||
| 559 | + top: ScreenUtil().setWidth(20), | ||
| 560 | + ), | ||
| 561 | + padding: EdgeInsets.symmetric( | ||
| 562 | + horizontal: | ||
| 563 | + ScreenUtil().setWidth(20), | ||
| 564 | + vertical: | ||
| 565 | + ScreenUtil().setWidth(10)), | ||
| 566 | + alignment: Alignment.center, | ||
| 567 | + decoration: BoxDecoration( | ||
| 568 | + // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 569 | + color: isSelected | ||
| 570 | + ? MyColours.color_199095 | ||
| 571 | + : MyColours.color_ffffff, | ||
| 572 | + border: Border.all( | ||
| 573 | + color: MyColours.color_E0E0E0, | ||
| 574 | + width: | ||
| 575 | + ScreenUtil().setWidth(2))), | ||
| 576 | + child: Text( | ||
| 577 | + '全部', | ||
| 578 | + overflow: TextOverflow.ellipsis, | ||
| 579 | + style: TextStyle( | ||
| 580 | + color: isSelected | ||
| 581 | + ? MyColours.color_ffffff | ||
| 582 | + : MyColours.color_333333, | ||
| 583 | + fontSize: ScreenUtil().setSp(28), | ||
| 584 | + decoration: TextDecoration.none, | ||
| 585 | + fontWeight: FontWeight.normal), | ||
| 586 | + ), | ||
| 587 | + ), | ||
| 588 | + ); | ||
| 589 | + } else { | ||
| 590 | + return AreaItemTable( | ||
| 591 | + areas[index - 1], currentArea, (area) { | ||
| 592 | + setState(() { | ||
| 593 | + isSelected = false; | ||
| 594 | + _selectNumber = index - 1; | ||
| 595 | + currentArea = areas[index - 1].name; | ||
| 596 | + _chooseTableModel.currentTables = | ||
| 597 | + _chooseTableModel | ||
| 598 | + .areaTableMapShow[currentArea]; | ||
| 599 | + // _anmationMenu(); | ||
| 600 | + }); | ||
| 601 | + }); | ||
| 602 | + } | ||
| 603 | + } | ||
| 604 | + }, | ||
| 605 | + )), | ||
| 606 | + InkWell( | ||
| 607 | + onTap: () { | ||
| 608 | + setState(() { | ||
| 609 | + model.swichState = !model.swichState; | ||
| 610 | + if (model.swichState) { | ||
| 611 | + model.areaTableMapShow = | ||
| 612 | + _chooseTableModel.areaTableMapCanNote; | ||
| 613 | + model.tablesShow = | ||
| 614 | + _chooseTableModel.tablesCanNote; | ||
| 615 | + } else { | ||
| 616 | + model.areaTableMapShow = model.areaTableMap; | ||
| 617 | + model.tablesShow = model.tablesAll; | ||
| 618 | + } | ||
| 619 | + }); | ||
| 620 | + }, | ||
| 621 | + child: Container( | ||
| 622 | + margin: EdgeInsets.only( | ||
| 623 | + top: ScreenUtil().setWidth(20), | ||
| 624 | + ), | ||
| 625 | + child: Row( | ||
| 626 | + children: [ | ||
| 627 | + MyDivider(ScreenUtil().setWidth(15), | ||
| 628 | + ScreenUtil().setWidth(80), | ||
| 629 | + color: MyColours.color_F1F0F4), | ||
| 630 | + MyDivider(ScreenUtil().setWidth(2), | ||
| 631 | + ScreenUtil().setWidth(80), | ||
| 632 | + color: MyColours.color_9C9C9C), | ||
| 633 | + HEmptyView(30), | ||
| 634 | + Image.asset( | ||
| 635 | + model.swichState | ||
| 636 | + ? Utils.getImgPath('f_swich_on') | ||
| 637 | + : Utils.getImgPath('f_swich_off'), | ||
| 638 | + width: ScreenUtil().setWidth(90), | ||
| 639 | + // height: ScreenUtil().setWidth(82), | ||
| 640 | + ), | ||
| 641 | + HEmptyView(20), | ||
| 642 | + Text( | ||
| 643 | + '仅看\n空座', | ||
| 644 | + style: TextStyle( | ||
| 645 | + fontSize: ScreenUtil().setSp(28), | ||
| 646 | + color: MyColours.color_333333, | ||
| 647 | + ), | ||
| 648 | + ), | ||
| 649 | + HEmptyView(40) | ||
| 650 | + ], | ||
| 651 | + )), | ||
| 652 | + ) | ||
| 653 | + ], | ||
| 654 | + ), | ||
| 655 | + ), | ||
| 656 | + Expanded( | ||
| 657 | + flex: 2, | ||
| 658 | + child: Container( | ||
| 659 | + constraints: BoxConstraints( | ||
| 660 | + minHeight: ScreenUtil().setWidth(100)), | ||
| 661 | + color: Color.fromRGBO(249, 249, 249, 1), | ||
| 662 | + child: item(_selectNumber))), | ||
| 663 | + Container( | ||
| 664 | + width: double.infinity, | ||
| 665 | + height: ScreenUtil().setHeight(84), | ||
| 666 | + margin: EdgeInsets.only( | ||
| 667 | + bottom: ScreenUtil().setWidth(50)), | ||
| 668 | + padding: EdgeInsets.symmetric( | ||
| 669 | + horizontal: ScreenUtil().setWidth(31)), | ||
| 670 | + alignment: Alignment.center, | ||
| 671 | + color: MyColours.color_ffffff, | ||
| 672 | + child: CommonButton( | ||
| 673 | + // content: widget.fromPage == 'tablePhoto' | ||
| 674 | + // ? '确定' | ||
| 675 | + // : "已选${selectNum}个 确定", | ||
| 676 | + content: '确定', | ||
| 677 | + width: 300, | ||
| 678 | + height: 84, | ||
| 679 | + fontSize: 34, | ||
| 680 | + state: 1, | ||
| 681 | + onPress: () { | ||
| 682 | + if (widget.fromPage == "tablePhoto") { | ||
| 683 | + Map temp = { | ||
| 684 | + 'tid': selectTables.length > 0 | ||
| 685 | + ? selectTables[0].id | ||
| 686 | + : '', | ||
| 687 | + 'tname': selectTables.length > 0 | ||
| 688 | + ? selectTables[0].name | ||
| 689 | + : '' | ||
| 690 | + }; | ||
| 691 | + Navigator.of(context).pop(temp); | ||
| 692 | + } else { | ||
| 693 | + if (widget.canChoose) { | ||
| 694 | + // if (widget.tableList.length > 0) { | ||
| 695 | + String tid = ""; | ||
| 696 | + for (TableList table in widget.tableList) { | ||
| 697 | + tid += table.id + ","; | ||
| 698 | + } | ||
| 699 | + if (widget.tableList.length > 0) { | ||
| 700 | + tid = tid.substring(0, tid.length - 1); | ||
| 701 | + } | ||
| 702 | + | ||
| 703 | + Map temp = { | ||
| 704 | + 'object': widget.tableList, | ||
| 705 | + 'tid': tid | ||
| 706 | + }; | ||
| 707 | + Navigator.of(context).pop(temp); | ||
| 708 | + // } | ||
| 709 | + } else { | ||
| 710 | + if (selectTables.length > 0) { | ||
| 711 | + String tid = ""; | ||
| 712 | + for (t.Table table in selectTables) { | ||
| 713 | + tid += table.id + ","; | ||
| 714 | + } | ||
| 715 | + if (selectTables.length > 0) { | ||
| 716 | + tid = tid.substring(0, tid.length - 1); | ||
| 717 | + } | ||
| 718 | + | ||
| 719 | + Map temp = { | ||
| 720 | + 'object': widget.tableList, | ||
| 721 | + 'tid': tid | ||
| 722 | + }; | ||
| 723 | + Navigator.of(context).pop(temp); | ||
| 724 | + } | ||
| 725 | + } | ||
| 726 | + } | ||
| 727 | + }, | ||
| 728 | + )), | ||
| 729 | + ]); | ||
| 730 | + return Container( | ||
| 731 | + color: MyColours.color_ffffff, | ||
| 732 | + child: Row( | ||
| 733 | + children: <Widget>[ | ||
| 734 | + Container( | ||
| 735 | + width: ScreenUtil().setWidth(170), | ||
| 736 | + height: double.infinity, | ||
| 737 | + color: MyColours.color_f1f1f1, | ||
| 738 | + child: ListView.builder( | ||
| 739 | + itemBuilder: (context, index) { | ||
| 740 | + if (areas.isEmpty || index == areas.length) { | ||
| 741 | + return InkWell( | ||
| 742 | + onTap: () async { | ||
| 743 | + //添加区域弹框 | ||
| 744 | + await DialogUtil.openCreateAreaDialog(context, | ||
| 745 | + onTap: (value) async { | ||
| 746 | + print(value); | ||
| 747 | + //添加区域 | ||
| 748 | + bool success = await _chooseTableModel | ||
| 749 | + .addTableAreas(context, value); | ||
| 750 | + print(success); | ||
| 751 | + if (success) { | ||
| 752 | + Utils.showToast('添加成功!'); | ||
| 753 | + | ||
| 754 | + await getTableList(needLoading: false); | ||
| 755 | + } | ||
| 756 | + }); | ||
| 757 | + }, | ||
| 758 | + child: Center( | ||
| 759 | + child: Image.asset( | ||
| 760 | + Utils.getImgPath('add_area'), | ||
| 761 | + width: ScreenUtil().setWidth(32)), | ||
| 762 | + ), | ||
| 763 | + ); | ||
| 764 | + } else { | ||
| 765 | + return AreaItem(areas[index], currentArea, | ||
| 766 | + (area) { | ||
| 767 | + setState(() { | ||
| 768 | + currentArea = (area as Area).name; | ||
| 769 | + }); | ||
| 770 | + }); | ||
| 771 | + } | ||
| 772 | + }, | ||
| 773 | + itemExtent: ScreenUtil().setHeight(207), | ||
| 774 | + itemCount: areas.length + 1, | ||
| 775 | + ), | ||
| 776 | + ), | ||
| 777 | + Expanded( | ||
| 778 | + child: Padding( | ||
| 779 | + padding: EdgeInsets.symmetric( | ||
| 780 | + vertical: ScreenUtil().setHeight(10), | ||
| 781 | + horizontal: ScreenUtil().setWidth(9)), | ||
| 782 | + child: Column( | ||
| 783 | + children: [ | ||
| 784 | + Expanded( | ||
| 785 | + child: GridView.builder( | ||
| 786 | + gridDelegate: | ||
| 787 | + SliverGridDelegateWithFixedCrossAxisCount( | ||
| 788 | + crossAxisCount: 3, | ||
| 789 | + childAspectRatio: 8 / 9), | ||
| 790 | + itemBuilder: (context, index) { | ||
| 791 | + if (index == | ||
| 792 | + areaTableMap[currentArea].length || | ||
| 793 | + areaTableMap[currentArea].length == 0) { | ||
| 794 | + return InkWell( | ||
| 795 | + onTap: () async { | ||
| 796 | + List<String> areasTemp = []; | ||
| 797 | + for (int i = 0; | ||
| 798 | + i < areas.length; | ||
| 799 | + i++) { | ||
| 800 | + areasTemp.add(areas[i].name); | ||
| 801 | + } | ||
| 802 | + | ||
| 803 | + //添加桌位弹框 | ||
| 804 | + await DialogUtil | ||
| 805 | + .openCreateTableDialog( | ||
| 806 | + context, | ||
| 807 | + areasTemp, | ||
| 808 | + areasTemp | ||
| 809 | + .indexOf(currentArea), | ||
| 810 | + personNumList, onTap: | ||
| 811 | + (Map<String, String> | ||
| 812 | + value) async { | ||
| 813 | + print(value); | ||
| 814 | + // 'areaname': | ||
| 815 | + // areas[currentAreaIndex], | ||
| 816 | + // 'name': controller.text, | ||
| 817 | + // 'pnumMin': pnumMin, | ||
| 818 | + // 'pnumMax': pnumMax | ||
| 819 | + //添加桌位 接口参数带整合??? | ||
| 820 | + // 以下是旧的不去,明天添加桌位接口 | ||
| 821 | + String rid; | ||
| 822 | + for (Area item in areas) { | ||
| 823 | + if (item.name == | ||
| 824 | + value['areaname']) { | ||
| 825 | + rid = item.rid; | ||
| 826 | + } | ||
| 827 | + } | ||
| 828 | + Map<String, String> params = { | ||
| 829 | + 'rid': rid, | ||
| 830 | + 'name': value['name'], | ||
| 831 | + }; | ||
| 832 | + if (value['pnumMin'] != '') { | ||
| 833 | + params['pnum'] = | ||
| 834 | + value['pnumMin']; | ||
| 835 | + } | ||
| 836 | + if (value['pnumMax'] != '') { | ||
| 837 | + params['most_pnum'] = | ||
| 838 | + value['pnumMax']; | ||
| 839 | + } | ||
| 840 | + bool success = | ||
| 841 | + await _chooseTableModel | ||
| 842 | + .addTable( | ||
| 843 | + context, params); | ||
| 844 | + print(success); | ||
| 845 | + if (success) { | ||
| 846 | + Utils.showToast('添加成功!'); | ||
| 847 | + refreshTable(context); | ||
| 848 | + } | ||
| 849 | + }); | ||
| 850 | + }, | ||
| 851 | + child: Container( | ||
| 852 | + margin: EdgeInsets.all( | ||
| 853 | + ScreenUtil().setWidth(15)), | ||
| 854 | + child: DottedBorder( | ||
| 855 | + dashPattern: [5, 5, 5, 5], | ||
| 856 | + borderType: BorderType.RRect, | ||
| 857 | + radius: Radius.circular( | ||
| 858 | + ScreenUtil().setWidth(10)), | ||
| 859 | + // padding: EdgeInsets.all(ScreenUtil().setWidth(70)), | ||
| 860 | + color: MyColours.color_199095, | ||
| 861 | + strokeWidth: | ||
| 862 | + ScreenUtil().setWidth(2), | ||
| 863 | + child: ClipRRect( | ||
| 864 | + borderRadius: BorderRadius | ||
| 865 | + .all(Radius.circular( | ||
| 866 | + ScreenUtil() | ||
| 867 | + .setWidth(10))), | ||
| 868 | + child: Container( | ||
| 869 | + height: ScreenUtil() | ||
| 870 | + .setWidth(90 * 2), | ||
| 871 | + width: ScreenUtil() | ||
| 872 | + .setWidth(80 * 2), | ||
| 873 | + child: Column( | ||
| 874 | + mainAxisAlignment: | ||
| 875 | + MainAxisAlignment | ||
| 876 | + .center, | ||
| 877 | + children: [ | ||
| 878 | + Image.asset( | ||
| 879 | + Utils.getImgPath( | ||
| 880 | + 'add_area'), | ||
| 881 | + width: ScreenUtil() | ||
| 882 | + .setWidth(32)), | ||
| 883 | + ], | ||
| 884 | + ), | ||
| 885 | + ), | ||
| 886 | + ), | ||
| 887 | + ))); | ||
| 888 | + } else { | ||
| 889 | + return TableItem( | ||
| 890 | + areaTableMap[currentArea][index], | ||
| 891 | + onSelected: (t.Table table) { | ||
| 892 | + if (widget.fromPage == 'tablePhoto') { | ||
| 893 | + for (String item | ||
| 894 | + in areaTableMap.keys) { | ||
| 895 | + for (t.Table item | ||
| 896 | + in areaTableMap[item]) { | ||
| 897 | + item.selected = false; | ||
| 898 | + selectNum = 0; | ||
| 899 | + if (table.id == item.id) { | ||
| 900 | + item.selected = true; | ||
| 901 | + selectTables = []; | ||
| 902 | + selectNum++; | ||
| 903 | + selectTables.add(table); | ||
| 904 | + } | ||
| 905 | + } | ||
| 906 | + } | ||
| 907 | + setState(() {}); | ||
| 908 | + } else { | ||
| 909 | + if ((table as t.Table).selected) { | ||
| 910 | + selectTables.add(table); | ||
| 911 | + | ||
| 912 | + selectNum++; | ||
| 913 | + | ||
| 914 | + widget.tableList | ||
| 915 | + .add(tableToTableList(table)); | ||
| 916 | + } else { | ||
| 917 | + widget.tableList.removeWhere( | ||
| 918 | + (t) => t.id == table.id); | ||
| 919 | + | ||
| 920 | + selectNum--; | ||
| 921 | + | ||
| 922 | + selectTables.removeWhere( | ||
| 923 | + (t) => t.id == table.id); | ||
| 924 | + } | ||
| 925 | + setState(() {}); | ||
| 926 | + } | ||
| 927 | + }, | ||
| 928 | + canSelected: true, | ||
| 929 | + fromPage: widget.fromPage, | ||
| 930 | + tableMap: tableMap, | ||
| 931 | + rid: widget.rid); | ||
| 932 | + } | ||
| 933 | + }, | ||
| 934 | + itemCount: currentArea == null | ||
| 935 | + ? 0 | ||
| 936 | + : areaTableMap[currentArea].length + 1, | ||
| 937 | + )), | ||
| 938 | + Container( | ||
| 939 | + width: double.infinity, | ||
| 940 | + height: ScreenUtil().setHeight(84), | ||
| 941 | + margin: EdgeInsets.only( | ||
| 942 | + bottom: ScreenUtil().setWidth(50)), | ||
| 943 | + padding: EdgeInsets.symmetric( | ||
| 944 | + horizontal: ScreenUtil().setWidth(31)), | ||
| 945 | + alignment: Alignment.center, | ||
| 946 | + color: MyColours.color_ffffff, | ||
| 947 | + child: CommonButton( | ||
| 948 | + content: widget.fromPage == 'tablePhoto' | ||
| 949 | + ? '确定' | ||
| 950 | + : "已选${selectNum}个 确定", | ||
| 951 | + width: 500, | ||
| 952 | + height: 84, | ||
| 953 | + fontSize: 34, | ||
| 954 | + state: 1, | ||
| 955 | + onPress: () { | ||
| 956 | + if (widget.fromPage == "tablePhoto") { | ||
| 957 | + Map temp = { | ||
| 958 | + 'tid': selectTables.length > 0 | ||
| 959 | + ? selectTables[0].id | ||
| 960 | + : '', | ||
| 961 | + 'tname': selectTables.length > 0 | ||
| 962 | + ? selectTables[0].name | ||
| 963 | + : '' | ||
| 964 | + }; | ||
| 965 | + Navigator.of(context).pop(temp); | ||
| 966 | + } else { | ||
| 967 | + if (widget.canChoose) { | ||
| 968 | + // if (widget.tableList.length > 0) { | ||
| 969 | + String tid = ""; | ||
| 970 | + for (TableList table | ||
| 971 | + in widget.tableList) { | ||
| 972 | + tid += table.id + ","; | ||
| 973 | + } | ||
| 974 | + if (widget.tableList.length > 0) { | ||
| 975 | + tid = tid.substring( | ||
| 976 | + 0, tid.length - 1); | ||
| 977 | + } | ||
| 978 | + | ||
| 979 | + Map temp = { | ||
| 980 | + 'object': widget.tableList, | ||
| 981 | + 'tid': tid | ||
| 982 | + }; | ||
| 983 | + Navigator.of(context).pop(temp); | ||
| 984 | + // } | ||
| 985 | + } else { | ||
| 986 | + if (selectTables.length > 0) { | ||
| 987 | + String tid = ""; | ||
| 988 | + for (t.Table table | ||
| 989 | + in selectTables) { | ||
| 990 | + tid += table.id + ","; | ||
| 991 | + } | ||
| 992 | + if (selectTables.length > 0) { | ||
| 993 | + tid = tid.substring( | ||
| 994 | + 0, tid.length - 1); | ||
| 995 | + } | ||
| 996 | + | ||
| 997 | + Map temp = { | ||
| 998 | + 'object': widget.tableList, | ||
| 999 | + 'tid': tid | ||
| 1000 | + }; | ||
| 1001 | + Navigator.of(context).pop(temp); | ||
| 1002 | + } | ||
| 1003 | + } | ||
| 1004 | + } | ||
| 1005 | + }, | ||
| 1006 | + )), | ||
| 1007 | + ], | ||
| 1008 | + )), | ||
| 1009 | + ) | ||
| 1010 | + ], | ||
| 1011 | + ), | ||
| 1012 | + ); | ||
| 1013 | + } | ||
| 1014 | + }), | ||
| 1015 | + ), | ||
| 1016 | + ], | ||
| 1017 | + ), | ||
| 1018 | + )); | ||
| 1019 | + } | ||
| 1020 | + | ||
| 1021 | + tableToTableList(t.Table table) { | ||
| 1022 | + TableList _tableList = TableList( | ||
| 1023 | + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); | ||
| 1024 | + _tableList.id = table.id; | ||
| 1025 | + _tableList.rid = table.rid; | ||
| 1026 | + _tableList.tid = table.tid; | ||
| 1027 | + _tableList.name = table.name; | ||
| 1028 | + _tableList.tablePnum = table.table_pnum; | ||
| 1029 | + _tableList.sellerid = null; | ||
| 1030 | + _tableList.qrcode = null; | ||
| 1031 | + _tableList.mostPnum = table.most_pnum; | ||
| 1032 | + _tableList.hot = null; | ||
| 1033 | + _tableList.orderO = table.order_o; | ||
| 1034 | + _tableList.status = table.status; | ||
| 1035 | + _tableList.enable = table.enable; | ||
| 1036 | + _tableList.spell = table.spell; | ||
| 1037 | + _tableList.cdate = null; | ||
| 1038 | + _tableList.rname = table.rname; | ||
| 1039 | + _tableList.regionName = table.rname; | ||
| 1040 | + _tableList.selected = true; | ||
| 1041 | + return _tableList; | ||
| 1042 | + } | ||
| 1043 | +} |
| @@ -16,6 +16,19 @@ class ChooseTableModel with ChangeNotifier { | @@ -16,6 +16,19 @@ class ChooseTableModel with ChangeNotifier { | ||
| 16 | PageState pageState = PageState.Loading; | 16 | PageState pageState = PageState.Loading; |
| 17 | List<TableOuter> tableOuterList = []; //区域-桌位列表 | 17 | List<TableOuter> tableOuterList = []; //区域-桌位列表 |
| 18 | 18 | ||
| 19 | + bool swichState = false; //仅看空座 | ||
| 20 | + | ||
| 21 | + Map<String, List<t.Table>> areaTableMap = {}; //区域-桌位Map 已预订和空桌子 | ||
| 22 | + Map<String, List<t.Table>> areaTableMapCanNote = | ||
| 23 | + {}; //区域-桌位Map 筛选出已经预订的桌子,剩余空桌子 | ||
| 24 | + | ||
| 25 | + Map<String, List<t.Table>> areaTableMapShow; ////区域-桌位Map 页面展示用(全部或者只看空桌子) | ||
| 26 | + List<t.Table> currentTables = []; //当前显示的区域-桌位 | ||
| 27 | + | ||
| 28 | + List<t.Table> tablesAll = []; //全部桌子(已预订和空桌子) | ||
| 29 | + List<t.Table> tablesCanNote = []; //全部桌子(空桌子) | ||
| 30 | + List<t.Table> tablesShow = []; //页面展示 | ||
| 31 | + | ||
| 19 | //获取桌位数据 | 32 | //获取桌位数据 |
| 20 | Future<List<TableOuter>> getTableList( | 33 | Future<List<TableOuter>> getTableList( |
| 21 | BuildContext context, Map<String, String> params, | 34 | BuildContext context, Map<String, String> params, |
| @@ -55,12 +68,14 @@ class ChooseTableModel with ChangeNotifier { | @@ -55,12 +68,14 @@ class ChooseTableModel with ChangeNotifier { | ||
| 55 | notifyListeners(); | 68 | notifyListeners(); |
| 56 | return []; | 69 | return []; |
| 57 | } | 70 | } |
| 71 | + | ||
| 58 | tableOuterList = (baseResp.data[0] as List).map((value) { | 72 | tableOuterList = (baseResp.data[0] as List).map((value) { |
| 59 | TableOuter tableOuter = TableOuter(); | 73 | TableOuter tableOuter = TableOuter(); |
| 60 | tableOuter.name = value["name"]; | 74 | tableOuter.name = value["name"]; |
| 61 | tableOuter.list = (value["list"] as List).map((table) { | 75 | tableOuter.list = (value["list"] as List).map((table) { |
| 62 | return t.Table.fromJson(table as Map<String, dynamic>); | 76 | return t.Table.fromJson(table as Map<String, dynamic>); |
| 63 | }).toList(); | 77 | }).toList(); |
| 78 | + | ||
| 64 | return tableOuter; | 79 | return tableOuter; |
| 65 | }).toList(); | 80 | }).toList(); |
| 66 | } | 81 | } |
| @@ -33,11 +33,21 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -33,11 +33,21 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 33 | List<TableList> tableList = []; | 33 | List<TableList> tableList = []; |
| 34 | String isSetDate = '0'; | 34 | String isSetDate = '0'; |
| 35 | List<TableList> recommendList = []; //推荐列表 | 35 | List<TableList> recommendList = []; //推荐列表 |
| 36 | - bool isRecommend = false; //是否展示推荐 | 36 | + // bool isRecommend = false; //是否展示推荐 |
| 37 | List oldTableList = []; | 37 | List oldTableList = []; |
| 38 | 38 | ||
| 39 | List<UserHistoryEntity> userHistorys = []; //历史录入 | 39 | List<UserHistoryEntity> userHistorys = []; //历史录入 |
| 40 | 40 | ||
| 41 | + DateTime dateTimeSelect; | ||
| 42 | + DateTime dateTime = DateTime.now(); | ||
| 43 | + | ||
| 44 | + String dateText = ""; //当前显示日期时间 | ||
| 45 | + | ||
| 46 | + int currTimeIndex = 1; | ||
| 47 | + String morning; //早市时间段 | ||
| 48 | + String noon; //午市时间段 | ||
| 49 | + String night; //晚市时间段 | ||
| 50 | + | ||
| 41 | clearData() { | 51 | clearData() { |
| 42 | dateList = []; //日期选择 月-日 某天 | 52 | dateList = []; //日期选择 月-日 某天 |
| 43 | sunDateList = []; // 早市、午市、晚市 | 53 | sunDateList = []; // 早市、午市、晚市 |
| @@ -68,53 +78,55 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -68,53 +78,55 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 68 | } | 78 | } |
| 69 | 79 | ||
| 70 | _initDateList(); | 80 | _initDateList(); |
| 71 | - _initPersonNumList(); | 81 | + |
| 72 | _initSexList(); | 82 | _initSexList(); |
| 73 | } | 83 | } |
| 74 | 84 | ||
| 75 | ///初始化 日期选择 月-日 某天 | 85 | ///初始化 日期选择 月-日 某天 |
| 76 | _initDateList() { | 86 | _initDateList() { |
| 77 | String createtime = detailEntity.ddate.toString() + '000'; | 87 | String createtime = detailEntity.ddate.toString() + '000'; |
| 78 | - DateTime createTime = | ||
| 79 | - DateTime.fromMillisecondsSinceEpoch(int.parse(createtime)); | ||
| 80 | - ddateStr = DateUtil.formatDate(createTime, format: DateFormats.h_m); | 88 | + dateTime = DateTime.fromMillisecondsSinceEpoch(int.parse(createtime)); |
| 89 | + ddateStr = DateUtil.formatDate(dateTime, format: DateFormats.h_m); | ||
| 90 | + dateText = _returnDate(dateTime); | ||
| 81 | String dateTimeSelect = DateUtil.formatDateMs( | 91 | String dateTimeSelect = DateUtil.formatDateMs( |
| 82 | - createTime.millisecondsSinceEpoch, | 92 | + dateTime.millisecondsSinceEpoch, |
| 83 | format: 'yyyy-MM-dd'); | 93 | format: 'yyyy-MM-dd'); |
| 84 | - //今天 | ||
| 85 | - DateTime dateTime = DateTime.now(); | ||
| 86 | - int dateTimeMill = dateTime.millisecondsSinceEpoch; | ||
| 87 | - String dateText = DateUtil.formatDateMs(dateTimeMill, format: 'yyyy-MM-dd'); | ||
| 88 | - dateList.add({ | ||
| 89 | - 'title': dateText, | ||
| 90 | - 'select': dateTimeSelect == dateText ? true : false, | ||
| 91 | - 'fontSize': 34.0, | ||
| 92 | - 'dayText': ' 今天', | ||
| 93 | - 'isImage': false | ||
| 94 | - }); | ||
| 95 | - //明天 | ||
| 96 | - int tomorrowMill = dateTimeMill + 24 * 60 * 60 * 1000; | ||
| 97 | - String dateTextTomorrow = | ||
| 98 | - DateUtil.formatDateMs(tomorrowMill, format: 'yyyy-MM-dd'); | ||
| 99 | - dateList.add({ | ||
| 100 | - 'title': dateTextTomorrow, | ||
| 101 | - 'select': dateTimeSelect == dateTextTomorrow ? true : false, | ||
| 102 | - 'fontSize': 34.0, | ||
| 103 | - 'dayText': ' 明天', | ||
| 104 | - 'isImage': false | ||
| 105 | - }); | ||
| 106 | - //第三个 | ||
| 107 | - dateList.add({ | ||
| 108 | - 'title': dateTimeSelect != dateText && dateTimeSelect != dateTextTomorrow | ||
| 109 | - ? dateTimeSelect | ||
| 110 | - : '其他', | ||
| 111 | - 'select': dateTimeSelect != dateText && dateTimeSelect != dateTextTomorrow | ||
| 112 | - ? true | ||
| 113 | - : false, | ||
| 114 | - 'fontSize': 30.0, | ||
| 115 | - 'dayText': '', | ||
| 116 | - 'isImage': true | ||
| 117 | - }); | 94 | + } |
| 95 | + | ||
| 96 | + //生成日期文本 | ||
| 97 | + createDateText(BuildContext context, DateTime day) { | ||
| 98 | + if (Utils.isOneDay(day, dateTime)) return; //日期没变 | ||
| 99 | + dateTimeSelect = day; | ||
| 100 | + dateText = _returnDate(day); | ||
| 101 | + dateTime = day; | ||
| 102 | + // getReserveList(context, needLoading: false); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + _returnDate(DateTime day) { | ||
| 106 | + String time = Utils.lunarCalendarHolidays(day); | ||
| 107 | + String date = _returnDayDateWeek(day); | ||
| 108 | + date += ' ${time}'; | ||
| 109 | + return date; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + String _returnDayDateWeek(DateTime day) { | ||
| 113 | + String date = ''; | ||
| 114 | + DateTime dateNow = DateTime.now(); | ||
| 115 | + String ymd = "${day.year}-" + | ||
| 116 | + Utils.addZeroNumber(day.month) + | ||
| 117 | + "-" + | ||
| 118 | + Utils.addZeroNumber(day.day); | ||
| 119 | + | ||
| 120 | + if (Utils.isOneDay(day, dateNow)) { | ||
| 121 | + date += "今天 "; | ||
| 122 | + } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 1)))) { | ||
| 123 | + date += "明天 "; | ||
| 124 | + } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 2)))) { | ||
| 125 | + date += "后天 "; | ||
| 126 | + } | ||
| 127 | + date += ymd; | ||
| 128 | + date += " 星期${Utils.formatWeekDayNum(day.weekday)}"; | ||
| 129 | + return date; | ||
| 118 | } | 130 | } |
| 119 | 131 | ||
| 120 | /// 初始化 早市、午市、晚市 | 132 | /// 初始化 早市、午市、晚市 |
| @@ -151,64 +163,6 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -151,64 +163,6 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 151 | notifyListeners(); | 163 | notifyListeners(); |
| 152 | } | 164 | } |
| 153 | 165 | ||
| 154 | - //人数 | ||
| 155 | - _initPersonNumList() { | ||
| 156 | - String pnum = detailEntity.pnum; | ||
| 157 | - if (int.parse(pnum) < 6 || int.parse(pnum) > 10) { | ||
| 158 | - numController.text = pnum; | ||
| 159 | - } | ||
| 160 | - personNumList = [ | ||
| 161 | - { | ||
| 162 | - 'dateText': '6', | ||
| 163 | - 'width': 30.0, | ||
| 164 | - 'fontSize': 34.0, | ||
| 165 | - 'isImage': false, | ||
| 166 | - 'isSelect': pnum == '6' ? true : false, | ||
| 167 | - 'isTextFiled': false | ||
| 168 | - }, | ||
| 169 | - { | ||
| 170 | - 'dateText': '7', | ||
| 171 | - 'width': 30.0, | ||
| 172 | - 'fontSize': 34.0, | ||
| 173 | - 'isImage': false, | ||
| 174 | - 'isSelect': pnum == '7' ? true : false, | ||
| 175 | - 'isTextFiled': false | ||
| 176 | - }, | ||
| 177 | - { | ||
| 178 | - 'dateText': '8', | ||
| 179 | - 'width': 30.0, | ||
| 180 | - 'fontSize': 34.0, | ||
| 181 | - 'isImage': false, | ||
| 182 | - 'isSelect': pnum == '8' ? true : false, | ||
| 183 | - 'isTextFiled': false | ||
| 184 | - }, | ||
| 185 | - { | ||
| 186 | - 'dateText': '9', | ||
| 187 | - 'width': 30.0, | ||
| 188 | - 'fontSize': 34.0, | ||
| 189 | - 'isImage': false, | ||
| 190 | - 'isSelect': pnum == '9' ? true : false, | ||
| 191 | - 'isTextFiled': false | ||
| 192 | - }, | ||
| 193 | - { | ||
| 194 | - 'dateText': '10', | ||
| 195 | - 'width': 30.0, | ||
| 196 | - 'fontSize': 34.0, | ||
| 197 | - 'isImage': false, | ||
| 198 | - 'isSelect': pnum == '10' ? true : false, | ||
| 199 | - 'isTextFiled': false | ||
| 200 | - }, | ||
| 201 | - { | ||
| 202 | - 'dateText': numController.text.length > 0 ? numController.text : '更多', | ||
| 203 | - 'width': 105.0, | ||
| 204 | - 'fontSize': 30.0, | ||
| 205 | - 'isImage': true, | ||
| 206 | - 'isSelect': int.parse(pnum) < 6 || int.parse(pnum) > 10 ? true : false, | ||
| 207 | - 'isTextFiled': true | ||
| 208 | - } | ||
| 209 | - ]; | ||
| 210 | - } | ||
| 211 | - | ||
| 212 | ///称谓 | 166 | ///称谓 |
| 213 | _initSexList() { | 167 | _initSexList() { |
| 214 | String sexStr = detailEntity.sex; | 168 | String sexStr = detailEntity.sex; |
| @@ -237,6 +191,10 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -237,6 +191,10 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 237 | /// 早市、午市、晚市对应的半个小时间隔时间段 | 191 | /// 早市、午市、晚市对应的半个小时间隔时间段 |
| 238 | initDateHourMinuteList(BuildContext context) async { | 192 | initDateHourMinuteList(BuildContext context) async { |
| 239 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 193 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 194 | + morning = | ||
| 195 | + userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; | ||
| 196 | + noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon; | ||
| 197 | + night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night; | ||
| 240 | userModel.user.morning == '' | 198 | userModel.user.morning == '' |
| 241 | ? dailyMap.putIfAbsent('morning', () => '') | 199 | ? dailyMap.putIfAbsent('morning', () => '') |
| 242 | : dailyMap.putIfAbsent( | 200 | : dailyMap.putIfAbsent( |
| @@ -249,8 +207,8 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -249,8 +207,8 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 249 | ? dailyMap.putIfAbsent('night', () => '') | 207 | ? dailyMap.putIfAbsent('night', () => '') |
| 250 | : dailyMap.putIfAbsent( | 208 | : dailyMap.putIfAbsent( |
| 251 | 'night', () => _getHourAndMinute(userModel.user.night, 3)); | 209 | 'night', () => _getHourAndMinute(userModel.user.night, 3)); |
| 252 | - _initSunDateList( | ||
| 253 | - userModel.user.morning, userModel.user.noon, userModel.user.night); | 210 | + // _initSunDateList( |
| 211 | + // userModel.user.morning, userModel.user.noon, userModel.user.night); | ||
| 254 | } | 212 | } |
| 255 | 213 | ||
| 256 | //根据获取时间 11:00-12:30 获取30分钟间隔组装的数组 | 214 | //根据获取时间 11:00-12:30 获取30分钟间隔组装的数组 |
| @@ -450,9 +408,6 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -450,9 +408,6 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 450 | ///根据商家ID 获取桌位信息列表: 1:散座 2:包间 默认:获取所有数据 | 408 | ///根据商家ID 获取桌位信息列表: 1:散座 2:包间 默认:获取所有数据 |
| 451 | Future<List<TableList>> getNewTableList(BuildContext context, String ddate, | 409 | Future<List<TableList>> getNewTableList(BuildContext context, String ddate, |
| 452 | String ddate_solt, String pnum, List oldTableList) async { | 410 | String ddate_solt, String pnum, List oldTableList) async { |
| 453 | - if (pnum == '') { | ||
| 454 | - pnum = '6'; | ||
| 455 | - } | ||
| 456 | DateTime createTime = DateTime.fromMillisecondsSinceEpoch(int.parse(ddate)); | 411 | DateTime createTime = DateTime.fromMillisecondsSinceEpoch(int.parse(ddate)); |
| 457 | String rdate = DateUtil.formatDate(createTime, format: "yyyyMMdd"); | 412 | String rdate = DateUtil.formatDate(createTime, format: "yyyyMMdd"); |
| 458 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 413 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| @@ -460,8 +415,10 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -460,8 +415,10 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 460 | "sid": userModel.user.sellerid, | 415 | "sid": userModel.user.sellerid, |
| 461 | "rdate": rdate, | 416 | "rdate": rdate, |
| 462 | 'ddate_solt': ddate_solt, | 417 | 'ddate_solt': ddate_solt, |
| 463 | - 'pnum': pnum | ||
| 464 | }; | 418 | }; |
| 419 | + if (pnum != null && pnum != '') { | ||
| 420 | + params['pnum'] = pnum; | ||
| 421 | + } | ||
| 465 | if (detailEntity.id.isNotEmpty && detailEntity.id != "-1") { | 422 | if (detailEntity.id.isNotEmpty && detailEntity.id != "-1") { |
| 466 | params['rid'] = detailEntity.id; | 423 | params['rid'] = detailEntity.id; |
| 467 | } | 424 | } |
| @@ -561,12 +518,12 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -561,12 +518,12 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 561 | // } | 518 | // } |
| 562 | // } | 519 | // } |
| 563 | 520 | ||
| 564 | - if (tableList.length == 0) { | ||
| 565 | - // Utils.showToast('包间已经被预订'); | ||
| 566 | - isRecommend = true; | ||
| 567 | - } else { | ||
| 568 | - isRecommend = false; | ||
| 569 | - } | 521 | + // if (tableList.length == 0) { |
| 522 | + // // Utils.showToast('包间已经被预订'); | ||
| 523 | + // isRecommend = true; | ||
| 524 | + // } else { | ||
| 525 | + // isRecommend = false; | ||
| 526 | + // } | ||
| 570 | print(tableList); | 527 | print(tableList); |
| 571 | notifyListeners(); | 528 | notifyListeners(); |
| 572 | return tableList; | 529 | return tableList; |
| @@ -576,35 +533,23 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -576,35 +533,23 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 576 | ///录入更改内部预订 | 533 | ///录入更改内部预订 |
| 577 | Future<SunReserveInfoModel> setReserveInfo(BuildContext context) async { | 534 | Future<SunReserveInfoModel> setReserveInfo(BuildContext context) async { |
| 578 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 535 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 579 | - String pnum = ''; | ||
| 580 | - for (var item in personNumList) { | ||
| 581 | - if (item['isSelect']) { | ||
| 582 | - pnum = item['dateText']; | ||
| 583 | - } | ||
| 584 | - } | ||
| 585 | - // if (pnum == '') { | ||
| 586 | - // pnum = '6'; | 536 | + |
| 537 | + // String tempTime; | ||
| 538 | + // if (currTimeIndex == 1) { | ||
| 539 | + // tempTime = '08:00'; | ||
| 540 | + // } else if (currTimeIndex == 2) { | ||
| 541 | + // tempTime = '12:00'; | ||
| 542 | + // } else if (currTimeIndex == 3) { | ||
| 543 | + // tempTime = '18:00'; | ||
| 587 | // } | 544 | // } |
| 588 | - String sex = '1'; | ||
| 589 | - for (var item in sexList) { | ||
| 590 | - if (item['select']) { | ||
| 591 | - sex = item['code']; | ||
| 592 | - } | ||
| 593 | - } | ||
| 594 | - //当前选中 年-月-日string | ||
| 595 | - String ymyStr = ""; | ||
| 596 | - //今天 明天 其他天 | ||
| 597 | - for (var item in dateList) { | ||
| 598 | - if (item['select'] == true) { | ||
| 599 | - ymyStr = item['title']; | ||
| 600 | - } | ||
| 601 | - } | ||
| 602 | - String timeStr = ymyStr + ' ' + ddateStr + ':00'; | 545 | + String ymd = DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d); |
| 546 | + // String timeStr = ymd + ' ' + tempTime + ':00'; | ||
| 547 | + // int start = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 603 | // int start = DateUtil.getDateMsByTimeStr(timeStr); | 548 | // int start = DateUtil.getDateMsByTimeStr(timeStr); |
| 604 | 549 | ||
| 605 | - LogUtil.v(timeStr); | 550 | + // LogUtil.v(timeStr); |
| 606 | // String tempDdate = ymyStr + ' ' + ddateStr + ':00'; | 551 | // String tempDdate = ymyStr + ' ' + ddateStr + ':00'; |
| 607 | - int ddate = DateUtil.getDateMsByTimeStr(timeStr); | 552 | + |
| 608 | String tableSelectInfo = ''; | 553 | String tableSelectInfo = ''; |
| 609 | for (TableList item in tableList) { | 554 | for (TableList item in tableList) { |
| 610 | // if (item.selected) { | 555 | // if (item.selected) { |
| @@ -617,53 +562,61 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -617,53 +562,61 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 617 | } | 562 | } |
| 618 | print(tableSelectInfo); | 563 | print(tableSelectInfo); |
| 619 | String rdate = ''; | 564 | String rdate = ''; |
| 620 | - String ddateSolt = ''; | ||
| 621 | - print(sunDateList); | ||
| 622 | - for (var item in sunDateList) { | ||
| 623 | - if (item['isSelect'] == true) { | ||
| 624 | - String keys = ''; | ||
| 625 | - ddateSolt = '${item['ddateSolt']}'; | ||
| 626 | - if (item['ddateSolt'] == 1) { | ||
| 627 | - //早市 | ||
| 628 | - keys = 'morning'; | ||
| 629 | - } else if (item['ddateSolt'] == 2) { | ||
| 630 | - //午市 | ||
| 631 | - keys = 'noon'; | ||
| 632 | - } else if (item['ddateSolt'] == 3) { | ||
| 633 | - //晚市 | ||
| 634 | - keys = 'night'; | ||
| 635 | - } | ||
| 636 | - if (keys != '') { | ||
| 637 | - List temp = dailyMap[keys]; | ||
| 638 | - String timeStrStart = ymyStr + ' ' + temp.first['title'] + ':00'; | ||
| 639 | - String timeStrEnd = ymyStr + ' ' + temp.last['title'] + ':00'; | ||
| 640 | - int startM = DateUtil.getDateMsByTimeStr(timeStrStart); | ||
| 641 | - int endM = DateUtil.getDateMsByTimeStr(timeStrEnd); | ||
| 642 | - String start = '${startM}'.substring(0, 10); | ||
| 643 | - String end = '${endM}'.substring(0, 10); | ||
| 644 | - rdate = start + '-' + end; | ||
| 645 | - } | ||
| 646 | - } | 565 | + |
| 566 | + String keys = ''; | ||
| 567 | + | ||
| 568 | + if (currTimeIndex == 1) { | ||
| 569 | + //早市 | ||
| 570 | + keys = 'morning'; | ||
| 571 | + } else if (currTimeIndex == 2) { | ||
| 572 | + //午市 | ||
| 573 | + keys = 'noon'; | ||
| 574 | + } else if (currTimeIndex == 3) { | ||
| 575 | + //晚市 | ||
| 576 | + keys = 'night'; | ||
| 577 | + } | ||
| 578 | + if (keys != '') { | ||
| 579 | + List temp = dailyMap[keys]; | ||
| 580 | + String timeStrStart = ymd + ' ' + temp.first['title'] + ':00'; | ||
| 581 | + String timeStrEnd = ymd + ' ' + temp.last['title'] + ':00'; | ||
| 582 | + int startM = DateUtil.getDateMsByTimeStr(timeStrStart); | ||
| 583 | + int endM = DateUtil.getDateMsByTimeStr(timeStrEnd); | ||
| 584 | + String start = '${startM}'.substring(0, 10); | ||
| 585 | + String end = '${endM}'.substring(0, 10); | ||
| 586 | + rdate = start + '-' + end; | ||
| 647 | } | 587 | } |
| 648 | Map<String, String> params = { | 588 | Map<String, String> params = { |
| 649 | "sid": userModel.user.sellerid, //商家ID | 589 | "sid": userModel.user.sellerid, //商家ID |
| 650 | "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | 590 | "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 |
| 651 | - "pnum": pnum, //预定用餐人数 | ||
| 652 | - "rname": nameController.text, //预订人姓名 | ||
| 653 | - "sex": sex, //预订人姓名:1:男 2:女 | ||
| 654 | - "phone": phoneController.text, //预订人电话 | ||
| 655 | - "cusdem": customController.text, //预订人需求:25汉字 | ||
| 656 | 'note_name': userModel.user.account, | 591 | 'note_name': userModel.user.account, |
| 657 | 'type': "0", //内部预订 | 592 | 'type': "0", //内部预订 |
| 658 | "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | 593 | "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) |
| 659 | - "ddate": '${ddate}'.substring(0, 10), //到店时间 | ||
| 660 | - 'is_set_ddate': "1", | 594 | + // 'is_set_ddate': "1", |
| 661 | "channel": '5', | 595 | "channel": '5', |
| 662 | "uid": userModel.user.openid | 596 | "uid": userModel.user.openid |
| 663 | }; | 597 | }; |
| 664 | if (detailEntity.id.isNotEmpty && detailEntity.id != "-1") { | 598 | if (detailEntity.id.isNotEmpty && detailEntity.id != "-1") { |
| 665 | params['rid'] = detailEntity.id; | 599 | params['rid'] = detailEntity.id; |
| 666 | } | 600 | } |
| 601 | + if (nameController.text.trim().length > 0) { | ||
| 602 | + String sex = '1'; | ||
| 603 | + for (var item in sexList) { | ||
| 604 | + if (item['select']) { | ||
| 605 | + sex = item['code']; | ||
| 606 | + } | ||
| 607 | + } | ||
| 608 | + | ||
| 609 | + params['rname'] = nameController.text; //预订人姓名 | ||
| 610 | + params['sex'] = sex; //预订人性别:1:男 2:女 | ||
| 611 | + } | ||
| 612 | + if (phoneController.text.trim().length > 0) { | ||
| 613 | + params['phone'] = phoneController.text; //预订人电话 | ||
| 614 | + | ||
| 615 | + } | ||
| 616 | + if (customController.text.trim().length > 0) { | ||
| 617 | + params['cusdem'] = customController.text; //预订人需求:25汉字 | ||
| 618 | + | ||
| 619 | + } | ||
| 667 | print(params); | 620 | print(params); |
| 668 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | 621 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() |
| 669 | .request<Map<String, dynamic>>( | 622 | .request<Map<String, dynamic>>( |
| @@ -76,6 +76,22 @@ class NavigatorUtil { | @@ -76,6 +76,22 @@ class NavigatorUtil { | ||
| 76 | "${Routes.select_table}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose"); | 76 | "${Routes.select_table}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose"); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | + /// 选择桌位——方硕新修改的选择桌位页面 | ||
| 80 | + static Future goSelectTableFPage( | ||
| 81 | + BuildContext context, String rid, int dateTime, String ddate_slot, | ||
| 82 | + {bool canChoose = false, | ||
| 83 | + Map object, | ||
| 84 | + String fromPage = 'change', | ||
| 85 | + String tid = ''}) { | ||
| 86 | + if (object != null) { | ||
| 87 | + return _navigateTo(context, | ||
| 88 | + "${Routes.select_table_f}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}"); | ||
| 89 | + } | ||
| 90 | + // object = {'object': [], "tid": ''}; | ||
| 91 | + return _navigateTo(context, | ||
| 92 | + "${Routes.select_table_f}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose"); | ||
| 93 | + } | ||
| 94 | + | ||
| 79 | /// 邀请函 | 95 | /// 邀请函 |
| 80 | static void goInvicationPage( | 96 | static void goInvicationPage( |
| 81 | BuildContext context, | 97 | BuildContext context, |
| @@ -111,8 +127,21 @@ class NavigatorUtil { | @@ -111,8 +127,21 @@ class NavigatorUtil { | ||
| 111 | ); | 127 | ); |
| 112 | } | 128 | } |
| 113 | 129 | ||
| 114 | - /// 变更预订 | ||
| 115 | - static void goNoteBookChangePage( | 130 | + // /// 变更预订 |
| 131 | + // static void goNoteBookChangePage( | ||
| 132 | + // BuildContext context, NotebookDetail detailEntity, String rid, | ||
| 133 | + // {replace = false}) { | ||
| 134 | + // if (detailEntity.type == "0") { | ||
| 135 | + // //内部预订 | ||
| 136 | + // detailEntity.is_set_ddate = "1"; | ||
| 137 | + // } | ||
| 138 | + // _navigateTo(context, | ||
| 139 | + // "${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid", | ||
| 140 | + // replace: replace); | ||
| 141 | + // } | ||
| 142 | + | ||
| 143 | + /// 变更预订——方硕新修改页面 | ||
| 144 | + static void goNoteBookChangeFPage( | ||
| 116 | BuildContext context, NotebookDetail detailEntity, String rid, | 145 | BuildContext context, NotebookDetail detailEntity, String rid, |
| 117 | {replace = false}) { | 146 | {replace = false}) { |
| 118 | if (detailEntity.type == "0") { | 147 | if (detailEntity.type == "0") { |
| @@ -120,7 +149,7 @@ class NavigatorUtil { | @@ -120,7 +149,7 @@ class NavigatorUtil { | ||
| 120 | detailEntity.is_set_ddate = "1"; | 149 | detailEntity.is_set_ddate = "1"; |
| 121 | } | 150 | } |
| 122 | _navigateTo(context, | 151 | _navigateTo(context, |
| 123 | - "${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid", | 152 | + "${Routes.change_detail_f}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid", |
| 124 | replace: replace); | 153 | replace: replace); |
| 125 | } | 154 | } |
| 126 | 155 |
| @@ -27,6 +27,8 @@ import 'package:one_key/pages/create_store/enter_store_time.dart'; | @@ -27,6 +27,8 @@ import 'package:one_key/pages/create_store/enter_store_time.dart'; | ||
| 27 | import 'package:one_key/pages/create_store/map_choice_point.dart'; | 27 | import 'package:one_key/pages/create_store/map_choice_point.dart'; |
| 28 | import 'package:one_key/pages/create_store/play_video.dart'; | 28 | import 'package:one_key/pages/create_store/play_video.dart'; |
| 29 | import 'package:one_key/pages/detail/notebook_detail_change_page.dart'; | 29 | import 'package:one_key/pages/detail/notebook_detail_change_page.dart'; |
| 30 | +import 'package:one_key/pages/detail/notebook_detail_change_page_f.dart'; | ||
| 31 | +import 'package:one_key/pages/detail/select_tables_f_page.dart'; | ||
| 30 | import 'package:one_key/pages/home/home_page.dart'; | 32 | import 'package:one_key/pages/home/home_page.dart'; |
| 31 | import 'package:one_key/pages/invicate/invitation_page.dart'; | 33 | import 'package:one_key/pages/invicate/invitation_page.dart'; |
| 32 | import 'package:one_key/pages/login/binding_phone.dart'; | 34 | import 'package:one_key/pages/login/binding_phone.dart'; |
| @@ -162,6 +164,33 @@ var handleSelectTableHandler = new Handler( | @@ -162,6 +164,33 @@ var handleSelectTableHandler = new Handler( | ||
| 162 | canChoose: canChoose, tableList: res, fromPage: fromPage, tid: tid)); | 164 | canChoose: canChoose, tableList: res, fromPage: fromPage, tid: tid)); |
| 163 | }); | 165 | }); |
| 164 | 166 | ||
| 167 | +// 跳转到选择桌位_方硕新修改的页面 | ||
| 168 | +var handleSelectTableFHandler = new Handler( | ||
| 169 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 170 | + String rid = params['rid'].first; | ||
| 171 | + String tid = params['tid'].first; | ||
| 172 | + DateTime dateTime = | ||
| 173 | + DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first)); | ||
| 174 | + String ddate_slot = params["ddate_slot"].first; | ||
| 175 | + String fromPage = params["fromPage"].first; | ||
| 176 | + bool canChoose = params["canChoose"].first == "true" ? true : false; | ||
| 177 | + List<TableList> res = []; | ||
| 178 | + if (params.keys.contains('object')) { | ||
| 179 | + Map object = FluroConvertUtils.string2map(params["object"].first); | ||
| 180 | + List temp = object['object']; | ||
| 181 | + | ||
| 182 | + for (var item in temp) { | ||
| 183 | + res.add(TableList.fromJson(item)); | ||
| 184 | + } | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + // return SelectTablePage(rid, dateTime, ddate_slot,canChoose: canChoose); | ||
| 188 | + return ChangeNotifierProvider<ChooseTableModel>( | ||
| 189 | + create: (_) => ChooseTableModel(), | ||
| 190 | + child: SelectTableFPage(rid, dateTime, ddate_slot, | ||
| 191 | + canChoose: canChoose, tableList: res, fromPage: fromPage, tid: tid)); | ||
| 192 | +}); | ||
| 193 | + | ||
| 165 | // 跳转到邀请函页面 | 194 | // 跳转到邀请函页面 |
| 166 | var handleInvicationHandler = new Handler( | 195 | var handleInvicationHandler = new Handler( |
| 167 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | 196 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { |
| @@ -202,7 +231,22 @@ var webPageHandler = new Handler( | @@ -202,7 +231,22 @@ var webPageHandler = new Handler( | ||
| 202 | }); | 231 | }); |
| 203 | 232 | ||
| 204 | // 跳转到变更预订 | 233 | // 跳转到变更预订 |
| 205 | -var handleChangeDetailHandler = new Handler( | 234 | +// var handleChangeDetailHandler = new Handler( |
| 235 | +// handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 236 | +// // String rid=params['rid'].first; | ||
| 237 | +// // NotebookDetail detailEntity = params["detailEntity"].first; | ||
| 238 | +// NotebookDetail detailEntity = NotebookDetail.fromJson(json | ||
| 239 | +// .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | ||
| 240 | +// String rid = params['rid'].first; | ||
| 241 | +// return ChangeNotifierProvider<NotebookDetailChangeModel>( | ||
| 242 | +// create: (_) => NotebookDetailChangeModel(detailEntity), | ||
| 243 | +// child: ChangeNotifierProvider<RemarkManagerModel>( | ||
| 244 | +// create: (_) => RemarkManagerModel(), | ||
| 245 | +// child: NoteBookChangePage(detailEntity: detailEntity, rid: rid))); | ||
| 246 | +// }); | ||
| 247 | + | ||
| 248 | +// 跳转到变更预订——方硕新修改页面 | ||
| 249 | +var noteBookChangeFPageHandle = new Handler( | ||
| 206 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | 250 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { |
| 207 | // String rid=params['rid'].first; | 251 | // String rid=params['rid'].first; |
| 208 | // NotebookDetail detailEntity = params["detailEntity"].first; | 252 | // NotebookDetail detailEntity = params["detailEntity"].first; |
| @@ -213,7 +257,7 @@ var handleChangeDetailHandler = new Handler( | @@ -213,7 +257,7 @@ var handleChangeDetailHandler = new Handler( | ||
| 213 | create: (_) => NotebookDetailChangeModel(detailEntity), | 257 | create: (_) => NotebookDetailChangeModel(detailEntity), |
| 214 | child: ChangeNotifierProvider<RemarkManagerModel>( | 258 | child: ChangeNotifierProvider<RemarkManagerModel>( |
| 215 | create: (_) => RemarkManagerModel(), | 259 | create: (_) => RemarkManagerModel(), |
| 216 | - child: NoteBookChangePage(detailEntity: detailEntity, rid: rid))); | 260 | + child: NoteBookChangeFPage(detailEntity: detailEntity, rid: rid))); |
| 217 | }); | 261 | }); |
| 218 | 262 | ||
| 219 | // 跳转可订时段管理页面 | 263 | // 跳转可订时段管理页面 |
| @@ -10,11 +10,12 @@ class Routes { | @@ -10,11 +10,12 @@ class Routes { | ||
| 10 | static String handle_online_page = "/handle_online_page"; //处理在线预订 | 10 | static String handle_online_page = "/handle_online_page"; //处理在线预订 |
| 11 | static String reserve_detail = "/reserve_detail"; //预订详情 | 11 | static String reserve_detail = "/reserve_detail"; //预订详情 |
| 12 | static String select_table = "/select_table"; //选择桌位 | 12 | static String select_table = "/select_table"; //选择桌位 |
| 13 | + static String select_table_f = "/select_table_f"; //选择桌位_方硕新修改的页面 | ||
| 13 | static String invication = "/invication"; //邀请函 | 14 | static String invication = "/invication"; //邀请函 |
| 14 | static String sms = "/sms"; //发短信 | 15 | static String sms = "/sms"; //发短信 |
| 15 | static String webview = "/webview"; //网页 | 16 | static String webview = "/webview"; //网页 |
| 16 | static String web_page = '/web_page'; //隐私协议 | 17 | static String web_page = '/web_page'; //隐私协议 |
| 17 | - static String change_detail = "/change_detail"; //变更预订 | 18 | + // static String change_detail = "/change_detail"; //变更预订 |
| 18 | static String book_time_set = "/book_time_set"; //可订时段管理 | 19 | static String book_time_set = "/book_time_set"; //可订时段管理 |
| 19 | static String receive_orders_time_set = "/receive_orders_time_set"; //接单时间管理 | 20 | static String receive_orders_time_set = "/receive_orders_time_set"; //接单时间管理 |
| 20 | static String remark_manager = "/remark_manager"; //常用备注管理 | 21 | static String remark_manager = "/remark_manager"; //常用备注管理 |
| @@ -63,6 +64,7 @@ class Routes { | @@ -63,6 +64,7 @@ class Routes { | ||
| 63 | static String personnel_password_page = "/personnel_password_page"; //密码展示页 | 64 | static String personnel_password_page = "/personnel_password_page"; //密码展示页 |
| 64 | static String personnel_password_edit_page = | 65 | static String personnel_password_edit_page = |
| 65 | "/personnel_password_edit_page"; //密码修改页 | 66 | "/personnel_password_edit_page"; //密码修改页 |
| 67 | + static String change_detail_f = "/change_detail_f"; //变更预订_方硕新修改页面 | ||
| 66 | 68 | ||
| 67 | static void configureRoutes(FluroRouter router) { | 69 | static void configureRoutes(FluroRouter router) { |
| 68 | router.notFoundHandler = new Handler( | 70 | router.notFoundHandler = new Handler( |
| @@ -75,11 +77,12 @@ class Routes { | @@ -75,11 +77,12 @@ class Routes { | ||
| 75 | router.define(handle_online_page, handler: handleOnlineHandler); | 77 | router.define(handle_online_page, handler: handleOnlineHandler); |
| 76 | router.define(reserve_detail, handler: reserveDetailHandler); | 78 | router.define(reserve_detail, handler: reserveDetailHandler); |
| 77 | router.define(select_table, handler: handleSelectTableHandler); | 79 | router.define(select_table, handler: handleSelectTableHandler); |
| 80 | + router.define(select_table_f, handler: handleSelectTableFHandler); | ||
| 78 | router.define(invication, handler: handleInvicationHandler); | 81 | router.define(invication, handler: handleInvicationHandler); |
| 79 | router.define(sms, handler: handleSmsHandler); | 82 | router.define(sms, handler: handleSmsHandler); |
| 80 | router.define(webview, handler: handleWebviewHandler); | 83 | router.define(webview, handler: handleWebviewHandler); |
| 81 | router.define(web_page, handler: webPageHandler); | 84 | router.define(web_page, handler: webPageHandler); |
| 82 | - router.define(change_detail, handler: handleChangeDetailHandler); | 85 | + // router.define(change_detail, handler: handleChangeDetailHandler); |
| 83 | router.define(book_time_set, handler: handleBookTimeSetHandler); | 86 | router.define(book_time_set, handler: handleBookTimeSetHandler); |
| 84 | router.define(receive_orders_time_set, | 87 | router.define(receive_orders_time_set, |
| 85 | handler: handleReceiveOrdersTimeSetHandler); | 88 | handler: handleReceiveOrdersTimeSetHandler); |
| @@ -134,5 +137,6 @@ class Routes { | @@ -134,5 +137,6 @@ class Routes { | ||
| 134 | handler: personnelPasswordPageHandle); | 137 | handler: personnelPasswordPageHandle); |
| 135 | router.define(personnel_password_edit_page, | 138 | router.define(personnel_password_edit_page, |
| 136 | handler: personnelPasswordEditPageHandle); | 139 | handler: personnelPasswordEditPageHandle); |
| 140 | + router.define(change_detail_f, handler: noteBookChangeFPageHandle); | ||
| 137 | } | 141 | } |
| 138 | } | 142 | } |
| @@ -10,6 +10,7 @@ import 'package:flutter_picker/flutter_picker.dart'; | @@ -10,6 +10,7 @@ import 'package:flutter_picker/flutter_picker.dart'; | ||
| 10 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 10 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 11 | import 'package:one_key/constant/constant.dart'; | 11 | import 'package:one_key/constant/constant.dart'; |
| 12 | import 'package:one_key/models/remark.dart'; | 12 | import 'package:one_key/models/remark.dart'; |
| 13 | +import 'package:one_key/models/table_list.dart'; | ||
| 13 | import 'package:one_key/pages/message/message_dialog_item.dart'; | 14 | import 'package:one_key/pages/message/message_dialog_item.dart'; |
| 14 | import 'package:one_key/provider/message_dialog_model.dart'; | 15 | import 'package:one_key/provider/message_dialog_model.dart'; |
| 15 | import 'package:one_key/provider/table_manager_model.dart'; | 16 | import 'package:one_key/provider/table_manager_model.dart'; |
| @@ -124,6 +125,63 @@ class DialogUtil { | @@ -124,6 +125,63 @@ class DialogUtil { | ||
| 124 | }); | 125 | }); |
| 125 | } | 126 | } |
| 126 | 127 | ||
| 128 | + static Future openFTablesChangeDialog( | ||
| 129 | + BuildContext context, List<TableList> tables, | ||
| 130 | + {CustomCallBack onTap}) async { | ||
| 131 | + final action = await showDialog( | ||
| 132 | + context: context, | ||
| 133 | + barrierDismissible: true, | ||
| 134 | + builder: (BuildContext context) { | ||
| 135 | + return Center( | ||
| 136 | + child: Container( | ||
| 137 | + height: ScreenUtil().setWidth(400), | ||
| 138 | + width: ScreenUtil().setWidth(280 * 2), | ||
| 139 | + decoration: BoxDecoration( | ||
| 140 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))), | ||
| 141 | + child: Card( | ||
| 142 | + shape: RoundedRectangleBorder( | ||
| 143 | + borderRadius: BorderRadius.all( | ||
| 144 | + Radius.circular(ScreenUtil().setWidth(10)))), //设置圆角 | ||
| 145 | + child: Column(children: [ | ||
| 146 | + Expanded( | ||
| 147 | + child: ListView( | ||
| 148 | + padding: EdgeInsets.symmetric( | ||
| 149 | + horizontal: ScreenUtil().setWidth(40), | ||
| 150 | + vertical: ScreenUtil().setWidth(40)), | ||
| 151 | + shrinkWrap: true, | ||
| 152 | + children: [ | ||
| 153 | + Wrap( | ||
| 154 | + children: tableListChangeWidget(tables, (v) {}), | ||
| 155 | + spacing: ScreenUtil().setWidth(20), | ||
| 156 | + runSpacing: ScreenUtil().setWidth(20), | ||
| 157 | + // alignment: WrapAlignment.start, | ||
| 158 | + // runAlignment: WrapAlignment.end, | ||
| 159 | + ), | ||
| 160 | + ], | ||
| 161 | + )), | ||
| 162 | + MyDivider(double.infinity, ScreenUtil().setWidth(2)), | ||
| 163 | + InkWell( | ||
| 164 | + onTap: () { | ||
| 165 | + Navigator.pop(context); | ||
| 166 | + }, | ||
| 167 | + child: Container( | ||
| 168 | + width: double.infinity, | ||
| 169 | + alignment: Alignment.center, | ||
| 170 | + padding: EdgeInsets.symmetric( | ||
| 171 | + vertical: ScreenUtil().setWidth(40)), | ||
| 172 | + child: Text('确定', | ||
| 173 | + style: TextStyle( | ||
| 174 | + color: Color.fromRGBO(42, 96, 244, 1), | ||
| 175 | + fontSize: ScreenUtil().setSp(30))), | ||
| 176 | + ), | ||
| 177 | + ) | ||
| 178 | + ])), | ||
| 179 | + ), | ||
| 180 | + ); | ||
| 181 | + }, | ||
| 182 | + ); | ||
| 183 | + } | ||
| 184 | + | ||
| 127 | static Future openFTablesDialog(BuildContext context, List<t.Table> tables, | 185 | static Future openFTablesDialog(BuildContext context, List<t.Table> tables, |
| 128 | {CustomCallBack onTap}) async { | 186 | {CustomCallBack onTap}) async { |
| 129 | final action = await showDialog( | 187 | final action = await showDialog( |
| @@ -1001,6 +1059,22 @@ class DialogUtil { | @@ -1001,6 +1059,22 @@ class DialogUtil { | ||
| 1001 | }); | 1059 | }); |
| 1002 | } | 1060 | } |
| 1003 | 1061 | ||
| 1062 | + static tableListChangeWidget( | ||
| 1063 | + List<TableList> tables, CustomCallBack callback) { | ||
| 1064 | + List<Widget> lists = tables.map((item) { | ||
| 1065 | + return remarkButton( | ||
| 1066 | + content: item.name, | ||
| 1067 | + isSelect: true, | ||
| 1068 | + onPress: () { | ||
| 1069 | + // state(() { | ||
| 1070 | + // item.selected = !item.selected; | ||
| 1071 | + // }); | ||
| 1072 | + // callback(item); | ||
| 1073 | + }); | ||
| 1074 | + }).toList(); | ||
| 1075 | + return lists; | ||
| 1076 | + } | ||
| 1077 | + | ||
| 1004 | static tableListWidget(List<t.Table> tables, CustomCallBack callback) { | 1078 | static tableListWidget(List<t.Table> tables, CustomCallBack callback) { |
| 1005 | List<Widget> lists = tables.map((item) { | 1079 | List<Widget> lists = tables.map((item) { |
| 1006 | return remarkButton( | 1080 | return remarkButton( |
| @@ -45,6 +45,17 @@ class FTableItemState extends State<FTableItem> { | @@ -45,6 +45,17 @@ class FTableItemState extends State<FTableItem> { | ||
| 45 | } | 45 | } |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | + bool isSelf = false; | ||
| 49 | + //当前桌子的预订id | ||
| 50 | + String idNow = ''; | ||
| 51 | + if (widget.tableMap.containsKey('${table.id}')) { | ||
| 52 | + //包含,证明该桌子已经被预订了 | ||
| 53 | + idNow = widget.tableMap['${table.id}'].id; | ||
| 54 | + if (idNow == widget.rid) { | ||
| 55 | + isSelf = true; | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + | ||
| 48 | return GestureDetector( | 59 | return GestureDetector( |
| 49 | onTap: () { | 60 | onTap: () { |
| 50 | if (widget.canSelected && widget.fromPage == 'change') { | 61 | if (widget.canSelected && widget.fromPage == 'change') { |
| @@ -66,6 +77,7 @@ class FTableItemState extends State<FTableItem> { | @@ -66,6 +77,7 @@ class FTableItemState extends State<FTableItem> { | ||
| 66 | idNow = widget.tableMap['${table.id}'].id; | 77 | idNow = widget.tableMap['${table.id}'].id; |
| 67 | if (idNow == widget.rid) { | 78 | if (idNow == widget.rid) { |
| 68 | setState(() { | 79 | setState(() { |
| 80 | + isSelf = true; | ||
| 69 | table.selected = !(table.selected ?? false); | 81 | table.selected = !(table.selected ?? false); |
| 70 | }); | 82 | }); |
| 71 | widget.onSelected(table); | 83 | widget.onSelected(table); |
| @@ -108,7 +120,7 @@ class FTableItemState extends State<FTableItem> { | @@ -108,7 +120,7 @@ class FTableItemState extends State<FTableItem> { | ||
| 108 | // height: ScreenUtil().setWidth(widget.height), | 120 | // height: ScreenUtil().setWidth(widget.height), |
| 109 | // margin: EdgeInsets.all(ScreenUtil().setWidth(9)), | 121 | // margin: EdgeInsets.all(ScreenUtil().setWidth(9)), |
| 110 | decoration: BoxDecoration( | 122 | decoration: BoxDecoration( |
| 111 | - color: widget.need && signStr == '已预订' | 123 | + color: widget.need && signStr == '已预订' && !isSelf |
| 112 | ? Color.fromRGBO(154, 23, 45, 1) | 124 | ? Color.fromRGBO(154, 23, 45, 1) |
| 113 | : widget.canSelected && table.selected | 125 | : widget.canSelected && table.selected |
| 114 | ? MyColours.color_199095 | 126 | ? MyColours.color_199095 |
| @@ -131,7 +143,7 @@ class FTableItemState extends State<FTableItem> { | @@ -131,7 +143,7 @@ class FTableItemState extends State<FTableItem> { | ||
| 131 | crossAxisAlignment: CrossAxisAlignment.center, | 143 | crossAxisAlignment: CrossAxisAlignment.center, |
| 132 | mainAxisAlignment: MainAxisAlignment.center, | 144 | mainAxisAlignment: MainAxisAlignment.center, |
| 133 | children: <Widget>[ | 145 | children: <Widget>[ |
| 134 | - widget.need && signStr == '已预订' | 146 | + widget.need && signStr == '已预订' && !isSelf |
| 135 | ? SizedBox() | 147 | ? SizedBox() |
| 136 | : VEmptyView(10), | 148 | : VEmptyView(10), |
| 137 | Container( | 149 | Container( |
| @@ -140,7 +152,9 @@ class FTableItemState extends State<FTableItem> { | @@ -140,7 +152,9 @@ class FTableItemState extends State<FTableItem> { | ||
| 140 | table.name, | 152 | table.name, |
| 141 | maxLines: 1, | 153 | maxLines: 1, |
| 142 | style: TextStyle( | 154 | style: TextStyle( |
| 143 | - color: (widget.need && signStr == '已预订') || | 155 | + color: (widget.need && |
| 156 | + signStr == '已预订' && | ||
| 157 | + !isSelf) || | ||
| 144 | (widget.canSelected && table.selected) | 158 | (widget.canSelected && table.selected) |
| 145 | ? MyColours.color_ffffff | 159 | ? MyColours.color_ffffff |
| 146 | : MyColours.color_333333, | 160 | : MyColours.color_333333, |
| @@ -170,7 +184,7 @@ class FTableItemState extends State<FTableItem> { | @@ -170,7 +184,7 @@ class FTableItemState extends State<FTableItem> { | ||
| 170 | ? VEmptyView(8) | 184 | ? VEmptyView(8) |
| 171 | : SizedBox(), | 185 | : SizedBox(), |
| 172 | Text( | 186 | Text( |
| 173 | - signStr == '已预订' | 187 | + signStr == '已预订' && !isSelf |
| 174 | ? (table.reserver == null || table.reserver.isEmpty) | 188 | ? (table.reserver == null || table.reserver.isEmpty) |
| 175 | ? (table.pnum != '' && | 189 | ? (table.pnum != '' && |
| 176 | table.pnum != null && | 190 | table.pnum != null && |
| @@ -185,7 +199,7 @@ class FTableItemState extends State<FTableItem> { | @@ -185,7 +199,7 @@ class FTableItemState extends State<FTableItem> { | ||
| 185 | : '') | 199 | : '') |
| 186 | : table.tableNum, | 200 | : table.tableNum, |
| 187 | style: TextStyle( | 201 | style: TextStyle( |
| 188 | - color: signStr == '已预订' || | 202 | + color: signStr == '已预订' && !isSelf || |
| 189 | (widget.canSelected && table.selected) | 203 | (widget.canSelected && table.selected) |
| 190 | ? MyColours.color_ffffff | 204 | ? MyColours.color_ffffff |
| 191 | : MyColours.color_353535, | 205 | : MyColours.color_353535, |
| @@ -195,7 +209,7 @@ class FTableItemState extends State<FTableItem> { | @@ -195,7 +209,7 @@ class FTableItemState extends State<FTableItem> { | ||
| 195 | overflow: TextOverflow.ellipsis, | 209 | overflow: TextOverflow.ellipsis, |
| 196 | ), | 210 | ), |
| 197 | 211 | ||
| 198 | - widget.need && signStr == '已预订' | 212 | + widget.need && signStr == '已预订' && !isSelf |
| 199 | ? Padding( | 213 | ? Padding( |
| 200 | padding: EdgeInsets.only( | 214 | padding: EdgeInsets.only( |
| 201 | top: ScreenUtil().setWidth(6), | 215 | top: ScreenUtil().setWidth(6), |
| @@ -213,7 +227,7 @@ class FTableItemState extends State<FTableItem> { | @@ -213,7 +227,7 @@ class FTableItemState extends State<FTableItem> { | ||
| 213 | ) | 227 | ) |
| 214 | : SizedBox(), | 228 | : SizedBox(), |
| 215 | 229 | ||
| 216 | - signStr == '已预订' | 230 | + signStr == '已预订' && !isSelf |
| 217 | ? Container( | 231 | ? Container( |
| 218 | // width: ScreenUtil().setWidth(160), | 232 | // width: ScreenUtil().setWidth(160), |
| 219 | height: ScreenUtil().setWidth(34), | 233 | height: ScreenUtil().setWidth(34), |
| @@ -246,7 +260,7 @@ class FTableItemState extends State<FTableItem> { | @@ -246,7 +260,7 @@ class FTableItemState extends State<FTableItem> { | ||
| 246 | ], | 260 | ], |
| 247 | ), | 261 | ), |
| 248 | ), | 262 | ), |
| 249 | - signStr == '已预订' | 263 | + signStr == '已预订' && !isSelf |
| 250 | ? SizedBox() | 264 | ? SizedBox() |
| 251 | : Positioned( | 265 | : Positioned( |
| 252 | left: 0, | 266 | left: 0, |
| @@ -328,7 +342,7 @@ class FTableItemState extends State<FTableItem> { | @@ -328,7 +342,7 @@ class FTableItemState extends State<FTableItem> { | ||
| 328 | // height: ScreenUtil().setWidth(40), | 342 | // height: ScreenUtil().setWidth(40), |
| 329 | // ) | 343 | // ) |
| 330 | // : Container()), | 344 | // : Container()), |
| 331 | - widget.need && signStr == '已预订' | 345 | + widget.need && signStr == '已预订' && !isSelf |
| 332 | ? SizedBox() | 346 | ? SizedBox() |
| 333 | : Positioned( | 347 | : Positioned( |
| 334 | left: ScreenUtil().setWidth(18), | 348 | left: ScreenUtil().setWidth(18), |
-
Please register or login to post a comment