Jelajahi Sumber

新增人脸认证

yuanmingze 3 bulan lalu
induk
melakukan
5ff590b4fa

+ 6 - 0
src/router/routes.ts

@@ -36,6 +36,12 @@ export const routes: RouteRecordRaw[] = [
     component: () => import('@/views/identity-upload/index.vue'),
     meta: { title: '开票认证', requiresAuth: true },
   },
+  {
+    path: '/face-recognition',
+    name: 'FaceRecognition',
+    component: () => import('@/views/face-recognition/index.vue'),
+    meta: { title: '开票认证', requiresAuth: true },
+  },
   {
     path: '/:pathMatch(.*)*',
     redirect: '/login',

+ 7 - 0
src/services/modules/faceRecognition/index.ts

@@ -0,0 +1,7 @@
+import http from '../../index'
+
+export const getFaceAuthInfoApi = () => {
+  return http.post({
+    url: '/admin/invoice-order/get-face-auth-info',
+  })
+}

+ 8 - 1
src/services/modules/login/index.ts

@@ -1,5 +1,12 @@
 import http from '../../index'
-import type { LoginEtssmsRequest } from './type.d'
+import type { LoginEtssmsRequest, SendTtsSmsRequest } from './type.d'
+
+export const sendEtsSmsApi = (data: SendTtsSmsRequest) => {
+  return http.post({
+    url: '/admin/invoice-order/send-ets-sms',
+    data: data,
+  })
+}
 
 export const loginEtssmsApi = (data: LoginEtssmsRequest) => {
   return http.post({

+ 6 - 0
src/services/modules/login/type.d.ts

@@ -3,3 +3,9 @@ export interface LoginEtssmsRequest {
   mobile: string
   code: string
 }
+
+// src/types/auth.ts
+export interface SendTtsSmsRequest {
+  mobile: string
+  pushRecordId: string
+}

+ 46 - 0
src/views/face-recognition/index.vue

@@ -0,0 +1,46 @@
+<template>
+  <div class="face-recognition">
+    <!-- 顶部导航 -->
+    <van-nav-bar title="自然人开票" fixed placeholder />
+    <div class="card">
+      <StepProgress :activeStep="2" />
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import StepProgress from '@/components/StepProgress.vue'
+import { getFaceAuthInfoApi } from '@/services/modules/faceRecognition'
+import { onBeforeMount } from 'vue'
+
+const getConfirmInvoiceInfo = async () => {
+  const res = await getFaceAuthInfoApi()
+  console.log('res', res)
+}
+onBeforeMount(() => {
+  getConfirmInvoiceInfo()
+})
+</script>
+
+<style lang="scss" scoped>
+.face-recognition {
+  background: #f5f6f8;
+  min-height: 100vh;
+  font-family:
+    -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei',
+    sans-serif;
+  font-size: 3.8vw;
+  padding: 4vw 3.5vw;
+
+  .card {
+    background: #fff;
+    border-radius: 14px;
+    margin-bottom: 5vw;
+    padding: 4vw 3.5vw;
+    box-shadow:
+      0 4px 12px rgba(0, 0, 0, 0.06),
+      0 1px 3px rgba(0, 0, 0, 0.04);
+    transition: all 0.3s ease;
+  }
+}
+</style>

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

@@ -149,7 +149,14 @@ const getConfirmInvoiceInfo = async () => {
 
 const nextBtn = async () => {
   const res = await getStatusApi(params)
+  console.log('res', res)
+
   if (res.code === 0) {
+    if (!res.data.eventStatus) {
+      return router.push({
+        path: '/face-recognition',
+      })
+    }
     // 当前账户没有身份照片,跳转上传证件页面
     if (!res.data.isIdImgReady) {
       router.push({
@@ -172,7 +179,7 @@ onMounted(() => {
 <style scoped lang="scss">
 .invoice-page {
   background: #f5f6f8;
-  min-height: 100dvh;
+  min-height: 100vh;
   font-family:
     -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei',
     sans-serif;

+ 21 - 9
src/views/login/index.vue

@@ -62,9 +62,9 @@
 <script setup lang="ts">
 import { ref, reactive, onMounted } from 'vue'
 import { useRouter } from 'vue-router'
-import { showFailToast, showToast } from 'vant'
-import { loginEtssmsApi } from '@/services/modules/login'
-import type { LoginEtssmsRequest } from '@/services/modules/login/type.d'
+import { showFailToast, showSuccessToast, showToast } from 'vant'
+import { sendEtsSmsApi, loginEtssmsApi } from '@/services/modules/login'
+import type { SendTtsSmsRequest, LoginEtssmsRequest } from '@/services/modules/login/type.d'
 import { useUserStore } from '@/stores/modules/user'
 
 const userStore = useUserStore()
@@ -77,6 +77,11 @@ const formData = reactive<LoginEtssmsRequest>({
   code: '5657',
 })
 
+const sendEtsSms = reactive<SendTtsSmsRequest>({
+  mobile: '',
+  pushRecordId: '2',
+})
+
 /* 限制手机号只能输入数字,最多 30 位 */
 const onInputMobile = (val: string) => {
   formData.mobile = val.replace(/\D/g, '').slice(0, 30)
@@ -96,14 +101,17 @@ const countDown = ref(60)
 let timer: number | undefined
 
 /* 发送验证码 */
-const sendCode = () => {
+const sendCode = async () => {
   if (!/^1\d{10}$/.test(formData.mobile)) {
     showToast('请输入正确的手机号')
     return
   }
-
-  showToast('验证码已发送')
-  startCountDown()
+  sendEtsSms.mobile = formData.mobile
+  const res = await sendEtsSmsApi(sendEtsSms)
+  if (res.code === 0 && res.data) {
+    showSuccessToast('发送成功')
+    startCountDown()
+  }
 }
 
 /* 倒计时逻辑 */
@@ -121,10 +129,14 @@ const startCountDown = () => {
 
 /* 登录逻辑 */
 const login = async () => {
-  if (!formData.mobile || !formData.code) {
+  if (!formData.mobile) {
     showFailToast('请输入手机号和验证码')
     return
   }
+  if (!formData.code) {
+    showFailToast('验证码不能为空')
+    return
+  }
 
   if (!agree.value) {
     showFailToast('请勾选阅读并同意')
@@ -252,7 +264,7 @@ onMounted(() => {
         line-height: 5vw;
         margin: 4vw 0;
         color: #666;
-        padding-left: 50px;
+        padding-left: 36px;
         label {
           display: flex;
           align-items: center;