Files
heping-api/app/view/wechat/payment.html
2022-09-19 10:42:07 +08:00

84 lines
2.5 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>微信支付</title>
<style>
* {
padding: 0;
margin: 0;
}
.background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 0;
margin: 0;
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
filter: blur(1px);
z-index: -1;
}
</style>
</head>
<body>
<div class="background" style="background-image: url('/static/background.jpg')">
</div>
<script type="text/javascript" src="/layer/layer.js"></script>
<script>
function onBridgeReady() {
if (typeof WeixinJSBridge === 'undefined') {
alert('请在微信在打开页面!');
return false;
}
WeixinJSBridge.invoke(
'getBrandWCPayRequest',
{$jssdk|json_encode|raw},
function (res) {
if (res.err_msg == "get_brand_wcpay_request:ok") {
setTimeout(function () {
layer.open({
content: '支付成功'
, shadeClose: false
, btn: ['3秒后自动返回']
, time: 3
, end: function () {
window.local.href = '{$callback}';
// window.history.back()
}
});
}, 1000);
} else {
layer.open({
content: '支付过程出现问题'
, shadeClose: false
, btn: ['3秒后自动返回']
, time: 3
, end: function () {
window.local.href = '{$callback}';
}
});
}
})
}
if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
}
} else {
onBridgeReady();
}
</script>
</body>
</html>