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 |  138 +++++++++++++++++++++++++++++++++++----------
 1 files changed, 107 insertions(+), 31 deletions(-)

diff --git a/src/views/project/fund/applyDetail/index.vue b/src/views/project/fund/applyDetail/index.vue
index 9497b6f..8f7e001 100644
--- a/src/views/project/fund/applyDetail/index.vue
+++ b/src/views/project/fund/applyDetail/index.vue
@@ -735,7 +735,8 @@
   getdownloadBX,
   addorupdateFund,
   ManualCalculation,
-  getdetailsByItemId
+  getdetailsByItemId,
+  listbypower
 } from "@/api/project/fund";
 
 import {
@@ -785,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 {
@@ -813,7 +815,7 @@
     "sys_professionaltitle"
   ],
 
-  data() {  
+  data() {
     // 鑷畾涔夎韩浠借瘉鍙锋牎楠屽櫒
     const validateIdCard = (rule, value, callback) => {
       // 1. 濡傛灉涓虹┖锛屼氦缁� required 瑙勫垯鍘诲鐞嗭紝杩欓噷鐩存帴鏀捐
@@ -1029,6 +1031,8 @@
         flowconclusion: null,
         fundid: null
       },
+      // 杩炵画瀹℃壒锛氬緟瀹℃壒鍗曟嵁鍒楄〃
+      pendingList: [],
 
       // 鏌ヨ鍙傛暟
       queryParams: {
@@ -1385,6 +1389,14 @@
     handleCheck() {
       this.isopen = 0;
       this.reset();
+      // 閲嶇疆瀹℃壒淇℃伅锛岄伩鍏嶄笂涓�鍗曠殑瀹℃壒缁撴灉甯﹀叆涓嬩竴鍗�
+      this.checkObj = {
+        flowlevelone: null,
+        flowconclusion: null,
+        fundid: null
+      };
+      // 杩炵画瀹℃壒锛氬姞杞藉綋鍓嶄笟鍔$被鍨嬩笅鐨勫緟瀹℃壒鍒楄〃
+      this.getPendingList();
 
       getFund(this.curId).then(response => {
         this.form = response.data;
@@ -1596,7 +1608,7 @@
               let tempDetail = this.rbDetails[j];
               if (
                 isNaN(parseFloat(tempDetail.amount)) ||
-                parseFloat(tempDetail.amount) == 0
+                moneyRound(tempDetail.amount) == 0
               ) {
                 this.$modal.msgWarning(
                   "鏈嶅姟椤圭洰琛ㄤ腑锛岀" +
@@ -1611,7 +1623,7 @@
               let tempDetail = this.rbDetails[j];
               if (
                 isNaN(parseFloat(tempDetail.amount)) ||
-                parseFloat(tempDetail.amount) == 0
+                moneyRound(tempDetail.amount) == 0
               ) {
                 this.$modal.msgWarning(
                   "鏈嶅姟椤圭洰琛ㄤ腑锛岀" +
@@ -1622,7 +1634,7 @@
               }
               if (
                 isNaN(parseFloat(tempDetail.taxamount)) ||
-                parseFloat(tempDetail.taxamount) == 0
+                moneyRound(tempDetail.taxamount) == 0
               ) {
                 tempDetail.taxedamount = parseFloat(tempDetail.amount);
               } else {
@@ -1760,6 +1772,66 @@
 
       this.Savenow();
       console.log("淇濆瓨骞跺鎵�");
+    },
+
+    // 杩炵画瀹℃壒锛氳幏鍙栧綋鍓嶄笟鍔$被鍨嬩笅鐨勫緟瀹℃壒鍒楄〃
+    getPendingList() {
+      return listbypower({
+        pageNum: 1,
+        pageSize: 1000,
+        CHECKFLAG: 1,
+        APPLYTYPE: this.businessType
+      })
+        .then(res => {
+          this.pendingList = res.rows || [];
+        })
+        .catch(() => {
+          this.pendingList = [];
+        });
+    },
+
+    // 杩炵画瀹℃壒锛氬鎵瑰畬鎴愬悗璇㈤棶鏄惁缁х画瀹℃壒涓嬩竴鍗�
+    continueOrExit() {
+      // 閲嶆柊鎷夊彇寰呭鎵瑰垪琛紙褰撳墠鍗曟嵁宸插鎵瑰畬鎴愯绉诲嚭鍒楄〃锛�
+      this.getPendingList().then(() => {
+        const list = this.pendingList || [];
+        const next = list[0] || null;
+        if (next) {
+          this.$confirm("瀹℃壒宸插畬鎴愶紝鏄惁缁х画瀹℃壒涓嬩竴寮犲緟瀹℃壒鍗曟嵁锛�", "鎻愮ず", {
+            confirmButtonText: "缁х画瀹℃壒",
+            cancelButtonText: "杩斿洖鍒楄〃",
+            type: "info"
+          })
+            .then(() => {
+              // 鍦ㄥ綋鍓嶉〉闈㈢洿鎺ュ姞杞戒笅涓�寮犲緟瀹℃壒鍗曟嵁
+              this.curId = next.id;
+              this.handleCheck();
+              // 鍚屾鏇存柊鍦板潃鏍忥紝閬垮厤鍒锋柊鍚庡洖鍒颁笂涓�鍗�
+              this.$router
+                .replace({
+                  path: this.$route.path,
+                  query: {
+                    id: next.id,
+                    businessType: this.businessType,
+                    operationType: "check"
+                  }
+                })
+                .catch(() => {});
+            })
+            .catch(() => {
+              this.exitToPage();
+            });
+        } else {
+          this.$modal.msgSuccess("宸叉棤寰呭鎵瑰崟鎹紝杩斿洖鍒楄〃");
+          this.exitToPage();
+        }
+      });
+    },
+
+    // 杩斿洖鍒楄〃椤�
+    exitToPage() {
+      this.$store.dispatch("tagsView/delView", this.$route);
+      this.$router.go(-1);
     },
 
     // 鍙栨秷鎸夐挳
@@ -2034,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");
     },
 
     //瀵煎叆鎵�鏈夐」鐩�
@@ -2203,7 +2274,7 @@
               let tempDetail = this.rbDetails[j];
               if (
                 isNaN(parseFloat(tempDetail.amount)) ||
-                parseFloat(tempDetail.amount) == 0
+                moneyRound(tempDetail.amount) == 0
               ) {
                 this.$modal.msgWarning(
                   "鏈嶅姟椤圭洰琛ㄤ腑锛岀" +
@@ -2218,7 +2289,7 @@
               let tempDetail = this.rbDetails[j];
               if (
                 isNaN(parseFloat(tempDetail.amount)) ||
-                parseFloat(tempDetail.amount) == 0
+                moneyRound(tempDetail.amount) == 0
               ) {
                 this.$modal.msgWarning(
                   "鏈嶅姟椤圭洰琛ㄤ腑锛岀" +
@@ -2229,7 +2300,7 @@
               }
               if (
                 isNaN(parseFloat(tempDetail.taxamount)) ||
-                parseFloat(tempDetail.taxamount) == 0
+                moneyRound(tempDetail.taxamount) == 0
               ) {
                 tempDetail.taxedamount = parseFloat(tempDetail.amount);
               } else {
@@ -2270,8 +2341,8 @@
                     //鍏抽棴绐楀彛
                     this.$modal.closeLoading();
                     this.$modal.msgSuccess("瀹℃牳瀹屾垚!");
-                    this.$store.dispatch("tagsView/delView", this.$route);
-                    this.$router.go(-1);
+                    // 杩炵画瀹℃壒锛氳闂槸鍚︾户缁鎵逛笅涓�鍗�
+                    this.continueOrExit();
                   } else {
                     this.$modal.closeLoading();
 
@@ -2510,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;
             }
           }
 
@@ -2545,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();
     },
@@ -3250,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;
@@ -3266,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