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