yangan
2024-05-27 cdb09e07c477931c8d7f7139945e66fd5fc01cce
pages/driver-page/drvier-my/drvier-my.vue
@@ -1,7 +1,7 @@
<template>
   <view class="driver-my">
      <view class=""
         style="height: 446rpx;width: 100%;">
         style="height: 586rpx;width: 100%;">
         <view class="driver-banner">
            <view class="navgation">我的</view>
            <view class="avatar">
@@ -26,7 +26,10 @@
            size="32"></u--text>
      </view>
      <view class="car-type">
         <text>{{userInfo.countryNumberCar===1?'国五车辆':'国六车辆'}}</text>
         <view ><u-button type="primary"
               @click="editDocClick"
               shape="circle"
               plain>编辑证件信息</u-button></view>
      </view>
      <view class="information-block">
         <view class="personal-information">
@@ -40,7 +43,7 @@
                        <view class="label-text">身份证号</view>
                     </view>
                     <view class="information-value">
                        {{ userInfo.idCard || '' }}
                        {{ idCard || '' }}
                     </view>
                  </view>
                  <view class="information-line">
@@ -247,14 +250,14 @@
                        border="none"
                        inputAlign="left"></u--input>
                  </u-form-item> -->
                  <u-form-item labelWidth="20%"
                  <!-- <u-form-item labelWidth="20%"
                     label="身份证号"
                     prop="idCard"
                     required>
                     <u--input v-model="editUserInfo.idCard"
                        border="none"
                        inputAlign="left"></u--input>
                  </u-form-item>
                  </u-form-item> -->
                  <u-form-item labelWidth="20%"
                     label="手机号"
                     prop="phone"
@@ -291,7 +294,7 @@
                  <u-form-item labelWidth="20%"
                     label="车辆类型"
                     borderBottom
                     required=""
                     required
                     prop="countryNumberCar">
                     <u-radio-group v-model="editUserInfo.countryNumberCar"
                        placement="row"
@@ -398,6 +401,144 @@
            </view>
         </u-popup>
      </view>
      <view class="editDriverPopup-container">
         <u-popup :show="editDocShow"
            mode="bottom"
            @close="editDocClose"
            @open="editDocOpen"
            :closeable="true">
            <combined-title title="修改证件信息"
               style="margin-left:20rpx"></combined-title>
            <view class="editDriverPopup-container-box">
               <u--form labelPosition="left"
                  :model="registerFormModel"
                  ref="editRef">
                  <u-form-item prop="cardImg1"
                     label="身份证正面"
                     labelWidth="20%"
                     borderBottom
                     required
                     @click="beforeRead">
                     <u-upload :fileList="fileList6"
                        deletable
                        @afterRead="afterRead"
                        @delete="deletePic"
                        name="6"
                        multiple
                        :maxCount="1"
                        width="250"
                        height="150"
                        :previewFullImage="true">
                     </u-upload>
                  </u-form-item>
                  <u-form-item prop="cardImg2"
                     label="身份证反面"
                     labelWidth="20%"
                     borderBottom
                     required
                     @click="beforeRead">
                     <u-upload :fileList="fileList7"
                        deletable
                        @afterRead="afterRead"
                        @delete="deletePic"
                        name="7"
                        multiple
                        :maxCount="1"
                        width="250"
                        height="150"
                        :previewFullImage="true">
                     </u-upload>
                  </u-form-item>
                  <u-form-item prop="expirationTimeIdcard"
                     label="身份证过期时间"
                     labelWidth="20%"
                     borderBottom>
                     <uni-datetime-picker v-model="registerFormModel.expirationTimeIdcard" type="datetime"  />
                  </u-form-item>
                  <u-form-item prop="drivingImg"
                     label="行驶证"
                     labelWidth="20%"
                     borderBottom
                     required
                     @click="beforeRead">
                     <u-upload :fileList="fileList2"
                        deletable
                        @afterRead="afterRead"
                        @delete="deletePic"
                        name="2"
                        multiple
                        :maxCount="1"
                        width="250"
                        height="150"
                        :previewFullImage="true">
                     </u-upload>
                  </u-form-item>
                  <u-form-item prop="expirationTimeDriving"
                     label="行驶证过期时间"
                     labelWidth="20%"
                     borderBottom>
                     <uni-datetime-picker v-model="registerFormModel.expirationTimeDriving" type="datetime"  />
                  </u-form-item>
                  <u-form-item prop="driverImg"
                     label="驾驶证"
                     labelWidth="24%"
                     borderBottom
                     required
                     @click="beforeRead">
                     <u-upload :fileList="fileList8"
                        deletable
                        @afterRead="afterRead"
                        @delete="deletePic"
                        name="8"
                        multiple
                        :maxCount="1"
                        width="250"
                        height="150"
                        :previewFullImage="true">
                     </u-upload>
                  </u-form-item>
                  <u-form-item prop="expirationTimeDriver"
                     label="驾驶证过期时间"
                     labelWidth="20%"
                     borderBottom>
                     <uni-datetime-picker v-model="registerFormModel.expirationTimeDriver" type="datetime"  />
                  </u-form-item>
                  <u-form-item prop="tradeQualificationImg"
                     label="从业资格证"
                     labelWidth="24%"
                     borderBottom
                     v-if="registerFormModel.type == 3||registerFormModel.type == 4"
                     required
                     @click="beforeRead">
                     <u-upload :fileList="fileList4"
                        deletable
                        @afterRead="afterRead"
                        @delete="deletePic"
                        name="4"
                        multiple
                        :maxCount="1"
                        width="250"
                        height="150"
                        :previewFullImage="true">
                     </u-upload>
                  </u-form-item>
                  <u-form-item prop="expirationTimeTradequalification"
                     label="从业资格过期时间"
                     labelWidth="20%"
                     borderBottom
                     v-if="registerFormModel.type == 3||registerFormModel.type == 4">
                     <uni-datetime-picker v-model="registerFormModel.expirationTimeTradequalification" type="datetime"  />
                  </u-form-item>
               </u--form>
               <view class="person-utils">
                  <u-button text="提交证件修改"
                     @click="updateDoc"
                     type="primary"></u-button>
               </view>
            </view>
         </u-popup>
      </view>
      <view class="logoutModel">
         <u-modal :show="logoutShow"
            :title="logoutTitle"
