25 Commits bf0616541f ... 3062dc461d

Author SHA1 Message Date
  yuanmingze 3062dc461d 修复针对人脸结果认证问题 3 weeks ago
  yuanmingze 65c899c9d9 Merge branch 'master' into pre 3 weeks ago
  yuanmingze 23a9ef142e Merge branch 'feature-phone-260410' into pre 2 months ago
  yuanmingze 5224e1c2e9 Merge branch 'feature-phone-260410' into pre 2 months ago
  yuanmingze 5e35dea4c5 Merge branch 'feature-wecht-260401' into pre 2 months ago
  yuanmingze 3328b96ebe Merge branch 'feature-wecht-260401' into pre 2 months ago
  yuanmingze 6caf5db7d8 Merge branch 'feature-wecht-260401' into pre 2 months ago
  yuanmingze a888bee2b8 Merge branch 'feature-wecht-260401' into pre 2 months ago
  yuanmingze 09a27b3278 Merge branch 'master' into pre 2 months ago
  yuanmingze f702706d81 Merge branch 'feature-message-260305' into pre 3 months ago
  yuanmingze 55ff79edb6 Merge branch 'feature/faceid-risk/20260206' into pre 3 months ago
  yuanmingze 02b2071be9 Merge branch 'feature/faceid-risk/20260206' into pre 3 months ago
  yuanmingze 919bb87e2e Merge branch 'feature/faceid-risk/20260206' into pre 4 months ago
  yuanmingze 57df9709b9 Merge branch 'feature/faceid-risk/20260206' into pre 4 months ago
  yuanmingze 6c7720268d Merge branch 'feature/faceid-risk/20260206' into pre 4 months ago
  yuanmingze 3ea6bd96a4 Merge branch 'feature/faceid-risk/20260206' into pre 4 months ago
  yuanmingze 2906955a84 Merge branch 'feature/faceid-risk/20260206' into pre 4 months ago
  yuanmingze 41b1d72ffe Merge branch 'feature/faceid-risk/20260206' into pre 4 months ago
  yuanmingze c44176a532 Merge branch 'feature/faceid-risk/20260206' into pre 4 months ago
  yuanmingze d7d3998aa2 新增 电子税务局提升账号安全等级操作指引 功能 4 months ago
  yuanmingze 8aef38f393 Merge branch 'feature/faceid-risk/20260206' into pre 4 months ago
  yuanmingze 8fce10132b Merge branch 'feature-loginText-260126' into pre 4 months ago
  yuanmingze ec3efc4e00 合并冲突 5 months ago
  yuanmingze 1341d46f6a Merge branch 'feature-loginAddPassword-260121' into pre 5 months ago
  yuanmingze 5431ab008b 修复 pushRecordId 问题 5 months ago
3 changed files with 61 additions and 22 deletions
  1. 55 17
      src/hooks/useInvoice.ts
  2. 1 2
      src/services/request/index.ts
  3. 5 3
      src/views/invoice-information/index.vue

+ 55 - 17
src/hooks/useInvoice.ts

@@ -15,6 +15,15 @@ interface ToStatus {
   [key: string]: any
   [key: string]: any
 }
 }
 
 
