|
|
@@ -0,0 +1,304 @@
|
|
|
+<template>
|
|
|
+ <app-view class="g-form account-certification">
|
|
|
+ <template #header>
|
|
|
+ <app-navbar title="实名认证" />
|
|
|
+ </template>
|
|
|
+ <Form ref="formRef" class="g-form__container" @submit="onCheckCardNum" :loading="loading">
|
|
|
+ <!-- 个人 -->
|
|
|
+ <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="person.bankId" placeholder="请选择开户银行" :readonly="isReadonly && bankaccount != ''" :options="banklist"
|
|
|
+ :optionProps="{ label: 'bankname', value: 'bankid' }" />
|
|
|
+ </template>
|
|
|
+ </Field>
|
|
|
+ <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>
|
|
|
+ <app-uploader @success="f_afterRead" />
|
|
|
+ </template>
|
|
|
+ </Field>
|
|
|
+ <Field name="cardbackphotourl" label="证件反面照片" :rules="PFormRules.idCardPhotoBackURL">
|
|
|
+ <template #input>
|
|
|
+ <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>
|
|
|
+ </Form>
|
|
|
+ <img src="../../../assets/images/certification.png" />
|
|
|
+ <template #footer>
|
|
|
+ <div class="g-form__footer inset">
|
|
|
+ <Button type="danger" :loading="buttonLoading" @click="formRef?.submit" round block>提交实名认证验证</Button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <component ref="componentRef" v-bind="{ serialNo }" :is="componentMap.get(componentId)" @closed="closeComponent"
|
|
|
+ v-if="componentId" />
|
|
|
+ </app-view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+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 { getIdCardAge } from '@/filters'
|
|
|
+import { useRequest } from '@/hooks/request'
|
|
|
+import { queryTencentUsereSignRecords, requestCheckCardNum } from '@/services/api/account'
|
|
|
+import { useRequestBankCard4 } from '@/business/user/account'
|
|
|
+import { validateRules } from '@/constants/regex'
|
|
|
+import { useUserStore } from '@/stores'
|
|
|
+import { useNavigation } from '@mobile/router/navigation'
|
|
|
+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>([
|
|
|
+ ['captcha', defineAsyncComponent(() => import('./components/captcha/Index.vue'))],
|
|
|
+])
|
|
|
+const { banklist } = useQueryCusBankSignBank()
|
|
|
+const { router } = useNavigation()
|
|
|
+const userStore = useUserStore()
|
|
|
+const formRef = shallowRef<FormInstance>()
|
|
|
+/// 个人信息
|
|
|
+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('')
|
|
|
+
|
|
|
+/// 查询托管银行信息
|
|
|
+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 } = useRequest(queryTencentUsereSignRecords, {
|
|
|
+ params: {
|
|
|
+ userId: getUserId(),
|
|
|
+ memberUserId: getMemberUserId()
|
|
|
+ },
|
|
|
+ onError: (err) => {
|
|
|
+ showFailToast(err)
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const b_afterRead = (filePath: string) => {
|
|
|
+ if (getUserInfoType() === 1) {
|
|
|
+ person.value.idCardPhotoBackURL = filePath
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const f_afterRead = (filePath: string) => {
|
|
|
+ if (getUserInfoType() === 1) {
|
|
|
+ person.value.idCardPhoto = filePath
|
|
|
+ } else {
|
|
|
+ company.value.idCardPhoto = filePath
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 个人信息表单验证规则
|
|
|
+const PFormRules: { [key in keyof Model.PersonBankCard4]?: FieldRule[] } = {
|
|
|
+ realName: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入用户姓名',
|
|
|
+ validator: () => {
|
|
|
+ return !!person.value.realName
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ mobile: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入手机号码',
|
|
|
+ validator: (val) => {
|
|
|
+ if (validateRules.phone.validate(val)) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return validateRules.phone.message
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ 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) => {
|
|
|
+ if (validateRules.cardno.validate(val)) {
|
|
|
+ if (getIdCardAge(val)) {
|
|
|
+ return '开户失败,您的年龄不符合开户要求'
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return validateRules.cardno.message
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ idCardPhoto: [{
|
|
|
+ required: true,
|
|
|
+ message: '请上传证件背面照片',
|
|
|
+ }],
|
|
|
+ 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: getUserInfoType() === 1 ? person.value.idCardNo : company.value.idCardNo
|
|
|
+ }
|
|
|
+ }).then(() => {
|
|
|
+ // 实体类型 1:个人 2:企业
|
|
|
+ formData.type = getUserInfoType()
|
|
|
+ // 个人
|
|
|
+ if ( getUserInfoType() === 1) {
|
|
|
+ formData.person = person.value
|
|
|
+ } else {
|
|
|
+ // 企业
|
|
|
+ formData.company = company.value
|
|
|
+ }
|
|
|
+ // 发送验证
|
|
|
+ onBankCard4().then((res) => {
|
|
|
+ hideLoading()
|
|
|
+ /// 流水号
|
|
|
+ serialNo.value = res.data.serialNo
|
|
|
+ /// 已发送验证码
|
|
|
+ dialog('验证码已发送!').then(() => {
|
|
|
+ /// 发送验证码
|
|
|
+ openComponent('captcha')
|
|
|
+ })
|
|
|
+ }).catch((err) => {
|
|
|
+ hideLoading(err, 'fail')
|
|
|
+ })
|
|
|
+ }).catch((err) => {
|
|
|
+ hideLoading(err, 'fail')
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ // 个人
|
|
|
+ if (getUserInfoType() === 1) {
|
|
|
+ person.value.idCardNo = decryptAES(cardnum)
|
|
|
+ person.value.mobile = mobile2
|
|
|
+ realName.value = customername
|
|
|
+ person.value.realName = realName.value
|
|
|
+ } else {
|
|
|
+ // 企业
|
|
|
+ company.value.mobile = mobile2
|
|
|
+ company.value.creditCode = decryptAES(cardnum)
|
|
|
+ realName.value = legalpersonname
|
|
|
+ company.value.realName = realName.value
|
|
|
+ company.value.companyName = customername
|
|
|
+ }
|
|
|
+})
|
|
|
+</script>
|