wechat.html 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <link rel="stylesheet" href="__ADDON__/css/wechat.css" />
  2. {if $type=='jsapi'}
  3. <div class="container">
  4. <div class="row" style="margin-top:20px;">
  5. <div class="col-xs-12">
  6. <button type="button" class="btn btn-success btn-lg btn-block">正在发起微信支付</button>
  7. <button type="button" class="btn btn-default btn-lg btn-block" onclick="location.href='{$orderData.returnurl}'">如果页面未自动跳转</button>
  8. </div>
  9. </div>
  10. </div>
  11. <script>
  12. function onBridgeReady(){
  13. WeixinJSBridge.invoke(
  14. 'getBrandWCPayRequest', {$payData|json_encode},
  15. function(res){
  16. if (res.err_msg == "get_brand_wcpay_request:ok") {
  17. layer.msg('支付成功!');
  18. } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
  19. layer.msg('您取消了支付');
  20. } else if (res.err_msg == "get_brand_wcpay_request:fail") {
  21. layer.msg('支付失败');
  22. }
  23. setTimeout(function () {
  24. location.href = '{$orderData.returnurl}';
  25. }, 1500);
  26. });
  27. }
  28. if (typeof WeixinJSBridge == "undefined"){
  29. if( document.addEventListener ){
  30. document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
  31. }else if (document.attachEvent){
  32. document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
  33. document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
  34. }
  35. }else{
  36. onBridgeReady();
  37. }
  38. </script>
  39. {elseif $type=='pc' /}
  40. <div class="container">
  41. <div class="wechat">
  42. <div class="row">
  43. <div class="col-xs-12 col-sm-12">
  44. <h2>
  45. <img src="__ADDON__/images/logo-wechat.png" alt="" height="32" class="pull-left" style="margin-right:5px;"> 微信支付
  46. <div class="wechat-time">
  47. 请在 <span>60</span> 秒内完成支付
  48. </div>
  49. </h2>
  50. <div class="row">
  51. <div class="col-xs-12 col-sm-5">
  52. <div class="wechat-body">
  53. <div class="wechat-order clearfix">
  54. <p>订单标题:<em>{$data.body}</em></p>
  55. <p>订单编号:<em>{$data.out_trade_no}</em></p>
  56. <p>订单价格:<em class="wechat-price">¥{$data.total_fee/100}</em> 元</p>
  57. </div>
  58. <div class="wechat-qrcode">
  59. <img src="{:addon_url('epay/api/qrcode',[],false)}?text={$data.code_url}">
  60. <div class="expired hidden"></div>
  61. <div class="paid hidden"></div>
  62. </div>
  63. <div class="wechat-tips">
  64. <p>请使用微信扫一扫<br>扫描二维码支付</p>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="col-sm-1"></div>
  69. <div class="col-sm-6 hidden-xs">
  70. <div class="wechat-scan">
  71. <img src="__ADDON__/images/tips.png" class="img-responsive" alt=""/>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. <script>
  80. var queryParams = {$data|json_encode};
  81. </script>
  82. {/if}