<html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"/> <meta content="width=device-width, initial-scale=1"/> <link href="https://www.jb51.net/__TMPL__Public/css/weui.css" type="text/css"/> <title>微信订单支付</title> <script type="text/javascript"> //调用微信JS api 支付 function jsApiCall() { WeixinJSBridge.invoke( 'getBrandWCPayRequest', <php> echo $jsApiParameters; </php>, function(res) { WeixinJSBridge.log(res.err_msg); if (res.err_msg == "get_brand_wcpay_request:ok") { // alert(res.err_code + res.err_desc + res.err_msg); // 成功跳转页面 window.location.href = '{:U("Orders/pay_ok",array("o_id"=>$o_id))}'; } 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> <br/> <div><div> <div> <div><i></i></div> <div> <h2>订单已生成</h2> <p>该笔订单支付金额为:<php> echo $pay_price;</php></p> </div> <div> <p> <a href="javascript:;">立即支付</a> <!--<a href="{:U('Order/pay_ok',array('o_id'=>$_GET['o_id']))}">取消支付</a>--> </p> </div> <!-- <div> <a href="/wap/order/order_det/<?php echo $order['id']?>.html" >查看详情</a> </div>--> </div> </div> </div> </body> </html>
5.支付成功跳转到OrderController.class.php ,订单支付完成