自动选择优惠券

This commit is contained in:
tsui110 2025-12-18 14:32:07 +08:00
parent f3c0ab6d8f
commit ffd0073fdd
2 changed files with 28 additions and 5 deletions

View File

@ -95,12 +95,21 @@ const selectedCard = computed(() => {
return null
})
watch(() => props.visible, (val) => {
if (val) {
couponIndex.value = -1
watch(
[() => props.visible, () => (Array.isArray(props.coupons) ? props.coupons.length : 0)],
([vis, len]) => {
if (!vis) return
cardIndex.value = -1
if (len <= 0) {
couponIndex.value = -1
return
}
})
if (couponIndex.value < 0) {
couponIndex.value = 0
}
},
{ immediate: true }
)
function onCouponChange(e) {
couponIndex.value = e.detail.value

View File

@ -450,6 +450,20 @@ function onPaymentSuccess(payload) {
console.log('Payment Success:', payload)
const result = payload.result
const status = String((result && (result.status || result.data?.status || result.result?.status)) || '')
if (status === 'paid_waiting') {
const next = result && (result.next_draw_time || result.nextDrawTime || result.next_draw_at || result.nextDrawAt)
const nextText = next ? formatDateTime(next) : ''
const content = nextText ? `下单成功,等待系统自动开启本期赏品。\n预计开赏时间${nextText}` : '下单成功,等待系统自动开启本期赏品。'
try {
uni.showModal({
title: '下单成功',
content,
showCancel: false
})
} catch (_) {}
return
}
let wonItems = []
//