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