Fix:4221 【商城小程序】已被领取的礼包在24小时后查看领取页面会显示为礼包已失效(应该显示为已领取的效果)

This commit is contained in:
linxi
2025-11-13 11:41:34 +08:00
parent 7cc2be3536
commit 6a526eb41c
+13 -5
View File
@@ -1,13 +1,13 @@
<template> <template>
<view v-if="!loading"> <view v-if="!loading">
<GiftCard <GiftCard
v-if="!giftCard.isExpire" v-if="showGift"
:card="giftCard" :card="giftCard"
:isTravelGroup="isTravelGroup" :isTravelGroup="isTravelGroup"
:addr="giftChooseAddress" :addr="giftChooseAddress"
@receive="onReceive($event)" /> @receive="onReceive($event)" />
<view v-else> <view v-else>
<view class="no-img-wrap"> <view class="no-img-wrap" v-if="isExpire">
<view class="wrap-box" > <view class="wrap-box" >
<image :src="webUrl + '/icon/no-gift.png'" mode="widthFix"></image> <image :src="webUrl + '/icon/no-gift.png'" mode="widthFix"></image>
<view class="v12-font-28 v12-dark1-text v12-mt-8">礼包超过24小时未领取订单已取消</view> <view class="v12-font-28 v12-dark1-text v12-mt-8">礼包超过24小时未领取订单已取消</view>
@@ -31,7 +31,8 @@ export default {
giftCard: {}, giftCard: {},
giftChooseAddress: {}, giftChooseAddress: {},
loading: false, loading: false,
isTravelGroup: false isTravelGroup: false,
isExpire: false
} }
}, },
onLoad(opts) { onLoad(opts) {
@@ -41,7 +42,11 @@ export default {
} else { } else {
this.getGiftCard(opts.code) this.getGiftCard(opts.code)
} }
},
computed: {
showGift() {
return !this.giftCard.isExpire || !!this.giftCard.isUserReceive
}
}, },
onShow() { onShow() {
this.giftChooseAddress = uni.getStorageSync('giftChooseAddress') || {} this.giftChooseAddress = uni.getStorageSync('giftChooseAddress') || {}
@@ -78,6 +83,7 @@ export default {
code: code code: code
}).then(res => { }).then(res => {
this.giftCard = res.data || {} this.giftCard = res.data || {}
this.isExpire = this.giftCard.isExpire === 1
if(this.isTravelGroup && res.data.isUserReceive === 1) { if(this.isTravelGroup && res.data.isUserReceive === 1) {
const obj = { const obj = {
...res.data, ...res.data,
@@ -86,10 +92,11 @@ export default {
} }
} }
uni.reLaunch({ url: '/pkg_user/views/gift/receiveDone?obj=' + JSON.stringify(obj) }) uni.reLaunch({ url: '/pkg_user/views/gift/receiveDone?obj=' + JSON.stringify(obj) })
} else {
this.loading = false
} }
uni.hideLoading() uni.hideLoading()
}).finally(() => { }).finally(() => {
this.loading = false
}) })
}, },
@@ -114,6 +121,7 @@ export default {
}).then(res => { }).then(res => {
this.giftCard = res.data || {} this.giftCard = res.data || {}
this.loading = false this.loading = false
this.isExpire = this.giftCard.isExpire === 1
if(this.giftCard.canTransfer === 0 ) { if(this.giftCard.canTransfer === 0 ) {
uni.hideShareMenu() uni.hideShareMenu()
return return