From 48118e7c69c14b86b06abbabb4c910cb59c12cfa Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期四, 12 十一月 2026 18:37:12 +0800
Subject: [PATCH] Merge branch 'master' of http://116.62.18.175:6699/r/~yxh/opo-web

---
 src/views/project/travelexpenseapply/travelexpensedetail/index.vue |  424 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 377 insertions(+), 47 deletions(-)

diff --git a/src/views/project/travelexpenseapply/travelexpensedetail/index.vue b/src/views/project/travelexpenseapply/travelexpensedetail/index.vue
index e439765..2d6c45c 100644
--- a/src/views/project/travelexpenseapply/travelexpensedetail/index.vue
+++ b/src/views/project/travelexpenseapply/travelexpensedetail/index.vue
@@ -631,8 +631,13 @@
         </el-tab-pane>
         <el-tab-pane label="鍙戠エ鏂囦欢" :name="2">
           <div class="pdfimg">
-            <div class="box-pdf">
+            <div class="box-pdf box-pdf--invoice">
               <div>
+                <div class="invoice-select-bar">
+                  <el-button type="primary" size="mini" icon="el-icon-plus"
+                    :disabled="operationType == 'detail'" @click="openInvoiceSelect">寮曠敤鍙戠エ</el-button>
+                  <span class="invoice-select-bar__tip">寮曠敤鍚庤嚜鍔ㄦ爣璁颁负宸叉姤閿�锛屽垹闄ゅ悗鎭㈠鏈姤閿�</span>
+                </div>
                 <el-upload size="mini" class="upload-demo" :action="uploadFileUrl" :file-list="invoicefileList"
                   :show-file-list="false" multiple drag :headers="headers" :on-success="(response, file, fileList) =>
                       uploadSccess(response, file, fileList)
@@ -646,15 +651,31 @@
                   </div>
                 </el-upload>
                 <el-table :data="invoicefileListto" @row-click="downFile" style="width: 100%" height="400">
-                  <el-table-column prop="name" :show-overflow-tooltip="true" label="鍚嶇О">
+                  <el-table-column prop="name" :show-overflow-tooltip="true" label="鏂囦欢鍚嶇О">
                     <template slot-scope="scope">
                       <i style="color:#409EFF" class=" el-icon-s-order" />{{
                         scope.row.name
                       }}
                     </template>
                   </el-table-column>
+                  <el-table-column prop="invoiceType" width="90" align="center" :show-overflow-tooltip="true"
+                    label="鍙戠エ绫诲瀷">
+                    <template slot-scope="scope">
+                      {{ scope.row.invoiceType || "-" }}
+                    </template>
+                  </el-table-column>
+                  <el-table-column prop="invoiceName" width="120" :show-overflow-tooltip="true" label="鍙戠エ鍚嶇О">
+                    <template slot-scope="scope">
+                      {{ scope.row.invoiceName || "-" }}
+                    </template>
+                  </el-table-column>
+                  <el-table-column prop="invoiceAmount" width="95" align="center" label="鍙戠エ閲戦">
+                    <template slot-scope="scope">
+                      {{ scope.row.invoiceAmount || "-" }}
+                    </template>
+                  </el-table-column>
 
-                  <el-table-column prop="name" width="180" :show-overflow-tooltip="true" label="鍔熻兘">
+                  <el-table-column prop="name" width="140" :show-overflow-tooltip="true" label="鍔熻兘">
                     <template slot-scope="scope">
                       <el-button type="primary" size="mini"
                         @click.native.prevent.stop="deletedowfile(scope.row)">鍒犻櫎</el-button>
@@ -670,6 +691,11 @@
           </div>
         </el-tab-pane>
       </el-tabs>
+    </el-dialog>
+    <el-dialog title="閫夋嫨鍙戠エ" :visible.sync="invoiceSelectOpen" width="1100px" append-to-body
+      :fullscreen="isMobile" :close-on-click-modal="false">
+      <invoice-index v-if="invoiceSelectOpen" select-mode @confirm="handleInvoiceSelected"
+        @cancel="invoiceSelectOpen = false" />
     </el-dialog>
     <el-dialog title="鎻愮ず" :visible.sync="Savereminder" width="30%">
       <el-alert :title="'鎮ㄥ凡娣诲姞' +
