From c0b8a21206c58a0161a179c15dfb73e4a8bbf55d Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期一, 19 五月 2025 17:36:17 +0800
Subject: [PATCH] 1

---
 src/views/system/tijian/index.vue |  204 +++++++++++++++++++++++++++++++++++---------------
 1 files changed, 142 insertions(+), 62 deletions(-)

diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue
index 1441feb..602e058 100644
--- a/src/views/system/tijian/index.vue
+++ b/src/views/system/tijian/index.vue
@@ -89,7 +89,8 @@
               <span slot="label" style="display: inline-block; border-bottom: 2px solid blue" @click="openname">
                 濮撳悕
               </span>
-              <el-input v-model="form.cusName" placeholder="璇疯緭鍏ュ鍚�" :disabled="isDisabled" />
+              <el-input v-model="form.cusName" placeholder="璇疯緭鍏ュ鍚�" :disabled="isDisabled"
+                @input="form.cusName = $event.replace(/\s/g, '')" />
             </el-form-item>
 
             <el-form-item label="璇佷欢绫诲瀷" prop="idType">
@@ -147,7 +148,8 @@
               <span slot="label" style="display: inline-block; border-bottom: 2px solid blue" @click="handleQuery">
                 璇佷欢鍙风爜
               </span>
-              <el-input :disabled="isDisabled" v-model="form.cusIdcard" placeholder="璇疯緭鍏ヨ韩浠借瘉鍙�" @input="inputChange" />
+              <el-input :disabled="isDisabled" v-model="form.cusIdcard" placeholder="璇疯緭鍏ヨ韩浠借瘉鍙�"
+                @input="handleIdCardInput" />
               <!-- <i style="
                     font-size: 1rem;
                     position: absolute;
@@ -179,7 +181,8 @@
                 trigger: 'blur',
               },
             ]">
-              <el-input v-model="form.cusPhone" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" :disabled="isDisabled" />
+              <el-input v-model="form.cusPhone" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" :disabled="isDisabled"
+                @input="form.cusPhone = $event.replace(/\s/g, '')" />
             </el-form-item>
 
             <el-form-item label="鍑虹敓鏃ユ湡" prop="cusBrithday">
@@ -282,7 +285,7 @@
       <el-tabs type="border-card" style="height: 560px; margin: 0 10px; width: 100%" v-model="activeNames"
         @tab-click="handleClick">
         <el-tab-pane label="濂楅" name="first">
-          <el-form :model="queryParam" ref="queryForm" size="small" :inline="true" v-if="showSearch" label-width="auto">
+          <el-form :model="queryParam" ref="queryForm" size="small" :inline="true" v-if="showSearch" label-width="auto" @submit.native.prevent="handle">
             <el-form-item label="濂楅鍚嶇О" prop="pacName">
               <el-input v-model="queryParam.pacName" placeholder="璇疯緭鍏ュ椁愬悕绉�" clearable @keyup.enter.native="handle" />
             </el-form-item>
@@ -336,7 +339,7 @@
                     margin-top: 10px;
                   ">
                   宸查�夐」鐩垪琛�
-                  
+
                 </div>
                 <el-table :data="DataLists" border style="width: 100%" height="400" :span-method="objectspanmethod">
                   <el-table-column prop="propinName" label="妫�鏌ラ」鐩�">
@@ -529,7 +532,7 @@
                 this.tableData1[0].pacName || ""
               }}</span>
               宸查�夐」鐩潯鏁帮細<span style="font-weight: 700; color: red; margin-right: 5px">{{ this.tableData1.length || 0
-                }}</span>鏉�
+              }}</span>鏉�
             </div>
             宸查�夐」鐩垪琛�
           </div>
@@ -731,6 +734,7 @@
   getByTjNum,
 } from "@/api/hosp/customer";
 import { getPrintSetUp } from "@/api/system/examcharge";
+import cnchar from 'cnchar';
 import {
   tuantiSelect,
   deptTreeSelect,
@@ -742,15 +746,12 @@
   getPackageListName,
   getaddtTransition,
   tuantiqueren,
-  getTransitionList,
   getTransitionList1,
-  getByTeamNo,
   delTbBycusCardIdAndProId,
   getLoadFile,
   getIsRequired,
   getconfigKey,
   getHistryTjOrderProByCusIdCard,
-  readCertCardInfos,
   gaibianzhekou,
 } from "@/api/system/tijian";
 import { addComp } from "@/api/system/comp";
