From 28a67a22bffae3ce3b2e52fa15a397cbe4922f0e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 14 七月 2025 11:47:32 +0800
Subject: [PATCH] 1.付款登记-添加明细展示,并且可以编辑和删除,付款流水数据展示要同步

---
 src/views/procurementManagement/invoiceEntry/components/Modal.vue |   81 +++++++++++++++++++++++++++++++---------
 1 files changed, 62 insertions(+), 19 deletions(-)

diff --git a/src/views/procurementManagement/invoiceEntry/components/Modal.vue b/src/views/procurementManagement/invoiceEntry/components/Modal.vue
index 1fd32e9..2914dc2 100644
--- a/src/views/procurementManagement/invoiceEntry/components/Modal.vue
+++ b/src/views/procurementManagement/invoiceEntry/components/Modal.vue
@@ -54,14 +54,10 @@
         </el-col>
         <el-col :span="12">
           <el-form-item label="鍙戠エ閲戦(鍏�)锛�" prop="invoiceAmount">
-            <el-input
-              type="number"
-              :step="0.01"
-              :min="0"
+            <el-input-number :step="0.01" :min="0" style="width: 100%"
               v-model="form.invoiceAmount"
               placeholder="鑷姩濉厖"
               clearable
-              :disabled="true"
             />
           </el-form-item>
         </el-col>
@@ -101,20 +97,33 @@
             />
           </el-form-item>
         </el-col>
+        <el-col :span="12">
+          <el-form-item label="褰曞叆鏃ユ湡锛�" prop="enterDate">
+            <el-date-picker
+              style="width: 100%"
+              v-model="form.enterDate"
+              type="date"
+              clearable
+            />
+          </el-form-item>
+        </el-col>
       </el-row>
-      <el-form-item label="浜у搧淇℃伅锛�" prop="entryDate"> </el-form-item>
+      <el-form-item label="浜у搧淇℃伅锛�"> </el-form-item>
       <PIMTable
         rowKey="id"
         :column="columns"
         :tableData="form.productData"
+				:summaryMethod="summarizeChildrenTable"
+				:isShowSummary="true"
         height="auto"
       >
         <template #ticketsNumRef="{ row }">
           <el-input-number
             v-model="row.ticketsNum"
-            placeholder="璇烽�夋嫨"
+            placeholder="璇疯緭鍏�"
             :min="0"
             :step="0.1"
+						:precision="2"
             clearable
             style="width: 100%"
             @change="invoiceNumBlur(row)"
@@ -123,8 +132,9 @@
         <template #ticketsAmountRef="{ row }">
           <el-input-number
             v-model="row.ticketsAmount"
-            placeholder="璇烽�夋嫨"
+            placeholder="璇疯緭鍏�"
             :min="0"
+						:precision="2"
             :step="0.1"
             clearable
             style="width: 100%"
@@ -144,6 +154,7 @@
 
 <script setup>
 import { ref, getCurrentInstance } from "vue";
+import { defineEmits } from 'vue';
 import { useModal } from "@/hooks/useModal";
 import useFormData from "@/hooks/useFormData";
 import FileUpload from "@/components/Upload/FileUpload.vue";
@@ -155,6 +166,7 @@
 import { getPurchaseById } from "@/api/procurementManagement/procurementLedger.js";
 import { getToken } from "@/utils/auth";
 import useUserStore from "@/store/modules/user";
+import dayjs from "dayjs";
 
 defineOptions({
   name: "鏉ョエ鐧昏妯℃�佹",
@@ -175,6 +187,7 @@
   issUer: userStore.nickName, // 褰曞叆浜�
   entryDate: undefined, // 寮�绁ㄦ棩鏈�
   salesContractNoId: undefined, // 寮�绁ㄦ棩鏈�
+  enterDate: dayjs().format("YYYY-MM-DD"),
   productData: [], // 琛ㄦ牸
   tempFileIds: [], // 鏂囦欢
 });
@@ -187,6 +200,8 @@
   invoiceAmount: [
     { required: true, message: "璇疯緭鍏ュ彂绁ㄩ噾棰�", trigger: "blur" },
   ],
+  entryDate: [{ required: true, message: "璇烽�夋嫨寮�绁ㄦ棩鏈�", trigger: "change" }],
+  enterDate: [{ required: true, message: "璇烽�夋嫨褰曞叆鏃ユ湡", trigger: "change" }],
 });
 
 const {
@@ -201,14 +216,18 @@
   title: "鏉ョエ鐧昏",
 });
 
