wechat.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. {if $type=='jsapi'}
  2. <div class="container">
  3. <div class="row" style="margin-top:20px;">
  4. <div class="col-xs-12">
  5. <button type="button" class="btn btn-success btn-lg btn-block">正在发起微信支付</button>
  6. <button type="button" class="btn btn-default btn-lg btn-block" onclick="location.href='{$orderData.returnurl}'">如果页面未自动跳转</button>
  7. </div>
  8. </div>
  9. </div>
  10. <!--@formatter:off-->
  11. <script>
  12. function onBridgeReady() {
  13. WeixinJSBridge.invoke('getBrandWCPayRequest', {$payData|json_encode}, function(res) {
  14. if (res.err_msg == "get_brand_wcpay_request:ok") {
  15. layer.msg('支付成功!');
  16. } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
  17. layer.msg('您取消了支付');
  18. } else if (res.err_msg == "get_brand_wcpay_request:fail") {
  19. layer.msg('支付失败');
  20. }else{
  21. layer.msg(typeof res.err_msg!='undefined' ? res.err_msg : (typeof res.errMsg !=='undefined' ? res.errMsg : "未知支付状态"));
  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. <!--@formatter:on-->
  40. {elseif $type=='pc' /}
  41. <div class="container">
  42. <h2 class="scanpay-title">
  43. <img src="__ADDON__/images/logo-wechat.png" alt="" height="32" class="pull-left" style="margin-right:5px;"> 微信支付
  44. <div class="scanpay-time">
  45. 请在 <span>60</span> 秒内完成支付
  46. </div>
  47. </h2>
  48. <div class="scanpay scanpay-wechat">
  49. <div class="row">
  50. <div class="col-xs-12 col-sm-12">
  51. <div class="row">
  52. <div class="col-xs-12 col-sm-5">
  53. <div class="scanpay-body">
  54. <div class="scanpay-order clearfix">
  55. <p>订单标题:<em>{$orderData.title}</em></p>
  56. <p>订单编号:<em>{$orderData.orderid}</em></p>
  57. <p>订单价格:<em class="scanpay-price">¥{$orderData.amount}</em> 元</p>
  58. </div>
  59. <div class="scanpay-qrcode">
  60. <div class="qrcode" data-text="{$payData.code_url}"></div>
  61. <div class="expired hidden"></div>
  62. <div class="paid hidden"></div>
  63. </div>
  64. <div class="scanpay-tips">
  65. <p>请使用微信扫一扫<br>扫描二维码进行支付</p>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="col-sm-1"></div>
  70. <div class="col-sm-6 hidden-xs">
  71. <div class="scanpay-screenshot">
  72. <img src="__ADDON__/images/screenshot-wechat.png" class="img-responsive" alt=""/>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <!--@formatter:off-->
  81. <script>
  82. var queryParams = {"paytype":"wechat", "orderid":"{$orderData.orderid}", "returnurl":"{$orderData.returnurl}"};
  83. </script>
  84. <!--@formatter:on-->
  85. {/if}