''
liukangdong
2024-07-04 5a85dcab83e969d6b21c599b512a15117e9b8651
admin/src/components/operation/OperCarUseBookParamWindow.vue
@@ -17,7 +17,7 @@
          >
        </el-form-item>
        <el-form-item label="选择车辆" prop="carId">
          <el-select v-model="form.carId" placeholder="选择车辆">
          <el-select v-model="form.carId" @change="clearTime" placeholder="选择车辆">
            <el-option
              v-for="item in carsList"
              :key="item.id"
@@ -133,6 +133,7 @@
                :class="{
                  disable: item.isUse == 1,
                  active: item.checked == '1',
                  hasSub: item.carUseBookId,
                }"
                @click="datetimeClick(item, i)"
                v-for="(item, i) in timeList"
@@ -161,6 +162,7 @@
      :visible.sync="isShowShiwai"
      append-to-body
      width="600px"
      :before-close="clearTime"
    >
      <el-form :model="form" ref="modalRef" class="el_form" :rules="rules">
        <el-form-item label="用车开始时间" prop="startTime">
@@ -189,7 +191,10 @@
      <div class="have_info" v-if="info && info.length > 0">
        <div class="tit">您申请的用车时段已有车辆预约</div>
        <div class="content" v-for="(item, i) in info" :key="i">
          <div class="card">{{ item.carCode }}</div>
          <div class="df_sb">
            <span class="card" v-if="item.carCode">{{ item.carCode }}</span>
            <span>{{ i + 1 }}/{{ info.length }}</span>
          </div>
          <div class="line">
            <span>用车时段</span>
            <span>
@@ -212,15 +217,47 @@
          </div>
          <div class="line">
            <span>申请人</span>
            <span>{{ item.memberName }} {{ item.memberMobile }}</span>
            <span>{{ item.memberName }} <span class="primaryColor">{{ item.memberMobile }}</span></span>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <div>已选择:{{ selDatetime }}</div>
        <div class="btn" @click="subTime">确认时间</div>
        <div class="btn" :class="{disable: info && info.length > 0}" @click="subTime">确认时间</div>
      </span>
    </el-dialog>
    <!-- 详情 -->
     <el-dialog
      title="选择用车时间"
      :visible.sync="isShowDetail"
      append-to-body
      width="600px"
    >
      <div class="detail_modal">
        <div class="title">车辆预约情况</div>
        <div class="h1" v-if="activeInfo.carCode">{{ activeInfo.carCode }}</div>
        <div class="line">
          <div class="label">预计用车时段</div>
          <div class="value" v-if="activeInfo.startTime">{{ activeInfo.startTime.slice(5, 16) }} - {{ activeInfo.endTime.slice(5, 16) }}</div>
        </div>
        <div class="line">
          <div class="label">目的地</div>
          <div class="value">{{ activeInfo.addr }}</div>
        </div>
        <div class="line">
          <div class="label">乘车人数</div>
          <div class="value" v-if="activeInfo.memberIds">{{ activeInfo.memberIds.split(',').length }}人</div>
        </div>
        <div class="line">
          <div class="label">用车事由</div>
          <div class="value">{{ activeInfo.content || '' }}</div>
        </div>
        <div class="line">
          <div class="label">申请人</div>
          <div class="value">{{ activeInfo.memberName }} <span class="primaryColor ml12">{{ activeInfo.memberPhone }}</span></div>
        </div>
      </div>
    </el-dialog>
  </GlobalWindow>
</template>
@@ -230,9 +267,10 @@
import GlobalWindow from '@/components/common/GlobalWindow'
import { allList } from '@/api/business/member'
import { allList as getCarList } from '@/api/business/cars'
import { carCanReservationDate, carUseBookCraete, carUseBookList } from '@/api/business/carUseBook'
import { carCanReservationDate, carUseBookCraete, carUseBookList, detail } from '@/api/business/carUseBook'
import { findTypeMemberInfo } from '@/api/business/memberCard'
import dayjs from 'dayjs'
export default {
  name: 'OperCarUseBookParamWindow',
  extends: BaseOpera,
@@ -260,6 +298,9 @@
        endTime: '',
        memberIds: []
      },
      activeInfo: {},
      isShowDetail: false,
      carBookInfo: {},
      pickerOptions: {
        disabledDate: (time) => {
          if (this.form.startTime) {
@@ -371,12 +412,26 @@
        return this.$tip.error('请先选择车辆')
      }
      if (this.form.type === 0) {
        this.$set(this.form, 'dateDay', '')
        this.timeList = []
        this.isShowTime = true
      } else {
        this.clearTime()
        this.isShowShiwai = true
      }
    },
    clearTime () {
      this.isShowShiwai = false
      this.$set(this.form, 'startTime', '')
      this.$set(this.form, 'endTime', '')
      this.$nextTick(() => {
        if (this.$refs.modalRef) {
          this.$refs.modalRef.clearValidate()
        }
      })
    },
    subTime() {
      if (this.info && this.info.length > 0) return
      if (this.form.type === 0) {
        const selTimeList = this.timeList.filter(i => i.checked == '1')
        if (selTimeList.length === 0) {
@@ -389,11 +444,24 @@
        this.$forceUpdate()
      } else {
        this.$refs.modalRef.validate((valid) => {
          const { form } = this
          if (new Date(form.startTime).getTime() > new Date(form.endTime).getTime()) {
            return this.$tip.error('结束时间应大于开始时间')
          }
          this.isShowShiwai = false
        })
      }
    },
    datetimeClick(item, index) {
      if (item.carUseBookId) {
        detail(
          item.carUseBookId
        ).then(res => {
          this.activeInfo = res
          this.isShowDetail = true
        })
        return
      }
      if (item.isUse == '1') return
      const { timeList } = this
      const selTimeList = timeList.filter(i => i.checked == '1')
@@ -539,6 +607,10 @@
    background-color: #cccccc;
    color: #999999;
  }
  .hasSub {
      color: #fff;
      background: #cccccc;
    }
}
.color_op {
  display: flex;
@@ -564,6 +636,10 @@
    color: #fff;
    width: 120px;
    text-align: center;
    cursor: pointer;
  }
  .disable{
    background: #cccccc;
  }
}
.have_info {
@@ -600,4 +676,29 @@
    }
  }
}
.detail_modal {
  padding: 20px 15px;
  .title {
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 20px;
  }
  .h1 {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 16px;
  }
  .line {
    display: flex;
    margin-bottom: 10px;
    .label {
      width: 120px;
      color: #888888;
    }
    .value {
      color: #333333;
    }
  }
}
</style>