jiangping
2024-05-31 6be28040e74e1ff7764478174a9b5d706fe4fc39
h5/pages/staff/vehicle/apply.vue
@@ -8,7 +8,17 @@
               <text>预计用车时段</text>
            </view>
            <view class="value" @click="$goBack()">
               <text class="mr6" :style="{ color: param.area ? '#000000' : '#999999' }">{{ param.area ? param.area : '请选择' }}</text>
          <text
            class="mr6"
            :style="{ color: param.startTime ? '#000000' : '#999999' }"
          >
            <text v-if="param.startTime">
              {{ param.startTime.slice(5, 16) }}至{{
                param.endTime.slice(11, 16)
              }}
            </text>
            <text v-else>请选择</text>
          </text>
               <u-icon name="arrow-right" color="#CCCCCC" size="20"></u-icon>
            </view>
         </view>
@@ -17,8 +27,14 @@
                  <text>*</text>
                  <text>申请车辆</text>
               </view>
               <view class="value">
                  <input type="text" placeholder="请输入申请车辆" v-model="param.receptMemberName" placeholder-style="color: #999999;" />
        <view class="value" @click="$goBack()">
          <input
            type="text"
            disabled
            placeholder="请输入申请车辆"
            v-model="param.carCode"
            placeholder-style="color: #999999;"
          />
               </view>
         </view>
         <view class="line">
@@ -27,7 +43,11 @@
               <text>预计出发时间</text>
            </view>
            <view class="value" @click="isShowDatetime = true">
               <text class="mr6" :style="{ color: param.area ? '#000000' : '#999999' }">{{ param.area ? param.area : '请选择' }}</text>
          <text
            class="mr6"
            :style="{ color: param.planUseDate ? '#000000' : '#999999' }"
            >{{ param.planUseDate ? param.planUseDate : "请选择" }}</text
          >
               <u-icon name="arrow-right" color="#CCCCCC" size="20"></u-icon>
            </view>
         </view>
@@ -38,7 +58,7 @@
                  <text>目的地类别</text>
               </view>
               <view class="value">
                  <text>{{ 111 }}</text>
          <text>{{ param.type == "1" ? "市外" : "市内" }}</text>
               </view>
         </view>
         <view class="line">
@@ -47,7 +67,12 @@
                  <text>目的地</text>
               </view>
               <view class="value">
                  <input type="text" placeholder="请输入" v-model="param.address" placeholder-style="color: #999999;" />
          <input
            type="text"
            placeholder="请输入"
            v-model="param.addr"
            placeholder-style="color: #999999;"
          />
               </view>
         </view>
         <view class="line">
@@ -55,55 +80,130 @@
                  <text>*</text>
                  <text>乘车人员</text>
               </view>
               <view class="value"  @click="$jump('/pages/staff/memberSel')">
                  <text class="mr6" :style="{ color: param.peo ? '#000000' : '#999999' }">{{ param.peo ? param.peo : '请选择' }}</text>
        <view class="value" @click="$jump('/pages/staff/vehicle/applePeo')">
          <text
            class="mr6"
            :style="{
              color:
                param.memberList && param.memberList.length > 0
                  ? '#000000'
                  : '#999999',
            }"
          >
            <text v-if="param.memberNames">
              {{ param.memberNames }}
            </text>
            <text v-else>请选择</text>
          </text>
                  <u-icon name="arrow-right" color="#CCCCCC" size="20"></u-icon>
               </view>
         </view>
         <view class="upload_line">
               <view class="label">
                  <text style="color: #e42d2d;">*</text>
          <text style="color: #e42d2d">*</text>
                  <text>用车事由</text>
               </view>
               <view class="value">
                  <textarea type="text" placeholder="请输入" :maxlength="-1" v-model="param.reson" placeholder-style="color: #999999;" />
          <textarea
            type="text"
            placeholder="请输入"
            :maxlength="-1"
            v-model="param.content"
            placeholder-style="color: #999999;"
          />
               </view>
         </view>
      </view>
      <view class="tip">
         <view class="title">注意事项:</view>
         <view class="line">1、公司车辆外出需办理用车申请表,经批准后方可外出(借出)。</view>
      <view class="line"
        >1、公司车辆外出需办理用车申请表,经批准后方可外出(借出)。</view
      >
         <view class="line">2、市外用车需总经办审批。</view>
         <view class="line">3、借出车辆必须遵守交通规则,安全行驶。对于车辆发生交通意外,对当事人及第三方造成人身伤害及损失,公司可以协助处理保险公司赔偿相关事宜,但不承担任何责任和费用。</view>
         <view class="line">4、公司借给申请人用车,申请借车人为第一责任人,不允许转借给其他人使用,若要借给他人使用。责任人要承担全部责任。</view>
      <view class="line"
        >3、借出车辆必须遵守交通规则,安全行驶。对于车辆发生交通意外,对当事人及第三方造成人身伤害及损失,公司可以协助处理保险公司赔偿相关事宜,但不承担任何责任和费用。</view
      >
      <view class="line"
        >4、公司借给申请人用车,申请借车人为第一责任人,不允许转借给其他人使用,若要借给他人使用。责任人要承担全部责任。</view
      >
      </view>
      <view class="sub_btn" @click="handleSub">提交</view>
      <!--  -->
      <u-datetime-picker :show="isShowDatetime" :minDate="minDate" @confirm="confirmDate" @cancel="isShowDatetime = false" mode="date"></u-datetime-picker>
    <u-datetime-picker
      :show="isShowDatetime"
      :minDate="new Date(param.startTime).getTime()"
      :maxDate="new Date(param.endTime).getTime()"
      @confirm="confirmDate"
      @cancel="isShowDatetime = false"
      mode="datetime"
    ></u-datetime-picker>
   </view>
