Authored by 郭成尧

wechat-pay

@@ -7,10 +7,10 @@ var loading = require('../plugin/loading'), @@ -7,10 +7,10 @@ var loading = require('../plugin/loading'),
7 7
8 8
9 // 点击微信显示加载 9 // 点击微信显示加载
10 -var $loadingToast = $(".loading-toast"); 10 +var $loadingToast = $('.loading-toast');
11 11
12 /* TODO 影响加载此段 JS */ 12 /* TODO 影响加载此段 JS */
13 -// var theOrderCode = document.getElementById('ordercode').value; 13 +var theOrderCode = document.getElementById('ordercode').value;
14 14
15 var wxPayEl = document.getElementById('weixin'), 15 var wxPayEl = document.getElementById('weixin'),
16 wxHammer = wxPayEl && new Hammer(wxPayEl); 16 wxHammer = wxPayEl && new Hammer(wxPayEl);
@@ -36,9 +36,9 @@ if ($('#goods-list').length === 0) { @@ -36,9 +36,9 @@ if ($('#goods-list').length === 0) {
36 $('.maybe-like').hide(); 36 $('.maybe-like').hide();
37 } 37 }
38 38
39 -//隐藏微信分享选项 39 +// 隐藏微信分享选项
40 if (window.wx) { 40 if (window.wx) {
41 - wx.hideOptionMenu(); 41 + window.wx.hideOptionMenu();
42 } 42 }
43 43
44 function onBridgeReady() { 44 function onBridgeReady() {
@@ -61,14 +61,13 @@ if (typeof WeixinJSBridge === undefined) { @@ -61,14 +61,13 @@ if (typeof WeixinJSBridge === undefined) {
61 61
62 // 调用微信JS api 支付 62 // 调用微信JS api 支付
63 function jsApiCall(orderCode, jsApiParameters) { 63 function jsApiCall(orderCode, jsApiParameters) {
64 - $loadingToast.addClass("hide"); 64 + $loadingToast.addClass('hide');
65 65
66 // 防止重复操作弹框 66 // 防止重复操作弹框
67 window.WeixinJSBridge && window.WeixinJSBridge.invoke( 67 window.WeixinJSBridge && window.WeixinJSBridge.invoke(
68 'getBrandWCPayRequest', 68 'getBrandWCPayRequest',
69 jsApiParameters, 69 jsApiParameters,
70 - function(res) {  
71 - 70 + function() {
72 window.location.href = '/home/orders/detail?order_code=' + orderCode + '&openId=true'; 71 window.location.href = '/home/orders/detail?order_code=' + orderCode + '&openId=true';
73 } 72 }
74 ); 73 );
@@ -78,7 +77,7 @@ function jsApiCall(orderCode, jsApiParameters) { @@ -78,7 +77,7 @@ function jsApiCall(orderCode, jsApiParameters) {
78 function callpay(orderCode) { 77 function callpay(orderCode) {
79 var jsApiParameters; 78 var jsApiParameters;
80 79
81 - $loadingToast.removeClass("hide"); 80 + $loadingToast.removeClass('hide');
82 if (typeof WeixinJSBridge === undefined) { 81 if (typeof WeixinJSBridge === undefined) {
83 if (document.addEventListener) { 82 if (document.addEventListener) {
84 document.addEventListener('WeixinJSBridgeReady', jsApiCall, false); 83 document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
@@ -91,7 +90,7 @@ function callpay(orderCode) { @@ -91,7 +90,7 @@ function callpay(orderCode) {
91 type: 'GET', 90 type: 'GET',
92 url: '/shopping/pay/wechatwapapi', 91 url: '/shopping/pay/wechatwapapi',
93 data: { 92 data: {
94 - 'order_code': orderCode 93 + order_code: orderCode
95 }, 94 },
96 dataType: 'json', 95 dataType: 'json',
97 success: function(res) { 96 success: function(res) {
@@ -106,7 +105,7 @@ function callpay(orderCode) { @@ -106,7 +105,7 @@ function callpay(orderCode) {
106 tip.show('请刷新本页面,完成微信支付'); 105 tip.show('请刷新本页面,完成微信支付');
107 }, 106 },
108 complete: function() { 107 complete: function() {
109 - $loadingToast.addClass("hide"); 108 + $loadingToast.addClass('hide');
110 } 109 }
111 }); 110 });
112 } 111 }
@@ -177,7 +176,7 @@ function showPage() { @@ -177,7 +176,7 @@ function showPage() {
177 function bindTouchedEvent() { 176 function bindTouchedEvent() {
178 var $boxs = $('.box'); 177 var $boxs = $('.box');
179 178
180 - $boxs.on('touchstart', function(e) { 179 + $boxs.on('touchstart', function() {
181 $(this).addClass('bytouch'); 180 $(this).addClass('bytouch');
182 }).on('touchend touchcancel', function() { 181 }).on('touchend touchcancel', function() {
183 $boxs.removeClass('bytouch'); 182 $boxs.removeClass('bytouch');