From 473a8b1acdad441bd93a81066e385bb1b6f922b7 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期六, 07 十一月 2026 14:53:17 +0800
Subject: [PATCH] refactor: 需求10/23 前端改为 ERP 口径,修正 ERP 可用性误判

---
 src/api/erp/statistics/purchase/index.ts |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/src/api/erp/statistics/purchase/index.ts b/src/api/erp/statistics/purchase/index.ts
index 126b6f2..232b3f7 100644
--- a/src/api/erp/statistics/purchase/index.ts
+++ b/src/api/erp/statistics/purchase/index.ts
@@ -1,3 +1,5 @@
+import type { PageParam, PageResult } from '@vben/request';
+
 import { requestClient } from '#/api/request';
 
 export namespace ErpPurchaseStatisticsApi {
@@ -14,6 +16,23 @@
     time: string; // 鏃堕棿
     price: number; // 閲囪喘閲戦
   }
+
+  /** 閲囪喘浠锋牸鍒嗘瀽锛堟寜鐗╂枡鑱氬悎宸插鏍搁噰璐鍗曪級 */
+  export interface PurchasePriceAnalysis {
+    productId?: number;
+    productBarCode?: string;
+    productName?: string;
+    /** 閲囪喘閲忥紙璁㈠崟鏄庣粏鏁伴噺鍚堣锛� */
+    totalQuantity?: number;
+    /** 鍔犳潈鍧囦环 = 危(鍗曚环脳鏁伴噺) / 危鏁伴噺 */
+    avgPrice?: number;
+    minPrice?: number;
+    maxPrice?: number;
+    latestPrice?: number;
+    previousPrice?: number;
+    /** 浠锋牸鍙樺姩鐜囷紙%锛� */
+    priceChangeRate?: number;
+  }
 }
 
 /** 鑾峰緱閲囪喘缁熻 */
@@ -29,3 +48,12 @@
     ErpPurchaseStatisticsApi.PurchaseTimeSummaryRespVO[]
   >('/erp/purchase-statistics/time-summary');
 }
+
+/** 閲囪喘浠锋牸鍒嗘瀽锛堟寜鐗╂枡鑱氬悎宸插鏍搁噰璐鍗曪紝鐢ㄤ簬閲囪喘鎴愭湰鍒嗘瀽锛� */
+export function getPurchasePriceAnalysis(
+  params: PageParam & { orderTime?: string[]; productId?: number },
+) {
+  return requestClient.get<
+    PageResult<ErpPurchaseStatisticsApi.PurchasePriceAnalysis>
+  >('/erp/purchase-statistics/price', { params });
+}

--
Gitblit v1.9.3