From 5a9be998d3dc8097d19d6f4833c0538c34bd6dcb Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期四, 09 一月 2025 10:29:18 +0800
Subject: [PATCH] 111

---
 src/views/system/tijian/index.vue |  160 +++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 107 insertions(+), 53 deletions(-)

diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue
index 34c9c2f..f164347 100644
--- a/src/views/system/tijian/index.vue
+++ b/src/views/system/tijian/index.vue
@@ -992,14 +992,14 @@
                   >閲嶇疆濂楅</el-button
                 >
                 <el-button
-  type="primary"
-  @click="submitPrice"
-  :loading="loadingSubmit"
-  :disabled="confirm || loadingSubmit"
-  v-if="showHidden.has_charge == 'N'"
-  size="mini"
->绛惧埌鐧昏</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="submitCheckinfee"
@@ -1495,7 +1495,6 @@
       ],
       isNow: 1,
       marryall: 0,
-      loadingSubmit: false,
       treeId: [],
       treeList: [],
       defaultKeys: [],
@@ -1530,6 +1529,7 @@
       hide: true,
       beat: false,
       dialogVisibles: false,
+      loadingSubmit: false,
       charge: false,
       src: "",
       url: "",
@@ -3757,55 +3757,109 @@
       });
       this.$tab.refreshPage();
     },
+
+    // 鏈�鍚庢彁浜ゆ寜閽�
     submitPrice() {
-  let _this = this;
-  
-  if (_this.tjCategory !== "") {
-    this.loadingSubmit = true; // Start loading
-
-    // Your existing code here...
-
-    gaibianzhekou(newArray).then((res) => {
-      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).finally(() => {
-            this.loadingSubmit = false; // End loading
-          });
+      let _this = this;
+      if (_this.tjCategory !== "") {
+        this.loadingSubmit = true;
+        let List = _this.tableData1; //鍗曚釜椤圭洰淇℃伅
+        if (this.responseList.cusId) {
+          var userId = this.responseList.cusId;
         } else {
-          // Handle case where pacId or tjOrderList is not available
-          this.loadingSubmit = false; // End loading
-          this.$message({
-            type: "warning",
-            message: "璇烽�夋嫨濂楅!",
-          });
+          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,
+            });
+          }
+        });
+        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,
+          })); // 鍒涘缓鏂扮殑瀵硅薄锛屽寘鍚� discount 鍜� id
+        gaibianzhekou(newArray).then((res) => {
+          if (res.code === 200) {
+            this.loadingSubmit = false;
+            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.$message({
+                type: "warning ",
+                message: "璇烽�夋嫨濂楅!",
+              });
+            }
+          } else {
+            this.loadingSubmit = false;
+            this.$modal.msgError("鏀瑰彉鎶樻墸閿欒");
+          }
+        });
       } else {
-        this.loadingSubmit = false; // End loading on error
-        this.$modal.msgError("鏀瑰彉鎶樻墸閿欒");
+        this.loadingSubmit = false;
+        this.$modal.msgError("璇烽�夋嫨浣撴绫诲埆");
       }
-    }).catch(() => {
-      this.loadingSubmit = false; // Ensure loading stops even on error
-    });
-  } else {
-    this.loadingSubmit = false; // End loading if tjCategory is empty
-    this.$modal.msgError("璇烽�夋嫨浣撴绫诲埆");
-  }
-},
+    },
   },
 };
 </script>

--
Gitblit v1.8.0