diff --git a/payment_headend/js/customAlert.js b/payment_headend/js/customAlert.js index 136242d..28c459c 100644 --- a/payment_headend/js/customAlert.js +++ b/payment_headend/js/customAlert.js @@ -1,6 +1,6 @@ function showCustomAlert(message) { const alertBox = document.getElementById('customAlert'); - alertBox.innerText = message; + alertBox.innerHTML = message; alertBox.style.display = 'block'; alertBox.style.opacity = '1'; diff --git a/payment_headend/js/index.js b/payment_headend/js/index.js index ecd825f..399cb2b 100644 --- a/payment_headend/js/index.js +++ b/payment_headend/js/index.js @@ -68,6 +68,7 @@ function handleMultipleAddresses(walletAddresses) { openAddressModal(); } +let paymentInterval; function openPaymentModal(orderId, amount, orderCreateTimestamp, orderExpirationTime) { document.getElementById('paymentModal').style.display = 'flex'; @@ -89,18 +90,25 @@ function openPaymentModal(orderId, amount, orderCreateTimestamp, orderExpiration // 如果时间到了,停止更新 if (remainingTime <= 0) { - clearInterval(interval); + if (paymentInterval) { + clearInterval(paymentInterval); + paymentInterval = null; + } orderInfoElement.innerHTML = `

Order ${orderId} has expired, please place a new order.

`; } }; // 开始倒计时 - const interval = setInterval(updateRemainingTime, 1000); + paymentInterval = setInterval(updateRemainingTime, 1000); updateRemainingTime(); // 立即更新一次 } function closePaymentModal() { + if (paymentInterval) { + clearInterval(paymentInterval); + paymentInterval = null; + } document.getElementById('paymentModal').style.display = 'none'; } @@ -240,19 +248,35 @@ function finishOrder() { } function handleQuery() { + const name = document.getElementById('nickname').value.trim(); const phone = document.getElementById('phone').value.trim(); const email = document.getElementById('email').value.trim(); const walletAddress = document.getElementById('wallet').value.trim(); - const queryParams = { - name: name, - phone: phone, - email: email, - wallet_address: walletAddress, - }; - sessionStorage.setItem('queryParams', JSON.stringify(queryParams)); - window.location.href = '/orderDetails.html'; +// Check if any field is empty + if (!name) { + openAlertModal("Please enter your game nickname."); + document.getElementById('nickname').focus(); // Focus on the name field + } else if (!phone) { + openAlertModal("Please enter your phone number."); + document.getElementById('phone').focus(); // Focus on the phone field + } else if (!email) { + openAlertModal("Please enter your email."); + document.getElementById('email').focus(); // Focus on the email field + } else if (!walletAddress) { + openAlertModal("Please enter your wallet address."); + document.getElementById('wallet').focus(); // Focus on the wallet field + } else { + const queryParams = { + name: name, + phone: phone, + email: email, + wallet_address: walletAddress, + }; + sessionStorage.setItem('queryParams', JSON.stringify(queryParams)); + window.location.href = '/orderDetails.html'; + } }