Showing
9 changed files
with
431 additions
and
5 deletions
lib/models/get_reserve_type_field_model.dart
0 → 100644
| 1 | +class GetReserveTypeFieldModel { | ||
| 2 | + int ret; | ||
| 3 | + List<GetReserveTypeFieldsSunModel> data; | ||
| 4 | + String msg; | ||
| 5 | + | ||
| 6 | + GetReserveTypeFieldModel({this.ret, this.data, this.msg}); | ||
| 7 | + | ||
| 8 | + GetReserveTypeFieldModel.fromJson(Map<String, dynamic> json) { | ||
| 9 | + ret = json['ret']; | ||
| 10 | + if (json['data'] != null) { | ||
| 11 | + data = <GetReserveTypeFieldsSunModel>[]; | ||
| 12 | + json['data'].forEach((v) { | ||
| 13 | + GetReserveTypeFieldsSunModel temp = | ||
| 14 | + GetReserveTypeFieldsSunModel(name: v, select: false); | ||
| 15 | + data.add(temp); | ||
| 16 | + }); | ||
| 17 | + } | ||
| 18 | + msg = json['msg']; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + Map<String, dynamic> toJson() { | ||
| 22 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 23 | + data['ret'] = this.ret; | ||
| 24 | + if (this.data != null) { | ||
| 25 | + data['data'] = this.data.map((v) => v.toJson()).toList(); | ||
| 26 | + } | ||
| 27 | + data['msg'] = this.msg; | ||
| 28 | + return data; | ||
| 29 | + } | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +class GetReserveTypeFieldsSunModel { | ||
| 33 | + String name; | ||
| 34 | + bool select; | ||
| 35 | + | ||
| 36 | + GetReserveTypeFieldsSunModel({this.name, this.select}); | ||
| 37 | + | ||
| 38 | + GetReserveTypeFieldsSunModel.fromJson(Map<String, dynamic> json) { | ||
| 39 | + name = json['name']; | ||
| 40 | + select = json['select']; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + Map<String, dynamic> toJson() { | ||
| 44 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 45 | + data['name'] = this.name; | ||
| 46 | + data['select'] = this.select; | ||
| 47 | + return data; | ||
| 48 | + } | ||
| 49 | +} |
| @@ -104,6 +104,7 @@ class NotebookDetail { | @@ -104,6 +104,7 @@ class NotebookDetail { | ||
| 104 | String con_amount; | 104 | String con_amount; |
| 105 | String gid; | 105 | String gid; |
| 106 | String guest_uid; | 106 | String guest_uid; |
| 107 | + String reserve_type; | ||
| 107 | String place_order_name; //下单人 | 108 | String place_order_name; //下单人 |
| 108 | 109 | ||
| 109 | dynamic is_user_comments; //是否评价过 | 110 | dynamic is_user_comments; //是否评价过 |
| @@ -304,7 +305,7 @@ class NotebookDetail { | @@ -304,7 +305,7 @@ class NotebookDetail { | ||
| 304 | 305 | ||
| 305 | @override | 306 | @override |
| 306 | String toString() { | 307 | String toString() { |
| 307 | - return 'NotebookDetail{id: $id, uid: $uid ,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, seller_user_phone:$seller_user_phone, nick_name: $nick_name,channel: $channel, cdate: $cdate, demands: $demands, tables: $tables, cancel: $cancel, gid: $gid,guest_uid:$guest_uid,place_order_name:$place_order_name,is_user_comments:$is_user_comments,up_date:$up_date}'; | 308 | + return 'NotebookDetail{id: $id, uid: $uid ,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, seller_user_phone:$seller_user_phone, nick_name: $nick_name,channel: $channel, cdate: $cdate, demands: $demands, tables: $tables, cancel: $cancel, gid: $gid,guest_uid:$guest_uid,reserve_type:$reserve_type,place_order_name:$place_order_name,is_user_comments:$is_user_comments,up_date:$up_date}'; |
| 308 | } | 309 | } |
| 309 | } | 310 | } |
| 310 | 311 |
| @@ -51,6 +51,7 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) { | @@ -51,6 +51,7 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) { | ||
| 51 | : OrderInfo.fromJson(json['order_info'] as Map<String, dynamic>) | 51 | : OrderInfo.fromJson(json['order_info'] as Map<String, dynamic>) |
| 52 | ..gid = json['gid'] as String | 52 | ..gid = json['gid'] as String |
| 53 | ..guest_uid=json['guest_uid'] as String | 53 | ..guest_uid=json['guest_uid'] as String |
| 54 | + ..reserve_type = json['reserve_type'] as String | ||
| 54 | ..place_order_name = json['place_order_name'] as String | 55 | ..place_order_name = json['place_order_name'] as String |
| 55 | ..is_user_comments = json['is_user_comments'] as dynamic | 56 | ..is_user_comments = json['is_user_comments'] as dynamic |
| 56 | ..up_date = json['up_date'] as String; | 57 | ..up_date = json['up_date'] as String; |
| @@ -91,6 +92,7 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) => | @@ -91,6 +92,7 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) => | ||
| 91 | 'order_info': instance.orderInfo, | 92 | 'order_info': instance.orderInfo, |
| 92 | 'gid': instance.gid, | 93 | 'gid': instance.gid, |
| 93 | 'guest_uid':instance.guest_uid, | 94 | 'guest_uid':instance.guest_uid, |
| 95 | + 'reserve_type':instance.reserve_type, | ||
| 94 | 'place_order_name': instance.place_order_name, | 96 | 'place_order_name': instance.place_order_name, |
| 95 | 'is_user_comments': instance.is_user_comments, | 97 | 'is_user_comments': instance.is_user_comments, |
| 96 | 'up_date':instance.up_date, | 98 | 'up_date':instance.up_date, |
| @@ -495,4 +495,7 @@ class HttpUrl { | @@ -495,4 +495,7 @@ class HttpUrl { | ||
| 495 | static const String get_export_info = | 495 | static const String get_export_info = |
| 496 | "?service=App.Seller.GetExportInfo"; // 获取App导出数据 | 496 | "?service=App.Seller.GetExportInfo"; // 获取App导出数据 |
| 497 | 497 | ||
| 498 | + static const String get_reserve_type_field = | ||
| 499 | + "?service=App.Seller.GetReserveTypeField"; // 获取用餐类型 | ||
| 500 | + | ||
| 498 | } | 501 | } |
| @@ -118,6 +118,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -118,6 +118,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 118 | 118 | ||
| 119 | CollectStoreProvider collectStoreProvider; | 119 | CollectStoreProvider collectStoreProvider; |
| 120 | ScrollController controller = ScrollController(); | 120 | ScrollController controller = ScrollController(); |
| 121 | + String reserveType = '请选择'; | ||
| 121 | 122 | ||
| 122 | @override | 123 | @override |
| 123 | void initState() { | 124 | void initState() { |
| @@ -133,6 +134,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -133,6 +134,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 133 | offset: value.toString().length))); | 134 | offset: value.toString().length))); |
| 134 | }); | 135 | }); |
| 135 | getSellerVersion(); | 136 | getSellerVersion(); |
| 137 | + _getReserveTypeField(); | ||
| 136 | _initCancel(); | 138 | _initCancel(); |
| 137 | _getReserveDetail(); | 139 | _getReserveDetail(); |
| 138 | _getOrderInfo(); | 140 | _getOrderInfo(); |
| @@ -170,6 +172,10 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -170,6 +172,10 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 170 | }); | 172 | }); |
| 171 | } | 173 | } |
| 172 | 174 | ||
| 175 | + _getReserveTypeField() async { | ||
| 176 | + await detailModel.getReserveTypeField(context); | ||
| 177 | + } | ||
| 178 | + | ||
| 173 | /// 通过预订ID查收定金详情 | 179 | /// 通过预订ID查收定金详情 |
| 174 | _getReserveDepositByRid() async { | 180 | _getReserveDepositByRid() async { |
| 175 | Map<String, String> params = { | 181 | Map<String, String> params = { |
| @@ -432,6 +438,11 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -432,6 +438,11 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 432 | "rid": widget.rid, | 438 | "rid": widget.rid, |
| 433 | }, | 439 | }, |
| 434 | showCircle: showCicle); | 440 | showCircle: showCicle); |
| 441 | + | ||
| 442 | + reserveType = | ||
| 443 | + detailEntity.reserve_type == null || detailEntity.reserve_type == '' | ||
| 444 | + ? '请选择' | ||
| 445 | + : detailEntity.reserve_type; | ||
| 435 | _initTime(int.parse(detailEntity.ddate_solt)); | 446 | _initTime(int.parse(detailEntity.ddate_solt)); |
| 436 | setState(() { | 447 | setState(() { |
| 437 | // detailModel.selectNum = detailEntity.actual_pum; | 448 | // detailModel.selectNum = detailEntity.actual_pum; |
| @@ -1913,7 +1924,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -1913,7 +1924,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 1913 | child: TitleAndBtn( | 1924 | child: TitleAndBtn( |
| 1914 | title: "时间", | 1925 | title: "时间", |
| 1915 | content: ddateHm, | 1926 | content: ddateHm, |
| 1916 | - list: personNumList, | 1927 | + // list: personNumList, |
| 1917 | detailModel: model, | 1928 | detailModel: model, |
| 1918 | uid: widget.uid, | 1929 | uid: widget.uid, |
| 1919 | callback: () { | 1930 | callback: () { |
| @@ -2031,6 +2042,42 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -2031,6 +2042,42 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 2031 | )) | 2042 | )) |
| 2032 | ]), | 2043 | ]), |
| 2033 | 2044 | ||
| 2045 | + TitleAndBtn( | ||
| 2046 | + title: "用餐类型", | ||
| 2047 | + content: reserveType, | ||
| 2048 | + // list: personNumList, | ||
| 2049 | + detailModel: model, | ||
| 2050 | + callback: () { | ||
| 2051 | + FocusScope.of(context) | ||
| 2052 | + .requestFocus( | ||
| 2053 | + FocusNode()); //隐藏键盘 | ||
| 2054 | + // 存储 | ||
| 2055 | + | ||
| 2056 | + DialogUtil | ||
| 2057 | + .openDishTypeSelectModalBottomSheet( | ||
| 2058 | + context, | ||
| 2059 | + detailModel | ||
| 2060 | + .reserveTypes, | ||
| 2061 | + reserveType, | ||
| 2062 | + rCallback: | ||
| 2063 | + (value) async { | ||
| 2064 | + if (value != null) { | ||
| 2065 | + reserveType = value; | ||
| 2066 | + setState(() {}); | ||
| 2067 | + bool sucess = | ||
| 2068 | + await detailModel | ||
| 2069 | + .upReserveInfo( | ||
| 2070 | + context, | ||
| 2071 | + widget.rid, | ||
| 2072 | + reserveType: | ||
| 2073 | + reserveType, | ||
| 2074 | + needToast: | ||
| 2075 | + false); | ||
| 2076 | + if (sucess) {} | ||
| 2077 | + } | ||
| 2078 | + }); | ||
| 2079 | + }), | ||
| 2080 | + | ||
| 2034 | // ), | 2081 | // ), |
| 2035 | // Offstage( | 2082 | // Offstage( |
| 2036 | // offstage: | 2083 | // offstage: |
| @@ -4329,7 +4376,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -4329,7 +4376,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 4329 | class TitleAndBtn extends StatelessWidget { | 4376 | class TitleAndBtn extends StatelessWidget { |
| 4330 | final String title; | 4377 | final String title; |
| 4331 | final String content; | 4378 | final String content; |
| 4332 | - final List<String> list; | 4379 | + // final List<String> list; |
| 4333 | final NotebookDetailModel detailModel; | 4380 | final NotebookDetailModel detailModel; |
| 4334 | final GestureTapCallback callback; | 4381 | final GestureTapCallback callback; |
| 4335 | final String uid; | 4382 | final String uid; |
| @@ -4337,7 +4384,7 @@ class TitleAndBtn extends StatelessWidget { | @@ -4337,7 +4384,7 @@ class TitleAndBtn extends StatelessWidget { | ||
| 4337 | {Key key, | 4384 | {Key key, |
| 4338 | this.title, | 4385 | this.title, |
| 4339 | this.content, | 4386 | this.content, |
| 4340 | - this.list, | 4387 | + // this.list, |
| 4341 | this.detailModel, | 4388 | this.detailModel, |
| 4342 | this.callback, | 4389 | this.callback, |
| 4343 | this.uid}) | 4390 | this.uid}) |
| @@ -4405,7 +4452,10 @@ class TitleAndBtn extends StatelessWidget { | @@ -4405,7 +4452,10 @@ class TitleAndBtn extends StatelessWidget { | ||
| 4405 | uid == userModel.user.openid) | 4452 | uid == userModel.user.openid) |
| 4406 | ? MyColours.color_199095 | 4453 | ? MyColours.color_199095 |
| 4407 | : MyColours.color_999999))), | 4454 | : MyColours.color_999999))), |
| 4408 | - child: Text(content == null || content == '' ? "修改" : content, | 4455 | + child: Text( |
| 4456 | + content == null || content == '' || content == '请选择' | ||
| 4457 | + ? "修改" | ||
| 4458 | + : content, | ||
| 4409 | style: TextStyle( | 4459 | style: TextStyle( |
| 4410 | color: (Utils.getAuthority(context, title) || | 4460 | color: (Utils.getAuthority(context, title) || |
| 4411 | uid == userModel.user.openid) | 4461 | uid == userModel.user.openid) |
| @@ -168,6 +168,7 @@ class InvicationPageState extends State<InvicationPage> | @@ -168,6 +168,7 @@ class InvicationPageState extends State<InvicationPage> | ||
| 168 | List<String> styleList = []; //餐单类型 | 168 | List<String> styleList = []; //餐单类型 |
| 169 | String styleShow = ''; | 169 | String styleShow = ''; |
| 170 | int styleIndex; | 170 | int styleIndex; |
| 171 | + String reserveType = '请选择'; | ||
| 171 | 172 | ||
| 172 | MyTextSelectionControls _myExtendedMaterialTextSelectionControls = | 173 | MyTextSelectionControls _myExtendedMaterialTextSelectionControls = |
| 173 | MyTextSelectionControls(); | 174 | MyTextSelectionControls(); |
| @@ -287,6 +288,7 @@ class InvicationPageState extends State<InvicationPage> | @@ -287,6 +288,7 @@ class InvicationPageState extends State<InvicationPage> | ||
| 287 | await _getCustomerActivityBaseinfo(); | 288 | await _getCustomerActivityBaseinfo(); |
| 288 | 289 | ||
| 289 | getDzSellerConf(); | 290 | getDzSellerConf(); |
| 291 | + _getReserveTypeField(); | ||
| 290 | 292 | ||
| 291 | _timerShow(); | 293 | _timerShow(); |
| 292 | await _getReserveDetail(showCicle: false); | 294 | await _getReserveDetail(showCicle: false); |
| @@ -1136,6 +1138,10 @@ class InvicationPageState extends State<InvicationPage> | @@ -1136,6 +1138,10 @@ class InvicationPageState extends State<InvicationPage> | ||
| 1136 | } | 1138 | } |
| 1137 | } | 1139 | } |
| 1138 | 1140 | ||
| 1141 | + _getReserveTypeField() async { | ||
| 1142 | + await detailModel.getReserveTypeField(context); | ||
| 1143 | + } | ||
| 1144 | + | ||
| 1139 | ///订座详情 | 1145 | ///订座详情 |
| 1140 | _getReserveDetail({bool showCicle = false}) async { | 1146 | _getReserveDetail({bool showCicle = false}) async { |
| 1141 | detailEntity = await detailModel.getReserveDetail( | 1147 | detailEntity = await detailModel.getReserveDetail( |
| @@ -1145,6 +1151,12 @@ class InvicationPageState extends State<InvicationPage> | @@ -1145,6 +1151,12 @@ class InvicationPageState extends State<InvicationPage> | ||
| 1145 | }, | 1151 | }, |
| 1146 | showCircle: false, | 1152 | showCircle: false, |
| 1147 | isShowLoading: false); | 1153 | isShowLoading: false); |
| 1154 | + | ||
| 1155 | + reserveType = | ||
| 1156 | + detailEntity.reserve_type == null || detailEntity.reserve_type == '' | ||
| 1157 | + ? '请选择' | ||
| 1158 | + : detailEntity.reserve_type; | ||
| 1159 | + | ||
| 1148 | _initTime(int.parse(detailEntity.ddate_solt)); | 1160 | _initTime(int.parse(detailEntity.ddate_solt)); |
| 1149 | _baseIndoProvider.pageState = PageState.Success; | 1161 | _baseIndoProvider.pageState = PageState.Success; |
| 1150 | String _nameStr = ''; | 1162 | String _nameStr = ''; |
| @@ -2425,6 +2437,101 @@ class InvicationPageState extends State<InvicationPage> | @@ -2425,6 +2437,101 @@ class InvicationPageState extends State<InvicationPage> | ||
| 2425 | Column( | 2437 | Column( |
| 2426 | crossAxisAlignment: CrossAxisAlignment.start, | 2438 | crossAxisAlignment: CrossAxisAlignment.start, |
| 2427 | children: [ | 2439 | children: [ |
| 2440 | + Container( | ||
| 2441 | + margin: EdgeInsets.only( | ||
| 2442 | + // top: ScreenUtil().setWidth(40), | ||
| 2443 | + bottom: ScreenUtil().setWidth(40)), | ||
| 2444 | + height: ScreenUtil().setWidth(68), | ||
| 2445 | + padding: EdgeInsets.symmetric( | ||
| 2446 | + horizontal: ScreenUtil().setWidth(16)), | ||
| 2447 | + decoration: BoxDecoration( | ||
| 2448 | + borderRadius: BorderRadius.circular( | ||
| 2449 | + ScreenUtil().setWidth(12)), | ||
| 2450 | + // color: Colors.red, | ||
| 2451 | + border: Border.all( | ||
| 2452 | + width: ScreenUtil().setWidth(2), | ||
| 2453 | + color: MyColours.color_DBDBDB)), | ||
| 2454 | + child: Row( | ||
| 2455 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 2456 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 2457 | + children: [ | ||
| 2458 | + Expanded( | ||
| 2459 | + child: TextField( | ||
| 2460 | + maxLines: 1, | ||
| 2461 | + enabled: false, | ||
| 2462 | + | ||
| 2463 | + //输入文本的样式 | ||
| 2464 | + style: TextStyle( | ||
| 2465 | + fontSize: ScreenUtil().setSp(28), | ||
| 2466 | + color: MyColours.color_353535), | ||
| 2467 | + controller: _baseIndoProvider.nameController, | ||
| 2468 | + focusNode: _nameNode, | ||
| 2469 | + // textAlignVertical: TextAlignVertical.top, | ||
| 2470 | + decoration: InputDecoration( | ||
| 2471 | + hintText: "用餐类型", | ||
| 2472 | + hintStyle: TextStyle( | ||
| 2473 | + color: MyColours.color_999999, | ||
| 2474 | + fontSize: ScreenUtil().setSp(28), | ||
| 2475 | + ), | ||
| 2476 | + // contentPadding: | ||
| 2477 | + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)), | ||
| 2478 | + // border: InputBorder.none, | ||
| 2479 | + contentPadding: EdgeInsets.zero, | ||
| 2480 | + border: OutlineInputBorder( | ||
| 2481 | + borderSide: BorderSide.none), | ||
| 2482 | + ), | ||
| 2483 | + onChanged: (value) {}, | ||
| 2484 | + onTap: () {}, | ||
| 2485 | + onEditingComplete: () {}, | ||
| 2486 | + keyboardType: TextInputType.text, | ||
| 2487 | + ), | ||
| 2488 | + ), | ||
| 2489 | + InkWell( | ||
| 2490 | + onTap: () { | ||
| 2491 | + FocusScope.of(context) | ||
| 2492 | + .requestFocus(FocusNode()); //隐藏键盘 | ||
| 2493 | + // 存储 | ||
| 2494 | + | ||
| 2495 | + DialogUtil.openDishTypeSelectModalBottomSheet( | ||
| 2496 | + context, | ||
| 2497 | + detailModel.reserveTypes, | ||
| 2498 | + reserveType, rCallback: (value) async { | ||
| 2499 | + if (value != null) { | ||
| 2500 | + reserveType = value; | ||
| 2501 | + setState(() {}); | ||
| 2502 | + bool sucess = await detailModel | ||
| 2503 | + .upReserveInfo(context, widget.rid, | ||
| 2504 | + reserveType: reserveType, | ||
| 2505 | + needToast: false); | ||
| 2506 | + if (sucess) { | ||
| 2507 | + EventBus() | ||
| 2508 | + .emit("refresh_tablemanager"); //刷新桌位 | ||
| 2509 | + bus.emit("refresh_book_list"); //刷新已预订列表 | ||
| 2510 | + bus.emit("refresh_detail"); | ||
| 2511 | + // await _getReserveDetail( | ||
| 2512 | + // showCicle: false); | ||
| 2513 | + } | ||
| 2514 | + } | ||
| 2515 | + }); | ||
| 2516 | + }, | ||
| 2517 | + child: Row(children: [ | ||
| 2518 | + Text( | ||
| 2519 | + reserveType, | ||
| 2520 | + style: TextStyle( | ||
| 2521 | + color: reserveType == '请选择' | ||
| 2522 | + ? MyColours.color_999999 | ||
| 2523 | + : MyColours.color_515151, | ||
| 2524 | + fontSize: ScreenUtil().setSp(28), | ||
| 2525 | + ), | ||
| 2526 | + ), | ||
| 2527 | + HEmptyView(4), | ||
| 2528 | + Image.asset(Utils.getImgPath('quan_down_f'), | ||
| 2529 | + width: ScreenUtil().setWidth(28), | ||
| 2530 | + height: ScreenUtil().setWidth(28)), | ||
| 2531 | + ]), | ||
| 2532 | + ) | ||
| 2533 | + ], | ||
| 2534 | + )), | ||
| 2428 | //输入框 | 2535 | //输入框 |
| 2429 | Container( | 2536 | Container( |
| 2430 | width: double.infinity, | 2537 | width: double.infinity, |
| @@ -16,6 +16,7 @@ import 'package:one_key/utils/utils.dart'; | @@ -16,6 +16,7 @@ import 'package:one_key/utils/utils.dart'; | ||
| 16 | import 'package:one_key/widgets/loading.dart'; | 16 | import 'package:one_key/widgets/loading.dart'; |
| 17 | import 'package:provider/provider.dart'; | 17 | import 'package:provider/provider.dart'; |
| 18 | 18 | ||
| 19 | +import '../models/get_reserve_type_field_model.dart'; | ||
| 19 | import '../models/notebook.dart'; | 20 | import '../models/notebook.dart'; |
| 20 | import '../models/reserve_deposit_model.dart'; | 21 | import '../models/reserve_deposit_model.dart'; |
| 21 | import '../models/reserve_recheck_model.dart'; | 22 | import '../models/reserve_recheck_model.dart'; |
| @@ -36,6 +37,8 @@ class NotebookDetailModel extends ChangeNotifier { | @@ -36,6 +37,8 @@ class NotebookDetailModel extends ChangeNotifier { | ||
| 36 | List<ReserveDepositSunModel> reserveDepositList = []; //订单订金数据 | 37 | List<ReserveDepositSunModel> reserveDepositList = []; //订单订金数据 |
| 37 | List<ReserveRecheckSunModel> reserveRecheckList = []; //核餐记录数据 | 38 | List<ReserveRecheckSunModel> reserveRecheckList = []; //核餐记录数据 |
| 38 | 39 | ||
| 40 | + List<GetReserveTypeFieldsSunModel> reserveTypes = []; //用餐类型 | ||
| 41 | + | ||
| 39 | NotebookDetailModel() { | 42 | NotebookDetailModel() { |
| 40 | initSexList(); | 43 | initSexList(); |
| 41 | } | 44 | } |
| @@ -123,6 +126,40 @@ class NotebookDetailModel extends ChangeNotifier { | @@ -123,6 +126,40 @@ class NotebookDetailModel extends ChangeNotifier { | ||
| 123 | notifyListeners(); | 126 | notifyListeners(); |
| 124 | } | 127 | } |
| 125 | 128 | ||
| 129 | + ///获取用餐类型 | ||
| 130 | + Future<dynamic> getReserveTypeField(BuildContext context, | ||
| 131 | + {isShowLoading = true, bool showCircle = false}) async { | ||
| 132 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 133 | + .request<dynamic>(context, Method.get, HttpUrl.get_reserve_type_field, | ||
| 134 | + showLoading: isShowLoading ? false : showCircle) | ||
| 135 | + .catchError((error) { | ||
| 136 | + print(error.toString()); | ||
| 137 | + if (error is MyError) { | ||
| 138 | + // switch (error.type) { | ||
| 139 | + // case 1: | ||
| 140 | + // pageState = PageState.ConnectivityError; | ||
| 141 | + // break; | ||
| 142 | + // case 2: | ||
| 143 | + // pageState = PageState.ConnectivityTimeOut; | ||
| 144 | + // break; | ||
| 145 | + // default: | ||
| 146 | + // pageState = PageState.ConnectivityError; | ||
| 147 | + // break; | ||
| 148 | + // } | ||
| 149 | + } | ||
| 150 | + notifyListeners(); | ||
| 151 | + }); | ||
| 152 | + if (baseResp.code == Constant.status_success) { | ||
| 153 | + reserveTypes = | ||
| 154 | + GetReserveTypeFieldModel.fromJson(baseResp.responseData).data; | ||
| 155 | + } else { | ||
| 156 | + pageState = PageState.ConnectivityError; | ||
| 157 | + if (baseResp != null) { | ||
| 158 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 159 | + } | ||
| 160 | + } | ||
| 161 | + } | ||
| 162 | + | ||
| 126 | ///获取已预订订单 | 163 | ///获取已预订订单 |
| 127 | Future<NotebookDetail> getReserveDetail( | 164 | Future<NotebookDetail> getReserveDetail( |
| 128 | BuildContext context, Map<String, String> params, | 165 | BuildContext context, Map<String, String> params, |
| @@ -355,6 +392,7 @@ class NotebookDetailModel extends ChangeNotifier { | @@ -355,6 +392,7 @@ class NotebookDetailModel extends ChangeNotifier { | ||
| 355 | String name, | 392 | String name, |
| 356 | String phone, | 393 | String phone, |
| 357 | String ymd, | 394 | String ymd, |
| 395 | + String reserveType, | ||
| 358 | bool showLoading = false, | 396 | bool showLoading = false, |
| 359 | bool needToast = true}) async { | 397 | bool needToast = true}) async { |
| 360 | if (phone != null && phone != '') { | 398 | if (phone != null && phone != '') { |
| @@ -399,6 +437,10 @@ class NotebookDetailModel extends ChangeNotifier { | @@ -399,6 +437,10 @@ class NotebookDetailModel extends ChangeNotifier { | ||
| 399 | if (phone != null && phone != '') { | 437 | if (phone != null && phone != '') { |
| 400 | params['phone'] = phone; | 438 | params['phone'] = phone; |
| 401 | } | 439 | } |
| 440 | + if (reserveType != null && reserveType != '') { | ||
| 441 | + params['reserve_type'] = reserveType; | ||
| 442 | + } | ||
| 443 | + | ||
| 402 | bool sucess = await _upReserveInfo(context, params, | 444 | bool sucess = await _upReserveInfo(context, params, |
| 403 | showLoading: showLoading, needToast: needToast); | 445 | showLoading: showLoading, needToast: needToast); |
| 404 | if (sucess) { | 446 | if (sucess) { |
| @@ -38,6 +38,7 @@ import 'package:one_key/models/table.dart' as t; | @@ -38,6 +38,7 @@ import 'package:one_key/models/table.dart' as t; | ||
| 38 | import 'package:url_launcher/url_launcher.dart'; | 38 | import 'package:url_launcher/url_launcher.dart'; |
| 39 | 39 | ||
| 40 | import '../models/cookbook_model.dart'; | 40 | import '../models/cookbook_model.dart'; |
| 41 | +import '../models/get_reserve_type_field_model.dart'; | ||
| 41 | import '../models/radio_model.dart'; | 42 | import '../models/radio_model.dart'; |
| 42 | import '../models/seller_template_color_list_model.dart'; | 43 | import '../models/seller_template_color_list_model.dart'; |
| 43 | import '../models/seller_version_model.dart'; | 44 | import '../models/seller_version_model.dart'; |
| @@ -60,6 +61,176 @@ typedef ClickCallback = void Function(String value); | @@ -60,6 +61,176 @@ typedef ClickCallback = void Function(String value); | ||
| 60 | // }; | 61 | // }; |
| 61 | 62 | ||
| 62 | class DialogUtil { | 63 | class DialogUtil { |
| 64 | + static List<Widget> dishSelectBtn( | ||
| 65 | + List<GetReserveTypeFieldsSunModel> menuSunModel, | ||
| 66 | + state, | ||
| 67 | + ClickCallback callback) { | ||
| 68 | + List<Widget> temp = []; | ||
| 69 | + for (int i = 0; i < menuSunModel.length; i++) { | ||
| 70 | + GetReserveTypeFieldsSunModel practiceModel = menuSunModel[i]; | ||
| 71 | + temp.add(InkWell( | ||
| 72 | + onTap: () { | ||
| 73 | + for (int j = 0; j < menuSunModel.length; j++) { | ||
| 74 | + menuSunModel[j].select = false; | ||
| 75 | + } | ||
| 76 | + menuSunModel[i].select = true; | ||
| 77 | + callback(menuSunModel[i].name); | ||
| 78 | + state(() {}); | ||
| 79 | + }, | ||
| 80 | + child: Container( | ||
| 81 | + // height: w(34), | ||
| 82 | + padding: | ||
| 83 | + EdgeInsets.symmetric(horizontal: w(10), vertical: w(5)), | ||
| 84 | + decoration: BoxDecoration( | ||
| 85 | + border: Border.all( | ||
| 86 | + color: practiceModel.select | ||
| 87 | + ? MyColours.color_438E93 | ||
| 88 | + : MyColours.color_515151, | ||
| 89 | + width: w(1)), | ||
| 90 | + borderRadius: BorderRadius.circular(r(5)), | ||
| 91 | + color: practiceModel.select | ||
| 92 | + ? MyColours.color_438E93 | ||
| 93 | + : MyColours.color_ffffff, | ||
| 94 | + ), | ||
| 95 | + child: Text(practiceModel.name, | ||
| 96 | + style: TextStyle( | ||
| 97 | + fontSize: font(14), | ||
| 98 | + color: practiceModel.select | ||
| 99 | + ? MyColours.color_ffffff | ||
| 100 | + : MyColours.color_515151, | ||
| 101 | + )), | ||
| 102 | + )) | ||
| 103 | + | ||
| 104 | + // RoundButton( | ||
| 105 | + // text: practiceModel.name, | ||
| 106 | + // // bgColor: MyColours.color_ffffff, | ||
| 107 | + // gradientStart: practiceModel.select | ||
| 108 | + // ? MyColours.color_438E93 | ||
| 109 | + // : MyColours.color_ffffff, | ||
| 110 | + // gradientEnd: practiceModel.select | ||
| 111 | + // ? MyColours.color_438E93 | ||
| 112 | + // : MyColours.color_ffffff, | ||
| 113 | + // // width: w(80), | ||
| 114 | + // padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(5)), | ||
| 115 | + // height: w(34), | ||
| 116 | + // isBold: false, | ||
| 117 | + // radius: r(5), | ||
| 118 | + // textColor: practiceModel.select | ||
| 119 | + // ? MyColours.color_ffffff | ||
| 120 | + // : MyColours.color_515151, | ||
| 121 | + // borderColor: practiceModel.select | ||
| 122 | + // ? MyColours.color_438E93 | ||
| 123 | + // : MyColours.color_515151, | ||
| 124 | + // onPressed: () { | ||
| 125 | + // for (int j = 0; j < menuSunModel.length; j++) { | ||
| 126 | + // menuSunModel[j].select = false; | ||
| 127 | + // } | ||
| 128 | + // menuSunModel[i].select = true; | ||
| 129 | + // callback(menuSunModel[i].name); | ||
| 130 | + // state(() {}); | ||
| 131 | + // }, | ||
| 132 | + // ) | ||
| 133 | + ); | ||
| 134 | + } | ||
| 135 | + return temp; | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + ///用餐类型 | ||
| 139 | + static openDishTypeSelectModalBottomSheet(context, | ||
| 140 | + List<GetReserveTypeFieldsSunModel> reserveTypes, String reserveType, | ||
| 141 | + {VoidCallback lCallback, ClickCallback rCallback}) async { | ||
| 142 | + String selectType = reserveType; | ||
| 143 | + if (selectType != '请选择') { | ||
| 144 | + reserveTypes.forEach((element) { | ||
| 145 | + element.select = false; | ||
| 146 | + if (element.name == selectType) { | ||
| 147 | + element.select = true; | ||
| 148 | + } | ||
| 149 | + }); | ||
| 150 | + } | ||
| 151 | + final option = await showModalBottomSheet( | ||
| 152 | + context: context, | ||
| 153 | + backgroundColor: Colors.transparent, | ||
| 154 | + isDismissible: false, | ||
| 155 | + isScrollControlled: true, | ||
| 156 | + builder: (BuildContext context) { | ||
| 157 | + return StatefulBuilder(builder: (context, state) { | ||
| 158 | + return Container( | ||
| 159 | + decoration: BoxDecoration( | ||
| 160 | + color: MyColours.color_ffffff, | ||
| 161 | + borderRadius: BorderRadius.only( | ||
| 162 | + topLeft: Radius.circular(ScreenUtil().setWidth(10)), | ||
| 163 | + topRight: Radius.circular(ScreenUtil().setWidth(10)))), | ||
| 164 | + child: | ||
| 165 | + Column(mainAxisSize: MainAxisSize.min, children: <Widget>[ | ||
| 166 | + Row( | ||
| 167 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 168 | + children: [ | ||
| 169 | + GestureDetector( | ||
| 170 | + behavior: HitTestBehavior.opaque, | ||
| 171 | + onTap: () { | ||
| 172 | + Navigator.of(context).pop(); | ||
| 173 | + }, | ||
| 174 | + child: Container( | ||
| 175 | + // width: double.infinity, | ||
| 176 | + alignment: Alignment.center, | ||
| 177 | + padding: EdgeInsets.symmetric( | ||
| 178 | + horizontal: w(15), | ||
| 179 | + vertical: ScreenUtil().setWidth(40)), | ||
| 180 | + child: Text( | ||
| 181 | + "取消", | ||
| 182 | + style: TextStyle( | ||
| 183 | + fontSize: ScreenUtil().setSp(32), | ||
| 184 | + color: MyColours.color_438E93), | ||
| 185 | + ), | ||
| 186 | + )), | ||
| 187 | + Container( | ||
| 188 | + // width: double.infinity, | ||
| 189 | + alignment: Alignment.center, | ||
| 190 | + padding: EdgeInsets.symmetric( | ||
| 191 | + vertical: ScreenUtil().setWidth(40)), | ||
| 192 | + child: Text( | ||
| 193 | + "选择客户宴请类型", | ||
| 194 | + style: TextStyle( | ||
| 195 | + fontWeight: FontWeight.bold, | ||
| 196 | + fontSize: ScreenUtil().setSp(32), | ||
| 197 | + color: MyColours.color_E6000000), | ||
| 198 | + ), | ||
| 199 | + ), | ||
| 200 | + GestureDetector( | ||
| 201 | + behavior: HitTestBehavior.opaque, | ||
| 202 | + onTap: () { | ||
| 203 | + Navigator.of(context).pop(); | ||
| 204 | + rCallback(selectType); | ||
| 205 | + }, | ||
| 206 | + child: Container( | ||
| 207 | + // width: double.infinity, | ||
| 208 | + alignment: Alignment.center, | ||
| 209 | + padding: EdgeInsets.symmetric( | ||
| 210 | + horizontal: w(15), | ||
| 211 | + vertical: ScreenUtil().setWidth(40)), | ||
| 212 | + child: Text("确定", | ||
| 213 | + style: TextStyle( | ||
| 214 | + fontSize: ScreenUtil().setSp(32), | ||
| 215 | + color: MyColours.color_438E93)), | ||
| 216 | + )), | ||
| 217 | + ]), | ||
| 218 | + VEmptyView(50), | ||
| 219 | + Wrap( | ||
| 220 | + spacing: w(12), | ||
| 221 | + runSpacing: w(12), | ||
| 222 | + children: dishSelectBtn(reserveTypes, state, (value) { | ||
| 223 | + selectType = value; | ||
| 224 | + })), | ||
| 225 | + VEmptyView(50), | ||
| 226 | + ])); | ||
| 227 | + }); | ||
| 228 | + }); | ||
| 229 | + reserveTypes.forEach((element) { | ||
| 230 | + element.select = false; | ||
| 231 | + }); | ||
| 232 | + } | ||
| 233 | + | ||
| 63 | static showAuthorityDestination( | 234 | static showAuthorityDestination( |
| 64 | BuildContext context, String name, String title, String subTitle) async { | 235 | BuildContext context, String name, String title, String subTitle) async { |
| 65 | Timer _timer = Timer(const Duration(seconds: 5), () { | 236 | Timer _timer = Timer(const Duration(seconds: 5), () { |
-
Please register or login to post a comment