From 01eb9a425ac622f8269a57ab516e543196542dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=96=B9=E6=88=90?= Date: Thu, 8 Jan 2026 10:14:13 +0800 Subject: [PATCH] ci --- pages-activity/activity/yifanshang/index.vue | 73 +++++++++++--------- utils/request.js | 2 +- 2 files changed, 40 insertions(+), 35 deletions(-) diff --git a/pages-activity/activity/yifanshang/index.vue b/pages-activity/activity/yifanshang/index.vue index 88095cb..a51c610 100644 --- a/pages-activity/activity/yifanshang/index.vue +++ b/pages-activity/activity/yifanshang/index.vue @@ -402,43 +402,48 @@ async function onPaymentConfirm(paymentData) { throw new Error('创建订单失败:未返回订单号') } - // 第二步:使用订单号调用微信支付预下单接口 - uni.showLoading({ title: '拉起支付...' }) + // 第二步:判断是否需要支付 + if (joinResult.actual_amount > 0 && joinResult.status !== 2) { + // 使用订单号调用微信支付预下单接口 + uni.showLoading({ title: '拉起支付...' }) - // 获取 openid - const openid = uni.getStorageSync('openid') - if (!openid) { - throw new Error('缺少OpenID,请重新登录') + // 获取 openid + const openid = uni.getStorageSync('openid') + if (!openid) { + throw new Error('缺少OpenID,请重新登录') + } + + const preorderData = { + openid: openid, + order_no: joinResult.order_no + } + + console.log('[Yifanshang] Calling wechat preorder with:', preorderData) + + const paymentParams = await createWechatOrder(preorderData) + console.log('[Yifanshang] Wechat payment params:', paymentParams) + + uni.hideLoading() + + // 第三步:拉起支付 + // #ifdef MP-WEIXIN + const payResult = await uni.requestPayment({ + provider: 'wxpay', + ...paymentParams + }) + console.log('[Yifanshang] Payment result:', payResult) + // #endif + + // #ifdef MP-TOUTIAO + const payResult = await tt.pay({ + ...paymentParams + }) + console.log('[Yifanshang] Payment result:', payResult) + // #endif + } else { + console.log('[Yifanshang] Order is free or paid, skipping payment flow. Amount:', joinResult.actual_amount, 'Status:', joinResult.status) } - const preorderData = { - openid: openid, - order_no: joinResult.order_no - } - - console.log('[Yifanshang] Calling wechat preorder with:', preorderData) - - const paymentParams = await createWechatOrder(preorderData) - console.log('[Yifanshang] Wechat payment params:', paymentParams) - - uni.hideLoading() - - // 第三步:拉起支付 - // #ifdef MP-WEIXIN - const payResult = await uni.requestPayment({ - provider: 'wxpay', - ...paymentParams - }) - console.log('[Yifanshang] Payment result:', payResult) - // #endif - - // #ifdef MP-TOUTIAO - const payResult = await tt.pay({ - ...paymentParams - }) - console.log('[Yifanshang] Payment result:', payResult) - // #endif - // 第四步:支付成功后,查询抽奖结果 uni.showLoading({ title: '查询结果中...' }) diff --git a/utils/request.js b/utils/request.js index 24e5ccb..39b7254 100644 --- a/utils/request.js +++ b/utils/request.js @@ -1,4 +1,4 @@ -const BASE_URL = 'https://mini-chat.1024tool.vip' +const BASE_URL = 'https://kdy.1024tool.vip' let authModalShown = false