From d6df4fd6344569bffcd575f48f04da4a54f51036 Mon Sep 17 00:00:00 2001
From: wwl <xchao828@163.com>
Date: 星期二, 21 一月 2025 18:02:58 +0800
Subject: [PATCH] 1

---
 src/views/system/tijian/index.vue  |   48 ++++++++++------
 vue.config.js                      |    4 
 src/views/system/package/index.vue |   97 ++++++++++++++++++--------------
 3 files changed, 87 insertions(+), 62 deletions(-)

diff --git a/src/views/system/package/index.vue b/src/views/system/package/index.vue
index 06436ff..e8b6b9e 100644
--- a/src/views/system/package/index.vue
+++ b/src/views/system/package/index.vue
@@ -823,6 +823,7 @@
       // 鏄惁鏄剧ず寮瑰嚭灞�
       open: false,
       Seachopen: false,
+      checkedNodes: [],
       pacId: "",
       // 鎬绘潯鏁�
       total: 0,
@@ -1152,14 +1153,19 @@
 
     /** 鍒犻櫎鎸夐挳鎿嶄綔 */
     handleDelete1(row) {
-      this.DataList = this.DataList.filter((item) => item.proId !== row.proId);
-      const tree = this.$refs.tree;
-      const node = tree.getNode(row.proId); // 鏍规嵁鑺傜偣鐨勫敮涓�鏍囪瘑鑾峰彇鑺傜偣瀵硅薄
-      if (node) {
-        node.setChecked(false); // 鍙栨秷閫変腑鐘舵��
+      this.DataList = this.DataList.filter(item => item.proId !== row.proId);
+      // 浠� checkedNodes 涓Щ闄�
+      const index = this.checkedNodes.indexOf(row.proId);
+      if (index > -1) {
+        this.checkedNodes.splice(index, 1);
       }
+      const tree = this.$refs.tree;
+      const node = tree.getNode(row.proId); 
+      if (node) {
+        node.setChecked(false); 
+      }
+      this.updateTotalPrice();
     },
-
     getSelectValue(val) {
       this.form.tjProjectList.forEach((formitem) => {
         if (formitem.proName == val) {
@@ -1274,17 +1280,12 @@
       search(this.queryParams1).then((response) => {
         this.Treedata = response.data.list; // 鏇存柊鏍戝舰鏁版嵁
         this.total1 = response.data.total; // 鏇存柊鎬绘潯鏁�
+        this.pics = this.DataList.reduce((total, item) => total + item.priceOrd, 0);
 
-        const selectedIds = this.DataList.map((item) => item.proId);
-        // 鏇存柊 checkedkey 浣垮緱閫変腑鐨勯」鐩繚鎸侀�変腑鐘舵��
-        this.checkedkey = selectedIds.filter((id) =>
-          this.Treedata.some((item) => item.proId === id)
-        );
-
-        this.pics = this.DataList.reduce(
-          (total, item) => total + item.priceOrd,
-          0
-        );
+        // 纭繚鍦ㄦ暟鎹姞杞藉悗淇濇寔閫変腑鐘舵��
+        this.$nextTick(() => {
+          this.$refs.tree.setCheckedKeys(this.checkedNodes);
+        });
       });
       this.loading = false;
     },
@@ -1351,8 +1352,12 @@
     //   });
     // },
     handleFilterInput() {
-      this.queryParams.page = 1; // 鎼滅储鏃堕噸缃负绗竴椤�
+      this.queryParams1.page = 1; // 鎼滅储鏃堕噸缃负绗竴椤�
       this.getDataList(); // 璋冪敤鎺ュ彛鑾峰彇鏁版嵁
+      // 鍦ㄨ繃婊ゅ悗锛岄噸鏂拌缃�変腑鐘舵��
+      this.$nextTick(() => {
+        this.$refs.tree.setCheckedKeys(this.checkedNodes);
+      });
     },
 
     // 鍒嗛〉浜嬩欢
@@ -1362,36 +1367,44 @@
       this.getDataList(); // 璋冪敤鎺ュ彛鑾峰彇鏁版嵁
     },
 
-    handleCurrentChecked(data, checked, checkedNodes) {
-      this.dataObj = data;
-      this.checkedObj = checked;
-
+    handleCurrentChecked(data, checked, indeterminate) {
       if (checked) {
-        // 妫�鏌ユ槸鍚﹀凡瀛樺湪浜� DataL
-        this.DataList.push({
-          proId: data.proId,
-          proName: data.proName,
-          priceOrd: data.proPrice, // 鍘熶环锛岀‘淇濊祴鍊兼纭�
-          limits: 10,
-          priceNow: data.proPrice,
-        });
+        // 濡傛灉宸查�夊垪琛ㄤ腑涓嶅瓨鍦ㄦ椤圭洰锛屽垯娣诲姞
+        if (!this.DataList.some(item => item.proId === data.proId)) {
+          this.DataList.push({
+            proId: data.proId,
+            proName: data.proName,
+            priceOrd: data.proPrice,
+            limits: 10,
+            priceNow: data.proPrice
+          });
+        }
+        // 娣诲姞鍒� checkedNodes 鏁扮粍
+        if (!this.checkedNodes.includes(data.proId)) {
+          this.checkedNodes.push(data.proId);
+        }
       } else {
-        let index = this.DataList.findIndex(
-          (item) => item.proId === data.proId
-        );
-        if (index !== -1) {
-          this.DataList.splice(index, 1);
+        // 鍙栨秷閫変腑鏃讹紝浠嶥ataList涓Щ闄�
+        this.DataList = this.DataList.filter(item => item.proId !== data.proId);
+        // 浠� checkedNodes 涓Щ闄�
+        const index = this.checkedNodes.indexOf(data.proId);
+        if (index > -1) {
+          this.checkedNodes.splice(index, 1);
         }
       }
-      this.pics = 0;
-      this.TotalPrice1 = 0;
-      this.DataList.forEach((item) => {
-        this.pics += item.priceOrd;
-        this.form.counterPrice += item.priceOrd;
-        this.TotalPrice1 += item.priceOrd; // 鍙互鏍规嵁闇�瑕佹敼鎴愪紭鎯犱环 `priceNow`
-      });
-    },
 
+      // 鏇存柊浼樻儬浠峰拰鎬讳环
+      this.updateTotalPrice();
+    }, 
+    updateTotalPrice() {
+      // 璁$畻鎵�鏈夐」鐩殑鎬讳紭鎯犱环
+      this.form.xianprice = this.DataList.reduce((sum, item) => {
+        return sum.plus(new Big(item.priceNow || "0"));
+      }, new Big(0)).toNumber();
+
+      // 璁$畻鍘熶环鎬诲拰
+      this.pics = this.DataList.reduce((total, item) => total + item.priceOrd, 0);
+    },
     spliceData() {
       for (var i = 0; i < this.DataList.length; i++) {
         for (var j = i + 1; j < this.DataList.length; j++) {
diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue
index bbea675..9966fbe 100644
--- a/src/views/system/tijian/index.vue
+++ b/src/views/system/tijian/index.vue
@@ -477,7 +477,7 @@
               <el-form-item label="浣撴绫诲瀷">
                 <el-select v-model="form.tjType" placeholder="璇烽�夋嫨浣撴绫诲瀷">
                   <el-option v-for="dict in dict.type.dict_team" :key="dict.value" :label="dict.label"
-                    :value="dict.value" :disabled="!form.firmId && dict.value === '1'"></el-option>
+                    :value="dict.value"></el-option>
                 </el-select>
               </el-form-item>
               <el-form-item label="浣撴绫诲埆">
@@ -505,8 +505,8 @@
               <el-form-item style="margin-left: 149px">
                 <el-button type="primary" @click="Package" size="mini" style="margin-right: 20px">閫夋嫨濂楅</el-button>
                 <el-button type="primary" @click="resetpackage" size="mini" style="margin-right: 20px">閲嶇疆濂楅</el-button>
-                <el-button type="primary" @click="submitPrice" :loading="loadingSubmit"
-                  :disabled="confirm || loadingSubmit" v-if="showHidden.has_charge == 'N'" size="mini">绛惧埌鐧昏</el-button>
+                <el-button type="primary" @click="submitPrice" :loading="loadingSubmit" :disabled="loadingSubmit"
+                  v-if="showHidden.has_charge == 'N'" size="mini">绛惧埌鐧昏</el-button>
                 <el-button type="primary" @click="submitCheckinfee" :disabled="confirm"
                   v-if="showHidden.has_charge == 'Y'" size="mini">鐧昏鏀惰垂</el-button>
               </el-form-item>
@@ -1074,9 +1074,7 @@
     };
   },
   watch: {
-    filterText(val) {
-      this.$refs.tree.filter(val);
-    },
+
     filterage(val) {
       this.$refs.treas.filter(val);
     },
@@ -1647,6 +1645,10 @@
         });
     },
     numberChangeXianPrice(currentValue, oldValue) {
+      // 濡傛灉鐜颁环娌℃湁鍙樺寲锛岀洿鎺ヨ繑鍥�
+      if (this.TotalPrice === this.lastXianPrice || !this.TotalPrice) {
+        return;
+      }
       this.$confirm("纭畾淇敼鎵�鏈夊瓙椤圭殑鎶樻墸鍚楋紵", "鎻愮ず", {
         confirmButtonText: "纭畾",
         cancelButtonText: "鍙栨秷",
@@ -1685,6 +1687,7 @@
               );
             }
           }
+          this.lastXianPrice = this.TotalPrice;
         })
         .catch(() => {
           this.discount = oldValue;
@@ -1831,7 +1834,7 @@
         });
       } else {
         let configKey = "getInfoFromSqlData";
-        getconfigKey(configKey).then((res) => {  
+        getconfigKey(configKey).then((res) => {
           if (res.code == 200) {
             if (res.msg == "N") {
               var websocket = null;
@@ -1882,7 +1885,7 @@
               /* this.$refs.aaa.open = true;
               this.$refs.aaa.getAllList();
               this.$refs.aaa.title = "璇佷欢瀛楀吀"; */
-              
+
             } else if (res.msg == "S") {
               this.cardreader = true;
               _this.cardreaderradio = 3;
@@ -2282,8 +2285,7 @@
       this.DataList = []; // 娓呯┖宸查�夐」鐩垪琛�
       this.checkedkey = []; // 娓呯┖鏍戠殑閫変腑鐘舵��
       this.checkedListkey = [];
-      this.TreedataList = [];
-      this.$refs.tree.setCheckedKeys([]); // 閲嶇疆鏍戦�変腑鐘舵��
+      this.TreedataList = []
 
       let data = {
         cusId,
@@ -2628,8 +2630,6 @@
     handleCurrentChecked(data, checked, checkedNodes) {
       this.dataObj = data;
       if (checked.checkedNodes.length != 0) {
-        this.$refs.tree.setCheckedKeys([data.proId]);
-
         let proId = data.proId;
         getProSonDxList(proId).then((res) => {
           this.TreedataList = res.data.list;
@@ -2804,9 +2804,8 @@
         pacId: _this.pacId,
         proIds: this.proIds,
       };
-
       // 鏍规嵁浣撴绫诲瀷閫夋嫨涓嶅悓鐨勫鐞嗘柟娉�
-      if (this.form.tjType == 1) {
+      if (this.form.firmId) {
         tuantiqueren(data).then((response) => {
           if (response.code == 200) {
             this.processOrderItems(cusId);
@@ -2831,11 +2830,13 @@
       this.DataLists = [];
     },
 
-    // 澶勭悊璁㈠崟椤圭洰
     processOrderItems(cusId) {
       getTransitionList1(cusId).then((response) => {
         this.tableData1 = response.data;
         if (this.tableData1) {
+          let totalOrdPrice = new Big(0);
+          let totalNowPrice = new Big(0);
+
           this.tableData1.forEach((item) => {
             if (item.tjCategory != null) {
               this.tjCategory = item.tjCategory;
@@ -2845,9 +2846,18 @@
                 this.treeList.push(item9.proId);
               });
             }
-            this.TotalPrice1 += item.ordPrice || 0; // 绱姞搴旀敹閲戦
-            this.TotalPrice += item.nowPrice || 0; // 绱姞瀹炴敹閲戦
+            // 浣跨敤Big.js杩涜鍔犳硶浠ラ伩鍏嶇簿搴︿涪澶�
+            totalOrdPrice = totalOrdPrice.plus(new Big(item.ordPrice || 0));
+            totalNowPrice = totalNowPrice.plus(new Big(item.nowPrice || 0));
           });
+
+          // 灏咮ig鏁拌浆鎹㈠洖鏁板�煎苟淇濈暀涓や綅灏忔暟
+          this.TotalPrice1 = totalOrdPrice.toNumber().toFixed(2);
+          this.TotalPrice = totalNowPrice.toNumber().toFixed(2);
+
+          // 纭繚TotalPrice鏄竴涓瓧绗︿覆锛岄槻姝㈠悗缁搷浣滃鑷寸簿搴︿涪澶�
+          this.TotalPrice = this.TotalPrice.toString();
+
           // 璁$畻鎶樻墸
           this.discount = this.TotalPrice1 > 0 ?
             (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10 : 0;
@@ -3168,8 +3178,9 @@
             cusIdCard: item.cusId,
           })); // 鍒涘缓鏂扮殑瀵硅薄锛屽寘鍚� discount 鍜� id
         gaibianzhekou(newArray).then((res) => {
+          this.loadingSubmit = false;
           if (res.code === 200) {
-            this.loadingSubmit = false;
+
             let data;
 
             if (pacId || this.tjOrderList.length > 0) {
@@ -3201,6 +3212,7 @@
               };
               this.listgetOrder(data);
             } else {
+              this.loadingSubmit = false;
               this.$message({
                 type: "warning ",
                 message: "璇烽�夋嫨濂楅!",
diff --git a/vue.config.js b/vue.config.js
index 0e775f0..fd5ce6e 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -53,8 +53,8 @@
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
         // target: `https://ltpeis.xaltjdkj.cn:5801/`,
-        // target: `http://192.168.1.2:5011`,
-        target: `http://192.168.1.113:5011`,
+        target: `http://192.168.1.2:5011`,
+        // target: `http://192.168.1.113:5011`,
         // // target: `http://192.168.0.99:8080/ltkj-admin`,
         // target: `https://ltpeis.xaltjdkj.cn:5011/ltkj-admin`,
         // target: `http://10.168.0.9:5011`,

--
Gitblit v1.8.0