ll
liukangdong
2025-03-10 2bc4a739db642494accbf5be1fa55793f4652f44
h5/pages/staff/vehicle/shiwai.vue
@@ -21,7 +21,7 @@
          <text>*</text>
          <text>预计用车时段</text>
        </view>
        <view class="value" @click="isShowDate = true">
        <view class="value" @click="showDate">
          <text
            class="mr6"
            :style="{ color: param.startTime ? '#000000' : '#999999' }"
@@ -42,7 +42,7 @@
        <view class="line">
          <text>用车时段</text>
          <text>
            {{ item.startTime.slice(5, 16) }}至{{
            {{ item.startTime.slice(5, 16) }} 至 {{
              item.endTime.slice(5, 16)
            }}</text
          >
@@ -66,11 +66,14 @@
      </view>
    </view>
    <view class="main_footer">
      <text>已选择:</text>
      <text class="sel" v-if="param.startTime"
        >{{ param.startHours }}至{{ param.endHours }}</text
      >
      <text class="btn" :class="{disable: info && info.length > 0}" @click="onSubmit">确认预约</text>
      <view class="df_sb">
            <text>已选择:</text>
            <text class="sel" v-if="param.startTime"
              >{{ param.startHours }}至{{ param.endHours }}</text
            >
            <text class="btn" :class="{disable: info && info.length > 0}" @click="onSubmit">确认预约</text>
         </view>
         <view class="red">{{placeStr}}</view>
    </view>
    <!--  -->
    <!-- 选择车辆 -->
@@ -83,7 +86,7 @@
      @confirm="seletedCar"
      @cancel="isShowCar = false"
    ></u-picker>
    <u-datetime-picker
   <!-- <u-datetime-picker
      mode="datetime"
      :show="isShowDate"
      :filter="timeFilter"
@@ -93,12 +96,24 @@
      :closeOnClickOverlay="true"
      @confirm="seletedDate"
      @cancel="isShowDate = false"
    />
    /> -->
      <u-datetime-picker
         mode="datetime"
         :show="isShowDate"
         ref="startPick"
         title="开始时间"
          :formatter="formatter"
         :minDate="minDate"
         @close="isShowDate = false"
         :closeOnClickOverlay="true"
         @confirm="seletedDate"
         @cancel="isShowDate = false"
       />
    <u-datetime-picker
      mode="datetime"
      :show="isShowEndDate"
      :filter="timeFilter"
      title="结束时间"
         :formatter="formatter"
      :minDate="new Date(param.startTime || null).getTime()"
      @close="endtimeClose"
      :closeOnClickOverlay="true"
@@ -121,14 +136,41 @@
      carsList: [],
      info: [],
      minDate: ''
      minDate: '',
         placeStr: ''
    }
  },
  onLoad() {
    this.minDate = new Date(dayjs().format('YYYY-MM-DD HH:') + '00:00').getTime()
    // this.minDate = new Date(dayjs().format('YYYY-MM-DD HH:mm') + ':00').getTime()
    this.minDate = new Date().getTime() - (6 * 24 * 60 * 60 * 1000)
    this.initData()
      uni.setStorageSync('vehicleAppForm', {})
  },
  methods: {
      formatter(type, value) {
         if (type === 'year') {
            return `${value}年`
         }
         if (type === 'month') {
            return `${value}月`
         }
         if (type === 'day') {
            return `${value}日`
         }
         if (type === 'hour') {
            return `${value}时`
         }
         if (type === 'minute') {
            return `${value}分`
         }
         return value
      },
      showDate() {
         this.isShowDate = true
         if (!this.param.startTime) {
            this.$refs.startPick.innerValue = new Date().getTime()
         }
      },
    onSubmit() {
      const { param, info } = this
      if (info.length > 0) return
@@ -188,6 +230,12 @@
      if (this.param.carId && this.param.startTime) {
        this.getInfo()
      }
         console.log(e);
         if(new Date(this.param.startTime).getTime() < new Date().getTime() - 60 * 1000){
            this.placeStr = '当前选择包含已经过去时间,请确认后再提交;'
         }else{
            this.placeStr = ''
         }
      this.$forceUpdate()
    },
    endtimeClose() {
@@ -203,7 +251,7 @@
    },
    initData() {
      getCarsList({
        type: 1
        type: 0
      }).then(res => {
        this.carsList = [res.data]
      })
@@ -316,11 +364,14 @@
  left: 0;
  background-color: #fff;
  bottom: 0;
  padding: 20rpx 30rpx 84rpx;
  padding: 20rpx 30rpx 62rpx;
  box-shadow: 0rpx -3rpx 6rpx 0rpx #eeeeee;
  display: flex;
  align-items: center;
  justify-content: space-between;
   .df_sb{
      display: flex;
      align-items: center;
      justify-content: space-between;
   }
  .btn {
    width: 184rpx;
    height: 72rpx;