Handy_Cao hace 2 años
padre
commit
816de84806

+ 29 - 1
src/business/user/account.ts

@@ -1,6 +1,6 @@
 import { shallowRef, reactive } from 'vue'
 import { useLoginStore, useAccountStore } from '@/stores'
-import { investorDel, modifyPassword, requestAddAuth, requestAddUser, requestCreateContractAndAddSigner, requestSignCompleted } from '@/services/api/account'
+import { investorDel, modifyPassword, requestAddAuth, requestAddUser, requestCreateContractAndAddSigner, requestSignCompleted, requestWillFace } from '@/services/api/account'
 import cryptojs from 'crypto-js'
 
 const loginStore = useLoginStore()
@@ -167,4 +167,32 @@ export function useRequestSignCompleted() {
         loading,
         signCompleted
     }
+}
+
+/**
+ * 个人意愿核身认证
+ */
+export function useRequestWillFace() {
+    const loading = shallowRef(false)
+
+    const willFaceFormData = reactive<Model.WillFaceReq>({})
+
+    const willFace = async () => {
+        try {
+            loading.value = true
+            return await requestWillFace({
+                data: {
+                    ... willFaceFormData
+                }
+            })
+        } finally {
+            loading.value = false
+        }
+    }
+
+    return {
+        loading,
+        willFaceFormData,
+        willFace
+    }
 }

+ 39 - 25
src/packages/qxst/views/account/certification/components/certification-next/Index.vue

@@ -21,11 +21,11 @@
                 </Field>
             </CellGroup>
             <CellGroup inset>
-                <Cell v-for="(item, index) in dataList" :key="index" :title="item.templatename" :icon="iconName(item.recordstatus)" :disable="[2, 4].includes(item.recordstatus)" @click="signer(item)" />
+                <Cell v-for="(item, index) in dataList.filter(obj => obj.templatetype === 2)" :key="index" :title="item.templatename" :icon="iconName(item.recordstatus)" :disable="[2, 4].includes(item.recordstatus)" @click="signer(item)" />
             </CellGroup>
             <template #footer>
                 <div class="g-form__footer inset">
-                    <Button type="danger" :disable="!canAdd" @click="completed()" round block>提交认证</Button>
+                    <Button type="danger" :disable="!canAdd" @click="onSubmit()" round block>提交认证</Button>
                 </div>
             </template>
         </app-view>
@@ -39,7 +39,7 @@ import { fullloading, dialog } from '@/utils/vant';
 import { getAQCertificateTypeListName } from "@/constants/account";
 import { useRequest } from '@/hooks/request'
 import { queryUserESignRecord } from '@/services/api/account';
-import { useRequestCreateContractAndAddSigner, useRequestSignCompleted } from '@/business/user/account';
+import { useRequestCreateContractAndAddSigner, useRequestSignCompleted, useRequestWillFace } from '@/business/user/account';
 import plus from '@/utils/h5plus'
 import eventBus from '@/services/bus'
 import { getFileUrl } from '@/filters';
@@ -50,6 +50,8 @@ const showModal = shallowRef(true)
 const refresh = shallowRef(false)
 const dataList = shallowRef<Model.UserESignRecordRsq[]>([])
 const { createSigner, templateNoFormData} = useRequestCreateContractAndAddSigner()
+/// 意愿视频认证
+const { willFace, willFaceFormData} = useRequestWillFace()
 const { signCompleted} = useRequestSignCompleted()
 /// 可以认证
 const canAdd = shallowRef(false)
@@ -57,24 +59,18 @@ const canAdd = shallowRef(false)
 /// 查询
 const { run } = useRequest(queryUserESignRecord, {
     onSuccess: (res) => {
-        if (res.data.length != 0) {
-            dataList.value = res.data.filter(obj => obj.templatetype === 2)
-        }
+        if (res.data.length != 0) { dataList.value = res.data  }
         /// 只有全部签署才可以进行下一步
-        canAdd.value = dataList.value.some(obj => [1, 4].includes(obj.recordstatus) )
+        canAdd.value = dataList.value.some(obj => obj.templatetype === 2 && [2, 3].includes(obj.recordstatus) )
     }
 })
 
 const iconName = (type: number) => {
     switch (type) {
-        case 2:
-            return 'info-o'
-        case 4:
-            return 'close'
-        case 3:
-            return 'passed'
-        default:
-            return 'circle'
+        case 2: return 'info-o'
+        case 4: return 'close'
+        case 3: return 'passed'
+        default: return 'circle'
     }
 }
 
@@ -119,17 +115,9 @@ const completed = () => {
 const signer = (item: Model.UserESignRecordRsq) => {
     ///  如果是已签署
     if (item.recordstatus === 2) {
-        if (item.signurl != '') {
-            openURL(item.signurl)
-        } else {
-            showFailToast('合同地址错误')
-        }
+        item.signurl != '' ? openURL(item.signurl) : showFailToast('合同地址错误')
     } else if (item.recordstatus === 3) { 
-        if (item.contractfileaddr != '') {
-            openURL(item.contractfileaddr)
-        } else {
-            showFailToast('已签署文件地址错误')
-        }
+        item.contractfileaddr != '' ? openURL(item.contractfileaddr) : showFailToast('合同地址错误')
     } else {
         fullloading((hideLoading) => {
             templateNoFormData.templateNo = item.templateno
@@ -144,6 +132,32 @@ const signer = (item: Model.UserESignRecordRsq) => {
     }
 }
 
+/// 最终提交
+const onSubmit = () => {
+    /// 如果类型为3 状态为3的 已经进行视频认证成功
+    if (dataList.value.some(obj => obj.templatetype === 3 && obj.recordstatus === 3)) {
+        completed()
+    } else {
+        willface()
+    }
+}
+
+/// 进行视频认证
+const willface = () => {
+    /// 参数信息
+    willFaceFormData.idCardNo = props.formData.idCard
+    willFaceFormData.realName = props.formData.name
+    /// loading
+    fullloading((hideLoading) => {
+        willFace().then((res) => {
+            hideLoading()
+            openURL(res.data.faceUrl)
+        }).catch((err) => {
+            showFailToast(err)
+        })
+    })
+}
+
 // 接收窗口页面状态通知
 const documentVisibilityStateNotify = eventBus.$on('DocumentVisibilityStateNotify', (state) => {
   if (state === 'visible') {

+ 11 - 0
src/services/api/account/index.ts

@@ -184,4 +184,15 @@ export function requestSignCompleted(config: RequestConfig<Model.ContractAndAddS
         url: '/Account/SignCompleted',
         data: config.data,
     })
+}
+
+/**
+ * 个人意愿核身认证
+ */
+export function requestWillFace(config: RequestConfig<Model.WillFaceReq> = {}) {
+    return http.goRequest<Model.WillFaceRsq>({
+        method: 'post',
+        url: '/Account/WillFace',
+        data: config.data,
+    })
 }

+ 14 - 0
src/types/model/bank.d.ts

@@ -363,4 +363,18 @@ declare namespace Model {
         /// 文件路径
         signUrl: string
     }
+
+    /// 个人意愿核身认证-请求
+    interface WillFaceReq {
+        /// 身份证号
+        idCardNo?: string
+        /// 真实姓名
+        realName?: string
+    }
+
+    /// 个人意愿核身认证-回应
+    interface WillFaceRsq {
+        /// 文件路径
+        faceUrl: string
+    }
 }