|
|
@ -256,7 +256,7 @@ $(function () {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pay.direct_paid) {
|
|
|
|
if (pay.direct_paid) {
|
|
|
|
window.location = '/api/payment/v1.0/wechat_jsapi_payment/partners/' + window.client_moniker + '/orders/' + pay.order_id;
|
|
|
|
location.href = '/api/payment/v1.0/wechat_jsapi_payment/partners/' + window.client_moniker + '/orders/' + pay.order_id;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var paydata = pay.jsapi;
|
|
|
|
var paydata = pay.jsapi;
|
|
|
@ -270,7 +270,8 @@ $(function () {
|
|
|
|
}, function (res) {
|
|
|
|
}, function (res) {
|
|
|
|
dataCache.paying = false;
|
|
|
|
dataCache.paying = false;
|
|
|
|
if (res.err_msg == 'get_brand_wcpay_request:ok') {
|
|
|
|
if (res.err_msg == 'get_brand_wcpay_request:ok') {
|
|
|
|
window.location = '/api/payment/v1.0/wechat_jsapi_payment/partners/' + window.client_moniker + '/orders/' + pay.order_id;
|
|
|
|
startCheckOrder(pay.order_id);
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (res.err_msg != 'get_brand_wcpay_request:cancel' && res.err_msg != 'get_brand_wcpay_request:fail') {
|
|
|
|
if (res.err_msg != 'get_brand_wcpay_request:cancel' && res.err_msg != 'get_brand_wcpay_request:fail') {
|
|
|
|
weuiAlert('WeChat Error:' + res.err_msg);
|
|
|
|
weuiAlert('WeChat Error:' + res.err_msg);
|
|
|
@ -289,6 +290,24 @@ $(function () {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function startCheckOrder(orderId) {
|
|
|
|
|
|
|
|
function checkOrderStd() {
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
|
|
url: '/api/v1.0/payment/orders/' + orderId + '/status',
|
|
|
|
|
|
|
|
method: 'GET',
|
|
|
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
|
|
if (res.paid) {
|
|
|
|
|
|
|
|
location.href = '/api/payment/v1.0/wechat_jsapi_payment/partners/' + window.client_moniker + '/orders/' + orderId;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
setTimeout(checkOrderStd, 500);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
checkOrderStd();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function weuiAlert(msg) {
|
|
|
|
function weuiAlert(msg) {
|
|
|
|
var config = {
|
|
|
|
var config = {
|
|
|
|
template: msg
|
|
|
|
template: msg
|
|
|
@ -343,7 +362,11 @@ $(function () {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var ft = $('<div class="weui_dialog_ft"></div>').appendTo(dialogBox);
|
|
|
|
var ft = $('<div class="weui_dialog_ft"></div>').appendTo(dialogBox);
|
|
|
|
if ($.isFunction(config.confirm)) {
|
|
|
|
if ($.isFunction(config.confirm)) {
|
|
|
|
var yes = $('<a></a>', {class: 'weui_btn_dialog primary', text: 'OK',style:'background: #0bb20c;color: #fff;'}).appendTo(ft);
|
|
|
|
var yes = $('<a></a>', {
|
|
|
|
|
|
|
|
class: 'weui_btn_dialog primary',
|
|
|
|
|
|
|
|
text: 'OK',
|
|
|
|
|
|
|
|
style: 'background: #0bb20c;color: #fff;'
|
|
|
|
|
|
|
|
}).appendTo(ft);
|
|
|
|
yes.click(function () {
|
|
|
|
yes.click(function () {
|
|
|
|
config.confirm(dialog, true);
|
|
|
|
config.confirm(dialog, true);
|
|
|
|
dialog.remove();
|
|
|
|
dialog.remove();
|
|
|
@ -354,7 +377,11 @@ $(function () {
|
|
|
|
dialog.remove();
|
|
|
|
dialog.remove();
|
|
|
|
})
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
var ok = $('<a></a>', {class: 'weui_btn_dialog primary', text: 'OK',style:'background: #0bb20c;color: #fff;'}).appendTo(ft);
|
|
|
|
var ok = $('<a></a>', {
|
|
|
|
|
|
|
|
class: 'weui_btn_dialog primary',
|
|
|
|
|
|
|
|
text: 'OK',
|
|
|
|
|
|
|
|
style: 'background: #0bb20c;color: #fff;'
|
|
|
|
|
|
|
|
}).appendTo(ft);
|
|
|
|
ok.click(function () {
|
|
|
|
ok.click(function () {
|
|
|
|
dialog.remove();
|
|
|
|
dialog.remove();
|
|
|
|
})
|
|
|
|
})
|
|
|
|