|
|
|
|
@ -67,6 +67,26 @@
|
|
|
|
|
<uv-icon name="checkmark-circle-fill" :color="selectedPayment === 'alipay' ? '#4285f4' : '#ccc'"
|
|
|
|
|
size="20"></uv-icon>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view
|
|
|
|
|
v-if="showAlipay"
|
|
|
|
|
class="payment-item"
|
|
|
|
|
:class="{ active: selectedPayment === 'wxpay' }"
|
|
|
|
|
@click="selectPayment('wxpay')"
|
|
|
|
|
>
|
|
|
|
|
<view class="payment-info">
|
|
|
|
|
<uv-icon name="weixin-fill" color="#07c160" size="24"></uv-icon>
|
|
|
|
|
<view class="payment-details">
|
|
|
|
|
<view class="payment-name">微信支付</view>
|
|
|
|
|
<view class="payment-desc">推荐使用微信支付</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<uv-icon
|
|
|
|
|
name="checkmark-circle-fill"
|
|
|
|
|
:color="selectedPayment === 'wxpay' ? '#ff3333' : '#ccc'"
|
|
|
|
|
size="20"
|
|
|
|
|
></uv-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
@ -359,15 +379,22 @@
|
|
|
|
|
|
|
|
|
|
// 根据支付方式调用对应的支付方法
|
|
|
|
|
let paymentResult;
|
|
|
|
|
|
|
|
|
|
let orderResult = {};
|
|
|
|
|
if (selectedPayment.value === 'wxpay') {
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
const res = await uni.login({
|
|
|
|
|
provider: 'weixin'
|
|
|
|
|
})
|
|
|
|
|
const orderResult = await RPC.post('/membership/order/pay_by_wechat_mini', {
|
|
|
|
|
orderResult = await RPC.post('/membership/order/pay_by_wechat_mini', {
|
|
|
|
|
code: res.code,
|
|
|
|
|
"order_no": orderNum.order_no
|
|
|
|
|
})
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
orderResult = await RPC.post("/membership/order/pay_by_wechat_h5", {
|
|
|
|
|
order_no: orderNum.order_no,
|
|
|
|
|
});
|
|
|
|
|
// #endif
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
title: "正在跳转微信支付...",
|
|
|
|
|
});
|
|
|
|
|
@ -417,9 +444,10 @@
|
|
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
uni.hideLoading();
|
|
|
|
|
console.log(error)
|
|
|
|
|
console.error('充值失败:', error);
|
|
|
|
|
|
|
|
|
|
let errorMessage = '充值失败,请重试';
|
|
|
|
|
let errorMessage = '';
|
|
|
|
|
if (error.message === '用户取消支付') {
|
|
|
|
|
errorMessage = '支付已取消';
|
|
|
|
|
} else if (error.message) {
|
|
|
|
|
@ -427,7 +455,7 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: errorMessage,
|
|
|
|
|
title: errorMessage || error,
|
|
|
|
|
icon: 'none'
|
|
|
|
|
});
|
|
|
|
|
} finally {
|
|
|
|
|
|