yangan
2024-08-13 6e5dddd39f051cfe564c32ae5608729ad9260409
pages/register/register.vue
@@ -4,7 +4,7 @@
         <u--form :rules="rules"
            :model="registerFormModel"
            ref="regesterFormRef">
            <u-form-item labelWidth="20%"
            <u-form-item labelWidth="35%"
               label="选择身份"
               borderBottom
               ref="roleRef"
@@ -25,8 +25,8 @@
               </u-radio-group>
            </u-form-item>
            <u-form-item prop="name"
               label="姓名"
               labelWidth="20%"
               :label="radiovalue1 == '司机'?'姓名':'承运商名称'"
               labelWidth="35%"
               borderBottom
               required>
               <u--input v-model="registerFormModel.name"
@@ -34,8 +34,8 @@
                  clearable></u--input>
            </u-form-item>
            <u-form-item prop="idCard"
               label="身份证"
               labelWidth="20%"
               :label="radiovalue1 == '司机'?'身份证':'证件号'"
               labelWidth="35%"
               borderBottom
               required>
               <u--input v-model="registerFormModel.idCard"
@@ -43,11 +43,12 @@
                  clearable></u--input>
            </u-form-item>
            <u-form-item prop="cardImg1"
               label="身份证正面"
               labelWidth="20%"
               :label="radiovalue1 == '司机'?'身份证正面':'身份证或营业执照照片'"
               labelWidth="35%"
               borderBottom
               required
               @click="beforeRead">
               @click="beforeRead"
               v-if="radiovalue1 == '货代'">
               <u-upload :fileList="fileList5"
                  deletable
                  @afterRead="afterRead"
@@ -61,11 +62,12 @@
               </u-upload>
            </u-form-item>
            <u-form-item prop="cardImg2"
               label="身份证反面"
               labelWidth="20%"
               :label="radiovalue1 == '司机'?'身份证反面':'身份证或营业执照照片'"
               labelWidth="35%"
               borderBottom
               required
               @click="beforeRead">
               @click="beforeRead"
               v-if="radiovalue1 == '货代'">
               <u-upload :fileList="fileList6"
                  deletable
                  @afterRead="afterRead"
@@ -78,15 +80,9 @@
                  :previewFullImage="true">
               </u-upload>
            </u-form-item>
            <u-form-item prop="expirationTimeIdcard"
               label="身份证过期时间"
               labelWidth="20%"
               borderBottom>
               <uni-datetime-picker v-model="registerFormModel.expirationTimeIdcard" type="date" :start="minDate" />
            </u-form-item>
            <u-form-item prop="phone"
               label="手机号"
               labelWidth="20%"
               labelWidth="35%"
               borderBottom
               required>
               <u--input v-model="registerFormModel.phone"
@@ -95,7 +91,7 @@
            </u-form-item>
            <u-form-item prop="password"
               label="密码"
               labelWidth="20%"
               labelWidth="35%"
               borderBottom
               required>
               <u--input v-model="registerFormModel.password"
@@ -120,7 +116,7 @@
        </view>
            <u-form-item prop="confirmPassword"
               label="确认密码"
               labelWidth="20%"
               labelWidth="35%"
               borderBottom
               required>
               <u--input v-model="registerFormModel.confirmPassword"
@@ -131,7 +127,7 @@
            </u-form-item>
            <u-form-item prop="carNo"
               label="车牌号"
               labelWidth="20%"
               labelWidth="35%"
               borderBottom
               v-if="radiovalue1 == '司机'"
               required>
@@ -139,7 +135,7 @@
                  placeholder="请输入内容"
                  clearable></u--input>
            </u-form-item>
            <u-form-item labelWidth="20%"
            <u-form-item labelWidth="35%"
               label="车辆类型"
               borderBottom
               ref="roleRef"
@@ -154,7 +150,7 @@
            </u-form-item>
            <u-form-item prop="carImg"
               label="车辆照片"
               labelWidth="20%"
               labelWidth="35%"
               borderBottom
               v-if="radiovalue1 == '司机'"
               required
@@ -173,7 +169,7 @@
            </u-form-item>
            <u-form-item prop="drivingImg"
               label="行驶证"
               labelWidth="20%"
               labelWidth="35%"
               borderBottom
               v-if="radiovalue1 == '司机'"
               required
@@ -191,15 +187,15 @@
               </u-upload>
            </u-form-item>
            <u-form-item prop="expirationTimeDriving"
               label="行驶证过期时间"
               labelWidth="20%"
               label="证件过期时间"
               labelWidth="35%"
               borderBottom
               v-if="radiovalue1 == '司机'">
               <uni-datetime-picker v-model="registerFormModel.expirationTimeDriving" type="date"  :start="minDate" />
            </u-form-item>
            <u-form-item prop="driverImg"
               label="驾驶证"
               labelWidth="24%"
               labelWidth="35%"
               borderBottom
               v-if="radiovalue1 == '司机'"
               required
@@ -217,15 +213,15 @@
               </u-upload>
            </u-form-item>
            <u-form-item prop="expirationTimeDriver"
               label="驾驶证过期时间"
               labelWidth="20%"
               label="证件过期时间"
               labelWidth="35%"
               borderBottom
               v-if="radiovalue1 == '司机'">
               <uni-datetime-picker v-model="registerFormModel.expirationTimeDriver" type="date"  :start="minDate" />
            </u-form-item>
            <u-form-item prop="tradeQualificationImg"
               label="从业资格证"
               labelWidth="24%"
               labelWidth="35%"
               borderBottom
               v-if="radiovalue1 == '司机'"
               @click="beforeRead">
