From c391bf92060a370c1f22e5e3b7d17c2ebfd048c7 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 08 四月 2026 14:25:36 +0800
Subject: [PATCH] fix: 销售台账新增修改

---
 src/views/salesManagement/receiptPaymentLedger/index.vue |  111 +++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 91 insertions(+), 20 deletions(-)

diff --git a/src/views/salesManagement/receiptPaymentLedger/index.vue b/src/views/salesManagement/receiptPaymentLedger/index.vue
index 7d61a83..158b715 100644
--- a/src/views/salesManagement/receiptPaymentLedger/index.vue
+++ b/src/views/salesManagement/receiptPaymentLedger/index.vue
@@ -38,28 +38,38 @@
             label="瀹㈡埛鍚嶇О"
             prop="customerName"
             show-overflow-tooltip
+						width="200"
           />
           <el-table-column
-            label="寮�绁ㄩ噾棰�(鍏�)"
+            label="鍚堝悓閲戦(鍏�)"
             prop="invoiceTotal"
             show-overflow-tooltip
             :formatter="formattedNumber"
+						width="200"
           />
           <el-table-column
             label="鍥炴閲戦(鍏�)"
             prop="receiptPaymentAmount"
             show-overflow-tooltip
             :formatter="formattedNumber"
+						width="200"
           />
           <el-table-column
             label="搴旀敹閲戦(鍏�)"
             prop="unReceiptPaymentAmount"
             show-overflow-tooltip
+						width="200"
           >
             <template #default="{ row, column }">
               <el-text type="danger">
                 {{ formattedNumber(row, column, row.unReceiptPaymentAmount) }}
               </el-text>
+            </template>
+          </el-table-column>
+          <el-table-column label="鎿嶄綔" fixed="right" width="180" align="center">
+            <template #default="{ row }">
+              <el-button link type="primary" @click.stop="showMoneyInteractions(row)">閲戦挶寰�鏉�</el-button>
+              <el-button link type="success" @click.stop="showSalesInteractions(row)">閿�鍞線鏉�</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -74,6 +84,7 @@
       </div>
       <div class="table_list">
         <el-table
+          v-if="recordMode === 'money'"
           :data="receiptRecord"
           border
           :row-key="(row) => row.id"
@@ -89,54 +100,72 @@
           />
           <el-table-column
             label="鍙戠敓鏃ユ湡"
-            prop="happenTime"
+            prop="receiptPaymentDate"
             show-overflow-tooltip
+						width="110"
           />
           <el-table-column
-            label="寮�绁ㄩ噾棰�(鍏�)"
-            prop="invoiceAmount"
+            label="閿�鍞悎鍚屽彿"
+            prop="salesContractNo"
+            show-overflow-tooltip
+						width="200"
+          />
+          <el-table-column
+            label="鍚堝悓閲戦(鍏�)"
+            prop="invoiceTotal"
             show-overflow-tooltip
             :formatter="formattedNumber"
+						width="200"
           />
           <el-table-column
             label="鍥炴閲戦(鍏�)"
-            prop="receiptAmount"
+            prop="receiptPaymentAmount"
             show-overflow-tooltip
             :formatter="formattedNumber"
+						width="200"
           />
           <el-table-column
             label="搴旀敹閲戦(鍏�)"
-            prop="unReceiptAmount"
+            prop="unReceiptPaymentAmount"
             show-overflow-tooltip
+						width="200"
           >
             <template #default="{ row, column }">
               <el-text type="danger">
-                {{ formattedNumber(row, column, row.unReceiptAmount) }}
+                {{ formattedNumber(row, column, row.unReceiptPaymentAmount) }}
               </el-text>
             </template>
           </el-table-column>
         </el-table>
