style:根据支付分免押规范进行页面样式变更(整体)
This commit is contained in:
+45
-6
@@ -138,8 +138,15 @@
|
||||
import {
|
||||
getDeviceInfo,
|
||||
rentPowerBank,
|
||||
getOrderByOrderNoScore
|
||||
getOrderByOrderNoScore,
|
||||
getOrderByOrderNoScorePayStatus
|
||||
} from '@/config/user.js'
|
||||
import {
|
||||
URL
|
||||
} from "@/config/url.js"
|
||||
import {
|
||||
initiateWeChatScorePayment
|
||||
} from '@/util/index.js'
|
||||
|
||||
// 响应式状态
|
||||
const deviceInfo = ref({})
|
||||
@@ -278,16 +285,48 @@
|
||||
|
||||
// 获取后端返回的订单信息
|
||||
const order = rentResult.data
|
||||
|
||||
// 获取支付分所需参数
|
||||
const res = await getOrderByOrderNoScore(order.orderNo);
|
||||
console.log(res);
|
||||
|
||||
uni.hideLoading()
|
||||
|
||||
|
||||
// 跳转到订单支付页面
|
||||
// uni.redirectTo({
|
||||
// url: `/pages/order/payment?orderId=${order.orderId}&deviceId=${deviceId.value}&noDeposit=true`
|
||||
// })
|
||||
if (res && res.code === 200) {
|
||||
try {
|
||||
// 调用微信支付分小程序
|
||||
const payResult = await initiateWeChatScorePayment(res);
|
||||
|
||||
// 支付成功后的逻辑处理 - 可以根据业务需求决定是否跳转或刷新页面
|
||||
if (payResult.errCode == '0') {
|
||||
const res = await getOrderByOrderNoScorePayStatus(order.orderNo);
|
||||
// 用户完成了支付流程,可以查询订单状态或跳转到订单页
|
||||
uni.showToast({
|
||||
title: '设备租借成功',
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
// 延迟跳转到租用中页面或订单页
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/index'
|
||||
});
|
||||
}, 1500);
|
||||
}
|
||||
// 用户取消等其他情况,不做特殊处理
|
||||
} catch (payError) {
|
||||
uni.showToast({
|
||||
title: '支付分调用失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res?.msg || '获取支付参数失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
|
||||
console.log(order);
|
||||
} catch (error) {
|
||||
uni.hideLoading()
|
||||
|
||||
Reference in New Issue
Block a user