From c870390bfc28b314f30240352895c5d6c466c148 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期日, 20 九月 2026 13:46:23 +0800
Subject: [PATCH] AI修复

---
 src/views/project/fund/applyDetail/index.vue |   59 ++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/src/views/project/fund/applyDetail/index.vue b/src/views/project/fund/applyDetail/index.vue
index 60c5e5c..8f7e001 100644
--- a/src/views/project/fund/applyDetail/index.vue
+++ b/src/views/project/fund/applyDetail/index.vue
@@ -786,6 +786,7 @@
 import Li_area_select from "@/components/Address";
 import OrgSelecter from "@/views/project/components/orgselect";
 import { getToken } from "@/utils/auth";
+import { moneySum, moneyMul, moneySub, moneyRound } from "@/utils/money";
 import CustomImageViewer from "@/components/CustomImageViewer"; // 鏍规嵁浣犵殑璺緞璋冩暣
 
 export default {
@@ -1607,7 +1608,7 @@
               let tempDetail = this.rbDetails[j];
               if (
                 isNaN(parseFloat(tempDetail.amount)) ||
-                parseFloat(tempDetail.amount) == 0
+                moneyRound(tempDetail.amount) == 0
               ) {
                 this.$modal.msgWarning(
                   "鏈嶅姟椤圭洰琛ㄤ腑锛岀" +
@@ -1622,7 +1623,7 @@
               let tempDetail = this.rbDetails[j];
               if (
                 isNaN(parseFloat(tempDetail.amount)) ||
-                parseFloat(tempDetail.amount) == 0
+                moneyRound(tempDetail.amount) == 0
               ) {
                 this.$modal.msgWarning(
                   "鏈嶅姟椤圭洰琛ㄤ腑锛岀" +
@@ -1633,7 +1634,7 @@
               }
               if (
                 isNaN(parseFloat(tempDetail.taxamount)) ||
-                parseFloat(tempDetail.taxamount) == 0
+                moneyRound(tempDetail.taxamount) == 0
               ) {
                 tempDetail.taxedamount = parseFloat(tempDetail.amount);
               } else {
@@ -2105,14 +2106,13 @@
 
     //璁$畻涓◣锛歵ype(A:宸茬煡绋庡墠閲戦锛岃绠楃◣鍚庨噾棰濓紱B锛氬凡鐭ョ◣鍚庨噾棰濓紝璁$畻绋庡墠閲戦)
     calculateTax(row, type) {
-      let targetValue = 0;
       for (let i = 0; i < this.rbDetails.length; i++) {
         if (!this.rbDetails[i].amount) {
           this.rbDetails[i].amount = 0;
         }
-        targetValue += parseFloat(this.rbDetails[i].amount); // 鍋囪姣忎釜瀵硅薄涓殑鐗瑰畾鍊煎瓨鍌ㄥ湪'specificValue'灞炴�т笅
       }
-      this.form.pretaxcost = targetValue;
+      // 鍚堣閲戦蹇呴』绮剧‘绱姞锛屽惁鍒欎細鍐欏叆 form.pretaxcost 骞惰惤搴�
+      this.form.pretaxcost = moneySum(this.rbDetails, "amount");
     },
 
     //瀵煎叆鎵�鏈夐」鐩�
@@ -2274,7 +2274,7 @@
               let tempDetail = this.rbDetails[j];
               if (
                 isNaN(parseFloat(tempDetail.amount)) ||
-                parseFloat(tempDetail.amount) == 0
+                moneyRound(tempDetail.amount) == 0
               ) {
                 this.$modal.msgWarning(
                   "鏈嶅姟椤圭洰琛ㄤ腑锛岀" +
@@ -2289,7 +2289,7 @@
               let tempDetail = this.rbDetails[j];
               if (
                 isNaN(parseFloat(tempDetail.amount)) ||
-                parseFloat(tempDetail.amount) == 0
+                moneyRound(tempDetail.amount) == 0
               ) {
                 this.$modal.msgWarning(
                   "鏈嶅姟椤圭洰琛ㄤ腑锛岀" +
@@ -2300,7 +2300,7 @@
               }
               if (
                 isNaN(parseFloat(tempDetail.taxamount)) ||
-                parseFloat(tempDetail.taxamount) == 0
+                moneyRound(tempDetail.taxamount) == 0
               ) {
                 tempDetail.taxedamount = parseFloat(tempDetail.amount);
               } else {
@@ -2581,33 +2581,32 @@
         });
       //鍏ㄩ儴鍒犻櫎鍚庢坊鍔犱竴鏉℃柊琛�
     },
-    //璁$畻鎬婚噾棰�
+    //璁$畻鎬婚噾棰濓紙閲戦涓�寰嬭蛋绮剧‘杩愮畻锛岀姝� parseFloat 绱姞锛�
     sumTotalFee(row) {
-      let allSum = 0;
+      const detailsArr = [];
       if (this.form.applytype != null) {
         for (let i = 0; i < this.rbDetails.length; i++) {
+          const detail = this.rbDetails[i];
           let totalFee = 0;
           let taxFee = 0;
           if (this.form.applytype == 1 || this.form.applytype == 2) {
-            //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣
-            if (!isNaN(parseFloat(this.rbDetails[i].amount))) {
-              totalFee += parseFloat(this.rbDetails[i].amount);
-              taxFee += parseFloat(this.rbDetails[i].amount);
+            //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣锛氱◣鍓� - 鎵g◣
+            if (!isNaN(parseFloat(detail.amount))) {
+              totalFee = moneySub(totalFee, -parseFloat(detail.amount));
+              taxFee = moneySub(taxFee, -parseFloat(detail.amount));
             }
-            if (!isNaN(parseFloat(this.rbDetails[i].taxamount))) {
-              totalFee -= parseFloat(this.rbDetails[i].taxamount);
-              taxFee -= parseFloat(this.rbDetails[i].taxamount);
+            if (!isNaN(parseFloat(detail.taxamount))) {
+              totalFee = moneySub(totalFee, detail.taxamount);
+              taxFee = moneySub(taxFee, detail.taxamount);
             }
           } else if (this.form.applytype == 3 || this.form.applytype == 4) {
             //鍗曚环*鏁伴噺=绋庡墠閲戦
             if (
-              !isNaN(parseFloat(this.rbDetails[i].price)) &&
-              !isNaN(parseFloat(this.rbDetails[i].quantity))
+              !isNaN(parseFloat(detail.price)) &&
+              !isNaN(parseFloat(detail.quantity))
             ) {
-              totalFee +=
-                parseFloat(this.rbDetails[i].price) *
-                parseFloat(this.rbDetails[i].quantity);
-              this.rbDetails[i].amount = totalFee;
+              totalFee = moneyMul(detail.price, detail.quantity);
+              detail.amount = totalFee;
             }
           }
 
@@ -2616,9 +2615,10 @@
           //   this.rbDetails[i].taxedamount = taxFee.toFixed(2);
           // }
 
-          allSum += totalFee;
+          detailsArr.push(totalFee);
         }
       }
+      const allSum = moneyRound(moneySum(detailsArr));
       // this.form.amountrequested = allSum.toFixed(2);
       // this.$forceUpdate();
     },
@@ -3321,7 +3321,9 @@
 
   //鐢熷懡鍛ㄦ湡 - 鎸傝浇瀹屾垚锛堝彲浠ヨ闂瓺OM鍏冪礌锛�
   mounted() {
-    window.addEventListener("beforeunload", e => this.beforeunloadHandler(e));
+    // 瀛樹綇鍚屼竴涓紩鐢紝鍚﹀垯 removeEventListener 浼犳柊绠ご鍑芥暟鏃犳硶鐪熸绉婚櫎锛屼細娉勬紡鐩戝惉鍣�
+    this._beforeUnloadHandler = e => this.beforeunloadHandler(e);
+    window.addEventListener("beforeunload", this._beforeUnloadHandler);
     this.getUserList();
     let apiaccountselectform = this.accountselectform;
     let apiform = this.form;
@@ -3337,7 +3339,10 @@
   updated() { }, //鐢熷懡鍛ㄦ湡 - 鏇存柊涔嬪悗
   beforeDestroy() { }, //鐢熷懡鍛ㄦ湡 - 閿�姣佷箣鍓�
   destroyed() {
-    window.removeEventListener("beforeunload", e => this.beforeunloadFn(e));
+    if (this._beforeUnloadHandler) {
+      window.removeEventListener("beforeunload", this._beforeUnloadHandler);
+      this._beforeUnloadHandler = null;
+    }
   }, //鐢熷懡鍛ㄦ湡 - 閿�姣佸畬鎴�
   activated() { } //濡傛灉椤甸潰鏈塳eep-alive缂撳瓨鍔熻兘锛岃繖涓嚱鏁颁細瑙﹀彂
 };

--
Gitblit v1.9.3