From 037a98ac21771bfc0d23392266f65a7837676bc3 Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期一, 04 九月 2023 16:27:02 +0800
Subject: [PATCH] 11

---
 src/views/project/fund/applyDetail/index.vue |  132 ++++++++++++++++++++++++-------------------
 1 files changed, 74 insertions(+), 58 deletions(-)

diff --git a/src/views/project/fund/applyDetail/index.vue b/src/views/project/fund/applyDetail/index.vue
index e6ef7ec..1986acc 100644
--- a/src/views/project/fund/applyDetail/index.vue
+++ b/src/views/project/fund/applyDetail/index.vue
@@ -158,7 +158,7 @@
           <el-table
             :data="rbDetails"
             v-loading="loading"
-            max-height="400"
+            max-height="800"
             border
             highlight-current-row
           >
@@ -166,7 +166,7 @@
               prop="orderno"
               align="center"
               label="搴忓彿"
-              width="65"
+              width="88"
             >
               <template slot-scope="scope">
                 <el-input v-model="scope.row.orderno" placeholder="搴忓彿" />
@@ -302,7 +302,15 @@
                     :value="dict.expense"></el-option>
                 </el-select>
               -->
-                <el-input v-model="scope.row.amount" placeholder="閲戦" />
+                <el-input
+                  v-model="scope.row.amount"
+                  placeholder="閲戦"
+                  @blur="
+                    val => {
+                      calculateTax(scope.row, 'A');
+                    }
+                  "
+                />
               </template>
             </el-table-column>
             <el-table-column
@@ -319,6 +327,11 @@
                 <el-input
                   v-model="scope.row.taxedamount"
                   placeholder="绋庡悗閲戦"
+                  @blur="
+                    val => {
+                      calculateTax(scope.row, 'B');
+                    }
+                  "
                 />
               </template>
             </el-table-column>
@@ -1270,36 +1283,7 @@
       Modifyornot: 0 //鏄惁淇敼
     };
   },
-  // vue璺敱鎺у埗椤甸潰鍏抽棴鎻愮ず
-  beforeRouteLeave(to, from, next) {
-    if (
-      JSON.stringify(this.form) == sessionStorage.getItem("apiform") &&
-      JSON.stringify(this.rbDetails) == sessionStorage.getItem("apifunddetail")
-    ) {
-      console.log("cg1");
-      sessionStorage.removeItem("apiform");
-      sessionStorage.removeItem("apifunddetail");
 
-      //灏辨槸涓婇潰鐨勭姸鎬� 濡傛灉鏄痶rue , 鍒欎笉璇㈤棶鏄惁淇濆瓨, 褰撶劧杩欎釜鏂规硶姣旇緝绗�, 澶у鍙互浣跨敤鏇翠紭闆呯殑鏂瑰紡
-      next();
-    } else {
-      console.log("cg2");
-      this.$confirm("绂诲紑椤甸潰 , 鏇存柊鏁版嵁灏嗕笉鍋氫繚瀛�, 璇风‘璁ゅ凡缁忎繚瀛�", "鎻愮ず", {
-        confirmButtonText: "纭畾",
-        cancelButtonText: "鍙栨秷",
-        type: "warning"
-      })
-        .then(() => {
-          sessionStorage.removeItem("apiform");
-          sessionStorage.removeItem("apifunddetail");
-          this.$router.go(-1);
-          next();
-        })
-        .catch(() => {
-          // alert("router")
-        });
-    }
-  },
   //鐩戝惉灞炴�� 绫讳技浜巇ata姒傚康
   computed: {},
   //鐩戞帶data涓殑鏁版嵁鍙樺寲
