|
|
@ -29,11 +29,29 @@ |
|
|
|
<view class="se-py-20 se-w-p-100 se-flex"> |
|
|
|
<view class="line-orange"></view> |
|
|
|
<view class="se-ml-10"> |
|
|
|
身份证上传(正反面) |
|
|
|
身份证上传(正面) |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="se-py-20 se-w-p-100"> |
|
|
|
<u-upload :fileList="form.idCardFile" @afterRead="afterRead" @delete="deletePic" name="1" |
|
|
|
<u-upload :fileList="form.cerImageBackFile" @afterRead="afterCerImageBackFileRead" @delete="deleteCerImageBackFilePic" name="1" |
|
|
|
multiple :maxCount="10"></u-upload> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</u-form-item> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="se-p-20"> |
|
|
|
<view class="se-px-20 se-pb-20 se-bgc-white se-br-10 se-fs-20"> |
|
|
|
<u-form-item prop="file" labelWidth="2"> |
|
|
|
<view class="se-flex se-flex-v-sa"> |
|
|
|
<view class="se-py-20 se-w-p-100 se-flex"> |
|
|
|
<view class="line-orange"></view> |
|
|
|
<view class="se-ml-10"> |
|
|
|
身份证上传(反面) |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="se-py-20 se-w-p-100"> |
|
|
|
<u-upload :fileList="form.cerImageFrontFile" @afterRead="afterCerImageFrontRead" @delete="deleteCerImageFrontReadPic" name="1" |
|
|
|
multiple :maxCount="10"></u-upload> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -56,7 +74,7 @@ |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import {roleBoss,industryList,updateRoleBoss} from "@/common/api.js" |
|
|
|
import {roleBoss,industryList,updateRoleBoss,queryCategoryList,addAuthenticationPerson,getAuthenticationPerson} from "@/common/api.js" |
|
|
|
export default{ |
|
|
|
data(){ |
|
|
|
return{ |
|
|
@ -72,7 +90,8 @@ |
|
|
|
address:'', |
|
|
|
industryId:'', |
|
|
|
industryName:'', |
|
|
|
idCardFile:[] |
|
|
|
cerImageBackFile:[], |
|
|
|
cerImageFrontFile:[] |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
name: [{ |
|
|
@ -113,7 +132,19 @@ |
|
|
|
message: '请选择行业', |
|
|
|
trigger: ['blur', 'change'] |
|
|
|
}], |
|
|
|
idCardFile:[ |
|
|
|
cerImageBackFile:[ |
|
|
|
{ |
|
|
|
validator: (rule, value, callback) => { |
|
|
|
if (value === null || value === undefined || value === '' || (Array.isArray(value) && value.length === 0)) { |
|
|
|
callback(new Error('请选择身份证')); |
|
|
|
} else { |
|
|
|
callback(); |
|
|
|
} |
|
|
|
}, |
|
|
|
trigger: 'blur' |
|
|
|
} |
|
|
|
], |
|
|
|
cerImageFrontFile:[ |
|
|
|
{ |
|
|
|
validator: (rule, value, callback) => { |
|
|
|
if (value === null || value === undefined || value === '' || (Array.isArray(value) && value.length === 0)) { |
|
|
@ -132,22 +163,43 @@ |
|
|
|
|
|
|
|
}, |
|
|
|
onReady() { |
|
|
|
this.onIndustryList() |
|
|
|
this.onAuthenticationPerson() |
|
|
|
this.onQueryCategoryList() |
|
|
|
this.$refs.uForm.setRules(this.rules) |
|
|
|
}, |
|
|
|
|
|
|
|
mounted() { |
|
|
|
let worker = uni.getStorageSync("worker") |
|
|
|
if(worker){ |
|
|
|
this.form.id = worker.id |
|
|
|
this.form.name = worker.userName |
|
|
|
this.form.mobile = worker.phone |
|
|
|
this.form.industryId = worker.industryId |
|
|
|
this.form.industryName = worker.industryName |
|
|
|
this.form.idCardFile = this.stringToKeyValueArray(worker.idCard) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
|
|
|
|
onAuthenticationPerson(){ |
|
|
|
let params={} |
|
|
|
getAuthenticationPerson(params).then(response=>{ |
|
|
|
let person = response.result |
|
|
|
if(response.result){ |
|
|
|
this.form.id = person.id |
|
|
|
this.form.name = person.name |
|
|
|
this.form.mobile = person.phone |
|
|
|
this.form.address = person.address |
|
|
|
this.form.industryId = person.industry |
|
|
|
this.form.industryName = person.industryName |
|
|
|
this.form.cerImageBackFile = this.stringToKeyValueArray(person.cerImageBack) |
|
|
|
this.form.cerImageFrontFile = this.stringToKeyValueArray(person.cerImageFront) |
|
|
|
} |
|
|
|
}).catch(error=>{ |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
onQueryCategoryList(){ |
|
|
|
queryCategoryList({}).then(response=>{ |
|
|
|
console.info(response) |
|
|
|
this.indList = response.result |
|
|
|
}).catch(error=>{ |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
stringToKeyValueArray(str, delimiter1 = ',') { |
|
|
|
if(str){ |
|
|
|
let arro = str.split(delimiter1); |
|
|
@ -172,14 +224,6 @@ |
|
|
|
this.form.industryName = event.name |
|
|
|
this.show = false |
|
|
|
}, |
|
|
|
onIndustryList(){ |
|
|
|
industryList({}).then(response=>{ |
|
|
|
console.info(response) |
|
|
|
this.indList = response.result |
|
|
|
}).catch(error=>{ |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
submit() { |
|
|
|
let that = this |
|
|
|
that.$refs.uForm.validate().then(res => { |
|
|
@ -193,26 +237,27 @@ |
|
|
|
let that = this |
|
|
|
let params={ |
|
|
|
id:that.form.id, |
|
|
|
userName:that.form.name, |
|
|
|
name:that.form.name, |
|
|
|
role:that.form.role, |
|
|
|
phone:that.form.mobile, |
|
|
|
industryId:that.form.industryId, |
|
|
|
industry:that.form.industryId, |
|
|
|
industryName:that.form.industryName, |
|
|
|
idCard:that.form.idCardFile.map(item => item.url).join(','), |
|
|
|
cerImageBack:that.form.cerImageBackFile.map(item => item.url).join(','), |
|
|
|
cerImageFront:that.form.cerImageFrontFile.map(item => item.url).join(','), |
|
|
|
} |
|
|
|
if(that.form.id){ |
|
|
|
updateRoleBoss(params).then(response=>{ |
|
|
|
uni.$u.toast("保存成功!") |
|
|
|
setTimeout(()=>{ |
|
|
|
uni.navigateBack({ |
|
|
|
delta:1 |
|
|
|
}) |
|
|
|
},1500) |
|
|
|
}).catch(error=>{ |
|
|
|
// if(that.form.id){ |
|
|
|
// updateRoleBoss(params).then(response=>{ |
|
|
|
// uni.$u.toast("保存成功!") |
|
|
|
// setTimeout(()=>{ |
|
|
|
// uni.navigateBack({ |
|
|
|
// delta:1 |
|
|
|
// }) |
|
|
|
// },1500) |
|
|
|
// }).catch(error=>{ |
|
|
|
|
|
|
|
}) |
|
|
|
}else{ |
|
|
|
roleBoss(params).then(response=>{ |
|
|
|
// }) |
|
|
|
// }else{ |
|
|
|
addAuthenticationPerson(params).then(response=>{ |
|
|
|
uni.$u.toast("提交成功,等待申请") |
|
|
|
setTimeout(()=>{ |
|
|
|
uni.switchTab({ |
|
|
@ -222,16 +267,29 @@ |
|
|
|
}).catch(error=>{ |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
// } |
|
|
|
}, |
|
|
|
deleteCerImageBackFilePic(event) { |
|
|
|
this.form.cerImageBackFile.splice(e.index, 1) |
|
|
|
}, |
|
|
|
async afterCerImageBackFileRead(e) { |
|
|
|
let self = this |
|
|
|
e.file.forEach(file => { |
|
|
|
self.$Oss.ossUpload(file.url).then(url => { |
|
|
|
self.form.cerImageBackFile.push({ |
|
|
|
url |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
deletePic(event) { |
|
|
|
this.form.idCardFile.splice(e.index, 1) |
|
|
|
deleteCerImageFrontReadPic(event) { |
|
|
|
this.form.cerImageFrontFile.splice(e.index, 1) |
|
|
|
}, |
|
|
|
async afterRead(e) { |
|
|
|
async afterCerImageFrontRead(e) { |
|
|
|
let self = this |
|
|
|
e.file.forEach(file => { |
|
|
|
self.$Oss.ossUpload(file.url).then(url => { |
|
|
|
self.form.idCardFile.push({ |
|
|
|
self.form.cerImageFrontFile.push({ |
|
|
|
url |
|
|
|
}) |
|
|
|
}) |
|
|
|