yuanmingze 3 сар өмнө
parent
commit
c681d5bb5d

+ 49 - 0
src/constants/faceRecognitionArea.ts

@@ -0,0 +1,49 @@
+export const area = [
+  { name: '江苏省', code: '320000' },
+  { name: '浙江省', code: '330000' },
+  { name: '上海市', code: '310000' },
+  { name: '天津市', code: '120000' },
+  { name: '陕西省', code: '610000' },
+  { name: '新疆维吾尔自治区', code: '650000' },
+  { name: '安徽省', code: '340000' },
+  { name: '湖南省', code: '430000' },
+  { name: '河北省', code: '130000' },
+  { name: '辽宁省', code: '210000' },
+  { name: '四川省', code: '510000' },
+  { name: '吉林省', code: '220000' },
+  { name: '广东省', code: '440000' },
+  { name: '重庆市', code: '500000' },
+  { name: '江西省', code: '360000' },
+  { name: '黑龙江省', code: '230000' },
+  { name: '青海省', code: '630000' },
+  { name: '河南省', code: '410000' },
+  { name: '内蒙古自治区', code: '150000' },
+  { name: '宁波市', code: '330200' },
+  { name: '厦门市', code: '350200' },
+  { name: '深圳市', code: '440300' },
+]
+
+export const areaCode = [
+  '320000',
+  '330000',
+  '310000',
+  '120000',
+  '610000',
+  '650000',
+  '340000',
+  '430000',
+  '130000',
+  '210000',
+  '510000',
+  '220000',
+  '440000',
+  '500000',
+  '360000',
+  '230000',
+  '630000',
+  '410000',
+  '150000',
+  '330200',
+  '350200',
+  '440300',
+]

+ 3 - 3
src/hooks/useInvoice.ts

@@ -79,11 +79,11 @@ export function useInvoice() {
           router.replace({ path: '/success' })
         }, 800)
       } else {
-        showToast('提交失败,请稍后重试')
+        showToast(res.msg)
       }
-    } catch (err) {
+    } catch (err: any) {
       console.error('提交失败', err)
-      showToast('提交失败,请稍后重试')
+      showToast(err.message)
     }
   }
 

+ 6 - 0
src/stores/modules/user.ts

@@ -5,6 +5,7 @@ interface UserState {
   access_token: string
   tenant_id: string
   pushRecordId: string
+  areaCode: string
 }
 
 export const useUserStore = defineStore('user', {
@@ -12,6 +13,7 @@ export const useUserStore = defineStore('user', {
     access_token: '',
     tenant_id: '1',
     pushRecordId: '',
+    areaCode: '',
   }),
 
   actions: {
@@ -21,9 +23,13 @@ export const useUserStore = defineStore('user', {
     setPushRecordId(id: string) {
       this.pushRecordId = id
     },
+    setAreaCode(code: string) {
+      this.areaCode = code
+    },
     LogOut() {
       this.access_token = ''
       this.pushRecordId = ''
+      this.areaCode = ''
     },
   },
 

+ 4 - 2
src/views/identity-upload/index.vue

@@ -72,8 +72,9 @@ import { useUserStore } from '@/stores/modules/user'
 // ✅ 使用封装好的 Hook
 import { useInvoice } from '@/hooks/useInvoice'
 import type { UpdateH5IdcardInfoRequest } from '@/services/modules/identityUpload/type.d'
+import { areaCode } from '@/constants/faceRecognitionArea'
 // --- 初始化 Hooks ---
-const { getStatus, submitInvoiceApply, statusMap } = useInvoice()
+const { getStatus, submitInvoiceApply } = useInvoice()
 const userStore = useUserStore()
 /** 上传项类型 */
 interface UploadFileItem {
@@ -187,7 +188,8 @@ const handleNext = async () => {
     const res = await updateH5IdcardInfo(submitInfo)
     if (res.code === 0) {
       // 需要人脸识别->跳转人脸识别
-      if (statusMap.value.eventStatus === 'PROCESSED') {
+      // 已处理状态,跳转人脸识别
+      if (areaCode.includes(userStore.areaCode)) {
         return router.push({ path: '/face-recognition' })
       }
       // 其他情况,直接提交

+ 2 - 1
src/views/invoice-information/index.vue

@@ -130,6 +130,7 @@ import StepProgress from '@/components/StepProgress.vue'
 import { getConfirmInvoiceInfoApi } from '@/services/modules/invoiceInformation'
 import type { PushRecordIdRequest } from '@/services/modules/invoiceInformation/type.d.ts'
 import { useUserStore } from '@/stores/modules/user'
+import { areaCode } from '@/constants/faceRecognitionArea'
 
 // ✅ 使用封装好的 Hook
 import { useInvoice } from '@/hooks/useInvoice'
@@ -175,7 +176,7 @@ const handleNext = async () => {
   }
 
   // 已处理状态,跳转人脸识别
-  if (statusMap.value.eventStatus === 'PROCESSED') {
+  if (areaCode.includes(userStore.areaCode)) {
     return router.push({ path: '/face-recognition' })
   }
 

+ 1 - 0
src/views/login/index.vue

@@ -289,6 +289,7 @@ const getPubName = async () => {
     if (res.code === 0) {
       pubName.value = res.data.projectName
       registerUrlParams.value.areaId = res.data.cityCode
+      userStore.setAreaCode(res.data.cityCode)
       registerUrlParams.value.pushRecordId = sendEtsSms.pushRecordId
     }
   } catch (err) {