From b40464ad36a2035e0f668ae1920b6e8cc8f00a4a Mon Sep 17 00:00:00 2001 From: wolter <11@gmail> Date: Tue, 22 Jul 2025 12:02:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=962?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/templates/payPage.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/front/templates/payPage.html b/front/templates/payPage.html index ecca6e3..ff1b2a0 100644 --- a/front/templates/payPage.html +++ b/front/templates/payPage.html @@ -199,16 +199,19 @@ }) .then((data) => { closeLoading(); + alert(data.status); switch (data.status) { case 2: // 处理中 handlePaymentCallback(); // 重查状态 break; case 3: // 支付成功 + alert(data.return_url); if (data.return_url) { window.location.href = data.return_url; // 自动跳转 } break; default: // 其他状态(待支付/失败/关闭) + alert("其他状态(待支付"); fetchPaymentMethods(); // window.location.reload(); } @@ -354,7 +357,7 @@ // 监听页面可见性变化 document.addEventListener("visibilitychange", function () { if (!document.hidden && localStorage.getItem("auto-redirect") == 2) { - // 页面从后台返回且处于支付状态 + // 按回退键返回,重新获取支付方式 fetchPaymentMethods(); } }); @@ -362,11 +365,8 @@ // 页面加载时执行 window.onload = function () { alert(`return:${getQueryParam("return")}`); - if ( - localStorage.getItem("auto-redirect") && - localStorage.getItem("auto-redirect") == 2 - ) { - alert("查询支付状态"); + if (getQueryParam("return")) { + alert("处理支付回调"); handlePaymentCallback(); // 如果是支付回调且不是自动跳转,处理支付结果 } else { localStorage.setItem("auto-redirect", 1); // 设置自动跳转标记