@@ -443,6 +584,9 @@
               roadTransportImg: '',
               inventoryImg: '',
               countryNumberCar: 0
            },
            registerFormModel:{
            },
            countryNumberCarList: [{
                  name: 1,
@@ -529,10 +673,11 @@
                     return Number(value);
                  },
                  validator: (rule, value, callback) => {
                     return value <= 10;
                     return value <= 10 && value > 0;
                  },
                  message: '请输入正确的车轴数',
                  trigger: ['change', 'blur']
                  trigger: ['change', 'blur'],
                  required: true,
               }],
               carImg: {
                  type: 'string',
@@ -551,7 +696,19 @@
                  required: true,
                  message: '请选择车辆类型',
                  trigger: ['blur', 'change']
               }
               },
               roadTransportImg: {
                  type: 'string',
                  required: true,
                  message: '请上传道路运输证照片',
                  trigger: ['blur', 'change']
               },
               tradeQualificationImg: {
                  type: 'string',
                  required: true,
                  message: '请上传从业资格证照片',
                  trigger: ['blur', 'change']
               },
            },
            src: '',
            fileList1: [],
@@ -559,8 +716,12 @@
            fileList3: [],
            fileList4: [],
            fileList5: [],
            fileList6: [],
            fileList7: [],
            fileList8:[],
            // 修改信息弹出框
            editDriverPopupShow: false,
            editDocShow:false,
            // previewImage
            previewImageShow: false,
            previewImageSrc: '',
