|
|
@@ -1,175 +0,0 @@
|
|
|
-<template>
|
|
|
- <app-modal direction="right" height="100%" v-model:show="showModal" :refresh="refresh">
|
|
|
- <app-view class="g-form">
|
|
|
- <template #header>
|
|
|
- <app-navbar title="实名认证" @back="closed" />
|
|
|
- </template>
|
|
|
- <div class="g-form__container">
|
|
|
- <CellGroup inset>
|
|
|
- <Cell title="姓名" :value="formData.username" />
|
|
|
- <Cell title="手机号码" :value="formData.mobile" />
|
|
|
- <Cell title="证件类型" :value="getAQCertificateTypeListName(formData.cardtype ?? 1)" />
|
|
|
- <Cell title="证件号码" :value="formData.cardnum" />
|
|
|
- <Cell title="证件正面照片">
|
|
|
- <template #value>
|
|
|
- <Image fit="contain" :src="cardfrontphotourl" width="100" height="100" />
|
|
|
- </template>
|
|
|
- </Cell>
|
|
|
- <Cell title="证件反面照片">
|
|
|
- <template #value>
|
|
|
- <Image fit="contain" :src="cardbackphotourl" width="100" height="100" />
|
|
|
- </template>
|
|
|
- </Cell>
|
|
|
- </CellGroup>
|
|
|
- <CellGroup inset>
|
|
|
- <template v-for="(item, index) in dataList" :key="index">
|
|
|
- <Cell :title="item.templatename" :icon="iconName(item.recordstatus)" @click="signer(item)"
|
|
|
- is-link />
|
|
|
- </template>
|
|
|
- </CellGroup>
|
|
|
- </div>
|
|
|
- <template #footer>
|
|
|
- <div class="g-form__footer inset">
|
|
|
- <Button type="danger" :disabled="dataList.some((e) => e.recordstatus !== 3)" @click="closed(true)" round
|
|
|
- block>提交认证</Button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </app-view>
|
|
|
- </app-modal>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script lang="ts" setup>
|
|
|
-import { shallowRef, computed, PropType } from 'vue'
|
|
|
-import { CellGroup, Button, Cell, showFailToast, Image, showToast } from 'vant'
|
|
|
-import { fullloading } from '@/utils/vant';
|
|
|
-import { getAQCertificateTypeListName } from "@/constants/account";
|
|
|
-import { useRequest } from '@/hooks/request'
|
|
|
-import { queryTencentUsereSignRecords } from '@/services/api/account';
|
|
|
-import { useRequestCreateFlowByTemplateDirectly } from '@/business/user/account';
|
|
|
-import plus from '@/utils/h5plus'
|
|
|
-import eventBus from '@/services/bus'
|
|
|
-import { getFileUrl } from '@/filters';
|
|
|
-import AppModal from '@/components/base/modal/index.vue'
|
|
|
-import { getUserId, getMemberUserId } from '@/services/methods/user'
|
|
|
-import { useUserStore } from '@/stores'
|
|
|
-
|
|
|
-const showModal = shallowRef(true)
|
|
|
-// 是否刷新父组件数据
|
|
|
-const refresh = shallowRef(false)
|
|
|
-/// 创建电子签合同
|
|
|
-const { createTemplate, templateFormData } = useRequestCreateFlowByTemplateDirectly()
|
|
|
-/// 电子签合同信息
|
|
|
-const dataList = shallowRef<Model.TencentUsereSignRecordsRsq[]>([])
|
|
|
-/// 查询
|
|
|
-const { run } = useRequest(queryTencentUsereSignRecords, {
|
|
|
- params: {
|
|
|
- userId: getUserId(),
|
|
|
- memberUserId: getMemberUserId()
|
|
|
- },
|
|
|
- onSuccess: (res) => {
|
|
|
- if (res.data.length != 0) {
|
|
|
- dataList.value = res.data
|
|
|
- }
|
|
|
- }
|
|
|
-})
|
|
|
-
|
|
|
-const iconName = (type: number) => {
|
|
|
- switch (type) {
|
|
|
- case 2: return 'info-o'
|
|
|
- case 4: return 'close'
|
|
|
- case 3: return 'passed'
|
|
|
- default: return 'circle'
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// 正面照
|
|
|
-const cardfrontphotourl = computed(() => {
|
|
|
- const cardfrontphotourl = props.formData.cardfrontphotourl ?? ''
|
|
|
- const image = cardfrontphotourl.split(',')[0]
|
|
|
- return getFileUrl(image)
|
|
|
-})
|
|
|
-
|
|
|
-// 背面照
|
|
|
-const cardbackphotourl = computed(() => {
|
|
|
- const cardbackphotourl = props.formData.cardbackphotourl ?? ''
|
|
|
- const image = cardbackphotourl.split(',')[0]
|
|
|
- return getFileUrl(image)
|
|
|
-})
|
|
|
-
|
|
|
-const openWebview = (url: string) => {
|
|
|
- const ua = window.navigator.userAgent.toLowerCase()
|
|
|
- if (ua.indexOf('micromessenger') !== -1) {
|
|
|
- showToast({
|
|
|
- type: 'fail',
|
|
|
- message: '请使用浏览器打开此页面'
|
|
|
- })
|
|
|
- } else {
|
|
|
- plus.openWebview({
|
|
|
- url,
|
|
|
- titleText: '实名认证',
|
|
|
- onClose: () => run()
|
|
|
- })
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-const props = defineProps({
|
|
|
- formData: {
|
|
|
- type: Object as PropType<Model.AddAuthReq>,
|
|
|
- required: true,
|
|
|
- }
|
|
|
-})
|
|
|
-
|
|
|
-const signer = (item: Model.TencentUsereSignRecordsRsq) => {
|
|
|
- /// 如果是已签署
|
|
|
- if (item.recordstatus === 2) {
|
|
|
- item.signurl ? openWebview(item.signurl) : showFailToast('合同地址错误')
|
|
|
- } else if (item.recordstatus === 3) {
|
|
|
- const fileUrl = getFileUrl(item.contractfileaddr)
|
|
|
- item.contractfileaddr ? plus.openURL(fileUrl) : showFailToast('合同地址错误')
|
|
|
- } else {
|
|
|
- fullloading((hideLoading) => {
|
|
|
- const userinfotype = useUserStore().userInfo.userinfotype
|
|
|
- templateFormData.userESignRecordID = item.recordid
|
|
|
- templateFormData.userType = userinfotype
|
|
|
- /// 个人信息
|
|
|
- if (userinfotype === 1) {
|
|
|
- templateFormData.personInfo = {
|
|
|
- idCardNumber: props.formData.cardnum,
|
|
|
- mobile: props.formData.mobile,
|
|
|
- name: props.formData.username
|
|
|
- }
|
|
|
- } else {
|
|
|
- templateFormData.organizationInfo = {
|
|
|
- name: props.formData.username
|
|
|
- }
|
|
|
- }
|
|
|
- /// 创建合同
|
|
|
- createTemplate().then((res) => {
|
|
|
- hideLoading()
|
|
|
- openWebview(res.data.signUrl)
|
|
|
- }).catch((err) => {
|
|
|
- hideLoading(err, 'fail')
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// 接收窗口页面状态通知
|
|
|
-const documentVisibilityStateNotify = eventBus.$on('DocumentVisibilityStateNotify', (state) => {
|
|
|
- if (state === 'visible') {
|
|
|
- run()
|
|
|
- }
|
|
|
-})
|
|
|
-
|
|
|
-// 关闭弹窗
|
|
|
-const closed = (isRefresh = false) => {
|
|
|
- refresh.value = isRefresh
|
|
|
- showModal.value = false
|
|
|
- documentVisibilityStateNotify.cancel()
|
|
|
-}
|
|
|
-
|
|
|
-// 暴露组件属性给父组件调用
|
|
|
-defineExpose({
|
|
|
- closed,
|
|
|
-})
|
|
|
-</script>
|