Commit 40e8d2d59dc0bbca207e30eaa919fcd755454959

Authored by “gaiyaguang”
1 parent e08b7dcf

合并

@@ -178,7 +178,7 @@ class DioUtil { @@ -178,7 +178,7 @@ class DioUtil {
178 // Utils.showToast("网络错误,请稍后重试"); 178 // Utils.showToast("网络错误,请稍后重试");
179 throw MyError(type: 1); 179 throw MyError(type: 1);
180 } 180 }
181 - if (showLoading) Loading.showLoading(context); 181 + // if (showLoading) Loading.showLoading(context);
182 try { 182 try {
183 print('--------' + path + '---------'); 183 print('--------' + path + '---------');
184 Response response = await _dio.request(path, 184 Response response = await _dio.request(path,
@@ -2,6 +2,7 @@ import 'dart:convert'; @@ -2,6 +2,7 @@ import 'dart:convert';
2 2
3 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
4 import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 import 'package:flutter_screenutil/flutter_screenutil.dart';
  5 +import 'package:one_key/constant/state.dart';
5 import 'package:one_key/models/manager.dart'; 6 import 'package:one_key/models/manager.dart';
6 import 'package:one_key/models/notebook_detail.dart'; 7 import 'package:one_key/models/notebook_detail.dart';
7 import 'package:one_key/provider/notebook_detail_model.dart'; 8 import 'package:one_key/provider/notebook_detail_model.dart';
@@ -14,6 +15,7 @@ import 'package:one_key/widgets/MyDivider.dart'; @@ -14,6 +15,7 @@ import 'package:one_key/widgets/MyDivider.dart';
14 import 'package:one_key/widgets/app_bar.dart'; 15 import 'package:one_key/widgets/app_bar.dart';
15 import 'package:one_key/widgets/common_button.dart'; 16 import 'package:one_key/widgets/common_button.dart';
16 import 'package:one_key/widgets/need_item.dart'; 17 import 'package:one_key/widgets/need_item.dart';
  18 +import 'package:one_key/widgets/page_exception.dart';
17 import 'package:one_key/widgets/row_multi_text.dart'; 19 import 'package:one_key/widgets/row_multi_text.dart';
18 import 'package:one_key/widgets/table_item.dart'; 20 import 'package:one_key/widgets/table_item.dart';
19 import 'package:one_key/models/table.dart' as t; 21 import 'package:one_key/models/table.dart' as t;
@@ -37,7 +39,7 @@ class HandleOnlinePage extends StatefulWidget { @@ -37,7 +39,7 @@ class HandleOnlinePage extends StatefulWidget {
37 } 39 }
38 40
39 class HandleOnlinePageState extends State<HandleOnlinePage> { 41 class HandleOnlinePageState extends State<HandleOnlinePage> {
40 - NotebookDetailModel detailModel = NotebookDetailModel(); 42 + NotebookDetailModel detailModel;
41 43
42 NotebookDetail detailEntity; 44 NotebookDetail detailEntity;
43 45
@@ -55,39 +57,44 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -55,39 +57,44 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
55 void initState() { 57 void initState() {
56 // TODO: implement initState 58 // TODO: implement initState
57 super.initState(); 59 super.initState();
58 - WidgetsBinding.instance.addPostFrameCallback((_) async {  
59 - detailEntity = await detailModel.getReserveDetail(context, {  
60 - "rid": widget.rid,  
61 - });  
62 - setState(() {  
63 - //未处理  
64 - cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;  
65 - formatPhone = detailEntity.phone;  
66 - if (App.sp.getString("is_call_tel") != null &&  
67 - App.sp.getString("is_call_tel") == "1") {  
68 - isCallTel = true;  
69 - } else {  
70 - isCallTel = false;  
71 - if (detailEntity.phone.isNotEmpty &&  
72 - detailEntity.phone.length == 11 &&  
73 - (detailEntity.status == "0" || detailEntity.status == "6")) {  
74 - formatPhone = detailEntity.phone.substring(0, 3) +  
75 - "****" +  
76 - detailEntity.phone.substring(7);  
77 - }  
78 - }  
79 - });  
80 - if (detailEntity.status != "0") {  
81 - //已处理  
82 - Future.delayed(Duration(milliseconds: 200), () {  
83 - NavigatorUtil.goNotebookDetailPage(context, detailEntity.id,  
84 - fromNotify: widget.fromNotify, replace: true);  
85 - });  
86 - setMessageStatus(); 60 + WidgetsBinding.instance.addPostFrameCallback((_) {
  61 + _getOrderListData();
  62 + });
  63 + }
  64 +
  65 + /// 获取当前预订订单详情
  66 + _getOrderListData() async {
  67 + detailEntity = await detailModel.getReserveDetail(context, {
  68 + "rid": widget.rid,
  69 + });
  70 + setState(() {
  71 + //未处理
  72 + cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;
  73 + formatPhone = detailEntity.phone;
  74 + if (App.sp.getString("is_call_tel") != null &&
  75 + App.sp.getString("is_call_tel") == "1") {
  76 + isCallTel = true;
87 } else { 77 } else {
88 - managers = await detailModel.getManagers(context); 78 + isCallTel = false;
  79 + if (detailEntity.phone.isNotEmpty &&
  80 + detailEntity.phone.length == 11 &&
  81 + (detailEntity.status == "0" || detailEntity.status == "6")) {
  82 + formatPhone = detailEntity.phone.substring(0, 3) +
  83 + "****" +
  84 + detailEntity.phone.substring(7);
  85 + }
89 } 86 }
90 }); 87 });
  88 + if (detailEntity.status != "0") {
  89 + //已处理
  90 + Future.delayed(Duration(milliseconds: 200), () {
  91 + NavigatorUtil.goNotebookDetailPage(context, detailEntity.id,
  92 + fromNotify: widget.fromNotify, replace: true);
  93 + });
  94 + setMessageStatus();
  95 + } else {
  96 + managers = await detailModel.getManagers(context);
  97 + }
91 } 98 }
92 99
93 //设置当前客户经理 100 //设置当前客户经理
@@ -140,7 +147,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -140,7 +147,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
140 widget.rid, 147 widget.rid,
141 int.parse(detailEntity.ddate) * 1000, 148 int.parse(detailEntity.ddate) * 1000,
142 detailEntity.ddate_solt); 149 detailEntity.ddate_solt);
143 - if (temp['tid'] != null) { 150 + if (temp != null && temp['tid'] != null) {
144 setReserveStatus("5", tid: temp['tid']); 151 setReserveStatus("5", tid: temp['tid']);
145 } 152 }
146 }, 153 },
@@ -186,30 +193,37 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -186,30 +193,37 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
186 193
187 @override 194 @override
188 Widget build(BuildContext context) { 195 Widget build(BuildContext context) {
189 - // TODO: implement build  
190 -  
191 - return SafeArea(  
192 - child: WillPopScope(  
193 - child: detailEntity == null  
194 - ? Container(  
195 - width: double.infinity,  
196 - height: double.infinity,  
197 - color: MyColours.color_ffffff,  
198 - )  
199 - : Column(  
200 - children: <Widget>[  
201 - MyAppBar(  
202 - "在线预订详情",  
203 - showBack: true, 196 + detailModel = Provider.of<NotebookDetailModel>(context, listen: true);
  197 + return Scaffold(
  198 + body: SafeArea(
  199 + child: WillPopScope(
  200 + child: Column(
  201 + children: <Widget>[
  202 + MyAppBar(
  203 + "在线预订详情",
  204 + showBack: true,
  205 + callback: () {
  206 + if (widget.fromNotify) {
  207 + NavigatorUtil.goHomePage(context, initialIndex: 0);
  208 + } else {
  209 + Navigator.of(context).pop();
  210 + }
  211 + },
  212 + ),
  213 + Expanded(child: Consumer<NotebookDetailModel>(
  214 + builder: (context, model, _) {
  215 + if (model.pageState != PageState.Success) {
  216 + return ExceptionPage(
  217 + pageState: model.pageState,
204 callback: () { 218 callback: () {
205 - if (widget.fromNotify) {  
206 - NavigatorUtil.goHomePage(context, initialIndex: 0);  
207 - } else {  
208 - Navigator.of(context).pop();  
209 - } 219 + _getOrderListData();
210 }, 220 },
211 - ),  
212 - Expanded( 221 + emptyMsg: "暂时没有预订列表信息哦",
  222 + emptyImg: "empty_search",
  223 + showMsg: "加载中,请稍后...",
  224 + );
  225 + } else {
  226 + return Expanded(
213 child: DefaultTextStyle( 227 child: DefaultTextStyle(
214 style: TextStyle(decoration: TextDecoration.none), 228 style: TextStyle(decoration: TextDecoration.none),
215 child: Container( 229 child: Container(
@@ -464,9 +478,12 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -464,9 +478,12 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
464 ) 478 )
465 ], 479 ],
466 ))), 480 ))),
467 - )  
468 - ],  
469 - ), 481 + );
  482 + }
  483 + },
  484 + ))
  485 + ],
  486 + ),
470 onWillPop: () async { 487 onWillPop: () async {
471 if (widget.fromNotify) { 488 if (widget.fromNotify) {
472 NavigatorUtil.goHomePage(context, initialIndex: 0); 489 NavigatorUtil.goHomePage(context, initialIndex: 0);
@@ -475,6 +492,6 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -475,6 +492,6 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
475 Navigator.of(context).pop(); 492 Navigator.of(context).pop();
476 return true; 493 return true;
477 }, 494 },
478 - )); 495 + )));
479 } 496 }
480 } 497 }
@@ -3,6 +3,7 @@ import 'dart:convert'; @@ -3,6 +3,7 @@ import 'dart:convert';
3 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
4 import 'package:flutter_picker/flutter_picker.dart'; 4 import 'package:flutter_picker/flutter_picker.dart';
5 import 'package:flutter_screenutil/flutter_screenutil.dart'; 5 import 'package:flutter_screenutil/flutter_screenutil.dart';
  6 +import 'package:one_key/constant/state.dart';
