Commit 8ef0a4984f27671b682fa4c84f9e6f90cb07f92f

Authored by “pengye”
1 parent 7f5a42d9

付款页修改当前餐段判断规则

@@ -614,7 +614,7 @@ Page({ @@ -614,7 +614,7 @@ Page({
614 } else { 614 } else {
615 obj.isshow = '0' 615 obj.isshow = '0'
616 } 616 }
617 - console.log('不可用日期信息餐段节假日', obj); 617 + console.log('不可用日期信息餐段节假日', {...obj});
618 if (obj && obj.can && obj.solt) { 618 if (obj && obj.can && obj.solt) {
619 this.setData({ 619 this.setData({
620 canSolt: { 620 canSolt: {
@@ -629,9 +629,9 @@ Page({ @@ -629,9 +629,9 @@ Page({
629 checkTimeInInterval(currentTime, lunchDis, lunchDinnerList) { 629 checkTimeInInterval(currentTime, lunchDis, lunchDinnerList) {
630 const [currentHour, currentMinute] = currentTime.split(':'); 630 const [currentHour, currentMinute] = currentTime.split(':');
631 const [morningHour2, morningMinute2] = lunchDis.morning ? lunchDis.morning.split("-")[1].split(':') : [0, 0]; 631 const [morningHour2, morningMinute2] = lunchDis.morning ? lunchDis.morning.split("-")[1].split(':') : [0, 0];
632 - const [noonHour1, noonMinute1] = lunchDis.noon ? lunchDis.noon.split("-")[1].split(':') : [0, 0]; 632 + const [noonHour1, noonMinute1] = lunchDis.noon ? lunchDis.noon.split("-")[0].split(':') : [0, 0];
633 const [noonHour2, noonMinute2] = lunchDis.noon ? lunchDis.noon.split("-")[1].split(':') : [0, 0]; 633 const [noonHour2, noonMinute2] = lunchDis.noon ? lunchDis.noon.split("-")[1].split(':') : [0, 0];
634 - const [nightHour1, nightMinute1] = lunchDis.night ? lunchDis.night.split("-")[1].split(':') : [0, 0]; 634 + const [nightHour1, nightMinute1] = lunchDis.night ? lunchDis.night.split("-")[0].split(':') : [0, 0];
635 const currentTimestamp = new Date().setHours(currentHour, currentMinute, 0, 0); //当前时间 635 const currentTimestamp = new Date().setHours(currentHour, currentMinute, 0, 0); //当前时间
636 const time1 = (morningHour2 && morningMinute2) ? new Date().setHours(morningHour2, morningMinute2, 0, 0) : ''; //早餐截止时间 636 const time1 = (morningHour2 && morningMinute2) ? new Date().setHours(morningHour2, morningMinute2, 0, 0) : ''; //早餐截止时间
637 const time2 = (noonHour1 && noonMinute1) ? new Date().setHours(noonHour1, noonMinute1, 0, 0) : ''; //午餐开始时间 637 const time2 = (noonHour1 && noonMinute1) ? new Date().setHours(noonHour1, noonMinute1, 0, 0) : ''; //午餐开始时间
@@ -657,16 +657,8 @@ Page({ @@ -657,16 +657,8 @@ Page({
657 } : { 657 } : {
658 solt: 2, 658 solt: 2,
659 can: '午餐' 659 can: '午餐'
660 - }; 660 + }
661 } else if (currentTimestamp > timeA1 && currentTimestamp < timeA2) { //在早餐/午餐截止时间之后 && 午餐/晚餐开始时间之前 661 } else if (currentTimestamp > timeA1 && currentTimestamp < timeA2) { //在早餐/午餐截止时间之后 && 午餐/晚餐开始时间之前
662 - return obj2.solt == 2 ? {  
663 - solt: 2,  
664 - can: '午餐'  
665 - } : {  
666 - solt: 3,  
667 - can: '晚餐'  
668 - };  
669 - } else if (currentTimestamp > timeA2) { //在午餐/晚餐截止时间之后  
670 return obj1.solt == 1 ? { 662 return obj1.solt == 1 ? {
671 solt: 1, 663 solt: 1,
672 can: '早餐' 664 can: '早餐'
@@ -674,6 +666,14 @@ Page({ @@ -674,6 +666,14 @@ Page({
674 solt: 2, 666 solt: 2,
675 can: '午餐' 667 can: '午餐'
676 }; 668 };
  669 + } else if (currentTimestamp > timeA2) { //在午餐/晚餐截止时间之后
  670 + return obj2.solt == 2 ? {
  671 + solt: 2,
  672 + can: '午餐'
  673 + } : {
  674 + solt: 3,
  675 + can: '晚餐'
  676 + };
677 } 677 }
678 } 678 }
679 // 3个餐段(早,午,晚) 679 // 3个餐段(早,午,晚)
@@ -685,13 +685,18 @@ Page({ @@ -685,13 +685,18 @@ Page({
685 }; 685 };
686 } else if (currentTimestamp > time1 && currentTimestamp < time2) { //在早餐截止时间之后 && 午餐开始时间之前 686 } else if (currentTimestamp > time1 && currentTimestamp < time2) { //在早餐截止时间之后 && 午餐开始时间之前
687 return { 687 return {
  688 + solt: 1,
  689 + can: '早餐'
  690 + };
  691 + } else if (currentTimestamp > time2 && currentTimestamp < time3){
  692 + return {
688 solt: 2, 693 solt: 2,
689 can: '午餐' 694 can: '午餐'
690 - };  
691 - } else if (currentTimestamp > time3 && currentTimestamp < time4) { //在午餐截止时间之后 && 晚餐开始时间之前 695 + }
  696 + } else if (currentTimestamp > time3 && currentTimestamp < time4) { //在午餐截止时间之后 && 晚餐开始时间之前
692 return { 697 return {
693 - solt: 3,  
694 - can: '晚餐' 698 + solt: 2,
  699 + can: '午餐'
695 }; 700 };
696 } else { 701 } else {
697 return { 702 return {
@@ -50,9 +50,9 @@ @@ -50,9 +50,9 @@
50 <!-- <view class="font20r bottom">{{item.arule.is_same_day=='1'?'领取当日可用':'领取当日不可用'}}</view> 50 <!-- <view class="font20r bottom">{{item.arule.is_same_day=='1'?'领取当日可用':'领取当日不可用'}}</view>
51 <view wx:if="{{item.aexpiration>0}}" class="font20r bottom">领取后{{item.aexpiration}}天内使用</view> 51 <view wx:if="{{item.aexpiration>0}}" class="font20r bottom">领取后{{item.aexpiration}}天内使用</view>
52 <view wx:if="{{item.cdateText}}" class="font20r bottom">领取日期:{{item.cdateText}}</view> --> 52 <view wx:if="{{item.cdateText}}" class="font20r bottom">领取日期:{{item.cdateText}}</view> -->
53 - <view wx:if="{{item.noonText || item.noonText}}" class="font20r bottomTitle"><text>不可使用:</text><view wx:if="{{item.noonText}}" class="bottom font20r">{{item.noonText}}</view> 53 + <view wx:if="{{item.noonText}}" class="font20r bottomTitle"><text>不可使用:</text><view wx:if="{{item.noonText}}" class="bottom font20r">{{item.noonText}}</view>
54 </view> 54 </view>
55 - <view wx:if="{{item.nigText}}" class="bottom font20r nodate">{{item.nigText}}</view> 55 + <view wx:if="{{item.nigText}}" class="font20r {{!item.noonText?'bottomTitle':'bottom nodate'}}"><text wx:if="{{!item.noonText}}">不可使用:</text><view wx:if="{{item.nigText}}" class="bottom font20r">{{item.nigText}}</view></view>
56 <view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font20r">无使用时间限制</view> 56 <view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font20r">无使用时间限制</view>
57 </view> 57 </view>
58 <checkbox disabled="{{item.showCpupon == '0'}}" value="{{item.activity_id}}" checked="{{item.checked}}" /> 58 <checkbox disabled="{{item.showCpupon == '0'}}" value="{{item.activity_id}}" checked="{{item.checked}}" />