ソースを参照

Merge branch 'feature/idCardLogin/261102' into pre

yuanmingze 1 日 前
親
コミット
6e3c7220ab

+ 2 - 2
src/services/modules/login/type.d.ts

@@ -1,6 +1,6 @@
 // src/types/auth.ts
 export interface LoginEtssmsRequest {
-  mobile: string
+  loginName: string
   code: string
   pushRecordId: string
   password: string
@@ -8,7 +8,7 @@ export interface LoginEtssmsRequest {
 
 // src/types/auth.ts
 export interface SendTtsSmsRequest {
-  mobile: string
+  loginName: string
   pushRecordId: string
   password: string
 }

+ 24 - 0
src/views/invoice-information/detail.vue

@@ -51,6 +51,11 @@
 
       <!-- 无数据 -->
       <div v-else class="empty">您的税费明细生成中,请稍后再试</div>
+
+      <div v-if="!loading && taxList.length" class="tax-notice" role="note">
+        <van-icon name="info" class="tax-notice-icon" aria-hidden="true" />
+        <span>税费为预估仅供参考,以税局核定、实际扣款为准。</span>
+      </div>
     </div>
 
     <!-- 底部栏 -->
@@ -180,6 +185,25 @@ onMounted(() => {
   }
 }
 
+.tax-notice {
+  display: flex;
+  align-items: center;
+  gap: 1.5vw;
+  margin-top: 3vw;
+  padding: 2.5vw 2vw;
+  border-radius: 1.5vw;
+  background: #fff8e8;
+  color: #b5791f;
+  font-size: 3.2vw;
+  line-height: 1.6;
+
+  .tax-notice-icon {
+    flex-shrink: 0;
+    color: #d99a2b;
+    font-size: 4vw;
+  }
+}
+
 /* ================= 税项 ================= */
 .tax-item {
   border-top: 0.3vw solid #f0f0f0;

+ 30 - 22
src/views/login/index.vue

@@ -11,16 +11,16 @@
       <div class="bold-text">已注册电子税务局</div>
 
       <div class="form">
-        <!-- 手机号输入 -->
+        <!-- 手机号 / 身份证号输入 -->
         <van-cell-group inset class="grop">
           <van-field
             class="input"
-            v-model="formData.mobile"
-            placeholder="请输入手机号"
+            v-model="formData.loginName"
+            placeholder="手机号/身份证号"
             clearable
-            type="tel"
-            maxlength="30"
-            @update:model-value="onInputMobile"
+            type="text"
+            maxlength="18"
+            :formatter="formatLoginName"
           />
         </van-cell-group>
 
@@ -53,7 +53,7 @@
             maxlength="6"
             @update:model-value="onInputCode"
           />
-          <button class="code-btn" :disabled="isCounting || !formData.mobile" @click="sendCode">
+          <button class="code-btn" :disabled="isCounting || !formData.loginName" @click="sendCode">
             {{ isCounting ? countDown + 's后重发' : '获取验证码' }}
           </button>
         </van-cell-group>
@@ -146,15 +146,29 @@ const switchPasswordType = () => {
 
 /* 表单数据 */
 const formData = reactive<LoginEtssmsRequest>({
-  mobile: '',
+  loginName: '',
   code: '',
   pushRecordId: '',
   password: '',
 })
 
-/* 限制手机号只能输入数字,最多 30 位 */
-const onInputMobile = (val: string) => {
-  formData.mobile = val.replace(/\D/g, '').slice(0, 30)
+/* 身份证末位允许 X,统一转换为大写。 */
+const formatLoginName = (val: string) =>
+  val
+    .replace(/[^\dXx]/g, '')
+    .toUpperCase()
+    .slice(0, 18)
+
+const validateLoginName = () => {
+  if (!formData.loginName) {
+    showToast('请输入手机号或身份证号')
+    return false
+  }
+  if (!/^(?:1\d{10}|\d{15}|\d{17}[\dX])$/.test(formData.loginName)) {
+    showToast('请输入正确的手机号或身份证号')
+    return false
+  }
+  return true
 }
 
 /* 限制验证码只能输入数字,最多 6 位 */
@@ -189,10 +203,7 @@ const sendCode = async () => {
     showToast('登录链接存在不完整或者输入错误')
     return
   }
-  if (!/^1\d{10}$/.test(formData.mobile)) {
-    showToast('请输入正确的手机号')
-    return
-  }
+  if (!validateLoginName()) return
   if (!formData.password) {
     showToast('密码不能为空')
     return
@@ -200,9 +211,9 @@ const sendCode = async () => {
   sending.value = true
   const toast = showLoadingToast({ message: '发送中…', forbidClick: true, duration: 3000 })
   const attemptId = loginAttemptId
-  const { mobile, password, pushRecordId } = formData
+  const { loginName, password, pushRecordId } = formData
   try {
-    const res = await sendEtsSmsApi({ mobile, password, pushRecordId })
+    const res = await sendEtsSmsApi({ loginName, password, pushRecordId })
     if (!isCurrentLogin(attemptId, pushRecordId)) return
     if (res.code === 0 && res.data) {
       showSuccessToast('发送成功')
@@ -291,10 +302,7 @@ const loginBtn = useDebounceFn(async () => {
     showFailToast('登录链接存在不完整或者输入错误')
     return
   }
-  if (!formData.mobile) {
-    showFailToast('请输入手机号')
-    return
-  }
+  if (!validateLoginName()) return
   if (!formData.password) {
     showFailToast('密码不能为空')
     return
@@ -395,7 +403,7 @@ const resetCountDown = () => {
 }
 
 const resetLoginState = () => {
-  formData.mobile = ''
+  formData.loginName = ''
   formData.password = ''
   formData.code = ''
   agree.value = false