fix: 防止用户误取消已付款订单-回调重新激活+2分钟内禁止取消+成功页30s超时提示

This commit is contained in:
2026-06-15 10:37:28 +08:00
parent e672f00b66
commit 43c349919d
2 changed files with 36 additions and 2 deletions

View File

@@ -901,6 +901,11 @@ fn build_success_html(order_no: &str) -> String {
<div class="tip">系统会自动处理,无需重复操作</div>
<div class="order-no">订单号: {2}</div>
</div>
<div id="timeoutView" style="display:none">
<p style="color:#666;font-size:14px">确认时间稍长,请返回小程序查看订单状态</p>
<p style="color:#999;font-size:12px">系统会在确认后自动为您开通会员,请勿重复支付</p>
<div class="order-no">订单号: {2}</div>
</div>
</div>
<script>
(function poll(){{
@@ -916,12 +921,22 @@ fn build_success_html(order_no: &str) -> String {
if (data.success && data.data.order_status === 'paid') {{
document.getElementById('confirmedView').style.display = 'block';
document.getElementById('pendingView').style.display = 'none';
document.getElementById('timeoutView').style.display = 'none';
}} else if (data.success && data.data.order_status === 'cancelled') {{
// 订单被取消(可能是误操作),继续轮询等待支付宝回调重新激活
setTimeout(poll, 2000);
}} else {{
setTimeout(poll, 2000);
}}
}})
.catch(function(){{ setTimeout(poll, 2000); }});
}})();
// 30 秒后显示返回提示(不阻断轮询)
setTimeout(function(){{
if (document.getElementById('confirmedView').style.display !== 'block') {{
document.getElementById('timeoutView').style.display = 'block';
}}
}}, 30000);
</script>
</body>
</html>"##,