chengkun
2025-05-26 4462855c0033970c39ac8d0da704b7dc41eabbfe
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{yun:}include file="$wapstyle/member/lheader.htm"{/yun}
<section class="wap_member">
  <div class="wap_member_comp_h1" style="position:relative"><span>微信支付</span></div>
  <div class="yun_wap_addresume_box" > 
 
    
    <form name='alipayment' onSubmit="return CheckForm(this);" action="index.php?c=pay" method="post">
        
      <div class="yun_wap_addresume_box_group" style="background: transparent; border: none;">
      {yun:}if $wxpay{/yun}
        <input type="button" value="微信支付" class="reinputText2" id="wxpay">
      {yun:}/if{/yun}
 
       {yun:}if $alipay{/yun}
        <input type="button" value="支付宝支付" class="reinputText2" id="alipay">
      {yun:}/if{/yun}
    
      </div>
    </form>
    </div>
  </div>
</section>
 
<script src="{yun:}$wap_style{/yun}/js/wx.sdk.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script>
    var id = '{yun:}$id{/yun}';
    
    
  //调用微信JS api 支付
    function jsApiCall()
    {
    
        
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest',
            {yun:}$jsApiParameters{/yun},
            function(res){
 
                if(res.err_msg == "get_brand_wcpay_request:ok" ) {
                    setInterval("wxorderstatus(" + id + ")", 3000);
                }else{
                    showToast(res.err_code+res.err_desc+res.err_msg,2,function(){location.href = 'index.php?c=pay';});    
                }
                
            }
        );
            
    }
    function wxorderstatus(orderid) { 
        $.post('{yun:}$config.sy_weburl{/yun}/api/wxpay/wxorder.php',{orderid:orderid},function(data){
            if(data==1){
                showToast('支付成功!',2,function(){location.href = 'index.php?c=com';});
            }
        });
    }
        
    $(document).ready(function(){
    
        
        
        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>
{yun:}include file="$wapstyle/member/public/phptoast.htm"{/yun}
</body></html>