6 import 'package:one_key/models/manager.dart'; 7 import 'package:one_key/models/manager.dart';
7 import 'package:one_key/models/notebook_detail.dart'; 8 import 'package:one_key/models/notebook_detail.dart';
8 import 'package:one_key/provider/message_dialog_model.dart'; 9 import 'package:one_key/provider/message_dialog_model.dart';
@@ -21,6 +22,7 @@ import 'package:one_key/widgets/dialog.dart'; @@ -21,6 +22,7 @@ import 'package:one_key/widgets/dialog.dart';
21 import 'package:one_key/widgets/h_empty_view.dart'; 22 import 'package:one_key/widgets/h_empty_view.dart';
22 import 'package:one_key/widgets/loading.dart'; 23 import 'package:one_key/widgets/loading.dart';
23 import 'package:one_key/widgets/need_item.dart'; 24 import 'package:one_key/widgets/need_item.dart';
  25 +import 'package:one_key/widgets/page_exception.dart';
24 import 'package:one_key/widgets/round_button.dart'; 26 import 'package:one_key/widgets/round_button.dart';
25 import 'package:one_key/widgets/row_multi_text.dart'; 27 import 'package:one_key/widgets/row_multi_text.dart';
26 import 'package:one_key/widgets/table_item.dart'; 28 import 'package:one_key/widgets/table_item.dart';
@@ -45,7 +47,7 @@ class NotebookDetailPage extends StatefulWidget { @@ -45,7 +47,7 @@ class NotebookDetailPage extends StatefulWidget {
45 } 47 }
46 48
47 class NotebookDetailPageState extends State<NotebookDetailPage> { 49 class NotebookDetailPageState extends State<NotebookDetailPage> {
48 - NotebookDetailModel detailModel = NotebookDetailModel(); 50 + NotebookDetailModel detailModel;
49 51
50 NotebookDetail detailEntity; 52 NotebookDetail detailEntity;
51 53
@@ -64,7 +66,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -64,7 +66,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
64 66
65 ScrollController _scrollController; 67 ScrollController _scrollController;
66 68
67 - String formatPhone=""; 69 + String formatPhone = "";
68 70
69 @override 71 @override
70 void initState() { 72 void initState() {
@@ -119,11 +121,16 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -119,11 +121,16 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
119 }); 121 });
120 setState(() { 122 setState(() {
121 cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman; 123 cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;
122 - formatPhone=detailEntity.phone;  
123 - if(App.sp.getString("is_call_tel")!=null&&App.sp.getString("is_call_tel")=="1"){  
124 - }else{  
125 - if(detailEntity.phone.isNotEmpty&&detailEntity.phone.length==11&&(detailEntity.status=="0"||detailEntity.status=="6")){  
126 - formatPhone=detailEntity.phone.substring(0,3)+"****"+detailEntity.phone.substring(7); 124 + formatPhone = detailEntity.phone;
  125 + if (App.sp.getString("is_call_tel") != null &&
  126 + App.sp.getString("is_call_tel") == "1") {
  127 + } else {
  128 + if (detailEntity.phone.isNotEmpty &&
  129 + detailEntity.phone.length == 11 &&
  130 + (detailEntity.status == "0" || detailEntity.status == "6")) {
  131 + formatPhone = detailEntity.phone.substring(0, 3) +
  132 + "****" +
  133 + detailEntity.phone.substring(7);
127 } 134 }
128 } 135 }
129 }); 136 });
@@ -409,346 +416,384 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -409,346 +416,384 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
409 if (MediaQuery.of(context).viewInsets.bottom == 0) { 416 if (MediaQuery.of(context).viewInsets.bottom == 0) {
410 _cancelNode.unfocus(); 417 _cancelNode.unfocus();
411 } 418 }
412 - return WillPopScope(  
413 - child: detailEntity == null  
414 - ? Container(  
415 - width: double.infinity,  
416 - height: double.infinity,  
417 - color: MyColours.color_ffffff,  
418 - )  
419 - : Container(  
420 - color: MyColours.color_ffffff,  
421 - child: Column(  
422 - children: <Widget>[  
423 - SizedBox(height: ScreenUtil.statusBarHeight),  
424 - MyAppBar(  
425 - "订座详情",  
426 - showBack: true, 419 + detailModel = Provider.of<NotebookDetailModel>(context, listen: true);
  420 + return Scaffold(
  421 + body: SafeArea(
  422 + child: WillPopScope(
  423 + child: Container(
  424 + color: MyColours.color_ffffff,
  425 + child: Column(
  426 + children: <Widget>[
  427 + SizedBox(height: ScreenUtil.statusBarHeight),
  428 + MyAppBar(
  429 + "订座详情",
  430 + showBack: true,
  431 + callback: () {
  432 + if (widget.fromNotify) {
  433 + NavigatorUtil.goHomePage(context, initialIndex: 0);
  434 + } else {
  435 + Navigator.of(context).pop();
  436 + }
  437 + },
  438 + ),
  439 + Expanded(child:
  440 + Consumer<NotebookDetailModel>(builder: (context, model, _) {
  441 + if (model.pageState != PageState.Success) {
  442 + return ExceptionPage(
  443 + pageState: model.pageState,
427 callback: () { 444 callback: () {
428 - if (widget.fromNotify) {  
429 - NavigatorUtil.goHomePage(context, initialIndex: 0);  
430 - } else {  
431 - Navigator.of(context).pop();  
432 - } 445 + // _getOrderListData();
433 }, 446 },
434 - ),  
435 - Expanded(  
436 - child: DefaultTextStyle(  
437 - style: TextStyle(decoration: TextDecoration.none),  
438 - child: Container(  
439 - color: MyColours.color_ffffff,  
440 - child: SingleChildScrollView( 447 + emptyMsg: "暂时没有预订列表信息哦",
  448 + emptyImg: "empty_search",
  449 + showMsg: "加载中,请稍后...",
  450 + );
  451 + } else {
  452 + return Column(
  453 + children: [
  454 + Expanded(
  455 + child: DefaultTextStyle(
  456 + style: TextStyle(decoration: TextDecoration.none),
441 child: Container( 457 child: Container(
442 - color: MyColours.color_ffffff,  
443 - padding: EdgeInsets.symmetric(  
444 - horizontal: ScreenUtil().setWidth(43)),  
445 - child: Column(  
446 - children: <Widget>[  
447 - RowMultiText("用餐时段", detailEntity.ddateMd),  
448 - Stack(  
449 - alignment: Alignment.center, 458 + color: MyColours.color_ffffff,
  459 + child: SingleChildScrollView(
  460 + child: Container(
  461 + color: MyColours.color_ffffff,
  462 + padding: EdgeInsets.symmetric(
  463 + horizontal: ScreenUtil().setWidth(43)),
  464 + child: Column(
450 children: <Widget>[ 465 children: <Widget>[
451 - Column( 466 + RowMultiText(
  467 + "用餐时段", detailEntity.ddateMd),
  468 + Stack(
  469 + alignment: Alignment.center,
452 children: <Widget>[ 470 children: <Widget>[
453 - RowMultiText(  
454 - "用餐时间", detailEntity.ddateHm),  
455 - Offstage(  
456 - offstage: detailEntity.type == "0"  
457 - ? false  
458 - : true,  
459 - child: RowMultiText(  
460 - "用餐人数", detailEntity.pnum), 471 + Column(
  472 + children: <Widget>[
  473 + RowMultiText("用餐时间",
  474 + detailEntity.ddateHm),
  475 + Offstage(
  476 + offstage:
  477 + detailEntity.type == "0"
  478 + ? false
  479 + : true,
  480 + child: RowMultiText("用餐人数",
  481 + detailEntity.pnum),
  482 + )
  483 + ],
  484 + ),
  485 + Image.asset(
  486 + detailEntity.statuImgAssets,
  487 + width: ScreenUtil().setWidth(100),
  488 + height: ScreenUtil().setWidth(30),
461 ) 489 )
462 ], 490 ],
463 ), 491 ),
464 - Image.asset(  
465 - detailEntity.statuImgAssets,  
466 - width: ScreenUtil().setWidth(100),  
467 - height: ScreenUtil().setWidth(30),  
468 - )  
469 - ],  
470 - ),  
471 - Offstage(  
472 - offstage: detailEntity.demands.length <= 0  
473 - ? true  
474 - : false,  
475 - child: Column(  
476 - children: <Widget>[  
477 - RowMultiText(  
478 - "包间需求",  
479 - (detailEntity.demands.length  
480 - .toString() +  
481 - "个") ??  
482 - ""),  
483 - Align(  
484 - alignment: Alignment.centerRight,  
485 - child: Offstage(  
486 - offstage: detailEntity  
487 - .demands.length >  
488 - 0  
489 - ? false  
490 - : true,  
491 - child: Container(  
492 - height: ScreenUtil()  
493 - .setHeight(210),  
494 - child: ListView.builder(  
495 - itemBuilder:  
496 - (BuildContext contxt,  
497 - int index) {  
498 - return NeedItem(  
499 - detailEntity  
500 - .demands[index]);  
501 - },  
502 - itemCount: detailEntity  
503 - .demands.length,  
504 - shrinkWrap: true,  
505 - scrollDirection:  
506 - Axis.horizontal,  
507 - ),  
508 - ),  
509 - ))  
510 - ],  
511 - ),  
512 - ),  
513 - RowMultiText(  
514 - "预订桌位",  
515 - (detailEntity.tables.length.toString() +  
516 - "个")),  
517 - Align(  
518 - alignment: Alignment.centerRight,  
519 - child: Offstage( 492 + Offstage(
520 offstage: 493 offstage:
521 - detailEntity.tables.length > 0  
522 - ? false  
523 - : true,  
524 - child: Container(  
525 - height: ScreenUtil().setHeight(210),  
526 - child: ListView.builder(  
527 - itemBuilder: (BuildContext contxt,  
528 - int index) {  
529 - return TableItem(  
530 - detailEntity.tables[index]);  
531 - },  
532 - itemCount:  
533 - detailEntity.tables.length,  
534 - shrinkWrap: true,  
535 - scrollDirection: Axis.horizontal,  
536 - ),  
537 - ),  
538 - )),  
539 - RowMultiText("客户姓名", detailEntity.rnameStr),  
540 - RowMultiText(  
541 - "客户电话", formatPhone),  
542 - Offstage(  
543 - offstage: detailEntity.cusdem == '' ||  
544 - detailEntity.cusdem == null,  
545 - child: RowMultiText(  
546 - "备注信息", detailEntity.cusdem ?? ""),  
547 - ),  
548 - MyDivider(double.infinity,  
549 - ScreenUtil().setHeight(1)),  
550 - Container(  
551 - color: MyColours.color_ffffff,  
552 - width: double.infinity,  
553 - height: ScreenUtil().setHeight(80),  
554 - alignment: Alignment.center,  
555 - child: Stack(  
556 - alignment: Alignment.center,  
557 - children: <Widget>[  
558 - Positioned(  
559 - left: 0,  
560 - child: Text(  
561 - "客户经理",  
562 - style: TextStyle(  
563 - color: MyColours.color_828282,  
564 - fontSize:  
565 - ScreenUtil().setSp(30)),  
566 - ), 494 + detailEntity.demands.length <= 0
  495 + ? true
  496 + : false,
  497 + child: Column(
  498 + children: <Widget>[
  499 + RowMultiText(
  500 + "包间需求",
  501 + (detailEntity.demands.length
  502 + .toString() +
  503 + "个") ??
  504 + ""),
  505 + Align(
  506 + alignment:
  507 + Alignment.centerRight,
  508 + child: Offstage(
  509 + offstage: detailEntity
  510 + .demands
  511 + .length >
  512 + 0
  513 + ? false
  514 + : true,
  515 + child: Container(
  516 + height: ScreenUtil()
  517 + .setHeight(210),
  518 + child: ListView.builder(
  519 + itemBuilder:
  520 + (BuildContext
  521 + contxt,
  522 + int index) {
  523 + return NeedItem(
  524 + detailEntity
  525 + .demands[
  526 + index]);
  527 + },
  528 + itemCount: detailEntity
  529 + .demands.length,
  530 + shrinkWrap: true,
  531 + scrollDirection:
  532 + Axis.horizontal,
  533 + ),
  534 + ),
  535 + ))
  536 + ],
567 ), 537 ),
568 - Positioned(  
569 - right: 0,  
570 - child: GestureDetector(  
571 - onTap: () async {  
572 - List<String> list = [];  
573 - for (Manager manager  
574 - in managers) {  
575 - list.add(  
576 - manager.roleUserName);  
577 - }  
578 - DialogUtil  
579 - .showSelectCusmanDialog(  
580 - context, list, (value) {  
581 - if (value != null) {  
582 - setState(() {  
583 - cusmanText =  
584 - managers[value.first]  
585 - .userName;  
586 - });  
587 - _setCurrManager();  
588 - }  
589 - }).then((value) {});  
590 - },  
591 - child: Text(  
592 - cusmanText,  
593 - style: TextStyle(  
594 - color: MyColours.color_353535,  
595 - fontSize:  
596 - ScreenUtil().setSp(30),  
597 - decoration:  
598 - TextDecoration.underline, 538 + ),
  539 + RowMultiText(
  540 + "预订桌位",
  541 + (detailEntity.tables.length
  542 + .toString() +
  543 + "个")),
  544 + Align(
  545 + alignment: Alignment.centerRight,
  546 + child: Offstage(
  547 + offstage:
  548 + detailEntity.tables.length > 0
  549 + ? false
  550 + : true,
  551 + child: Container(
  552 + height:
  553 + ScreenUtil().setHeight(210),
  554 + child: ListView.builder(
  555 + itemBuilder:
  556 + (BuildContext contxt,
  557 + int index) {
  558 + return TableItem(
  559 + detailEntity
  560 + .tables[index]);
  561 + },
  562 + itemCount: detailEntity
  563 + .tables.length,
  564 + shrinkWrap: true,
  565 + scrollDirection:
  566 + Axis.horizontal,
599 ), 567 ),
600 ), 568 ),
601 - ),  
602 - )  
603 - ],  
604 - ),  
605 - ),  
606 - Offstage(  
607 - offstage: detailEntity.note_name == '' ||  
608 - detailEntity.note_name == null,  
609 - child: RowMultiText(  
610 - "记录人", detailEntity.note_name ?? ""),  
611 - ),  
612 - Offstage(  
613 - offstage: (detailEntity.status == "4" &&  
614 - detailEntity.cancel != null)  
615 - ? false  
616 - : true,  
617 - child: Column(  
618 - children: <Widget>[  
619 - MyDivider(double.infinity,  
620 - ScreenUtil().setHeight(2)),  
621 - RowMultiText("取消原因",  
622 - detailEntity.cancel?.desc ?? "",  
623 - textAlign: TextAlign.left),  
624 - RowMultiText(  
625 - "取消时间",  
626 - detailEntity.cancel?.cdateStr ??  
627 - ""),  
628 - RowMultiText(  
629 - "操作人",  
630 - detailEntity.abolition == '2'  
631 - ? '顾客在线取消'  
632 - : detailEntity  
633 - .cancel?.uname ?? 569 + )),
  570 + RowMultiText(
  571 + "客户姓名", detailEntity.rnameStr),
  572 + RowMultiText("客户电话", formatPhone),
  573 + Offstage(
  574 + offstage: detailEntity.cusdem == '' ||
  575 + detailEntity.cusdem == null,
  576 + child: RowMultiText("备注信息",
  577 + detailEntity.cusdem ?? ""),
  578 + ),
  579 + MyDivider(double.infinity,
  580 + ScreenUtil().setHeight(1)),
  581 + Container(
  582 + color: MyColours.color_ffffff,
  583 + width: double.infinity,
  584 + height: ScreenUtil().setHeight(80),
  585 + alignment: Alignment.center,
  586 + child: Stack(
  587 + alignment: Alignment.center,
  588 + children: <Widget>[
  589 + Positioned(
  590 + left: 0,
  591 + child: Text(
  592 + "客户经理",
  593 + style: TextStyle(
  594 + color: MyColours
  595 + .color_828282,
  596 + fontSize: ScreenUtil()
  597 + .setSp(30)),
  598 + ),
  599 + ),
  600 + Positioned(
  601 + right: 0,
  602 + child: GestureDetector(
  603 + onTap: () async {
  604 + List<String> list = [];
  605 + for (Manager manager
  606 + in managers) {
  607 + list.add(
  608 + manager.roleUserName);
  609 + }
  610 + DialogUtil
  611 + .showSelectCusmanDialog(
  612 + context, list,
  613 + (value) {
  614 + if (value != null) {
  615 + setState(() {
  616 + cusmanText = managers[
  617 + value.first]
  618 + .userName;
  619 + });
  620 + _setCurrManager();
  621 + }
  622 + }).then((value) {});
  623 + },
  624 + child: Text(
  625 + cusmanText,
  626 + style: TextStyle(
  627 + color: MyColours
  628 + .color_353535,
  629 + fontSize: ScreenUtil()
  630 + .setSp(30),
  631 + decoration: TextDecoration
  632 + .underline,
  633 + ),
  634 + ),
  635 + ),
  636 + )
  637 + ],
  638 + ),
  639 + ),
  640 + Offstage(
  641 + offstage: detailEntity.note_name ==
  642 + '' ||
  643 + detailEntity.note_name == null,
  644 + child: RowMultiText("记录人",
  645 + detailEntity.note_name ?? ""),
  646 + ),
  647 + Offstage(
  648 + offstage: (detailEntity.status ==
  649 + "4" &&
  650 + detailEntity.cancel != null)
  651 + ? false
  652 + : true,
  653 + child: Column(
  654 + children: <Widget>[
  655 + MyDivider(double.infinity,
  656 + ScreenUtil().setHeight(2)),
  657 + RowMultiText(
  658 + "取消原因",
  659 + detailEntity.cancel?.desc ??
  660 + "",
  661 + textAlign: TextAlign.left),
  662 + RowMultiText(
  663 + "取消时间",
  664 + detailEntity
  665 + .cancel?.cdateStr ??
634 ""), 666 ""),
635 - ],  
636 - ),  
637 - ),  
638 - ],  
639 - )),  
640 - ),  
641 - )),  
642 - ),  
643 - Offstage(  
644 - offstage: (detailEntity.status == "3" ||  
645 - detailEntity.status == "4" ||  
646 - detailEntity.status == "6")  
647 - ? true  
648 - : false,  
649 - child: Container(  
650 - width: double.infinity,  
651 - decoration: BoxDecoration(  
652 - color: MyColours.color_ffffff,  
653 - border: Border(  
654 - top: BorderSide(  
655 - color: MyColours.color_dbe3e3,  
656 - width: ScreenUtil().setWidth(1)))),  
657 - padding: EdgeInsets.fromLTRB(  
658 - ScreenUtil().setHeight(40),  
659 - ScreenUtil().setHeight(40),  
660 - ScreenUtil().setHeight(40),  
661 - ScreenUtil().setHeight(0)),  
662 - margin: EdgeInsets.symmetric(  
663 - vertical: ScreenUtil().setHeight(20)),  
664 - child: CommonButton(  
665 - content: "通知客户",  
666 - width: 669,  
667 - height: 84,  
668 - fontSize: 34,  
669 - onPress: () {  
670 - DialogUtil.showShareDialog(context)?.then((value) {  
671 - switch (value) {  
672 - case 1: //微信  
673 - NavigatorUtil.goInvicationPage(  
674 - context,  
675 - detailEntity.id,  
676 - detailEntity.tableinfoStr,  
677 - detailEntity.ddate,  
678 - detailEntity.ddateStr);  
679 - break;  
680 - case 2: //短信  
681 - NavigatorUtil.goSmsPage(  
682 - context, detailEntity.id);  
683 - break;  
684 - case 3: //电话  
685 - if (detailEntity.phone != null &&  
686 - detailEntity.phone.isNotEmpty) {  
687 - Utils.goPhone(detailEntity.phone);  
688 - } else {  
689 - Utils.showToast("没有客户电话!");  
690 - }  
691 - break;  
692 - }  
693 - });  
694 - }, 667 + RowMultiText(
  668 + "操作人",
  669 + detailEntity.abolition == '2'
  670 + ? '顾客在线取消'
  671 + : detailEntity
  672 + .cancel?.uname ??
  673 + ""),
  674 + ],
  675 + ),
  676 + ),
  677 + ],
  678 + )),
  679 + ),
  680 + )),
695 ), 681 ),
696 - ),  
697 - ),  
698 - Offstage(  
699 - offstage: (detailEntity.status == "3" ||  
700 - detailEntity.status == "4" ||  
701 - detailEntity.status == "6")  
702 - ? true  
703 - : false,  
704 - child: Container(  
705 - width: double.infinity,  
706 - height: ScreenUtil().setWidth(84),  
707 - margin: EdgeInsets.symmetric(  
708 - horizontal: ScreenUtil().setHeight(40)),  
709 - decoration: BoxDecoration(  
710 - border: Border.all(  
711 - color: MyColours.color_199095,  
712 - width: ScreenUtil().setWidth(2)),  
713 - borderRadius:  
714 - BorderRadius.circular(ScreenUtil().setWidth(10)), 682 + Offstage(
  683 + offstage: (detailEntity.status == "3" ||
  684 + detailEntity.status == "4" ||
  685 + detailEntity.status == "6")
  686 + ? true
  687 + : false,
  688 + child: Container(
  689 + width: double.infinity,
  690 + decoration: BoxDecoration(
  691 + color: MyColours.color_ffffff,
  692 + border: Border(
  693 + top: BorderSide(
  694 + color: MyColours.color_dbe3e3,
  695 + width: ScreenUtil().setWidth(1)))),
  696 + padding: EdgeInsets.fromLTRB(
  697 + ScreenUtil().setHeight(40),
  698 + ScreenUtil().setHeight(40),
  699 + ScreenUtil().setHeight(40),
  700 + ScreenUtil().setHeight(0)),
  701 + margin: EdgeInsets.symmetric(
  702 + vertical: ScreenUtil().setHeight(20)),
  703 + child: CommonButton(
  704 + content: "通知客户",
  705 + width: 669,
  706 + height: 84,
  707 + fontSize: 34,
  708 + onPress: () {
  709 + DialogUtil.showShareDialog(context)
  710 + ?.then((value) {
  711 + switch (value) {
  712 + case 1: //微信
  713 + NavigatorUtil.goInvicationPage(
  714 + context,
  715 + detailEntity.id,
  716 + detailEntity.tableinfoStr,
  717 + detailEntity.ddate,
  718 + detailEntity.ddateStr);
  719 + break;
  720 + case 2: //短信
  721 + NavigatorUtil.goSmsPage(
  722 + context, detailEntity.id);
  723 + break;
  724 + case 3: //电话
  725 + if (detailEntity.phone != null &&
  726 + detailEntity.phone.isNotEmpty) {
  727 + Utils.goPhone(detailEntity.phone);
  728 + } else {
  729 + Utils.showToast("没有客户电话!");
  730 + }
  731 + break;
  732 + }
  733 + });
  734 + },
  735 + ),
  736 + ),
715 ), 737 ),
716 - // child: Text('fff'),  
717 - child: Material(  
718 - color: Colors.transparent,  
719 - child: Row(  
720 - children: [  
721 - Expanded(  
722 - child: _cancelAndChangeBtn(() {  
723 - print('点击变更预订');  
724 - NavigatorUtil.goNoteBookChangePage(  
725 - context, detailEntity, widget.rid);  
726 - }, '变更预订')),  
727 - MyDivider(  
728 - ScreenUtil().setWidth(2),  
729 - ScreenUtil().setWidth(50), 738 + Offstage(
  739 + offstage: (detailEntity.status == "3" ||
  740 + detailEntity.status == "4" ||
  741 + detailEntity.status == "6")
  742 + ? true
  743 + : false,
  744 + child: Container(
  745 + width: double.infinity,
  746 + height: ScreenUtil().setWidth(84),
  747 + margin: EdgeInsets.symmetric(
  748 + horizontal: ScreenUtil().setHeight(40)),
  749 + decoration: BoxDecoration(
  750 + border: Border.all(
730 color: MyColours.color_199095, 751 color: MyColours.color_199095,
731 - ),  
732 - Expanded(  
733 - child: _cancelAndChangeBtn(() {  
734 - _showCancelWidget(context);  
735 - }, '取消预订')),  
736 - ],  
737 - )),  
738 - ),  
739 - ),  
740 - VEmptyView(ScreenUtil().setWidth(60))  
741 - ],  
742 - ),  
743 - ),  
744 - onWillPop: () async {  
745 - if (widget.fromNotify) {  
746 - NavigatorUtil.goHomePage(context, initialIndex: 0); 752 + width: ScreenUtil().setWidth(2)),
  753 + borderRadius: BorderRadius.circular(
  754 + ScreenUtil().setWidth(10)),
  755 + ),
  756 + // child: Text('fff'),
  757 + child: Material(
  758 + color: Colors.transparent,
  759 + child: Row(
  760 + children: [
  761 + Expanded(
  762 + child: _cancelAndChangeBtn(() {
  763 + print('点击变更预订');
  764 + NavigatorUtil.goNoteBookChangePage(
  765 + context, detailEntity, widget.rid);
  766 + }, '变更预订')),
  767 + MyDivider(
  768 + ScreenUtil().setWidth(2),
  769 + ScreenUtil().setWidth(50),
  770 + color: MyColours.color_199095,
  771 + ),
  772 + Expanded(
  773 + child: _cancelAndChangeBtn(() {
  774 + _showCancelWidget(context);
  775 + }, '取消预订')),
  776 + ],
  777 + )),
  778 + ),
  779 + ),
  780 + VEmptyView(ScreenUtil().setWidth(60))
  781 + ],
  782 + );
  783 + }
  784 + })),
  785 + ],
  786 + ),
  787 + ),
  788 + onWillPop: () async {
  789 + if (widget.fromNotify) {
  790 + NavigatorUtil.goHomePage(context, initialIndex: 0);
  791 + return true;
  792 + }
  793 + Navigator.of(context).pop();
747 return true; 794 return true;
748 - }  
749 - Navigator.of(context).pop();  
750 - return true;  
751 - }, 795 + },
  796 + )),
752 ); 797 );
753 } 798 }
754 } 799 }
@@ -2,6 +2,7 @@ import 'dart:ffi'; @@ -2,6 +2,7 @@ import 'dart:ffi';
2 2
3 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
4 import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 import 'package:flutter_screenutil/flutter_screenutil.dart';
  5 +import 'package:one_key/constant/state.dart';
