From 4c4abb59d6ee838c61b851fcc7be93c0522c39c4 Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期五, 04 七月 2025 16:36:13 +0800
Subject: [PATCH] Merge branch 'master' of http://101.42.27.146:5001/r/ltkj_peisweb_region

---
 src/views/system/tijian/index.vue |  304 +++++++++++++++++++++++++-------------------------
 1 files changed, 153 insertions(+), 151 deletions(-)

diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue
index 602e058..f175afb 100644
--- a/src/views/system/tijian/index.vue
+++ b/src/views/system/tijian/index.vue
@@ -181,7 +181,7 @@
                 trigger: 'blur',
               },
             ]">
-              <el-input v-model="form.cusPhone" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" :disabled="isDisabled"
+              <el-input v-model="form.cusPhone" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" :disabled="isDisabled" maxlength="11"
                 @input="form.cusPhone = $event.replace(/\s/g, '')" />
             </el-form-item>
 
@@ -285,7 +285,8 @@
       <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" @submit.native.prevent="handle">
+          <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>
@@ -957,6 +958,7 @@
       // valueUrl: "ws://192.168.1.3:6789/websocket",
       valueUrl: "ws://127.0.0.1:6789/websocket",
       valueUrls: "ws://127.0.0.1:6789/websocket",
+      
       // valueUrls: "ws://"+getIp() +":6789/websocket",
       webSocket: null,
       // 韬唤璇侀渶瑕�
@@ -1709,46 +1711,57 @@
     },
     /** 鐧昏鎻愪氦鎸夐挳 */
     /** 鐧昏鎻愪氦鎸夐挳 */
-    submitForm() { 
-      let _this = this;
-      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, '') : '';
+  submitForm() {
+  let _this = this;
+  if (!this.form.cusPhone || !this.form.cusName) {
+    this.$message.warning("璇峰~閫夊繀濉」");
+    return;
+  }
 
-            // 澶勭悊鎬у埆鍊�
-            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.$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, '') : '';
+      // 娣诲姞 sfzImg 瀛楁
+      formData.sfzImg = this.imageUrl || ''; // 浣跨敤 base64 鏍煎紡鐨勫ご鍍忔暟鎹紝鑻ヤ负绌哄垯浼犵┖瀛楃涓�
 
