Jelajahi Sumber

feat: 预约时间粒度改为10分钟一档

skyline 3 minggu lalu
induk
melakukan
fe29e10558

+ 4 - 4
charge-front/src/pages-charge/appointment/appointment.vue

@@ -437,8 +437,8 @@ const getHourPrice = (hour: string) => {
   return price;
 };
 
-/* ============ 时间选择(自主选择,24小时内,30分钟粒度) ============ */
-const STEP = 30 * 60 * 1000; // 30分钟粒度
+/* ============ 时间选择(自主选择,24小时内,10分钟粒度) ============ */
+const STEP = 10 * 60 * 1000; // 10分钟粒度
 const WINDOW = 24 * 60 * 60 * 1000; // 只能选择从此时开始24小时内
 
 const timesInfo = ref<any>({
@@ -500,9 +500,9 @@ const buildTimeOptions = () => {
     const dayLast = Math.min(last, dayEnd - 1);
     const options: any[] = [];
     for (let ts = dayFirst; ts <= dayLast; ts += STEP) {
-      // 对齐到半点(dayFirst 来自 first 已对齐,跨天起点为 00:00 天然对齐)
+      // 对齐到10分钟档(dayFirst 来自 first 已对齐,跨天起点为 00:00 天然对齐)
       const d = new Date(ts);
-      if (d.getMinutes() !== 0 && d.getMinutes() !== 30) {
+      if (d.getMinutes() % 10 !== 0) {
         continue;
       }
       options.push(buildOption(ts, now));