|
@@ -490,12 +490,18 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -490,12 +490,18 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
490
|
itemModelList.removeAt(i);
|
490
|
itemModelList.removeAt(i);
|
|
491
|
}
|
491
|
}
|
|
492
|
}
|
492
|
}
|
|
|
|
493
|
+
|
|
|
|
494
|
+ List<String> tableIds = []; //所有桌位的id
|
|
|
|
495
|
+ List<String> tableIdsOld = []; //带过来所有桌位的id
|
|
493
|
for (TableListSunModel item in itemModelList) {
|
496
|
for (TableListSunModel item in itemModelList) {
|
|
494
|
if (item.name == "推荐") {
|
497
|
if (item.name == "推荐") {
|
|
495
|
itemModelList.remove(item);
|
498
|
itemModelList.remove(item);
|
|
496
|
}
|
499
|
}
|
|
|
|
500
|
+
|
|
497
|
for (var item in item.list) {
|
501
|
for (var item in item.list) {
|
|
|
|
502
|
+ tableIds.add(item.id);
|
|
498
|
for (var table in oldTableList) {
|
503
|
for (var table in oldTableList) {
|
|
|
|
504
|
+ tableIdsOld.add(table.id);
|
|
499
|
if (item.id == table.id) {
|
505
|
if (item.id == table.id) {
|
|
500
|
item.selected = true;
|
506
|
item.selected = true;
|
|
501
|
if (!tableList.contains(item)) {
|
507
|
if (!tableList.contains(item)) {
|
|
@@ -505,6 +511,17 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -505,6 +511,17 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
505
|
}
|
511
|
}
|
|
506
|
}
|
512
|
}
|
|
507
|
}
|
513
|
}
|
|
|
|
514
|
+
|
|
|
|
515
|
+ List<String> combinedList = [];
|
|
|
|
516
|
+ for (var old in tableIdsOld) {
|
|
|
|
517
|
+ if (!tableIds.contains(old)) {
|
|
|
|
518
|
+ //删除了
|
|
|
|
519
|
+ combinedList.add(old);
|
|
|
|
520
|
+ }
|
|
|
|
521
|
+ }
|
|
|
|
522
|
+
|
|
|
|
523
|
+// tables
|
|
|
|
524
|
+
|
|
508
|
// List usedTableList = []; //被占用的包间
|
525
|
// List usedTableList = []; //被占用的包间
|
|
509
|
// for (var itemOld in oldTableList) {
|
526
|
// for (var itemOld in oldTableList) {
|
|
510
|
// if (tableList.length == 0) {
|
527
|
// if (tableList.length == 0) {
|
|
@@ -529,17 +546,47 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -529,17 +546,47 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
529
|
idold.remove(item);
|
546
|
idold.remove(item);
|
|
530
|
}
|
547
|
}
|
|
531
|
print(idold); //被占用的桌子的id
|
548
|
print(idold); //被占用的桌子的id
|
|
|
|
549
|
+
|
|
532
|
if (idold.length > 0) {
|
550
|
if (idold.length > 0) {
|
|
|
|
551
|
+ print(combinedList);
|
|
|
|
552
|
+ List delTablesid = []; //删除
|
|
|
|
553
|
+ List useTablesid = []; //占用
|
|
|
|
554
|
+ if (combinedList.length > 0) {
|
|
|
|
555
|
+ //存在删除的桌位
|
|
|
|
556
|
+ for (String ids in idold) {
|
|
|
|
557
|
+ if (combinedList.contains(ids)) {
|
|
|
|
558
|
+ delTablesid.add(ids);
|
|
|
|
559
|
+ } else {
|
|
|
|
560
|
+ useTablesid.add(ids);
|
|
|
|
561
|
+ }
|
|
|
|
562
|
+ }
|
|
|
|
563
|
+ } else {
|
|
|
|
564
|
+ useTablesid.addAll(idold); //占用
|
|
|
|
565
|
+ }
|
|
533
|
String msg = '';
|
566
|
String msg = '';
|
|
|
|
567
|
+ String msgDel = '';
|
|
534
|
for (var item in oldTableList) {
|
568
|
for (var item in oldTableList) {
|
|
535
|
- if (idold.contains(item.id)) {
|
569
|
+ if (useTablesid.contains(item.id)) {
|
|
536
|
msg += '${item.name},';
|
570
|
msg += '${item.name},';
|
|
537
|
}
|
571
|
}
|
|
|
|
572
|
+ if (delTablesid.length > 0) {
|
|
|
|
573
|
+ msgDel += '${item.name},';
|
|
|
|
574
|
+ }
|
|
538
|
}
|
575
|
}
|
|
539
|
if (msg.endsWith(',')) {
|
576
|
if (msg.endsWith(',')) {
|
|
540
|
msg = msg.substring(0, msg.length - 1);
|
577
|
msg = msg.substring(0, msg.length - 1);
|
|
541
|
}
|
578
|
}
|
|
542
|
- Utils.showToast('${msg}已被占用啦');
|
579
|
+ if (msgDel.endsWith(',')) {
|
|
|
|
580
|
+ msgDel = msgDel.substring(0, msgDel.length - 1);
|
|
|
|
581
|
+ }
|
|
|
|
582
|
+
|
|
|
|
583
|
+ if (msg != '' && msgDel == '') {
|
|
|
|
584
|
+ Utils.showToast('${msg}已被占用啦');
|
|
|
|
585
|
+ }else if(msg == '' && msgDel != '') {
|
|
|
|
586
|
+ Utils.showToast('${msgDel}已被删除啦');
|
|
|
|
587
|
+ }else if(msg != '' && msgDel != '') {
|
|
|
|
588
|
+ Utils.showToast('${msg}已被占用啦\n'+'${msgDel}已被删除啦');
|
|
|
|
589
|
+ }
|
|
543
|
}
|
590
|
}
|
|
544
|
|
591
|
|
|
545
|
// if (usedTableList.length > 0) {
|
592
|
// if (usedTableList.length > 0) {
|
|
@@ -585,8 +632,7 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -585,8 +632,7 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
585
|
//录入客户电话时不能用自己手机号(管店)
|
632
|
//录入客户电话时不能用自己手机号(管店)
|
|
586
|
|
633
|
|
|
587
|
if (userModel.user.userphone == phoneController.text.trim() ||
|
634
|
if (userModel.user.userphone == phoneController.text.trim() ||
|
|
588
|
- userModel.user.userphoneMyPage ==
|
|
|
|
589
|
- phoneController.text.trim()) {
|
635
|
+ userModel.user.userphoneMyPage == phoneController.text.trim()) {
|
|
590
|
Utils.showToast('录入客户电话时不能用自己手机号!');
|
636
|
Utils.showToast('录入客户电话时不能用自己手机号!');
|
|
591
|
return null;
|
637
|
return null;
|
|
592
|
}
|
638
|
}
|
|
@@ -759,9 +805,8 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -759,9 +805,8 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
759
|
if (customerProvider.isselfphone) {
|
805
|
if (customerProvider.isselfphone) {
|
|
760
|
//录入客户电话时不能用自己手机号(管店)
|
806
|
//录入客户电话时不能用自己手机号(管店)
|
|
761
|
|
807
|
|
|
762
|
- if (userModel.user.userphone == phoneController.text.trim()||
|
|
|
|
763
|
- userModel.user.userphoneMyPage ==
|
|
|
|
764
|
- phoneController.text.trim()) {
|
808
|
+ if (userModel.user.userphone == phoneController.text.trim() ||
|
|
|
|
809
|
+ userModel.user.userphoneMyPage == phoneController.text.trim()) {
|
|
765
|
Utils.showToast('录入客户电话时不能用自己手机号!');
|
810
|
Utils.showToast('录入客户电话时不能用自己手机号!');
|
|
766
|
return null;
|
811
|
return null;
|
|
767
|
}
|
812
|
}
|