index.html
1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html>
<head>
<title>微信支付</title>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1.0, width=device-width, user-scalable=no" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/assets/css/lanren.css">
<script type="text/javascript">
//调用微信JS api 支付
function jsApiCall()
{
WeixinJSBridge.invoke(
"getBrandWCPayRequest",
{$jsApiParameters},
function(res){
WeixinJSBridge.log(res.err_msg);
alert(res.err_code+res.err_desc+res.err_msg);
if (res.err_msg=='get_brand_wcpay_request:cancel'){
//支付取消逻辑
}else if (res.err_msg=='get_brand_wcpay_request:ok'){
//支付成功逻辑
}else{
//支付失败逻辑
}
}
);
}
function callpay()
{
if (typeof WeixinJSBridge == "undefined"){
if( document.addEventListener ){
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
}else if (document.attachEvent){
document.attachEvent('WeixinJSBridgeReady', jsApiCall);
document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
}
}else{
jsApiCall();
}
}
</script>
</head>
<body>
<div class="wenx_xx">
<div class="mz">DEF0000000001</div>
<div class="wxzf_price">¥0.01</div>
</div>
<div class="skf_xinf">
<div class="all_w"> <span class="bt">收款方</span> <span class="fr">{$site_info.site_name}</span> </div>
</div>
<a onclick="callpay()" class="ljzf_but all_w">立即支付</a>
<script type="text/javascript">
callpay();
</script>
</body>
</html>