-        <pagination
-          v-show="recordTotal > 0"
-          :total="recordTotal"
-          layout="total, sizes, prev, pager, next, jumper"
-          :page="recordPage.current"
-          :limit="recordPage.size"
-          @pagination="recordPaginationChange"
-        />
+        <el-table
+          v-else
+          :data="salesRecord"
+          border
+          :row-key="(row) => row.id"
+          show-summary
+          :summary-method="summarizeSalesTable"
+          height="calc(100vh - 18.5em)"
+        >
+          <el-table-column align="center" label="搴忓彿" type="index" width="60" />
+          <el-table-column label="璐у悕" prop="goodsName" show-overflow-tooltip width="220" />
+          <el-table-column label="瑙勬牸" prop="specificationModel" show-overflow-tooltip width="220" />
+          <el-table-column label="宸插彂璐�" prop="shippedQuantity" show-overflow-tooltip width="140" />
+          <el-table-column label="鏈彂璐�" prop="unshippedQuantity" show-overflow-tooltip width="140" />
+        </el-table>
       </div>
     </div>
   </div>
 </template>
 
 <script setup>
-import { ref } from "vue";
+import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue";
 import { invoiceLedgerSalesAccount } from "../../../api/salesManagement/invoiceLedger.js";
-import { customerInteractions } from "../../../api/salesManagement/receiptPayment.js";
+import { customerInteractions, customerSalesInteractions } from "../../../api/salesManagement/receiptPayment.js";
 import Pagination from "../../../components/PIMTable/Pagination.vue";
 const { proxy } = getCurrentInstance();
 const tableData = ref([]);
 const receiptRecord = ref([]);
+const salesRecord = ref([]);
 const tableLoading = ref(false);
 const page = reactive({
   current: 1,
@@ -148,6 +177,7 @@
 });
 const total = ref(0);
 const recordTotal = ref(0);
+const recordMode = ref("money");
 const data = reactive({
   searchForm: {
     searchText: "",
@@ -157,6 +187,7 @@
 const customerId = ref("");
 const { searchForm } = toRefs(data);
 const originReceiptRecord = ref([]);
+const originSalesRecord = ref([]);
 // 鏌ヨ鍒楄〃
 /** 鎼滅储鎸夐挳鎿嶄綔 */
 const handleQuery = () => {
@@ -164,7 +195,6 @@
   getList();
 };
 const paginationChange = (obj) => {
-  console.log("paginationChange", current, limit);
   page.current = obj.page;
   page.size = obj.limit;
   getList();
@@ -219,6 +249,18 @@
   return summarizeTable;
 };
 
+// 閿�鍞線鏉ヨ〃鍚堣锛堝凡鍙戣揣/鏈彂璐э級
+const summarizeSalesTable = (param) => {
+  return proxy.summarizeTable(
+    param,
+    ["shippedQuantity", "unshippedQuantity"],
+    {
+      shippedQuantity: { noDecimal: false },
+      unshippedQuantity: { noDecimal: false },
+    }
+  );
+};
+
 const receiptPaymentList = (id) => {
   const param = {
     customerId: id,
@@ -231,6 +273,29 @@
   });
 };
 
+const salesInteractionList = (id) => {
+  const param = {
+    customerId: id,
+  };
+  customerSalesInteractions(param).then((res) => {
+    // 鏀寔鍚庣鐩存帴杩斿洖鏁扮粍锛屾垨 data.records 褰㈠紡
+    originSalesRecord.value = res?.data?.records || res?.data || [];
+    salesRecord.value = originSalesRecord.value;
+  });
+};
+
+const showMoneyInteractions = (row) => {
+  customerId.value = row.id;
+  recordMode.value = "money";
+  receiptPaymentList(customerId.value);
+};
+
+const showSalesInteractions = (row) => {
+  customerId.value = row.id;
+  recordMode.value = "sales";
+  salesInteractionList(customerId.value);
+};
+
 // 姹囨璁板綍鍒楄〃鍒嗛〉
 const recordPaginationChange = (pagination) => {
   handlePagination(pagination);
@@ -238,7 +303,11 @@
 
 const rowClickMethod = (row) => {
   customerId.value = row.id;
-  receiptPaymentList(customerId.value);
+  if (recordMode.value === "money") {
+    receiptPaymentList(customerId.value);
+  } else {
+    salesInteractionList(customerId.value);
+  }
 };
 
 const handlePagination = ({ page, limit }) => {
@@ -251,7 +320,9 @@
   receiptRecord.value = originReceiptRecord.value.slice(start, end);
 };
 
-getList();
+onMounted(() => {
+	getList();
+});
 </script>
 
 <style scoped lang="scss">

--
Gitblit v1.9.3