commit
4390b7764d
After Width: | Height: | Size: 1011 B |
File diff suppressed because one or more lines are too long
@ -0,0 +1,50 @@
|
|||||||
|
window = {};
|
||||||
|
$(function () {
|
||||||
|
'use strict';
|
||||||
|
var winHeight = $(window).height();
|
||||||
|
var ua = navigator.userAgent.toLowerCase();
|
||||||
|
if (ua.indexOf('micromessenger') >= 0) {
|
||||||
|
$(".weixin-tip").show().css("height", winHeight);
|
||||||
|
} else {
|
||||||
|
location.href = window.target_href;
|
||||||
|
}
|
||||||
|
$('.close-weixin-tip').bind('touchstart', function () {
|
||||||
|
$(".weixin-tip").hide();
|
||||||
|
checkOrderStd(window.client_moniker, window.partner_order_id, true);
|
||||||
|
});
|
||||||
|
$('#complete').bind('touchstart', function () {
|
||||||
|
checkOrderStd(window.client_moniker, window.partner_order_id, false);
|
||||||
|
});
|
||||||
|
$('#continue_use_browser').bind('touchstart', function () {
|
||||||
|
location.href = window.target_href;
|
||||||
|
});
|
||||||
|
|
||||||
|
function checkOrderStd(clientMoniker, merchantOrderId, needLoop) {
|
||||||
|
if (!clientMoniker || !merchantOrderId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: '/api/v1.0/payment/clients/' + clientMoniker + '/orders/' + merchantOrderId + '/status',
|
||||||
|
method: 'GET',
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (res) {
|
||||||
|
if (res.paid) {
|
||||||
|
location.href = window.redirect + (window.redirect.indexOf('?') < 0 ? '?' : '&') + 'success=true&time=' + res.time + '&nonce_str=' + res.nonce_str + '&sign=' + res.sign;
|
||||||
|
} else {
|
||||||
|
if (needLoop) {
|
||||||
|
setTimeout(checkOrderStd(clientMoniker, merchantOrderId, needLoop), 3000);
|
||||||
|
}
|
||||||
|
if (!needLoop && !res.paid) {
|
||||||
|
alert("订单未支付,请稍后再试");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (res) {
|
||||||
|
if (needLoop && res.message) {
|
||||||
|
alert(res.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
;
|
Loading…
Reference in new issue