|
...
|
...
|
@@ -490,12 +490,18 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
|
|
itemModelList.removeAt(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
List<String> tableIds = []; //所有桌位的id
|
|
|
|
List<String> tableIdsOld = []; //带过来所有桌位的id
|
|
|
|
for (TableListSunModel item in itemModelList) {
|
|
|
|
if (item.name == "推荐") {
|
|
|
|
itemModelList.remove(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (var item in item.list) {
|
|
|
|
tableIds.add(item.id);
|
|
|
|
for (var table in oldTableList) {
|
|
|
|
tableIdsOld.add(table.id);
|
|
|
|
if (item.id == table.id) {
|
|
|
|
item.selected = true;
|
|
|
|
if (!tableList.contains(item)) {
|
|
...
|
...
|
@@ -505,6 +511,17 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
List<String> combinedList = [];
|
|
|
|
for (var old in tableIdsOld) {
|
|
|
|
if (!tableIds.contains(old)) {
|
|
|
|
//删除了
|
|
|
|
combinedList.add(old);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// tables
|
|
|
|
|
|
|
|
// List usedTableList = []; //被占用的包间
|
|
|
|
// for (var itemOld in oldTableList) {
|
|
|
|
// if (tableList.length == 0) {
|
|
...
|
...
|
@@ -529,17 +546,47 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
|
|
idold.remove(item);
|
|
|
|
}
|
|
|
|
print(idold); //被占用的桌子的id
|
|
|
|
|
|
|
|
if (idold.length > 0) {
|
|
|
|
print(combinedList);
|
|
|
|
List delTablesid = []; //删除
|
|
|
|
List useTablesid = []; //占用
|
|
|
|
if (combinedList.length > 0) {
|
|
|
|
//存在删除的桌位
|
|
|
|
for (String ids in idold) {
|
|
|
|
if (combinedList.contains(ids)) {
|
|
|
|
delTablesid.add(ids);
|
|
|
|
} else {
|
|
|
|
useTablesid.add(ids);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
useTablesid.addAll(idold); //占用
|
|
|
|
}
|
|
|
|
String msg = '';
|
|
|
|
String msgDel = '';
|
|
|
|
for (var item in oldTableList) {
|
|
|
|
if (idold.contains(item.id)) {
|
|
|
|
if (useTablesid.contains(item.id)) {
|
|
|
|
msg += '${item.name},';
|
|
|
|
}
|
|
|
|
if (delTablesid.length > 0) {
|
|
|
|
msgDel += '${item.name},';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (msg.endsWith(',')) {
|
|
|
|
msg = msg.substring(0, msg.length - 1);
|
|
|
|
}
|
|
|
|
Utils.showToast('${msg}已被占用啦');
|
|
|
|
if (msgDel.endsWith(',')) {
|
|
|
|
msgDel = msgDel.substring(0, msgDel.length - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (msg != '' && msgDel == '') {
|
|
|
|
Utils.showToast('${msg}已被占用啦');
|
|
|
|
}else if(msg == '' && msgDel != '') {
|
|
|
|
Utils.showToast('${msgDel}已被删除啦');
|
|
|
|
}else if(msg != '' && msgDel != '') {
|
|
|
|
Utils.showToast('${msg}已被占用啦\n'+'${msgDel}已被删除啦');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if (usedTableList.length > 0) {
|
|
...
|
...
|
@@ -585,8 +632,7 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
|
|
//录入客户电话时不能用自己手机号(管店)
|
|
|
|
|
|
|
|
if (userModel.user.userphone == phoneController.text.trim() ||
|
|
|
|
userModel.user.userphoneMyPage ==
|
|
|
|
phoneController.text.trim()) {
|
|
|
|
userModel.user.userphoneMyPage == phoneController.text.trim()) {
|
|
|
|
Utils.showToast('录入客户电话时不能用自己手机号!');
|
|
|
|
return null;
|
|
|
|
}
|
|
...
|
...
|
@@ -759,9 +805,8 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
|
|
if (customerProvider.isselfphone) {
|
|
|
|
//录入客户电话时不能用自己手机号(管店)
|
|
|
|
|
|
|
|
if (userModel.user.userphone == phoneController.text.trim()||
|
|
|
|
userModel.user.userphoneMyPage ==
|
|
|
|
phoneController.text.trim()) {
|
|
|
|
if (userModel.user.userphone == phoneController.text.trim() ||
|
|
|
|
userModel.user.userphoneMyPage == phoneController.text.trim()) {
|
|
|
|
Utils.showToast('录入客户电话时不能用自己手机号!');
|
|
|
|
return null;
|
|
|
|
}
|
...
|
...
|
|