更新 front/templates/payPage.html

This commit is contained in:
zhangguoping 2025-07-21 20:20:22 +08:00
parent e62a311c0e
commit eaed2d4a0b
1 changed files with 7 additions and 6 deletions

View File

@ -59,7 +59,7 @@
flex-direction: column;
align-items: center;
justify-content: center;
height: 200px;
height: 100%;
}
.loading-spinner {
@ -139,7 +139,7 @@
</div>
<!-- Loading状态 -->
<div id="loading" class="loading-container" style="display: block;">
<div id="loading" class="loading-container" style="display: flex;">
<div class="loading-spinner"></div>
<p class="loading-text">支付处理中,请稍等...</p>
</div>
@ -214,9 +214,7 @@
// 获取支付方式列表
function fetchPaymentMethods() {
const id = getQueryParam('no');
alert(id, 'zgp')
if (id) {
fetch(`/pay/front/api/v1/payPage/list?id=${id}`, {
method: 'POST',
@ -235,9 +233,9 @@
}
})
.then(data => {
closeLoading();
// 处理返回的数据,例如渲染支付方式列表
if (data === null || data.data.length === 0) {
closeLoading();
const pay = document.getElementById('pay');
pay.innerHTML = '<h3>支付环境异常,请检查</h3>';
} else if (data.data.length === 1) {
@ -249,6 +247,7 @@
}
} else {
// 多种支付方式,展示支付界面
closeLoading();
renderPaymentMethods(data.data);
}
})
@ -343,14 +342,16 @@
// 页面加载时执行
window.onload = function() {
alert(1)
if (localStorage.getItem('auto-redirect') && localStorage.getItem('auto-redirect') == 2) {
alert(2)
handlePaymentCallback(); // 如果是支付回调且不是自动跳转,处理支付结果
} else {
alert(3)
localStorage.setItem('auto-redirect', 1); // 设置自动跳转标记
fetchPaymentMethods(); // 获取支付方式
}
};
</script>
{{ else}}