From 9d242e52a874480a612124dd3833ab7cfa65c74f Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期三, 26 七月 2023 19:24:42 +0800
Subject: [PATCH] 修改个税计算

---
 src/views/project/fund/expertFeeFundApply/index.vue |  220 +++++++++++++++++++++++++++----------------------------
 1 files changed, 108 insertions(+), 112 deletions(-)

diff --git a/src/views/project/fund/expertFeeFundApply/index.vue b/src/views/project/fund/expertFeeFundApply/index.vue
index c934696..d2ed7c1 100644
--- a/src/views/project/fund/expertFeeFundApply/index.vue
+++ b/src/views/project/fund/expertFeeFundApply/index.vue
@@ -662,6 +662,10 @@
         username: null,
         usertype: null,
       },
+
+      //
+      amount: 0.00,
+
       //鐢宠鍗曠被鍨�
       currentApplyType: "1",
       //涓撳鍒楄〃
@@ -705,6 +709,10 @@
       donateconsolationfundList: [],
       //璐圭敤鏄庣粏鍒楄〃
       fundDetails: [],
+      formData: {},
+      totalPreTaxAmount: 0.0,
+      totalAfterTaxAmount: 0.0,
+      totalAmount: 0.0,
 
       // 寮瑰嚭灞傛爣棰�
       title: "",
@@ -1348,7 +1356,7 @@
     submitForm() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
-          let formData = this.form;
+          this.formData = this.form;
           let totalPreTaxAmount = 0.0;
           let totalAfterTaxAmount = 0.0;
           let totalAmount = 0.0;
@@ -1385,144 +1393,132 @@
             //   tempDetail.unitname = tempDetail.unitno;
             // }
 
+            //鑾峰彇鏈嶅姟椤圭洰鏄庣粏
+            let tempItemArr = tempDetail.itemArr;
+            let itemIndex = tempItemArr.findIndex(
+              (item) => tempDetail.itemid == item.id
+            );
+            if (itemIndex > -1) {
+              tempDetail.itemname = tempItemArr[itemIndex].itemName;
+              tempDetail.itemid = tempItemArr[itemIndex].id;
+            }
+
+            //鑾峰彇applytypename銆佹湇鍔¤垂鐢ㄥぇ绫�
+            let applytypeIndex = this.rowfeeItemTypes.findIndex(
+              (item) => tempDetail.applytype == item.value
+            );
+            if (applytypeIndex > -1) {
+              console.log("tempData1", tempData);
+              tempDetail.applytypename = this.rowfeeItemTypes[applytypeIndex].label;
+              tempDetail.subjecttype = this.rowfeeItemTypes[applytypeIndex].subjecttype;
+              tempDetail.subjecttypename = this.rowfeeItemTypes[applytypeIndex].subjecttypename;
+            }
+
+            this.fundDetails[m] = tempDetail;
             //璁$畻涓◣            
             //if (isNaN(parseFloat(tempDetail.taxedamount)))
+            //鑾峰彇鍙傛暟
+            this.taxParam.beneficiaryNo = tempDetail.beneficiaryno;
+            this.taxParam.startTime = this.form.createTime.substring(0, 10);
+            // 璁$畻绋庡悗閲戦
             if (tempDetail.taxedamount == undefined || tempDetail.taxedamount == null || tempDetail.taxedamount == 0 || tempDetail.taxedamount == '') {
               //鑾峰彇鍙傛暟
-              this.taxParam.beneficiaryNo = tempDetail.beneficiaryno;
               this.taxParam.money = tempDetail.amount.toString();
-              this.taxParam.startTime = this.form.createTime.substring(0, 10);
               getTaxByBeneFiciaryNo(this.taxParam).then((res) => {
                 if (res.code == 200) {
                   tempDetail.taxamount = res.data;
                   tempDetail.taxedamount = tempDetail.amount - tempDetail.taxamount;
+                  this.fundDetails[k] = tempDetail;
+
+                  this.totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
+                  this.totalAmount += parseFloat(tempDetail.amount);
+                  console.log('绗簩姝�');
+                  this.brforaFn()
                 }
               });
             }
 