@@ -727,15 +753,18 @@
 import { treeselect } from "@/api/system/dept";
 import { getSubsidy } from "@/api/project/travelcity";
 import { listReportname, listUser } from "@/api/project/organization";
+import { updateInvoice } from "@/api/project/invoice";
+import InvoiceIndex from "@/views/project/invoice/index.vue";
 import { getToken } from "@/utils/auth";
 import debounce from "lodash/debounce";
-import { moneySum, moneyAdd, moneyRound } from "@/utils/money";
+import { moneySum, moneyAdd, moneySub, moneyRound } from "@/utils/money";
 import { checkFileName, checkDetails } from "@/utils/fileNameCheck";
 export default {
   components: {
     Treeselect,
     Li_area_select,
     CustomImageViewer,
+    InvoiceIndex,
     pdf
   },
   name: "Funddetail",
@@ -905,6 +934,9 @@
       initialIndex: 0, // 鍒濆绱㈠紩
       viewerVisible: false, // 鎺у埗棰勮缁勪欢鏄剧ず
       invoiceviewerVisible: false, // 鎺у埗棰勮缁勪欢鏄剧ず
+      // 鍙戠エ绠$悊寮曠敤寮圭獥
+      invoiceSelectOpen: false,
+      invoiceSelecting: false,
 
       //浜哄憳绫诲埆
       persontype: null,
@@ -927,6 +959,12 @@
       //淇濆瓨鎸夐挳鎺у埗
       idisabled: false
     };
+  },
+
+  computed: {
+    isMobile() {
+      return this.$store.state.app.device === "mobile";
+    }
   },
 
   created() {
@@ -1078,6 +1116,213 @@
       console.log("鍥剧墖鍔犺浇鎴愬姛");
     },
     handleUploadError() { },