+type FaceAuthRzzt = 'REQUIRED_AUTHENTICATION' | 'NO_REQUIRED_AUTHENTICATION'
+
+interface FaceAuthResultData {
+  success?: boolean
+  rzzt?: FaceAuthRzzt
+  msg?: string
+  lowCertLevel?: boolean
+}
+
 /* ========================== 主 Hook ========================== */
 /* ========================== 主 Hook ========================== */
 
 
 export function useInvoice() {
 export function useInvoice() {
@@ -26,21 +35,30 @@ export function useInvoice() {
   const isLoading = ref(false)
   const isLoading = ref(false)
   const statusMap = ref<ToStatus>({})
   const statusMap = ref<ToStatus>({})
 
 
-  // 状态层面是否允许继续流程
+  // get-status 接口是否允许继续流程
   const statusReady = ref(false)
   const statusReady = ref(false)
 
 
-  // 人脸认证接口是否已经返回成功
+  /**
+   * 只表示 get-face-auth-result 接口是否已成功返回
+   * 仅用于 btnDisabled 判断
+   */
   const faceAuthReady = ref(false)
   const faceAuthReady = ref(false)
 
 
-  // 人脸是否“通过或无需认证”
+  /**
+   * 是否需要跳转人脸认证页
+   * REQUIRED_AUTHENTICATION => true
+   */
+  const needFaceAuth = ref(false)
+
+  /**
+   * 人脸认证是否已完成 / 无需认证
+   * NO_REQUIRED_AUTHENTICATION => true
+   * REQUIRED_AUTHENTICATION => false
+   */
   const faceAuthResult = ref(false)
   const faceAuthResult = ref(false)
 
 
   /* ------------------ UI 控制层 ------------------ */
   /* ------------------ UI 控制层 ------------------ */
 
 
-  /**
-   * 仅用于按钮禁用控制
-   * 不参与真实业务逻辑
-   */
   const btnDisabled = computed(() => {
   const btnDisabled = computed(() => {
     return !(statusReady.value && faceAuthReady.value)
     return !(statusReady.value && faceAuthReady.value)
   })
   })
@@ -73,6 +91,7 @@ export function useInvoice() {
     if (!params.pushRecordId) return
     if (!params.pushRecordId) return
 
 
     isLoading.value = true
     isLoading.value = true
+
     try {
     try {
       const res = await getStatusApi(params)
       const res = await getStatusApi(params)
       if (res.code !== 0) return
       if (res.code !== 0) return
@@ -82,7 +101,6 @@ export function useInvoice() {
       const { invoiceStatus, eventStatus } = res.data
       const { invoiceStatus, eventStatus } = res.data
 
 
       const isInvoiceSubmitted = !!invoiceStatus && isSubmitStatusMap.includes(invoiceStatus)
       const isInvoiceSubmitted = !!invoiceStatus && isSubmitStatusMap.includes(invoiceStatus)
-
       const isEventSubmitted = !!eventStatus && isSubmitEventStatusMap.includes(eventStatus)
       const isEventSubmitted = !!eventStatus && isSubmitEventStatusMap.includes(eventStatus)
 
 
       // 只有未提交状态才允许继续
       // 只有未提交状态才允许继续
@@ -107,9 +125,17 @@ export function useInvoice() {
 
 
       if (res.code !== 0 || !res.data?.success) return
       if (res.code !== 0 || !res.data?.success) return
 
 
-      if (res.data.rzzt === 'NO_REQUIRED_AUTHENTICATION') {
-        faceAuthResult.value = true
-      }
+      const data = res.data as FaceAuthResultData
+      const rzzt = data.rzzt
+
+      // 接口成功返回后,按钮可以进入下一步流程
+      faceAuthReady.value = true
+
+      // 需要做人脸:按钮可点,但点击后应跳人脸页
+      needFaceAuth.value = rzzt === 'REQUIRED_AUTHENTICATION'
+
+      // 无需认证:视为人脸流程已通过,可以直接提交
+      faceAuthResult.value = rzzt === 'NO_REQUIRED_AUTHENTICATION'
     } catch (err: any) {
     } catch (err: any) {
       console.error('获取认证结果失败', err)
       console.error('获取认证结果失败', err)
       showToast(err?.message || '获取认证结果失败,请稍后重试')
       showToast(err?.message || '获取认证结果失败,请稍后重试')
@@ -117,8 +143,7 @@ export function useInvoice() {
   }
   }
 
 
   /* ============================================================
   /* ============================================================
-   * 核心提交逻辑(纯业务)
-   * ⚠ 不依赖任何 UI 计算属性
+   * 核心提交逻辑
    * ============================================================ */
    * ============================================================ */
 
 
   const doSubmitInvoice = async (): Promise<boolean> => {
   const doSubmitInvoice = async (): Promise<boolean> => {
@@ -151,7 +176,7 @@ export function useInvoice() {
   }
   }
 
 
   /* ============================================================
   /* ============================================================
-   * UI 场景提交(按钮点击)
+   * UI 场景提交
    * ============================================================ */
    * ============================================================ */
 
 
   const submitInvoiceWithGuard = async () => {
   const submitInvoiceWithGuard = async () => {
@@ -160,7 +185,7 @@ export function useInvoice() {
   }
   }
 
 
   /* ============================================================
   /* ============================================================
-   * 流程场景提交(loading页/自动流程)
+   * 流程场景提交
    * ============================================================ */
    * ============================================================ */
 
 
   const submitInvoiceForce = async () => {
   const submitInvoiceForce = async () => {
@@ -173,7 +198,20 @@ export function useInvoice() {
     /* 状态 */
     /* 状态 */
     statusMap,
     statusMap,
     isLoading,
     isLoading,
+
+    /**
+     * 是否需要去人脸页
+     */
+    needFaceAuth,
+
+    /**
+     * 人脸是否完成 / 无需认证
+     */
     faceAuthResult,
     faceAuthResult,
+
+    /**
+     * 按钮禁用状态
+     */
     btnDisabled,
     btnDisabled,
 
 
     /* 状态获取 */
     /* 状态获取 */
@@ -181,7 +219,7 @@ export function useInvoice() {
     getFaceAuthResult,
     getFaceAuthResult,
 
 
     /* 提交 */
     /* 提交 */
-    submitInvoiceWithGuard, // 按钮用
-    submitInvoiceForce, // 流程自动用
+    submitInvoiceWithGuard,
+    submitInvoiceForce,
   }
   }
 }
 }

+ 1 - 2
src/services/request/index.ts

@@ -102,17 +102,16 @@ const handleNetworkError = (response: AxiosResponse, silent?: boolean) => {
   if (status === 401) {
   if (status === 401) {
     showToast('您的登录状态已失效,请重新登录')
     showToast('您的登录状态已失效,请重新登录')
     abortAllRequests()
     abortAllRequests()
-
     const pushRecordId = userStore.pushRecordId
     const pushRecordId = userStore.pushRecordId
     // 🔁 跳转到登录页
     // 🔁 跳转到登录页
     setTimeout(() => {
     setTimeout(() => {
+      useUserStoreWithOut().LogOut()
       router.replace({
       router.replace({
         path: '/login',
         path: '/login',
         query: {
         query: {
           pushRecordId: pushRecordId,
           pushRecordId: pushRecordId,
         },
         },
       })
       })
-      useUserStoreWithOut().LogOut()
     }, 1500)
     }, 1500)
   }
   }
 
 

+ 5 - 3
src/views/invoice-information/index.vue

@@ -159,6 +159,7 @@ const {
   btnDisabled,
   btnDisabled,
   statusMap,
   statusMap,
   faceAuthResult,
   faceAuthResult,
+  needFaceAuth,
 } = useInvoice()
 } = useInvoice()
 
 
 // --- 其余本页面独有逻辑 ---
 // --- 其余本页面独有逻辑 ---
@@ -195,17 +196,18 @@ const getConfirmInvoiceInfo = async () => {
  */
  */
 const handleNext = async () => {
 const handleNext = async () => {
   if (btnDisabled.value) return
   if (btnDisabled.value) return
+
   // 未上传身份证,跳转上传页
   // 未上传身份证,跳转上传页
   if (!statusMap.value.isIdImgReady) {
   if (!statusMap.value.isIdImgReady) {
     return router.push({ path: '/identity-upload' })
     return router.push({ path: '/identity-upload' })
   }
   }
 
 
-  // 已处理状态,跳转人脸识别
-  if (userStore.needFaceId && !faceAuthResult.value) {
+  // 需要人脸,并且人脸还没完成,跳转人脸认证页
+  if (needFaceAuth.value && !faceAuthResult.value) {
     return router.push({ path: '/face-recognition' })
     return router.push({ path: '/face-recognition' })
   }
   }
 
 
-  // 其他情况,直接提交
+  // 不需要人脸,或者人脸已完成,直接提交
   await submitInvoiceWithGuard()
   await submitInvoiceWithGuard()
 }
 }