5 import 'package:one_key/models/area.dart'; 6 import 'package:one_key/models/area.dart';
6 import 'package:one_key/models/notebook.dart'; 7 import 'package:one_key/models/notebook.dart';
7 import 'package:one_key/models/tableOuter.dart'; 8 import 'package:one_key/models/tableOuter.dart';
@@ -16,6 +17,7 @@ import 'package:one_key/utils/utils.dart'; @@ -16,6 +17,7 @@ import 'package:one_key/utils/utils.dart';
16 import 'package:one_key/widgets/app_bar.dart'; 17 import 'package:one_key/widgets/app_bar.dart';
17 import 'package:one_key/widgets/area_item.dart'; 18 import 'package:one_key/widgets/area_item.dart';
18 import 'package:one_key/widgets/common_button.dart'; 19 import 'package:one_key/widgets/common_button.dart';
  20 +import 'package:one_key/widgets/page_exception.dart';
19 import 'package:one_key/widgets/table_item.dart'; 21 import 'package:one_key/widgets/table_item.dart';
20 import 'package:one_key/models/table.dart' as t; 22 import 'package:one_key/models/table.dart' as t;
21 import 'package:provider/provider.dart'; 23 import 'package:provider/provider.dart';
@@ -46,8 +48,6 @@ class SelectTablePageState extends State<SelectTablePage> { @@ -46,8 +48,6 @@ class SelectTablePageState extends State<SelectTablePage> {
46 48
47 Map<String, List<t.Table>> areaTableMap = {}; //区域-桌位Map 49 Map<String, List<t.Table>> areaTableMap = {}; //区域-桌位Map
48 50
49 - SelectTableModel selectTableModel = new SelectTableModel();  
50 -  
51 ChooseTableModel _chooseTableModel; 51 ChooseTableModel _chooseTableModel;
52 52
53 Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单 53 Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单
@@ -67,7 +67,10 @@ class SelectTablePageState extends State<SelectTablePage> { @@ -67,7 +67,10 @@ class SelectTablePageState extends State<SelectTablePage> {
67 getTableList() async { 67 getTableList() async {
68 UserModel userModel = Provider.of<UserModel>(context, listen: false); 68 UserModel userModel = Provider.of<UserModel>(context, listen: false);
69 Map<String, String> params = {"sellerid": userModel.user.sellerid}; 69 Map<String, String> params = {"sellerid": userModel.user.sellerid};
70 - tableOuterList = await selectTableModel.getTableList(context, params); 70 + tableOuterList = await _chooseTableModel.getTableList(
  71 + context,
  72 + params,
  73 + );
71 for (TableOuter item in tableOuterList) { 74 for (TableOuter item in tableOuterList) {
72 // if (item.name == "推荐") { 75 // if (item.name == "推荐") {
73 // itemModelList.remove(item); 76 // itemModelList.remove(item);
@@ -83,7 +86,9 @@ class SelectTablePageState extends State<SelectTablePage> { @@ -83,7 +86,9 @@ class SelectTablePageState extends State<SelectTablePage> {
83 } 86 }
84 } 87 }
85 } 88 }
86 - _getReserveList(userModel.user.sellerid); 89 + if (_chooseTableModel.pageState == PageState.Success) {
  90 + _getReserveList(userModel.user.sellerid);
  91 + }
87 } 92 }
88 93
89 //获取已预订列表 94 //获取已预订列表
@@ -175,101 +180,124 @@ class SelectTablePageState extends State<SelectTablePage> { @@ -175,101 +180,124 @@ class SelectTablePageState extends State<SelectTablePage> {
175 @override 180 @override
176 Widget build(BuildContext context) { 181 Widget build(BuildContext context) {
177 _chooseTableModel = Provider.of<ChooseTableModel>(context); 182 _chooseTableModel = Provider.of<ChooseTableModel>(context);
178 - return SafeArea(  
179 - child: areaTableMap.isEmpty  
180 - ? Container(  
181 - width: double.infinity,  
182 - height: double.infinity,  
183 - color: MyColours.color_ffffff,  
184 - )  
185 - : Column(  
186 - children: <Widget>[  
187 - MyAppBar(  
188 - "选择桌位",  
189 - showBack: true,  
190 - ),  
191 - Expanded(  
192 - child: Container(  
193 - color: MyColours.color_ffffff,  
194 - child: Row(  
195 - children: <Widget>[  
196 - Container(  
197 - width: ScreenUtil().setWidth(170),  
198 - height: double.infinity,  
199 - color: MyColours.color_f1f1f1,  
200 - child: ListView.builder(  
201 - itemBuilder: (context, index) {  
202 - return AreaItem(areas[index], currentArea,  
203 - (area) {  
204 - setState(() {  
205 - currentArea = (area as Area).name;  
206 - }); 183 + return Scaffold(
  184 + body: SafeArea(
  185 + child: Column(
  186 + children: <Widget>[
  187 + MyAppBar(
  188 + "选择桌位",
  189 + showBack: true,
  190 + ),
  191 + Expanded(
  192 + child: Consumer<ChooseTableModel>(builder: (context, model, _) {
  193 + if (model.pageState != PageState.Success) {
  194 + return ExceptionPage(
  195 + pageState: model.pageState,
  196 + callback: () {
  197 + getTableList();
  198 + },
  199 + emptyMsg: "暂时没有预订哦",
  200 + emptyImg: "empty_search",
  201 + showMsg: "加载中,请稍后...",
  202 + );
  203 + } else {
  204 + return Container(
  205 + color: MyColours.color_ffffff,
  206 + child: Row(
  207 + children: <Widget>[
  208 + Container(
  209 + width: ScreenUtil().setWidth(170),
  210 + height: double.infinity,
  211 + color: MyColours.color_f1f1f1,
  212 + child: ListView.builder(
  213 + itemBuilder: (context, index) {
  214 + return AreaItem(areas[index], currentArea, (area) {
  215 + setState(() {
  216 + currentArea = (area as Area).name;
207 }); 217 });
208 - },  
209 - itemExtent: ScreenUtil().setHeight(207),  
210 - itemCount: areas.length,  
211 - ), 218 + });
  219 + },
  220 + itemExtent: ScreenUtil().setHeight(207),
  221 + itemCount: areas.length,
212 ), 222 ),
213 - Expanded(  
214 - child: Padding(  
215 - padding: EdgeInsets.symmetric(  
216 - vertical: ScreenUtil().setHeight(10),  
217 - horizontal: ScreenUtil().setWidth(9)),  
218 - child: Column(  
219 - children: [  
220 - Expanded(  
221 - child: GridView.builder(  
222 - gridDelegate:  
223 - SliverGridDelegateWithFixedCrossAxisCount(  
224 - crossAxisCount: 3,  
225 - childAspectRatio: 8 / 9),  
226 - itemBuilder: (context, index) {  
227 - return TableItem(  
228 - areaTableMap[currentArea][index],  
229 - onSelected: (table) {  
230 - if ((table as t.Table).selected) {  
231 - selectTables.add(table);  
232 - widget.tableList  
233 - .add(tableToTableList(table));  
234 - } else {  
235 - widget.tableList.removeWhere(  
236 - (t) => t.id == table.id);  
237 - selectTables.removeWhere(  
238 - (t) => t.id == table.id);  
239 - }  
240 - },  
241 - canSelected: true,  
242 - canChoose: widget.canChoose,  
243 - tableMap: tableMap,  
244 - rid: widget.rid); 223 + ),
  224 + Expanded(
  225 + child: Padding(
  226 + padding: EdgeInsets.symmetric(
  227 + vertical: ScreenUtil().setHeight(10),
  228 + horizontal: ScreenUtil().setWidth(9)),
  229 + child: Column(
  230 + children: [
  231 + Expanded(
  232 + child: GridView.builder(
  233 + gridDelegate:
  234 + SliverGridDelegateWithFixedCrossAxisCount(
  235 + crossAxisCount: 3,
  236 + childAspectRatio: 8 / 9),
  237 + itemBuilder: (context, index) {
  238 + return TableItem(
  239 + areaTableMap[currentArea][index],
  240 + onSelected: (table) {
  241 + if ((table as t.Table).selected) {
  242 + selectTables.add(table);
  243 + widget.tableList
  244 + .add(tableToTableList(table));
  245 + } else {
  246 + widget.tableList.removeWhere(
  247 + (t) => t.id == table.id);
  248 + selectTables.removeWhere(
  249 + (t) => t.id == table.id);
  250 + }
245 }, 251 },
246 - itemCount: areaTableMap[currentArea].length,  
247 - )),  
248 - Container(  
249 - width: double.infinity,  
250 - height: ScreenUtil().setHeight(84),  
251 - margin: EdgeInsets.only(  
252 - bottom: ScreenUtil().setWidth(50)),  
253 - padding: EdgeInsets.symmetric(  
254 - horizontal:  
255 - ScreenUtil().setWidth(31)),  
256 - alignment: Alignment.center,  
257 - color: MyColours.color_ffffff,  
258 - child: CommonButton(  
259 - content: "确定",  
260 - width: 500,  
261 - height: 84,  
262 - fontSize: 34,  
263 - state: 1,  
264 - onPress: () {  
265 - if (widget.canChoose) {  
266 - // if (widget.tableList.length > 0) { 252 + canSelected: true,
  253 + canChoose: widget.canChoose,
  254 + tableMap: tableMap,
  255 + rid: widget.rid);
  256 + },
  257 + itemCount: areaTableMap[currentArea].length,
  258 + )),
  259 + Container(
  260 + width: double.infinity,
  261 + height: ScreenUtil().setHeight(84),
  262 + margin: EdgeInsets.only(
  263 + bottom: ScreenUtil().setWidth(50)),
  264 + padding: EdgeInsets.symmetric(
  265 + horizontal: ScreenUtil().setWidth(31)),
  266 + alignment: Alignment.center,
  267 + color: MyColours.color_ffffff,
  268 + child: CommonButton(
  269 + content: "确定",
  270 + width: 500,
  271 + height: 84,
  272 + fontSize: 34,
  273 + state: 1,
  274 + onPress: () {
  275 + if (widget.canChoose) {
  276 + // if (widget.tableList.length > 0) {
  277 + String tid = "";
  278 + for (TableList table
  279 + in widget.tableList) {
  280 + tid += table.id + ",";
  281 + }
  282 + if (widget.tableList.length > 0) {
  283 + tid = tid.substring(
  284 + 0, tid.length - 1);
  285 + }
  286 +
  287 + Map temp = {
  288 + 'object': widget.tableList,
  289 + 'tid': tid
  290 + };
  291 + Navigator.of(context).pop(temp);
  292 + // }
  293 + } else {
  294 + if (selectTables.length > 0) {
267 String tid = ""; 295 String tid = "";
268 - for (TableList table  
269 - in widget.tableList) { 296 + for (t.Table table
  297 + in selectTables) {
270 tid += table.id + ","; 298 tid += table.id + ",";
271 } 299 }
272 - if (widget.tableList.length > 0) { 300 + if (selectTables.length > 0) {
273 tid = tid.substring( 301 tid = tid.substring(
274 0, tid.length - 1); 302 0, tid.length - 1);
275 } 303 }
@@ -279,38 +307,22 @@ class SelectTablePageState extends State<SelectTablePage> { @@ -279,38 +307,22 @@ class SelectTablePageState extends State<SelectTablePage> {
279 'tid': tid 307 'tid': tid
280 }; 308 };
281 Navigator.of(context).pop(temp); 309 Navigator.of(context).pop(temp);
282 - // }  
283 - } else {  
284 - if (selectTables.length > 0) {  
285 - String tid = "";  
286 - for (t.Table table  
287 - in selectTables) {  
288 - tid += table.id + ",";  
289 - }  
290 - if (selectTables.length > 0) {  
291 - tid = tid.substring(  
292 - 0, tid.length - 1);  
293 - }  
294 -  
295 - Map temp = {  
296 - 'object': widget.tableList,  
297 - 'tid': tid  
298 - };  
299 - Navigator.of(context).pop(temp);  
300 - }  
301 } 310 }
302 - },  
303 - )),  
304 - ],  
305 - )),  
306 - )  
307 - ],  
308 - ), 311 + }
  312 + },
  313 + )),
  314 + ],
  315 + )),
  316 + )
  317 + ],
309 ), 318 ),
310 - ),  
311 - ],  
312 - ),  
313 - ); 319 + );
  320 + }
  321 + }),
  322 + ),
  323 + ],
  324 + ),
  325 + ));
314 } 326 }
315 327
316 tableToTableList(t.Table table) { 328 tableToTableList(t.Table table) {
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
  2 +import 'package:one_key/constant/constant.dart';
  3 +import 'package:one_key/constant/error.dart';
  4 +import 'package:one_key/constant/state.dart';
  5 +import 'package:one_key/models/tableOuter.dart';
2 import 'package:one_key/models/table_list.dart'; 6 import 'package:one_key/models/table_list.dart';
  7 +import 'package:one_key/net/base_resp.dart';
  8 +import 'package:one_key/net/dio_util.dart';
  9 +import 'package:one_key/net/http_url.dart';
  10 +import 'package:one_key/models/table.dart' as t;
3 11
4 class ChooseTableModel with ChangeNotifier { 12 class ChooseTableModel with ChangeNotifier {
5 List<TableList> tableList = []; 13 List<TableList> tableList = [];
  14 + PageState pageState = PageState.Loading;
  15 +
  16 + //获取桌位数据
  17 + Future<List<TableOuter>> getTableList(
  18 + BuildContext context, Map<String, String> params,
  19 + {isShowLoading = true}) async {
  20 + if (isShowLoading) {
  21 + pageState = PageState.Loading;
  22 + notifyListeners();
  23 + }
  24 + BaseResp<List> baseResp = await DioUtil()
  25 + .request<List>(context, Method.get, HttpUrl.table_list,
  26 + data: params, showLoading: true)
  27 + .catchError((error) {
  28 + print(error.toString());
  29 + if (error is MyError) {
  30 + switch (error.type) {
  31 + case 1:
  32 + pageState = PageState.ConnectivityError;
  33 + break;
  34 + case 2:
  35 + pageState = PageState.ConnectivityTimeOut;
  36 + break;
  37 + default:
  38 + pageState = PageState.ConnectivityError;
  39 + break;
  40 + }
  41 + }
  42 + notifyListeners();
  43 + });
  44 + if (baseResp.code == Constant.status_success) {
  45 + if ((baseResp.data[0] as List).isEmpty) {
  46 + pageState = PageState.Empty;
  47 + notifyListeners();
  48 + } else {
  49 + pageState = PageState.Success;
  50 + }
  51 +
  52 + return (baseResp.data[0] as List).map((value) {
  53 + TableOuter tableOuter = TableOuter();
  54 + tableOuter.name = value["name"];
  55 + tableOuter.list = (value["list"] as List).map((table) {
  56 + return t.Table.fromJson(table as Map<String, dynamic>);
  57 + }).toList();
  58 + return tableOuter;
  59 + }).toList();
  60 + } else {
  61 + pageState = PageState.ConnectivityError;
  62 + notifyListeners();
  63 + }
  64 + return [];
  65 + }
6 } 66 }
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:one_key/constant/constant.dart'; 2 import 'package:one_key/constant/constant.dart';
  3 +import 'package:one_key/constant/error.dart';
  4 +import 'package:one_key/constant/state.dart';
3 import 'package:one_key/models/manager.dart'; 5 import 'package:one_key/models/manager.dart';
4 import 'package:one_key/models/notebook_detail.dart'; 6 import 'package:one_key/models/notebook_detail.dart';
5 import 'package:one_key/net/base_resp.dart'; 7 import 'package:one_key/net/base_resp.dart';
@@ -11,18 +13,50 @@ import 'package:one_key/utils/utils.dart'; @@ -11,18 +13,50 @@ import 'package:one_key/utils/utils.dart';
11 import 'package:provider/provider.dart'; 13 import 'package:provider/provider.dart';
12 14
13 class NotebookDetailModel extends ChangeNotifier { 15 class NotebookDetailModel extends ChangeNotifier {
  16 + PageState pageState = PageState.Loading;
  17 +
14 ///获取已预订订单 18 ///获取已预订订单
15 Future<NotebookDetail> getReserveDetail( 19 Future<NotebookDetail> getReserveDetail(
16 - BuildContext context, Map<String, String> params) async { 20 + BuildContext context, Map<String, String> params,
  21 + {isShowLoading = true}) async {
  22 + if (isShowLoading) {
  23 + pageState = PageState.Loading;
  24 + notifyListeners();
  25 + }
17 BaseResp<Map<String, dynamic>> baseResp = await DioUtil() 26 BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
18 .request<Map<String, dynamic>>( 27 .request<Map<String, dynamic>>(
19 context, Method.get, HttpUrl.reserve_detail, 28 context, Method.get, HttpUrl.reserve_detail,
20 data: params) 29 data: params)
21 .catchError((error) { 30 .catchError((error) {
22 print(error.toString()); 31 print(error.toString());
  32 + if (error is MyError) {
  33 + switch (error.type) {
  34 + case 1:
  35 + pageState = PageState.ConnectivityError;
  36 + break;
  37 + case 2:
  38 + pageState = PageState.ConnectivityTimeOut;
  39 + break;
  40 + default:
  41 + pageState = PageState.ConnectivityError;
  42 + break;
  43 + }
  44 + }
  45 + notifyListeners();
23 }); 46 });
24 if (baseResp.code == Constant.status_success) { 47 if (baseResp.code == Constant.status_success) {
  48 + if (baseResp.data.isEmpty) {
  49 + pageState = PageState.ConnectivityError;
  50 + } else {
  51 + pageState = PageState.Success;
  52 + }
  53 + notifyListeners();
25 return NotebookDetail.fromJson(baseResp.data); 54 return NotebookDetail.fromJson(baseResp.data);
  55 + } else {
  56 + pageState = PageState.ConnectivityError;
  57 + if (baseResp != null) {
  58 + Utils.showToast(baseResp.msg ?? "");
  59 + }
26 } 60 }
27 } 61 }
28 62
@@ -61,7 +95,8 @@ class NotebookDetailModel extends ChangeNotifier { @@ -61,7 +95,8 @@ class NotebookDetailModel extends ChangeNotifier {
61 } 95 }
62 96
63 //安排在线预订 97 //安排在线预订
64 - Future<bool> setReserveStatus(BuildContext context, Map<String, String> params, 98 + Future<bool> setReserveStatus(
  99 + BuildContext context, Map<String, String> params,
65 {ifPush = true, showLoading = false}) async { 100 {ifPush = true, showLoading = false}) async {
66 BaseResp<Map<String, dynamic>> baseResp = await DioUtil() 101 BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
67 .request<Map<String, dynamic>>( 102 .request<Map<String, dynamic>>(
@@ -70,7 +105,7 @@ class NotebookDetailModel extends ChangeNotifier { @@ -70,7 +105,7 @@ class NotebookDetailModel extends ChangeNotifier {
70 .catchError((error) { 105 .catchError((error) {
71 print(error.toString()); 106 print(error.toString());
72 }); 107 });
73 - if(baseResp==null) return false; 108 + if (baseResp == null) return false;
74 if (baseResp.code == Constant.status_success) { 109 if (baseResp.code == Constant.status_success) {
75 if (ifPush) { 110 if (ifPush) {
76 NavigatorUtil.goNotebookDetailPage(context, params["rid"], 111 NavigatorUtil.goNotebookDetailPage(context, params["rid"],
1 -import 'package:flutter/material.dart';  
2 -import 'package:one_key/constant/constant.dart';  
3 -import 'package:one_key/models/tableOuter.dart';  
4 -import 'package:one_key/net/base_resp.dart';  
5 -import 'package:one_key/net/dio_util.dart';  
6 -import 'package:one_key/net/http_url.dart';  
7 -import 'package:one_key/models/table.dart' as t;  
8 -import 'package:one_key/utils/navigator_util.dart';  
9 -import 'package:one_key/utils/utils.dart'; 1 +// import 'package:flutter/material.dart';
  2 +// import 'package:one_key/constant/constant.dart';
  3 +// import 'package:one_key/constant/state.dart';
  4 +// import 'package:one_key/models/tableOuter.dart';
  5 +// import 'package:one_key/net/base_resp.dart';
  6 +// import 'package:one_key/net/dio_util.dart';
  7 +// import 'package:one_key/net/http_url.dart';
  8 +// import 'package:one_key/models/table.dart' as t;
  9 +// import 'package:one_key/utils/navigator_util.dart';
  10 +// import 'package:one_key/utils/utils.dart';
10 11
11 -class SelectTableModel{ 12 +// class SelectTableModel {
  13 +// PageState pageState = PageState.Loading;
12 14
13 - //获取桌位数据  
14 - Future<List<TableOuter>> getTableList(BuildContext context,Map<String,String> params) async {  
15 - BaseResp<List> baseResp = await DioUtil()  
16 - .request<List>(context, Method.get, HttpUrl.table_list,  
17 - data: params,showLoading: true)  
18 - .catchError((error) {  
19 - print(error.toString());  
20 - });  
21 - if(baseResp.code==Constant.status_success){  
22 - return (baseResp.data[0] as List).map((value){  
23 - TableOuter tableOuter=TableOuter();  
24 - tableOuter.name=value["name"];  
25 - tableOuter.list=(value["list"] as List).map((table){  
26 - return t.Table.fromJson(table as Map<String,dynamic>);  
27 - }).toList();  
28 - return tableOuter;  
29 - }).toList();  
30 - }  
31 - return [];  
32 - }  
33 -}  
  15 +// //获取桌位数据
  16 +// Future<List<TableOuter>> getTableList(
  17 +// BuildContext context, Map<String, String> params,
  18 +// {isShowLoading = true}) async {
  19 +// if (isShowLoading) {
  20 +// pageState = PageState.Loading;
  21 +// notifyListeners();
  22 +// }
  23 +// BaseResp<List> baseResp = await DioUtil()
  24 +// .request<List>(context, Method.get, HttpUrl.table_list,
  25 +// data: params, showLoading: true)
  26 +// .catchError((error) {
  27 +// print(error.toString());
  28 +// });
  29 +// if (baseResp.code == Constant.status_success) {
  30 +// return (baseResp.data[0] as List).map((value) {
  31 +// TableOuter tableOuter = TableOuter();
  32 +// tableOuter.name = value["name"];
  33 +// tableOuter.list = (value["list"] as List).map((table) {
  34 +// return t.Table.fromJson(table as Map<String, dynamic>);
  35 +// }).toList();
  36 +// return tableOuter;
  37 +// }).toList();
  38 +// }
  39 +// return [];
  40 +// }
  41 +// }
@@ -17,6 +17,7 @@ import 'package:one_key/pages/table/select_table_page.dart'; @@ -17,6 +17,7 @@ import 'package:one_key/pages/table/select_table_page.dart';
17 import 'package:one_key/pages/webview/webview_page.dart'; 17 import 'package:one_key/pages/webview/webview_page.dart';
18 import 'package:one_key/provider/choose_table_model.dart'; 18 import 'package:one_key/provider/choose_table_model.dart';
19 import 'package:one_key/provider/notebook_detail_change_model.dart'; 19 import 'package:one_key/provider/notebook_detail_change_model.dart';
  20 +import 'package:one_key/provider/notebook_detail_model.dart';
20 import 'package:one_key/utils/fluro_convert_utils.dart'; 21 import 'package:one_key/utils/fluro_convert_utils.dart';
21 import 'package:one_key/utils/log_util.dart'; 22 import 'package:one_key/utils/log_util.dart';
22 import 'package:provider/provider.dart'; 23 import 'package:provider/provider.dart';
@@ -40,9 +41,15 @@ var homeHandler = new Handler( @@ -40,9 +41,15 @@ var homeHandler = new Handler(
40 var reserveDetailHandler = new Handler( 41 var reserveDetailHandler = new Handler(
41 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 42 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
42 String rid = params['rid'].first; 43 String rid = params['rid'].first;
43 - String mid=params['mid'].first;  
44 - bool fromNotify=FluroConvertUtils.string2bool(params["fromNotify"].first);  
45 - return NotebookDetailPage(rid,mid:mid,fromNotify: fromNotify,); 44 + String mid = params['mid'].first;
  45 + bool fromNotify = FluroConvertUtils.string2bool(params["fromNotify"].first);
  46 + return ChangeNotifierProvider<NotebookDetailModel>(
  47 + create: (_) => NotebookDetailModel(),
  48 + child: NotebookDetailPage(
  49 + rid,
  50 + mid: mid,
  51 + fromNotify: fromNotify,
  52 + ));
46 }); 53 });
47 54
48 // 跳转到处理在线预订 55 // 跳转到处理在线预订
@@ -50,8 +57,11 @@ var handleOnlineHandler = new Handler( @@ -50,8 +57,11 @@ var handleOnlineHandler = new Handler(
50 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 57 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
51 String rid = params['rid'].first; 58 String rid = params['rid'].first;
52 String mid = params["mid"].first; 59 String mid = params["mid"].first;
53 - bool fromNotify=FluroConvertUtils.string2bool(params["fromNotify"].first);  
54 - return HandleOnlinePage(rid, mid,fromNotify: fromNotify,); 60 + bool fromNotify = FluroConvertUtils.string2bool(params["fromNotify"].first);
  61 + return ChangeNotifierProvider<NotebookDetailModel>(
  62 + create: (_) => NotebookDetailModel(),
  63 + child: HandleOnlinePage(rid, mid, fromNotify: fromNotify));
  64 + // return HandleOnlinePage(rid, mid,fromNotify: fromNotify);
55 }); 65 });
56 66
57 // 跳转到选择桌位 67 // 跳转到选择桌位
@@ -66,7 +66,7 @@ class ExceptionPageState extends State<ExceptionPage> { @@ -66,7 +66,7 @@ class ExceptionPageState extends State<ExceptionPage> {
66 page = Container( 66 page = Container(
67 width: 0, 67 width: 0,
68 height: 10, 68 height: 10,
69 - color: Colors.blue, 69 + color: Colors.white,
70 ); 70 );
71 break; 71 break;
72 default: 72 default: