yangan
2024-09-30 ff8327beb143f7014901ac9b807dce932baa5ad9
pages/driver-page/drvier-my/certifiCate/certifiCate.vue
@@ -196,6 +196,24 @@
                           border="none"
                           inputAlign="left"></u--input>
                     </u-form-item>
                     <u-form-item prop="certificateImg"
                        label="资质证明"
                        labelWidth="20%"
                        borderBottom
                        required
                        @click="beforeRead">
                        <u-upload :fileList="item.fileList"
                           deletable
                           @afterRead="afterReads"
                           @delete="deletePics"
                           multiple
                           :name="index.toString()"
                           :maxCount="1"
                           width="250"
                           height="150"
                           :previewFullImage="true">
                        </u-upload>
                     </u-form-item>
                  </view>
                  
                  <u-form-item labelWidth="20%"
@@ -229,7 +247,8 @@
            supercargoList:[{
               driverName:"",
               driverIdcard:"",
               driverPhone:""
               driverPhone:"",
               fileList:[]
            }],
            userInfo: {},
            scoreDetailList: [],
@@ -335,6 +354,10 @@
            this.previewImageShow = false;
         },
         previewImageOpen() {},
         deletePics(event) {
            this.changeisUploadimg(true);
            this.supercargoList[event.name].fileList.splice(event.index, 1);
         },
         // 删除
         deletePic(event) {
            this.changeisUploadimg(true);
@@ -385,9 +408,11 @@
                }
               if(data){
                  this.tranSportForm=Object.assign({},this.tranSportForm,data)
                  this.supercargoList =this.tranSportForm.supercargoInfo.split(",").map(item=>{
                     return {driverName:item.split("|")[0],driverIdcard:item.split("|")[1],driverPhone:item.split("|")[2]}
                  })
                  if((!this.tranSportForm.supercargoInfo==''||null)||(!this.tranSportForm.highlyToxicImg==''||null) ){
                     this.supercargoList =this.tranSportForm.supercargoInfo.split(",").map((item,index)=>{
                        return {driverName:item.split("|")[0],driverIdcard:item.split("|")[1],driverPhone:item.split("|")[2],fileList:[{url:`${BaseUrl}${this.tranSportForm.highlyToxicImg.split(',')[index]}`}]}
                     })
                  }
                  this.driverList=this.tranSportForm.driverName.split(",").map((item,index)=>{
                     return {driverName:item,driverIdcard:this.tranSportForm.driverIdcard.split(",")[index]}
                  })
@@ -480,6 +505,13 @@
                              duration: 2000
                           });
                           submit=false
                        }else if(item.fileList.length==0){
                           uni.showToast({
                              title: `请上传资质证明!`,
                              icon: 'error',
                              duration: 2000
                           });
                           submit=false
                        }
                     })
                  }
@@ -487,6 +519,7 @@
                        let driverName=""
                        let driverIdcard=""
                        let supercargoInfo=''
                        let highlyToxicImg=''
                        driverName = this.driverList.map((item, index) => {
                                return item.driverName;
                              }).join(",");
@@ -496,6 +529,9 @@
                        supercargoInfo = this.supercargoList.map((item, index) => {
                            return item.driverName+ '|'+item.driverIdcard+"|"+item.driverPhone
                           }).join(",");
                        highlyToxicImg= this.supercargoList.map((item, index) => {
                           return item.fileList[0].url.replace(BaseUrl,'')
                           }).join(",")
                          if(this.tranSportForm.id){
                           this.$reqPut('putJcroadtransport',{
                              id:this.tranSportForm.id,
@@ -512,7 +548,8 @@
                              userId:this.userInfo.userId,
                              driverName:driverName,
                              driverIdcard:driverIdcard,
                              supercargoInfo:supercargoInfo
                              supercargoInfo:supercargoInfo,
                              highlyToxicImg:highlyToxicImg
                           }, 'json').then(res => {
                              if (res.code == 0) {
                                 this.editTranShow = false;
@@ -529,7 +566,8 @@
                                 this.supercargoList=[{
                                    driverName:"",
                                    driverIdcard:"",
                                    driverPhone:""
                                    driverPhone:"",
                                    fileList:[]
                                 }]
                                 this.fileList9=[]
                                 this.getData();
@@ -547,7 +585,8 @@
                              ...this.tranSportForm,
                              driverName:driverName,
                              driverIdcard:driverIdcard,
                              supercargoInfo:supercargoInfo
                              supercargoInfo:supercargoInfo,
                              highlyToxicImg:highlyToxicImg
                           }, 'json').then(res => {
                              if (res.code == 0) {
                                 this.editTranShow = false;
@@ -564,7 +603,8 @@
                                 this.supercargoList=[{
                                    driverName:"",
                                    driverIdcard:"",
                                    driverPhone:""
                                    driverPhone:"",
                                    fileList:[]
                                 }]
                                 this.fileList9=[]
                                 this.getData();
@@ -579,6 +619,47 @@
                          }
                     }
               })
         },
         async afterReads(event) {
            // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
            let lists = [].concat(event.file);
            let fileListLen = this.supercargoList[event.name].fileList.length;
            lists.map(item => {
               this.supercargoList[event.name].fileList.push({
                  ...item,
                  status: 'uploading',
                  message: '上传中'
               });
            });
            for (let i = 0; i < lists.length; i++) {
               const result = await this.uploadFilePromises(lists[i].url, event.name);
               let item = this.supercargoList[event.name].fileList[fileListLen];
               this.supercargoList[event.name].fileList.splice(
                  fileListLen,
                  1,
                  Object.assign(item, {
                     status: 'success',
                     message: '上传成功',
                     url: result
                  })
               );
               fileListLen++;
            }
         },
         uploadFilePromises(url, num) {
            return new Promise((resolve, reject) => {
               let a = uni.uploadFile({
                  url: BaseUrl + '/admin/sys-file/uploadUnToken',
                  filePath: url,
                  name: 'file',
                  // formData: {
                  //    user: 'test'
                  // },
                  success: res => {
                        resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`);
                  }
               });
            });
         },
         async afterRead(event) {
            // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
@@ -638,7 +719,8 @@
            this.supercargoList.push({
               driverName:"",
               driverIdcard:"",
               driverPhone:""
               driverPhone:"",
               fileList:[]
            })
         },
         addDriver(){