</template>
<script>
   import dayjs from 'dayjs'
import { carUseBookCraete } from '@/api'
   export default {
      data() {
         return {
            param: {},
            minDate: '',
            isShowDatetime: false,
         };
    }
      },
      created(){
  mounted() {
    this.$eventBus.$on('applePeo', (res) => {
      this.$set(this.param, 'memberList', res)
      this.$set(this.param, 'memberIds', res.map(i => i.id).join(','))
      this.$set(this.param, 'memberNames', res.map(i => i.name).join(','))
    })
  },
  onLoad(option) {
    console.log(option)
    this.param = { ...option }
         this.minDate = new Date().getTime()
      },
      methods: {
         handleSub() {
            console.log('---');
      const { param } = this
      console.log('---', param)
      if (!param.planUseDate) return uni.showToast({
        title: '请选择预计用车时间',
        icon: 'none'
      })
      if (!param.addr) return uni.showToast({
        title: '请输入目的地',
        icon: 'none'
      })
      if (!param.memberList || param.memberList.length === 0) return uni.showToast({
        title: '请选择乘车人员',
        icon: 'none'
      })
      if (!param.content) return uni.showToast({
        title: '请输入用车事由',
        icon: 'none'
      })
      carUseBookCraete({
        ...param,
      }).then(res => {
        if (res.code === 200) {
          setTimeout(() => {
            uni.showToast({
              title: '提交成功',
              icon: 'success'
            })
          })
          uni.redirectTo({
            url: '/pages/staff/index'
          })
        }
      })
         },
         confirmDate(e) {
            console.log(e.value);
            this.param.aa = dayjs(e.value).format('YYYY-MM-DD')
            this.isShowDate = false
      this.param.planUseDate = dayjs(e.value).format('YYYY-MM-DD HH:mm')
      this.isShowDatetime = false
         }
      }
   }
@@ -130,7 +230,7 @@
      .value {
         flex: 1;
         height: 100%;
         margin-left: 30rpx;
      margin-left: 0rpx;
         display: flex;
         align-items: center;
         justify-content: flex-end;
@@ -158,7 +258,7 @@
         margin-top: 24rpx;
         width: 120rpx;
         height: 120rpx;
         border: 2rpx solid #E5E5E5;
      border: 2rpx solid #e5e5e5;
         background: #f7f7f7;
         color: #666666;
         font-size: 22rpx;
@@ -181,14 +281,14 @@
   height: 88rpx;
   line-height: 88rpx;
   text-align: center;
   background: #279BAA;
   box-shadow: 0rpx -1rpx 0rpx 0rpx #EEEEEE;
  background: #279baa;
  box-shadow: 0rpx -1rpx 0rpx 0rpx #eeeeee;
   border-radius: 44rpx;
   font-size: 30rpx;
   color: #FFFFFF;
  color: #ffffff;
}
.tip{
      background: #F7F7F7;
  background: #f7f7f7;
      padding: 30rpx 30rpx 180rpx;
      margin: 0 -30rpx;
      .title{