From 466f16e313ddf98ae7bf29d962159a48e52d9abb 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:14:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A5=97=E9=A4=90=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E9=BB=98=E8=AE=A4=E6=97=B6=E9=97=B4=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=B9=B6=E6=B7=BB=E5=8A=A0=E5=BF=AB=E6=8D=B7=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=97=B6=E9=95=BF=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pending_bookings.php | 68 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/pending_bookings.php b/pending_bookings.php index f7d19ff..d7ce715 100644 --- a/pending_bookings.php +++ b/pending_bookings.php @@ -614,7 +614,19 @@ try {
- +
+ + + + + + + + + + +
+
@@ -816,11 +828,65 @@ try { durationInput.value = duration; totalPriceInput.value = price.toFixed(2); + // 更新快捷选择按钮状态 + selectDuration(submissionId, duration); + packageInfoDiv.style.display = 'block'; } else { packageInfoDiv.style.display = 'none'; } } + + // 快捷选择服务时长 + function selectDuration(submissionId, minutes) { + const durationInput = document.getElementById('duration_' + submissionId); + const customDurationInput = document.getElementById('customDuration_' + submissionId); + + // 更新时长输入框 + durationInput.value = minutes; + + // 更新自定义时长输入框 + if (customDurationInput) { + customDurationInput.value = minutes; + } + + // 更新按钮选中状态 + document.querySelectorAll(`[onclick="selectDuration(${submissionId}, ${minutes})"]`).forEach(btn => { + btn.classList.add('selected'); + }); + + // 移除其他按钮的选中状态 + 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'); + } + }); + }); + } + + // 应用自定义时长 + function applyCustomDuration(submissionId) { + const customDurationInput = document.getElementById('customDuration_' + submissionId); + const customDuration = parseInt(customDurationInput.value); + const maxDuration = 720; // 最大时长为12小时(720分钟) + + if (customDuration < 30) { + alert('最小服务时长为30分钟'); + customDurationInput.value = 30; + selectDuration(submissionId, 30); + } else if (customDuration > maxDuration) { + alert('最大服务时长为12小时(720分钟)'); + customDurationInput.value = maxDuration; + selectDuration(submissionId, maxDuration); + } else { + // 确保时长是30的倍数 + const roundedDuration = Math.round(customDuration / 30) * 30; + customDurationInput.value = roundedDuration; + selectDuration(submissionId, roundedDuration); + } + } \ No newline at end of file