更新 front/templates/payPage.html

This commit is contained in:
zhangguoping 2025-07-21 20:47:55 +08:00
parent 64d79d4f3e
commit 8457574a8e
1 changed files with 4 additions and 7 deletions

View File

@ -243,8 +243,7 @@
if(localStorage.getItem('auto-redirect') != 2){ if(localStorage.getItem('auto-redirect') != 2){
// 否则设置自动跳转标记,并跳转 // 否则设置自动跳转标记,并跳转
localStorage.setItem('auto-redirect', 2); localStorage.setItem('auto-redirect', 2);
window.location.replace(`/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}`;
// window.location.href = `/pay/front/api/v1/payPage/submit?pay_channel_id=${data.data[0].pay_channel_id}&no=${id}`;
} }
} else { } else {
// 多种支付方式,展示支付界面 // 多种支付方式,展示支付界面
@ -329,8 +328,7 @@
const no = getQueryParam('no'); const no = getQueryParam('no');
const selectedMethod = document.querySelector('input[name="paymentMethod"]:checked'); const selectedMethod = document.querySelector('input[name="paymentMethod"]:checked');
if (selectedMethod) { if (selectedMethod) {
window.location.replace(`/pay/front/api/v1/payPage/submit?pay_channel_id=${selectedMethod.value}&no=${no}`); window.location.href = `/pay/front/api/v1/payPage/submit?pay_channel_id=${selectedMethod.value}&no=${no}`;
// window.location.href = `/pay/front/api/v1/payPage/submit?pay_channel_id=${selectedMethod.value}&no=${no}`;
} else { } else {
alert('请选择支付方式'); alert('请选择支付方式');
} }
@ -344,16 +342,15 @@
// 页面加载时执行 // 页面加载时执行
window.onload = function() { window.onload = function() {
alert(1)
if (localStorage.getItem('auto-redirect') && localStorage.getItem('auto-redirect') == 2) { if (localStorage.getItem('auto-redirect') && localStorage.getItem('auto-redirect') == 2) {
alert(2)
handlePaymentCallback(); // 如果是支付回调且不是自动跳转,处理支付结果 handlePaymentCallback(); // 如果是支付回调且不是自动跳转,处理支付结果
} else { } else {
alert(3)
localStorage.setItem('auto-redirect', 1); // 设置自动跳转标记 localStorage.setItem('auto-redirect', 1); // 设置自动跳转标记
fetchPaymentMethods(); // 获取支付方式 fetchPaymentMethods(); // 获取支付方式
} }
}; };
</script> </script>
{{ else}} {{ else}}