Handy_Cao 2 rokov pred
rodič
commit
9d3fb587bb

+ 11 - 17
src/packages/qxst/views/account/certification/Index.vue

@@ -10,7 +10,7 @@
                 <Field v-model="mobile2" name="mobile" label="手机号码" placeholder="请输入手机号码" />
                 <Field name="idCardType" label="证件类型" :rules="formRules.idCardType" is-link>
                     <template #input>
-                        <app-select v-model="formData.idCardType" placeholder="请选择证件类型" :options="enums" />
+                        <app-select v-model="formData.idCardType" placeholder="请选择证件类型" :options="getAQCertificateTypeList()" />
                     </template>
                 </Field>
                 <Field v-model="formData.idCard" name="cardnum" label="证件号码" placeholder="请输入证件号码"
@@ -38,7 +38,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, computed, defineAsyncComponent } from 'vue'
+import { shallowRef, defineAsyncComponent } from 'vue'
 import { CellGroup, Button, Field, Form, FormInstance, showFailToast, FieldRule } from 'vant'
 import { fullloading, dialog } from '@/utils/vant';
 import { getAQCertificateTypeList } from "@/constants/account";
@@ -55,7 +55,6 @@ import { useNavigation } from '../../../router/navigation'
 const { router } = useNavigation()
 const formRef = shallowRef<FormInstance>()
 const { formData, formSubmit } = adddUserReq()
-const error = shallowRef(false)
 const canAdd = shallowRef(false)
 
 const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => {
@@ -68,17 +67,15 @@ const componentMap = new Map<string, unknown>([
 ])
 
 /// 查询记录
-const { loading, dataList  } = useRequest(queryUserESignRecord, {
-    onError: () => {
-        error.value = true
-    }, 
-    onFinally: () => {
-        dataList.value.map(obj => {
-            if (obj.templatetype === 1 && obj.recordstatus === 1) {
-                canAdd.value = true
-            } else if (obj.templatetype === 1 && obj.recordstatus === 3) {
+const { loading  } = useRequest(queryUserESignRecord, {
+    onSuccess: (res) => {
+        if(res.data.some((e)=>e.templatetype === 1 && e.recordstatus === 1)) {
+            canAdd.value = true
+        } else {
+            const item = res.data.find((e)=>e.templatetype === 1 && e.recordstatus === 3)
+            if (item) {
                 canAdd.value = false
-                const { name, idCard, idCardPhoto, idCardPhotoBackURL, mobile, idCardType } = JSON.parse(obj.authinfo)
+                const { name, idCard, idCardPhoto, idCardPhotoBackURL, mobile, idCardType } = JSON.parse(item.authinfo)
                 formData.name = name
                 formData.idCard = idCard
                 formData.idCardPhoto = idCardPhoto
@@ -88,13 +85,10 @@ const { loading, dataList  } = useRequest(queryUserESignRecord, {
                 /// 进行下一步
                 openComponent('certification-next')
             } 
-        }) 
+        }
     }
 })
 
-/// 获取对应的证件枚举类型
-const enums = computed(() => { return getAQCertificateTypeList().map(obj => { return { label: obj.label, value: obj.value } }) })
-
 const b_afterRead = (filePath: string) => {
     formData.idCardPhoto = filePath
 }

+ 20 - 21
src/packages/qxst/views/account/certification/components/certification-next/Index.vue

@@ -41,7 +41,6 @@ import { useRequest } from '@/hooks/request'
 import { queryUserESignRecord } from '@/services/api/account';
 import { useRequestCreateContractAndAddSigner, useRequestSignCompleted } from '@/business/user/account';
 import plus from '@/utils/h5plus'
-import { onMounted } from 'vue';
 import { getFileUrl } from '@/filters';
 import AppModal from '@/components/base/modal/index.vue'
 
@@ -55,6 +54,22 @@ const { signCompleted} = useRequestSignCompleted()
 /// 可以认证
 const canAdd = shallowRef(false)
 
+/// 查询
+useRequest(queryUserESignRecord, {
+    onSuccess: (res) => {
+        if (res.data.length != 0) {
+            dataList.value = res.data.filter(obj => {
+                return obj.templatetype === 2
+            })
+        }
+        /// 只有全部签署才可以进行下一步
+        canAdd.value = dataList.value.some(obj => { [1, 4].includes(obj.recordstatus) })
+    },
+    onError: () => {
+        error.value = true
+    }
+})
+
 const iconName = (type: number) => {
     switch (type) {
         case 2:
@@ -71,13 +86,15 @@ const iconName = (type: number) => {
 // 正面照
 const idCardPhoto = computed(() => {
     const idCardPhoto = props.formData.idCardPhoto ?? ''
-    return idCardPhoto.split(',').map((path) => getFileUrl(path))[0]
+    const image = idCardPhoto.split(',')[0]
+    return getFileUrl(image)
 })
 
 // 背面照
 const idCardPhotoBackURL = computed(() => {
     const idCardPhotoBackURL = props.formData.idCardPhotoBackURL ?? ''
-    return idCardPhotoBackURL.split(',').map((path) => getFileUrl(path))[0]
+    const image = idCardPhotoBackURL.split(',')[0]
+    return getFileUrl(image)
 })
 
 const openURL = (url: string) => {
@@ -132,24 +149,6 @@ const signer = (item: Model.UserESignRecordRsq) => {
     }
 }
 
-onMounted(() => {
-    /// 查询
-    useRequest(queryUserESignRecord, {
-        onSuccess: (res) => {
-            if (res.data.length != 0) {
-                dataList.value = res.data.filter(obj => {
-                    return obj.templatetype === 2
-                })
-            }
-            /// 只有全部签署才可以进行下一步
-            canAdd.value = dataList.value.some(obj => { [1, 4].includes(obj.recordstatus) })
-        },
-        onError: () => {
-            error.value = true
-        }
-    })
-})
-
 // 关闭弹窗
 const closed = (isRefresh = false) => {
     refresh.value = isRefresh