PHP后台微信支付和支付宝支付开发

时间:2017-05-08

4.前端微信支付页面wxpay.html

<html>
 <head>
  <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
  <link href="__TMPL__Public/css/weui.css" rel="external nofollow" type="text/css" rel="stylesheet"/>
  <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 class="container" id="container"><div class="msg">
    <div class="weui_msg">
     <div class="weui_icon_area"><i class="weui_icon_success weui_icon_msg"></i></div>
     <div class="weui_text_area">
      <h2 class="weui_msg_title">订单已生成</h2>
      <p class="weui_msg_desc">该笔订单支付金额为:<php> echo $pay_price;</php></p>
     </div>
     <div class="weui_opr_area">
      <p class="weui_btn_area">
       <a href="javascript:;" rel="external nofollow" class="weui_btn weui_btn_primary" onclick="callpay()">立即支付</a>
       <!--<a href="{:U('Order/pay_ok',array('o_id'=>$_GET['o_id']))}" rel="external nofollow" class="weui_btn weui_btn_default">取消支付</a>-->
      </p>
     </div>
     <!--     <div class="weui_extra_area">
           <a href="/wap/order/order_det/<?php echo $order['id']?>.html" rel="external nofollow" >查看详情</a>
          </div>-->
    </div>
   </div>
  </div>
 </body>
</html>
  • 共4页:
  • 上一页
  • 2/4
  • 下一页
  • 上一篇:PHP实现批量删除(封装) 下一篇:ThinkPHP中create()方法自动验证表单信息

    相关文章

    最新文章