Showing
1 changed file
with
21 additions
and
11 deletions
@@ -146,19 +146,9 @@ if ($aliPayEL && $aliPayEL.length > 0 && $aliPayEL.data('href')) { | @@ -146,19 +146,9 @@ if ($aliPayEL && $aliPayEL.length > 0 && $aliPayEL.data('href')) { | ||
146 | }); | 146 | }); |
147 | } | 147 | } |
148 | 148 | ||
149 | -// 微信支付 | ||
150 | -function callpay(orderCode) { | 149 | +function getWechatPayData(orderCode) { |
151 | let jsApiParameters; | 150 | let jsApiParameters; |
152 | 151 | ||
153 | - $loadingToast.removeClass('hide'); | ||
154 | - if (typeof WeixinJSBridge === 'undefined') { | ||
155 | - if (document.addEventListener) { | ||
156 | - document.addEventListener('WeixinJSBridgeReady', jsApiCall, false); | ||
157 | - } else if (document.attachEvent) { | ||
158 | - document.attachEvent('WeixinJSBridgeReady', jsApiCall); | ||
159 | - document.attachEvent('onWeixinJSBridgeReady', jsApiCall); | ||
160 | - } | ||
161 | - } else { | ||
162 | $.ajax({ | 152 | $.ajax({ |
163 | type: 'GET', | 153 | type: 'GET', |
164 | url: '/cart/index/new/pay', | 154 | url: '/cart/index/new/pay', |
@@ -182,6 +172,26 @@ function callpay(orderCode) { | @@ -182,6 +172,26 @@ function callpay(orderCode) { | ||
182 | $loadingToast.addClass('hide'); | 172 | $loadingToast.addClass('hide'); |
183 | } | 173 | } |
184 | }); | 174 | }); |
175 | +} | ||
176 | + | ||
177 | +// 微信支付 | ||
178 | +function callpay(orderCode) { | ||
179 | + $loadingToast.removeClass('hide'); | ||
180 | + if (typeof WeixinJSBridge === 'undefined') { | ||
181 | + if (document.addEventListener) { | ||
182 | + document.addEventListener('WeixinJSBridgeReady', function() { | ||
183 | + getWechatPayData(orderCode); | ||
184 | + }, false); | ||
185 | + } else if (document.attachEvent) { | ||
186 | + document.attachEvent('WeixinJSBridgeReady', function() { | ||
187 | + getWechatPayData(orderCode); | ||
188 | + }); | ||
189 | + document.attachEvent('onWeixinJSBridgeReady', function() { | ||
190 | + getWechatPayData(orderCode); | ||
191 | + }); | ||
192 | + } | ||
193 | + } else { | ||
194 | + getWechatPayData(orderCode); | ||
185 | } | 195 | } |
186 | } | 196 | } |
187 | 197 |
-
Please register or login to post a comment