feat: 页面优化4
This commit is contained in:
parent
85c585ee02
commit
47c3a408a1
|
@ -197,8 +197,6 @@
|
|||
case 3: // 支付成功
|
||||
if (data.return_url) {
|
||||
window.location.href = data.return_url; // 自动跳转
|
||||
} else {
|
||||
window.location.reload(); // 无链接则刷新
|
||||
}
|
||||
break;
|
||||
default: // 其他状态(待支付/失败/关闭)
|
||||
|
@ -238,9 +236,17 @@
|
|||
const pay = document.getElementById('pay');
|
||||
pay.innerHTML = '<h3>支付环境异常,请检查</h3>';
|
||||
} else if (data.data.length === 1) {
|
||||
// 只有一种支付方式,显示loading效果,并跳转
|
||||
// 只有一种支付方式,显示loading效果
|
||||
showLoading();
|
||||
window.location.href = `/pay/front/api/v1/payPage/submit?pay_channel_id=${data.data[0].pay_channel_id}&no=${id}`;
|
||||
|
||||
if(localStorage.getItem('auto-redirect')){
|
||||
// 如果有自动跳转标记,展示支付界面
|
||||
renderPaymentMethods(data.data);
|
||||
}else{
|
||||
// 否则设置自动跳转标记,并跳转
|
||||
localStorage.setItem('auto-redirect', "true");
|
||||
window.location.href = `/pay/front/api/v1/payPage/submit?pay_channel_id=${data.data[0].pay_channel_id}&no=${id}`;
|
||||
}
|
||||
} else {
|
||||
// 多种支付方式,展示支付界面
|
||||
renderPaymentMethods(data.data);
|
||||
|
@ -337,12 +343,11 @@
|
|||
|
||||
// 页面加载时执行
|
||||
window.onload = function() {
|
||||
if (getQueryParam('return') == 'true') {
|
||||
// 如果是支付回调,处理支付结果
|
||||
handlePaymentCallback();
|
||||
if (getQueryParam('return') == 'true' && !localStorage.getItem('auto-redirect')) {
|
||||
handlePaymentCallback(); // 如果是支付回调且不是自动跳转,处理支付结果
|
||||
} else {
|
||||
// 获取支付方式
|
||||
fetchPaymentMethods();
|
||||
localStorage.removeItem('auto-redirect'); // 清除可能的auto-redirect标记
|
||||
fetchPaymentMethods(); // 获取支付方式
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue