yangan
2024-06-20 2490d3321f6d6f9b5bacf29225387f7c3f89a2b4
pages/driver-page/drvier-my/drvier-my.vue
@@ -1,7 +1,7 @@
<template>
   <view class="driver-my">
      <view class=""
         style="height: 586rpx;width: 100%;">
         style="height: 540rpx;width: 100%;">
         <view class="driver-banner">
            <view class="navgation">我的</view>
            <view class="avatar">
@@ -31,6 +31,10 @@
               shape="circle"
               plain>编辑证件信息</u-button></view>
      </view>
      <view class="process-tran"
         >
      </view>
      <view class="information-block">
         <view class="personal-information">
            <view class="personal-information-block">
@@ -120,7 +124,7 @@
                           size="36"></u-icon>
                     </view>
                  </view> -->
                  <view class="information-line last"
                  <view class="information-line"
                     @click="scoreDetail">
                     <view class="line-label"
                        style="margin-left: 1.5%;">
@@ -138,7 +142,25 @@
                              size="36"></u-icon>
                        </view>
                     </view>
                  </view>
                  <view class="information-line last"
                     @click="scoreCert">
                     <view class="line-label"
                        style="margin-left: 1.5%;">
                        <image src="https://mx.jzeg.cn:9096/appimg/image/banner/score.png"
                           mode="widthFix"
                           style="width: 36rpx;position: relative;left: 8rpx;"></image>
                        <view class="label-text">道路运输证</view>
                     </view>
                     <view class="information-value">
                        <view class="">
                           {{ '' }}
                        </view>
                        <view class="">
                           <u-icon name="arrow-right"
                              size="36"></u-icon>
                        </view>
                     </view>
                  </view>
               </view>
            </view>
@@ -292,7 +314,7 @@
                        inputAlign="left"></u--input>
                  </u-form-item>
                  <u-form-item labelWidth="20%"
                     label="车辆类型"
                     label="环保标准"
                     borderBottom
                     required
                     prop="countryNumberCar">
@@ -309,85 +331,17 @@
                           :name="item.name"></u-radio>
                     </u-radio-group>
                  </u-form-item>
                  <u-form-item labelWidth="25%"
                     label="车辆照片"
                     @click="beforeRead"
                     prop="carImg"
                     required>
                     <u-upload :fileList="fileList1"
                        @afterRead="afterRead"
                        @delete="deletePic"
                        name="1"
                        multiple
                        :maxCount="1"
                        width="250"
                        height="150"
                        :previewFullImage="true"></u-upload>
                  </u-form-item>
                  <u-form-item labelWidth="25%"
                     label="行驶证照片"
                     ref="item1"
                     @click="beforeRead"
                     prop="drivingImg"
                     required>
                     <u-upload :fileList="fileList2"
                        @afterRead="afterRead"
                        @delete="deletePic"
                        name="2"
                        multiple
                        :maxCount="1"
                        width="250"
                        height="150"
                        :previewFullImage="true"></u-upload>
                  </u-form-item>
                  <u-form-item labelWidth="25%"
                     label="道路运输证"
                     ref="item1"
                     @click="beforeRead"
                     prop="roadTransportImg"
                     required>
                     <u-upload :fileList="fileList3"
                        @afterRead="afterRead"
                        @delete="deletePic"
                        name="3"
                        multiple
                        :maxCount="1"
                        width="250"
                        height="150"
                        :previewFullImage="true"></u-upload>
                  </u-form-item>
                  <u-form-item labelWidth="25%"
                     label="从业资格证"
                     ref="item1"
                     @click="beforeRead"
                     prop="tradeQualificationImg"
                     required>
                     <u-upload :fileList="fileList4"
                        @afterRead="afterRead"
                        @delete="deletePic"
                        name="4"
                        multiple
                        :maxCount="1"
                        width="250"
                        height="150"
                        :previewFullImage="true"></u-upload>
                  </u-form-item>
                  <u-form-item prop="inventoryImg"
                     label="环保清单"
                     labelWidth="24%"
                  <u-form-item labelWidth="20%"
                     label="车辆类型"
                     borderBottom
                     @click="beforeRead">
                     <u-upload :fileList="fileList5"
                        deletable
                        @afterRead="afterRead"
                        @delete="deletePic"
                        name="5"
                        multiple
                        :maxCount="3"
                        width="250"
                        height="150"
                        :previewFullImage="true">
                     </u-upload>
                     ref="roleRef"
                     required>
                     <niceui-data-select-input v-model="editUserInfo.carType"
                        :localdata="radiolist2"
                        label="车辆类型选择"
                        placeholder="请选择车辆类型"
                        @change="productcarTypeChange"
                        ></niceui-data-select-input>
                  </u-form-item>
               </u--form>
               <view class="person-utils">
@@ -401,6 +355,7 @@
            </view>
         </u-popup>
      </view>
      <!-- 修改证件弹出 -->
      <view class="editDriverPopup-container">
         <u-popup :show="editDocShow"
            mode="bottom"
@@ -453,7 +408,7 @@
                     label="身份证过期时间"
                     labelWidth="20%"
                     borderBottom>
                     <uni-datetime-picker v-model="registerFormModel.expirationTimeIdcard" type="datetime"  />
                     <uni-datetime-picker v-model="registerFormModel.expirationTimeIdcard" type="datetime" :start="minDate" />
                  </u-form-item>
                  <u-form-item prop="drivingImg"
                     label="行驶证"
@@ -477,7 +432,7 @@
                     label="行驶证过期时间"
                     labelWidth="20%"
                     borderBottom>
                     <uni-datetime-picker v-model="registerFormModel.expirationTimeDriving" type="datetime"  />
                     <uni-datetime-picker v-model="registerFormModel.expirationTimeDriving" type="datetime" :start="minDate" />
                  </u-form-item>
                  <u-form-item prop="driverImg"
                     label="驾驶证"
@@ -501,7 +456,7 @@
                     label="驾驶证过期时间"
                     labelWidth="20%"
                     borderBottom>
                     <uni-datetime-picker v-model="registerFormModel.expirationTimeDriver" type="datetime"  />
                     <uni-datetime-picker v-model="registerFormModel.expirationTimeDriver" type="datetime"  :start="minDate" />
                  </u-form-item>
                  <u-form-item prop="tradeQualificationImg"
                     label="从业资格证"
@@ -527,7 +482,7 @@
                     labelWidth="20%"
                     borderBottom
                     v-if="registerFormModel.type == 3||registerFormModel.type == 4">
                     <uni-datetime-picker v-model="registerFormModel.expirationTimeTradequalification" type="datetime"  />
                     <uni-datetime-picker v-model="registerFormModel.expirationTimeTradequalification" type="datetime"  :start="minDate" />
                  </u-form-item>
               </u--form>
               <view class="person-utils">
@@ -538,7 +493,6 @@
            </view>
         </u-popup>
      </view>
      <view class="logoutModel">
         <u-modal :show="logoutShow"
            :title="logoutTitle"
