diff --git a/components/YifanSelector.vue b/components/YifanSelector.vue index becae24..21395f2 100644 --- a/components/YifanSelector.vue +++ b/components/YifanSelector.vue @@ -289,24 +289,29 @@ async function onPaymentConfirm(paymentData) { } // 2. 使用返回的订单号去发起支付 - const payRes = await createWechatOrder({ - openid: openid, - order_no: orderNo - }) + // Check if order is already paid (e.g. via Game Pass or Points) + const isPaid = (joinRes?.status === 2) || (joinRes?.actual_amount <= 0) - // 调起微信支付 - await new Promise((resolve, reject) => { - uni.requestPayment({ - provider: 'wxpay', - timeStamp: payRes.timeStamp || payRes.timestamp, - nonceStr: payRes.nonceStr || payRes.noncestr, - package: payRes.package, - signType: payRes.signType || 'MD5', - paySign: payRes.paySign, - success: resolve, - fail: reject - }) - }) + if (!isPaid) { + const payRes = await createWechatOrder({ + openid: openid, + order_no: orderNo + }) + + // 调起微信支付 + await new Promise((resolve, reject) => { + uni.requestPayment({ + provider: 'wxpay', + timeStamp: payRes.timeStamp || payRes.timestamp, + nonceStr: payRes.nonceStr || payRes.noncestr, + package: payRes.package, + signType: payRes.signType || 'MD5', + paySign: payRes.paySign, + success: resolve, + fail: reject + }) + }) + } uni.hideLoading() uni.showLoading({ title: '查询结果...' }) diff --git a/pages-activity/activity/wuxianshang/index.vue b/pages-activity/activity/wuxianshang/index.vue index 8a1361d..085d7ae 100644 --- a/pages-activity/activity/wuxianshang/index.vue +++ b/pages-activity/activity/wuxianshang/index.vue @@ -378,19 +378,24 @@ async function onMachineDraw(count) { const orderNo = joinRes?.order_no || joinRes?.data?.order_no || joinRes?.result?.order_no if (!orderNo) throw new Error('未获取到订单号') - const payRes = await createWechatOrder({ openid, order_no: orderNo }) - await new Promise((resolve, reject) => { - uni.requestPayment({ - provider: 'wxpay', - timeStamp: payRes.timeStamp || payRes.timestamp, - nonceStr: payRes.nonceStr || payRes.noncestr, - package: payRes.package, - signType: payRes.signType || 'MD5', - paySign: payRes.paySign, - success: resolve, - fail: reject + // Check if order is already paid (e.g. via Game Pass or Points) + const isPaid = (joinRes?.status === 2) || (joinRes?.actual_amount <= 0) + + if (!isPaid) { + const payRes = await createWechatOrder({ openid, order_no: orderNo }) + await new Promise((resolve, reject) => { + uni.requestPayment({ + provider: 'wxpay', + timeStamp: payRes.timeStamp || payRes.timestamp, + nonceStr: payRes.nonceStr || payRes.noncestr, + package: payRes.package, + signType: payRes.signType || 'MD5', + paySign: payRes.paySign, + success: resolve, + fail: reject + }) }) - }) + } // 支付成功后立即显示开奖加载弹窗 drawTotal.value = times