431 lines
16 KiB
Vue
431 lines
16 KiB
Vue
<template>
|
|
<view v-if="userInfo && userInfo.person">
|
|
<el-row :gutter="10">
|
|
<el-col :span="12">
|
|
<el-form-item label="真实姓名" required>
|
|
<el-input v-model="form.person.personName" v-if="isEdit"/>
|
|
<text v-else>{{ userInfo.person.personName }}</text>
|
|
</el-form-item>
|
|
</el-col>
|
|
<!-- <el-col :span="12">-->
|
|
<!-- <el-form-item label="主营类目" required>-->
|
|
<!-- <el-input v-model="form.person.businessType" v-if="isEdit"/>-->
|
|
<!-- <text v-else>{{ userInfo.person.businessType }}</text>-->
|
|
<!-- </el-form-item>-->
|
|
<!-- </el-col>-->
|
|
</el-row>
|
|
<!-- <el-form-item label="主营商品" required>-->
|
|
<!-- <el-checkbox-group v-model="form.person.mainSpotCategoryIds" v-if="isEdit">-->
|
|
<!-- <el-checkbox v-for="(item, index) in goodsCate" :key="index" :label="item._id">-->
|
|
<!-- {{ item.name }}-->
|
|
<!-- </el-checkbox>-->
|
|
<!-- </el-checkbox-group>-->
|
|
<!-- <template v-else>-->
|
|
<!-- <text v-if="userInfo.person.mainSpotCategoryIds">-->
|
|
<!-- {{-->
|
|
<!-- userInfo.person.mainSpotCategoryIds.length ? userInfo.person.mainSpotCategoryIds.map(item => goodsCate.find(i => i._id === item) ? goodsCate.find(i => i._id === item).name : '').join('、') : ''-->
|
|
<!-- }}-->
|
|
<!-- </text>-->
|
|
<!-- </template>-->
|
|
<!-- </el-form-item>-->
|
|
<el-form-item label="行业分类">
|
|
<el-select v-model="form.person.businessType" placeholder="请选择行业分类" v-if="isEdit">
|
|
<el-option
|
|
v-for="(item, index) in industryList"
|
|
:key="index"
|
|
:label="item.name"
|
|
:value="item.name">
|
|
</el-option>
|
|
</el-select>
|
|
<!-- <el-input v-model="form.company.businessType" v-if="isEdit"/>-->
|
|
<text v-else>{{ userInfo.person.businessType }}</text>
|
|
</el-form-item>
|
|
<el-form-item label="现居住所在地" required>
|
|
<el-row :gutter="10" v-if="isEdit">
|
|
<el-col :span="8">
|
|
<el-select v-model="addressIndex[0]" placeholder="请选择省" class="w-100p">
|
|
<el-option v-for="(item, index) in provinceData" :key="index"
|
|
:label="item.name"
|
|
:value="index">
|
|
</el-option>
|
|
</el-select>
|
|
</el-col>
|
|
<el-col :span="7">
|
|
<el-select v-model="addressIndex[1]" placeholder="请选择市" class="w-100p"
|
|
:readonly="addressIndex.length === 0 || [0, 1].includes(userInfo.authStatus)">
|
|
<template v-if="addressIndex[0] !== null">
|
|
<el-option v-for="(item, index) in cityData[addressIndex[0]]" :key="index"
|
|
:label="item.name"
|
|
:value="index">
|
|
</el-option>
|
|
</template>
|
|
</el-select>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-select v-model="addressIndex[2]" placeholder="请选择区" class="w-100p">
|
|
<template v-if="addressIndex[0] !== null && addressIndex[1] !== null">
|
|
<el-option
|
|
v-for="(item, index) in areaData[addressIndex[0]][addressIndex[1]]"
|
|
:key="index" :label="item.name" :value="index">
|
|
</el-option>
|
|
</template>
|
|
</el-select>
|
|
</el-col>
|
|
</el-row>
|
|
<view v-else-if="!isEdit && userInfo.person.addressRegion">
|
|
<text>{{
|
|
userInfo.person.addressRegion.province ? userInfo.person.addressRegion.province.name : ''
|
|
}}
|
|
</text>
|
|
<text>{{
|
|
userInfo.person.addressRegion.city ? userInfo.person.addressRegion.city.name : ''
|
|
}}
|
|
</text>
|
|
<text>{{
|
|
userInfo.person.addressRegion.area ? userInfo.person.addressRegion.area.name : ''
|
|
}}
|
|
</text>
|
|
<text>{{ userInfo.person.addressDetail ? userInfo.person.addressDetail : '' }}</text>
|
|
</view>
|
|
<el-input v-model="form.person.addressDetail" placeholder="请输入详细地址" v-if="isEdit"/>
|
|
</el-form-item>
|
|
<el-form-item label="有效通信地址">
|
|
<text>{{ form.person.address }}</text>
|
|
</el-form-item>
|
|
<el-row :gutter="10">
|
|
<el-col :span="8">
|
|
<el-form-item label="个人账号" required>
|
|
<el-input v-model="form.person.personAccount" v-if="isEdit"/>
|
|
<text v-else>{{ userInfo.person.personAccount }}</text>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="个人开户行" required>
|
|
<el-input v-model="form.person.personBankName" v-if="isEdit"/>
|
|
<text v-else>{{ userInfo.person.personBankName }}</text>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="个人账户名" required>
|
|
<el-input v-model="form.person.accountName" v-if="isEdit"/>
|
|
<text v-else>{{ userInfo.person.accountName }}</text>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="10">
|
|
<el-form-item label="联系方式" required>
|
|
<el-col :span="8">
|
|
<el-input v-model="form.person.mobile" v-if="isEdit" placeholder="请输入手机号码"/>
|
|
<text v-else>{{ userInfo.person.mobile }}</text>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-input v-model="form.person.qq" v-if="isEdit" placeholder="请输入QQ号码"/>
|
|
<text v-else>{{ userInfo.person.qq }}</text>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-input v-model="form.person.contactEmail" v-if="isEdit" placeholder="请输入邮箱地址"/>
|
|
<text v-else>{{ userInfo.person.contactEmail }}</text>
|
|
</el-col>
|
|
</el-form-item>
|
|
</el-row>
|
|
<el-row :gutter="10">
|
|
<el-col :span="8">
|
|
<el-form-item label="短信验证码" required>
|
|
<el-input v-model="form.smsCode" :disabled="!form.person.mobile" v-if="isEdit"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-button type="primary" :disabled="!form.person.mobile || codeDisabled" @click="sendSmsCode">
|
|
{{ smsTips }}
|
|
</el-button>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<text>(请勿告知他人相关信息)</text>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<!-- <el-form-item label="平台交易账号认证" required v-if="isEdit">-->
|
|
<!-- <div v-html="authBankInfo"></div>-->
|
|
<!-- </el-form-item>-->
|
|
<!-- <el-form-item label="金久信平台幕布照" required>-->
|
|
<!-- <view class="flex justify-start items-center" v-if="isEdit">-->
|
|
<!-- <vk-data-upload :limit="1" v-model="form.person.photo"></vk-data-upload>-->
|
|
<!-- <text class="text-main ml-20 pointer" @click="openDownload">电子版文件下载</text>-->
|
|
<!-- </view>-->
|
|
<!-- <el-image :src="userInfo.person.photo" style="width: 100px;height: 100px" fit="cover"-->
|
|
<!-- v-else-if="!isEdit && userInfo.person.photo && userInfo.person.photo.includes('.')"/>-->
|
|
<!-- </el-form-item>-->
|
|
<view class="flex justify-start items-center">
|
|
<view class="flex justify-start items-center" v-if="[1, 2].includes(userInfo.authStatus)">
|
|
<view class="mr-15">
|
|
<el-button type="primary" plain @click.native="changeEdit">{{
|
|
isEdit ? '取消' : '编辑'
|
|
}}
|
|
</el-button>
|
|
</view>
|
|
<el-button v-if="userInfo.authStatus === 1" type="primary" @click.native="submit(0)"
|
|
:disabled="!isEdit">提交个人认证
|
|
</el-button>
|
|
</view>
|
|
<el-button type="primary" @click.native="submit()"
|
|
v-if="userInfo.authStatus === null || [-1, 2].includes(userInfo.authStatus)">提交个人认证
|
|
</el-button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import provinces from "@/uni_modules/vk-uview-ui/libs/address/provinces.json";
|
|
import citys from "@/uni_modules/vk-uview-ui/libs/address/citys.json";
|
|
import areas from "@/uni_modules/vk-uview-ui/libs/address/areas.json";
|
|
import key from "@icon-park/vue/lib/icons/Key";
|
|
|
|
let timer = null
|
|
let timeS = 60
|
|
|
|
export default {
|
|
name: "personalAuth",
|
|
data() {
|
|
return {
|
|
isEdit: false,
|
|
authBankInfo: '',
|
|
authPhotoBack: '',
|
|
provinceData: provinces,
|
|
cityData: citys,
|
|
areaData: areas,
|
|
addressIndex: [null, null, null],
|
|
form: {
|
|
person: {
|
|
personName: '',
|
|
address: '',
|
|
businessType: '',
|
|
addressRegion: {},
|
|
addressDetail: '',
|
|
mobile: '',
|
|
qq: '',
|
|
contactEmail: '',
|
|
personAccount: '',
|
|
personBankName: '',
|
|
accountName: '',
|
|
photo: '',
|
|
mainSpotCategoryIds: []
|
|
},
|
|
smsCode: '',
|
|
},
|
|
smsTips: '点击获取',
|
|
codeDisabled: false,
|
|
goodsCate: [],
|
|
industryList: [],
|
|
userInfo: {}
|
|
}
|
|
},
|
|
methods: {
|
|
async getIndustryList() {
|
|
const {rows} = await vk.callFunction({
|
|
url: 'client/industry/pub/getList'
|
|
})
|
|
this.industryList = rows
|
|
},
|
|
getGoodsCate() {
|
|
vk.callFunction({
|
|
url: 'client/spot/category/pub/getList',
|
|
data: {
|
|
whereJson: {
|
|
level: 2
|
|
}
|
|
},
|
|
success: (res) => {
|
|
this.goodsCate = res.data
|
|
}
|
|
});
|
|
},
|
|
getAuthBankInfo() {
|
|
vk.callFunction({
|
|
url: 'client/dict/pub/getDetail',
|
|
data: {
|
|
id: '657d38a8337a9f0756cb3b22'
|
|
},
|
|
success: res => {
|
|
this.authBankInfo = res.content
|
|
}
|
|
});
|
|
},
|
|
getAuthPhoto() {
|
|
vk.callFunction({
|
|
url: 'client/dict/pub/getDetail',
|
|
data: {
|
|
id: '657d3a178b0da41d31112468'
|
|
},
|
|
success: res => {
|
|
this.authPhotoBack = res.content
|
|
}
|
|
});
|
|
},
|
|
openDownload() {
|
|
window.open(this.authPhotoBack)
|
|
},
|
|
async submit(authStatus = 0) {
|
|
if (!this.form.person.personName) return this.$message({
|
|
type: 'error',
|
|
message: '请输入真实姓名'
|
|
})
|
|
// if (!this.form.person.businessType) return this.$message({
|
|
// type: 'error',
|
|
// message: '请选择行业分类'
|
|
// })
|
|
// if (this.form.person.mainSpotCategoryIds.length === 0) return this.$message({
|
|
// type: 'error',
|
|
// message: '请选择主营商品'
|
|
// })
|
|
if (!this.form.person.mobile) return this.$message({
|
|
type: 'error',
|
|
message: '请输入联系方式'
|
|
})
|
|
if (!this.form.person.personAccount) return this.$message({
|
|
type: 'error',
|
|
message: '请填写个人账号'
|
|
})
|
|
if (!this.form.person.personBankName) return this.$message({
|
|
type: 'error',
|
|
message: '请选择个人开户行'
|
|
})
|
|
if (!this.form.person.accountName) return this.$message({
|
|
type: 'error',
|
|
message: '请选择个人账户名'
|
|
})
|
|
// if (!this.form.person.photo) return this.$message({
|
|
// type: 'error',
|
|
// message: '请上传平台幕布照'
|
|
// })
|
|
if (!this.form.smsCode) return this.$message({
|
|
type: 'error',
|
|
message: '请输入短信验证码'
|
|
})
|
|
if (this.addressIndex[2] === null) return this.$message({
|
|
type: 'error',
|
|
message: '请完善居住所在地'
|
|
})
|
|
|
|
// this.form.person.addressRegion.province = this.provinceData[this.addressIndex[0]]
|
|
// this.form.person.addressRegion.city = this.cityData[this.addressIndex[0]][this.addressIndex[1]]
|
|
// this.form.person.addressRegion.area = this.areaData[this.addressIndex[0]][this.addressIndex[1]][this.addressIndex[2]]
|
|
const data = {...this.form, ...{authStatus}}
|
|
if (authStatus === 0) data.authType = 2
|
|
await vk.callFunction({
|
|
url: 'client/user/kh/addAuth',
|
|
title: '提交中...',
|
|
data
|
|
})
|
|
this.$message({
|
|
type: 'success',
|
|
message: '提交成功'
|
|
})
|
|
setTimeout(() => {
|
|
window.location.reload()
|
|
}, 1500)
|
|
},
|
|
sendSmsCode() {
|
|
if (timer != null) return
|
|
this.codeDisabled = true
|
|
vk.userCenter.sendSmsCode({
|
|
loading: true,
|
|
data: {
|
|
mobile: this.form.person.mobile,
|
|
type: 'verify',
|
|
},
|
|
success: (data) => {
|
|
this.codeDisabled = false
|
|
this.$message({
|
|
message: "验证码已发送",
|
|
type: 'success'
|
|
})
|
|
timeS = 60
|
|
timer = setInterval(() => {
|
|
timeS--
|
|
if (timeS <= 0) {
|
|
this.smsTips = "重新发送"
|
|
this.stopTimer()
|
|
} else {
|
|
this.smsTips = timeS + "秒"
|
|
}
|
|
|
|
}, 1000)
|
|
}
|
|
})
|
|
},
|
|
stopTimer() {
|
|
if (timer != null) {
|
|
clearInterval(timer)
|
|
timer = null
|
|
}
|
|
},
|
|
selectRegion() {
|
|
this.form.person.address = ''
|
|
if (this.addressIndex[0] !== null) {
|
|
this.form.person.address = this.provinceData[this.addressIndex[0]].name
|
|
this.form.person.addressRegion.province = this.provinceData[this.addressIndex[0]]
|
|
if (this.addressIndex[1] !== null) {
|
|
this.form.person.address += this.cityData[this.addressIndex[0]][this.addressIndex[1]].name
|
|
this.form.person.addressRegion.city = this.cityData[this.addressIndex[0]][this.addressIndex[1]]
|
|
if (this.addressIndex[2] !== null) {
|
|
this.form.person.address += this.areaData[this.addressIndex[0]][this.addressIndex[1]][this.addressIndex[2]].name
|
|
this.form.person.addressRegion.area = this.areaData[this.addressIndex[0]][this.addressIndex[1]][this.addressIndex[2]]
|
|
}
|
|
}
|
|
}
|
|
if (this.form.person.addressDetail) this.form.person.address += this.form.person.addressDetail
|
|
},
|
|
changeEdit() {
|
|
this.isEdit = !this.isEdit
|
|
this.codeDisabled = !this.isEdit
|
|
}
|
|
},
|
|
mounted() {
|
|
this.getGoodsCate()
|
|
this.getIndustryList()
|
|
vk.userCenter.getCurrentUserInfo({
|
|
success: (data) => {
|
|
this.userInfo = data.userInfo
|
|
|
|
this.isEdit = this.userInfo.authStatus === -1
|
|
this.codeDisabled = !this.isEdit
|
|
if (this.userInfo.person) for (let key in this.form.person) this.form.person[key] = this.userInfo.person[key]
|
|
if (JSON.stringify(this.userInfo.person.addressRegion) !== "{}" && this.userInfo.person.addressRegion && this.userInfo.person.addressRegion.province) {
|
|
this.addressIndex[0] = this.provinceData.findIndex(item => parseInt(item.code) === parseInt(this.userInfo.person.addressRegion.province.code))
|
|
if (this.addressIndex[0] !== -1) {
|
|
this.addressIndex[1] = this.cityData[this.addressIndex[0]].findIndex(item => parseInt(item.code) === parseInt(this.userInfo.person.addressRegion.city.code))
|
|
if (this.addressIndex[1] !== -1) {
|
|
this.addressIndex[2] = this.areaData[this.addressIndex[0]][this.addressIndex[1]].findIndex(item => parseInt(item.code) === parseInt(this.userInfo.person.addressRegion.area.code))
|
|
}
|
|
}
|
|
} else {
|
|
this.form.person.addressRegion = {
|
|
province: {
|
|
code: '',
|
|
name: ''
|
|
},
|
|
city: {
|
|
code: '',
|
|
name: ''
|
|
},
|
|
area: {
|
|
code: '',
|
|
name: ''
|
|
}
|
|
}
|
|
}
|
|
if (!this.userInfo.person.mainSpotCategoryIds) {
|
|
this.userInfo.person.mainSpotCategoryIds = []
|
|
this.form.person.mainSpotCategoryIds = []
|
|
}
|
|
if (!this.userInfo.person.personAccount && this.userInfo.person.bankCardNo)
|
|
this.form.person.personAccount = this.userInfo.person.bankCardNo
|
|
if (!this.userInfo.person.accountName && this.userInfo.person.personName)
|
|
this.form.person.accountName = this.userInfo.person.personName
|
|
// this.getAuthBankInfo()
|
|
// this.getAuthPhoto()
|
|
}
|
|
})
|
|
}
|
|
}
|
|
</script> |