| | |
| | | <el-row> |
| | | <el-col :span="20"> |
| | | <el-form-item label="终端机用户名" prop="enterprisenumber"> |
| | | <el-input v-model="registerForm.enterprisenumber" @change="checkNameAndNumber('number')" placeholder="自定义英文+数字,将作为销售终端用户名"></el-input> |
| | | <el-input v-model="registerForm.enterprisenumber" @change="checkNameAndNumber('number')" placeholder="自定义英文或数字,将作为销售终端用户名"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4" style="margin-top:10px;" v-if="showNumber"> |
| | |
| | | import {isNameExist, isNumberExist, register} from "../../api/login"; |
| | | import {getCityListData, getProvinceListData} from "../../api/area"; |
| | | import {parseError} from "../../utils/messageDialog"; |
| | | import {validEnterName, validEnterNumber, verifyPwd} from "../../utils/validate"; |
| | | |
| | | export default { |
| | | name: "register", |
| | | data(){ |
| | | let checkEnterName = (rule, value, callback)=>{ |
| | | if(value === ''){ |
| | | callback(new Error('请填写企业名称')) |
| | | }else{ |
| | | if(!validEnterName(value)){ |
| | | callback(new Error('名称不能包含中文括号')) |
| | | }else{ |
| | | callback() |
| | | } |
| | | } |
| | | } |
| | | let checkNumber = (rule, value, callback)=>{ |
| | | if(value === ''){ |
| | | callback(new Error('请填写终端机用户名')) |
| | | }else{ |
| | | if(!validEnterNumber(value)){ |
| | | callback(new Error('名称请使用英文或数字(长度2到30),不能包含中文')) |
| | | }else{ |
| | | callback() |
| | | } |
| | | } |
| | | } |
| | | let checkPassword = (rule, value, callback)=>{ |
| | | if(value === ''){ |
| | | callback(new Error('请填写密码')) |
| | | }else{ |
| | | if(!verifyPwd(value)){ |
| | | callback(new Error('密码须同时包含字母、数字、特殊字符,长度在6-16之间')) |
| | | }else{ |
| | | callback() |
| | | } |
| | | } |
| | | } |
| | | return{ |
| | | showNumber:false, |
| | | showName:false, |
| | |
| | | safetyProduction:[], |
| | | rules:{ |
| | | enterprisename:[ |
| | | { required: true, message: '请填写企业名称', trigger: 'blur' }, |
| | | { required: true, validator: checkEnterName, trigger: 'blur' }, |
| | | ], |
| | | enterprisenumber:[ |
| | | { required: true, message: '请填写终端机用户名', trigger: 'blur' }, |
| | | { required: true, validator: checkNumber, trigger: 'blur' }, |
| | | ], |
| | | password:[ |
| | | { required: true, message: '请填写密码', trigger: 'change' }, |
| | | { required: true, validator: checkPassword, trigger: 'change' }, |
| | | ], |
| | | type:[ |
| | | { required: true, message: '请选择企业类型', trigger: 'blur' }, |
| | |
| | | async submit(){ |
| | | this.$refs["ruleForm"].validate((valid) =>{ |
| | | if(valid){ |
| | | if(this.registerForm.type === '烟花爆竹生产' && this.businessLicense.length !== 0 && this.idCard.length !== 0 && this.legalPerson.length !== 0 && this.operationQualification.length !== 0 && this.escortCompany.length !== 0 && this.insurance.length !==0){ |
| | | // console.log(this.registerForm.type,'type',this.businessLicense, this.idCard,this.legalPerson,this.operationQualification,this.escortCompany,this.insurance) |
| | | if(this.registerForm.type === '烟花爆竹生产'){ |
| | | this.businessLicense = this.businessLicense.map((item,index,arr) =>{ |
| | | return item.raw |
| | | },this.businessLicense) |
| | |
| | | }).catch(error => { |
| | | parseError({error: error, vm: this}) |
| | | }) |
| | | }else if(this.registerForm.type === '烟花爆竹批发经营'&& this.businessLicense.length !== 0 && this.idCard.length !== 0 && this.legalPerson.length !== 0 && this.operationQualification.length !== 0 && this.escortCompany.length !== 0 && this.insurance.length !== 0 && this.safetyProduction.length !== 0){ |
| | | }else if(this.registerForm.type === '烟花爆竹批发经营'){ |
| | | this.businessLicense = this.businessLicense.map((item,index,arr) =>{ |
| | | return item.raw |
| | | },this.businessLicense) |
| | |
| | | }).catch(error => { |
| | | parseError({error: error, vm: this}) |
| | | }) |
| | | }else if(this.registerForm.type === '烟花爆竹零售经营(长期)' && this.businessLicense.length !== 0 && this.idCard.length !== 0 && this.legalPerson.length !== 0 && this.insurance.length !== 0){ |
| | | }else if(this.registerForm.type === '烟花爆竹零售经营(长期)'){ |
| | | this.businessLicense = this.businessLicense.map((item,index,arr) =>{ |
| | | return item.raw |
| | | },this.businessLicense) |
| | |
| | | }).catch(error => { |
| | | parseError({error: error, vm: this}) |
| | | }) |
| | | }else if(this.registerForm.type==='烟花爆竹零售经营(短期)' && this.idCard.length !== 0 && this.legalPerson.length !== 0 && this.insurance.length !== 0){ |
| | | }else if(this.registerForm.type==='烟花爆竹零售经营(短期)'){ |
| | | this.businessLicense = this.businessLicense.map((item,index,arr) =>{ |
| | | return item.raw |
| | | },this.businessLicense) |
| | |
| | | message: '终端机用户名已存在', |
| | | }) |
| | | }else{ |
| | | this.$message({ |
| | | type:'success', |
| | | message:'终端机用户名可以使用' |
| | | }) |
| | | // this.$message({ |
| | | // type:'success', |
| | | // message:'终端机用户名可以使用' |
| | | // }) |
| | | this.showNumber = false |
| | | } |
| | | }else{ |