From b66bd3213636032189026d14bdc9f264a3a57742 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 29 六月 2026 16:27:12 +0800
Subject: [PATCH] 供应商往来页面更换接口

---
 src/api/procurementManagement/paymentLedger.js           |    8 
 src/pages/procurementManagement/paymentLedger/index.vue  |  210 ++++++++++++++++++++++-------------------
 src/pages/procurementManagement/paymentLedger/detail.vue |   67 ++++++++-----
 3 files changed, 157 insertions(+), 128 deletions(-)

diff --git a/src/api/procurementManagement/paymentLedger.js b/src/api/procurementManagement/paymentLedger.js
index 31aff29..abb8c5a 100644
--- a/src/api/procurementManagement/paymentLedger.js
+++ b/src/api/procurementManagement/paymentLedger.js
@@ -4,17 +4,17 @@
 // 鍒嗛〉鏌ヨ
 export function paymentLedgerList(query) {
   return request({
-    url: "/purchase/paymentRegistration/supplierNameListPage",
+    url: "/purchase/report/supplierTransactions",
     method: "get",
     params: query,
   });
 }
 
 // 鍒嗛〉鏌ヨ
-export function paymentRecordList(supplierId) {
+export function paymentRecordList(params) {
   return request({
-    url: "/purchase/paymentRegistration/supplierNameListPageDetails",
+    url: "/purchase/report/supplierTransactionsDetails",
     method: "get",
-    params: supplierId,
+    params,
   });
 }
diff --git a/src/pages/procurementManagement/paymentLedger/detail.vue b/src/pages/procurementManagement/paymentLedger/detail.vue
index 26f5cf5..efbd13c 100644
--- a/src/pages/procurementManagement/paymentLedger/detail.vue
+++ b/src/pages/procurementManagement/paymentLedger/detail.vue
@@ -1,7 +1,7 @@
 <template>
   <view class="receipt-payment-detail">
     <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
-    <PageHeader title="渚涘簲鍟嗗線鏉ヨ鎯�"
+    <PageHeader :title="pageTitle"
                 @back="goBack" />
     <!-- 缁熻淇℃伅 -->
     <view class="summary-info"
@@ -11,16 +11,16 @@
         <text class="summary-value">{{ tableData.length }}</text>
       </view>
       <view class="summary-item">
-        <text class="summary-label">寮�绁ㄦ�婚噾棰�</text>
-        <text class="summary-value">{{ formatAmount(invoiceTotal) }}</text>
+        <text class="summary-label">鍚堝悓鎬婚噾棰�</text>
+        <text class="summary-value">{{ formatAmount(contractTotal) }}</text>
       </view>
       <view class="summary-item">
-        <text class="summary-label">鍥炴鎬婚噾棰�</text>
-        <text class="summary-value highlight">{{ formatAmount(receiptTotal) }}</text>
+        <text class="summary-label">宸插叆搴撴�婚噾棰�</text>
+        <text class="summary-value highlight">{{ formatAmount(shippedTotal) }}</text>
       </view>
       <view class="summary-item">
-        <text class="summary-label">搴旀敹鎬婚噾棰�</text>
-        <text class="summary-value danger">{{ formatAmount(unReceiptTotal) }}</text>
+        <text class="summary-label">鏈叆搴撴�婚噾棰�</text>
+        <text class="summary-value danger">{{ formatAmount(unshippedTotal) }}</text>
       </view>
     </view>
     <!-- 鍥炴璁板綍鏄庣粏鍒楄〃 -->
@@ -38,25 +38,25 @@
             </view>
             <text class="item-index">{{ index + 1 }}</text>
           </view>
-          <view class="item-date">{{ item.happenTime }}</view>
+          <view class="item-date">{{ item.executionDate || '--' }}</view>
         </view>
         <up-divider></up-divider>
         <view class="item-details">
           <view class="detail-row">
-            <text class="detail-label">鍙戠エ閲戦(鍏�)</text>
-            <text class="detail-value">{{ formatAmount(item.invoiceAmount) }}</text>
+            <text class="detail-label">閲囪喘鍚堝悓鍙�</text>
+            <text class="detail-value">{{ item.purchaseContractNumber || '--' }}</text>
           </view>
           <view class="detail-row">
-            <text class="detail-label">浠樻閲戦(鍏�)</text>
-            <text class="detail-value highlight">{{ formatAmount(item.currentPaymentAmount) }}</text>
+            <text class="detail-label">鍚堝悓閲戦(鍏�)</text>
+            <text class="detail-value">{{ formatAmount(item.contractAmount) }}</text>
           </view>
           <view class="detail-row">
-            <text class="detail-label">搴斾粯閲戦(鍏�)</text>
-            <text class="detail-value danger">{{ formatAmount(item.payableAmount) }}</text>
+            <text class="detail-label">宸插叆搴撻噾棰�(鍏�)</text>
+            <text class="detail-value highlight">{{ formatAmount(item.shippedAmount) }}</text>
           </view>
           <view class="detail-row">
-            <text class="detail-label">鍙戠敓鏃ユ湡</text>
-            <text class="detail-value">{{ item.paymentDate }}</text>
+            <text class="detail-label">鏈叆搴撻噾棰�(鍏�)</text>
+            <text class="detail-value danger">{{ formatAmount(item.unshippedAmount) }}</text>
           </view>
         </view>
       </view>
@@ -72,37 +72,41 @@
   import { ref, computed, onMounted } from "vue";
   import { onShow } from "@dcloudio/uni-app";
   import {
-    paymentLedgerList,
     paymentRecordList,
   } from "@/api/procurementManagement/paymentLedger";
 
   // 瀹㈡埛淇℃伅
   const supplierId = ref("");
+  const supplierName = ref("");
+  const pageTitle = computed(() => {
+    return supplierName.value ? `渚涘簲鍟嗗線鏉ヨ鎯咃紙${supplierName.value}锛塦 : "渚涘簲鍟嗗線鏉ヨ鎯�";
+  });
 
   // 琛ㄦ牸鏁版嵁
   const tableData = ref([]);
 
-  const invoiceTotal = computed(() => {
+  const contractTotal = computed(() => {
     return tableData.value.reduce((sum, item) => {
-      return sum + (parseFloat(item.invoiceAmount) || 0);
+      return sum + (parseFloat(item.contractAmount) || 0);
     }, 0);
   });
 
-  const receiptTotal = computed(() => {
+  const shippedTotal = computed(() => {
     return tableData.value.reduce((sum, item) => {
-      return sum + (parseFloat(item.receiptAmount) || 0);
+      return sum + (parseFloat(item.shippedAmount) || 0);
     }, 0);
   });
 
-  const unReceiptTotal = computed(() => {
+  const unshippedTotal = computed(() => {
     return tableData.value.reduce((sum, item) => {
-      return sum + (parseFloat(item.unReceiptAmount) || 0);
+      return sum + (parseFloat(item.unshippedAmount) || 0);
     }, 0);
   });
 
   // 杩斿洖涓婁竴椤�
   const goBack = () => {
     uni.removeStorageSync("supplierId");
+    uni.removeStorageSync("supplierName");
     uni.navigateBack();
   };
 
@@ -112,6 +116,10 @@
     const storedSupplierId = uni.getStorageSync("supplierId");
     if (storedSupplierId) {
       supplierId.value = storedSupplierId;
+    }
+    const storedSupplierName = uni.getStorageSync("supplierName");
+    if (storedSupplierName) {
+      supplierName.value = storedSupplierName;
     }
   };
 
@@ -125,9 +133,18 @@
       return;
     }
     showLoadingToast("鍔犺浇涓�...");
-    paymentRecordList({ supplierId: supplierId.value })
+    paymentRecordList({
+      supplierId: supplierId.value,
+      current: -1,
+      size: -1,
+    })
       .then(res => {
-        tableData.value = res.data;
+        const result = res?.data;
+        if (Array.isArray(result)) {
+          tableData.value = result;
+        } else {
+          tableData.value = result?.records || [];
+        }
         closeToast();
       })
       .catch(() => {
diff --git a/src/pages/procurementManagement/paymentLedger/index.vue b/src/pages/procurementManagement/paymentLedger/index.vue
index 8bd7c6e..66437e3 100644
--- a/src/pages/procurementManagement/paymentLedger/index.vue
+++ b/src/pages/procurementManagement/paymentLedger/index.vue
@@ -1,64 +1,68 @@
 <template>
   <view class="sales-account">
     <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
-    <PageHeader title="渚涘簲鍟嗗線鏉�" @back="goBack" />
-    
+    <PageHeader title="渚涘簲鍟嗗線鏉�"
+                @back="goBack" />
     <!-- 鎼滅储鍖哄煙 -->
     <view class="search-section">
       <view class="search-bar">
         <view class="search-input">
-          <up-input
-            class="search-text"
-            placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О"
-            v-model="searchForm.supplierName"
-            @change="handleQuery"
-						clearable
-          />
+          <up-input class="search-text"
+                    placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О"
+                    v-model="searchForm.supplierName"
+                    @change="handleQuery"
+                    clearable />
         </view>
-        <view class="search-button" @click="handleQuery">
-          <up-icon name="search" size="24" color="#999"></up-icon>
+        <view class="search-button"
+              @click="handleQuery">
+          <up-icon name="search"
+                   size="24"
+                   color="#999"></up-icon>
         </view>
       </view>
     </view>
-
     <!-- 渚涘簲鍟嗗垪琛� -->
     <view class="customer-list-container">
-      <view class="customer-list" v-if="tableData.length > 0">
-        <view 
-          v-for="(item, index) in tableData" 
-          :key="item.id"
-          class="customer-item"
-          @click="rowClickMethod(item)"
-        >
+      <view class="customer-list"
+            v-if="tableData.length > 0">
+        <view v-for="(item, index) in tableData"
+              :key="item.id"
+              class="customer-item"
+              @click="rowClickMethod(item)">
           <view class="item-header">
             <view class="item-left">
               <view class="customer-icon">
-								<up-icon name="file-text" size="16" color="#ffffff"></up-icon>
+                <up-icon name="file-text"
+                         size="16"
+                         color="#ffffff"></up-icon>
               </view>
               <text class="customer-name">{{ item.supplierName }}</text>
             </view>
             <view class="item-right">
-              <up-icon name="arrow-right" size="16" color="#999"></up-icon>
+              <up-icon name="arrow-right"
+                       size="16"
+                       color="#999"></up-icon>
             </view>
           </view>
           <up-divider></up-divider>
           <view class="item-details">
             <view class="detail-row">
               <text class="detail-label">鍚堝悓閲戦(鍏�)</text>
-              <text class="detail-value">{{ formattedNumber(item.invoiceAmount) }}</text>
+              <text class="detail-value">{{ formattedNumber(item.contractAmounts) }}</text>
             </view>
             <view class="detail-row">
-              <text class="detail-label">浠樻閲戦(鍏�)</text>
-              <text class="detail-value">{{ formattedNumber(item.paymentAmount) }}</text>
+              <text class="detail-label">宸插叆搴撻噾棰�(鍏�)</text>
+              <text class="detail-value">{{ formattedNumber(item.shippedAmount) }}</text>
             </view>
             <view class="detail-row">
-              <text class="detail-label">搴斾粯閲戦(鍏�)</text>
-              <text class="detail-value highlight danger">{{ formattedNumber(item.payableAmount) }}</text>
+              <text class="detail-label">鏈叆搴撻噾棰�(鍏�)</text>
+              <text class="detail-value highlight danger">{{ formattedNumber(item.unshippedAmount) }}</text>
             </view>
           </view>
         </view>
       </view>
-      <view v-else class="no-data">
+      <view v-else
+            class="no-data">
         <text>鏆傛棤渚涘簲鍟嗘暟鎹�</text>
       </view>
     </view>
@@ -66,90 +70,98 @@
 </template>
 
 <script setup>
-import { onMounted, ref, reactive, toRefs } from "vue";
-import { onShow } from '@dcloudio/uni-app';
-import {paymentLedgerList} from "@/api/procurementManagement/paymentLedger";
+  import { onMounted, ref, reactive, toRefs } from "vue";
+  import { onShow } from "@dcloudio/uni-app";
+  import { paymentLedgerList } from "@/api/procurementManagement/paymentLedger";
 
+  const tableData = ref([]);
 
-const tableData = ref([]);
+  const page = reactive({
+    current: -1,
+    size: -1,
+  });
 
-const page = reactive({
-  current: -1,
-  size: -1,
-});
+  const data = reactive({
+    searchForm: {
+      supplierName: "",
+      invoiceDate: "",
+    },
+  });
 
+  const { searchForm } = toRefs(data);
 
+  // 杩斿洖涓婁竴椤�
+  const goBack = () => {
+    uni.navigateBack();
+  };
 
-const data = reactive({
-  searchForm: {
-    supplierName: "",
-    invoiceDate: "",
-  },
-});
+  // 鏌ヨ鍒楄〃
+  const handleQuery = () => {
+    getList();
+  };
 
-const { searchForm } = toRefs(data);
+  const getList = () => {
+    showLoadingToast("鍔犺浇涓�...");
+    paymentLedgerList({ ...searchForm.value, ...page })
+      .then(res => {
+        const result = res?.data;
+        if (Array.isArray(result)) {
+          tableData.value = result;
+        } else {
+          tableData.value = result?.records || [];
+        }
+        closeToast();
+      })
+      .catch(() => {
+        closeToast();
+        uni.showToast({
+          title: "鏌ヨ澶辫触",
+          icon: "error",
+        });
+      });
+  };
 
-// 杩斿洖涓婁竴椤�
-const goBack = () => {
-  uni.navigateBack();
-};
+  const formattedNumber = value => {
+    if (value === null || value === undefined || value === "") return "0.00";
+    const num = Number(value);
+    if (Number.isNaN(num)) return "0.00";
+    return num.toFixed(2);
+  };
 
-// 鏌ヨ鍒楄〃
-const handleQuery = () => {
-  getList();
-};
-
-const getList = () => {
-	showLoadingToast('鍔犺浇涓�...')
-	paymentLedgerList({ ...searchForm.value, ...page }).then((res) => {
-    tableData.value = res.data.records;
-    closeToast()
-  }).catch(() => {
-    closeToast()
-    uni.showToast({
-      title: '鏌ヨ澶辫触',
-      icon: 'error'
+  // 鏄剧ず鍔犺浇鎻愮ず
+  const showLoadingToast = message => {
+    uni.showLoading({
+      title: message,
+      mask: true,
     });
+  };
+
+  // 鍏抽棴鎻愮ず
+  const closeToast = () => {
+    uni.hideLoading();
+  };
+
+  const rowClickMethod = row => {
+    // 浣跨敤 uni.setStorageSync 瀛樺偍渚涘簲鍟嗕俊鎭�
+    uni.setStorageSync("supplierId", row.supplierId);
+    uni.setStorageSync("supplierName", row.supplierName);
+    // 璺宠浆鍒板洖娆捐褰曟槑缁嗛〉闈�
+    uni.navigateTo({
+      url: "/pages/procurementManagement/paymentLedger/detail",
+    });
+  };
+
+  onMounted(() => {
+    getList();
   });
-};
-
-const formattedNumber = (value) => {
-  return parseFloat(value || 0).toFixed(2);
-};
-
-// 鏄剧ず鍔犺浇鎻愮ず
-const showLoadingToast = (message) => {
-	uni.showLoading({
-		title: message,
-		mask: true
-	});
-};
-
-// 鍏抽棴鎻愮ず
-const closeToast = () => {
-	uni.hideLoading();
-};
-
-const rowClickMethod = (row) => {
-  // 浣跨敤 uni.setStorageSync 瀛樺偍渚涘簲鍟嗕俊鎭�
-  uni.setStorageSync('supplierId', row.supplierId);
-  // 璺宠浆鍒板洖娆捐褰曟槑缁嗛〉闈�
-  uni.navigateTo({
-    url: '/pages/procurementManagement/paymentLedger/detail'
-  });
-};
-
-onMounted(() => {
-  getList();
-});
 </script>
 
 <style scoped lang="scss">
-@import '@/styles/procurement-common.scss';
+  @import "@/styles/procurement-common.scss";
 
-// 渚涘簲鍟嗗線鏉ョ壒鏈夋牱寮�
-.detail-value.danger {
-  color: #ff4757; // 涓庡叕鍏辨牱寮忎腑鐨� #ee0a24 涓嶅悓
-  font-weight: 500;
-}
-</style>
\ No newline at end of file
+  // 渚涘簲鍟嗗線鏉ョ壒鏈夋牱寮�
+  .detail-value.danger {
+    color: #ff4757; // 涓庡叕鍏辨牱寮忎腑鐨� #ee0a24 涓嶅悓
+    font-weight: 500;
+  }
+</style>

--
Gitblit v1.9.3