更新 front/templates/payPage.html
This commit is contained in:
parent
d39d581a80
commit
f5061b558e
|
@ -198,22 +198,20 @@
|
|||
}
|
||||
break;
|
||||
default: // 其他状态(待支付/失败/关闭)
|
||||
alert('其他状态:待支付/失败/关闭');
|
||||
closeLoading();
|
||||
fetchPaymentMethods();
|
||||
closeLoading()
|
||||
// window.location.reload();
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
closeLoading();
|
||||
alert('订单状态查询失败');
|
||||
// window.location.reload();
|
||||
// closeLoading();
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
// 获取支付方式列表
|
||||
function fetchPaymentMethods() {
|
||||
const id = getQueryParam('no');
|
||||
alert(`订单id:${id}`);
|
||||
if (id) {
|
||||
fetch(`/pay/front/api/v1/payPage/list?id=${id}`, {
|
||||
method: 'POST',
|
||||
|
@ -237,20 +235,16 @@
|
|||
const pay = document.getElementById('pay');
|
||||
pay.innerHTML = '<h3>支付环境异常,请检查</h3>';
|
||||
} else if (data.data.length === 1) {
|
||||
alert('只有一种支付方式');
|
||||
|
||||
if(localStorage.getItem('auto-redirect') == 2){
|
||||
alert(`只有一种支付方式,有自动跳转标记:${localStorage.getItem('auto-redirect')}`);
|
||||
// 如果有自动跳转标记,展示支付界面
|
||||
renderPaymentMethods(data.data);
|
||||
}else{
|
||||
alert(`只有一种支付方式,没有自动跳转标记`);
|
||||
// 否则设置自动跳转标记,并跳转
|
||||
localStorage.setItem('auto-redirect', 2);
|
||||
window.location.href = `/pay/front/api/v1/payPage/submit?pay_channel_id=${data.data[0].pay_channel_id}&no=${id}`;
|
||||
}
|
||||
} else {
|
||||
alert(`多种支付方式`);
|
||||
// 多种支付方式,展示支付界面
|
||||
renderPaymentMethods(data.data);
|
||||
}
|
||||
|
@ -345,12 +339,9 @@
|
|||
|
||||
// 页面加载时执行
|
||||
window.onload = function() {
|
||||
alert(localStorage.getItem('auto-redirect'));
|
||||
if (localStorage.getItem('auto-redirect') == 2) {
|
||||
alert('支付回调且不是自动跳转');
|
||||
handlePaymentCallback(); // 如果是支付回调且不是自动跳转,处理支付结果
|
||||
} else {
|
||||
alert('首次加载');
|
||||
localStorage.setItem('auto-redirect', 1); // 设置自动跳转标记
|
||||
fetchPaymentMethods(); // 获取支付方式
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue