|
|
@@ -3,23 +3,25 @@
|
|
|
<template #header>
|
|
|
<app-navbar title="实名认证" />
|
|
|
</template>
|
|
|
- <Form ref="formRef" class="g-form__container" @submit="onSubmit">
|
|
|
+ <Form ref="formRef" class="g-form__container" @submit="onSubmit" :loading="loading">
|
|
|
<CellGroup inset>
|
|
|
- <Field v-model="formData.username" name="username" label="姓名" placeholder="请输入用户姓名"
|
|
|
- :rules="formRules.username" />
|
|
|
- <Field name="cardtype" label="证件类型" :rules="formRules.cardtype" is-link>
|
|
|
+ <Field v-model="formData.name" name="name" label="姓名" placeholder="请输入用户姓名"
|
|
|
+ :rules="formRules.name" />
|
|
|
+ <Field v-model="formData.mobile" name="mobile" label="手机号码" placeholder="请输入手机号码"
|
|
|
+ :rules="formRules.mobile" />
|
|
|
+ <Field name="idCardType" label="证件类型" :rules="formRules.idCardType" is-link>
|
|
|
<template #input>
|
|
|
- <app-select v-model="formData.cardtype" placeholder="请选择证件类型" :options="enums" />
|
|
|
+ <app-select v-model="formData.idCardType" placeholder="请选择证件类型" :options="enums" />
|
|
|
</template>
|
|
|
</Field>
|
|
|
- <Field v-model="formData.cardnum" name="cardnum" label="证件号码" placeholder="请输入证件号码"
|
|
|
- :rules="formRules.cardnum" />
|
|
|
- <Field name="cardfrontphotourl" label="证件正面照片" :rules="formRules.cardfrontphotourl">
|
|
|
+ <Field v-model="formData.idCard" name="cardnum" label="证件号码" placeholder="请输入证件号码"
|
|
|
+ :rules="formRules.idCard" />
|
|
|
+ <Field name="idCardPhoto" label="证件正面照片" :rules="formRules.idCardPhoto">
|
|
|
<template #input>
|
|
|
<app-uploader @success="b_afterRead" />
|
|
|
</template>
|
|
|
</Field>
|
|
|
- <Field name="cardbackphotourl" label="证件反面照片" :rules="formRules.cardbackphotourl">
|
|
|
+ <Field name="idCardPhotoBackURL" label="证件反面照片" :rules="formRules.idCardPhotoBackURL">
|
|
|
<template #input>
|
|
|
<app-uploader @success="f_afterRead" />
|
|
|
</template>
|
|
|
@@ -29,53 +31,92 @@
|
|
|
<img src="../../../assets/images/certification.png" />
|
|
|
<template #footer>
|
|
|
<div class="g-form__footer inset">
|
|
|
- <Button type="danger" @click="formRef?.submit" round block>提交实名认证</Button>
|
|
|
+ <Button type="danger" @click="formRef?.submit" :disabled="!canAdd" round block>提交实名认证</Button>
|
|
|
</div>
|
|
|
</template>
|
|
|
+ <component ref="componentRef" v-bind="{ formData }" :is="componentMap.get(componentId)" @closed="closeComponent" v-if="componentId" />
|
|
|
</app-view>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { shallowRef, computed } from 'vue'
|
|
|
+import { shallowRef, computed, defineAsyncComponent } from 'vue'
|
|
|
import { CellGroup, Button, Field, Form, FormInstance, showFailToast, FieldRule } from 'vant'
|
|
|
-import { addAuthReq } from '@/business/user'
|
|
|
import { fullloading, dialog } from '@/utils/vant';
|
|
|
-import { getCertificateTypeList } from "@/constants/account";
|
|
|
+import { getAQCertificateTypeList } from "@/constants/account";
|
|
|
+import { useRequest } from '@/hooks/request'
|
|
|
+import { queryUserESignRecord } from '@/services/api/account';
|
|
|
+import { adddUserReq } from '@/business/user/account';
|
|
|
+import { validateRules } from '@/constants/regex';
|
|
|
+import { useComponent } from '@/hooks/component'
|
|
|
import AppSelect from '../../../components/base/select/index.vue'
|
|
|
-import { useNavigation } from '../../../router/navigation'
|
|
|
import AppUploader from '../../../components/base/uploader/index.vue'
|
|
|
|
|
|
const formRef = shallowRef<FormInstance>()
|
|
|
-const { formData, formSubmit } = addAuthReq()
|
|
|
-const { router } = useNavigation()
|
|
|
+const { formData, formSubmit } = adddUserReq()
|
|
|
+const error = shallowRef(false)
|
|
|
+const canAdd = shallowRef(false)
|
|
|
+const { componentRef, componentId, openComponent, closeComponent } = useComponent()
|
|
|
+
|
|
|
+const componentMap = new Map<string, unknown>([
|
|
|
+ ['certification-next', defineAsyncComponent(() => import('./components/certification-next/Index.vue'))], // 爱签-实名认证第二步
|
|
|
+])
|
|
|
+
|
|
|
+/// 查询记录
|
|
|
+const { loading } = useRequest(queryUserESignRecord, {
|
|
|
+ onSuccess: (res) => {
|
|
|
+ res.data.map(obj => {
|
|
|
+ if (obj.templatetype === 1 && obj.recordstatus === 1) {
|
|
|
+ canAdd.value = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onError: () => {
|
|
|
+ error.value = true
|
|
|
+ }
|
|
|
+})
|
|
|
|
|
|
/// 获取对应的证件枚举类型
|
|
|
-const enums = computed(() => { return getCertificateTypeList().map(obj => { return { label: obj.label, value: obj.value } }) })
|
|
|
+const enums = computed(() => { return getAQCertificateTypeList().map(obj => { return { label: obj.label, value: obj.value } }) })
|
|
|
|
|
|
const b_afterRead = (filePath: string) => {
|
|
|
- formData.cardfrontphotourl = filePath
|
|
|
+ formData.idCardPhoto = filePath
|
|
|
}
|
|
|
|
|
|
const f_afterRead = (filePath: string) => {
|
|
|
- formData.cardbackphotourl = filePath
|
|
|
+ formData.idCardPhotoBackURL = filePath
|
|
|
}
|
|
|
|
|
|
// 表单验证规则
|
|
|
-const formRules: { [key in keyof Model.AddAuthReq]?: FieldRule[] } = {
|
|
|
- username: [{
|
|
|
+const formRules: { [key in keyof Model.AddUserReq]?: FieldRule[] } = {
|
|
|
+ name: [{
|
|
|
required: true,
|
|
|
message: '请输入用户姓名',
|
|
|
}],
|
|
|
- cardnum: [{
|
|
|
+ mobile: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入手机号码',
|
|
|
+ validator: (val) => {
|
|
|
+ if (validateRules.phone.validate(val)) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return validateRules.phone.message
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ idCard: [{
|
|
|
required: true,
|
|
|
message: '请输入证件号码',
|
|
|
-
|
|
|
+ validator: (val) => {
|
|
|
+ if (validateRules.cardno.validate(val)) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return validateRules.cardno.message
|
|
|
+ }
|
|
|
}],
|
|
|
- cardbackphotourl: [{
|
|
|
+ idCardPhotoBackURL: [{
|
|
|
required: true,
|
|
|
message: '请上传证件背面照片',
|
|
|
}],
|
|
|
- cardfrontphotourl: [{
|
|
|
+ idCardPhoto: [{
|
|
|
required: true,
|
|
|
message: '请上传证件正面照片',
|
|
|
}],
|
|
|
@@ -86,7 +127,8 @@ const onSubmit = () => {
|
|
|
formSubmit().then(() => {
|
|
|
hideLoading()
|
|
|
dialog('实名认证提交请求成功').then(() => {
|
|
|
- router.back()
|
|
|
+ /// 进行下一步
|
|
|
+ openComponent('certification-next')
|
|
|
})
|
|
|
}).catch((err) => {
|
|
|
showFailToast(err)
|