|
|
@ -4,18 +4,21 @@
|
|
|
|
$(document).ready(function () {
|
|
|
|
$(document).ready(function () {
|
|
|
|
'use strict';
|
|
|
|
'use strict';
|
|
|
|
decode();
|
|
|
|
decode();
|
|
|
|
|
|
|
|
|
|
|
|
function decode() {
|
|
|
|
function decode() {
|
|
|
|
var redirect = window.redirect;
|
|
|
|
var redirect = window.redirect;
|
|
|
|
while(redirect.indexOf('://')<0){
|
|
|
|
while (redirect.indexOf('://') < 0) {
|
|
|
|
redirect = decodeURIComponent(redirect);
|
|
|
|
redirect = decodeURIComponent(redirect);
|
|
|
|
if(redirect==window.redirect){
|
|
|
|
if (redirect == window.redirect) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
window.redirect = redirect;
|
|
|
|
window.redirect = redirect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var dataCache = {paying: false};
|
|
|
|
var dataCache = {paying: false};
|
|
|
|
$('#key_P').bind('touchstart', startPay);
|
|
|
|
$('#key_P').bind('touchstart', startPay);
|
|
|
|
|
|
|
|
|
|
|
|
function startPay() {
|
|
|
|
function startPay() {
|
|
|
|
$('#wdiv').show();
|
|
|
|
$('#wdiv').show();
|
|
|
|
if (dataCache.paying) {
|
|
|
|
if (dataCache.paying) {
|
|
|
@ -28,17 +31,31 @@ $(document).ready(function () {
|
|
|
|
method: 'get',
|
|
|
|
method: 'get',
|
|
|
|
dataType: 'json',
|
|
|
|
dataType: 'json',
|
|
|
|
success: function (pay) {
|
|
|
|
success: function (pay) {
|
|
|
|
if(pay.direct_paid){
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (pay.direct_paid) {
|
|
|
|
|
|
|
|
dataCache.paying = false;
|
|
|
|
|
|
|
|
location.href = window.redirect;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var paydata = pay.jsapi;
|
|
|
|
|
|
|
|
invokePay(paydata);
|
|
|
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
alert("Unexpected Error:" + e);
|
|
|
|
|
|
|
|
$('#wdiv').hide();
|
|
|
|
dataCache.paying = false;
|
|
|
|
dataCache.paying = false;
|
|
|
|
location.href = window.redirect;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var paydata = pay.jsapi;
|
|
|
|
|
|
|
|
invokePay(paydata);
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
error: function (jqXhr) {
|
|
|
|
error: function (jqXhr) {
|
|
|
|
alert(jqXhr.responseJSON.message);
|
|
|
|
var respText = jqXhr.responseText;
|
|
|
|
$('#wdiv').hide();
|
|
|
|
try {
|
|
|
|
dataCache.paying = false;
|
|
|
|
alert(JSON.parse(respText).message);
|
|
|
|
|
|
|
|
$('#wdiv').hide();
|
|
|
|
|
|
|
|
dataCache.paying = false;
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
alert("Unexpected Error:" + respText);
|
|
|
|
|
|
|
|
$('#wdiv').hide();
|
|
|
|
|
|
|
|
dataCache.paying = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -85,6 +102,7 @@ $(document).ready(function () {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
checkOrderStd();
|
|
|
|
checkOrderStd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|