Commit e1595fbaedbd14bc3d33ad9fbeae7202fa33dcdd

Authored by wdn127929
1 parent 4665b76a

桌位去重

@@ -171,7 +171,7 @@ class TableManagerModelOrReserve with ChangeNotifier { @@ -171,7 +171,7 @@ class TableManagerModelOrReserve with ChangeNotifier {
171 "keywords": "", 171 "keywords": "",
172 "sort": "1" 172 "sort": "1"
173 }; 173 };
174 - BaseResp<dynamic> baseResp = await DioUtil() 174 + BaseResp<dynamic> baseResp = await DioUtil()
175 .request<dynamic>( 175 .request<dynamic>(
176 context, Method.get, HttpUrl.get_table_list_or_reserve, 176 context, Method.get, HttpUrl.get_table_list_or_reserve,
177 data: params, showLoading: showLoading, selfDismiss: selfDismiss) 177 data: params, showLoading: showLoading, selfDismiss: selfDismiss)
@@ -675,12 +675,12 @@ class TableManagerModelOrReserve with ChangeNotifier { @@ -675,12 +675,12 @@ class TableManagerModelOrReserve with ChangeNotifier {
675 List timem = night.split('-'); 675 List timem = night.split('-');
676 timeStrStart = ymd + ' ' + timem[0] + ':00'; 676 timeStrStart = ymd + ' ' + timem[0] + ':00';
677 timeStrEnd = ymd + ' ' + timem[1] + ':00'; 677 timeStrEnd = ymd + ' ' + timem[1] + ':00';
678 - }else if (currTimeIndex == 4) { 678 + } else if (currTimeIndex == 4) {
679 //晚市 679 //晚市
680 List timem = meal1.split('-'); 680 List timem = meal1.split('-');
681 timeStrStart = ymd + ' ' + timem[0] + ':00'; 681 timeStrStart = ymd + ' ' + timem[0] + ':00';
682 timeStrEnd = ymd + ' ' + timem[1] + ':00'; 682 timeStrEnd = ymd + ' ' + timem[1] + ':00';
683 - }else if (currTimeIndex == 5) { 683 + } else if (currTimeIndex == 5) {
684 //晚市 684 //晚市
685 List timem = meal2.split('-'); 685 List timem = meal2.split('-');
686 timeStrStart = ymd + ' ' + timem[0] + ':00'; 686 timeStrStart = ymd + ' ' + timem[0] + ':00';
@@ -694,13 +694,21 @@ class TableManagerModelOrReserve with ChangeNotifier { @@ -694,13 +694,21 @@ class TableManagerModelOrReserve with ChangeNotifier {
694 rdate = start + '-' + end; 694 rdate = start + '-' + end;
695 695
696 String tableSelectInfo = ''; 696 String tableSelectInfo = '';
697 -  
698 - selectTablesOrReserve = selectTablesOrReserve.toSet().toList(); 697 +
  698 + List<String> tidsSet = [];
  699 +
699 for (TableListReserve item in selectTablesOrReserve) { 700 for (TableListReserve item in selectTablesOrReserve) {
700 // if (item.selected) { 701 // if (item.selected) {
701 - tableSelectInfo += ',${item.id}'; 702 +
702 // } 703 // }
  704 +
  705 + tidsSet.add(item.id);
703 } 706 }
  707 + tidsSet = tidsSet.toSet().toList();
  708 + tidsSet.forEach((element) {
  709 + tableSelectInfo += ',${element}';
  710 + });
  711 +
704 print(tableSelectInfo); 712 print(tableSelectInfo);
705 if (tableSelectInfo.startsWith(',')) { 713 if (tableSelectInfo.startsWith(',')) {
706 tableSelectInfo = tableSelectInfo.substring(1); 714 tableSelectInfo = tableSelectInfo.substring(1);
@@ -711,7 +719,6 @@ class TableManagerModelOrReserve with ChangeNotifier { @@ -711,7 +719,6 @@ class TableManagerModelOrReserve with ChangeNotifier {
711 context, rdate, tableSelectInfo, currTimeIndex.toString()); 719 context, rdate, tableSelectInfo, currTimeIndex.toString());
712 720
713 if (sucess) { 721 if (sucess) {
714 -  
715 // 722 //
716 if (tempTime == null) { 723 if (tempTime == null) {
717 // if (currTimeIndex == 1) { 724 // if (currTimeIndex == 1) {
@@ -724,7 +731,7 @@ class TableManagerModelOrReserve with ChangeNotifier { @@ -724,7 +731,7 @@ class TableManagerModelOrReserve with ChangeNotifier {
724 if (currTimeIndex == 1) { 731 if (currTimeIndex == 1) {
725 tempTime = '08:00'; 732 tempTime = '08:00';
726 if (morning != '' && morning != null) { 733 if (morning != '' && morning != null) {
727 - List tempDate =morning.split("-"); 734 + List tempDate = morning.split("-");
728 tempTime = tempDate[0]; 735 tempTime = tempDate[0];
729 } 736 }
730 } else if (currTimeIndex == 2) { 737 } else if (currTimeIndex == 2) {
@@ -745,7 +752,7 @@ class TableManagerModelOrReserve with ChangeNotifier { @@ -745,7 +752,7 @@ class TableManagerModelOrReserve with ChangeNotifier {
745 List tempDate = meal1.split("-"); 752 List tempDate = meal1.split("-");
746 tempTime = tempDate[0]; 753 tempTime = tempDate[0];
747 } 754 }
748 - }else if (currTimeIndex == 5) { 755 + } else if (currTimeIndex == 5) {
749 tempTime = '21:00'; 756 tempTime = '21:00';
750 if (meal2 != '' && meal2 != null) { 757 if (meal2 != '' && meal2 != null) {
751 List tempDate = meal2.split("-"); 758 List tempDate = meal2.split("-");
@@ -760,7 +767,7 @@ class TableManagerModelOrReserve with ChangeNotifier { @@ -760,7 +767,7 @@ class TableManagerModelOrReserve with ChangeNotifier {
760 LogUtil.v(timeStr); 767 LogUtil.v(timeStr);
761 // String tempDdate = ymyStr + ' ' + ddateStr + ':00'; 768 // String tempDdate = ymyStr + ' ' + ddateStr + ':00';
762 int ddate = DateUtil.getDateMsByTimeStr(timeStr); 769 int ddate = DateUtil.getDateMsByTimeStr(timeStr);
763 - UserModel userModel = Provider.of<UserModel>(context, listen: false); 770 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
764 Map<String, String> params = { 771 Map<String, String> params = {
765 "sid": userModel.user.sellerid, //商家ID 772 "sid": userModel.user.sellerid, //商家ID
766 "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 773 "tid": tableSelectInfo, //桌子ID: 格式 2,3,4