-            //if (isNaN(parseFloat(tempDetail.amount)))
+            // 璁$畻绋庡墠閲戦
             if (tempDetail.amount == undefined || tempDetail.amount == null || tempDetail.amount == 0 || tempDetail.amount == '') {
               //鑾峰彇鍙傛暟
-              this.taxParam.beneficiaryNo = tempDetail.beneficiaryno;
               this.taxParam.money = tempDetail.taxedamount.toString();
-              this.taxParam.startTime = this.form.createTime.substring(0, 10);
-
               getTaxBeforeByAfterMoney(this.taxParam).then((res) => {
                 if (res.code == 200) {
                   tempDetail.taxamount = res.data.nowTax;
-                  tempDetail.amount = res.data.nowTaxBeforeMoney;
+                  tempDetail.amount = parseFloat(res.data.nowTaxBeforeMoney);
+                  this.fundDetails[k] = tempDetail;
+
+                  this.totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
+                  this.totalAmount += parseFloat(tempDetail.amount);
+                  console.log("1", this.amount);
+                  console.log('绗簩姝�');
+                  this.brforaFn()
                 }
               });
             }
-
-            totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
-            totalAmount += parseFloat(tempDetail.amount);
-            this.fundDetails[k] = tempDetail;
-          }
-
-          this.loading = true;
-          //闄勪欢澶勭悊
-          let list = this.fileList;
-          if (list.length > 0) {
-            this.form.annexbankcard = list.map(item => item.url).join(",");
-          }
-
-          //
-          this.form.donorname = this.curCase.name;
-          this.form.pretaxcost = parseFloat(totalPreTaxAmount).toFixed(2);
-          this.form.taxedcost = parseFloat(totalAfterTaxAmount).toFixed(2);
-          this.form.amountrequested = totalAmount.toFixed(2);
-          if (this.form.id != null) {
-            this.form.recordstatus = -1;
-            updateFund(this.form).then((res) => {
-              this.getfundList();
-              this.dialogOpen = false;
-              this.getList();
-              this.selectDonotor(this.curCase);
-              this.$modal.msgSuccess("淇敼鎴愬姛");
-              this.loading = false;
-              for (let m = 0; m < this.fundDetails.length; m++) {
-                let tempData = this.fundDetails[m];
-                let tempItemArr = tempData.itemArr;
-                tempData.fundid = formData.id;
-
-                //鑾峰彇鏈嶅姟椤圭洰鏄庣粏
-                let itemIndex = tempItemArr.findIndex(
-                  (item) => tempData.itemid == item.id
-                );
-                if (itemIndex > -1) {
-                  tempData.itemname = tempItemArr[itemIndex].itemName;
-                  tempData.itemid = tempItemArr[itemIndex].id;
-                }
-
-                //鑾峰彇applytypename銆佹湇鍔¤垂鐢ㄥぇ绫�
-                let applytypeIndex = this.rowfeeItemTypes.findIndex(
-                  (item) => tempData.applytype == item.value
-                );
-                if (applytypeIndex > -1) {
-                  console.log("tempData1", tempData);
-                  tempData.applytypename = this.rowfeeItemTypes[applytypeIndex].label;
-                  tempData.subjecttype = this.rowfeeItemTypes[applytypeIndex].subjecttype;
-                  tempData.subjecttypename = this.rowfeeItemTypes[applytypeIndex].subjecttypename;
-                }
-                console.log("tempData2", tempData);
-                if (tempData.id > 0) {
-                  updateFunddetail(tempData).then((res) => { });
-                } else {
-                  addFunddetail(tempData).then((res) => { });
-                }
-              }
-            });
-          } else {
-            //淇濆瓨璐圭敤鐢宠
-            for (let m = 0; m < this.fundDetails.length; m++) {
-              let tempData = this.fundDetails[m];
-              let tempUtemArr = tempData.itemArr;
-
-              //鑾峰彇鏈嶅姟椤圭洰鏄庣粏
-              let itemIndex = tempUtemArr.findIndex(
-                (item) => tempData.itemid == item.id
-              );
-              if (itemIndex > -1) {
-                tempData.itemname = tempUtemArr[itemIndex].itemName;
-                tempData.itemid = tempUtemArr[itemIndex].id;
-              }
-
-              //鑾峰彇applytypename銆佹湇鍔¤垂鐢ㄥぇ绫�
-              let applytypeIndex = this.rowfeeItemTypes.findIndex(
-                (item) => tempData.applytype == item.value
-              );
-              if (applytypeIndex > -1) {
-                tempData.applytypename = this.rowfeeItemTypes[applytypeIndex].label;
-                tempData.subjecttype = this.rowfeeItemTypes[applytypeIndex].subjecttype;
-                tempData.subjecttypename = this.rowfeeItemTypes[applytypeIndex].subjecttypename;
-              }
-              this.fundDetails[m] = tempData;
-            }
-
-            this.form.serviceFunddetails = 0;
-            this.fundDetails.map((item) => {
-              this.form.serviceFunddetails += item.amount;
-            });
-            this.form.serviceFunddetails = this.fundDetails;
-            this.form.recordstatus = -1;
-
-            batchUploadFund(this.form).then((response) => {
-              if (response.code === 200) {
-                this.$modal.msgSuccess("鏂板鎴愬姛");
-                this.loading = false;
-                this.selectDonotor(this.curCase);
-              } else {
-                this.$modal.msgError("鏂板澶辫触锛�" + response.msg);
-                this.loading = false;
-              }
-            });
-            this.dialogOpen = false;
           }
         }
       });
     },
 
