微信H5支付完成后跳转问题

master
dalong306 3 years ago
parent b6b2eacb02
commit 6533eec88a

@ -1,4 +1,4 @@
window = {}; window = window || {};
$(function () { $(function () {
'use strict'; 'use strict';
var winHeight = $(window).height(); var winHeight = $(window).height();
@ -6,7 +6,11 @@ $(function () {
if (ua.indexOf('micromessenger') >= 0) { if (ua.indexOf('micromessenger') >= 0) {
$(".weixin-tip").show().css("height", winHeight); $(".weixin-tip").show().css("height", winHeight);
} else { } else {
location.href = window.target_href; if (!window.retry_flag) {
location.href = window.target_href;
} else {
checkOrderStd(window.client_moniker, window.parent_order_id, true)
}
} }
decode(); decode();
@ -17,21 +21,59 @@ $(function () {
$('#complete').bind('touchstart', function () { $('#complete').bind('touchstart', function () {
checkOrderStd(window.client_moniker, window.partner_order_id, false); checkOrderStd(window.client_moniker, window.partner_order_id, false);
}); });
$('#refresh').bind('touchstart', function () {
if (window.refresh_cooldown > 0) {
return;
}
window.refresh_cooldown = 10;
function replaceTxt() {
window.refresh_cooldown = window.refresh_cooldown - 1
if (window.refresh_cooldown > 0) {
$('#refresh').find('a').text('正在查询订单,请' + window.refresh_cooldown + '秒后重试')
setTimeout(replaceTxt, 1000)
} else {
$('#refresh').find('a').text('已完成付款')
}
}
setTimeout(replaceTxt, 1000)
replaceTxt()
checkOrderStd(window.client_moniker, window.partner_order_id, false);
});
$('#retry_btn').bind('touchstart', function () {
location.href = window.target_href;
})
$('#continue_use_browser').bind('touchstart', function () { $('#continue_use_browser').bind('touchstart', function () {
location.href = window.target_href; location.href = window.target_href;
}); });
$('#copy_link').bind('touchstart', function () {
var current_href = location.href;
$("#copy_link_btn").attr("data-clipboard-text", current_href);
var btn = document.getElementById('copy_link_btn');
var clipboard = new ClipboardJS(btn);
clipboard.on('success', function (e) {
alert("复制成功!");
e.clearSelection();
});
clipboard.on('error', function (e) {
alert("复制失败!");
});
});
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;
} }
} }
function checkOrderStd(clientMoniker, merchantOrderId, needLoop) { function checkOrderStd(clientMoniker, merchantOrderId, needLoop) {
if (!clientMoniker || !merchantOrderId) { if (!clientMoniker || !merchantOrderId) {
return; return;

@ -17,6 +17,12 @@ $(function () {
$('#complete').bind('touchstart', function () { $('#complete').bind('touchstart', function () {
checkOrderStd(window.client_moniker, window.partner_order_id, false); checkOrderStd(window.client_moniker, window.partner_order_id, false);
}); });
$('#refresh').bind('touchstart', function () {
checkOrderStd(window.client_moniker, window.partner_order_id, false);
});
$('#continue_use_browser').bind('touchstart', function () {
callAlipayAps();
});
$('#continue_use_browser').bind('touchstart', function () { $('#continue_use_browser').bind('touchstart', function () {
callAlipayAps(); callAlipayAps();
}); });

Loading…
Cancel
Save