wk
2024-06-29 65d1e61e0546a5a7b42381b1f11a5ad6ed2ce145
pages/driver-page/drvier-my/certifiCate/certifiCate.vue
@@ -90,7 +90,8 @@
                  <u-form-item labelWidth="20%"
                     label="产品"
                     ref="item1" 
                     prop='productId'>
                     prop='productName'
                     required>
                     <u--input placeholder="请输入产品"
                        v-model="tranSportForm.productName"
                        class="input"
@@ -99,7 +100,8 @@
                  <u-form-item labelWidth="20%"
                     label="客户"
                     ref="item1" 
                     prop='productId'>
                     prop='customerName'
                     required>
                     <u--input placeholder="请输入客户"
                        v-model="tranSportForm.customerName"
                        class="input"
@@ -212,39 +214,6 @@
               </view>
            </view>
         </u-popup>
         <u-popup :closeable='true'
            :round="30"
            mode='bottom'
            :show="selfDeliverShow"
            @close="selfDeliverClose"
            @open="selfDeliverOpen">
            <view class="name-list-section">
               <view class="name-list_title">
                  选择客户
               </view>
               <view class="name-list_container">
                  <u-empty mode="data"
                     icon="http://cdn.uviewui.com/uview/empty/data.png"
                     text="暂无数据"
                     textSize="30"
                     iconSize="1000"
                     v-if="customerNameList.length===0"></u-empty>
                  <view class="name-list_container_item"
                     v-for="(item,index) in customerNameList" :key="index"
                     @click="selectCustomer(item)">
                     <view class="item-image">
                        <image src="https://mx.jzeg.cn:9096/appimg/image/banner/address.png"
                           mode="widthFix"
                           style="width: 18px;"></image>
                     </view>
                     <view class="item-customerName">
                        {{item.customerName}}
                     </view>
                  </view>
               </view>
            </view>
         </u-popup>
      </view>
   </view>
