From 45d4fe24016c03fcccbe7c9798533ca97e2e7aea Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期四, 03 十二月 2026 16:59:34 +0800
Subject: [PATCH] 回款新增和修改问题

---
 src/views/project/tallage/computingBill/index.vue |  316 +++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 224 insertions(+), 92 deletions(-)

diff --git a/src/views/project/tallage/computingBill/index.vue b/src/views/project/tallage/computingBill/index.vue
index b1412ce..1d921a3 100644
--- a/src/views/project/tallage/computingBill/index.vue
+++ b/src/views/project/tallage/computingBill/index.vue
@@ -61,21 +61,50 @@
             </el-form-item>
           </el-col>
           <el-col :span="6"
-            ><el-form-item label="鎵g◣閲戦" prop="donateno">
+            ><el-form-item label="澧炲�肩◣" prop="donateno">
+              <el-input
+                v-model="form.vatAmount"
+                :disabled="true"
+                placeholder="璇疯緭鍏ュ鍊肩◣"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6"
+            ><el-form-item label="鍩庡缓绋�" prop="donateno">
+              <el-input
+                v-model="form.cityTaxAmount"
+                :disabled="true"
+                placeholder="璇疯緭鍏ュ煄寤虹◣"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6"
+            ><el-form-item label="鍔冲姟绋庡墠" prop="donateno">
+              <el-input
+                v-model="form.laborPretaxAmount"
+                :disabled="true"
+                placeholder="璇疯緭鍏ュ姵鍔$◣鍓�"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="6"
+            ><el-form-item label="鍔冲姟涓◣" prop="donateno">
               <el-input
                 v-model="form.taxMoney"
                 :disabled="true"
-                placeholder="璇疯緭鍏ユ墸绋庨噾棰�"
+                placeholder="璇疯緭鍏ュ姵鍔′釜绋�"
               />
             </el-form-item>
           </el-col>
 
           <el-col :span="6">
-            <el-form-item label="绋庡悗閲戦" prop="donationcategory">
+            <el-form-item label="鍔冲姟绋庡悗" prop="donationcategory">
               <el-input
                 v-model="form.taxedamount"
                 :disabled="true"
-                placeholder="璇疯緭鍏ユ敹娆捐鍙�"
+                placeholder="璇疯緭鍏ュ姵鍔$◣鍚�"
               />
             </el-form-item>
           </el-col>
@@ -119,20 +148,20 @@
               align="center"
               fixed
               label="搴忓彿"
-              width="120"
+              width="60"
             >
             </el-table-column>
             <el-table-column
               prop="donorname"
               align="center"
               fixed
-              label="妗堜緥鎹愮尞鑰�"
+              label="鎹愮尞妗堜緥"
               width="120"
             >
               <template slot-scope="scope">
                 <el-input
                   v-model="scope.row.donorname"
-                  placeholder="妗堜緥鎹愮尞鑰�"
+                  placeholder="鎹愮尞鑰�"
                   :disabled="true"
                 />
               </template>
@@ -156,7 +185,7 @@
               prop="deptmentname"
               align="center"
               label="鎵�灞炵粍鍒�"
-              width="280"
+              width="200"
             >
               <template slot-scope="scope">
                 <el-input
@@ -186,7 +215,7 @@
                 </el-date-picker>
               </template>
             </el-table-column>
-            <el-table-column prop="pretaxcost" align="center" label="绋庡墠閲戦">
+            <el-table-column prop="pretaxcost" align="right" label="绋庡墠閲戦" width="120" header-align="right" class-name="money-column" :formatter="formatMoney">
               <template slot-scope="scope">
                 <el-input
                   v-model="scope.row.pretaxcost"
@@ -195,29 +224,55 @@
                 />
               </template>
             </el-table-column>
-            <el-table-column label="鎵g◣閲戦" align="center" prop="taXmoney">
+            <el-table-column prop="vatCost" align="right" label="澧炲�肩◣" width="120" header-align="right" class-name="money-column" :formatter="formatMoney">
               <template slot-scope="scope">
                 <el-input
-                  v-model="scope.row.taXmoney"
+                  v-model="scope.row.vatCost"
                   :disabled="true"