@@ -1075,6 +1076,10 @@
     this.marryall = 0;
   },
   methods: {
+    handleIdCardInput(value) {
+      this.form.cusIdcard = value.replace(/\s/g, '');
+      this.inputChange(); // 淇濈暀鍘熸湁鐨勮韩浠借瘉杈撳叆澶勭悊閫昏緫
+    },
     debounceNumberChange(currentValue, oldValue) {
       clearTimeout(this.debounceTimer);
       this.debounceTimer = setTimeout(() => {
@@ -1114,7 +1119,7 @@
             });
             this.TotalPrice = this.tableData1.reduce((sum, item) => {
               return sum.plus(new Big(item.nowPrice || "0"));
-            }, new Big(0));
+            }, new Big(0)).toNumber();
             this.discount =
               (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) *
               10;
@@ -1145,13 +1150,13 @@
       row.nowPrice = result.toNumber();
       this.TotalPrice = this.tableData1.reduce((sum, item) => {
         return sum.plus(new Big(item.nowPrice || "0"));
-      }, new Big(0));
+      }, new Big(0)).toNumber();
 
       this.discount =
         (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10;
     },
     updateProPrice1(row) {
-      console.log("杩涘叆浜�1")
+      console.log("杩涘叆浜�1", row)
       const ordPrice = new Big(row.ordPrice);
       const discount = new Big(row.discount);
       const result = ordPrice.times(discount.div(10));
@@ -1223,11 +1228,9 @@
       this.open1 = true;
       this.title = "娣诲姞浣撴鍗曚綅淇℃伅缁存姢";
     },
-    idFn1(value) {
-      if (value) {
-        // console.log(value);
+    idFn1() {
+      if (this.form.firmName) {
         const originalCompId = this.form.firmId;
-        this.form.firmName = value;
         this.CompanyList.forEach((item) => {
           if (item.cnName == this.form.firmName) {
             this.form.firmId = item.drugManufacturerId;
@@ -1237,10 +1240,15 @@
         if (this.form.firmId === originalCompId) {
           this.form.firmId = "";
         }
-        if (this.form.firmId) {
-          this.form.tjType = "1";
-        }
+
       }
+
+      if (this.form.firmName) {
+        this.form.tjType = this.dict.type.dict_team[1].value;
+      } else {
+        this.form.tjType = this.dict.type.dict_team[0].value;
+      }
+
     },
     getCurrentDateTime() {
       const currentDate = new Date();
@@ -1272,20 +1280,42 @@
       }, 1000); //姣忕閽熸洿鏂颁竴娆�
     },
     filterNode(value, data) {
-      if (!value) return true;
+      // if (!value) return true;
       // return data.proName.indexOf(value) !== -1;
-      if (data.proName.indexOf(value) !== -1) {
-        return data.proName.indexOf(value) !== -1;
-      } else {
-        return data.proEngName.indexOf(value) !== -1;
-      }
+      // if (data.proName.indexOf(value) !== -1) {
+      //   return data.proName.indexOf(value) !== -1;
+      // } else {
+      //   return data.proEngName.indexOf(value) !== -1;
+      // }
+      if (!value) return true;
+      if (data.proName.indexOf(value) !== -1) return true;
+      let values = value.toLowerCase();
+      if (data.proEngName.indexOf(values) !== -1) return true;
+      // 鍖归厤灏忓啓
+      let arr = data.proName.spell('low', 'array');
+      let spell = arr.join('');
+      let lengths = [0];
+      for (var i = 0; i < arr.length - 1; i++) {
+        lengths.push(lengths[i] + arr[i].length);
+      };
+      //鍒ゆ柇label瀹屾暣鎷奸煶 涓� 杈撳叆鍊肩殑 index 鏄笉鏄瓑浜庢煇涓眽瀛楃涓�涓嫾闊冲瓧姣嶇殑index鍊�
+      if (lengths.indexOf(spell.indexOf(value)) !== -1) return true
+      // 澶у啓
+      let arrUp = data.proName.spell('up', 'array');
+      let spellUp = arrUp.join('');
+      let lengthsUp = [0];
+      for (var i = 0; i < arrUp.length - 1; i++) {
+        lengthsUp.push(lengthsUp[i] + arrUp[i].length);
+      };
+      return lengthsUp.indexOf(spellUp.indexOf(value)) !== -1;
     },
     filterpackage(value, data) {
       if (!value) return true;
       if (data.zhmc.indexOf(value) !== -1) {
         return data.zhmc.indexOf(value) !== -1;
       } else {
-        return data.pym.indexOf(value) !== -1;
+        let values = value.toLowerCase();
+        return data.pym.indexOf(values) !== -1;
       }
     },
     beforeDestroy() {
@@ -1621,7 +1651,7 @@
             item.nowPrice = result.toNumber();
             this.TotalPrice = this.tableData1.reduce((sum, item) => {
               return sum.plus(new Big(item.nowPrice || "0"));
-            }, new Big(0));
+            }, new Big(0)).toNumber();
           });
         })
         .catch(() => {
@@ -1678,35 +1708,46 @@
         });
     },
     /** 鐧昏鎻愪氦鎸夐挳 */
