From ca4261a5d05d0359d02e332b88ed149a0656eae1 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期四, 27 七月 2023 13:47:57 +0800
Subject: [PATCH] 修改了专家费用保存

---
 src/views/project/fund/expertFeeFundApply/index.vue |  196 +++++++++++++++++++++++--------------------------
 1 files changed, 92 insertions(+), 104 deletions(-)

diff --git a/src/views/project/fund/expertFeeFundApply/index.vue b/src/views/project/fund/expertFeeFundApply/index.vue
index c99482d..e6fad70 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: "",
@@ -875,7 +883,7 @@
           addExternalperson(this.expertform).then((response) => {
             if (response.code == 200) {
               this.$modal.msgSuccess("鏂板涓撳淇℃伅鎴愬姛锛�");
-              
+
               listExternalperson().then((res) => {
                 this.personlist = res.rows;
                 console.log("new personlist", this.personlist);
@@ -1348,10 +1356,10 @@
     submitForm() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
-          let formData = this.form;
-          let totalPreTaxAmount = 0.0;
-          let totalAfterTaxAmount = 0.0;
-          let totalAmount = 0.0;
+          this.formData = this.form;
+          // let totalPreTaxAmount = 0.0;
+          // let totalAfterTaxAmount = 0.0;
+          // let totalAmount = 0.0;
 
           //淇濆瓨鍓嶆牎楠屾暟鎹�
           for (let k = 0; k < this.fundDetails.length; k++) {
@@ -1385,133 +1393,111 @@
             //   tempDetail.unitname = tempDetail.unitno;
             // }
 
+
+          }
+
+          //闄勪欢澶勭悊
+          let list = this.fileList;
+          if (list.length > 0) {
+            this.form.annexfiles = list.map(item => item.url).join(",");
+          }
+
+          //澶勭悊鏄庣粏
+          for (let i = 0; i < this.fundDetails.length; i++) {
+            let tempDetail = this.fundDetails[i];
+            //鑾峰彇鏈嶅姟椤圭洰鏄庣粏
+            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) {
+              tempDetail.applytypename = this.rowfeeItemTypes[applytypeIndex].label;
+              tempDetail.subjecttype = this.rowfeeItemTypes[applytypeIndex].subjecttype;
+              tempDetail.subjecttypename = this.rowfeeItemTypes[applytypeIndex].subjecttypename;
+            }
+            this.fundDetails[k] = 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);
                 }
               });
             }
 
-            //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);
                 }
               });
             }
-
-            totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
-            totalAmount += parseFloat(tempDetail.amount);
-            this.fundDetails[k] = tempDetail;
+            */
           }
+          //璐圭敤鍚堣
+          // this.form.pretaxcost = parseFloat(this.totalPreTaxAmount).toFixed(2);
+          // this.form.taxedcost = parseFloat(this.totalAfterTaxAmount).toFixed(2);
+          // this.form.amountrequested = this.totalAmount.toFixed(2);
 
+          //淇濆瓨鏁版嵁
           this.loading = true;
-          //闄勪欢澶勭悊
-          let list = this.fileList;
-          if (list.length > 0) {
-            this.form.annexbankcard = list.map(item => item.url).join(",");
-          }
+          this.form.serviceFunddetails = 0;
+          this.fundDetails.map((item) => {
+            this.form.serviceFunddetails += item.amount;
+          });
+          this.form.serviceFunddetails = this.fundDetails;
 
-          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((response) => {
-              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) {
-                  tempData.applytypename = this.rowfeeItemTypes[applytypeIndex].label;
-                }
-
-                if (tempData.id > 0) {
-                  updateFunddetail(tempData).then((response2) => { });
-                } else {
-                  addFunddetail(tempData).then((response2) => { });
-                }
-              }
-            });
-          } 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;
-              }
-              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;
+            //鎹愮尞鑰�
+            this.form.donorname = this.curCase.name;
           }
+          else {
+            this.form.recordstatus = -1;
+          }
+
+          batchUploadFund(this.form).then((response) => {
+            if (response.code === 200) {
+              this.$modal.msgSuccess("涓撳鍔冲姟璐逛繚瀛樻垚鍔燂紒");
+              this.selectDonotor(this.curCase);
+            } else {
+              this.$modal.msgError("涓撳鍔冲姟璐逛繚瀛樺け璐ワ細" + response.msg);
+            }
+          });
+
+          //鍏抽棴绐楀彛
+          this.loading = false;
+          this.dialogOpen = false;
         }
       });
     },
@@ -1779,6 +1765,8 @@
           this.rowfeeItemTypes.push({
             value: dataList[m].itemType,
             label: dataList[m].itemTypeName,
+            subjecttype: dataList[m].subjecttype,
+            subjecttypename: dataList[m].subjecttypename,
           });
         }
       });

--
Gitblit v1.9.3