</template>
@@ -270,7 +239,6 @@
            previewImageSrc: '',
            certificateData:[],
            userInfo: {},
            customerNameList:[],
            driverList:[{
               driverName:"",
               driverIdcard:""
@@ -281,6 +249,18 @@
               customerId:""
            },
            sportRules:{
               productName:{
                  type: 'string',
                  required: true,
                  message: '请填写产品名称',
                  trigger: ['blur', 'change']
               },
               customerName:{
                  type: 'string',
                  required: true,
                  message: '请填写客户名称',
                  trigger: ['blur', 'change']
               },
               certificateNo: {
                  type: 'string',
                  required: true,
@@ -290,7 +270,7 @@
               expirationTime: {
                  type: 'string',
                  required: true,
                  message: '请选择运输证过期时间',
                  message: '请选择运输证开始时间',
                  trigger: ['blur', 'change']
               },
               startTime:{
@@ -379,7 +359,6 @@
            });
         },
         editTranClick(){
            this.getShipToList()
            this.editTranShow = true;
         },
         editTranClose(){
@@ -390,21 +369,17 @@
            this.$refs.sportRef
               .validate()
               .then(res => {
                  if (this.tranSportForm.productName == '' ) {
                     uni.showToast({
                        title: '请选择产品!',
                        icon: 'error',
                        duration: 2000
                     });
                  }else if(this.tranSportForm.customerName == ''){
                     uni.showToast({
                        title: '请选择客户!',
                        icon: 'error',
                        duration: 2000
                     });
                  }
                  let submit=true
                  let idcardtext=/^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
                  if(this.driverList.length>0){
                  console.log(this.fileList9.length)
                  if (this.fileList9.length==0) {
                     uni.showToast({
                        title: '请选择运输证!',
                        icon: 'error',
                        duration: 2000
                     });
                     submit=false
                  }else if(this.driverList.length>0){
                     this.driverList.forEach((item,index)=>{
                        if(!item.driverName){
                           uni.showToast({
@@ -412,19 +387,21 @@
                              icon: 'error',
                              duration: 2000
                           });
                        }
                        if(!item.driverIdcard){
                           submit=false
                        }else if(!item.driverIdcard){
                           uni.showToast({
                              title: `请填写驾驶身份证!`,
                              icon: 'error',
                              duration: 2000
                           });
                           submit=false
                        }else if(!idcardtext.test(item.driverIdcard)){
                           uni.showToast({
                              title: `请检验驾驶员身份证!`,
                              icon: 'error',
                              duration: 2000
                           });
                           submit=false
                        }
                     })
                  }
@@ -436,87 +413,98 @@
                              icon: 'error',
                              duration: 2000
                           });
                        }
                        if(!item.driverIdcard){
                           submit=false
                        }else if(!item.driverIdcard){
                           uni.showToast({
                              title: `请填写押运身份证!`,
                              icon: 'error',
                              duration: 2000
                           });
                           submit=false
                        }else if(!idcardtext.test(item.driverIdcard)){
                           uni.showToast({
                              title: `请检验押运身份证!`,
                              icon: 'error',
                              duration: 2000
                           });
                        }
                        if(!item.driverPhone){
                           submit=false
                        }else if(!item.driverPhone){
                           uni.showToast({
                              title: `请填写押运手机号!`,
                              icon: 'error',
                              duration: 2000
                           });
                           submit=false
                        }else if( !/^1[23456789]\d{9}$/.test(item.driverPhone)){
                           uni.showToast({
                              title: `请检验押运手机号!`,
                              icon: 'error',
                              duration: 2000
                           });
                           submit=false
                        }
                     })
                  }
                  let driverName=""
                  let driverIdcard=""
                  let supercargoInfo=''
                  driverName = this.driverList.map((item, index) => {
                          return item.driverName;
                        }).join(",");
                  driverIdcard = this.driverList.map((item, index) => {
                         return item.driverIdcard;
                        }).join(",");
                  supercargoInfo = this.supercargoList.map((item, index) => {
                      return item.driverName+ '|'+item.driverIdcard+"|"+item.driverPhone
                     }).join(",");
                     if(this.tranSportForm.startTime){
                        this.tranSportForm.startTime=this.tranSportForm.startTime+" 00:01"
                     if(submit){
                        let driverName=""
                        let driverIdcard=""
                        let supercargoInfo=''
                        driverName = this.driverList.map((item, index) => {
                                return item.driverName;
                              }).join(",");
                        driverIdcard = this.driverList.map((item, index) => {
                               return item.driverIdcard;
                              }).join(",");
                        supercargoInfo = this.supercargoList.map((item, index) => {
                            return item.driverName+ '|'+item.driverIdcard+"|"+item.driverPhone
                           }).join(",");
                           if(this.tranSportForm.startTime){
                              this.tranSportForm.startTime=this.tranSportForm.startTime+" 00:01"
                           }
                           if(this.tranSportForm.expirationTime){
                              this.tranSportForm.expirationTime=this.tranSportForm.expirationTime+" 23:55"
                           }
                        this.$reqPost('addJcroadtransport', {
                           userId:this.userInfo.userId,
                           ...this.tranSportForm,
                           driverName:driverName,
                           driverIdcard:driverIdcard,
                           supercargoInfo:supercargoInfo
                        }, 'json').then(res => {
                           if (res.code == 0) {
                              this.editTranShow = false;
                              this.$u.toast('提交成功');
                              this.tranSportForm={
                                 carNo:"",
                                 productId:"",
                                 customerId:""
                              }
                              this.driverList=[{
                                 driverName:"",
                                 driverIdcard:""
                              }]
                              this.supercargoList=[{
                                 driverName:"",
                                 driverIdcard:"",
                                 driverPhone:""
                              }]
                              this.fileList9=[]
                              this.getData();
                           } else {
                              uni.showToast({
                                 title: res.msg,
                                 icon: 'none',
                                 duration: 2000
                              });
                           if(this.tranSportForm.startTime){
                              this.tranSportForm.startTime=this.tranSportForm.startTime.slice(0,10)
                           }
                           if(this.tranSportForm.expirationTime){
                              this.tranSportForm.expirationTime=this.tranSportForm.expirationTime.slice(0,10)
                           }
                           }
                        })
                     }
                     if(this.tranSportForm.expirationTime){
                        this.tranSportForm.expirationTime=this.tranSportForm.expirationTime+" 23:55"
                     }
                  this.$reqPost('addJcroadtransport', {
                     userId:this.userInfo.userId,
                     ...this.tranSportForm,
                     driverName:driverName,
                     driverIdcard:driverIdcard,
                     supercargoInfo:supercargoInfo
                  }, 'json').then(res => {
                     if (res.code == 0) {
                        this.editTranShow = false;
                        this.$u.toast('提交成功');
                        this.tranSportForm={
                           carNo:"",
                           productId:"",
                           customerId:""
                        }
                        this.driverList=[{
                           driverName:"",
                           driverIdcard:""
                        }]
                        this.supercargoList=[{
                           driverName:"",
                           driverIdcard:"",
                           driverPhone:""
                        }]
                        this.fileList9=[]
                        this.getData();
                     } else {
                        uni.showToast({
                           title: res.msg,
                           icon: 'none',
                           duration: 2000
                        });
                     }
                  })
               })
         },
         async afterRead(event) {
@@ -563,17 +551,6 @@
                  }
               });
            });
         },
         // 获取客户
         getShipToList() {
            this.$reqGet('getShipToList')
               .then(res => {
                  if (res.code == 0) {
                     this.customerNameList = res.data
                  }else {
                  this.$u.toast('加载失败')
               }
            })
         },
         getScoreDetail() {
            uni.showLoading({