Lufaneng 8 months ago
parent 902623352d
commit 1a03f4fcdf

@ -109,14 +109,12 @@
color="#000" color="#000"
border="bottom" border="bottom"
:placeholderStyle="{ color: '#666778' }" :placeholderStyle="{ color: '#666778' }"
:placeholder=" :placeholder="item.type === 'number' ? `范围:${item.min} - ${item.max === 0 ? '不限' : item.max}` : (item.name === '土建图号'
item.name === '土建图号'
? '将根据土建图型号自动生成' ? '将根据土建图型号自动生成'
: '请输入' : '请输入')"
"
></uv-input> ></uv-input>
<!-- 数字范围提示 --> <!-- 数字范围提示 -->
<view <!-- <view
v-if=" v-if="
item.type === 'number' && item.type === 'number' &&
(item.min !== undefined || item.max !== undefined) (item.min !== undefined || item.max !== undefined)
@ -132,7 +130,7 @@
<text v-else-if="item.max !== undefined"> <text v-else-if="item.max !== undefined">
最大值{{ item.max }} 最大值{{ item.max }}
</text> </text>
</view> </view> -->
</uv-form-item> </uv-form-item>
</uv-form> </uv-form>
</view> </view>
@ -380,7 +378,7 @@ const validateNumberRange = (item) => {
} }
// //
if (item.max !== undefined && value > item.max) { if (item.max !== undefined && item.max !== 0 && value > item.max) {
uni.showToast({ uni.showToast({
title: `${item.name}不能大于${item.max}`, title: `${item.name}不能大于${item.max}`,
icon: "error", icon: "error",

@ -316,7 +316,7 @@
// #ifdef H5 // #ifdef H5
// H5 // H5
const payUrl = orderInfo.mwebUrl; // H5 const payUrl = orderInfo.h5_url; // H5
window.location.href = payUrl; window.location.href = payUrl;
return { return {
success: true, success: true,

@ -87,6 +87,25 @@
size="20" size="20"
></uv-icon> ></uv-icon>
</view> </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">
<text class="payment-name">微信支付</text>
<text class="payment-desc">推荐使用微信支付</text>
</view>
</view>
<uv-icon
name="checkmark-circle-fill"
:color="selectedPayment === 'wxpay' ? '#ff3333' : '#ccc'"
size="20"
></uv-icon>
</view>
</view> </view>
<!-- 底部支付按钮 --> <!-- 底部支付按钮 -->
@ -202,7 +221,7 @@ const wechatPay = async (orderInfo) => {
// #ifdef H5 // #ifdef H5
// H5 // H5
const payUrl = orderInfo.mwebUrl; // H5 const payUrl = orderInfo.h5_url; // H5
window.location.href = payUrl; window.location.href = payUrl;
return { return {
success: true, success: true,

@ -119,18 +119,18 @@
import RPC from "@/utils/request"; import RPC from "@/utils/request";
const authStore = useAuthStore(); const authStore = useAuthStore();
const userStore = useUserStore(); const userStore = useUserStore();
const memberInfo = ref({}) const memberInfo = ref({})
const getMemberInfo = () => { const getMemberInfo = () => {
uni.showLoading(); uni.showLoading();
RPC.post('/membership/user/info', { RPC.post('/membership/user/info', {
user_id: userStore.userInfo.id user_id: userStore.userInfo.id
}).then(res => { }).then(res => {
memberInfo.value = res || {} memberInfo.value = res || {}
}).finally(() => { }).finally(() => {
uni.hideLoading(); uni.hideLoading();
}) })
} }
// //
@ -139,7 +139,7 @@
const customAmount = ref(''); const customAmount = ref('');
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 isWechat = ref(false)
// //
@ -217,13 +217,13 @@
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
// //
showAlipay.value = false; showAlipay.value = false;
isWechat.value = true; 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'; selectedPayment.value = 'alipay';
// #endif // #endif
}; };
@ -258,37 +258,12 @@
// #ifdef H5 // #ifdef H5
// H5 // H5
if (typeof WeixinJSBridge !== 'undefined') { const payUrl = orderInfo.h5_url; // H5
return new Promise((resolve, reject) => { window.location.href = payUrl;
WeixinJSBridge.invoke('getBrandWCPayRequest', { return {
appId: orderInfo.appId, success: true,
timeStamp: orderInfo.timeStamp, redirect: true,
nonceStr: orderInfo.nonceStr, };
package: orderInfo.package,
signType: orderInfo.signType,
paySign: orderInfo.paySign
}, (res) => {
if (res.err_msg === 'get_brand_wcpay_request:ok') {
resolve({
success: true,
data: res
});
} else if (res.err_msg === 'get_brand_wcpay_request:cancel') {
reject(new Error('用户取消支付'));
} else {
reject(new Error('微信支付失败'));
}
});
});
} else {
//
const payUrl = orderInfo.mwebUrl;
window.location.href = payUrl;
return {
success: true,
redirect: true
};
}
// #endif // #endif
}; };
@ -356,7 +331,7 @@
// API // API
const orderNum = await RPC.post('/wallet/recharge', { const orderNum = await RPC.post('/wallet/recharge', {
user_id: userStore.userInfo.id, user_id: userStore.userInfo.id,
amount_cents: finalAmount.value * 100, amount_cents: finalAmount.value * 100,
pay_channel: selectedPayment.value pay_channel: selectedPayment.value
}) })
console.log('orderNum', orderNum) console.log('orderNum', orderNum)
@ -398,9 +373,9 @@
}); });
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', { const orderResult = await RPC.post('/membership/order/pay_by_alipay', {
order_no: orderNum.order_no order_no: orderNum.order_no
}) })
uni.showLoading({ uni.showLoading({
title: '正在跳转支付宝...' title: '正在跳转支付宝...'
@ -428,9 +403,9 @@
// //
selectedAmount.value = 0; selectedAmount.value = 0;
customAmount.value = ''; customAmount.value = '';
// setTimeout(() => { // setTimeout(() => {
// getMemberInfo() // getMemberInfo()
// },1000) // },1000)
// //
@ -515,7 +490,7 @@
}); });
onShow(() => { onShow(() => {
handlePaymentCallback(); handlePaymentCallback();
getMemberInfo() getMemberInfo()
}); });
</script> </script>

Loading…
Cancel
Save