@@ -245,15 +241,15 @@
               </span>
            </u-form-item>
            <u-form-item prop="expirationTimeTradequalification"
               label="从业资格过期时间"
               labelWidth="20%"
               label="证件过期时间"
               labelWidth="35%"
               borderBottom
               v-if="radiovalue1 == '司机'">
               <uni-datetime-picker v-model="registerFormModel.expirationTimeTradequalification" type="date"  :start="minDate" />
            </u-form-item>
            <u-form-item labelWidth="20%"
            <u-form-item labelWidth="35%"
               v-if="radiovalue1 == '司机'"
               label="环保类型"
               label="排放类型"
               borderBottom
               prop="countryNumberCar">
               <u-radio-group v-model="registerFormModel.countryNumberCar"
@@ -378,6 +374,7 @@
        return callback()
      };
         return {
            tablist:[{idCard:""},{idCard:""}],
        level:[],  //密码强度数组
            minDate: this.getToday(),
            // 车牌号键盘控制
@@ -398,7 +395,7 @@
               confirmPassword: '',
               tradeQualificationImg: '',
               driverImg: '',
               countryNumberCar: 2, //环保类型;国五 1,国六 2
               countryNumberCar: 2, //排放类型;国五 1,国六 2
               carType:null,
            },
            fileList1: [],
@@ -409,9 +406,6 @@
            fileList6: [],
            rules: {
               countryNumberCar: {
                  required: false,
               },
               expirationTimeIdcard: {
                  required: false,
               },
               expirationTimeDriving: {
@@ -550,12 +544,8 @@
                  value:2
               },
               {
                  text: '液氯槽车',
                  text: '槽车',
                  value:3
               },
               {
                  text: '液碱槽车',
                  value:4
               }
            ],
            countryNumberCarList: [{
@@ -618,11 +608,10 @@
           return value.toString().padStart(2, '0');
         },
         productcarTypeChange(e){
            console.log(this.registerFormModel.carType,this.radiolist2.find(v => v.value === e).value)
            this.registerFormModel.carType = this.radiolist2.find(v => v.value === e).value
         },
         registerClick() {
        if(this.registerFormModel.carType==3&&!this.registerFormModel.tradeQualificationImg||this.registerFormModel.carType==4&&!this.registerFormModel.tradeQualificationImg){
        if(this.registerFormModel.carType==3&&!this.registerFormModel.tradeQualificationImg){
          uni.showToast({
            title: '请上传从业资格证!',
            icon: 'error',
@@ -634,38 +623,37 @@
              .then(res => {
                this.registerClickloading = true;
                this.registerFormModel.username = this.registerFormModel.phone;
                this.registerFormModel.idCardImg = this.registerFormModel.cardImg1+","+this.registerFormModel.cardImg2;
            if(this.radiovalue1 == '货代'){
               this.registerFormModel.idCardImg = this.registerFormModel.cardImg1+","+this.registerFormModel.cardImg2;
            }
                if(this.registerFormModel.expirationTimeDriver){
                  this.registerFormModel.expirationTimeDriver=this.registerFormModel.expirationTimeDriver.slice(0,16)
                }
                if(this.registerFormModel.expirationTimeDriving){
                  this.registerFormModel.expirationTimeDriving=this.registerFormModel.expirationTimeDriving.slice(0,16)
                }
                if(this.registerFormModel.expirationTimeIdcard){
                  this.registerFormModel.expirationTimeIdcard=this.registerFormModel.expirationTimeIdcard.slice(0,16)
                }
                if(this.registerFormModel.expirationTimeTradequalification){
                  this.registerFormModel.expirationTimeTradequalification=this.registerFormModel.expirationTimeTradequalification.slice(0,16)
                }
                this.$reqPost('registerDriver', this.registerFormModel, 'json')
                    .then(res => {
                      this.registerClickloading = false;
                      if (res.code == 0) {
                        uni.showToast({
                          title: '注册成功,即将返回登录页',
                          icon: 'none',
                          duration: 1000
                        });
                        setTimeout(() => {
                          uni.redirectTo({ url: '/pages/login/login' });
                        }, 1000);
                      } else {
                        this.$u.toast(res.msg ? res.msg : '添加失败');
                      }
                    })
                    .catch(err => {
                      console.log('错误', err);
                    });
            this.$reqPost('registerDriver', this.registerFormModel, 'json')
               .then(res => {
                 this.registerClickloading = false;
                 if (res.code == 0) {
                  uni.showToast({
                    title: '注册成功,即将返回登录页',
                    icon: 'none',
                    duration: 1000
                  });
                  setTimeout(() => {
                    uni.redirectTo({ url: '/pages/login/login' });
                  }, 1000);
                 } else {
                  this.$u.toast(res.msg ? res.msg : '添加失败');
                 }
               })
               .catch(err => {
                 console.log('错误', err);
               });
              })
              .catch(err => {
                console.log('err', err);
@@ -685,6 +673,14 @@
            ) {
               this.$refs.regesterFormRef.clearValidate();
               this.beforeChangeValue = e;
            }
         },
         addData(){
            this.tablist.push({idCard:""})
         },
         delData(e){
            if(this.tablist.length>2){
               this.tablist.splice(e,1)
            }
         },
         jiaoYanPassword() {
@@ -800,7 +796,7 @@
         .u-form {
            .u-radio {
               width: 33%;
               width: 35%;
            }
         }
      }