Kaynağa Gözat

fix: 移除时间智能推荐,改为用户完全自主选择

删除快捷推荐chips与默认预选;弹层顶部提示仅可选24小时内;保留已预约修改时回显当前预约时间;网格分组/电价展示/确认条与动效不变
skyline 3 hafta önce
ebeveyn
işleme
e276ceee91

+ 8 - 87
charge-front/src/pages-charge/appointment/appointment.vue

@@ -270,23 +270,7 @@
       "
     >
       <view class="time-picker">
-        <!-- 智能推荐快捷项 -->
-        <view class="tp-quick">
-          <view class="fs-24 color-999 mb-16">智能推荐(24小时内)</view>
-          <scroll-view scroll-x class="tp-quick_scroll">
-            <view class="tp-quick_list">
-              <view
-                  v-for="(q, i) in quickOptions"
-                  :key="i"
-                  class="tp-chip pressable"
-                  hover-class="pressed"
-                  hover-stay-time="80"
-                  :class="{ 'tp-chip_active': selectedTs === q.ts }"
-                  @click="pickOption(q)"
-              >{{ q.label }}</view>
-            </view>
-          </scroll-view>
-        </view>
+        <view class="fs-22 color-999 tp-tip">仅可选择从现在起24小时内的时间</view>
         <!-- 时段网格(30分钟粒度) -->
         <scroll-view scroll-y class="tp-grid_scroll">
           <block v-for="(group, gi) in timeGroups" :key="gi">
@@ -451,10 +435,9 @@ const getHourPrice = (hour: string) => {
   return price;
 };
 
-/* ============ 时间选择(智能推荐 + 24小时内,30分钟粒度) ============ */
+/* ============ 时间选择(自主选择,24小时内,30分钟粒度) ============ */
 const STEP = 30 * 60 * 1000; // 30分钟粒度
 const WINDOW = 24 * 60 * 60 * 1000; // 只能选择从此时开始24小时内
-const QUICK_OFFSETS = [30 * 60 * 1000, 60 * 60 * 1000, 2 * 60 * 60 * 1000]; // 尽快/1小时/2小时
 
 const timesInfo = ref<any>({
   groups: [] as any[],
@@ -464,9 +447,6 @@ const selectedTs = ref(0);
 
 const pad2 = (n: number) => (n < 10 ? `0${n}` : `${n}`);
 
-/** 把时间对齐到下一个5分钟(智能推荐用) */
-const ceil5 = (ts: number) => Math.ceil(ts / (5 * 60 * 1000)) * 5 * 60 * 1000;
-
 const buildOption = (ts: number, now: number): any => {
   const d = new Date(ts);
   const hourStr = `${pad2(d.getHours())}:${pad2(d.getMinutes())}`;
@@ -523,32 +503,7 @@ const buildTimeOptions = () => {
   timesInfo.value = { groups, flat };
 };
 
-/** 智能推荐:尽快开始 / 1小时后 / 2小时后 / 00:00 低谷(5分钟粒度,独立于网格) */
-const quickOptions = computed(() => {
-  const res: any[] = [];
-  const now = Date.now();
-  const labels = ["尽快", "1小时后", "2小时后"];
-  QUICK_OFFSETS.forEach((offset, i) => {
-    const ts = ceil5(now + offset);
-    if (ts <= now + WINDOW) {
-      const opt = buildOption(ts, now);
-      res.push({ ...opt, label: `${labels[i]} ${opt.timeLabel}` });
-    }
-  });
-  // 下一低谷 00:00
-  const tomorrowZero = new Date().setHours(24, 0, 0, 0);
-  if (tomorrowZero <= now + WINDOW) {
-    const opt = buildOption(tomorrowZero, now);
-    res.push({ ...opt, label: "00:00 低谷充电" });
-  }
-  return res;
-});
-
-const selected = computed(
-    () =>
-        timesInfo.value.flat[selectedTs.value] ||
-        quickOptions.value.find((q: any) => q.ts === selectedTs.value)
-);
+const selected = computed(() => timesInfo.value.flat[selectedTs.value]);
 
 const pickOption = (opt: any) => {
   if (opt.disabled) {
@@ -577,17 +532,15 @@ const selectTime = () => {
     return;
   }
   buildTimeOptions();
-  // 智能默认:已预约则定位当前预约时间,否则默认选中"尽快开始"
+  // 已预约修改时间时回显当前预约时间;新预约由用户自主选择,不预选
   if (appointmentData.value) {
     const start = new Date(
         appointmentData.value.startTime.replace(/-/g, "/")
     ).getTime();
     const aligned = Math.ceil(start / STEP) * STEP;
-    selectedTs.value = timesInfo.value.flat[aligned]
-        ? aligned
-        : quickOptions.value[0]?.ts || 0;
+    selectedTs.value = timesInfo.value.flat[aligned] ? aligned : 0;
   } else {
-    selectedTs.value = quickOptions.value[0]?.ts || 0;
+    selectedTs.value = 0;
   }
   chargeTimeDialog.value = true;
 };
@@ -1037,40 +990,8 @@ onShow(() => {
   background-color: #fff;
 }
 
-.tp-quick {
-  padding: 24rpx 30rpx 8rpx;
-  border-bottom: 1rpx solid var(--divider);
-}
-
-.tp-quick_scroll {
-  white-space: nowrap;
-  width: 100%;
-}
-
-.tp-quick_list {
-  display: inline-flex;
-  padding-bottom: 16rpx;
-}
-
-.tp-chip {
-  display: inline-flex;
-  align-items: center;
-  justify-content: center;
-  height: 64rpx;
-  padding: 0 28rpx;
-  margin-right: 16rpx;
-  background: var(--color-sec);
-  border-radius: 32rpx;
-  font-size: 26rpx;
-  color: #5c6b69;
-  transition: background-color 0.15s cubic-bezier(0.22, 1, 0.36, 1),
-    color 0.15s cubic-bezier(0.22, 1, 0.36, 1);
-}
-
-.tp-chip_active {
-  background: var(--color-primary);
-  color: #fff;
-  font-weight: 500;
+.tp-tip {
+  padding: 20rpx 30rpx 0;
 }
 
 .tp-grid_scroll {