字段全部必填

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) {
const alertBox = document.getElementById('customAlert');
alertBox.innerText = message;
alertBox.innerHTML = message;
alertBox.style.display = 'block';
alertBox.style.opacity = '1';

View File

@ -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 = `<p style="color: red">Order ${orderId} has expired, please place a new order.</p>`;
}
};
// 开始倒计时
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,11 +248,26 @@ 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();
// 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,
@ -254,6 +277,7 @@ function handleQuery() {
sessionStorage.setItem('queryParams', JSON.stringify(queryParams));
window.location.href = '/orderDetails.html';
}
}
function handleError(message) {