Fix:5304 【商城小程序】在中奖名单页面领取优惠券后,优惠券列表没有该优惠券
This commit is contained in:
@@ -155,7 +155,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getDrawActivityInfo, getActivityWinRecord, getDrawMyTickets, getDrawHistoryActivities } from '@/api/lottery'
|
import { claimCoupon, getDrawActivityInfo, getActivityWinRecord, getDrawMyTickets, getDrawHistoryActivities } from '@/api/lottery'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
@@ -202,6 +202,7 @@ export default {
|
|||||||
historyActivities: [],
|
historyActivities: [],
|
||||||
loaded: false,
|
loaded: false,
|
||||||
showCouponSuccessPopup: false,
|
showCouponSuccessPopup: false,
|
||||||
|
claiming: false,
|
||||||
showHistory: false,
|
showHistory: false,
|
||||||
entryWithoutActivityId: false,
|
entryWithoutActivityId: false,
|
||||||
historyList: [],
|
historyList: [],
|
||||||
@@ -268,8 +269,9 @@ export default {
|
|||||||
url: '/pkg-video/views/county-my-tickets'
|
url: '/pkg-video/views/county-my-tickets'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleClaimNow() {
|
async handleClaimNow() {
|
||||||
if (!this.userWinList.length) return
|
if (!this.userWinList.length) return
|
||||||
|
if (this.claiming) return
|
||||||
if (!this.showClaimNowBtn) {
|
if (!this.showClaimNowBtn) {
|
||||||
this.navToMyTickets()
|
this.navToMyTickets()
|
||||||
return
|
return
|
||||||
@@ -282,7 +284,31 @@ export default {
|
|||||||
|
|
||||||
const allCouponPrize = this.userWinList.every((item) => this.isCouponPrize(item))
|
const allCouponPrize = this.userWinList.every((item) => this.isCouponPrize(item))
|
||||||
if (allCouponPrize) {
|
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
|
return
|
||||||
}
|
}
|
||||||
this.navToReceiveInfo(this.userWinList[0])
|
this.navToReceiveInfo(this.userWinList[0])
|
||||||
|
|||||||
Reference in New Issue
Block a user