|
|
@@ -4,30 +4,41 @@
|
|
|
<app-navbar title="实名认证" />
|
|
|
</template>
|
|
|
<Form ref="formRef" class="g-form__container" @submit="onCheckCardNum" :loading="loading">
|
|
|
- <CellGroup inset>
|
|
|
- <Field v-model="formData.name" name="name" label="姓名" placeholder="请输入用户姓名" :rules="formRules.name"
|
|
|
- :readonly="isReadonly" />
|
|
|
- <Field v-model="formData.mobile" name="mobile" readonly label="手机号码" />
|
|
|
- <Field name="idCardType" label="证件类型" :rules="formRules.idCardType" is-link>
|
|
|
+ <!-- 个人 -->
|
|
|
+ <CellGroup v-if="getUserInfoType() === 1" inset>
|
|
|
+ <Field v-model="person.realName" :readonly="isReadonly && realName != ''" name="realName" label="姓名" placeholder="请输入用户姓名" :rules="PFormRules.realName" />
|
|
|
+ <Field v-model="person.mobile" name="mobile" readonly label="预留手机号" :rules="PFormRules.mobile"/>
|
|
|
+ <Field name="bankId" label="开户银行" :rules="PFormRules.bankId" is-link>
|
|
|
<template #input>
|
|
|
- <app-select v-model="formData.idCardType" placeholder="请选择证件类型"
|
|
|
- :options="getAQCertificateTypeList()" :readonly="isReadonly" />
|
|
|
+ <app-select v-model="person.bankId" placeholder="请选择开户银行" :readonly="isReadonly && bankaccount != ''" :options="banklist"
|
|
|
+ :optionProps="{ label: 'bankname', value: 'bankid' }" />
|
|
|
</template>
|
|
|
</Field>
|
|
|
- <Field v-model="formData.idCard" name="cardnum" label="证件号码" placeholder="请输入证件号码" :rules="formRules.idCard"
|
|
|
- :readonly="isReadonly" />
|
|
|
- <Field name="idCardPhoto" label="证件正面照片" :rules="formRules.idCardPhoto">
|
|
|
+ <Field label="银行卡号" v-model="person.bankCard" :readonly="isReadonly && bankaccount != ''" name="bankCard" placeholder="请输入银行卡号" :rules="PFormRules.bankCard" />
|
|
|
+ <span style="font-size: 12px; padding-left: 15px; color: #FF162F;">此银行卡作为后续签约银行卡,请谨慎填写</span>
|
|
|
+ <Field v-model="person.idCardNo" :readonly="isReadonly && cardnum != ''" name="idCardNo" label="证件号码" placeholder="请输入证件号码" :rules="PFormRules.idCardNo" />
|
|
|
+ <Field name="idCardPhoto" label="证件正面照片" :rules="PFormRules.idCardPhoto">
|
|
|
<template #input>
|
|
|
- <Image fit="contain" :src="getFileUrl(formData.idCardPhoto)" width="100" height="100"
|
|
|
- v-if="isReadonly" />
|
|
|
- <app-uploader @success="f_afterRead" v-else />
|
|
|
+ <app-uploader @success="f_afterRead" />
|
|
|
</template>
|
|
|
</Field>
|
|
|
- <Field name="idCardPhotoBackURL" label="证件反面照片" :rules="formRules.idCardPhotoBackURL">
|
|
|
+ <Field name="cardbackphotourl" label="证件反面照片" :rules="PFormRules.idCardPhotoBackURL">
|
|
|
<template #input>
|
|
|
- <Image fit="contain" :src="getFileUrl(formData.idCardPhotoBackURL)" width="100" height="100"
|
|
|
- v-if="isReadonly" />
|
|
|
- <app-uploader @success="b_afterRead" v-else />
|
|
|
+ <app-uploader @success="b_afterRead" />
|
|
|
+ </template>
|
|
|
+ </Field>
|
|
|
+ </CellGroup>
|
|
|
+ <!-- 企业 -->
|
|
|
+ <CellGroup inset v-else>
|
|
|
+ <Field v-model="company.realName" :readonly="isReadonly && realName != ''" name="realName" label="法人姓名" placeholder="请输入法人姓名" :rules="CFormRules.realName" />
|
|
|
+ <Field v-model="company.mobile" name="mobile" readonly label="法人手机号" />
|
|
|
+ <Field v-model="company.companyName" name="companyName" label="企业名称" placeholder="请输入企业名称" :rules="CFormRules.companyName" />
|
|
|
+ <Field v-model="company.creditCode" name="creditCode" label="信用代码" placeholder="请输入社会统一信用代码" :rules="CFormRules.creditCode" />
|
|
|
+ <Field v-model="company.bankCard" :readonly="isReadonly && bankaccount != ''" name="bankCard" label="法人银行卡号" placeholder="请输入法人银行卡号" :rules="CFormRules.bankCard" />
|
|
|
+ <Field v-model="company.idCardNo" :readonly="isReadonly && cardnum != ''" name="idCardNo" label="法人身份证号" placeholder="请输入法人身份证号" :rules="CFormRules.idCardNo" />
|
|
|
+ <Field name="idCardPhoto" label="营业执照" :rules="CFormRules.idCardPhoto">
|
|
|
+ <template #input>
|
|
|
+ <app-uploader @success="f_afterRead" />
|
|
|
</template>
|
|
|
</Field>
|
|
|
</CellGroup>
|
|
|
@@ -35,59 +46,79 @@
|
|
|
<img src="../../../assets/images/certification.png" />
|
|
|
<template #footer>
|
|
|
<div class="g-form__footer inset">
|
|
|
- <Button type="danger" :loading="buttonLoading" @click="onSubmit" round block>提交实名认证</Button>
|
|
|
+ <Button type="danger" :loading="buttonLoading" @click="formRef?.submit" round block>提交实名认证验证</Button>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <component ref="componentRef" v-bind="{ formData }" :is="componentMap.get(componentId)" @closed="closeComponent"
|
|
|
+ <component ref="componentRef" v-bind="{ serialNo }" :is="componentMap.get(componentId)" @closed="closeComponent"
|
|
|
v-if="componentId" />
|
|
|
</app-view>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { shallowRef, defineAsyncComponent, onMounted, computed } from 'vue'
|
|
|
-import { CellGroup, Button, Field, Form, FormInstance, showFailToast, FieldRule, Image } from 'vant'
|
|
|
+import { shallowRef, onMounted, ref, defineAsyncComponent } from 'vue'
|
|
|
+import { useComponent } from '@/hooks/component'
|
|
|
+import { CellGroup, Button, Field, Form, FormInstance, showFailToast, FieldRule } from 'vant'
|
|
|
import { fullloading, dialog } from '@/utils/vant'
|
|
|
-import { getFileUrl } from '@/filters'
|
|
|
-import { getAQCertificateTypeList } from "@/constants/account"
|
|
|
+import { getIdCardAge } from '@/filters'
|
|
|
import { useRequest } from '@/hooks/request'
|
|
|
-import { queryUserESignRecord, requestCheckCardNum } from '@/services/api/account'
|
|
|
-import { adddUserReq } from '@/business/user/account'
|
|
|
+import { queryTencentUsereSignRecords, requestCheckCardNum } from '@/services/api/account'
|
|
|
+import { useRequestBankCard4 } from '@/business/user/account'
|
|
|
import { validateRules } from '@/constants/regex'
|
|
|
-import { useComponent } from '@/hooks/component'
|
|
|
import { useUserStore } from '@/stores'
|
|
|
-import { getIdCardAge } from '@/filters'
|
|
|
import { useNavigation } from '@mobile/router/navigation'
|
|
|
-import AppSelect from '@mobile/components/base/select/index.vue'
|
|
|
+import { getUserId, getMemberUserId, getUserInfoType } from '@/services/methods/user'
|
|
|
+import { decryptAES } from '@/services/websocket/package/crypto'
|
|
|
+import { queryBankAccountSign } from '@/services/api/bank'
|
|
|
+import { useQueryCusBankSignBank } from '@/business/bank'
|
|
|
import AppUploader from '@mobile/components/base/uploader/index.vue'
|
|
|
+import AppSelect from '@mobile/components/base/select/index.vue'
|
|
|
|
|
|
const componentMap = new Map<string, unknown>([
|
|
|
- ['certification-next', defineAsyncComponent(() => import('./components/certification-next/Index.vue'))], // 爱签-实名认证第二步
|
|
|
+ ['captcha', defineAsyncComponent(() => import('./components/captcha/Index.vue'))],
|
|
|
])
|
|
|
-
|
|
|
+const { banklist } = useQueryCusBankSignBank()
|
|
|
const { router } = useNavigation()
|
|
|
const userStore = useUserStore()
|
|
|
const formRef = shallowRef<FormInstance>()
|
|
|
-const { formData, formSubmit, loading } = adddUserReq()
|
|
|
-
|
|
|
+/// 个人信息
|
|
|
+const person = ref<Model.PersonBankCard4>({})
|
|
|
+/// 公司信息
|
|
|
+const company = ref<Model.CompanyBankCard4>({})
|
|
|
+/// 四要素校验
|
|
|
+const { formData, onBankCard4, loading } = useRequestBankCard4()
|
|
|
+const { customername, mobile2, cardnum, legalpersonname } = userStore.userInfo
|
|
|
const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => {
|
|
|
router.back()
|
|
|
})
|
|
|
+/// 流水号
|
|
|
+const serialNo = ref<string>('')
|
|
|
+/// 是否只读
|
|
|
+const isReadonly = ref(false)
|
|
|
+const bankaccount = ref('')
|
|
|
+const realName = ref('')
|
|
|
|
|
|
-const isReadonly = computed(() => userESignRecords.value.some((e) => e.templatetype === 1 && e.recordstatus === 3))
|
|
|
+/// 查询托管银行信息
|
|
|
+useRequest(queryBankAccountSign, {
|
|
|
+ onSuccess: (res) => {
|
|
|
+ /// 签约状态
|
|
|
+ if (res.data.length != 0) {
|
|
|
+ /// 如果已经签约了 不允许修改信息
|
|
|
+ const { bankaccountname, bankaccountno2, bankid } = res.data[0]
|
|
|
+ isReadonly.value = res.data.some(e => [4].includes(e.signstatus))
|
|
|
+ person.value.bankCard = decryptAES(bankaccountno2)
|
|
|
+ person.value.bankId = bankid
|
|
|
+ bankaccount.value = bankaccountno2
|
|
|
+ realName.value = bankaccountname
|
|
|
+ person.value.realName = realName.value
|
|
|
+ }
|
|
|
+ }
|
|
|
+})
|
|
|
|
|
|
/// 查询记录
|
|
|
-const { loading: buttonLoading, dataList: userESignRecords, run: getUserESignRecord } = useRequest(queryUserESignRecord, {
|
|
|
- onSuccess: (res) => {
|
|
|
- const record = res.data.find((e) => e.templatetype === 1 && e.recordstatus === 3)
|
|
|
- if (record) {
|
|
|
- const { name, idCard, idCardPhoto, idCardPhotoBackURL, mobile, idCardType } = JSON.parse(record.authinfo || '{}')
|
|
|
- formData.name = name
|
|
|
- formData.idCard = idCard
|
|
|
- formData.idCardPhoto = idCardPhoto
|
|
|
- formData.idCardPhotoBackURL = idCardPhotoBackURL
|
|
|
- formData.idCardType = idCardType
|
|
|
- formData.mobile = mobile
|
|
|
- }
|
|
|
+const { loading: buttonLoading } = useRequest(queryTencentUsereSignRecords, {
|
|
|
+ params: {
|
|
|
+ userId: getUserId(),
|
|
|
+ memberUserId: getMemberUserId()
|
|
|
},
|
|
|
onError: (err) => {
|
|
|
showFailToast(err)
|
|
|
@@ -95,18 +126,27 @@ const { loading: buttonLoading, dataList: userESignRecords, run: getUserESignRec
|
|
|
})
|
|
|
|
|
|
const b_afterRead = (filePath: string) => {
|
|
|
- formData.idCardPhotoBackURL = filePath
|
|
|
+ if (getUserInfoType() === 1) {
|
|
|
+ person.value.idCardPhotoBackURL = filePath
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const f_afterRead = (filePath: string) => {
|
|
|
- formData.idCardPhoto = filePath
|
|
|
+ if (getUserInfoType() === 1) {
|
|
|
+ person.value.idCardPhoto = filePath
|
|
|
+ } else {
|
|
|
+ company.value.idCardPhoto = filePath
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-// 表单验证规则
|
|
|
-const formRules: { [key in keyof Model.AddUserReq]?: FieldRule[] } = {
|
|
|
- name: [{
|
|
|
+// 个人信息表单验证规则
|
|
|
+const PFormRules: { [key in keyof Model.PersonBankCard4]?: FieldRule[] } = {
|
|
|
+ realName: [{
|
|
|
required: true,
|
|
|
message: '请输入用户姓名',
|
|
|
+ validator: () => {
|
|
|
+ return !!person.value.realName
|
|
|
+ }
|
|
|
}],
|
|
|
mobile: [{
|
|
|
required: true,
|
|
|
@@ -118,7 +158,23 @@ const formRules: { [key in keyof Model.AddUserReq]?: FieldRule[] } = {
|
|
|
return validateRules.phone.message
|
|
|
}
|
|
|
}],
|
|
|
- idCard: [{
|
|
|
+ bankId: [{
|
|
|
+ message: '请选择开户银行',
|
|
|
+ validator: () => {
|
|
|
+ return !!person.value.bankId
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ bankCard: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入银行卡号',
|
|
|
+ validator: (val) => {
|
|
|
+ if (validateRules. bankcardno.validate(val)) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return validateRules.bankcardno.message
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ idCardNo: [{
|
|
|
required: true,
|
|
|
message: '请输入证件号码',
|
|
|
validator: (val) => {
|
|
|
@@ -131,47 +187,97 @@ const formRules: { [key in keyof Model.AddUserReq]?: FieldRule[] } = {
|
|
|
return validateRules.cardno.message
|
|
|
}
|
|
|
}],
|
|
|
- idCardPhotoBackURL: [{
|
|
|
+ idCardPhoto: [{
|
|
|
required: true,
|
|
|
message: '请上传证件背面照片',
|
|
|
}],
|
|
|
- idCardPhoto: [{
|
|
|
+ idCardPhotoBackURL: [{
|
|
|
required: true,
|
|
|
message: '请上传证件正面照片',
|
|
|
}],
|
|
|
}
|
|
|
|
|
|
+// 企业信息表单验证规则
|
|
|
+const CFormRules: { [key in keyof Model.CompanyBankCard4]?: FieldRule[] } = {
|
|
|
+ realName: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入法人姓名',
|
|
|
+ }],
|
|
|
+ companyName: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入企业名称',
|
|
|
+ }],
|
|
|
+ creditCode: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入社会统一信用代码',
|
|
|
+ }],
|
|
|
+ mobile: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入手机号码',
|
|
|
+ validator: (val) => {
|
|
|
+ if (validateRules.phone.validate(val)) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return validateRules.phone.message
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ bankCard: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入法人银行卡号(仅限印有“银联”字样的银行卡)',
|
|
|
+ validator: (val) => {
|
|
|
+ if (validateRules. bankcardno.validate(val)) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return validateRules.bankcardno.message
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ idCardNo: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入法人身份证号',
|
|
|
+ validator: (val) => {
|
|
|
+ if (validateRules.cardno.validate(val)) {
|
|
|
+ if (getIdCardAge(val)) {
|
|
|
+ return '开户失败,您的年龄不符合开户要求'
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return validateRules.cardno.message
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ idCardPhoto: [{
|
|
|
+ required: true,
|
|
|
+ message: '请上传营业执照',
|
|
|
+ }],
|
|
|
+}
|
|
|
+
|
|
|
const onCheckCardNum = () => {
|
|
|
fullloading((hideLoading) => {
|
|
|
requestCheckCardNum({
|
|
|
data: {
|
|
|
- cardnum: formData.idCard
|
|
|
+ cardnum: getUserInfoType() === 1 ? person.value.idCardNo : company.value.idCardNo
|
|
|
}
|
|
|
}).then(() => {
|
|
|
- formSubmit().then(() => {
|
|
|
+ // 实体类型 1:个人 2:企业
|
|
|
+ formData.type = getUserInfoType()
|
|
|
+ // 个人
|
|
|
+ if ( getUserInfoType() === 1) {
|
|
|
+ formData.person = person.value
|
|
|
+ } else {
|
|
|
+ // 企业
|
|
|
+ formData.company = company.value
|
|
|
+ }
|
|
|
+ // 发送验证
|
|
|
+ onBankCard4().then((res) => {
|
|
|
hideLoading()
|
|
|
- getUserESignRecord()
|
|
|
- dialog('提交请求成功').then(() => {
|
|
|
- /// 进行下一步
|
|
|
- openComponent('certification-next')
|
|
|
+ /// 流水号
|
|
|
+ serialNo.value = res.data.serialNo
|
|
|
+ /// 已发送验证码
|
|
|
+ dialog('验证码已发送!').then(() => {
|
|
|
+ /// 发送验证码
|
|
|
+ openComponent('captcha')
|
|
|
})
|
|
|
}).catch((err) => {
|
|
|
- switch (err) {
|
|
|
- case '100020':
|
|
|
- hideLoading('个人三要素信息验证失败', 'fail')
|
|
|
- break
|
|
|
- case '100021':
|
|
|
- hideLoading('用户已存在', 'fail')
|
|
|
- break
|
|
|
- case '100726':
|
|
|
- hideLoading('该条实名记录为核验记录,无法用于添加用户', 'fail')
|
|
|
- break
|
|
|
- case '100727':
|
|
|
- hideLoading('实名认证类型和添加用户类型不匹配', 'fail')
|
|
|
- break
|
|
|
- default:
|
|
|
- hideLoading(err, 'fail')
|
|
|
- }
|
|
|
+ hideLoading(err, 'fail')
|
|
|
})
|
|
|
}).catch((err) => {
|
|
|
hideLoading(err, 'fail')
|
|
|
@@ -179,16 +285,20 @@ const onCheckCardNum = () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-const onSubmit = () => {
|
|
|
- const isInclude = userESignRecords.value.some((e) => e.templatetype === 1 && e.recordstatus === 1)
|
|
|
- if (!userESignRecords.value.length || isInclude) {
|
|
|
- formRef.value?.submit()
|
|
|
+onMounted(() => {
|
|
|
+ // 个人
|
|
|
+ if (getUserInfoType() === 1) {
|
|
|
+ person.value.idCardNo = decryptAES(cardnum)
|
|
|
+ person.value.mobile = mobile2
|
|
|
+ realName.value = customername
|
|
|
+ person.value.realName = realName.value
|
|
|
} else {
|
|
|
- openComponent('certification-next')
|
|
|
+ // 企业
|
|
|
+ company.value.mobile = mobile2
|
|
|
+ company.value.creditCode = decryptAES(cardnum)
|
|
|
+ realName.value = legalpersonname
|
|
|
+ company.value.realName = realName.value
|
|
|
+ company.value.companyName = customername
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-onMounted(() => {
|
|
|
- formData.mobile = userStore.userInfo?.mobile2 ?? ''
|
|
|
})
|
|
|
-</script>
|
|
|
+</script>
|