+const emit = defineEmits(['refreshList']);
+
 const columns = [
   {
     label: "浜у搧澶х被",
     prop: "productCategory",
+		width: 120,
   },
   {
     label: "瑙勬牸鍨嬪彿",
     prop: "specificationModel",
+		width: 120,
   },
   {
     label: "鍗曚綅",
@@ -235,7 +254,7 @@
     prop: "taxInclusiveUnitPrice",
     width: 150,
     formatData: (val) => {
-      return parseFloat(val).toFixed(2) ?? 0;
+      return val ? parseFloat(val).toFixed(2) : 0;
     },
   },
   {
@@ -273,10 +292,12 @@
   {
     label: "鏈潵绁ㄦ暟",
     prop: "futureTickets",
+		width: 100,
   },
   {
     label: "鏈潵绁ㄩ噾棰�(鍏�)",
     prop: "futureTicketsAmount",
+		width: 200,
   },
 ];
 
@@ -306,7 +327,19 @@
     form.productData = data.productData;
   }
 };
-
+// 瀛愯〃鍚堣鏂规硶
+const summarizeChildrenTable = (param) => {
+	return proxy.summarizeTable(param, [
+		"taxInclusiveUnitPrice",
+		"taxInclusiveTotalPrice",
+		"taxExclusiveTotalPrice",
+		"ticketsNum",
+		"ticketsAmount",
+		"ticketsAmountRef",
+		"futureTickets",
+		"futureTicketsAmount",
+	]);
+};
 //鏈鏉ョエ鏁板け鐒︽搷浣�
 const invoiceNumBlur = (row) => {
   if (!row.ticketsNum || row.ticketsNum === "") {
@@ -318,11 +351,11 @@
     return;
   }
   // 璁$畻鏈鏉ョエ閲戦
-  row.ticketsAmount = row.ticketsNum * row.taxInclusiveUnitPrice;
+  row.ticketsAmount = (row.ticketsNum * row.taxInclusiveUnitPrice).toFixed(2)
   // 璁$畻鏈潵绁ㄦ暟
-  row.futureTickets = row.tempFutureTickets - row.ticketsNum;
+  row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2)
   // 璁$畻鏈潵绁ㄩ噾棰�
-  row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount;
+  row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2)
   calculateinvoiceAmount();
 };
 
@@ -341,9 +374,9 @@
     (row.ticketsAmount / row.taxInclusiveUnitPrice).toFixed(2)
   );
   // 璁$畻鏈潵绁ㄦ暟
-  row.futureTickets = row.tempFutureTickets - row.ticketsNum;
+  row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2)
   // 璁$畻鏈潵绁ㄩ噾棰�
-  row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount;
+  row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2)
   calculateinvoiceAmount();
 };
 
@@ -351,7 +384,7 @@
   let invoiceAmountTotal = 0;
   form.productData.forEach((item) => {
     if (item.ticketsAmount) {
-      invoiceAmountTotal += item.ticketsAmount;
+      invoiceAmountTotal += Number(item.ticketsAmount);
     }
   });
   form.invoiceAmount = invoiceAmountTotal.toFixed(2);
@@ -373,10 +406,15 @@
   form.tempFileIds = form.tempFileIds.filter((item) => item !== tempId);
 };
 
+const closeAndRefresh = () => {
+  closeModal();
+  emit('refreshList');
+};
+
 const submitForm = () => {
   formRef.value.validate(async (valid, fields) => {
     if (valid) {
-      modalLoading.value = true;
+      // modalLoading.value = true;
       const { code } = await addOrUpdateRegistration({
         purchaseLedgerId: id.value,
         purchaseContractNumber: form.purchaseLedgerNo,
@@ -385,23 +423,28 @@
         salesContractNo: form.salesContractNo,
         projectName: form.projectName,
         productData: form.productData,
-        issUerId: form.issUerId, // 褰曞叆浜�
+        issueDate: form.entryDate,
+        issUerId: form.issUerId, // 褰曞叆浜篿d
         issUer: form.issUer, // 褰曞叆浜�
         salesContractNoId: form.salesContractNoId,
         supplierName: form.supplierName,
         tempFileIds: form.tempFileIds,
+        enterDate: form.enterDate,
         type: 4,
       });
       modalLoading.value = false;
       if (code == 200) {
-        closeModal();
+        closeAndRefresh();
       }
+    } else {
+      modalLoading.value = false;
     }
   });
 };
 
 defineExpose({
   open,
+  closeAndRefresh,
 });
 </script>
 

--
Gitblit v1.9.3