Showing
4 changed files
with
68 additions
and
6 deletions
| @@ -229,25 +229,32 @@ Page({ | @@ -229,25 +229,32 @@ Page({ | ||
| 229 | if (condition.valid_forever === '0' && condition.stime && condition.etime) { | 229 | if (condition.valid_forever === '0' && condition.stime && condition.etime) { |
| 230 | detail.useStime = util.unixtoTime(condition.stime, 'YYYY-MM-DD'); | 230 | detail.useStime = util.unixtoTime(condition.stime, 'YYYY-MM-DD'); |
| 231 | detail.useEtime = util.unixtoTime(condition.etime, 'YYYY-MM-DD'); | 231 | detail.useEtime = util.unixtoTime(condition.etime, 'YYYY-MM-DD'); |
| 232 | + detail.useEtimeStr = useStime + '至' + useEtime; | ||
| 232 | } | 233 | } |
| 233 | if (condition.valid_forever === '1') { | 234 | if (condition.valid_forever === '1') { |
| 234 | detail.foreverText = '永久有效'; | 235 | detail.foreverText = '永久有效'; |
| 236 | + detail.useEtimeStr = '永久有效'; | ||
| 235 | } | 237 | } |
| 238 | + // today 领券当日起天数 | ||
| 236 | if (condition.valid_forever === '0' && condition.today) { | 239 | if (condition.valid_forever === '0' && condition.today) { |
| 237 | let obj = this.setTimeRange(detail.cdate, 0, parseInt(condition.today)-1); | 240 | let obj = this.setTimeRange(detail.cdate, 0, parseInt(condition.today)-1); |
| 238 | detail.useStime = obj.useStime; | 241 | detail.useStime = obj.useStime; |
| 239 | detail.useEtime = obj.useEtime; | 242 | detail.useEtime = obj.useEtime; |
| 243 | + detail.useEtimeStr = '领取当日起' + condition.today + '天内有效'; | ||
| 240 | } | 244 | } |
| 245 | + // tomorrow 领券次日起天数 | ||
| 241 | if (condition.valid_forever === '0' && condition.tomorrow) { | 246 | if (condition.valid_forever === '0' && condition.tomorrow) { |
| 242 | let obj = this.setTimeRange(detail.cdate, 1, condition.tomorrow*1); | 247 | let obj = this.setTimeRange(detail.cdate, 1, condition.tomorrow*1); |
| 243 | detail.useStime = obj.useStime; | 248 | detail.useStime = obj.useStime; |
| 244 | detail.useEtime = obj.useEtime; | 249 | detail.useEtime = obj.useEtime; |
| 250 | + detail.useEtimeStr = '领取次日起' + condition.tomorrow + '天内有效'; | ||
| 245 | } | 251 | } |
| 252 | + // sday 领券后第几天的开始天数 eday 领券后第几天的结束天数 | ||
| 246 | if (condition.valid_forever === '0' && condition.sday && condition.eday) { | 253 | if (condition.valid_forever === '0' && condition.sday && condition.eday) { |
| 247 | - let eday = condition.sday == '1' ? (parseInt(condition.eday)-1) : (parseInt(condition.eday)+1) | ||
| 248 | - let obj = this.setTimeRange(detail.cdate, parseInt(condition.sday)-1, eday); | 254 | + let obj = this.setTimeRange(detail.cdate, parseInt(condition.sday) - 1, parseInt(condition.eday) - 1); |
| 249 | detail.useStime = obj.useStime; | 255 | detail.useStime = obj.useStime; |
| 250 | detail.useEtime = obj.useEtime; | 256 | detail.useEtime = obj.useEtime; |
| 257 | + detail.useEtimeStr = '领取后第' + condition.sday + '天至' + condition.eday + '天可用'; | ||
| 251 | } | 258 | } |
| 252 | if (exp_date && exp_date.week_data) { | 259 | if (exp_date && exp_date.week_data) { |
| 253 | let mor = this.hasConsecutiveSelect(exp_date.week_data, '1').rArr.join('、') | 260 | let mor = this.hasConsecutiveSelect(exp_date.week_data, '1').rArr.join('、') |
| @@ -42,7 +42,14 @@ | @@ -42,7 +42,14 @@ | ||
| 42 | <text class="font32r">有效期</text> | 42 | <text class="font32r">有效期</text> |
| 43 | </view> | 43 | </view> |
| 44 | <block wx:if="{{detail.is_type == '3'}}"> | 44 | <block wx:if="{{detail.is_type == '3'}}"> |
| 45 | - <view class="info font28r" wx:if="{{detail.aexpiration.valid_forever == '0' && detail.useStime && detail.useEtime}}"><text>券有效期:</text>{{detail.useStime}} <text> 至 </text> {{detail.useEtime}}</view> | 45 | + <view class="info font28r" wx:if="{{detail.aexpiration.valid_forever == '0' && detail.useStime && detail.useEtime}}"><text>券有效期:</text> |
| 46 | + <block wx:if="{{resultCoupon == '1'}}"> | ||
| 47 | + {{detail.useStime}} <text> 至 </text> {{detail.useEtime}} | ||
| 48 | + </block> | ||
| 49 | + <block wx:else> | ||
| 50 | + {{detail.useEtimeStr}} | ||
| 51 | + </block> | ||
| 52 | + </view> | ||
| 46 | <view class="info font28r" wx:if="{{detail.aexpiration.valid_forever == '1'}}"><text>券有效期:</text> 永久有效</view> | 53 | <view class="info font28r" wx:if="{{detail.aexpiration.valid_forever == '1'}}"><text>券有效期:</text> 永久有效</view> |
| 47 | </block> | 54 | </block> |
| 48 | <block wx:else> | 55 | <block wx:else> |
| @@ -4,6 +4,7 @@ Page({ | @@ -4,6 +4,7 @@ Page({ | ||
| 4 | data: { | 4 | data: { |
| 5 | list:[], | 5 | list:[], |
| 6 | status:1, | 6 | status:1, |
| 7 | + dataStr: Date.now() * 1 / 1000, | ||
| 7 | }, | 8 | }, |
| 8 | page:1, | 9 | page:1, |
| 9 | size:10, | 10 | size:10, |
| @@ -30,7 +31,8 @@ Page({ | @@ -30,7 +31,8 @@ Page({ | ||
| 30 | let date=Date.now()*1/1000; | 31 | let date=Date.now()*1/1000; |
| 31 | list.forEach(item=>{ | 32 | list.forEach(item=>{ |
| 32 | item.is_expire='0' | 33 | item.is_expire='0' |
| 33 | - let etime=item.etime*1 | 34 | + let etime=item.etime*1 |
| 35 | + if(!item.is_type) item.is_type = item.type | ||
| 34 | if(item.is_type == '3'){ | 36 | if(item.is_type == '3'){ |
| 35 | item.status = '2'; | 37 | item.status = '2'; |
| 36 | item.is_examine = '0'; | 38 | item.is_examine = '0'; |
| @@ -45,6 +47,36 @@ Page({ | @@ -45,6 +47,36 @@ Page({ | ||
| 45 | item.arule = item.arule ? util.determine(item.arule) : ''; | 47 | item.arule = item.arule ? util.determine(item.arule) : ''; |
| 46 | item.use = item.use ? util.determine(item.use) : ''; | 48 | item.use = item.use ? util.determine(item.use) : ''; |
| 47 | item.aexpiration = item.aexpiration ? util.determine(item.aexpiration) : ''; | 49 | item.aexpiration = item.aexpiration ? util.determine(item.aexpiration) : ''; |
| 50 | + item.cdate = item.cdate * 1; | ||
| 51 | + item.useStime = ''; | ||
| 52 | + item.useEtime = ''; | ||
| 53 | + let condition = item.aexpiration | ||
| 54 | + if (condition.valid_forever === '0' && condition.stime && condition.etime) { | ||
| 55 | + item.useStime = util.unixtoTime(condition.stime, 'YYYY-MM-DD'); | ||
| 56 | + item.useEtime = util.unixtoTime(condition.etime, 'YYYY-MM-DD'); | ||
| 57 | + } | ||
| 58 | + if (condition.valid_forever === '1') { | ||
| 59 | + item.foreverText = '永久有效'; | ||
| 60 | + } | ||
| 61 | + // today 领券当日起天数 | ||
| 62 | + if (condition.valid_forever === '0' && condition.today) { | ||
| 63 | + let obj = this.setTimeRange(item.cdate, 0, parseInt(condition.today)-1); | ||
| 64 | + item.useStime = obj.useStime; | ||
| 65 | + item.useEtime = obj.useEtime; | ||
| 66 | + item.useEtimeStr = '领取当日起' + condition.today + '天内有效'; | ||
| 67 | + } | ||
| 68 | + // tomorrow 领券次日起天数 | ||
| 69 | + if (condition.valid_forever === '0' && condition.tomorrow) { | ||
| 70 | + let obj = this.setTimeRange(item.cdate, 1, condition.tomorrow*1); | ||
| 71 | + item.useStime = obj.useStime; | ||
| 72 | + item.useEtime = obj.useEtime; | ||
| 73 | + } | ||
| 74 | + // sday 领券后第几天的开始天数 eday 领券后第几天的结束天数 | ||
| 75 | + if (condition.valid_forever === '0' && condition.sday && condition.eday) { | ||
| 76 | + let obj = this.setTimeRange(item.cdate, parseInt(condition.sday) - 1, parseInt(condition.eday) - 1); | ||
| 77 | + item.useStime = obj.useStime; | ||
| 78 | + item.useEtime = obj.useEtime; | ||
| 79 | + } | ||
| 48 | if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) { | 80 | if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) { |
| 49 | let cash = item.use.cash * 1; | 81 | let cash = item.use.cash * 1; |
| 50 | let price = item.price * 1; | 82 | let price = item.price * 1; |
| @@ -67,7 +99,7 @@ Page({ | @@ -67,7 +99,7 @@ Page({ | ||
| 67 | item.noShow = '0' | 99 | item.noShow = '0' |
| 68 | item.noShowTetxt = '已使用' | 100 | item.noShowTetxt = '已使用' |
| 69 | } | 101 | } |
| 70 | - if(item.is_expire=='1' && item.aexpiration.valid_forever != '1'){ | 102 | + if(item.is_expire=='1' && (item.is_type=='3' && item.aexpiration.valid_forever != '1' && this.data.dataStr > (item.useEtime * 1)) || (item.is_type !='3' && this.data.dataStr > (item.etime * 1))){ |
| 71 | item.noShow = '0' | 103 | item.noShow = '0' |
| 72 | item.noShowTetxt = '已失效' | 104 | item.noShowTetxt = '已失效' |
| 73 | } | 105 | } |
| @@ -150,6 +182,20 @@ Page({ | @@ -150,6 +182,20 @@ Page({ | ||
| 150 | this.todetail() | 182 | this.todetail() |
| 151 | } | 183 | } |
| 152 | }, | 184 | }, |
| 185 | + // 计算免费券有效期的起始、结束日期 | ||
| 186 | + setTimeRange(cdate, startOffset, endOffset) { | ||
| 187 | + console.log(cdate, startOffset, endOffset); | ||
| 188 | + const startDate = new Date((cdate * 1 + startOffset * 86400) * 1000); | ||
| 189 | + startDate.setHours(0, 0, 0, 0); | ||
| 190 | + const useStime = util.unixtoTime(startDate.getTime() / 1000, 'YYYY-MM-DD'); | ||
| 191 | + const endDate = new Date((cdate * 1 + endOffset * 86400) * 1000); | ||
| 192 | + endDate.setHours(23, 59, 59, 0); | ||
| 193 | + const useEtime = util.unixtoTime(endDate.getTime() / 1000, 'YYYY-MM-DD'); | ||
| 194 | + return { | ||
| 195 | + useStime, | ||
| 196 | + useEtime | ||
| 197 | + }; | ||
| 198 | + }, | ||
| 153 | // 处理优惠券不可用日期数据 | 199 | // 处理优惠券不可用日期数据 |
| 154 | hasConsecutiveSelect(arr, type) { | 200 | hasConsecutiveSelect(arr, type) { |
| 155 | let firstTitle = null; | 201 | let firstTitle = null; |
| @@ -32,11 +32,13 @@ | @@ -32,11 +32,13 @@ | ||
| 32 | <view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view> | 32 | <view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view> |
| 33 | <view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view> | 33 | <view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view> |
| 34 | <view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view> | 34 | <view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view> |
| 35 | + <view wx:if="{{item.aexpiration.valid_forever == '0' && item.useStime && item.useEtime}}" class="bottom font24r">有效期:{{item.useStime}} 至 {{item.useEtime}}</view> | ||
| 36 | + <view class="bottom font24r" wx:if="{{item.aexpiration.valid_forever == '1'}}">有效期:永久有效</view> | ||
| 35 | <view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view> | 37 | <view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view> |
| 36 | </block> | 38 | </block> |
| 37 | </view> | 39 | </view> |
| 38 | <view class="btnBox"> | 40 | <view class="btnBox"> |
| 39 | - <view class="font24r orderingFood" wx:if="{{item.is_type!='3'&&item.is_examine=='0' && item.is_expire=='0' && item.is_examine=='0' && item.status!='4' && item.status!='5'}}">去核销</view> | 41 | + <view class="font24r orderingFood" wx:if="{{item.is_type!='3'&&item.is_examine=='0' && item.is_expire=='0' && item.is_examine=='0' && item.status!='4' && item.status!='5' && item.noShow !='0'}}">去核销</view> |
| 40 | <view class="font24r orderingFood" wx:if="{{item.is_examine=='1' && item.is_expire=='0' && item.status!='4' && item.status!='5' && item.is_comment!='1'}}">去评价</view> | 42 | <view class="font24r orderingFood" wx:if="{{item.is_examine=='1' && item.is_expire=='0' && item.status!='4' && item.status!='5' && item.is_comment!='1'}}">去评价</view> |
| 41 | <view class="font24r orderingFood" wx:if="{{!(item.is_examine=='1' && item.is_expire=='0' && item.status!='4' && item.status!='5' && item.is_comment!='1') && item.noShowTetxt}}">{{item.noShowTetxt}}</view> | 43 | <view class="font24r orderingFood" wx:if="{{!(item.is_examine=='1' && item.is_expire=='0' && item.status!='4' && item.status!='5' && item.is_comment!='1') && item.noShowTetxt}}">{{item.noShowTetxt}}</view> |
| 42 | </view> | 44 | </view> |
-
Please register or login to post a comment