ljc 1 週間 前
コミット
57e481dd4a
2 ファイル変更34 行追加1 行削除
  1. 32 1
      pages/mine/improveImmediately.vue
  2. 2 0
      service/personal.ts

+ 32 - 1
pages/mine/improveImmediately.vue

@@ -861,11 +861,13 @@ onLoad((options) => {
   currentStep.value = parseInt(options?.currentStep || '1', 10)
 })
 
-function goStep(step: number) {
+async function goStep(step: number) {
   console.log(step, 'step')
+  loadingStates.value.next = true
   if (step == 3){
     if (!formData.value?.identity){
       toast(t('vaildate.IDCard.empty'))
+      loadingStates.value.next = false
       return
     }
   }
@@ -873,17 +875,46 @@ function goStep(step: number) {
     if (currentUploadCard.value == 1) {
       if (!formData.value.cardType) {
         toast( t('vaildate.CardType.empty'))
+        loadingStates.value.next = false
         return
       }
       if (!fileListID1.value.path || !fileListID2.value.path) {
         toast( t('vaildate.IDPhoto.empty'))
+        loadingStates.value.next = false
         return
       }
     }
+    // 当前接口没有审核通过的请求接口,
+    const {status,applyRealStatus} = userStore.userInfo.customInfo
+    // if (!(status == 2 || applyRealStatus == 1 || applyRealStatus == 2)){
+     await getOcrInfo()
+    // }
   }
+  loadingStates.value.next = false
   currentStep.value = step
 }
 
+const getOcrInfo =async () => {
+  try {
+    let res = await personalApi.ocrResult()
+    console.log(res)
+    if (res.data){
+      const { idCard='',gender='男' ,birthDate='',address=''} = res.data
+      formData.value = {
+        identity:idCard,
+        gender:gender=='男'?1:2,
+        birth:Date.parse(new Date(birthDate).toString())/1000,
+        addressLines1:address,
+        ...formData.value,
+      }
+      console.log(formData.value)
+    }
+  }catch (error) {
+    loadingStates.value.next = false
+    toast(error.msg)
+  }
+}
+
 // 选项数据
 const customerTypeOptions = computed(()=>[
   { value: 1, text: t('ImproveImmediately.Label.CustomerType1') },

+ 2 - 0
service/personal.ts

@@ -45,4 +45,6 @@ export const personalApi = {
   getWebsdkLink: (params = {}) => post('/custom/getWebsdkLink', params, 'Host80'),
   /** 真实用户开户设置 */
   customAccount: (params = {}) => post('/custom/info/update/show/login/type', params, 'Host90'),
+  /** ocr信息 */
+  ocrResult: (params = {}) => post('/custom/ocr/result', params, 'Host80'),
 };