@@ -575,6 +736,9 @@
      computed: {
         currentSelectedPrintStyle() {
            return this.selectedPrintStyle ? this.selectedPrintStyle : uni.getStorageSync('selectedPrintStyle')
         },
         idCard() {
            return this.userInfo.idCard.slice(0, 6) + '********' + this.userInfo.idCard.slice(-4)
         }
      },
      onShow() {
@@ -595,8 +759,8 @@
            this.$reqGet('getUserEntity').then(res => {
               uni.hideLoading();
               this.userInfo = res.data;
               this.userInfo.idCard = this.userInfo.idCard.slice(0, 6) + '********' + this.userInfo.idCard
                  .slice(-4)
               // this.userInfo.idCard = this.userInfo.idCard.slice(0, 6) + '********' + this.userInfo.idCard
               //    .slice(-4)
               uni.setStorageSync('carImg', this.userInfo.carImg);
               uni.setStorageSync('drivingImg', this.userInfo.drivingImg);
               uni.setStorageSync('roadTransportImg', this.userInfo.roadTransportImg);
@@ -626,20 +790,47 @@
                     url: `${BaseUrl}${this.userInfo.inventoryImg}`
                  });
               }
               Object.keys(this.editUserInfo).map(item => {
                  if (res.data[item]) {
                     this.editUserInfo[item] = res.data[item];
                     this.editUserInfo.idCard = this.userInfo.idCard.slice(0, 6) + '********' + this
                        .editUserInfo.idCard
                        .slice(-4)
               Object.assign(this.editUserInfo, res.data)
               this.registerFormModel={
                  customerid:res.data.userId,
                  idCardImg:res.data.idCardImg,
                  expirationTimeIdcard:res.data.expirationTimeIdcard,
                  drivingImg:res.data.drivingImg,
                  expirationTimeDriving:res.data.expirationTimeDriving,
                  driverImg:res.data.driverImg,
                  expirationTimeDriver:res.data.expirationTimeDriver,
                  tradeQualificationImg:res.data.tradeQualificationImg,
                  expirationTimeTradequalification:res.data.expirationTimeTradequalification,
                  type:res.data.carType
               }
               if(this.registerFormModel.idCardImg){
                  if (this.fileList6.length == 0 && this.registerFormModel.idCardImg.split(",")[0]) {
                     this.fileList6.push({
                        url: `${BaseUrl}${this.registerFormModel.idCardImg.split(",")[0]}`
                     });
                  }
               });
                  if (this.fileList7.length == 0 && this.registerFormModel.idCardImg.split(",")[1]) {
                     this.fileList7.push({
                        url: `${BaseUrl}${this.registerFormModel.idCardImg.split(",")[1]}`
                     });
                  }
                  if (this.fileList8.length == 0 && this.userInfo.driverImg) {
                     this.fileList8.push({
                        url: `${BaseUrl}${this.userInfo.driverImg}`
                     });
                  }
                  this.registerFormModel.cardImg1=this.registerFormModel.idCardImg.split(",")[1]
                  this.registerFormModel.cardImg2=this.registerFormModel.idCardImg.split(",")[1]
                 }
               this.editUserInfo.password = ''
            });
         },
         // 修改按钮点击
         editBtnClick() {
            this.editDriverPopupShow = true;
         },
         editDocClick(){
            this.editDocShow = true;
         },
         imageClick(index) {
            if (index == 1) {
@@ -700,9 +891,11 @@
                  success: res => {
                     if (num == 1) {
                        this.editUserInfo.carImg = JSON.parse(res.data).data.url;
                        this.registerFormModel.carImg = JSON.parse(res.data).data.url;
                        uni.setStorageSync('carImg', JSON.parse(res.data).data.url);
                        resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`);
                     } else if (num == 2) {
                        this.registerFormModel.drivingImg = JSON.parse(res.data).data.url;
                        this.editUserInfo.drivingImg = JSON.parse(res.data).data.url;
                        uni.setStorageSync('drivingImg', JSON.parse(res.data).data.url);
                        resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`);
@@ -719,6 +912,18 @@
                     } else if (num == 5) {
                        this.editUserInfo.inventoryImg = JSON.parse(res.data).data
                           .url;
                        resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`);
                     }else if(num==6){
                        this.registerFormModel.cardImg1 = JSON.parse(res.data)
                           .data.url;
                        resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`);
                     }else if(num==7){
                        this.registerFormModel.cardImg2 = JSON.parse(res.data)
                           .data.url;
                        resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`);
                     }else if(num==8){
                        this.registerFormModel.driverImg = JSON.parse(res.data)
                           .data.url;
                        resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`);
                     }
                  }
@@ -738,12 +943,42 @@
         editDriverPopupClose() {
            this.editDriverPopupShow = false;
         },
         editDocClose(){
            this.editDocShow = false;
         },
         editDriverPopupOpen() {},
         editDocOpen(){},
         modifyPassword() {
            this.$store.commit('changeisLogin', false)
            this.$store.dispatch('websocketOnClose')
            uni.reLaunch({
               url: '/pages/login/forgetPassword/forgetPassword'
            })
         },
         // 修改证件信息
         updateDoc(){
            this.$reqPost('saveDriverDocs', {
               userId:this.registerFormModel.customerid,
               idCardImg:this.registerFormModel.cardImg1+","+this.registerFormModel.cardImg2,
               expirationTimeIdcard:this.registerFormModel.expirationTimeIdcard,
               drivingImg:this.registerFormModel.drivingImg,
               expirationTimeDriving:this.registerFormModel.expirationTimeDriving,
               driverImg:this.registerFormModel.driverImg,
               expirationTimeDriver:this.registerFormModel.expirationTimeDriver,
               tradeQualificationImg:this.registerFormModel.tradeQualificationImg,
               expirationTimeTradequalification:this.registerFormModel.expirationTimeTradequalification,
            }, 'json').then(res => {
               this.editDocShow = false;
               if (res.code == 0) {
                  this.$u.toast('修改成功');
                  this.init();
               } else {
                  uni.showToast({
                     title: res.msg,
                     icon: 'none',
                     duration: 2000
                  });
               }
            })
         },
         // 修改用户信息
@@ -757,6 +992,7 @@
            this.$refs.editRef
               .validate()
               .then(res => {
                  this.$reqPost('updateUser', this.editUserInfo, 'json').then(res => {
                     console.log('更新数据', res);
                     this.editDriverPopupShow = false;
@@ -896,7 +1132,7 @@
      .car-type {
         position: fixed;
         top: 284rpx;
         right: 70rpx;
         right: 20rpx;
         width: 100%;
         height: 50rpx;
         display: flex;