-    submitForm() {
+    /** 鐧昏鎻愪氦鎸夐挳 */
+    submitForm() { 
       let _this = this;
-      this.$refs["form"].validate((valid) => {
-        if (valid) {
-          // return;
-          if (this.form.cusSex === "濂�") {
-            this.form.cusSex = 1;
-          }
-          if (this.form.cusSex === "鐢�") {
-            this.form.cusSex = 0;
-          }
-          if (this.form.cusSex === "鏈煡") {
-            this.form.cusSex = 2;
-          }
-          if (this.form.tjType === "") {
-            this.form.tjType = this.dict.type.dict_team[0].value;
-          }
+      if (!this.form.cusPhone || !this.form.cusName) {
+        this.$message.warning("璇峰~閫夊繀濉」");
+      } else {
+        this.$refs["form"].validate((valid) => {
+          if (valid) {
+            // 鍒涘缓琛ㄥ崟鏁版嵁鐨勫壇鏈苟鍘婚櫎绌烘牸
+            const formData = { ...this.form };
+            formData.cusName = formData.cusName ? formData.cusName.replace(/\s/g, '') : '';
+            formData.cusPhone = formData.cusPhone ? formData.cusPhone.replace(/\s/g, '') : '';
+            formData.cusIdcard = formData.cusIdcard ? formData.cusIdcard.replace(/\s/g, '') : '';
 
-          addCustomer(this.form).then((response) => {
-            this.responseList = response.data;
+            // 澶勭悊鎬у埆鍊�
+            if (formData.cusSex === "濂�") {
+              formData.cusSex = 1;
+            }
+            if (formData.cusSex === "鐢�") {
+              formData.cusSex = 0;
+            }
+            if (formData.cusSex === "鏈煡") {
+              formData.cusSex = 2;
+            }
+            if (formData.tjType === "") {
+              formData.tjType = this.dict.type.dict_team[0].value;
+            
+            }
 
-            this.$modal.msgSuccess("鏂板鎴愬姛");
-
-            _this.tcShow = true;
-            _this.isDisabled = true;
-            _this.top = false;
-          });
-        }
-      });
+            addCustomer(formData).then((response) => {
+              this.responseList = response.data;
+              this.form.tjType = this.dict.type.dict_team[0].value;
+              this.$modal.msgSuccess("鏂板鎴愬姛");
+              _this.tcShow = true;
+              _this.isDisabled = true;
+              _this.top = false;
+            });
+          }
+        });
+      }
     },
 
     getmailType() {
@@ -1745,7 +1786,12 @@
             if (this.form.reservationId != null) {
               if (this.form.groupingId) {
                 this.form.firmName = this.form.compName;
-                this.form.tjType = "1";
+                this.dict.type.dict_team.forEach((item) => {
+                  if (item.label == "鍥㈤槦") {
+                    this.form.tjType = item.value;
+                  }
+                })
+                // this.form.tjType = this.dict.type.dict_team[1].value;
                 this.CompanyList.forEach((item) => {
                   if (item.cnName == this.form.firmName) {
                     this.form.firmId = item.drugManufacturerId;
@@ -1861,9 +1907,6 @@
               websocket.onmessage = (event) => {
                 var resultObj = eval("(" + event.data + ")");
                 this.readCardWebSocket(resultObj);
-              };
-              websocket.onclose = function () {
-                alert("璇诲崱鍣ㄨ繛鎺ュ叧闂�");
               };
             } else if (res.msg == "Y") {
               /* this.$refs.aaa.open = true;
@@ -2219,7 +2262,7 @@
       this.malldisble = false;
       this.defaultKeys = [];
       this.DataLists = [];
-      
+
     },
 
     cancell() {
@@ -2239,7 +2282,8 @@
         dwId: this.form.firmId,
       };
       if (this.name) {
-        getPackageListName(this.name).then((response) => {
+        let name= this.name.toLowerCase()
+        getPackageListName(name).then((response) => {
           this.newpacName = response.data;
           this.loading = false;
         });
@@ -2302,6 +2346,11 @@
 
     Package() {
       this.activeNames = "first";
+      if (this.form.cusSex == "鐢�") {
+        this.form.cusSex = 0;
+      } else if (this.form.cusSex == "濂�") {
+        _this.form.cusSex = 1;
+      }
       let cusSex = this.form.cusSex;
       this.datekey = Date.now();
       //鍏ㄩ儴濂楅
@@ -2885,10 +2934,15 @@
 
     // 澶勭悊璁㈠崟椤圭洰
     processOrderItems(cusId) {
+      console.log(11222)
       getTransitionList1(cusId).then((response) => {
         this.tableData1 = response.data;
+        let Price = 0;
         if (this.tableData1) {
           this.tableData1.forEach((item) => {
+            if (typeof item.nowPrice  === 'number') {
+              item.nowPrice  = Number(item.nowPrice.toFixed(3));
+          }
             if (item.tjCategory != null) {
               this.tjCategory = item.tjCategory;
             }
@@ -2898,8 +2952,11 @@
               });
             }
             this.TotalPrice1 += item.ordPrice || 0; // 绱姞搴旀敹閲戦
-            this.TotalPrice += item.nowPrice || 0; // 绱姞瀹炴敹閲戦
+            // this.TotalPrice += item.nowPrice || 0; 
+            Price += item.nowPrice || 0; // 绱姞瀹炴敹閲戦
+            this.TotalPrice = Price.toFixed(2);
           });
+          console.log( this.TotalPrice1,this.TotalPrice)
           // 璁$畻鎶樻墸
           this.discount = this.TotalPrice1 > 0 ?
             (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10 : 0;
@@ -2926,6 +2983,15 @@
         if (this.tableData[0]) {
           var pacId = this.tableData[0].pacId;
         }
+
+        // 鍘荤┖鏍煎鐞�
+        const processedForm = {
+          ...this.form,
+          cusName: this.form.cusName ? this.form.cusName.replace(/\s/g, '') : '',
+          cusPhone: this.form.cusPhone ? this.form.cusPhone.replace(/\s/g, '') : '',
+          cusIdcard: this.form.cusIdcard ? this.form.cusIdcard.replace(/\s/g, '') : ''
+        };
+
         List.forEach((item) => {
           if (item.list) {
             item.list.forEach((item1) => {
@@ -2951,6 +3017,7 @@
             });
           }
         });
+
         let copeWith = this.TotalPrice1;
         let paidIn = this.TotalPrice.toString();
         let discount = this.discount;
@@ -2968,6 +3035,10 @@
             getType: this.getType,
             addAddress: this.addAddress,
             tjCategory: this.tjCategory,
+            // 浣跨敤鍘绘帀绌烘牸鍚庣殑鏁版嵁
+            cusName: processedForm.cusName,
+            cusPhone: processedForm.cusPhone,
+            cusIdcard: processedForm.cusIdcard
           };
         } else {
           data = {
@@ -2978,8 +3049,13 @@
             tjType,
             getType: this.getType,
             tjCategory: this.tjCategory,
+            // 浣跨敤鍘绘帀绌烘牸鍚庣殑鏁版嵁
+            cusName: processedForm.cusName,
+            cusPhone: processedForm.cusPhone,
+            cusIdcard: processedForm.cusIdcard
           };
         }
+
         getOrder(data).then((res) => {
           this.$modal.msgSuccess("鎻愪氦鎴愬姛");
           this.tjNumbers = res.msg;
@@ -3218,6 +3294,7 @@
             discount: item.discount,
             parentProId: item.parentProId,
             cusIdCard: item.cusId,
+            yhj: item.nowPrice
           })); // 鍒涘缓鏂扮殑瀵硅薄锛屽寘鍚� discount 鍜� id
         gaibianzhekou(newArray).then((res) => {
           this.loadingSubmit = false;
@@ -3324,8 +3401,10 @@
 }
 
 .filter-tree {
-  overflow-y: auto; /* 淇濈暀绾靛悜婊氬姩鏉� */
-  overflow-x: hidden; /* 闅愯棌妯悜婊氬姩鏉� */
+  overflow-y: auto;
+  /* 淇濈暀绾靛悜婊氬姩鏉� */
+  overflow-x: hidden;
+  /* 闅愯棌妯悜婊氬姩鏉� */
   height: 350px;
 }
 
@@ -3436,6 +3515,7 @@
   width: 100%;
   display: flex;
 }
+
 /* .tab3 {
   overflow-y: auto;
 }

--
Gitblit v1.8.0