From 7fa5cdd283a6323f405a7cffc43c1c0e054ccca6 Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期二, 07 一月 2025 13:55:55 +0800
Subject: [PATCH] age

---
 src/views/system/tijian/index.vue |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue
index 0f4b28c..091cc22 100644
--- a/src/views/system/tijian/index.vue
+++ b/src/views/system/tijian/index.vue
@@ -2478,6 +2478,7 @@
     // 鏈�鏂颁娇鐢╳ebSocket閫氫俊
     readCardWebSocket(resultObj) {
       let _this = this;
+
       if (resultObj.code === 200 && resultObj.data.name != null) {
         //鍥炴樉鐩稿叧鏁版嵁
         _this.form.cusName = resultObj.data.name;
@@ -2489,6 +2490,29 @@
             /^(\d{4})(\d{2})(\d{2})$/,
             "$1-$2-$3"
           );
+        } else if (_this.form.cusIdcard) {
+          // 浠庤韩浠借瘉鍙风爜鎻愬彇鍑虹敓鏃ユ湡
+          var org_birthday = _this.form.cusIdcard.substring(6, 14);
+          _this.form.cusBrithday =
+            org_birthday.substring(0, 4) +
+            "-" +
+            org_birthday.substring(4, 6) +
+            "-" +
+            org_birthday.substring(6, 8);
+        }
+        // 濡傛灉鍑虹敓鏃ユ湡瀛樺湪锛岃绠楀勾榫�
+        if (_this.form.cusBrithday) {
+          var birthdays = new Date(_this.form.cusBrithday);
+          let d = new Date();
+          let age =
+            d.getFullYear() -
+            birthdays.getFullYear() -
+            (d.getMonth() < birthdays.getMonth() ||
+            (d.getMonth() == birthdays.getMonth() &&
+              d.getDate() < birthdays.getDate())
+              ? 1
+              : 0);
+          _this.form.age = age; // 璧嬪�艰绠楃殑骞撮緞
         }
         _this.form.cusAddr = resultObj.data.addres;
         _this.form.cusIdcard = resultObj.data.card;

--
Gitblit v1.8.0