<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <title>微信支付</title>
    <script type="text/javascript">
        //调用微信JS api 支付
        function jsApiCall()
        {
            WeixinJSBridge.invoke(
                'getBrandWCPayRequest',
                <?php echo $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:ok" ) {
                        window.location.href = "<?=str_replace(array('&#61;','&amp;'),array('=','&'),urldecode($return_url));?>";
                    }
                }
            );
        }
        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>

<center hidden>
    <h1 class="title">微信支付</h1>
    <div class="info">
        <p class="price">¥<?php echo $order->total_price;?></p>
        <p class="order">
            <span>交易单号:<strong style="color:#ff5400;"><?php echo $order->order_sn;?></strong></span>
            <br>
            <span>创建时间:<strong><?php echo date("Y-m-d H:i:s",$order->create_time);?></strong></span>
        </p>
    </div>
    <button style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer;  color:white;  font-size:16px;" type="button" onclick="callpay()" >立即支付</button>
</center>
<script>
callpay();
</script>
</body>
</html>