PaymentCenter/front/templates/payTemplateDefault.html

50 lines
1.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{ define "payTemplateDefault.html"}}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<!-- 修复荣耀UA识别关键标签 -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
<title>支付</title>
<style>
body { padding: 50px 20px; margin:0; font-family: system-ui; text-align: center; }
.desc { font-size:14px; color:#555; margin-bottom:40px; }
.wx-pay-btn {
width: 90%;
padding:14px 0;
background:#07C160;
color:#fff;
border:none;
border-radius:8px;
font-size:17px;
}
</style>
</head>
<body>
{{ if eq .code 200}}
<div class="desc">正在尝试自动唤起支付<br>若未跳转,请点击下方按钮</div>
<button class="wx-pay-btn" id="triggerPay">打开支付</button>
<script>
const payLink = "{{.payUrl}}";
const btn = document.getElementById('triggerPay');
// 荣耀机型必须靠点击事件才能绕过系统拦截
btn.onclick = function(){
window.location.href = payLink;
}
// DOM加载完成后延时自动跳转仅作兜底荣耀大概率拦截按钮是核心方案
window.onload = function(){
setTimeout(()=>{
window.location.href = payLink;
}, 500);
}
</script>
{{else}}
<script>
alert("支付失败:{{.code}} {{.message}}");
history.back();
</script>
{{end}}
</body>
</html>
{{ end }}