Commit 4a0369c38940f546761ab05a74fff4fbd0d30d85

Authored by wdn127929
1 parent 44d31008

已预订订单按照桌位区域排序

@@ -15,7 +15,15 @@ Notebook _$NotebookFromJson(Map<String, dynamic> json) { @@ -15,7 +15,15 @@ Notebook _$NotebookFromJson(Map<String, dynamic> json) {
15 data.add(new ReserveRecheckSunModel.fromJson(v)); 15 data.add(new ReserveRecheckSunModel.fromJson(v));
16 }); 16 });
17 } 17 }
  18 +
  19 + List<dynamic> tabletemp = convert.jsonDecode(json['tableinfo'] as String);
  20 +
  21 + List<t.TableList> temp = [];
  22 + tabletemp.forEach((element) {
  23 + temp.add(t.TableList.fromJson(element));
  24 + });
18 return Notebook() 25 return Notebook()
  26 + ..tableinfoList = temp
19 ..tableinfo = json['tableinfo'] as String 27 ..tableinfo = json['tableinfo'] as String
20 ..id = json['id'] as String 28 ..id = json['id'] as String
21 ..orderid = json['orderid'] as String 29 ..orderid = json['orderid'] as String
1 import 'package:json_annotation/json_annotation.dart'; 1 import 'package:json_annotation/json_annotation.dart';
2 2
  3 +import 'notebook.dart';
  4 +
