From 0719588d8dec75b7d924063d7d60943a33b6918d Mon Sep 17 00:00:00 2001 From: wystan Date: Thu, 28 Nov 2024 21:41:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=85=A8=E9=83=A8=E5=BF=85?= =?UTF-8?q?=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- payment_headend/js/index.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/payment_headend/js/index.js b/payment_headend/js/index.js index 399cb2b..9fda4ac 100644 --- a/payment_headend/js/index.js +++ b/payment_headend/js/index.js @@ -38,7 +38,7 @@ document.addEventListener('DOMContentLoaded', () => { // Close modal when clicking outside the modal content document.getElementById('addressModal').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; + function openPaymentModal(orderId, amount, orderCreateTimestamp, orderExpirationTime) { document.getElementById('paymentModal').style.display = 'flex'; @@ -196,12 +197,27 @@ async function createOrder(amount, name, phone, email, wallet_address, paymentMe // 绑定表单提交事件 function handleSubmit() { const amount = document.getElementById('amount').value.trim(); + const name = document.getElementById('nickname').value.trim(); const phone = document.getElementById('phone').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() { @@ -254,7 +270,7 @@ function handleQuery() { const email = document.getElementById('email').value.trim(); const walletAddress = document.getElementById('wallet').value.trim(); -// Check if any field is empty + // Check if any field is empty if (!name) { openAlertModal("Please enter your game nickname."); document.getElementById('nickname').focus(); // Focus on the name field