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 |  187 +++++++++++++++++++++++++++++++---------------
 1 files changed, 124 insertions(+), 63 deletions(-)

diff --git a/src/views/salesManagement/receiptPaymentLedger/index.vue b/src/views/salesManagement/receiptPaymentLedger/index.vue
index 2cec625..158b715 100644
--- a/src/views/salesManagement/receiptPaymentLedger/index.vue
+++ b/src/views/salesManagement/receiptPaymentLedger/index.vue
@@ -41,7 +41,77 @@
 						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>
+        <pagination
+          v-show="total > 0"
+          :total="total"
+          layout="total, sizes, prev, pager, next, jumper"
+          :page="page.current"
+          :limit="page.size"
+          @pagination="paginationChange"
+        />
+      </div>
+      <div class="table_list">
+        <el-table
+          v-if="recordMode === 'money'"
+          :data="receiptRecord"
+          border
+          :row-key="(row) => row.id"
+          show-summary
+          :summary-method="summarizeMainTable1"
+          height="calc(100vh - 18.5em)"
+        >
+          <el-table-column
+            align="center"
+            label="搴忓彿"
+            type="index"
+            width="60"
+          />
+          <el-table-column
+            label="鍙戠敓鏃ユ湡"
+            prop="receiptPaymentDate"
+            show-overflow-tooltip
+						width="110"
+          />
+          <el-table-column
+            label="閿�鍞悎鍚屽彿"
+            prop="salesContractNo"
+            show-overflow-tooltip
+						width="200"
+          />
+          <el-table-column
+            label="鍚堝悓閲戦(鍏�)"
             prop="invoiceTotal"
             show-overflow-tooltip
             :formatter="formattedNumber"
@@ -67,84 +137,35 @@
             </template>
           </el-table-column>
         </el-table>
-        <pagination
-          v-show="total > 0"
-          :total="total"
-          layout="total, sizes, prev, pager, next, jumper"
-          :page="page.current"
-          :limit="page.size"
-          @pagination="paginationChange"
-        />
-      </div>
-      <div class="table_list">
         <el-table
-          :data="receiptRecord"
+          v-else
+          :data="salesRecord"
           border
           :row-key="(row) => row.id"
           show-summary
-          :summary-method="summarizeMainTable1"
+          :summary-method="summarizeSalesTable"
           height="calc(100vh - 18.5em)"
         >
-          <el-table-column
-            align="center"
-            label="搴忓彿"
-            type="index"
-            width="60"
-          />
-          <el-table-column
-            label="鍙戠敓鏃ユ湡"
-            prop="happenTime"
-            show-overflow-tooltip
-						width="110"
-          />
-          <el-table-column
-            label="寮�绁ㄩ噾棰�(鍏�)"
-            prop="invoiceAmount"
-            show-overflow-tooltip
-            :formatter="formattedNumber"
-						width="200"
-          />
-          <el-table-column
-            label="鍥炴閲戦(鍏�)"
-            prop="receiptAmount"
-            show-overflow-tooltip
-            :formatter="formattedNumber"
-						width="200"
-          />
-          <el-table-column
-            label="搴旀敹閲戦(鍏�)"
-            prop="unReceiptAmount"
-            show-overflow-tooltip
-						width="200"
-          >
-            <template #default="{ row, column }">
-              <el-text type="danger">
-                {{ formattedNumber(row, column, row.unReceiptAmount) }}
-              </el-text>
-            </template>
-          </el-table-column>
+          <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>
-        <pagination
-          v-show="recordTotal > 0"
-          :total="recordTotal"
-          layout="total, sizes, prev, pager, next, jumper"
-          :page="recordPage.current"
-          :limit="recordPage.size"
-          @pagination="recordPaginationChange"
-        />
       </div>
     </div>
   </div>
 </template>
 
 <script setup>
-import {onMounted, 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,
@@ -156,6 +177,7 @@
 });
 const total = ref(0);
 const recordTotal = ref(0);
+const recordMode = ref("money");
 const data = reactive({
   searchForm: {
     searchText: "",
@@ -165,6 +187,7 @@
 const customerId = ref("");
 const { searchForm } = toRefs(data);
 const originReceiptRecord = ref([]);
+const originSalesRecord = ref([]);
 // 鏌ヨ鍒楄〃
 /** 鎼滅储鎸夐挳鎿嶄綔 */
 const handleQuery = () => {
@@ -172,7 +195,6 @@
   getList();
 };
 const paginationChange = (obj) => {
-  console.log("paginationChange", current, limit);
   page.current = obj.page;
   page.size = obj.limit;
   getList();
@@ -227,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,
@@ -239,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);
@@ -246,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 }) => {

--
Gitblit v1.9.3