+    // 鎵撳紑鍙戠エ绠$悊寮曠敤寮圭獥锛堝閫夋湭鎶ラ攢鍙戠エ锛�
+    openInvoiceSelect() {
+      if (this.operationType == "detail") {
+        return;
+      }
+      if (!this.rbDetails[this.atpresent]) {
+        this.$modal.msgWarning("璇峰厛閫夋嫨璐圭敤鏄庣粏琛�");
+        return;
+      }
+      this.invoiceSelectOpen = true;
+    },
+    // 寮曠敤鍙戠エ锛氬啓鍏ュ綋鍓嶆槑缁嗙殑鍙戠エ闆嗗悎锛屽苟鎶婂彂绁ㄦ爣璁颁负宸叉姤閿�
+    handleInvoiceSelected(rows) {
+      if (this.invoiceSelecting) {
+        return;
+      }
+      const detail = this.rbDetails[this.atpresent];
+      if (!detail) {
+        this.$modal.msgWarning("璇峰厛閫夋嫨璐圭敤鏄庣粏琛�");
+        return;
+      }
+      const existed = (detail.invoicefilesList || [])
+        .map(item => item && item.invoiceId)
+        .filter(id => id !== null && id !== undefined && id !== "")
+        .map(id => String(id));
+      const selected = (rows || []).filter(
+        row => !existed.includes(String(row.id))
+      );
+      if (!selected.length) {
+        this.$modal.msgWarning("鎵�閫夊彂绁ㄥ凡寮曠敤锛岃鍕块噸澶嶆坊鍔�");
+        return;
+      }
+      this.invoiceSelecting = true;
+      Promise.all(
+        selected.map(row =>
+          updateInvoice({ id: row.id, reimburseState: "1" })
+        )
+      )
+        .then(() => {
+          if (!detail.invoicefilesList) {
+            this.$set(detail, "invoicefilesList", []);
+          }
+          selected.forEach(row => {
+            const file = this.buildInvoiceFile(row);
+            // 鎸夊彂绁ㄧ被鍨嬫妸閲戦璁″叆瀵瑰簲璐圭敤绉戠洰
+            const applied = this.applyInvoiceExpense(detail, file, 1);
+            // 璁板綍瀹為檯璁″叆閲戦锛岃礋鏁板彂绁ㄨ0鎴柇鏃跺垹闄や笉浼氬弽鍚戝鍔�
+            file.expenseAmount = moneyRound(applied).toFixed(2);
+            // 鏄庣粏鍐呬繚瀛樻湇鍔$鍦板潃锛屽垪琛ㄥ唴淇濆瓨鍚屼竴浠芥暟鎹緵灞曠ず/鍒犻櫎
+            detail.invoicefilesList.push(Object.assign({}, file));
+            this.invoicefileListto.push(file);
+          });
+          this.sumRowFee(detail);
+          this.invoicepdfimgsrcList = this.invoicefileListto.map(
+            item => item.url
+          );
+          this.pdftitle = "鍏�" + this.invoicefileListto.length + "椤�";
+          this.invoiceSelectOpen = false;
+          this.$modal.msgSuccess(
+            "宸插紩鐢� " + selected.length + " 寮犲彂绁紝璐圭敤宸叉寜绫诲瀷璁″叆"
+          );
+        })
+        .catch(() => {
+          this.$modal.msgError("鍙戠エ鏍囪宸叉姤閿�澶辫触锛岃绋嶅悗閲嶈瘯");
+        })
+        .finally(() => {
+          this.invoiceSelecting = false;
+        });
+    },
+    // 鍙戠エ绠$悊璁板綍 -> 鍙戠エ闄勪欢锛堜繚鐣欏彂绁ㄤ笟鍔″瓧娈碉紝闅忔槑缁嗕竴璧蜂繚瀛橈級
+    buildInvoiceFile(row) {
+      const fileUrl = this.toRelativeFileUrl(row.invoiceUrl);
+      const ext = this.getFileExt(fileUrl);
+      return {
+        name: this.buildInvoiceFileName(row, ext),
+        url: fileUrl,
+        invoiceId: row.id,
+        invoiceNo: row.invoiceNo,
+        invoiceType: row.invoiceType,
+        invoiceName: row.invoiceName,
+        invoiceAmount: row.invoiceAmount,
+        // 璁板綍璁″叆鐨勮垂鐢ㄧ鐩拰閲戦锛屽垹闄ゅ彂绁ㄦ椂鎸夊悓涓�鍙e緞鎵e噺
+        expenseField: this.resolveInvoiceExpenseField(row),
+        expenseAmount: moneyRound(
+          this.invoiceAmountValue(row.invoiceAmount)
+        ).toFixed(2),
+        reimburseState: "1"
+      };
+    },
+    // 鍙戠エ绫诲瀷 -> 鎶ラ攢鏄庣粏璐圭敤绉戠洰
+    resolveInvoiceExpenseField(invoice) {
+      const type = String(invoice.invoiceType || "");
+      let ext = {};
+      try {
+        ext = invoice.extContent ? JSON.parse(invoice.extContent) : {};
+        if (!ext || typeof ext !== "object") {
+          ext = {};
+        }
+      } catch (e) {
+        ext = {};
+      }
+      const text = [
+        type,
+        invoice.invoiceName,
+        invoice.sellerName,
+        ext["閿�鍞柟鍚嶇О"],
+        ext["椤圭洰鍚嶇О"],
+        ext["璐х墿鎴栧簲绋庡姵鍔″悕绉�"]
+      ]
+        .filter(Boolean)
+        .join(" ");
+      // 浼樺厛璇嗗埆鍙戠エ绫诲瀷閲岀洿鎺ュ啓鏄庣殑璐圭敤绉戠洰
+      if (type.includes("甯傚唴浜ら��")) return "cityfee";
+      if (type.includes("浜ら��")) return "trafficexpense";
+      if (type.includes("浣忓")) return "hotelexpense";
+      if (type.includes("浼欓")) return "foodallowance";
+      if (type.includes("鍏潅")) return "otherexpense";
+      if (type.includes("鍏朵粬璐圭敤")) return "otherfeeamount";
+      // OCR 绫诲瀷閫氬父鏄彂绁ㄧ绫伙紝鍐嶇粨鍚堝彂绁ㄥ悕绉�/閿�鍞柟/椤圭洰鍚嶇О璇嗗埆
+      if (/鍑虹|缃戠害|婊存淮|鍦伴搧|鍏氦|鍋滆溅|杩囪矾|閫氳璐�/.test(text)) {
+        return "cityfee";
+      }
+      if (
+        /鐏溅|楂橀搧|鍔ㄨ溅|閾佽矾|椋炴満|鑸┖|鏈虹エ|琛岀▼鍗晐姹借溅绁▅瀹㈣繍|鑸圭エ|杩愯緭/.test(
+          text
+        )
+      ) {
+        return "trafficexpense";
+      }
+      if (/浣忓|閰掑簵|瀹鹃|鏃呴/.test(text)) return "hotelexpense";
+      if (/浼欓|椁愰ギ|椁愯垂|楗簵|椋熷搧/.test(text)) return "foodallowance";
+      if (/鍏潅|鍔炲叕|鏃ョ敤鍝亅閫氳|鐢佃瘽璐箌蹇��/.test(text)) {
+        return "otherexpense";
+      }
+      // 鏃犳硶褰掔被鐨勫彂绁ㄧ粺涓�璁″叆鍏朵粬璐圭敤
+      return "otherfeeamount";
+    },
+    // 鍙戠エ閲戦鍙兘鏄甫鍗冨垎浣�/璐у竵绗﹀彿鐨勬枃鏈紝鎶藉嚭鍙绠楅儴鍒�
+    invoiceAmountValue(value) {
+      const text = String(value === null || value === undefined ? "" : value)
+        .replace(/,/g, "")
+        .trim();
+      const match = text.match(/-?\d*\.?\d+/);
+      return match ? match[0] : 0;
+    },
+    // sign=1 璁″叆锛宻ign=-1 鎵e噺锛岄噾棰濈粺涓�璧扮簿纭繍绠�
+    applyInvoiceExpense(detail, invoiceFile, sign) {
+      const field = invoiceFile.expenseField;
+      if (!detail || !field) {
+        return 0;
+      }
+      const amount = moneyRound(
+        this.invoiceAmountValue(
+          invoiceFile.expenseAmount !== undefined
+            ? invoiceFile.expenseAmount
+            : invoiceFile.invoiceAmount
+        )
+      );
+      if (!amount) {
+        return 0;
+      }
+      const before = moneyRound(detail[field]);
+      const next =
+        sign > 0
+          ? moneyAdd(before, amount)
+          : moneySub(before, amount);
+      const after = moneyRound(Math.max(0, next));
+      detail[field] = after.toFixed(2);
+      return moneyRound(after - before);
+    },
+    // 姹囨�讳竴琛屾槑缁嗕腑璁″叆鎸囧畾璐圭敤绉戠洰鐨勫彂绁ㄩ噾棰�
+    sumInvoiceExpenseByField(row, field) {
+      const list = (row && row.invoicefilesList) || [];
+      return moneySum(
+        list.filter(item => item && item.expenseField === field),
+        item =>
+          item.expenseAmount !== undefined
+            ? item.expenseAmount
+            : item.invoiceAmount
+      );
+    },
+    // 闄勪欢鍚嶆牎楠屼笉鍏佽绌烘牸/鐗规畩瀛楃涓斾富骞测墹20瀛楋紝鐢ㄥ彂绁ㄥ彿鐮佺敓鎴愬畨鍏ㄦ枃浠跺悕
+    buildInvoiceFileName(row, ext) {
+      const raw = String(row.invoiceNo || "").replace(/[\s/\\:*?"<>|#%]/g, "");
+      const main = [...(raw || "鍙戠エ" + row.id)].slice(0, 20).join("");
+      return main + ext;
+    },
+    // 鍙戠エ鍦板潃鍏ュ簱鏃剁粺涓�鎴愭帴鍙g浉瀵硅矾寰勶紝閬垮厤鏈嶅姟鍣ㄥ湴鍧�鍙樻洿鍚庨瑙堝け鏁�
+    toRelativeFileUrl(url) {
+      const text = String(url || "");
+      const index = text.indexOf("/profile/upload");
+      return index > -1 ? text.slice(index) : text;
+    },
+    getFileExt(url) {
+      const path = String(url || "").split("?")[0];
+      const index = path.lastIndexOf(".");
+      return index > -1 ? path.slice(index) : "";
+    },
+    // 棰勮妗嗕緷璧栨枃浠跺悕鍚庣紑鍒ゆ柇鏂囦欢绫诲瀷锛岀己灏戝悗缂�鏃剁敤鍦板潃琛ラ綈
+    withFileExt(name, url) {
+      const text = String(name || "");
+      if (/\.[a-z0-9]{2,5}$/i.test(text)) {
+        return text;
+      }
+      const ext = this.getFileExt(url);
+      return ext ? text + ext : text;
+    },
     // 鑾峰彇璇锋眰澶�
     Getnetworkheader() {
       // 浠ュ綋鍓嶉〉闈� origin 涓哄噯锛屽吋瀹� 80/8032/9091 鍙婂悗缁鍙h皟鏁�
@@ -1267,19 +1512,24 @@
       //鍙戠エ
       if (this.rbDetails[index].invoicefilesList) {
         const fetchPromises = this.rbDetails[index].invoicefilesList.map(
-          (value, indexson) => {
-            const pdfimg = this.Networkheader + process.env.VUE_APP_BASE_API + value.url;
+          value => {
+            // 淇濈暀鍙戠エ涓氬姟瀛楁锛坕nvoiceId/绫诲瀷/鍚嶇О/閲戦锛夛紝閲嶆柊鎵撳紑鏃朵粛鍙睍绀哄拰鍒犻櫎
+            const kept = Object.assign({}, value);
+            // 鍙戠エ绠$悊涓殑鍦板潃鏄畬鏁� URL锛屼笉鑳藉啀鎷兼帴鍙e墠缂�
+            if (/^https?:\/\//i.test(value.url)) {
+              return Promise.resolve(kept);
+            }
+            const pdfimg =
+              this.Networkheader + process.env.VUE_APP_BASE_API + value.url;
             return fetch(pdfimg, config)
               .then(response => response.blob())
               .then(blob => {
-                return {
-                  name: value.name,
-                  url: URL.createObjectURL(blob)
-                };
+                kept.url = URL.createObjectURL(blob);
+                return kept;
               })
               .catch(error => {
                 console.error("Error loading image", error);
-                return null;
+                return kept;
               });
           }
         );
@@ -1288,7 +1538,9 @@
           this.invoicefileListto = invoicefileListto.filter(
             item => item !== null
           );
-          this.invoicepdfimg = this.invoicefileListto[0].url;
+          this.invoicepdfimg = this.invoicefileListto.length
+            ? this.invoicefileListto[0].url
+            : "";
           console.log(this.invoicepdfimg, "invoicepdfimg");
           this.invoicepdfimgsrcList = this.invoicefileListto.map(
             item => item.url
@@ -1315,10 +1567,13 @@
     downFile(item) {
       const source =
         this.activeName == 1 ? this.fileListto : this.invoicefileListto;
-      let list = (source || []).map(f => ({ name: f.name, url: f.url }));
+      let list = (source || []).map(f => ({
+        name: this.withFileExt(f.name, f.url),
+        url: f.url
+      }));
       let index = list.findIndex(f => f.url === item.url);
       if (index < 0 && item && item.url) {
-        list = [{ name: item.name, url: item.url }];
+        list = [{ name: this.withFileExt(item.name, item.url), url: item.url }];
         index = 0;
       }
       this.$previewFile(list, index > -1 ? index : 0);
@@ -1362,26 +1617,53 @@
           this.invoicepdfimgsrcList,
           row.url
         );
-        this.invoicepdfimgsrcList.splice(indexlist, 1);
+        if (indexlist > -1) {
+          this.invoicepdfimgsrcList.splice(indexlist, 1);
+        }
         const index = this.getIndexInArray(this.invoicefileListto, row);
-        this.invoicefileListto.splice(index, 1);
-        console.log(this.rbDetails[this.atpresent].invoicefilesList);
-        const targetIndex = this.rbDetails[
-          this.atpresent
-        ].invoicefilesList.findIndex(item => {
-          return item.name === row.name; // 寤鸿浣跨敤涓ユ牸鐩哥瓑 ===
+        if (index > -1) {
+          this.invoicefileListto.splice(index, 1);
+        }
+        const invoiceFiles =
+          this.rbDetails[this.atpresent].invoicefilesList || [];
+        // 寮曠敤鍙戠エ鎸夊彂绁↖D鍖归厤锛岄伩鍏嶅悓鍚嶅彂绁ㄥ垹閿欙紱涓婁紶鏂囦欢鎸夊悕绉板吋瀹规棫鏁版嵁
+        const targetIndex = invoiceFiles.findIndex(item => {
+          return row.invoiceId
+            ? String(item.invoiceId) === String(row.invoiceId)
+            : item.name === row.name;
         });
-        console.log(targetIndex, "鍒犻櫎绱㈠紩"); // 鐜板湪鎵撳嵃鐨勬槸绱㈠紩鍙凤紝渚嬪 0, 1, 2...
+        console.log(targetIndex, "鍒犻櫎绱㈠紩");
 
+        let removed = null;
         if (targetIndex > -1) {
-          // 纭繚鎵惧埌浜嗗厓绱�
-          this.rbDetails[this.atpresent].invoicefilesList.splice(
-            targetIndex,
-            1
-          );
+          removed = invoiceFiles.splice(targetIndex, 1)[0];
           console.log("鍒犻櫎鎴愬姛");
         } else {
           console.log("鏈壘鍒板搴旈」鐩紝鏃犳硶鍒犻櫎");
+        }
+        // 鍒犻櫎宸插紩鐢ㄥ彂绁ㄦ椂锛屾寜寮曠敤鏃惰鍏ョ殑绉戠洰鍜岄噾棰濇墸鍑�
+        if (removed && removed.expenseField) {
+          this.applyInvoiceExpense(
+            this.rbDetails[this.atpresent],
+            removed,
+            -1
+          );
+          this.sumRowFee(this.rbDetails[this.atpresent]);
+        }
+        // 鍒犻櫎宸插紩鐢ㄧ殑鍙戠エ鍚庯紝鎶婂彂绁ㄦ仮澶嶄负鏈姤閿�
+        const invoiceId = row.invoiceId || (removed && removed.invoiceId);
+        if (invoiceId) {
+          updateInvoice({ id: invoiceId, reimburseState: "0" })
+            .then(() => {
+              this.$modal.msgSuccess(
+                "鍙戠エ宸插垹闄わ紝璐圭敤宸叉墸鍑忓苟鎭㈠涓烘湭鎶ラ攢"
+              );
+            })
+            .catch(() => {
+              this.$modal.msgError(
+                "鍙戠エ鐘舵�佹仮澶嶅け璐ワ紝璇峰埌鍙戠エ绠$悊涓墜鍔ㄦ爣璁颁负鏈姤閿�"
+              );
+            });
         }
       }
     },
@@ -1406,21 +1688,24 @@
         ); // 灏唅temann鎻掑叆鍒扮储寮曚綅缃殑鍓嶄竴浣�
       } else {
         const index = this.getIndexInArray(this.invoicefileListto, row);
+        if (index < 1) {
+          return;
+        }
         const item = this.invoicefileListto.splice(index, 1)[0]; // 绉婚櫎鎸囧畾绱㈠紩澶勭殑鍏冪礌锛屽苟淇濆瓨鍒癷tem鍙橀噺涓�
         this.invoicefileListto.splice(index - 1, 0, item); // 灏唅tem鎻掑叆鍒扮储寮曚綅缃殑鍓嶄竴浣�
 
-        const indexinvo = this.rbDetails[
-          this.atpresent
-        ].invoicefilesList.findIndex(item => item.name == row.name);
-        const iteminvo = this.rbDetails[this.atpresent].invoicefilesList.splice(
-          indexinvo,
-          1
-        )[0]; // 绉婚櫎鎸囧畾绱㈠紩澶勭殑鍏冪礌锛屽苟淇濆瓨鍒癷tem鍙橀噺涓�
-        this.rbDetails[this.atpresent].invoicefilesList.splice(
-          indexinvo - 1,
-          0,
-          iteminvo
-        ); // 灏唅teminvo鎻掑叆鍒扮储寮曚綅缃殑鍓嶄竴浣�
+        const invoiceFiles =
+          this.rbDetails[this.atpresent].invoicefilesList || [];
+        const indexinvo = invoiceFiles.findIndex(file =>
+          row.invoiceId
+            ? String(file.invoiceId) === String(row.invoiceId)
+            : file.name == row.name
+        );
+        if (indexinvo < 1) {
+          return;
+        }
+        const iteminvo = invoiceFiles.splice(indexinvo, 1)[0];
+        invoiceFiles.splice(indexinvo - 1, 0, iteminvo);
       }
     },
 
@@ -1549,35 +1834,58 @@
         row.persontype == "绠$悊浜哄憳"
       ) {
         //鍏潅璐硅ˉ鍔╋細鏉窞妗愬簮锛屽缓寰凤紝娣冲畨60锛屾澀宸炲叾浠栧湴鍖�0锛岄潪鏉窞鍦板尯80
+        const otherInvoice = this.sumInvoiceExpenseByField(
+          row,
+          "otherexpense"
+        );
+        const foodInvoice = this.sumInvoiceExpenseByField(
+          row,
+          "foodallowance"
+        );
+        // 鍏堢畻琛ュ姪鍩烘暟锛屽啀鍙犲姞椁愰ギ/鍔炲叕绫诲彂绁紝閬垮厤琛ュ姪閲嶇畻鎶婂彂绁ㄩ噾棰濊鐩�
+        let baseOther = row.otherexpense;
+        if (otherInvoice) {
+          baseOther = moneySub(row.otherexpense, otherInvoice);
+        }
         if (row.destination != "") {
           var tempStr = row.destination;
 
           //楠岃瘉鍩庡競
           if (tempStr == "鏉窞") {
-            row.otherexpense = "";
+            baseOther = "";
           } else if (
             tempStr.includes("妗愬簮") ||
             tempStr.includes("寤哄痉") ||
             tempStr.includes("娣冲畨")
           ) {
-            row.otherexpense = (parseInt(row.days) * 60).toString();
+            baseOther = (parseInt(row.days) * 60).toString();
           } else {
-            row.otherexpense = (parseInt(row.days) * 80).toString();
+            baseOther = (parseInt(row.days) * 80).toString();
           }
         }
 
         //浼欓璐硅ˉ鍔╋細鍩庡競锛堣タ钘忥紝鏂扮枂锛岄潚娴�.120锛夛紙鍏朵粬100锛�
+        let baseFood = "";
         if (tempStr == "鏉窞") {
-          row.foodallowance = "";
+          baseFood = "";
         } else if (
           tempStr == "瑗胯棌" ||
           tempStr == "鏂扮枂" ||
           tempStr == "闈掓捣"
         ) {
-          row.foodallowance = (parseInt(row.days) * 120).toString();
+          baseFood = (parseInt(row.days) * 120).toString();
         } else {
-          row.foodallowance = (parseInt(row.days) * 100).toString();
+          baseFood = (parseInt(row.days) * 100).toString();
         }
+
+        row.otherexpense =
+          baseOther === "" && !otherInvoice
+            ? ""
+            : moneyAdd(baseOther, otherInvoice).toFixed(2);
+        row.foodallowance =
+          baseFood === "" && !foodInvoice
+            ? ""
+            : moneyAdd(baseFood, foodInvoice).toFixed(2);
 
         //璁$畻鍚堣
         this.sumRowFee(row);
@@ -1611,10 +1919,14 @@
             for (let i = 0; i < response.data.length; i++) {
               fee += response.data[i].reimbursementamout;
             }
-            row.hotelexpense = fee;
+            const hotelInvoice = this.sumInvoiceExpenseByField(
+              row,
+              "hotelexpense"
+            );
+            row.hotelexpense = moneyAdd(fee, hotelInvoice).toFixed(2);
           })
           .finally(() => {
-            this.sumTotalFee();
+            this.sumRowFee(row);
           });
       }
     },
@@ -2927,6 +3239,19 @@
   text-align: center;
 }
 
+.invoice-select-bar {
+  display: flex;
+  align-items: center;
+  flex-wrap: wrap;
+  margin-bottom: 10px;
+
+  &__tip {
+    margin-left: 10px;
+    font-size: 12px;
+    color: #909399;
+  }
+}
+
 .pdfimg {
   display: flex; // text-align: center;
   width: 100%;
@@ -2942,6 +3267,11 @@
     box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1); // <- Add this to fix.
   }
 
+  // 鍙戠エ椤靛鍑虹被鍨�/鍚嶇О/閲戦涓夊垪锛岀粰琛ㄦ牸鐣欏嚭妯悜绌洪棿
+  .box-pdf--invoice {
+    width: 560px;
+  }
+
   .pdftit {
     width: 200px;
     padding: 20px;

--
Gitblit v1.9.3