Fix:5304 【商城小程序】在中奖名单页面领取优惠券后,优惠券列表没有该优惠券

This commit is contained in:
linxi
2026-06-26 10:07:23 +08:00
parent 26c5c4d115
commit fb9b85645b
+29 -3
View File
@@ -155,7 +155,7 @@
</template>
<script>
import { getDrawActivityInfo, getActivityWinRecord, getDrawMyTickets, getDrawHistoryActivities } from '@/api/lottery'
import { claimCoupon, getDrawActivityInfo, getActivityWinRecord, getDrawMyTickets, getDrawHistoryActivities } from '@/api/lottery'
export default {
computed: {
@@ -202,6 +202,7 @@ export default {
historyActivities: [],
loaded: false,
showCouponSuccessPopup: false,
claiming: false,
showHistory: false,
entryWithoutActivityId: false,
historyList: [],
@@ -268,8 +269,9 @@ export default {
url: '/pkg-video/views/county-my-tickets'
})
},
handleClaimNow() {
async handleClaimNow() {
if (!this.userWinList.length) return
if (this.claiming) return
if (!this.showClaimNowBtn) {
this.navToMyTickets()
return
@@ -282,7 +284,31 @@ export default {
const allCouponPrize = this.userWinList.every((item) => this.isCouponPrize(item))
if (allCouponPrize) {
this.showCouponSuccessPopup = true
const prize = this.userWinList[0] || {}
const ticketId = Number(prize.id || prize.lotteryRecordId || 0)
if (!ticketId) {
uni.showToast({
title: '缺少抽奖券ID',
icon: 'none'
})
return
}
this.claiming = true
uni.showLoading({ title: '领取中...' })
try {
await claimCoupon(ticketId)
await this.fetchData()
this.showCouponSuccessPopup = true
} catch (e) {
uni.showToast({
title: (e && e.msg) || (e && e.message) || '领取失败',
icon: 'none'
})
} finally {
uni.hideLoading()
this.claiming = false
}
return
}
this.navToReceiveInfo(this.userWinList[0])