From f297a12a7ab93861c62362b64e9485be091d43a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=B1=95=E9=B9=8F?= Date: Sat, 6 Dec 2025 01:17:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DselectDuration=E5=87=BD?= =?UTF-8?q?=E6=95=B0=EF=BC=8C=E7=A1=AE=E4=BF=9D=E5=A5=97=E9=A4=90=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=9C=8D=E5=8A=A1=E6=97=B6=E9=97=B4=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pending_bookings.php | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/pending_bookings.php b/pending_bookings.php index d7ce715..687ec8f 100644 --- a/pending_bookings.php +++ b/pending_bookings.php @@ -850,19 +850,18 @@ try { customDurationInput.value = minutes; } - // 更新按钮选中状态 - document.querySelectorAll(`[onclick="selectDuration(${submissionId}, ${minutes})"]`).forEach(btn => { - btn.classList.add('selected'); - }); + // 获取当前表单的所有时长按钮 + const form = document.getElementById('selected_package_' + submissionId).closest('form'); + const durationButtons = form.querySelectorAll('.duration-btn'); - // 移除其他按钮的选中状态 - document.querySelectorAll(`#selected_package_${submissionId}`).forEach(packageSelect => { - const formGroup = packageSelect.closest('form').querySelector('.form-group'); - formGroup.querySelectorAll('.duration-btn').forEach(btn => { - if (!btn.onclick || !btn.onclick.toString().includes(`selectDuration(${submissionId}, ${minutes})`)) { - btn.classList.remove('selected'); - } - }); + // 更新按钮选中状态 + durationButtons.forEach(btn => { + // 检查按钮的onclick属性是否包含当前的分钟数 + if (btn.onclick && btn.onclick.toString().includes(`selectDuration(${submissionId}, ${minutes})`)) { + btn.classList.add('selected'); + } else { + btn.classList.remove('selected'); + } }); }