Commit 712ebb2ac2abd70e71a72d8e72ac51375f93e315

Authored by wdn127929
1 parent 6b531ae0

已预订列表,桌子或者桌子所属区域比对不上的订单排序放在后面

Showing 1 changed file with 61 additions and 30 deletions
... ... @@ -24,7 +24,7 @@ class NoteBookModel extends ChangeNotifier {
bool isSimple = true;
//获取已预订订单
//获取已预订订单
Future<List<Notebook>> getReserveList(
BuildContext context, Map<String, String> params,
{bool needLoading = false, bool showLoading = true}) async {
... ... @@ -66,16 +66,16 @@ class NoteBookModel extends ChangeNotifier {
pageState = PageState.Empty;
} else {
if (notebooks.length > 0) {
if (isSimple) {
for (Notebook item in notebooks) {
item.issimple = true;
}
} else {
for (Notebook item in notebooks) {
item.issimple = false;
if (isSimple) {
for (Notebook item in notebooks) {
item.issimple = true;
}
} else {
for (Notebook item in notebooks) {
item.issimple = false;
}
}
}
}
}
pageState = PageState.Success;
}
} else {
... ... @@ -85,7 +85,6 @@ class NoteBookModel extends ChangeNotifier {
return notebooks;
}
//获取已预订订单
Future<List<Notebook>> getReserveListSort(
BuildContext context, Map<String, String> params,
... ... @@ -131,6 +130,7 @@ class NoteBookModel extends ChangeNotifier {
await tableManagerModel.getTableList(context);
List<Notebook> temp = []; //其余订单排序
List<Notebook> tempNo = []; //区域或者桌子被删除的订单排序
List<Notebook> tempLast = []; //3、4、6订单放在最后
print(notebooks);
notebooks.forEach((notebook) {
... ... @@ -138,17 +138,46 @@ class NoteBookModel extends ChangeNotifier {
if (notebook.status != '3' &&
notebook.status != '4' &&
notebook.status != '6') {
tableManagerModel.tableOuterList.forEach((elementAll) {
if (notebook.tableinfoList[0].rid == elementAll.rid) { //区域id
elementAll.list.forEach((element) {
if (notebook.tableinfoList[0].id == element.id) {
//区域ID存在
bool tempArea = tableManagerModel.tableOuterList.any(
(element) => element.rid == notebook.tableinfoList[0].rid);
//桌子id存在
List tables = tableManagerModel.tableOuterList
.where(
(element) => element.rid == notebook.tableinfoList[0].rid)
.toList();
bool tempTable = false;
if (tables != null && tables.length > 0) {
tempTable = tables[0].list.any(
(element) => element.id == notebook.tableinfoList[0].id);
}
if (tempArea && tempTable) {
tableManagerModel.tableOuterList.forEach((elementAll) {
//订单第一个桌子的区域存在
if (notebook.tableinfoList[0].rid == elementAll.rid) {
//桌子id存在
bool tempTable = elementAll.list.any((element) =>
element.id == notebook.tableinfoList[0].id);
if (tempTable) {
elementAll.list.forEach((element) {
if (notebook.tableinfoList[0].id == element.id) {
//桌子ID
element.notebook = notebook;
element.notebook = notebook;
//
}
});
} else {
//订单第一个桌子不存在
tempNo.add(notebook);
}
});
}
});
}
});
} else {
//订单第一个桌子的区域不存在
tempNo.add(notebook);
}
} else {
tempLast.add(notebook);
}
... ... @@ -169,22 +198,24 @@ class NoteBookModel extends ChangeNotifier {
print(notebooks);
notebooks = temp.toList();
notebooks.addAll(tempNo);
notebooks.addAll(tempLast);
// tableManagerModel.tableOuterList //桌子
// tableManagerModel.areaSunModelList //区域
if (notebooks.length > 0) {
if (isSimple) {
for (Notebook item in notebooks) {
item.issimple = true;
}
} else {
for (Notebook item in notebooks) {
item.issimple = false;
if (notebooks.length > 0) {
if (isSimple) {
for (Notebook item in notebooks) {
item.issimple = true;
}
} else {
for (Notebook item in notebooks) {
item.issimple = false;
}
}
}
}
}
pageState = PageState.Success;
}
... ... @@ -196,7 +227,7 @@ class NoteBookModel extends ChangeNotifier {
return notebooks;
}
simpleState() {
simpleState() {
if (notebooks.length > 0) {
if (isSimple) {
for (Notebook item in notebooks) {
... ...