bruce

优化

......@@ -129,7 +129,7 @@ public class UnionPayUtil {
}
}
try {
return URLDecoder.decode(result.toString(), "utf-8");
return URLDecoder.decode(result.toString(), "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return "转码出错";
......
......@@ -27,6 +27,7 @@
this.countdown = 120;
this.count = 1;
this.billNo = '';
this.interval = '';
},
bind: function () {
$(document).on('click', '#payBtn', this.showPayDialog);
......@@ -51,7 +52,11 @@
skin: 'payDialogContent',
btnAlign: 'c',
moveType: 1,
content: ''
content: '',
cancel: function(){
Pay.count = 11;
window.clearInterval(Pay.interval);
}
});
var htmlStr = '';
htmlStr += '<div style="width:100%;height:50px;font-size:16px;text-align:center;padding-top:30px;">'
......@@ -74,10 +79,11 @@
});
qrcode.clear();
qrcode.makeCode(data.qrCode);
Pay.count = 1;
Pay.billNo = data.billNo;
setTimeout(function () {
setInterval(function () { Pay.ajaxstatus()}, 5000);
}, 5000);
Pay.interval = setInterval(function () { Pay.ajaxstatus()}, 5000);
}, 3000);
Pay._timer();
} else {
layer.msg(data.msg, {icon: '2'});
......@@ -90,17 +96,16 @@
type: "get",
url: "/pick/unionPay/query?billNo=" + Pay.billNo,
success: function (data) {
console.info(data)
if (data.status === 'PAID') {
layer.msg('付款成功', {icon: '1'});
setTimeout(function () {
window.location.href = "/user/pick/record"; //页面跳转
window.location.href = "/user/pick/record";
}, 3 * 1000)
}else if(data.status === 'CLOSED') {
layer.msg('二维码已失效,请重新扫码支付', {icon: '1'});
layer.msg('二维码已失效,请重新扫码支付', {icon: '2'});
setTimeout(function () {}, 5 * 1000)
}else if(data.status === 'UNKNOWN') {
layer.msg('付款失败,请重新扫码支付', {icon: '1'});
layer.msg('付款失败,请重新扫码支付', {icon: '2'});
setTimeout(function () {}, 5 * 1000)
}
},
......@@ -111,7 +116,7 @@
},
_timer: function () {
if (Pay.countdown == 0) {
if (Pay.count > 5) {
if (Pay.count > 10) {
return;
}
$.ajax({
......@@ -119,7 +124,7 @@
url: "/pick/unionPay/createOrder",
success: function (data) {
if (data.code) {
Pay.countdown = 120;zx
Pay.countdown = 120;
var qrcode = new QRCode(document.getElementById("qrcode"), {
width: 200,
height: 200,
......