-                  placeholder="鎵g◣閲戦"
+                  placeholder="澧炲�肩◣"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column prop="cityTaxCost" align="right" label="鍩庡缓绋�" width="120" header-align="right" class-name="money-column" :formatter="formatMoney">
+              <template slot-scope="scope">
+                <el-input
+                  v-model="scope.row.cityTaxCost"
+                  :disabled="true"
+                  placeholder="鍩庡缓绋�"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column prop="laborPretaxCost" align="right" label="鍔冲姟绋庡墠" width="120" header-align="right" class-name="money-column" :formatter="formatMoney">
+              <template slot-scope="scope">
+                <el-input
+                  v-model="scope.row.laborPretaxCost"
+                  :disabled="true"
+                  placeholder="鍔冲姟绋庡墠"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column label="鍔冲姟涓◣" prop="taxcost" width="120" align="right" header-align="right" class-name="money-column" :formatter="formatMoney">
+              <template slot-scope="scope">
+                <el-input
+                  v-model="scope.row.taxcost"
+                  :disabled="true"
+                  placeholder="鍔冲姟涓◣"
                 />
               </template>
             </el-table-column>
 
-            <el-table-column prop="taxedcost" align="center" label="绋庡悗閲戦">
+            <el-table-column prop="taxedcost" label="鍔冲姟绋庡悗" width="120" align="right" header-align="right" class-name="money-column" :formatter="formatMoney">
               <template slot-scope="scope">
                 <el-input
                   @blur="chargeSum"
                   :disabled="true"
                   v-model="scope.row.taxedcost"
-                  placeholder="绋庡悗閲戦"
+                  placeholder="鍔冲姟绋庡悗"
                 />
               </template>
             </el-table-column>
             <el-table-column
               prop="remark"
-              width="280"
               align="center"
               label="澶囨敞"
             >
@@ -390,24 +445,42 @@
                   show-overflow-tooltip
                 >
                 </el-table-column>
-                <el-table-column
+                <!-- <el-table-column
                   prop="pretaxcost"
                   label="绋庡墠閲戦"
                   show-overflow-tooltip
-                >
+                 align="right" header-align="right" class-name="money-column" :formatter="formatMoney">
                 </el-table-column>
                 <el-table-column
-                  prop="taXmoney"
-                  label="鎵g◣閲戦"
+                  prop="vatCost"
+                  label="澧炲�肩◣"
                   show-overflow-tooltip
-                >
+                 align="right" header-align="right" class-name="money-column" :formatter="formatMoney">
+                </el-table-column>
+                <el-table-column
+                  prop="cityTaxCost"
+                  label="鍩庡缓绋�"
+                  show-overflow-tooltip
+                 align="right" header-align="right" class-name="money-column" :formatter="formatMoney">
+                </el-table-column>
+                <el-table-column
+                  prop="laborPretaxCost"
+                  label="鍔冲姟绋庡墠"
+                  show-overflow-tooltip
+                 align="right" header-align="right" class-name="money-column" :formatter="formatMoney">
+                </el-table-column>
+                <el-table-column
+                  prop="taxcost"
+                  label="鍔冲姟涓◣"
+                  show-overflow-tooltip
+                 align="right" header-align="right" class-name="money-column" :formatter="formatMoney">
                 </el-table-column>
                 <el-table-column
                   prop="taxedcost"
-                  label="绋庡悗閲戦"
+                  label="鍔冲姟绋庡悗"
                   show-overflow-tooltip
-                >
-                </el-table-column>
+                 align="right" header-align="right" class-name="money-column" :formatter="formatMoney">
+                </el-table-column> -->
                 <el-table-column
                   prop="remark"
                   label="澶囨敞"
@@ -487,7 +560,7 @@
               </el-upload>
               <el-table
                 :data="fileListto"
-                @row-click="downFile"
+                @row-click="previewInline" @row-dblclick="downFile"
                 style="width: 100%"
                 height="400"
               >
@@ -617,6 +690,8 @@
       pdfVisible: false,
       maxTaxId: "",
       pdfimgsrcList: [],
+      // 2026-11-30锛氱エ鎹脊绐楅瑙堜护鐗岋紙闃叉鍒囨崲琛屾椂鏃ц姹傚洖鍐欙級
+      previewToken: 0,
       Savereminder: false, //鎻愰啋淇濆瓨寮规
       Reminderquantity: 0, //鎻愰啋鏁伴噺
       totalquantity: 0, //鎬绘暟閲�
@@ -812,8 +887,6 @@
         });
       }
       this.donorchargeorgans.forEach(item => {
-        item.taXmoney = item.pretaxcost - item.taxedcost;
-        item.taXmoney = item.taXmoney.toFixed(2);
         this.accumulation();
       });
       if (this.form.id) {
@@ -828,47 +901,81 @@
 
       this.dialogVisiblepatient = false;
     },
-    // 璁$畻涓◣
+    // 璁$畻涓◣锛堝厛淇濆瓨褰撳墠鍗曟嵁锛屼繚瀛樻垚鍔熷悗鍐嶇畻绋庯紱绠楃◣鎴愬姛鍚庝粠鍚庣閲嶆柊鍔犺浇锛屼笉鍐嶇敤椤甸潰鏃ч噾棰濆洖鍐欙級
     calculateFn() {
       if (this.form.id >= this.MaxFundTaxId) {
-        this.$modal.loading("姝e湪鎻愪氦锛岃绋嶅�欙紒");
         this.$modal
-          .confirm("鍗冲皢杩涜绠楃◣鏄惁宸蹭繚瀛樺叏閮ㄦ暟鎹�?")
-          .then(res => {
-            listbxiaostatistics({
-              fundTaxId: Number(this.form.id),
-              addOrupdate: 1
-            }).then(res1 => {
-              if (res1.code == 200) {
-                this.$modal.msgSuccess("璁$畻鎴愬姛");
-                this.$modal.closeLoading();
-                this.form.istax = 1;
-                this.form.taxedtime = this.$moment().format(
-                  "YYYY-MM-DD HH:mm:ss"
-                );
-                this.submitForm();
-              } else {
-                this.$modal.closeLoading();
-                this.$modal.msgError(res1.msg);
+          .confirm("绠楃◣鍓嶄細鍏堜繚瀛樺綋鍓嶅崟鎹紝鏄惁缁х画?")
+          .then(() => {
+            this.form.serviceFunds = this.donorchargeorgans;
+            this.$refs["form"].validate(valid => {
+              if (!valid) {
+                this.$modal.msgError("鍗曟嵁鏍¢獙鏈�氳繃锛岃妫�鏌ュ悗閲嶈瘯");
+                return;
               }
+              this.$modal.loading("姝e湪鎻愪氦锛岃绋嶅�欙紒");
+              updateFundtax(this.form).then(res0 => {
+                if (res0.code != 200) {
+                  this.$modal.closeLoading();
+                  this.$modal.msgError(res0.msg);
+                  return;
+                }
+                listbxiaostatistics({
+                  fundTaxId: Number(this.form.id),
+                  addOrupdate: 1
+                }).then(res1 => {
+                  if (res1.code == 200) {
+                    // 鍚庣宸插洖鍐� service_fund / service_fundtax锛岃繖閲屽彧鍋氶噸鏂板姞杞�
+                    this.refreshFundtax().then(() => {
+                      this.$modal.closeLoading();
+                      this.$modal.msgSuccess("璁$畻鎴愬姛");
+                    });
+                  } else {
+                    this.$modal.closeLoading();
+                    this.$modal.msgError(res1.msg);
+                  }
+                });
+              });
             });
           })
-
           .catch(() => {});
       } else {
         this.$modal.msgError("褰撳墠鍗曟嵁涓嶄负鏈�鏂扮敵璇峰崟");
       }
     },
-    // 閲戦鍚堣
+    // 浠庡悗绔噸鏂板姞杞芥眹鎬诲崟锛堝惈鏄庣粏鍗曟嵁琛岋級骞堕噸绠楀悎璁�
+    refreshFundtax() {
+      return getFundtax(this.form.id).then(response => {
+        this.form = response.data;
+        if (this.form.serviceFunds && this.form.serviceFunds[0]) {
+          this.donorchargeorgans = this.form.serviceFunds;
+          this.donorchargeorgans.forEach((item, index) => {
+            item.index = index + 1;
+          });
+        }
+        this.accumulation();
+        return response;
+      });
+    },
+    // 閲戦鍚堣锛�6 涓噾棰濆叏閮ㄥ彇鑷崟鎹笂鐨勫悗绔噾棰濓紝涓嶅啀鐢ㄢ�滅◣鍓�-绋庡悗鈥濆�掔畻锛�
     accumulation() {
       this.form.pretaxamount = this.donorchargeorgans
-        .reduce((acc, obj) => acc + Number(obj.pretaxcost), 0)
+        .reduce((acc, obj) => acc + Number(obj.pretaxcost || 0), 0)
+        .toFixed(2);
+      this.form.vatAmount = this.donorchargeorgans
+        .reduce((acc, obj) => acc + Number(obj.vatCost || 0), 0)
+        .toFixed(2);
+      this.form.cityTaxAmount = this.donorchargeorgans
+        .reduce((acc, obj) => acc + Number(obj.cityTaxCost || 0), 0)
+        .toFixed(2);
+      this.form.laborPretaxAmount = this.donorchargeorgans
+        .reduce((acc, obj) => acc + Number(obj.laborPretaxCost || 0), 0)
         .toFixed(2);
       this.form.taxMoney = this.donorchargeorgans
-        .reduce((acc, obj) => acc + Number(obj.taXmoney), 0)
+        .reduce((acc, obj) => acc + Number(obj.taxcost || 0), 0)
         .toFixed(2);
       this.form.taxedamount = this.donorchargeorgans
-        .reduce((acc, obj) => acc + Number(obj.taxedcost), 0)
+        .reduce((acc, obj) => acc + Number(obj.taxedcost || 0), 0)
         .toFixed(2);
     },
     // 澶氶�夋閫変腑鏁版嵁
@@ -1011,14 +1118,12 @@
       this.title = "涓撳璐规眹鎬诲崟缂栬緫";
       getFundtax(this.curId).then(response => {
         this.form = response.data;
-        if (this.form.serviceFunds[0]) {
+        if (this.form.serviceFunds && this.form.serviceFunds[0]) {
           this.donorchargeorgans = this.form.serviceFunds;
           this.donorchargeorgans.forEach((item, index) => {
-            item.taXmoney = item.pretaxcost - item.taxedcost;
-            item.taXmoney = item.taXmoney.toFixed(2);
             item.index = index + 1;
-            this.accumulation();
           });
+          this.accumulation();
         }
       });
     },
@@ -1028,14 +1133,12 @@
       this.title = "鏌ョ湅涓撳璐规眹鎬诲崟";
       getFundtax(this.curId).then(response => {
         this.form = response.data;
-        if (this.form.serviceFunds[0]) {
+        if (this.form.serviceFunds && this.form.serviceFunds[0]) {
           this.donorchargeorgans = this.form.serviceFunds;
           this.donorchargeorgans.forEach((item, index) => {
-            item.taXmoney = item.pretaxcost - item.taxedcost;
-            item.taXmoney = item.taXmoney.toFixed(2);
             item.index = index + 1;
-            this.accumulation();
           });
+          this.accumulation();
         }
       });
     },
@@ -1053,21 +1156,10 @@
           if (this.form.id != null) {
             updateFundtax(this.form).then(res1 => {
               if (res1.code == 200) {
-                console.log(3);
                 this.$modal.msgSuccess("淇濆瓨鎴愬姛锛�");
-                getFundtax(this.form.id).then(response => {
-                  this.form = response.data;
-                  if (this.form.serviceFunds[0]) {
-                    this.donorchargeorgans = this.form.serviceFunds;
-                    this.donorchargeorgans.forEach((item, index) => {
-                      item.taXmoney = item.pretaxcost - item.taxedcost;
-                      item.taXmoney = item.taXmoney.toFixed(2);
-                      item.index = index + 1;
-                      this.accumulation();
-                    });
-                  }
+                this.refreshFundtax().then(() => {
+                  this.$modal.closeLoading();
                 });
-                this.$modal.closeLoading();
               } else {
                 this.$modal.closeLoading();
                 this.$modal.msgError(res1.msg);
@@ -1077,20 +1169,10 @@
             addFundtax(this.form).then(response => {
               if (response.code == 200) {
                 this.$modal.msgSuccess("鏂板鎴愬姛锛�");
-                getFundtax(response.data.fundTaxId).then(res => {
-                  this.form = res.data;
-                  if (this.form.serviceFunds[0]) {
-                    this.donorchargeorgans = this.form.serviceFunds;
-                    this.donorchargeorgans.forEach((item, index) => {
-                      item.taXmoney = item.pretaxcost - item.taxedcost;
-                      item.taXmoney = item.taXmoney.toFixed(2);
-                      item.index = index + 1;
-
-                      this.accumulation();
-                    });
-                  }
+                this.form.id = response.data.fundTaxId;
+                this.refreshFundtax().then(() => {
+                  this.$modal.closeLoading();
                 });
-                this.$modal.closeLoading();
               } else {
                 this.$modal.msgError(response.msg);
                 this.$modal.closeLoading();
@@ -1187,11 +1269,24 @@
       return sums;
     },
     // 鏂囦欢------------------------
+    /** 2026-11-23锛氭寜鏂囦欢鍚嶄粠鍒楄〃涓簿纭垹闄や竴椤癸紝閬垮厤鐢ㄩ瑙堝垪琛�(blob)鏁磋〃瑕嗙洊闄勪欢瀛楁 */
+    spliceByName(list, name) {
+      if (!list || !name) {
+        return;
+      }
+      const idx = list.findIndex(item => item && item.name === name);
+      if (idx > -1) {
+        list.splice(idx, 1);
+      }
+    },
     remove(file, fileList) {
       const donorchargeorgans = [...this.donorchargeorgans];
 
-      this.fileListto.splice(this.fileListto.indexOf(file), 1);
-      donorchargeorgans[this.atpresent].annexFilesList = this.fileListto;
+      this.spliceByName(this.fileListto, file && file.name);
+      this.spliceByName(
+        donorchargeorgans[this.atpresent].annexFilesList,
+        file && file.name
+      );
     },
 
     uploadSccess(response, file, fileList) {
@@ -1234,18 +1329,31 @@
     },
 
     // 鐐瑰嚮绁ㄦ嵁
+    /**
+     * 2026-11-30锛氭竻绌虹エ鎹脊绐楅瑙堢姸鎬侊紙鍚� embeddedFile / invoiceEmbeddedFile锛夛紝
+     * 閬垮厤鍐嶆鎵撳紑寮圭獥鏃朵粛鏄剧ず涓婁竴娆¢�夋嫨鐨勭エ鎹浘鐗囥��
+     */
+    resetPreviewState() {
+      this.fileListto = [];
+      this.invoicefileListto = [];
+      this.pdfimg = "";
+      this.invoicepdfimg = "";
+      this.pdfimgsrcList = [];
+      this.invoicepdfimgsrcList = [];
+      this.embeddedFile = null;
+      this.invoiceEmbeddedFile = null;
+      this.pdftitle = "";
+      this.previewToken = (this.previewToken || 0) + 1;
+    },
+
     Filepopup(index, row) {
       const config = {
         headers: { Authorization: "Bearer " + this.ICDtoken }
       };
 
       this.tableDatatop = [];
-      this.fileListto = [];
-      this.invoicefileListto = [];
-      this.pdfimg = "";
-      this.invoicepdfimg = [];
-      this.pdfimgsrcList = [];
-      this.invoicepdfimgsrcList = [];
+      this.resetPreviewState();
+      const previewToken = ++this.previewToken;
       this.tableDatatop.push(row);
       this.atpresent = index;
       this.pdfVisible = true;
@@ -1270,6 +1378,10 @@
         );
 
         Promise.all(fetchPromises).then(fileListto => {
+          // 2026-11-30锛氬垏鎹㈣鍚庝涪寮冭繃鏈熺粨鏋�
+          if (previewToken !== this.previewToken) {
+            return;
+          }
           this.fileListto = fileListto.filter(item => item !== null);
           this.pdfimg = this.fileListto[0].url;
           console.log(this.pdfimg, "pdfimg");
@@ -1293,6 +1405,26 @@
     },
 
     // 鐐瑰嚮宸蹭笂浼犳枃浠讹細鍦ㄩ檮浠跺脊绐楀彸渚у唴宓岄瑙�
+    /**
+     * 2026-11-30锛氬崟鍑诲垪琛ㄩ」 鈫� 鍦ㄦ湰椤甸瑙堬紙鍙充晶 preview-pane锛夈��
+     * 鍙屽嚮鎵嶆墦寮�鐙珛鐨勯瑙堥〉闈紙downFile 鈫� $previewFile锛夈��
+     */
+    previewInline(row) {
+      if (!row) {
+        return;
+      }
+      const url = row.previewUrl || row.url;
+      if (!url) {
+        return;
+      }
+      const file = {
+        name: row.name || "",
+        url,
+        type: /\.pdf$/i.test(row.name || "") ? "pdf" : "image"
+      };
+      this.embeddedFile = file;
+    },
+
     downFile(item) {
       if (this.operationType == "detail") {
         const list = (this.fileListto || []).map(f => ({

--
Gitblit v1.9.3