...
|
...
|
@@ -146,42 +146,56 @@ if ($aliPayEL && $aliPayEL.length > 0 && $aliPayEL.data('href')) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
// 微信支付
|
|
|
function callpay(orderCode) {
|
|
|
/**
|
|
|
* 获取微信支付数据
|
|
|
* @param {*} orderCode
|
|
|
*/
|
|
|
function getWechatPayData(orderCode) {
|
|
|
let jsApiParameters;
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/cart/index/new/pay',
|
|
|
data: {
|
|
|
order_code: orderCode,
|
|
|
payment: '22_platform',
|
|
|
},
|
|
|
dataType: 'json',
|
|
|
success: function(res) {
|
|
|
if (res.code === 200) {
|
|
|
jsApiParameters = res.data.jsApiParameters;
|
|
|
jsApiCall(orderCode, jsApiParameters);
|
|
|
} else {
|
|
|
tip.show('微信支付调取失败');
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('请刷新本页面,完成微信支付');
|
|
|
},
|
|
|
complete: function() {
|
|
|
$loadingToast.addClass('hide');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 微信支付
|
|
|
function callpay(orderCode) {
|
|
|
$loadingToast.removeClass('hide');
|
|
|
if (typeof WeixinJSBridge === 'undefined') {
|
|
|
if (document.addEventListener) {
|
|
|
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
|
|
|
document.addEventListener('WeixinJSBridgeReady', function() {
|
|
|
getWechatPayData(orderCode);
|
|
|
}, false);
|
|
|
} else if (document.attachEvent) {
|
|
|
document.attachEvent('WeixinJSBridgeReady', jsApiCall);
|
|
|
document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
|
|
|
document.attachEvent('WeixinJSBridgeReady', function() {
|
|
|
getWechatPayData(orderCode);
|
|
|
});
|
|
|
document.attachEvent('onWeixinJSBridgeReady', function() {
|
|
|
getWechatPayData(orderCode);
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/cart/index/new/pay',
|
|
|
data: {
|
|
|
order_code: orderCode,
|
|
|
payment: '22_platform',
|
|
|
},
|
|
|
dataType: 'json',
|
|
|
success: function(res) {
|
|
|
if (res.code === 200) {
|
|
|
jsApiParameters = res.data.jsApiParameters;
|
|
|
jsApiCall(orderCode, jsApiParameters);
|
|
|
} else {
|
|
|
tip.show('微信支付调取失败');
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('请刷新本页面,完成微信支付');
|
|
|
},
|
|
|
complete: function() {
|
|
|
$loadingToast.addClass('hide');
|
|
|
}
|
|
|
});
|
|
|
getWechatPayData(orderCode);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|