Showing
11 changed files
with
532 additions
and
123 deletions
assets/f_camera_white.png
0 → 100644
30.5 KB
| @@ -46,6 +46,7 @@ class Notebook { | @@ -46,6 +46,7 @@ class Notebook { | ||
| 46 | String cdate; | 46 | String cdate; |
| 47 | String name; | 47 | String name; |
| 48 | OrderInfo orderInfo; | 48 | OrderInfo orderInfo; |
| 49 | + String nick_name; | ||
| 49 | 50 | ||
| 50 | String get tableinfoStr { | 51 | String get tableinfoStr { |
| 51 | return name + | 52 | return name + |
| @@ -141,7 +142,7 @@ class OrderInfo extends Object { | @@ -141,7 +142,7 @@ class OrderInfo extends Object { | ||
| 141 | @JsonKey(name: 'sid') | 142 | @JsonKey(name: 'sid') |
| 142 | String sid; | 143 | String sid; |
| 143 | 144 | ||
| 144 | - @JsonKey(name: 'uid') | 145 | + @JsonKey(name: 'uid') |
| 145 | String uid; | 146 | String uid; |
| 146 | 147 | ||
| 147 | @JsonKey(name: 'rid') | 148 | @JsonKey(name: 'rid') |
| @@ -41,6 +41,7 @@ Notebook _$NotebookFromJson(Map<String, dynamic> json) { | @@ -41,6 +41,7 @@ Notebook _$NotebookFromJson(Map<String, dynamic> json) { | ||
| 41 | ..code = json['code'] as String | 41 | ..code = json['code'] as String |
| 42 | ..note_openid = json['note_openid'] as String | 42 | ..note_openid = json['note_openid'] as String |
| 43 | ..note_name = json['note_name'] as String | 43 | ..note_name = json['note_name'] as String |
| 44 | + ..nick_name = json['nick_name'] as String | ||
| 44 | ..operator_openid = json['operator_openid'] as String | 45 | ..operator_openid = json['operator_openid'] as String |
| 45 | ..channel = json['channel'] as String | 46 | ..channel = json['channel'] as String |
| 46 | ..cdate = json['cdate'] as String | 47 | ..cdate = json['cdate'] as String |
| @@ -88,7 +89,8 @@ Map<String, dynamic> _$NotebookToJson(Notebook instance) => <String, dynamic>{ | @@ -88,7 +89,8 @@ Map<String, dynamic> _$NotebookToJson(Notebook instance) => <String, dynamic>{ | ||
| 88 | 'channel': instance.channel, | 89 | 'channel': instance.channel, |
| 89 | 'cdate': instance.cdate, | 90 | 'cdate': instance.cdate, |
| 90 | 'name': instance.name, | 91 | 'name': instance.name, |
| 91 | - 'order_info': instance.orderInfo | 92 | + 'order_info': instance.orderInfo, |
| 93 | + 'nick_name': instance.nick_name, | ||
| 92 | }; | 94 | }; |
| 93 | 95 | ||
| 94 | OrderInfo _$OrderInfoFromJson(Map<String, dynamic> json) { | 96 | OrderInfo _$OrderInfoFromJson(Map<String, dynamic> json) { |
| @@ -91,6 +91,7 @@ class NotebookDetail { | @@ -91,6 +91,7 @@ class NotebookDetail { | ||
| 91 | String action; | 91 | String action; |
| 92 | String type; //0 内部订单 1 在线预订 | 92 | String type; //0 内部订单 1 在线预订 |
| 93 | String note_name; | 93 | String note_name; |
| 94 | + String nick_name; | ||
| 94 | String channel; | 95 | String channel; |
| 95 | String cdate; | 96 | String cdate; |
| 96 | List<t.Table> demands; //需求桌位 | 97 | List<t.Table> demands; //需求桌位 |
| @@ -216,7 +217,7 @@ class NotebookDetail { | @@ -216,7 +217,7 @@ class NotebookDetail { | ||
| 216 | 217 | ||
| 217 | @override | 218 | @override |
| 218 | String toString() { | 219 | String toString() { |
| 219 | - return 'NotebookDetail{id: $id, con_amount:$con_amount,abolition: $abolition, tableinfo: $tableinfo,actual_pum:$actual_pum, pnum: $pnum, rname: $rname, sex: $sex, phone: $phone, cusdem: $cusdem, cusman: $cusman, ddate: $ddate, is_set_ddate: $is_set_ddate, ddate_solt: $ddate_solt, status: $status, action: $action, type: $type, note_name: $note_name, channel: $channel, cdate: $cdate, demands: $demands, tables: $tables, cancel: $cancel}'; | 220 | + return 'NotebookDetail{id: $id, con_amount:$con_amount,abolition: $abolition, tableinfo: $tableinfo,actual_pum:$actual_pum, pnum: $pnum, rname: $rname, sex: $sex, phone: $phone, cusdem: $cusdem, cusman: $cusman, ddate: $ddate, is_set_ddate: $is_set_ddate, ddate_solt: $ddate_solt, status: $status, action: $action, type: $type, note_name: $note_name, , nick_name: $nick_name,channel: $channel, cdate: $cdate, demands: $demands, tables: $tables, cancel: $cancel}'; |
| 220 | } | 221 | } |
| 221 | } | 222 | } |
| 222 | 223 |
| @@ -27,6 +27,7 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) { | @@ -27,6 +27,7 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) { | ||
| 27 | ..action = json['action'] as String | 27 | ..action = json['action'] as String |
| 28 | ..type = json['type'] as String | 28 | ..type = json['type'] as String |
| 29 | ..note_name = json['note_name'] as String | 29 | ..note_name = json['note_name'] as String |
| 30 | + ..nick_name = json['nick_name'] as String | ||
| 30 | ..channel = json['channel'] as String | 31 | ..channel = json['channel'] as String |
| 31 | ..cdate = json['cdate'] as String | 32 | ..cdate = json['cdate'] as String |
| 32 | ..demands = (json['demands'] as List) | 33 | ..demands = (json['demands'] as List) |
| @@ -54,8 +55,8 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) => | @@ -54,8 +55,8 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) => | ||
| 54 | 'tableinfo': instance.tableinfo, | 55 | 'tableinfo': instance.tableinfo, |
| 55 | 'abolition': instance.abolition, | 56 | 'abolition': instance.abolition, |
| 56 | 'pnum': instance.pnum, | 57 | 'pnum': instance.pnum, |
| 57 | - 'con_amount':instance.con_amount, | ||
| 58 | - 'actual_pum':instance.actual_pum, | 58 | + 'con_amount': instance.con_amount, |
| 59 | + 'actual_pum': instance.actual_pum, | ||
| 59 | 'rname': instance.rname, | 60 | 'rname': instance.rname, |
| 60 | 'sex': instance.sex, | 61 | 'sex': instance.sex, |
| 61 | 'phone': instance.phone, | 62 | 'phone': instance.phone, |
| @@ -68,6 +69,7 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) => | @@ -68,6 +69,7 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) => | ||
| 68 | 'action': instance.action, | 69 | 'action': instance.action, |
| 69 | 'type': instance.type, | 70 | 'type': instance.type, |
| 70 | 'note_name': instance.note_name, | 71 | 'note_name': instance.note_name, |
| 72 | + 'nick_name': instance.nick_name, | ||
| 71 | 'channel': instance.channel, | 73 | 'channel': instance.channel, |
| 72 | 'cdate': instance.cdate, | 74 | 'cdate': instance.cdate, |
| 73 | 'demands': instance.demands, | 75 | 'demands': instance.demands, |
| @@ -26,7 +26,7 @@ class Table { | @@ -26,7 +26,7 @@ class Table { | ||
| 26 | bool selected; //是否选中 | 26 | bool selected; //是否选中 |
| 27 | int isPhoto; //桌位是否有照片 | 27 | int isPhoto; //桌位是否有照片 |
| 28 | String pnum; //预计人数 | 28 | String pnum; //预计人数 |
| 29 | - String noteName; //操作人 | 29 | + String nickName; //操作人 |
| 30 | 30 | ||
| 31 | //获取桌位类型 | 31 | //获取桌位类型 |
| 32 | String get tidStr { | 32 | String get tidStr { |
| @@ -789,12 +789,12 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -789,12 +789,12 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 789 | ), | 789 | ), |
| 790 | Offstage( | 790 | Offstage( |
| 791 | offstage: | 791 | offstage: |
| 792 | - detailEntity.note_name == | 792 | + detailEntity.nick_name == |
| 793 | '' || | 793 | '' || |
| 794 | - detailEntity.note_name == | 794 | + detailEntity.nick_name == |
| 795 | null, | 795 | null, |
| 796 | child: RowMultiText("记录人", | 796 | child: RowMultiText("记录人", |
| 797 | - detailEntity.note_name ?? ""), | 797 | + detailEntity.nick_name ?? ""), |
| 798 | ), | 798 | ), |
| 799 | RowMultiText( | 799 | RowMultiText( |
| 800 | "下单时间", | 800 | "下单时间", |
| @@ -8,6 +8,7 @@ import 'package:one_key/constant/state.dart'; | @@ -8,6 +8,7 @@ import 'package:one_key/constant/state.dart'; | ||
| 8 | import 'package:one_key/models/area.dart'; | 8 | import 'package:one_key/models/area.dart'; |
| 9 | import 'package:one_key/models/notebook_detail.dart'; | 9 | import 'package:one_key/models/notebook_detail.dart'; |
| 10 | import 'package:one_key/models/tableOuter.dart'; | 10 | import 'package:one_key/models/tableOuter.dart'; |
| 11 | +import 'package:one_key/models/table_list.dart'; | ||
| 11 | import 'package:one_key/pages/table/area_item_table.dart'; | 12 | import 'package:one_key/pages/table/area_item_table.dart'; |
| 12 | import 'package:one_key/pages/table/cc_menu_wdn.dart'; | 13 | import 'package:one_key/pages/table/cc_menu_wdn.dart'; |
| 13 | import 'package:one_key/provider/table_manager_model.dart'; | 14 | import 'package:one_key/provider/table_manager_model.dart'; |
| @@ -24,6 +25,7 @@ import 'package:one_key/widgets/common_button_flat.dart'; | @@ -24,6 +25,7 @@ import 'package:one_key/widgets/common_button_flat.dart'; | ||
| 24 | import 'package:one_key/widgets/f_table_item.dart'; | 25 | import 'package:one_key/widgets/f_table_item.dart'; |
| 25 | import 'package:one_key/widgets/h_empty_view.dart'; | 26 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 26 | import 'package:one_key/widgets/page_exception.dart'; | 27 | import 'package:one_key/widgets/page_exception.dart'; |
| 28 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 27 | import 'package:one_key/widgets/system_app_bar.dart'; | 29 | import 'package:one_key/widgets/system_app_bar.dart'; |
| 28 | import 'package:one_key/widgets/table_item.dart'; | 30 | import 'package:one_key/widgets/table_item.dart'; |
| 29 | import 'package:one_key/models/table.dart' as t; | 31 | import 'package:one_key/models/table.dart' as t; |
| @@ -55,7 +57,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -55,7 +57,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 55 | bool isSelected = true; //全部按钮 | 57 | bool isSelected = true; //全部按钮 |
| 56 | 58 | ||
| 57 | int _selectNumber; | 59 | int _selectNumber; |
| 58 | - | 60 | + ScrollController _scrollCrl = ScrollController(); |
| 59 | final ItemPositionsListener itemPositionsListener = | 61 | final ItemPositionsListener itemPositionsListener = |
| 60 | ItemPositionsListener.create(); | 62 | ItemPositionsListener.create(); |
| 61 | 63 | ||
| @@ -85,6 +87,14 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -85,6 +87,14 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 85 | }); | 87 | }); |
| 86 | } | 88 | } |
| 87 | 89 | ||
| 90 | + @override | ||
| 91 | + void dispose() { | ||
| 92 | + // TODO: implement dispose | ||
| 93 | + super.dispose(); | ||
| 94 | + EventBus().off("refresh_tablemanager"); | ||
| 95 | + EventBus().off("refresh_tablePhoto"); | ||
| 96 | + } | ||
| 97 | + | ||
| 88 | ///刷新图片显示 | 98 | ///刷新图片显示 |
| 89 | _refreshTablePhoto() async { | 99 | _refreshTablePhoto() async { |
| 90 | List temp = | 100 | List temp = |
| @@ -240,81 +250,94 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -240,81 +250,94 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 240 | shouldRebuild: (pre, next) => true, | 250 | shouldRebuild: (pre, next) => true, |
| 241 | selector: (context, model) => data[index], | 251 | selector: (context, model) => data[index], |
| 242 | builder: (context, table, _) { | 252 | builder: (context, table, _) { |
| 243 | - return FTableItem(table, onSelected: (table) { | ||
| 244 | - if ((table as t.Table).selected) { | ||
| 245 | - tableManagerModel.selectTables.add(table); | 253 | + return FTableItem(table, canSelected: true, onSelected: (table) { |
| 254 | + if (table.signStr == '已预订') { | ||
| 255 | + //进入订座详情页面 | ||
| 256 | + NavigatorUtil.goNotebookDetailPage( | ||
| 257 | + context, | ||
| 258 | + tableManagerModel.tableMap[table.id].id, | ||
| 259 | + tableManagerModel.tableMap[table.id].uid); | ||
| 246 | } else { | 260 | } else { |
| 247 | - tableManagerModel.selectTables | ||
| 248 | - .removeWhere((t) => t.id == table.id); | ||
| 249 | - } | ||
| 250 | - DialogUtil.showTableManagerDialog(context, table).then((value) { | ||
| 251 | - if (value != null) { | ||
| 252 | - switch (value) { | ||
| 253 | - case 1: //查看详情 | ||
| 254 | - NavigatorUtil.goNotebookDetailPage( | ||
| 255 | - context, | ||
| 256 | - tableManagerModel.tableMap[table.id].id, | ||
| 257 | - tableManagerModel.tableMap[table.id].uid); | ||
| 258 | - break; | ||
| 259 | - case 2: //订座 | ||
| 260 | - NavigatorUtil.goNoteBookChangePage( | ||
| 261 | - context, | ||
| 262 | - NotebookDetail.fromTableManager( | ||
| 263 | - tableManagerModel.getCurrDdateStr(), | ||
| 264 | - tableManagerModel.currTimeIndex.toString(), | ||
| 265 | - table), | ||
| 266 | - ""); | ||
| 267 | - break; | ||
| 268 | - | ||
| 269 | - case 3: //停用,启用桌位 | ||
| 270 | - Map<String, String> params = { | ||
| 271 | - "id": (table as t.Table).id, | ||
| 272 | - "status": (table as t.Table).enable == "1" ? "0" : "1" | ||
| 273 | - }; | ||
| 274 | - tableManagerModel | ||
| 275 | - .setSwitchStatus(context, params) | ||
| 276 | - .then((value) { | ||
| 277 | - if (value != null) { | ||
| 278 | - (table as t.Table).enable = | ||
| 279 | - ((int.parse((table as t.Table).enable) + 1) % 2) | ||
| 280 | - .toString(); | ||
| 281 | - if ((table as t.Table).enable == "1") { | ||
| 282 | - for (Area area in tableManagerModel.areas) { | ||
| 283 | - if (area.name == | ||
| 284 | - tableManagerModel.currentArea) { | ||
| 285 | - if (table.sign != '5' && table.sign != '1') { | ||
| 286 | - //已预订 | ||
| 287 | - area.count++; | ||
| 288 | - } | ||
| 289 | - break; | ||
| 290 | - } | ||
| 291 | - } | ||
| 292 | - } else { | ||
| 293 | - for (Area area in tableManagerModel.areas) { | ||
| 294 | - if (area.name == | ||
| 295 | - tableManagerModel.currentArea) { | ||
| 296 | - if (table.sign != '5' && table.sign != '1') { | ||
| 297 | - //已预订 | ||
| 298 | - area.count--; | ||
| 299 | - } | ||
| 300 | - break; | ||
| 301 | - } | ||
| 302 | - } | ||
| 303 | - } | ||
| 304 | - tableManagerModel.notifyListeners(); | ||
| 305 | - } | ||
| 306 | - }); | ||
| 307 | - break; | ||
| 308 | - case 4: //照片管理 | ||
| 309 | - NavigatorUtil.goTablePhotoManagerPage(context, | ||
| 310 | - tid: (table as t.Table).id, | ||
| 311 | - tname: (table as t.Table).name); | ||
| 312 | - break; | 261 | + setState(() { |
| 262 | + if ((table as t.Table).selected) { | ||
| 263 | + tableManagerModel.selectTables.add(table); | ||
| 264 | + } else { | ||
| 265 | + tableManagerModel.selectTables | ||
| 266 | + .removeWhere((t) => t.id == table.id); | ||
| 313 | } | 267 | } |
| 314 | - } | ||
| 315 | - }); | 268 | + if (tableManagerModel.selectTables.length > 1) { |
| 269 | + _scrollCrl.position | ||
| 270 | + .didUpdateScrollPositionBy(0); //这里触发更新滚动条 | ||
| 271 | + } | ||
| 272 | + }); | ||
| 273 | + } | ||
| 274 | + // DialogUtil.showTableManagerDialog(context, table).then((value) { | ||
| 275 | + // if (value != null) { | ||
| 276 | + // switch (value) { | ||
| 277 | + // case 1: //查看详情 | ||
| 278 | + // NavigatorUtil.goNotebookDetailPage( | ||
| 279 | + // context, | ||
| 280 | + // tableManagerModel.tableMap[table.id].id, | ||
| 281 | + // tableManagerModel.tableMap[table.id].uid); | ||
| 282 | + // break; | ||
| 283 | + // case 2: //订座 | ||
| 284 | + // NavigatorUtil.goNoteBookChangePage( | ||
| 285 | + // context, | ||
| 286 | + // NotebookDetail.fromTableManager( | ||
| 287 | + // tableManagerModel.getCurrDdateStr(), | ||
| 288 | + // tableManagerModel.currTimeIndex.toString(), | ||
| 289 | + // table), | ||
| 290 | + // ""); | ||
| 291 | + // break; | ||
| 292 | + | ||
| 293 | + // case 3: //停用,启用桌位 | ||
| 294 | + // Map<String, String> params = { | ||
| 295 | + // "id": (table as t.Table).id, | ||
| 296 | + // "status": (table as t.Table).enable == "1" ? "0" : "1" | ||
| 297 | + // }; | ||
| 298 | + // tableManagerModel | ||
| 299 | + // .setSwitchStatus(context, params) | ||
| 300 | + // .then((value) { | ||
| 301 | + // if (value != null) { | ||
| 302 | + // (table as t.Table).enable = | ||
| 303 | + // ((int.parse((table as t.Table).enable) + 1) % 2) | ||
| 304 | + // .toString(); | ||
| 305 | + // if ((table as t.Table).enable == "1") { | ||
| 306 | + // for (Area area in tableManagerModel.areas) { | ||
| 307 | + // if (area.name == | ||
| 308 | + // tableManagerModel.currentArea) { | ||
| 309 | + // if (table.sign != '5' && table.sign != '1') { | ||
| 310 | + // //已预订 | ||
| 311 | + // area.count++; | ||
| 312 | + // } | ||
| 313 | + // break; | ||
| 314 | + // } | ||
| 315 | + // } | ||
| 316 | + // } else { | ||
| 317 | + // for (Area area in tableManagerModel.areas) { | ||
| 318 | + // if (area.name == | ||
| 319 | + // tableManagerModel.currentArea) { | ||
| 320 | + // if (table.sign != '5' && table.sign != '1') { | ||
| 321 | + // //已预订 | ||
| 322 | + // area.count--; | ||
| 323 | + // } | ||
| 324 | + // break; | ||
| 325 | + // } | ||
| 326 | + // } | ||
| 327 | + // } | ||
| 328 | + // tableManagerModel.notifyListeners(); | ||
| 329 | + // } | ||
| 330 | + // }); | ||
| 331 | + // break; | ||
| 332 | + // case 4: //照片管理 | ||
| 333 | + // NavigatorUtil.goTablePhotoManagerPage(context, | ||
| 334 | + // tid: (table as t.Table).id, | ||
| 335 | + // tname: (table as t.Table).name); | ||
| 336 | + // break; | ||
| 337 | + // } | ||
| 338 | + // } | ||
| 339 | + // }); | ||
| 316 | }, | 340 | }, |
| 317 | - canSelected: false, | ||
| 318 | fromPage: 'table_manage', | 341 | fromPage: 'table_manage', |
| 319 | tableMap: tableManagerModel.tableMap, | 342 | tableMap: tableManagerModel.tableMap, |
| 320 | rid: ""); | 343 | rid: ""); |
| @@ -325,6 +348,190 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -325,6 +348,190 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 325 | ); | 348 | ); |
| 326 | } | 349 | } |
| 327 | 350 | ||
| 351 | + ///选中的桌子widget | ||
| 352 | + Widget _selectTableWidget() { | ||
| 353 | + return Expanded( | ||
| 354 | + flex: 1, | ||
| 355 | + child: Container( | ||
| 356 | + // constraints: BoxConstraints(maxHeight: ScreenUtil().setWidth(300)), | ||
| 357 | + // height: ScreenUtil().setWidth(400), | ||
| 358 | + width: double.infinity, | ||
| 359 | + padding: EdgeInsets.symmetric( | ||
| 360 | + horizontal: ScreenUtil().setWidth(40), | ||
| 361 | + vertical: ScreenUtil().setWidth(30)), | ||
| 362 | + decoration: BoxDecoration( | ||
| 363 | + color: MyColours.color_ffffff, | ||
| 364 | + boxShadow: [ | ||
| 365 | + BoxShadow( | ||
| 366 | + color: MyColours.color_333333, | ||
| 367 | + blurRadius: ScreenUtil().setWidth(14)) | ||
| 368 | + ], | ||
| 369 | + borderRadius: BorderRadius.only( | ||
| 370 | + topLeft: Radius.circular(ScreenUtil().setWidth(30)), | ||
| 371 | + topRight: Radius.circular(ScreenUtil().setWidth(30)), | ||
| 372 | + )), | ||
| 373 | + child: Row( | ||
| 374 | + // mainAxisSize: MainAxisSize.min, | ||
| 375 | + children: [ | ||
| 376 | + Column( | ||
| 377 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 378 | + children: [ | ||
| 379 | + Text( | ||
| 380 | + tableManagerModel.selectDateStr, | ||
| 381 | + style: TextStyle( | ||
| 382 | + color: MyColours.color_333333, | ||
| 383 | + fontSize: ScreenUtil().setSp(28)), | ||
| 384 | + ), | ||
| 385 | + VEmptyView(20), | ||
| 386 | + Text( | ||
| 387 | + '已选桌位:', | ||
| 388 | + style: TextStyle( | ||
| 389 | + color: MyColours.color_333333, | ||
| 390 | + fontSize: ScreenUtil().setSp(26)), | ||
| 391 | + ), | ||
| 392 | + VEmptyView(20), | ||
| 393 | + Expanded( | ||
| 394 | + child: Container( | ||
| 395 | + width: ScreenUtil.screenWidthDp - | ||
| 396 | + ScreenUtil().setWidth(100 + 180), | ||
| 397 | + // height: ScreenUtil().setWidth(200), | ||
| 398 | + // color: Colors.blueAccent, | ||
| 399 | + child: | ||
| 400 | + // ListView.builder( | ||
| 401 | + // shrinkWrap: true, | ||
| 402 | + // itemBuilder: (BuildContext context, int index) { | ||
| 403 | + // return | ||
| 404 | + Scrollbar( | ||
| 405 | + isAlwaysShown: true, //设置滚动条常亮 | ||
| 406 | + controller: _scrollCrl, //必须设置一个controller | ||
| 407 | + | ||
| 408 | + ///添加进度条 | ||
| 409 | + child: SingleChildScrollView( | ||
| 410 | + controller: _scrollCrl, | ||
| 411 | + child: Container( | ||
| 412 | + width: ScreenUtil.screenWidthDp - | ||
| 413 | + ScreenUtil().setWidth(100 + 180), | ||
| 414 | + child: Wrap( | ||
| 415 | + spacing: ScreenUtil().setWidth(20), | ||
| 416 | + runSpacing: | ||
| 417 | + ScreenUtil().setWidth(20), | ||
| 418 | + children: _buildAlwayItems())), | ||
| 419 | + )) | ||
| 420 | + // }, | ||
| 421 | + // itemCount: 1, | ||
| 422 | + // ), | ||
| 423 | + )) | ||
| 424 | + ], | ||
| 425 | + ), | ||
| 426 | + HEmptyView(20), | ||
| 427 | + Container( | ||
| 428 | + // width: ScreenUtil().setWidth(100), | ||
| 429 | + // color: Colors.red, | ||
| 430 | + child: Column( | ||
| 431 | + children: [ | ||
| 432 | + RoundButton( | ||
| 433 | + onPressed: () async { | ||
| 434 | + await tableManagerModel.setReserveInfo(context); | ||
| 435 | + }, | ||
| 436 | + text: '预订', | ||
| 437 | + fontSize: 48, | ||
| 438 | + isBold: true, | ||
| 439 | + width: ScreenUtil().setWidth(180), | ||
| 440 | + height: ScreenUtil().setWidth(140), | ||
| 441 | + padding: EdgeInsets.symmetric( | ||
| 442 | + horizontal: ScreenUtil().setWidth(20), | ||
| 443 | + vertical: ScreenUtil().setWidth(4)), | ||
| 444 | + textColor: MyColours.color_ffffff, | ||
| 445 | + gradientStart: MyColours.color_199095, | ||
| 446 | + gradientEnd: MyColours.color_199095, | ||
| 447 | + radius: ScreenUtil().setWidth(10), | ||
| 448 | + borderColor: MyColours.color_199095, | ||
| 449 | + ), | ||
| 450 | + InkWell( | ||
| 451 | + onTap: () { | ||
| 452 | + tableManagerModel.selectTables = []; | ||
| 453 | + for (t.Table item in tableManagerModel.tablesShow) { | ||
| 454 | + item.selected = false; | ||
| 455 | + } | ||
| 456 | + tableManagerModel.areaTableMapShow | ||
| 457 | + .forEach((key, value) { | ||
| 458 | + value.forEach((element) { | ||
| 459 | + element.selected = false; | ||
| 460 | + }); | ||
| 461 | + }); | ||
| 462 | + | ||
| 463 | + tableManagerModel.notifyListeners(); | ||
| 464 | + }, | ||
| 465 | + child: Padding( | ||
| 466 | + padding: EdgeInsets.symmetric( | ||
| 467 | + horizontal: ScreenUtil().setWidth(40), | ||
| 468 | + vertical: ScreenUtil().setWidth(30)), | ||
| 469 | + child: Text( | ||
| 470 | + '取消重置', | ||
| 471 | + style: TextStyle( | ||
| 472 | + color: MyColours.color_199095, | ||
| 473 | + fontSize: ScreenUtil().setSp(26)), | ||
| 474 | + ), | ||
| 475 | + ), | ||
| 476 | + ), | ||
| 477 | + ], | ||
| 478 | + ), | ||
| 479 | + ) | ||
| 480 | + ], | ||
| 481 | + ), | ||
| 482 | + )); | ||
| 483 | + } | ||
| 484 | + | ||
| 485 | + //构建常用备注 | ||
| 486 | + List<Widget> _buildAlwayItems() { | ||
| 487 | + List<Widget> tables = []; | ||
| 488 | + for (t.Table table in tableManagerModel.selectTables) { | ||
| 489 | + tables.add(Container( | ||
| 490 | + padding: EdgeInsets.symmetric( | ||
| 491 | + horizontal: ScreenUtil().setWidth(20), | ||
| 492 | + vertical: ScreenUtil().setWidth(4)), | ||
| 493 | + decoration: BoxDecoration( | ||
| 494 | + border: Border.all( | ||
| 495 | + color: MyColours.color_E0E0E0, | ||
| 496 | + width: ScreenUtil().setWidth(2)), | ||
| 497 | + borderRadius: | ||
| 498 | + BorderRadius.circular(ScreenUtil().setWidth(10))), | ||
| 499 | + child: Text( | ||
| 500 | + table.name, | ||
| 501 | + style: TextStyle( | ||
| 502 | + fontSize: ScreenUtil().setSp(26), | ||
| 503 | + color: MyColours.color_333333, | ||
| 504 | + fontWeight: FontWeight.bold), | ||
| 505 | + )) | ||
| 506 | + // RoundButton( | ||
| 507 | + // onPressed: () async {}, | ||
| 508 | + // text: table.name, | ||
| 509 | + // fontSize: 26, | ||
| 510 | + // isBold: false, | ||
| 511 | + // padding: EdgeInsets.symmetric( | ||
| 512 | + // horizontal: ScreenUtil().setWidth(20), | ||
| 513 | + // vertical: ScreenUtil().setWidth(4)), | ||
| 514 | + // height: ScreenUtil().setWidth(48), | ||
| 515 | + // textColor: MyColours.color_333333, | ||
| 516 | + // gradientStart: MyColours.color_ffffff, | ||
| 517 | + // gradientEnd: MyColours.color_ffffff, | ||
| 518 | + // radius: ScreenUtil().setWidth(10), | ||
| 519 | + // borderColor: MyColours.color_E0E0E0, | ||
| 520 | + // ) | ||
| 521 | + ); | ||
| 522 | + } | ||
| 523 | + | ||
| 524 | + return tables; | ||
| 525 | + } | ||
| 526 | + | ||
| 527 | + ///早餐、午餐、晚餐点击方法 | ||
| 528 | + _clickMorAndNoonAndNig() { | ||
| 529 | + tableManagerModel.selectDateStr = tableManagerModel.returnDayDateWeekStr( | ||
| 530 | + tableManagerModel.dateTimeSelect, tableManagerModel.currTimeIndex); | ||
| 531 | + | ||
| 532 | + tableManagerModel.getReserveList(context, needLoading: false); | ||
| 533 | + } | ||
| 534 | + | ||
| 328 | @override | 535 | @override |
| 329 | Widget build(BuildContext context) { | 536 | Widget build(BuildContext context) { |
| 330 | tableManagerModel = Provider.of<TableManagerModel>(context, listen: true); | 537 | tableManagerModel = Provider.of<TableManagerModel>(context, listen: true); |
| @@ -435,7 +642,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -435,7 +642,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 435 | if (tableManagerModel.currTimeIndex == 1) | 642 | if (tableManagerModel.currTimeIndex == 1) |
| 436 | return; | 643 | return; |
| 437 | tableManagerModel.currTimeIndex = 1; | 644 | tableManagerModel.currTimeIndex = 1; |
| 438 | - tableManagerModel.getReserveList(context); | 645 | + _clickMorAndNoonAndNig(); |
| 439 | }, | 646 | }, |
| 440 | )), | 647 | )), |
| 441 | btnNum == 3 && tableManagerModel.currTimeIndex == 3 | 648 | btnNum == 3 && tableManagerModel.currTimeIndex == 3 |
| @@ -469,7 +676,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -469,7 +676,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 469 | if (tableManagerModel.currTimeIndex == 2) | 676 | if (tableManagerModel.currTimeIndex == 2) |
| 470 | return; | 677 | return; |
| 471 | tableManagerModel.currTimeIndex = 2; | 678 | tableManagerModel.currTimeIndex = 2; |
| 472 | - tableManagerModel.getReserveList(context); | 679 | + _clickMorAndNoonAndNig(); |
| 473 | }, | 680 | }, |
| 474 | )), | 681 | )), |
| 475 | btnNum == 3 && tableManagerModel.currTimeIndex == 1 | 682 | btnNum == 3 && tableManagerModel.currTimeIndex == 1 |
| @@ -500,7 +707,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -500,7 +707,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 500 | if (tableManagerModel.currTimeIndex == 3) | 707 | if (tableManagerModel.currTimeIndex == 3) |
| 501 | return; | 708 | return; |
| 502 | tableManagerModel.currTimeIndex = 3; | 709 | tableManagerModel.currTimeIndex = 3; |
| 503 | - tableManagerModel.getReserveList(context); | 710 | + _clickMorAndNoonAndNig(); |
| 504 | }, | 711 | }, |
| 505 | )), | 712 | )), |
| 506 | ), | 713 | ), |
| @@ -761,9 +968,15 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -761,9 +968,15 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 761 | ), | 968 | ), |
| 762 | ), | 969 | ), |
| 763 | Expanded( | 970 | Expanded( |
| 971 | + flex: 2, | ||
| 764 | child: Container( | 972 | child: Container( |
| 973 | + constraints: BoxConstraints( | ||
| 974 | + minHeight: ScreenUtil().setWidth(100)), | ||
| 765 | color: Color.fromRGBO(249, 249, 249, 1), | 975 | color: Color.fromRGBO(249, 249, 249, 1), |
| 766 | child: item(_selectNumber))), | 976 | child: item(_selectNumber))), |
| 977 | + tableManagerModel.selectTables.length > 0 | ||
| 978 | + ? _selectTableWidget() | ||
| 979 | + : SizedBox() | ||
| 767 | ])) | 980 | ])) |
| 768 | // return CCMenuPage.builder( | 981 | // return CCMenuPage.builder( |
| 769 | // tableManagerModel: tableManagerModel, | 982 | // tableManagerModel: tableManagerModel, |
| @@ -818,12 +1031,4 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -818,12 +1031,4 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 818 | }, | 1031 | }, |
| 819 | )); | 1032 | )); |
| 820 | } | 1033 | } |
| 821 | - | ||
| 822 | - @override | ||
| 823 | - void dispose() { | ||
| 824 | - // TODO: implement dispose | ||
| 825 | - super.dispose(); | ||
| 826 | - EventBus().off("refresh_tablemanager"); | ||
| 827 | - EventBus().off("refresh_tablePhoto"); | ||
| 828 | - } | ||
| 829 | } | 1034 | } |
| @@ -6,7 +6,9 @@ import 'package:one_key/constant/state.dart'; | @@ -6,7 +6,9 @@ import 'package:one_key/constant/state.dart'; | ||
| 6 | import 'package:one_key/models/area.dart'; | 6 | import 'package:one_key/models/area.dart'; |
| 7 | import 'package:one_key/models/area_model.dart'; | 7 | import 'package:one_key/models/area_model.dart'; |
| 8 | import 'package:one_key/models/notebook.dart'; | 8 | import 'package:one_key/models/notebook.dart'; |
| 9 | +import 'package:one_key/models/reserve_info_model.dart'; | ||
| 9 | import 'package:one_key/models/tableOuter.dart'; | 10 | import 'package:one_key/models/tableOuter.dart'; |
| 11 | +import 'package:one_key/models/table_list.dart'; | ||
| 10 | import 'package:one_key/net/base_resp.dart'; | 12 | import 'package:one_key/net/base_resp.dart'; |
| 11 | import 'package:one_key/net/dio_util.dart'; | 13 | import 'package:one_key/net/dio_util.dart'; |
| 12 | import 'package:one_key/net/http_url.dart'; | 14 | import 'package:one_key/net/http_url.dart'; |
| @@ -55,12 +57,16 @@ class TableManagerModel with ChangeNotifier { | @@ -55,12 +57,16 @@ class TableManagerModel with ChangeNotifier { | ||
| 55 | 57 | ||
| 56 | Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 | 58 | Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 |
| 57 | bool swichState = false; //仅看空座 | 59 | bool swichState = false; //仅看空座 |
| 60 | + String selectDateStr = ''; | ||
| 61 | + | ||
| 62 | + DateTime dateTimeSelect; | ||
| 58 | 63 | ||
| 59 | //初始化时间 | 64 | //初始化时间 |
| 60 | initTime(BuildContext context) async { | 65 | initTime(BuildContext context) async { |
| 61 | userModel = Provider.of<UserModel>(context, listen: false); | 66 | userModel = Provider.of<UserModel>(context, listen: false); |
| 62 | dateTime = DateTime.now(); | 67 | dateTime = DateTime.now(); |
| 63 | dateText = _returnDate(dateTime); | 68 | dateText = _returnDate(dateTime); |
| 69 | + dateTimeSelect = dateTime; | ||
| 64 | morning = | 70 | morning = |
| 65 | userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; | 71 | userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; |
| 66 | noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon; | 72 | noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon; |
| @@ -124,6 +130,7 @@ class TableManagerModel with ChangeNotifier { | @@ -124,6 +130,7 @@ class TableManagerModel with ChangeNotifier { | ||
| 124 | //过了晚市 | 130 | //过了晚市 |
| 125 | currTimeIndex = 3; | 131 | currTimeIndex = 3; |
| 126 | } | 132 | } |
| 133 | + selectDateStr = returnDayDateWeekStr(dateTime, currTimeIndex); | ||
| 127 | List temp = await getTableList(context); | 134 | List temp = await getTableList(context); |
| 128 | if (temp.length > 0) { | 135 | if (temp.length > 0) { |
| 129 | getReserveList(context); | 136 | getReserveList(context); |
| @@ -236,6 +243,105 @@ class TableManagerModel with ChangeNotifier { | @@ -236,6 +243,105 @@ class TableManagerModel with ChangeNotifier { | ||
| 236 | return sb; | 243 | return sb; |
| 237 | } | 244 | } |
| 238 | 245 | ||
| 246 | + ///录入更改内部预订 | ||
| 247 | + Future<SunReserveInfoModel> setReserveInfo(BuildContext context) async { | ||
| 248 | + if (selectTables.length == 0) { | ||
| 249 | + Utils.showToast('请选择桌位'); | ||
| 250 | + return null; | ||
| 251 | + } | ||
| 252 | + bool sucess = | ||
| 253 | + await getReserveList(context, showMsg: true, needLoading: false); | ||
| 254 | + if (sucess) { | ||
| 255 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 256 | + // | ||
| 257 | + String tempTime; | ||
| 258 | + if (currTimeIndex == 1) { | ||
| 259 | + tempTime = '08:00'; | ||
| 260 | + } else if (currTimeIndex == 2) { | ||
| 261 | + tempTime = '12:00'; | ||
| 262 | + } else if (currTimeIndex == 3) { | ||
| 263 | + tempTime = '18:00'; | ||
| 264 | + } | ||
| 265 | + String ymd = DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d); | ||
| 266 | + String timeStr = ymd + ' ' + tempTime + ':00'; | ||
| 267 | + // int start = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 268 | + | ||
| 269 | + LogUtil.v(timeStr); | ||
| 270 | + // String tempDdate = ymyStr + ' ' + ddateStr + ':00'; | ||
| 271 | + int ddate = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 272 | + String tableSelectInfo = ''; | ||
| 273 | + for (t.Table item in selectTables) { | ||
| 274 | + // if (item.selected) { | ||
| 275 | + tableSelectInfo += ',${item.id}'; | ||
| 276 | + // } | ||
| 277 | + } | ||
| 278 | + print(tableSelectInfo); | ||
| 279 | + if (tableSelectInfo.startsWith(',')) { | ||
| 280 | + tableSelectInfo = tableSelectInfo.substring(1); | ||
| 281 | + } | ||
| 282 | + print(tableSelectInfo); | ||
| 283 | + String rdate = ''; | ||
| 284 | + | ||
| 285 | + String keys = ''; | ||
| 286 | + | ||
| 287 | + if (currTimeIndex == 1) { | ||
| 288 | + //早市 | ||
| 289 | + keys = 'morning'; | ||
| 290 | + } else if (currTimeIndex == 2) { | ||
| 291 | + //午市 | ||
| 292 | + keys = 'noon'; | ||
| 293 | + } else if (currTimeIndex == 3) { | ||
| 294 | + //晚市 | ||
| 295 | + keys = 'night'; | ||
| 296 | + } | ||
| 297 | + if (keys != '') { | ||
| 298 | + List temp = dailyMap[keys]; | ||
| 299 | + String timeStrStart = ymd + ' ' + temp.first + ':00'; | ||
| 300 | + String timeStrEnd = ymd + ' ' + temp.last + ':00'; | ||
| 301 | + int startM = DateUtil.getDateMsByTimeStr(timeStrStart); | ||
| 302 | + int endM = DateUtil.getDateMsByTimeStr(timeStrEnd); | ||
| 303 | + String start = '${startM}'.substring(0, 10); | ||
| 304 | + String end = '${endM}'.substring(0, 10); | ||
| 305 | + rdate = start + '-' + end; | ||
| 306 | + } | ||
| 307 | + | ||
| 308 | + Map<String, String> params = { | ||
| 309 | + "sid": userModel.user.sellerid, //商家ID | ||
| 310 | + "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | ||
| 311 | + 'note_name': userModel.user.account, | ||
| 312 | + 'type': "0", //内部预订 | ||
| 313 | + "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | ||
| 314 | + "ddate": '${ddate}'.substring(0, 10), //到店时间 | ||
| 315 | + 'is_set_ddate': '1', | ||
| 316 | + "channel": '5', | ||
| 317 | + "uid": userModel.user.openid | ||
| 318 | + }; | ||
| 319 | + print(params); | ||
| 320 | + BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | ||
| 321 | + .request<Map<String, dynamic>>( | ||
| 322 | + context, Method.get, HttpUrl.set_reserve_info, | ||
| 323 | + data: params) | ||
| 324 | + .catchError((error) { | ||
| 325 | + print(error.toString()); | ||
| 326 | + }); | ||
| 327 | + SunReserveInfoModel itemModel; | ||
| 328 | + if (baseResp == null) return itemModel; | ||
| 329 | + if (baseResp.code == Constant.status_success) { | ||
| 330 | + if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 331 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 332 | + return itemModel; | ||
| 333 | + } | ||
| 334 | + if (baseResp.responseData['data'] != null && | ||
| 335 | + baseResp.responseData['data']['row'] != null) { | ||
| 336 | + itemModel = ReserveInfoModel.fromJson(baseResp.responseData).data; | ||
| 337 | + } else { | ||
| 338 | + Utils.showToast("录入预订订单失败,请重试!"); | ||
| 339 | + } | ||
| 340 | + return itemModel; | ||
| 341 | + } | ||
| 342 | + } | ||
| 343 | + } | ||
| 344 | + | ||
| 239 | //获取桌位数据 | 345 | //获取桌位数据 |
| 240 | Future<List<TableOuter>> getTableList(BuildContext context, | 346 | Future<List<TableOuter>> getTableList(BuildContext context, |
| 241 | {bool needLoading = true}) async { | 347 | {bool needLoading = true}) async { |
| @@ -321,7 +427,9 @@ class TableManagerModel with ChangeNotifier { | @@ -321,7 +427,9 @@ class TableManagerModel with ChangeNotifier { | ||
| 321 | 427 | ||
| 322 | //获取已预订列表 | 428 | //获取已预订列表 |
| 323 | getReserveList(BuildContext context, | 429 | getReserveList(BuildContext context, |
| 324 | - {bool needLoading = true, bool needKeep = false}) async { | 430 | + {bool needLoading = true, |
| 431 | + bool needKeep = false, | ||
| 432 | + bool showMsg = false}) async { | ||
| 325 | tableMap.clear(); | 433 | tableMap.clear(); |
| 326 | NoteBookModel model = new NoteBookModel(); | 434 | NoteBookModel model = new NoteBookModel(); |
| 327 | Map<String, String> params = { | 435 | Map<String, String> params = { |
| @@ -339,20 +447,48 @@ class TableManagerModel with ChangeNotifier { | @@ -339,20 +447,48 @@ class TableManagerModel with ChangeNotifier { | ||
| 339 | } | 447 | } |
| 340 | 448 | ||
| 341 | List<Notebook> noteBooks = await newGetReserveList(context, params); | 449 | List<Notebook> noteBooks = await newGetReserveList(context, params); |
| 450 | + List<t.Table> tempSelectTables = []; | ||
| 451 | + tempSelectTables.addAll(selectTables); | ||
| 452 | + String msg = ''; | ||
| 342 | for (Notebook notebook in noteBooks) { | 453 | for (Notebook notebook in noteBooks) { |
| 343 | if (notebook.tid.isEmpty) continue; | 454 | if (notebook.tid.isEmpty) continue; |
| 344 | - if (notebook.status == "1" || | ||
| 345 | - notebook.status == "2" || | ||
| 346 | - notebook.status == "5") { | ||
| 347 | - //已预订,用餐中,已安排 | ||
| 348 | - List<String> tids = notebook.tid.split(","); | ||
| 349 | - for (String tid in tids) { | 455 | + |
| 456 | + //已预订,用餐中,已安排 | ||
| 457 | + List<String> tids = notebook.tid.split(","); | ||
| 458 | + for (String tid in tids) { | ||
| 459 | + if (notebook.status == "1" || | ||
| 460 | + notebook.status == "2" || | ||
| 461 | + notebook.status == "5") { | ||
| 350 | tableMap["$tid"] = notebook; | 462 | tableMap["$tid"] = notebook; |
| 351 | } | 463 | } |
| 464 | + | ||
| 465 | + ///预订按钮点击的时候提醒已经被预订的桌子 | ||
| 466 | + /// | ||
| 467 | + if (showMsg && selectTables.length > 0) { | ||
| 468 | + for (t.Table item in selectTables) { | ||
| 469 | + if (item.id == tid) { | ||
| 470 | + msg += '${item.name},'; | ||
| 471 | + tempSelectTables.remove(item); | ||
| 472 | + } | ||
| 473 | + } | ||
| 474 | + } | ||
| 352 | } | 475 | } |
| 353 | } | 476 | } |
| 477 | + if (showMsg && msg != '' && selectTables.length > 0) { | ||
| 478 | + if (msg.endsWith(',')) { | ||
| 479 | + msg = msg.substring(0, msg.length - 1); | ||
| 480 | + } | ||
| 481 | + selectTables = tempSelectTables; | ||
| 482 | + Utils.showToast('${msg}已被预订,请选择其他桌位!'); | ||
| 483 | + print(tableMap); | ||
| 484 | + initData(needKeep: needKeep); | ||
| 485 | + // notifyListeners(); | ||
| 486 | + return false; | ||
| 487 | + } | ||
| 488 | + | ||
| 354 | print(tableMap); | 489 | print(tableMap); |
| 355 | initData(needKeep: needKeep); | 490 | initData(needKeep: needKeep); |
| 491 | + return true; | ||
| 356 | } | 492 | } |
| 357 | 493 | ||
| 358 | //获取已预订订单 | 494 | //获取已预订订单 |
| @@ -428,6 +564,9 @@ class TableManagerModel with ChangeNotifier { | @@ -428,6 +564,9 @@ class TableManagerModel with ChangeNotifier { | ||
| 428 | table.sign = ""; | 564 | table.sign = ""; |
| 429 | table.notebookId = ""; | 565 | table.notebookId = ""; |
| 430 | table.reserver = ""; | 566 | table.reserver = ""; |
| 567 | + | ||
| 568 | + table.selected = false; | ||
| 569 | + | ||
| 431 | if (table.tablestatus == "0") { | 570 | if (table.tablestatus == "0") { |
| 432 | //没有用餐中 | 571 | //没有用餐中 |
| 433 | if (tableMap["${table.id}"] != null) { | 572 | if (tableMap["${table.id}"] != null) { |
| @@ -436,7 +575,7 @@ class TableManagerModel with ChangeNotifier { | @@ -436,7 +575,7 @@ class TableManagerModel with ChangeNotifier { | ||
| 436 | table.notebookId = notebook.id; | 575 | table.notebookId = notebook.id; |
| 437 | table.reserver = notebook.rnameStr; | 576 | table.reserver = notebook.rnameStr; |
| 438 | table.pnum = notebook.pnum; | 577 | table.pnum = notebook.pnum; |
| 439 | - table.noteName = notebook.note_name; | 578 | + table.nickName = notebook.nick_name; |
| 440 | 579 | ||
| 441 | //剔除已经预订的桌子,剩下空桌子(仅看空座) | 580 | //剔除已经预订的桌子,剩下空桌子(仅看空座) |
| 442 | tempList.remove(table); | 581 | tempList.remove(table); |
| @@ -472,6 +611,24 @@ class TableManagerModel with ChangeNotifier { | @@ -472,6 +611,24 @@ class TableManagerModel with ChangeNotifier { | ||
| 472 | tablesShow = tablesAll; | 611 | tablesShow = tablesAll; |
| 473 | } | 612 | } |
| 474 | 613 | ||
| 614 | + if (selectTables.length > 0) { | ||
| 615 | + //刷新页面时,让原来选中的按钮继续选中 | ||
| 616 | + for (t.Table itemSelect in selectTables) { | ||
| 617 | + areaTableMapShow.forEach((key, value) { | ||
| 618 | + for (t.Table item in value) { | ||
| 619 | + if (itemSelect.id == item.id) { | ||
| 620 | + item.selected = true; | ||
| 621 | + } | ||
| 622 | + } | ||
| 623 | + }); | ||
| 624 | + for (t.Table item in tablesShow) { | ||
| 625 | + if (itemSelect.id == item.id) { | ||
| 626 | + item.selected = true; | ||
| 627 | + } | ||
| 628 | + } | ||
| 629 | + } | ||
| 630 | + } | ||
| 631 | + | ||
| 475 | if (areaTableMap.isNotEmpty) { | 632 | if (areaTableMap.isNotEmpty) { |
| 476 | if (!needKeep) { | 633 | if (!needKeep) { |
| 477 | // currentArea = areaTableMap.keys.first; | 634 | // currentArea = areaTableMap.keys.first; |
| @@ -491,12 +648,34 @@ class TableManagerModel with ChangeNotifier { | @@ -491,12 +648,34 @@ class TableManagerModel with ChangeNotifier { | ||
| 491 | //生成日期文本 | 648 | //生成日期文本 |
| 492 | createDateText(BuildContext context, DateTime day) { | 649 | createDateText(BuildContext context, DateTime day) { |
| 493 | if (Utils.isOneDay(day, dateTime)) return; //日期没变 | 650 | if (Utils.isOneDay(day, dateTime)) return; //日期没变 |
| 651 | + dateTimeSelect = day; | ||
| 494 | dateText = _returnDate(day); | 652 | dateText = _returnDate(day); |
| 653 | + selectDateStr = returnDayDateWeekStr(day, currTimeIndex); | ||
| 495 | dateTime = day; | 654 | dateTime = day; |
| 496 | - getReserveList(context); | 655 | + getReserveList(context, needLoading: false); |
| 497 | } | 656 | } |
| 498 | 657 | ||
| 499 | _returnDate(DateTime day) { | 658 | _returnDate(DateTime day) { |
| 659 | + String time = Utils.lunarCalendarHolidays(day); | ||
| 660 | + String date = _returnDayDateWeek(day); | ||
| 661 | + date += ' ${time}'; | ||
| 662 | + return date; | ||
| 663 | + } | ||
| 664 | + | ||
| 665 | + String returnDayDateWeekStr(DateTime day, int index) { | ||
| 666 | + String date = _returnDayDateWeek(day); | ||
| 667 | + | ||
| 668 | + if (index == 1) { | ||
| 669 | + date += ' 早餐'; | ||
| 670 | + } else if (index == 2) { | ||
| 671 | + date += ' 午餐'; | ||
| 672 | + } else if (index == 3) { | ||
| 673 | + date += ' 晚餐'; | ||
| 674 | + } | ||
| 675 | + return date; | ||
| 676 | + } | ||
| 677 | + | ||
| 678 | + String _returnDayDateWeek(DateTime day) { | ||
| 500 | String date = ''; | 679 | String date = ''; |
| 501 | DateTime dateNow = DateTime.now(); | 680 | DateTime dateNow = DateTime.now(); |
| 502 | String ymd = "${day.year}-" + | 681 | String ymd = "${day.year}-" + |
| @@ -513,9 +692,6 @@ class TableManagerModel with ChangeNotifier { | @@ -513,9 +692,6 @@ class TableManagerModel with ChangeNotifier { | ||
| 513 | } | 692 | } |
| 514 | date += ymd; | 693 | date += ymd; |
| 515 | date += " 星期${Utils.formatWeekDayNum(day.weekday)}"; | 694 | date += " 星期${Utils.formatWeekDayNum(day.weekday)}"; |
| 516 | - | ||
| 517 | - String time = Utils.lunarCalendarHolidays(day); | ||
| 518 | - date += ' ${time}'; | ||
| 519 | return date; | 695 | return date; |
| 520 | } | 696 | } |
| 521 | 697 |
| @@ -83,7 +83,10 @@ class FTableItemState extends State<FTableItem> { | @@ -83,7 +83,10 @@ class FTableItemState extends State<FTableItem> { | ||
| 83 | widget.onSelected(table); | 83 | widget.onSelected(table); |
| 84 | } else if (widget.fromPage == 'table_manage' || | 84 | } else if (widget.fromPage == 'table_manage' || |
| 85 | widget.fromPage == 'room_manage') { | 85 | widget.fromPage == 'room_manage') { |
| 86 | - table.selected = !(table.selected ?? false); | 86 | + setState(() { |
| 87 | + table.selected = !(table.selected ?? false); | ||
| 88 | + }); | ||
| 89 | + | ||
| 87 | widget.onSelected(table); | 90 | widget.onSelected(table); |
| 88 | } else if (widget.fromPage == 'tablePhoto') { | 91 | } else if (widget.fromPage == 'tablePhoto') { |
| 89 | // setState(() { | 92 | // setState(() { |
| @@ -91,6 +94,11 @@ class FTableItemState extends State<FTableItem> { | @@ -91,6 +94,11 @@ class FTableItemState extends State<FTableItem> { | ||
| 91 | // }); | 94 | // }); |
| 92 | 95 | ||
| 93 | widget.onSelected(table); | 96 | widget.onSelected(table); |
| 97 | + } else { | ||
| 98 | + setState(() { | ||
| 99 | + table.selected = !(table.selected ?? false); | ||
| 100 | + }); | ||
| 101 | + widget.onSelected(table); | ||
| 94 | } | 102 | } |
| 95 | }, | 103 | }, |
| 96 | child: Stack( | 104 | child: Stack( |
| @@ -102,7 +110,9 @@ class FTableItemState extends State<FTableItem> { | @@ -102,7 +110,9 @@ class FTableItemState extends State<FTableItem> { | ||
| 102 | decoration: BoxDecoration( | 110 | decoration: BoxDecoration( |
| 103 | color: widget.need && signStr == '已预订' | 111 | color: widget.need && signStr == '已预订' |
| 104 | ? Color.fromRGBO(154, 23, 45, 1) | 112 | ? Color.fromRGBO(154, 23, 45, 1) |
| 105 | - : MyColours.color_ffffff, | 113 | + : widget.canSelected && table.selected |
| 114 | + ? MyColours.color_199095 | ||
| 115 | + : MyColours.color_ffffff, | ||
| 106 | border: Border.all( | 116 | border: Border.all( |
| 107 | width: ScreenUtil().setWidth(2), | 117 | width: ScreenUtil().setWidth(2), |
| 108 | color: MyColours.color_E0E0E0), | 118 | color: MyColours.color_E0E0E0), |
| @@ -130,7 +140,8 @@ class FTableItemState extends State<FTableItem> { | @@ -130,7 +140,8 @@ class FTableItemState extends State<FTableItem> { | ||
| 130 | table.name, | 140 | table.name, |
| 131 | maxLines: 1, | 141 | maxLines: 1, |
| 132 | style: TextStyle( | 142 | style: TextStyle( |
| 133 | - color: widget.need && signStr == '已预订' | 143 | + color: (widget.need && signStr == '已预订') || |
| 144 | + (widget.canSelected && table.selected) | ||
| 134 | ? MyColours.color_ffffff | 145 | ? MyColours.color_ffffff |
| 135 | : MyColours.color_333333, | 146 | : MyColours.color_333333, |
| 136 | fontSize: ScreenUtil().setSp(36), | 147 | fontSize: ScreenUtil().setSp(36), |
| @@ -166,7 +177,8 @@ class FTableItemState extends State<FTableItem> { | @@ -166,7 +177,8 @@ class FTableItemState extends State<FTableItem> { | ||
| 166 | ? '(${table.pnum}人)' | 177 | ? '(${table.pnum}人)' |
| 167 | : ''), | 178 | : ''), |
| 168 | style: TextStyle( | 179 | style: TextStyle( |
| 169 | - color: signStr == '已预订' | 180 | + color: signStr == '已预订' || |
| 181 | + (widget.canSelected && table.selected) | ||
| 170 | ? MyColours.color_ffffff | 182 | ? MyColours.color_ffffff |
| 171 | : MyColours.color_353535, | 183 | : MyColours.color_353535, |
| 172 | fontSize: ScreenUtil().setSp(22), | 184 | fontSize: ScreenUtil().setSp(22), |
| @@ -182,7 +194,7 @@ class FTableItemState extends State<FTableItem> { | @@ -182,7 +194,7 @@ class FTableItemState extends State<FTableItem> { | ||
| 182 | bottom: ScreenUtil().setWidth(10), | 194 | bottom: ScreenUtil().setWidth(10), |
| 183 | ), | 195 | ), |
| 184 | child: Text( | 196 | child: Text( |
| 185 | - '${table.noteName}订', | 197 | + '${table.nickName}订', |
| 186 | style: TextStyle( | 198 | style: TextStyle( |
| 187 | color: MyColours.color_ffffff, | 199 | color: MyColours.color_ffffff, |
| 188 | fontSize: ScreenUtil().setSp(22), | 200 | fontSize: ScreenUtil().setSp(22), |
| @@ -240,7 +252,9 @@ class FTableItemState extends State<FTableItem> { | @@ -240,7 +252,9 @@ class FTableItemState extends State<FTableItem> { | ||
| 240 | EdgeInsets.all(ScreenUtil().setWidth(4)), | 252 | EdgeInsets.all(ScreenUtil().setWidth(4)), |
| 241 | alignment: Alignment.center, | 253 | alignment: Alignment.center, |
| 242 | decoration: BoxDecoration( | 254 | decoration: BoxDecoration( |
| 243 | - color: Color.fromRGBO(239, 239, 239, 1), | 255 | + color: widget.canSelected && table.selected |
| 256 | + ? MyColours.color_199095 | ||
| 257 | + : Color.fromRGBO(239, 239, 239, 1), | ||
| 244 | borderRadius: BorderRadius.only( | 258 | borderRadius: BorderRadius.only( |
| 245 | topLeft: Radius.circular( | 259 | topLeft: Radius.circular( |
| 246 | ScreenUtil().setWidth(20)), | 260 | ScreenUtil().setWidth(20)), |
| @@ -251,7 +265,10 @@ class FTableItemState extends State<FTableItem> { | @@ -251,7 +265,10 @@ class FTableItemState extends State<FTableItem> { | ||
| 251 | )), | 265 | )), |
| 252 | child: Text(table.tidStr, | 266 | child: Text(table.tidStr, |
| 253 | style: TextStyle( | 267 | style: TextStyle( |
| 254 | - color: MyColours.color_333333, | 268 | + color: |
| 269 | + widget.canSelected && table.selected | ||
| 270 | + ? MyColours.color_ffffff | ||
| 271 | + : MyColours.color_333333, | ||
| 255 | fontSize: ScreenUtil().setSp(20), | 272 | fontSize: ScreenUtil().setSp(20), |
| 256 | decoration: TextDecoration.none, | 273 | decoration: TextDecoration.none, |
| 257 | fontWeight: FontWeight.normal)), | 274 | fontWeight: FontWeight.normal)), |
| @@ -293,16 +310,16 @@ class FTableItemState extends State<FTableItem> { | @@ -293,16 +310,16 @@ class FTableItemState extends State<FTableItem> { | ||
| 293 | ], | 310 | ], |
| 294 | ), | 311 | ), |
| 295 | ), | 312 | ), |
| 296 | - Positioned( | ||
| 297 | - top: 3, | ||
| 298 | - right: 5, | ||
| 299 | - child: widget.canSelected && (table.selected ?? false) | ||
| 300 | - ? Image.asset( | ||
| 301 | - "assets/icon_selected.png", | ||
| 302 | - width: ScreenUtil().setWidth(40), | ||
| 303 | - height: ScreenUtil().setWidth(40), | ||
| 304 | - ) | ||
| 305 | - : Container()), | 313 | + // Positioned( |
| 314 | + // top: 3, | ||
| 315 | + // right: 5, | ||
| 316 | + // child: widget.canSelected && (table.selected ?? false) | ||
| 317 | + // ? Image.asset( | ||
| 318 | + // "assets/icon_selected.png", | ||
| 319 | + // width: ScreenUtil().setWidth(40), | ||
| 320 | + // height: ScreenUtil().setWidth(40), | ||
| 321 | + // ) | ||
| 322 | + // : Container()), | ||
| 306 | widget.need && signStr == '已预订' | 323 | widget.need && signStr == '已预订' |
| 307 | ? SizedBox() | 324 | ? SizedBox() |
| 308 | : Positioned( | 325 | : Positioned( |
| @@ -310,7 +327,9 @@ class FTableItemState extends State<FTableItem> { | @@ -310,7 +327,9 @@ class FTableItemState extends State<FTableItem> { | ||
| 310 | bottom: ScreenUtil().setWidth(12), | 327 | bottom: ScreenUtil().setWidth(12), |
| 311 | child: table.isPhoto != 1 | 328 | child: table.isPhoto != 1 |
| 312 | ? Image.asset( | 329 | ? Image.asset( |
| 313 | - "assets/f_camera.png", | 330 | + widget.canSelected && table.selected |
| 331 | + ? 'assets/f_camera_white.png' | ||
| 332 | + : "assets/f_camera.png", | ||
| 314 | width: ScreenUtil().setWidth(22), | 333 | width: ScreenUtil().setWidth(22), |
| 315 | height: ScreenUtil().setWidth(22), | 334 | height: ScreenUtil().setWidth(22), |
| 316 | ) | 335 | ) |
| @@ -25,6 +25,7 @@ class RoundButton extends StatelessWidget { | @@ -25,6 +25,7 @@ class RoundButton extends StatelessWidget { | ||
| 25 | this.textColor = Colors.white, | 25 | this.textColor = Colors.white, |
| 26 | this.borderColor = Colors.transparent, | 26 | this.borderColor = Colors.transparent, |
| 27 | this.isBold = true, | 27 | this.isBold = true, |
| 28 | + this.padding = EdgeInsets.zero, | ||
| 28 | this.space = 6}) | 29 | this.space = 6}) |
| 29 | : super(key: key); | 30 | : super(key: key); |
| 30 | 31 | ||
| @@ -51,6 +52,7 @@ class RoundButton extends StatelessWidget { | @@ -51,6 +52,7 @@ class RoundButton extends StatelessWidget { | ||
| 51 | 52 | ||
| 52 | final String text; | 53 | final String text; |
| 53 | final TextStyle style; | 54 | final TextStyle style; |
| 55 | + final EdgeInsetsGeometry padding; | ||
| 54 | 56 | ||
| 55 | final VoidCallback onPressed; | 57 | final VoidCallback onPressed; |
| 56 | 58 | ||
| @@ -59,6 +61,7 @@ class RoundButton extends StatelessWidget { | @@ -59,6 +61,7 @@ class RoundButton extends StatelessWidget { | ||
| 59 | Color _bgColor = bgColor ?? Theme.of(context).primaryColor; | 61 | Color _bgColor = bgColor ?? Theme.of(context).primaryColor; |
| 60 | BorderRadius _borderRadius = BorderRadius.circular(radius ?? (height / 2)); | 62 | BorderRadius _borderRadius = BorderRadius.circular(radius ?? (height / 2)); |
| 61 | return new Container( | 63 | return new Container( |
| 64 | + padding: padding, | ||
| 62 | width: width, | 65 | width: width, |
| 63 | height: height, | 66 | height: height, |
| 64 | margin: margin, | 67 | margin: margin, |
-
Please register or login to post a comment