|
|
|
@ -41,7 +41,7 @@
|
|
|
|
<view class="section-title">选择支付方式</view>
|
|
|
|
<view class="section-title">选择支付方式</view>
|
|
|
|
<view class="payment-list">
|
|
|
|
<view class="payment-list">
|
|
|
|
<!-- 微信支付 -->
|
|
|
|
<!-- 微信支付 -->
|
|
|
|
<view class="payment-item" :class="{ active: selectedPayment === 'wxpay' }"
|
|
|
|
<view v-if="isWechat" class="payment-item" :class="{ active: selectedPayment === 'wxpay' }"
|
|
|
|
@click="selectPayment('wxpay')">
|
|
|
|
@click="selectPayment('wxpay')">
|
|
|
|
<view class="payment-info">
|
|
|
|
<view class="payment-info">
|
|
|
|
<uv-icon name="weixin-fill" color="#07c160" size="28"></uv-icon>
|
|
|
|
<uv-icon name="weixin-fill" color="#07c160" size="28"></uv-icon>
|
|
|
|
@ -140,6 +140,7 @@
|
|
|
|
const selectedPayment = ref('wxpay');
|
|
|
|
const selectedPayment = ref('wxpay');
|
|
|
|
const recharging = ref(false);
|
|
|
|
const recharging = ref(false);
|
|
|
|
const showAlipay = ref(true);
|
|
|
|
const showAlipay = ref(true);
|
|
|
|
|
|
|
|
const isWechat = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
// 充值金额选项
|
|
|
|
// 充值金额选项
|
|
|
|
const rechargeAmounts = ref([{
|
|
|
|
const rechargeAmounts = ref([{
|
|
|
|
@ -216,16 +217,14 @@
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
// 微信小程序环境,隐藏支付宝选项
|
|
|
|
// 微信小程序环境,隐藏支付宝选项
|
|
|
|
showAlipay.value = false;
|
|
|
|
showAlipay.value = false;
|
|
|
|
|
|
|
|
isWechat.value = true;
|
|
|
|
selectedPayment.value = 'wxpay';
|
|
|
|
selectedPayment.value = 'wxpay';
|
|
|
|
// #endif
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
|
|
|
|
// #ifdef H5
|
|
|
|
// #ifdef H5
|
|
|
|
// H5环境,显示所有支付选项
|
|
|
|
// H5环境,显示所有支付选项
|
|
|
|
showAlipay.value = true;
|
|
|
|
showAlipay.value = true;
|
|
|
|
// 如果在微信浏览器内,默认选择微信支付
|
|
|
|
selectedPayment.value = 'alipay';
|
|
|
|
const ua = navigator.userAgent.toLowerCase();
|
|
|
|
|
|
|
|
const isWechat = ua.indexOf('micromessenger') !== -1;
|
|
|
|
|
|
|
|
selectedPayment.value = isWechat ? 'wxpay' : 'alipay';
|
|
|
|
|
|
|
|
// #endif
|
|
|
|
// #endif
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@ -297,7 +296,7 @@
|
|
|
|
const alipayPay = async (orderInfo) => {
|
|
|
|
const alipayPay = async (orderInfo) => {
|
|
|
|
// #ifdef H5
|
|
|
|
// #ifdef H5
|
|
|
|
// H5支付宝支付
|
|
|
|
// H5支付宝支付
|
|
|
|
const payUrl = orderInfo.payUrl;
|
|
|
|
const payUrl = orderInfo.pay_url;
|
|
|
|
window.location.href = payUrl;
|
|
|
|
window.location.href = payUrl;
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
success: true,
|
|
|
|
success: true,
|
|
|
|
@ -400,10 +399,13 @@
|
|
|
|
console.log('orderResult', orderResult)
|
|
|
|
console.log('orderResult', orderResult)
|
|
|
|
paymentResult = await wechatPay(orderResult);
|
|
|
|
paymentResult = await wechatPay(orderResult);
|
|
|
|
} else if (selectedPayment.value === 'alipay') {
|
|
|
|
} else if (selectedPayment.value === 'alipay') {
|
|
|
|
|
|
|
|
const orderResult = await RPC.post('/membership/order/pay_by_alipay', {
|
|
|
|
|
|
|
|
order_no: orderNum.order_no
|
|
|
|
|
|
|
|
})
|
|
|
|
uni.showLoading({
|
|
|
|
uni.showLoading({
|
|
|
|
title: '正在跳转支付宝...'
|
|
|
|
title: '正在跳转支付宝...'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
paymentResult = await alipayPay(orderResult.alipayInfo);
|
|
|
|
paymentResult = await alipayPay(orderResult);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uni.hideLoading();
|
|
|
|
uni.hideLoading();
|
|
|
|
|