From b06a903d08d6f5432105d12686ccaf074b45323a Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期四, 24 十月 2024 08:58:35 +0800 Subject: [PATCH] lkk 10.24 --- src/views/system/tijian/index.vue | 85 ++++++++++++++++++++++++++++++++++++------ 1 files changed, 72 insertions(+), 13 deletions(-) diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue index da8a012..a0587e3 100644 --- a/src/views/system/tijian/index.vue +++ b/src/views/system/tijian/index.vue @@ -2192,7 +2192,8 @@ this.discount = this.form.discount; } if (this.form.tjType === null) { - this.form.tjType = "2"; + // this.form.tjType = "2"; + this.form.tjType = "3"; } if (this.form.reservationId != null) { if (this.form.groupingId) { @@ -2478,8 +2479,34 @@ "$1-$2-$3" ); } - _this.form.cusAddr = resultObj.data.addres; _this.form.cusIdcard = resultObj.data.card; + if (_this.form.cusIdcard) { + const reg = + /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; + if (reg.test(_this.form.cusIdcard)) { + var org_birthday = _this.form.cusIdcard.substring(6, 14); + var birthday = + org_birthday.substring(0, 4) + + "-" + + org_birthday.substring(4, 6) + + "-" + + org_birthday.substring(6, 8); + var birthdays = new Date(birthday.replace(/-/g, "-")); + 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.cardreader = false; }; @@ -2489,7 +2516,7 @@ }; } else { // if (_this.inputSSS.indexOf(":1") != -1) { - + // var str1 = _this.inputSSS.indexOf(":1"); // var result1 = _this.inputSSS.substring(0, str1); @@ -2501,7 +2528,7 @@ // _this.inputSSS = result1 + result2; // } - _this.inputSSS = _this.inputSSS.replace(":1",""); + _this.inputSSS = _this.inputSSS.replace(":1", ""); var websocket = null; var url = this.valueUrls; // var url = 'ws://'+ getIp() +':6789/websocket' @@ -2552,17 +2579,49 @@ websocket.onmessage = function (event) { var resultObj = JSON.parse(event.data); _this.form.cusName = resultObj.data.name; - _this.form.cusSex = resultObj.data.gender; - _this.form.cusNational = resultObj.data.nation; - // _this.form.cusBrithday = resultObj.data.csrq; - // if (_this.form.cusBrithday) { - // _this.form.cusBrithday = _this.form.cusBrithday.replace( - // /^(\d{4})(\d{2})(\d{2})$/, - // "$1-$2-$3" - // ); - // } + + if( resultObj.data.nation == "姹夋棌"){ + _this.form.cusNational ="1"; + } + if(resultObj.data.gender == "鐢�"){ + _this.form.cusSex = 0; + }else{ + _this.form.cusSex = 1; + } + _this.form.cusBrithday = resultObj.data.birthday; + if (_this.form.cusBrithday) { + _this.form.cusBrithday = _this.form.cusBrithday.replace( + /^(\d{4})(\d{2})(\d{2})$/, + "$1-$2-$3" + ); + } _this.form.cusPhone = resultObj.data.phone; _this.form.cusIdcard = resultObj.data.idenno; + if (_this.form.cusIdcard) { + const reg = + /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; + if (reg.test(_this.form.cusIdcard)) { + var org_birthday = _this.form.cusIdcard.substring(6, 14); + var birthday = + org_birthday.substring(0, 4) + + "-" + + org_birthday.substring(4, 6) + + "-" + + org_birthday.substring(6, 8); + var birthdays = new Date(birthday.replace(/-/g, "-")); + 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.cardreader = false; }; -- Gitblit v1.8.0