3 part 'table.g.dart'; 5 part 'table.g.dart';
4 6
5 @JsonSerializable() 7 @JsonSerializable()
@@ -41,6 +43,8 @@ class Table { @@ -41,6 +43,8 @@ class Table {
41 String reserveCount; //预订总次数 43 String reserveCount; //预订总次数
42 String phone; //订餐人电话 44 String phone; //订餐人电话
43 45
  46 + Notebook notebook;
  47 +
44 //预订总次数显示 48 //预订总次数显示
45 String get reserveCountShow { 49 String get reserveCountShow {
46 if (reserveCount == '1' || phone == null || phone == '' 50 if (reserveCount == '1' || phone == null || phone == ''
  1 +import 'package:one_key/models/notebook.dart';
1 import 'package:one_key/models/table.dart'; 2 import 'package:one_key/models/table.dart';
2 import 'package:one_key/models/table.dart' as t; 3 import 'package:one_key/models/table.dart' as t;
3 4
@@ -10,6 +11,8 @@ class TableOuter { @@ -10,6 +11,8 @@ class TableOuter {
10 List<t.Table> selectTables = []; //选择的桌位 11 List<t.Table> selectTables = []; //选择的桌位
11 String orderId; 12 String orderId;
12 13
  14 +
  15 +
13 // bool get isAll { 16 // bool get isAll {
14 // return list.every((element) => element.selected); 17 // return list.every((element) => element.selected);
15 // } 18 // }
@@ -29,6 +29,8 @@ import 'package:one_key/widgets/v_empty_view.dart'; @@ -29,6 +29,8 @@ import 'package:one_key/widgets/v_empty_view.dart';
29 import 'package:provider/provider.dart'; 29 import 'package:provider/provider.dart';
30 import 'package:table_calendar/table_calendar.dart'; 30 import 'package:table_calendar/table_calendar.dart';
31 31
  32 +import '../../provider/table_manager_model.dart';
  33 +
32 class NoteBookPage extends StatefulWidget { 34 class NoteBookPage extends StatefulWidget {
33 final int tabIndex; 35 final int tabIndex;
34 36
@@ -207,6 +209,8 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -207,6 +209,8 @@ class NoteBookPageState extends State<NoteBookPage> {
207 209
208 //获取已预订列表 210 //获取已预订列表
209 _getReserveList({bool needLoading = false, bool showLoading = true}) async { 211 _getReserveList({bool needLoading = false, bool showLoading = true}) async {
  212 +
  213 +
210 Map<String, String> params = { 214 Map<String, String> params = {
211 "sid": userModel.user.sellerid, 215 "sid": userModel.user.sellerid,
212 "rdate": _getRdate(), 216 "rdate": _getRdate(),
@@ -225,6 +229,10 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -225,6 +229,10 @@ class NoteBookPageState extends State<NoteBookPage> {
225 _simpleState(); 229 _simpleState();
226 } 230 }
227 231
  232 +
  233 +
  234 +
  235 +
228 //解析返回显示的日期 236 //解析返回显示的日期
229 _parseDateDay(DateTime dateTime) { 237 _parseDateDay(DateTime dateTime) {
230 DateTime now = DateTime.now(); 238 DateTime now = DateTime.now();
@@ -6,6 +6,7 @@ import 'package:one_key/models/notebook.dart'; @@ -6,6 +6,7 @@ import 'package:one_key/models/notebook.dart';
6 import 'package:one_key/net/base_resp.dart'; 6 import 'package:one_key/net/base_resp.dart';
7 import 'package:one_key/net/dio_util.dart'; 7 import 'package:one_key/net/dio_util.dart';
8 import 'package:one_key/net/http_url.dart'; 8 import 'package:one_key/net/http_url.dart';
  9 +import 'package:one_key/provider/table_manager_model.dart';
9 import 'package:one_key/provider/user_model.dart'; 10 import 'package:one_key/provider/user_model.dart';
10 import 'package:one_key/utils/utils.dart'; 11 import 'package:one_key/utils/utils.dart';
11 import 'package:provider/provider.dart'; 12 import 'package:provider/provider.dart';
@@ -30,8 +31,7 @@ class NoteBookModel extends ChangeNotifier { @@ -30,8 +31,7 @@ class NoteBookModel extends ChangeNotifier {
30 showLoading = false; 31 showLoading = false;
31 notifyListeners(); 32 notifyListeners();
32 } 33 }
33 - // pageState = PageState.Loading;  
34 - // notifyListeners(); 34 +
35 BaseResp<List> baseResp = await DioUtil() 35 BaseResp<List> baseResp = await DioUtil()
36 .request<List>(context, Method.get, HttpUrl.get_reserve_list, 36 .request<List>(context, Method.get, HttpUrl.get_reserve_list,
37 data: params, showLoading: needLoading ? false : showLoading) 37 data: params, showLoading: needLoading ? false : showLoading)
@@ -62,11 +62,64 @@ class NoteBookModel extends ChangeNotifier { @@ -62,11 +62,64 @@ class NoteBookModel extends ChangeNotifier {
62 if (notebooks.isEmpty) { 62 if (notebooks.isEmpty) {
63 pageState = PageState.Empty; 63 pageState = PageState.Empty;
64 } else { 64 } else {
  65 + TableManagerModel tableManagerModel =
  66 + Provider.of<TableManagerModel>(context, listen: false);
  67 +
  68 + await tableManagerModel.getTableList(context);
  69 + List<Notebook> temp = [];
  70 +
  71 + notebooks.forEach((notebook) {
  72 + if (notebook.tableinfoList.length > 0) {
  73 + tableManagerModel.tableOuterList.forEach((elementAll) {
  74 + if (notebook.tableinfoList[0].rid == elementAll.rid) {
  75 + elementAll.list.forEach((element) {
  76 + if(notebook.tableinfoList[0].id == element.id){
  77 +//桌子ID
  78 +element.notebook = notebook;
  79 +//
  80 + }
  81 + });
  82 + }
  83 + });
  84 +
  85 + // // if( elementTable.rid == element.tableinfoList[0].rid){
  86 + // // //区域ID
  87 +
  88 + // // element.orderRID = elementTable.orderId;
  89 +
  90 + // // }
  91 + }
  92 + });
  93 +
  94 + for(int i=0;i<tableManagerModel.tableOuterList.length;i++){
  95 +
  96 +for(int j=0;j<tableManagerModel.tableOuterList[i].list.length;j++){
  97 +if(tableManagerModel.tableOuterList[i].list[j].notebook != null){
  98 + temp.add(tableManagerModel.tableOuterList[i].list[j].notebook);
  99 +}
  100 +
  101 +
  102 +}
  103 + }
  104 +
  105 +
  106 +
  107 + print(temp);
  108 + print(notebooks);
  109 +
  110 + notebooks = temp.toList();
  111 +
  112 +
  113 +
  114 + // tableManagerModel.tableOuterList //桌子
  115 + // tableManagerModel.areaSunModelList //区域
  116 +
65 pageState = PageState.Success; 117 pageState = PageState.Success;
66 } 118 }
67 } else { 119 } else {
68 Utils.showToast(baseResp.msg ?? ""); 120 Utils.showToast(baseResp.msg ?? "");
69 } 121 }
  122 +
70 notifyListeners(); 123 notifyListeners();
71 return notebooks; 124 return notebooks;
72 } 125 }