diff --git a/src/main/ui/static/templates/skip_wxbrowser.js b/src/main/ui/static/templates/skip_wxbrowser.js index bdd95f702..7697843b5 100644 --- a/src/main/ui/static/templates/skip_wxbrowser.js +++ b/src/main/ui/static/templates/skip_wxbrowser.js @@ -1,4 +1,4 @@ -window = {}; +window = window || {}; $(function () { 'use strict'; var winHeight = $(window).height(); @@ -6,7 +6,11 @@ $(function () { if (ua.indexOf('micromessenger') >= 0) { $(".weixin-tip").show().css("height", winHeight); } 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(); @@ -17,21 +21,59 @@ $(function () { $('#complete').bind('touchstart', function () { 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 () { 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() { var redirect = window.redirect; while (redirect.indexOf('://') < 0) { redirect = decodeURIComponent(redirect); - if (redirect == window.redirect) { + if (redirect === window.redirect) { break; } window.redirect = redirect; } } + function checkOrderStd(clientMoniker, merchantOrderId, needLoop) { if (!clientMoniker || !merchantOrderId) { return; diff --git a/src/main/ui/static/templates/skip_wxbrowser_aps.js b/src/main/ui/static/templates/skip_wxbrowser_aps.js index 38df37603..ecb015c58 100644 --- a/src/main/ui/static/templates/skip_wxbrowser_aps.js +++ b/src/main/ui/static/templates/skip_wxbrowser_aps.js @@ -17,6 +17,12 @@ $(function () { $('#complete').bind('touchstart', function () { 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 () { callAlipayAps(); });