字段全部必填

This commit is contained in:
wystan 2024-11-28 21:20:57 +08:00
parent e74856423f
commit fba1c4f672
2 changed files with 35 additions and 11 deletions

View File

@ -1,6 +1,6 @@
function showCustomAlert(message) { function showCustomAlert(message) {
const alertBox = document.getElementById('customAlert'); const alertBox = document.getElementById('customAlert');
alertBox.innerText = message; alertBox.innerHTML = message;
alertBox.style.display = 'block'; alertBox.style.display = 'block';
alertBox.style.opacity = '1'; alertBox.style.opacity = '1';

View File

@ -68,6 +68,7 @@ function handleMultipleAddresses(walletAddresses) {
openAddressModal(); openAddressModal();
} }
let paymentInterval;
function openPaymentModal(orderId, amount, orderCreateTimestamp, orderExpirationTime) { function openPaymentModal(orderId, amount, orderCreateTimestamp, orderExpirationTime) {
document.getElementById('paymentModal').style.display = 'flex'; document.getElementById('paymentModal').style.display = 'flex';
@ -89,18 +90,25 @@ function openPaymentModal(orderId, amount, orderCreateTimestamp, orderExpiration
// 如果时间到了,停止更新 // 如果时间到了,停止更新
if (remainingTime <= 0) { if (remainingTime <= 0) {
clearInterval(interval); if (paymentInterval) {
clearInterval(paymentInterval);
paymentInterval = null;
}
orderInfoElement.innerHTML = `<p style="color: red">Order ${orderId} has expired, please place a new order.</p>`; orderInfoElement.innerHTML = `<p style="color: red">Order ${orderId} has expired, please place a new order.</p>`;
} }
}; };
// 开始倒计时 // 开始倒计时
const interval = setInterval(updateRemainingTime, 1000); paymentInterval = setInterval(updateRemainingTime, 1000);
updateRemainingTime(); // 立即更新一次 updateRemainingTime(); // 立即更新一次
} }
function closePaymentModal() { function closePaymentModal() {
if (paymentInterval) {
clearInterval(paymentInterval);
paymentInterval = null;
}
document.getElementById('paymentModal').style.display = 'none'; document.getElementById('paymentModal').style.display = 'none';
} }
@ -240,19 +248,35 @@ function finishOrder() {
} }
function handleQuery() { function handleQuery() {
const name = document.getElementById('nickname').value.trim(); const name = document.getElementById('nickname').value.trim();
const phone = document.getElementById('phone').value.trim(); const phone = document.getElementById('phone').value.trim();
const email = document.getElementById('email').value.trim(); const email = document.getElementById('email').value.trim();
const walletAddress = document.getElementById('wallet').value.trim(); const walletAddress = document.getElementById('wallet').value.trim();
const queryParams = { // Check if any field is empty
name: name, if (!name) {
phone: phone, openAlertModal("Please enter your game nickname.");
email: email, document.getElementById('nickname').focus(); // Focus on the name field
wallet_address: walletAddress, } else if (!phone) {
}; openAlertModal("Please enter your phone number.");
sessionStorage.setItem('queryParams', JSON.stringify(queryParams)); document.getElementById('phone').focus(); // Focus on the phone field
window.location.href = '/orderDetails.html'; } 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';
}
} }