@@ -1779,7 +1763,7 @@
             }
             this.rbDetails[i] = tempDetail;
             /*
-            //璁$畻涓◣
+            //璁$畻涓◣            
             //if (isNaN(parseFloat(tempDetail.taxedamount)))
             //鑾峰彇鍙傛暟
             this.taxParam.beneficiaryNo = tempDetail.beneficiaryno;
@@ -1793,13 +1777,13 @@
                   tempDetail.taxamount = res.data;
                   tempDetail.taxedamount = tempDetail.amount - tempDetail.taxamount;
                   this.rbDetails[k] = tempDetail;
-
+           
                   this.totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
                   this.totalAmount += parseFloat(tempDetail.amount);
                 }
               });
             }
-
+           
             // 璁$畻绋庡墠銆佺◣璐广�佺◣鍚庨噾棰�
             if (tempDetail.amount == undefined || tempDetail.amount == null || tempDetail.amount == 0 || tempDetail.amount == '') {
               //鑾峰彇鍙傛暟
@@ -1809,7 +1793,7 @@
                   tempDetail.taxamount = res.data.nowTax;
                   tempDetail.amount = parseFloat(res.data.nowTaxBeforeMoney);
                   this.rbDetails[k] = tempDetail;
-
+           
                   this.totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
                   this.totalAmount += parseFloat(tempDetail.amount);
                 }
@@ -2125,10 +2109,16 @@
             row.amount = 0.0;
             row.taxamount = 0.0;
             row.taxedamount = item.expense;
+
+            //璁$畻绋庡墠閲戦
+            this.calculateTax(row, "B");
           } else {
             row.amount = item.expense;
             row.taxamount = 0.0;
             row.taxedamount = 0.0;
+
+            //璁$畻绋庡悗閲戦
+            this.calculateTax(row, "A");
           }
 
           this.form.serviceFunddetails = 0;
@@ -2228,6 +2218,34 @@
           row.beneficiaryno = row.beneficiaryname;
         }
       });
+    },
+
+    //璁$畻涓◣锛歵ype(A:宸茬煡绋庡墠閲戦锛岃绠楃◣鍚庨噾棰濓紱B锛氬凡鐭ョ◣鍚庨噾棰濓紝璁$畻绋庡墠閲戦)
+    calculateTax(row, type) {
+      //if (isNaN(parseFloat(tempDetail.taxedamount)))
+      //鑾峰彇鍙傛暟
+      this.taxParam.beneficiaryNo = row.beneficiaryno;
+      this.taxParam.startTime = this.form.createTime.substring(0, 10);
+
+      if (type == "A") {
+        // 璁$畻涓◣銆佺◣鍚庨噾棰�
+        this.taxParam.money = row.amount.toString();
+        getTaxByBeneFiciaryNo(this.taxParam).then(res => {
+          if (res.code == 200) {
+            row.taxamount = res.data;
+            row.taxedamount = row.amount - row.taxamount;
+          }
+        });
+      } else {
+        // 璁$畻绋庡墠銆佷釜绋庨噾棰�
+        this.taxParam.money = row.taxedamount.toString();
+        getTaxBeforeByAfterMoney(this.taxParam).then(res => {
+          if (res.code == 200) {
+            row.taxamount = res.data.nowTax;
+            row.amount = parseFloat(res.data.nowTaxBeforeMoney);
+          }
+        });
+      }
     },
 
     //瀵煎叆鎵�鏈夐」鐩�
@@ -2404,7 +2422,7 @@
             }
             this.rbDetails[i] = tempDetail;
             /*
-            //璁$畻涓◣
+            //璁$畻涓◣            
             //if (isNaN(parseFloat(tempDetail.taxedamount)))
             //鑾峰彇鍙傛暟
             this.taxParam.beneficiaryNo = tempDetail.beneficiaryno;
@@ -2418,7 +2436,7 @@
                   tempDetail.taxamount = res.data;
                   tempDetail.taxedamount = tempDetail.amount - tempDetail.taxamount;
                   this.rbDetails[k] = tempDetail;
-
+           
                   this.totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
                   this.totalAmount += parseFloat(tempDetail.amount);
                 }
@@ -2434,7 +2452,7 @@
                   tempDetail.taxamount = res.data.nowTax;
                   tempDetail.amount = parseFloat(res.data.nowTaxBeforeMoney);
                   this.rbDetails[k] = tempDetail;
-
+           
                   this.totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
                   this.totalAmount += parseFloat(tempDetail.amount);
                 }
@@ -2653,9 +2671,6 @@
       }
     },
 
-    //璁$畻涓◣
-    calculateTax() {},
-
     //璁$畻鎬婚噾棰�
     sumTotalFee(row) {
       let allSum = 0;
@@ -2795,6 +2810,9 @@
         this.$modal.msgSuccess(response.msg);
         this.fileListto.push({ name: file.name, url: response.fileName });
         // this.fileListto.push({ name: file.name, url: response.url });
+        this.pdfimgsrcList.push(
+          this.Networkheader + "/prod-api" + response.fileName
+        );
         // this.pdfimgsrcList.push(response.url);
 
         this.rbDetails[this.atpresent].annexfilesList = this.fileListto;
@@ -2816,7 +2834,6 @@
           this.pdfimgsrcList.push(this.Networkheader + "/prod-api" + item.url);
         });
         console.log(this.pdfimgsrcList);
-
         console.log(this.pdfimg);
       } else {
         this.fileListto = [];
@@ -2824,29 +2841,30 @@
         this.pdftitle = "";
       }
     },
-    fnrowclick(row) {
-      console.log(row);
-    },
-    // 鐐瑰嚮宸蹭笂浼犳枃浠�
-    downFile(row) {
-      console.log(row);
 
-      this.pdftitle = row.name;
-      let name = row.name.split(".");
+    // 鐐瑰嚮宸蹭笂浼犳枃浠�
+    downFile(item) {
+      console.log(item);
+      this.pdftitle = item.name;
+      let name = item.name.split(".");
       if (name[1] == "pdf") {
         this.$modal.msgWarning("褰撳墠鏂囦欢鏆備笉鏀寔棰勮");
         this.previewpdf = false;
         this.hintitle = "褰撳墠鏂囦欢鏆備笉鏀寔棰勮";
       } else if (name[1] == "jpg" || "png") {
         this.previewpdf = true;
-        if (row.url) {
-          this.pdfimg = this.Networkheader + "/prod-api" + row.url;
-          // this.pdfimg = row.url;
+        if (item.url) {
+          this.pdfimg = this.Networkheader + "/prod-api" + item.url;
+          // this.pdfimg = item.url;
           // this.pdfimgsrcList = [];
           // this.pdfimgsrcList.push(this.pdfimg);
+          if (!this.pdfimgsrcList.includes(this.pdfimg)) {
+            this.pdfimgsrcList.push(this.pdfimg);
+            console.log("鍔犲叆");
+          }
           console.log(this.pdfimg);
         } else {
-          this.pdfimg = this.Networkheader + "/prod-api" + row.url;
+          this.pdfimg = this.Networkheader + "/prod-api" + item.url;
         }
       } else {
         this.hintitle = "褰撳墠鏂囦欢鏆備笉鏀寔棰勮";
@@ -3043,9 +3061,7 @@
 
   beforeCreate() {}, //鐢熷懡鍛ㄦ湡 - 鍒涘缓涔嬪墠
   beforeMount() {}, //鐢熷懡鍛ㄦ湡 - 鎸傝浇涔嬪墠
-  beforeUpdate() {
-    console.log("beforeUpdate");
-  }, //鐢熷懡鍛ㄦ湡 - 鏇存柊涔嬪墠
+  beforeUpdate() {}, //鐢熷懡鍛ㄦ湡 - 鏇存柊涔嬪墠
   updated() {}, //鐢熷懡鍛ㄦ湡 - 鏇存柊涔嬪悗
   beforeDestroy() {}, //鐢熷懡鍛ㄦ湡 - 閿�姣佷箣鍓�
   destroyed() {}, //鐢熷懡鍛ㄦ湡 - 閿�姣佸畬鎴�

--
Gitblit v1.9.3