diff --git a/index.php b/index.php
index 85e7a4a..4809e97 100644
--- a/index.php
+++ b/index.php
@@ -507,6 +507,71 @@ $packages_json = json_encode(array_map(function($package) {
});
+
+
🕐 选择时间段
@@ -1806,6 +1871,7 @@ $packages_json = json_encode(array_map(function($package) {
const slotDiv = document.createElement('div');
slotDiv.className = `time-slot ${isPast ? 'past' : ''} ${isBooked ? 'booked' : 'available'}`;
slotDiv.textContent = timeString;
+ slotDiv.dataset.time = timeString; // 添加数据属性,与pending_bookings.php保持一致
slotDiv.onclick = () => selectTimeSlot(timeString);
timeGrid.appendChild(slotDiv);
@@ -1886,7 +1952,8 @@ $packages_json = json_encode(array_map(function($package) {
slot.classList.remove('selected');
});
- const slotElement = document.querySelector(`[onclick="selectTimeSlot('${time}')"]`);
+ // 使用data-time属性查找元素,与pending_bookings.php保持一致
+ const slotElement = document.querySelector(`[data-time="${time}"]`);
if (slotElement) {
slotElement.classList.add('selected');
}