@@ -559,12 +513,16 @@
   import noobTour from '@/components/noobTour/noobTour.vue'
   import printerStyle from '@/pages/driver-page/driver-index/bill-of-lading-details/printerStyle/printerStyle.vue'
   import { mapMutations, mapState } from 'vuex';
   import qianTree from '@/components/qian-tree/qian-tree.vue';
   export default {
      components: { previewImage, noobTour, printerStyle },
      components: { previewImage, noobTour, printerStyle,qianTree },
      data() {
         return {
            minDate: this.getToday(),
            customerName:"",
            // 获取的司机详情
            userInfo: {},
            productName:"",
            // 修改司机详情
            editUserInfo: {
               phone: '',
@@ -585,9 +543,24 @@
               inventoryImg: '',
               countryNumberCar: 0
            },
            registerFormModel:{
            },
            registerFormModel:{},
            radiolist2: [{
                  text: '普通运输车',
                  value:1
               },
               {
                  text: '集装箱平板车',
                  value:2
               },
               {
                  text: '液氯槽车',
                  value:3
               },
               {
                  text: '液碱槽车',
                  value:4
               }
            ],
            countryNumberCarList: [{
                  name: 1,
                  label: '国五',
@@ -694,7 +667,7 @@
               countryNumberCar: {
                  type: 'number',
                  required: true,
                  message: '请选择车辆类型',
                  message: '请选择环保标准',
                  trigger: ['blur', 'change']
               },
               roadTransportImg: {
@@ -715,10 +688,9 @@
            fileList2: [],
            fileList3: [],
            fileList4: [],
            fileList5: [],
            fileList6: [],
            fileList7: [],
            fileList8:[],
            fileList8: [],
            // 修改信息弹出框
            editDriverPopupShow: false,
            editDocShow:false,
@@ -748,7 +720,23 @@
         this.$refs.editRef.setRules(this.rules);
      },
      methods: {
         productcarTypeChange(e){
            this.registerFormModel.carType = this.radiolist2.find(v => v.value === e).value
         },
         ...mapMutations(['changeisUploadimg']),
         getToday() {
           let now = new Date();
           let year = now.getFullYear();
           let month = this.padStart(now.getMonth() + 1); // 月份是从0开始的
           let day = this.padStart(now.getDate());
           let hour = this.padStart(now.getHours());
           let minute = this.padStart(now.getMinutes());
           let second = this.padStart(now.getSeconds());
           return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
         },
         padStart(value) {
           return value.toString().padStart(2, '0');
         },
         init() {
            this.getUserEntity();
         },
@@ -783,11 +771,6 @@
               if (this.fileList4.length == 0 && this.userInfo.tradeQualificationImg) {
                  this.fileList4.push({
                     url: `${BaseUrl}${this.userInfo.tradeQualificationImg}`
                  });
               }
               if (this.fileList5.length == 0 && this.userInfo.inventoryImg) {
                  this.fileList5.push({
                     url: `${BaseUrl}${this.userInfo.inventoryImg}`
                  });
               }
               Object.assign(this.editUserInfo, res.data)
@@ -926,6 +909,7 @@
                           .data.url;
                        resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`);
                     }
                  }
               });
            });
@@ -957,29 +941,53 @@
         },
         // 修改证件信息
         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
                  });
               }
            })
            if(this.registerFormModel.type == 3||this.registerFormModel.type == 4){
               this.$reqPost('saveDriverDocs', {
                  userId:this.registerFormModel.customerid,
                  idCardImg:this.registerFormModel.cardImg1+","+this.registerFormModel.cardImg2,
                  expirationTimeIdcard:this.registerFormModel.expirationTimeIdcard.slice(0,16),
                  drivingImg:this.registerFormModel.drivingImg,
                  expirationTimeDriving:this.registerFormModel.expirationTimeDriving.slice(0,16),
                  driverImg:this.registerFormModel.driverImg,
                  expirationTimeDriver:this.registerFormModel.expirationTimeDriver.slice(0,16),
                  tradeQualificationImg:this.registerFormModel.tradeQualificationImg,
                  expirationTimeTradequalification:this.registerFormModel.expirationTimeTradequalification.slice(0,16),
               }, '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
                     });
                  }
               })
            }else{
               this.$reqPost('saveDriverDocs', {
                  userId:this.registerFormModel.customerid,
                  idCardImg:this.registerFormModel.cardImg1+","+this.registerFormModel.cardImg2,
                  expirationTimeIdcard:this.registerFormModel.expirationTimeIdcard.slice(0,16),
                  drivingImg:this.registerFormModel.drivingImg,
                  expirationTimeDriving:this.registerFormModel.expirationTimeDriving.slice(0,16),
                  driverImg:this.registerFormModel.driverImg,
                  expirationTimeDriver:this.registerFormModel.expirationTimeDriver.slice(0,16),
               }, '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
                     });
                  }
               })
            }
         },
         // 修改用户信息
         updateUser() {
@@ -992,9 +1000,7 @@
            this.$refs.editRef
               .validate()
               .then(res => {
                  this.$reqPost('updateUser', this.editUserInfo, 'json').then(res => {
                     console.log('更新数据', res);
                     this.editDriverPopupShow = false;
                     if (res.code == 0) {
                        this.$u.toast('修改成功');
@@ -1035,6 +1041,11 @@
               url: '/pages/driver-page/drvier-my/scoreDetail/scoreDetail'
            })
         },
         scoreCert(){
            uni.navigateTo({
               url: '/pages/driver-page/drvier-my/certifiCate/certifiCate'
            })
         },
         addressManageHandle() {
            uni.navigateTo({
               url: '/pages/driver-page/drvier-my/addressMange/addressMange'
@@ -1042,7 +1053,33 @@
         },
         selectedPrintStyleHandle(val) {
            this.selectedPrintStyle = val
         }
         },
         findNameById(tree, idArr) {
            let result = [];
            function traverse(node, idArr) {
               if (!node) return;
               if (idArr.includes(node.id)) {
                  result.push({name:node.productName,id:node.id});
               }
               if (node.children && node.children.length > 0) {
                  node.children.forEach(child => {
                     traverse(child, idArr);
                  });
               }
            }
            tree.forEach(node => {
               traverse(node, idArr);
            });
            return result;
         },
         // 打开产品表
         treeOpen() {
            this.$refs.tkitree._show();
         },
         treeClose() {
            this.$refs.tkitree._hide();
         },
      }
   };
</script>
@@ -1128,10 +1165,34 @@
            margin-right: vww(6);
         }
      }
      .process-tran{
         width: 300rpx;
         height: 50rpx;
         margin: 0 auto;
         position: fixed;
         top: 390rpx;
         left: 37rpx;
         display: flex;
         align-items: center;
         .state-text {
            margin-right: vww(6);
         }
      }
      .car-type {
         position: fixed;
         top: 284rpx;
         right: 20rpx;
         width: 100%;
         height: 50rpx;
         display: flex;
         align-items: center;
         justify-content: flex-end;
      }
      .tran-type{
         position: fixed;
         top: 390rpx;
         right: 20rpx;
         width: 100%;
         height: 50rpx;
@@ -1152,7 +1213,7 @@
            &-block {
               width: 690rpx;
               height: 680rpx;
               height: 760rpx;
               background: #ffffff;
               box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
               border-radius: 20rpx;
@@ -1213,9 +1274,35 @@
      }
      .car-information {
         margin-top: 30rpx;
         width: 100%;
         position: relative;
         @include flex justify-content: center;
         .roadTransportCertificate{
            width: 690rpx;
            background: #ffffff;
            box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
            border-radius: 20rpx;
            .information-body {
               width: 636rpx;
               margin: vww(15) vww(14);
               @include flex flex-direction: column;
               .certificate {
                  display: flex;
                  justify-content: space-between;
                  align-items: center;
                  width: 636rpx;
                  height: 90rpx;
                  border-bottom: 1rpx solid #f0f1f6;
                  .certificate-left{
                     margin-left: 20rpx;
                  }
                  .certificate-right{
                     margin-right: 20rpx;
                  }
               }
            }
         }
         .information-main {
            width: 690rpx;
@@ -1228,7 +1315,6 @@
               width: 636rpx;
               margin: vww(15) vww(14);
               @include flex flex-direction: column;
               .car-img {
                  height: 246rpx;
                  width: 100%;
@@ -1331,5 +1417,15 @@
            }
         }
      }
      .superList{
         margin: 10rpx;
         padding: 10rpx;
         border: 1px solid  #f0f1f6;
      }
      .adddelete{
         display: flex;
         justify-content: space-around;
         margin: 10rpx;
      }
   }
</style>