Browse Source

报告详情购买增加开户校验

yujinwen 4 days ago
parent
commit
8ebc07b372
4 changed files with 62 additions and 5 deletions
  1. 5 1
      src/api/modules/user.js
  2. 28 2
      src/views/report/Detail.vue
  3. 28 2
      src/views/report/PDF.vue
  4. 1 0
      vite.config.js

+ 5 - 1
src/api/modules/user.js

@@ -34,6 +34,10 @@ export default{
   // 保存风险测评结果
   saveEvaluationResult:params=>{
     return post('/webhook/v1/syncRiskLevel',params)
-  }
+  },
+  // 获取用户状态
+  checkUserStatus:()=>{
+    return post('/account/checkUserStatus',{})
+  },
   
 }

+ 28 - 2
src/views/report/Detail.vue

@@ -1,7 +1,7 @@
 <script setup>
 import apiReport from '@/api/modules/report'
 import { useRoute } from 'vue-router'
-import { Message, Toast } from 'tdesign-mobile-vue';
+import { DialogPlugin, Message, Toast } from 'tdesign-mobile-vue';
 import apiUser from '@/api/modules/user'
 import { useThrottleFn } from '@vueuse/core'
 
@@ -260,7 +260,33 @@ function handleGoTestRisk(){
 }
 
 //跳转购买
-function goPrimary(){
+async function goPrimary(){
+  // 校验开户
+  const res=await apiUser.checkUserStatus()
+  if(res.Ret===430){
+    DialogPlugin.confirm({
+      title: '温馨提示',
+      content: '您尚未开户,请开户后继续购买产品',
+      confirmBtn: '立即开户',
+      cancelBtn:'取消',
+      onConfirm:()=>{
+        wx.miniProgram.navigateTo({
+          url: `/pages/user/openAccount`
+        })
+      }
+    });
+    return
+  }
+  if(res.Ret===435){
+    DialogPlugin.confirm({
+      title: '温馨提示',
+      content: '开户中,请等待',
+      confirmBtn: '确认',
+    });
+    return
+  }
+  
+
   wx.miniProgram.navigateTo({
     url: `/pages-order/payPage/index?id=${productId}`
   })

+ 28 - 2
src/views/report/PDF.vue

@@ -1,7 +1,7 @@
 <script setup>
 import apiReport from '@/api/modules/report'
 import { useRoute } from 'vue-router'
-import { Message, Toast } from 'tdesign-mobile-vue';
+import { Message, Toast, DialogPlugin } from 'tdesign-mobile-vue';
 import apiUser from '@/api/modules/user'
 import { useThrottleFn } from '@vueuse/core'
 import dayjs from 'dayjs'
@@ -172,7 +172,33 @@ function handleGoTestRisk(){
 }
 
 //跳转购买
-function goPrimary(){
+async function goPrimary(){
+  // 校验开户
+  const res=await apiUser.checkUserStatus()
+  if(res.Ret===430){
+    DialogPlugin.confirm({
+      title: '温馨提示',
+      content: '您尚未开户,请开户后继续购买产品',
+      confirmBtn: '立即开户',
+      cancelBtn:'取消',
+      onConfirm:()=>{
+        wx.miniProgram.navigateTo({
+          url: `/pages/user/openAccount`
+        })
+      }
+    });
+    return
+  }
+  if(res.Ret===435){
+    DialogPlugin.confirm({
+      title: '温馨提示',
+      content: '开户中,请等待',
+      confirmBtn: '确认',
+    });
+    return
+  }
+  
+
   wx.miniProgram.navigateTo({
     url: `/pages-order/payPage/index?id=${productId}`
   })

+ 1 - 0
vite.config.js

@@ -70,6 +70,7 @@ export default defineConfig(({ mode }) => {
           // 定义全局的scss变量
           // 给导入的路径最后加上 ;
           // additionalData: `@import '@/styles/var.scss';`,
+          api: 'modern-compiler', // or "modern", "legacy"
         },
       },
     },