+    // 绗簩姝�
+    brforaFn() {
+      //闄勪欢澶勭悊
+      this.loading = true;
+      let list = this.fileList;
+      if (list.length > 0) {
+        this.form.annexbankcard = list.map(item => item.url).join(",");
+      }
+
+      //
+      this.form.donorname = this.curCase.name;
+      this.form.pretaxcost = parseFloat(this.totalPreTaxAmount).toFixed(2);
+      this.form.taxedcost = parseFloat(this.totalAfterTaxAmount).toFixed(2);
+      this.form.amountrequested = this.totalAmount.toFixed(2);
+      if (this.form.id != null) {
+        this.form.recordstatus = -1;
+        updateFund(this.form).then((res) => {
+          this.getfundList();
+          this.dialogOpen = false;
+          this.getList();
+          this.selectDonotor(this.curCase);
+
+          // this.$modal.msgSuccess("淇敼鎴愬姛");
+          this.loading = false;
+          for (let m = 0; m < this.fundDetails.length; m++) {
+            let tempData = this.fundDetails[m];
+            if (tempData.id > 0) {
+              updateFunddetail(tempData).then((res) => { });
+            } else {
+              tempData.fundid = this.formData.id;
+              addFunddetail(tempData).then((res) => { });
+            }
+          }
+        });
+      } else {
+        this.form.serviceFunddetails = 0;
+        this.fundDetails.map((item) => {
+          this.form.serviceFunddetails += item.amount;
+        });
+        this.form.serviceFunddetails = this.fundDetails;
+        this.form.recordstatus = -1;
+
+        batchUploadFund(this.form).then((response) => {
+          if (response.code === 200) {
+            this.$modal.msgSuccess("鏂板鎴愬姛");
+            this.loading = false;
+            this.selectDonotor(this.curCase);
+          } else {
+            this.$modal.msgError("鏂板澶辫触锛�" + response.msg);
+            this.loading = false;
+          }
+        });
+
+        //鍏抽棴绐楀彛
+        this.dialogOpen = false;
+      }
+    },
+
     //鑾峰彇涓撳鍒楄〃
     getlistExternalperson() {
       listExternalperson().then((res) => {

--
Gitblit v1.9.3