字段全部必填

This commit is contained in:
wystan 2024-11-28 21:41:21 +08:00
parent fba1c4f672
commit 0719588d8d
1 changed files with 20 additions and 4 deletions

View File

@ -38,7 +38,7 @@ document.addEventListener('DOMContentLoaded', () => {
// Close modal when clicking outside the modal content // Close modal when clicking outside the modal content
document.getElementById('addressModal').addEventListener('click', closeModalOnClickOutside); document.getElementById('addressModal').addEventListener('click', closeModalOnClickOutside);
document.getElementById('paymentModal').addEventListener('click', closeModalOnClickOutside); document.getElementById('paymentModal').addEventListener('click', closeModalOnClickOutside);
document.getElementById('alertModal').addEventListener('click', closeModalOnClickOutside); // document.getElementById('alertModal').addEventListener('click', closeModalOnClickOutside);
}); });
@ -69,6 +69,7 @@ function handleMultipleAddresses(walletAddresses) {
} }
let paymentInterval; 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';
@ -196,12 +197,27 @@ async function createOrder(amount, name, phone, email, wallet_address, paymentMe
// 绑定表单提交事件 // 绑定表单提交事件
function handleSubmit() { function handleSubmit() {
const amount = document.getElementById('amount').value.trim(); const amount = document.getElementById('amount').value.trim();
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 payment_address = document.getElementById('wallet').value.trim(); const walletAddress = document.getElementById('wallet').value.trim();
createOrder(amount, name, phone, email, payment_address, "USDT"); 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 {
createOrder(amount, name, phone, email, walletAddress, "USDT");
}
} }
function finishOrder() { function finishOrder() {
@ -254,7 +270,7 @@ function handleQuery() {
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();
// Check if any field is empty // Check if any field is empty
if (!name) { if (!name) {
openAlertModal("Please enter your game nickname."); openAlertModal("Please enter your game nickname.");
document.getElementById('nickname').focus(); // Focus on the name field document.getElementById('nickname').focus(); // Focus on the name field