1.优化充值跳转链接的问题
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
.countdown.expired { color: #cf1322; }
|
||||
button { width: 100%; padding: 14px; font-size: 16px; border: 0; border-radius: 8px; background: #1677ff; color: #fff; cursor: pointer; margin-top: 12px; }
|
||||
button:disabled { background: #ccc; cursor: not-allowed; }
|
||||
.btn-back { display: none; background: #fff; color: #cf1322; border: 1px solid #d9d9d9; }
|
||||
.hint { font-size: 13px; color: #999; }
|
||||
.ok { display: none; margin-top: 16px; padding: 12px; background: #f6ffed; border: 1px solid #b7eb8f; border-radius: 8px; color: #389e0d; line-height: 1.6; }
|
||||
.info { margin-top: 12px; padding: 12px; background: #e6f4ff; border: 1px solid #91caff; border-radius: 8px; color: #0958d9; font-size: 14px; line-height: 1.6; }
|
||||
@@ -32,6 +33,7 @@
|
||||
<p class="hint" id="expireLine"></p>
|
||||
<button type="button" id="btnPay">确认支付</button>
|
||||
<div class="ok" id="okBox"><strong>支付成功(模拟)</strong><br />订单已提交,需管理员在后台审核通过后才会入账。</div>
|
||||
<button type="button" class="btn-back" id="btnBackGame">返回游戏</button>
|
||||
<div id="msg"></div>
|
||||
</div>
|
||||
<script>
|
||||
@@ -41,6 +43,7 @@
|
||||
var apiBase = (params.get('api_base') || '').replace(/\/$/, '');
|
||||
var expireAt = parseInt(params.get('expire_at') || '0', 10);
|
||||
var sign = params.get('sign') || '';
|
||||
var returnGameUrl = params.get('return_game_url') || '';
|
||||
if (!apiBase) {
|
||||
apiBase = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
|
||||
}
|
||||
@@ -49,8 +52,19 @@
|
||||
var countdownEl = document.getElementById('countdown');
|
||||
var expireLineEl = document.getElementById('expireLine');
|
||||
var btnPay = document.getElementById('btnPay');
|
||||
var btnBackGame = document.getElementById('btnBackGame');
|
||||
var countdownTimer = null;
|
||||
|
||||
function showBackGame(url) {
|
||||
var target = (url || returnGameUrl || '').trim();
|
||||
if (!target) return;
|
||||
returnGameUrl = target;
|
||||
btnBackGame.style.display = 'block';
|
||||
btnBackGame.onclick = function () {
|
||||
window.location.href = returnGameUrl;
|
||||
};
|
||||
}
|
||||
|
||||
function showErr(text) {
|
||||
document.getElementById('msg').innerHTML = '<div class="err">' + text + '</div>';
|
||||
}
|
||||
@@ -110,12 +124,14 @@
|
||||
if (data.status === 'paid') {
|
||||
showInfo('该订单已入账。');
|
||||
btnPay.style.display = 'none';
|
||||
showBackGame(data.return_game_url);
|
||||
return;
|
||||
}
|
||||
if (data.status === 'pending_review') {
|
||||
document.getElementById('okBox').style.display = 'block';
|
||||
btnPay.style.display = 'none';
|
||||
showInfo('您已提交支付,请等待管理员审核通过后到账。');
|
||||
showBackGame(data.return_game_url);
|
||||
return;
|
||||
}
|
||||
if (data.status === 'failed') {
|
||||
@@ -184,6 +200,11 @@
|
||||
if (countdownTimer) clearInterval(countdownTimer);
|
||||
countdownEl.textContent = '已提交,等待后台审核';
|
||||
countdownEl.className = 'countdown';
|
||||
if (res.data && res.data.return_game_url) {
|
||||
showBackGame(res.data.return_game_url);
|
||||
} else {
|
||||
showBackGame('');
|
||||
}
|
||||
} else {
|
||||
showErr((res && res.message) ? res.message : '提交失败');
|
||||
btnPay.disabled = false;
|
||||
|
||||
Reference in New Issue
Block a user