diff --git a/front/templates/payPage.html b/front/templates/payPage.html index d58d496..96f631c 100644 --- a/front/templates/payPage.html +++ b/front/templates/payPage.html @@ -164,7 +164,7 @@ function showLoading() { document.getElementById('payment-info').style.display = 'none'; document.getElementById('pay-container').style.display = 'none'; - document.getElementById('loading').style.display = 'block'; + document.getElementById('loading').style.display = 'flex'; } // 关闭Loading效果 @@ -177,8 +177,11 @@ // 处理支付回调 function handlePaymentCallback() { const id = getQueryParam('no'); + alert(id, 'id') if (!id) return; + showLoading(); // 显示加载状态 + // 查询订单状态 fetch(`/pay/front/api/v1/payPage/query?no=${id}`, { method: 'POST', @@ -190,7 +193,7 @@ .then(data => { switch(data.status) { case 2: // 处理中 - handlePaymentCallback(); // 重查状态 + setTimeout(handlePaymentCallback, 1000); // 1秒后重查 break; case 3: // 支付成功 if (data.return_url) { @@ -198,7 +201,6 @@ } break; default: // 其他状态(待支付/失败/关闭) - alert('其他状态:待支付/失败/关闭'); closeLoading(); // window.location.reload(); } @@ -213,7 +215,7 @@ // 获取支付方式列表 function fetchPaymentMethods() { const id = getQueryParam('no'); - alert(`订单id:${id}`); + console.log('Order no:', id); if (id) { fetch(`/pay/front/api/v1/payPage/list?id=${id}`, { method: 'POST', @@ -237,27 +239,25 @@ const pay = document.getElementById('pay'); pay.innerHTML = '