-            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;
-            });
-          }
-        });
+      // 澶勭悊鎬у埆鍊�
+      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;
+      }
+
+      // 鍙�夛細妫�鏌� sfzImg 鏄惁瀛樺湪
+      if (!formData.sfzImg) {
+        this.$message.warning("璇峰厛鑾峰彇韬唤璇佸ご鍍�");
+        return;
+      }
+
+      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;
+      }).catch((error) => {
+        this.$modal.msgError("鐧昏澶辫触锛岃妫�鏌ユ暟鎹�");
+        console.error("Error in addCustomer:", error);
+      });
+    }
+  });
+},
 
     getmailType() {
       if (this.getType == "2") {
@@ -1926,11 +1939,15 @@
     // 鏈�鏂颁娇鐢╳ebSocket閫氫俊
     readCardWebSocket(resultObj) {
       let _this = this;
-
+      const isChineseChar = (char) => /[\u4E00-\u9FA5]/.test(char)
       if (resultObj.code === 200 && resultObj.data.name != null) {
         //鍥炴樉鐩稿叧鏁版嵁
         _this.form.cusName = resultObj.data.name;
-        _this.form.cusSex = resultObj.data.sex == "0" ? "濂�" : "鐢�";
+        if (isChineseChar(resultObj.data.sex)) {
+          _this.form.cusSex = resultObj.data.sex == "濂�" ? 1 : 0
+        } else {
+          _this.form.cusSex = resultObj.data.sex;
+        }
         _this.form.cusNational = resultObj.data.mz;
         _this.form.cusBrithday = resultObj.data.csrq;
         if (_this.form.cusBrithday) {
@@ -1985,7 +2002,7 @@
           //鍥炴樉鐩稿叧鏁版嵁
           _this.form.cusName = resultObj.resultContent.partyName;
           _this.form.cusSex =
-            resultObj.resultContent.gender == "0" ? "濂�" : "鐢�";
+            resultObj.resultContent.gender;
           _this.form.cusNational = resultObj.resultContent.nation;
           _this.form.cusBrithday = resultObj.resultContent.bornDay;
           if (_this.form.cusBrithday) {
@@ -2235,11 +2252,6 @@
       this.form.cusIdcard = params[0].sfzh;
       this.handleQuery();
     },
-
-    // 涓婁紶澶村儚
-    handleAvatarSuccess(res, file) {
-      this.imageUrl = URL.createObjectURL(file.raw);
-    },
     beforeAvatarUpload(file) {
       const isJPG = file.type === "image/jpeg";
       const isLt2M = file.size / 1024 / 1024 < 2;
@@ -2282,7 +2294,7 @@
         dwId: this.form.firmId,
       };
       if (this.name) {
-        let name= this.name.toLowerCase()
+        let name = this.name.toLowerCase()
         getPackageListName(name).then((response) => {
           this.newpacName = response.data;
           this.loading = false;
@@ -2940,9 +2952,9 @@
         let Price = 0;
         if (this.tableData1) {
           this.tableData1.forEach((item) => {
-            if (typeof item.nowPrice  === 'number') {
-              item.nowPrice  = Number(item.nowPrice.toFixed(3));
-          }
+            if (typeof item.nowPrice === 'number') {
+              item.nowPrice = Number(item.nowPrice.toFixed(3));
+            }
             if (item.tjCategory != null) {
               this.tjCategory = item.tjCategory;
             }
@@ -2956,7 +2968,7 @@
             Price += item.nowPrice || 0; // 绱姞瀹炴敹閲戦
             this.TotalPrice = Price.toFixed(2);
           });
-          console.log( this.TotalPrice1,this.TotalPrice)
+          console.log(this.TotalPrice1, this.TotalPrice)
           // 璁$畻鎶樻墸
           this.discount = this.TotalPrice1 > 0 ?
             (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10 : 0;
@@ -3243,110 +3255,100 @@
     },
 
     // 鏈�鍚庢彁浜ゆ寜閽�
-    submitPrice() {
-      let _this = this;
-      this.loadingSubmit = true;
-      if (_this.tjCategory !== "") {
-        let List = _this.tableData1; //鍗曚釜椤圭洰淇℃伅
-        if (this.responseList.cusId) {
-          var userId = this.responseList.cusId;
-        } else {
-          var userId = _this.form.cusId;
-        }
-        let tjType = _this.form.tjType;
-        if (this.tableData[0]) {
-          var pacId = this.tableData[0].pacId;
-        }
+  submitPrice() {
+  let _this = this;
+  this.loadingSubmit = true;
+  if (_this.tjCategory !== "") {
+    let List = _this.tableData1; // 鍗曚釜椤圭洰淇℃伅
+    if (this.responseList.cusId) {
+      var userId = this.responseList.cusId;
+    } else {
+      var userId = _this.form.cusId;
+    }
+    let tjType = _this.form.tjType;
+    if (this.tableData[0]) {
+      var pacId = this.tableData[0].pacId;
+    }
 
-        //tjOrderList//杩欎釜鏄鐞嗗畬鐨勬瘡涓�椤瑰椁愪俊鎭�
-        List.forEach((item) => {
-          if (item.list) {
-            item.list.forEach((item1) => {
-              this.tjOrderList.push({
-                proName: item1.proName,
-                proPrice: item1.nowPrice,
-                proId: item1.proId,
-              });
-            });
-          } else if (item.tjProjectList) {
-            item.tjProjectList.forEach((item1) => {
-              this.tjOrderList.push({
-                proName: item1.proName,
-                proPrice: item1.priceNow,
-                proId: item1.proId,
-              });
-            });
-          } else {
-            this.tjOrderList.push({
-              proName: item.proName,
-              proPrice: item.ysPrice,
-              proId: item.proId,
-            });
-          }
+    // tjOrderList 澶勭悊
+    List.forEach((item) => {
+      if (item.list) {
+        item.list.forEach((item1) => {
+          this.tjOrderList.push({
+            proName: item1.proName,
+            proPrice: item1.nowPrice,
+            proId: item1.proId,
+          });
         });
-        let copeWith = this.TotalPrice1;
-        let paidIn = this.TotalPrice.toString();
-        let discount = this.discount;
-        this.tjFlowingWater = { copeWith, paidIn, discount };
-        const newArray = this.tableData1
-          .filter((item) => item.discount < 10) // 杩囨护鍑� discount < 10 鐨勯」
-          .map((item) => ({
-            discount: item.discount,
-            parentProId: item.parentProId,
-            cusIdCard: item.cusId,
-            yhj: item.nowPrice
-          })); // 鍒涘缓鏂扮殑瀵硅薄锛屽寘鍚� discount 鍜� id
-        gaibianzhekou(newArray).then((res) => {
-          this.loadingSubmit = false;
-          if (res.code === 200) {
-
-            let data;
-
-            if (pacId || this.tjOrderList.length > 0) {
-              data = {
-                photo: this.srcUrl,
-                pacId,
-                tjOrderList: this.tjOrderList,
-                tjFlowingWater: this.tjFlowingWater,
-                userId,
-                tjType,
-                tjCategory: this.tjCategory,
-                firmId: this.form.firmId,
-                firmName: this.form.firmName,
-                firmDeptName: this.form.firmDeptName,
-              };
-
-              this.listgetOrder(data);
-            } else if (pacId || this.tjOrderList.length > 0) {
-              data = {
-                photo: this.srcUrl,
-                tjOrderList: this.tjOrderList,
-                tjFlowingWater: this.tjFlowingWater,
-                userId,
-                tjType,
-                tjCategory: this.tjCategory,
-                firmId: this.form.firmId,
-                firmName: this.form.firmName,
-                firmDeptName: this.form.firmDeptName,
-              };
-              this.listgetOrder(data);
-            } else {
-              this.loadingSubmit = false;
-              this.$message({
-                type: "warning ",
-                message: "璇烽�夋嫨濂楅!",
-              });
-            }
-          } else {
-            this.loadingSubmit = false;
-            this.$modal.msgError("鏀瑰彉鎶樻墸閿欒");
-          }
+      } else if (item.tjProjectList) {
+        item.tjProjectList.forEach((item1) => {
+          this.tjOrderList.push({
+            proName: item1.proName,
+            proPrice: item1.priceNow,
+            proId: item1.proId,
+          });
         });
       } else {
-        this.loadingSubmit = false;
-        this.$modal.msgError("璇烽�夋嫨浣撴绫诲埆");
+        this.tjOrderList.push({
+          proName: item.proName,
+          proPrice: item.ysPrice,
+          proId: item.proId,
+        });
       }
-    },
+    });
+
+    let copeWith = this.TotalPrice1;
+    let paidIn = this.TotalPrice.toString();
+    let discount = this.discount;
+    this.tjFlowingWater = { copeWith, paidIn, discount };
+
+    const newArray = this.tableData1
+      .filter((item) => item.discount < 10)
+      .map((item) => ({
+        discount: item.discount,
+        parentProId: item.parentProId,
+        cusIdCard: item.cusId,
+        yhj: item.nowPrice,
+      }));
+
+    gaibianzhekou(newArray).then((res) => {
+      this.loadingSubmit = false;
+      if (res.code === 200) {
+        let data;
+
+        if (pacId || this.tjOrderList.length > 0) {
+          data = {
+            photo: this.srcUrl, // 淇濈暀鍘熸湁 photo 瀛楁锛堝鏋滃悗绔粛闇�瑕侊級
+            sfzImg: this.imageUrl, // 娣诲姞 sfzImg 瀛楁锛屼紭鍏堜娇鐢ㄦ湇鍔″櫒URL锛岃嫢鏃犲垯浣跨敤base64
+            pacId,
+            tjOrderList: this.tjOrderList,
+            tjFlowingWater: this.tjFlowingWater,
+            userId,
+            tjType,
+            tjCategory: this.tjCategory,
+            firmId: this.form.firmId,
+            firmName: this.form.firmName,
+            firmDeptName: this.form.firmDeptName,
+          };
+
+          this.listgetOrder(data);
+        } else {
+          this.loadingSubmit = false;
+          this.$message({
+            type: "warning",
+            message: "璇烽�夋嫨濂楅!",
+          });
+        }
+      } else {
+        this.loadingSubmit = false;
+        this.$modal.msgError("鏀瑰彉鎶樻墸閿欒");
+      }
+    });
+  } else {
+    this.loadingSubmit = false;
+    this.$modal.msgError("璇烽�夋嫨浣撴绫诲埆");
+  }
+},
   },
 };
 </script>

--
Gitblit v1.8.0