diff --git a/apps/web-antd/src/api/agent/agent.ts b/apps/web-antd/src/api/agent/agent.ts index 3f0e20a..199a98c 100644 --- a/apps/web-antd/src/api/agent/agent.ts +++ b/apps/web-antd/src/api/agent/agent.ts @@ -139,10 +139,22 @@ export namespace AgentApi { } // 提现统计数据 - export interface WithdrawalStatistics { - total_withdrawal_amount: number; - today_withdrawal_amount: number; - } +export interface WithdrawalStatistics { + total_withdrawal_amount: number; + today_withdrawal_amount: number; +} + +// 代理订单统计数据 +export interface AgentOrderStatistics { + total_agent_order_count: number; // 总代理订单数 + today_agent_order_count: number; // 今日代理订单数 +} + +// 代理统计数据 +export interface AgentStatistics { + total_agent_count: number; // 总代理数 + today_agent_count: number; // 今日新增代理数 +} // 代理上级抽佣相关接口 export interface AgentCommissionDeductionListItem { @@ -487,15 +499,35 @@ async function getWithdrawalStatistics() { ); } +/** + * 获取代理订单统计数据 + */ +async function getAgentOrderStatistics() { + return requestClient.get( + '/agent/agent-order/statistics', + ); +} + +/** + * 获取代理统计数据 + */ +async function getAgentStatistics() { + return requestClient.get( + '/agent/statistics', + ); +} + export { getAgentCommissionDeductionList, getAgentCommissionList, getAgentLinkList, getAgentList, getAgentMembershipConfigList, + getAgentOrderStatistics, getAgentPlatformDeductionList, getAgentProductionConfigList, getAgentRewardList, + getAgentStatistics, getAgentWithdrawalList, getMembershipRechargeOrderList, getWithdrawalStatistics, diff --git a/apps/web-antd/src/views/dashboard/analytics/index.vue b/apps/web-antd/src/views/dashboard/analytics/index.vue index eae9861..c834843 100644 --- a/apps/web-antd/src/views/dashboard/analytics/index.vue +++ b/apps/web-antd/src/views/dashboard/analytics/index.vue @@ -22,7 +22,7 @@ import AnalyticsVisitsSales from './analytics-visits-sales.vue'; import AnalyticsVisitsSource from './analytics-visits-source.vue'; import AnalyticsVisits from './analytics-visits.vue'; -import { getAgentList, getWithdrawalStatistics } from '#/api/agent'; +import { getAgentList, getAgentStatistics, getWithdrawalStatistics, getAgentOrderStatistics } from '#/api/agent'; import { getOrderList, getRefundStatistics, getIncomeStatistics } from '#/api/order/order'; import { getPlatformUserList } from '#/api/platform-user'; @@ -111,8 +111,8 @@ async function fetchStatistics() { const orderTotal = orderResponse.total || 0; // 获取代理订单数据 - const agentOrderResponse = await getOrderList({ page: 1, pageSize: 1, is_agent_order: true }); - const agentOrderTotal = agentOrderResponse.total || 0; + const agentOrderResponse = await getAgentOrderStatistics(); + const agentOrderTotal = agentOrderResponse.total_agent_order_count || 0; // 获取今日新增订单数 const todayOrderResponse = await getOrderList({ @@ -124,29 +124,15 @@ async function fetchStatistics() { const todayOrderTotal = todayOrderResponse.total || 0; // 获取今日新增代理订单数 - const todayAgentOrderResponse = await getOrderList({ - page: 1, - pageSize: 1000, - is_agent_order: true, - create_time_start: startTime, - create_time_end: endTime - }); - const todayAgentOrderTotal = todayAgentOrderResponse.total || 0; + const todayAgentOrderResponse = await getAgentOrderStatistics(); + const todayAgentOrderTotal = todayAgentOrderResponse.today_agent_order_count || 0; // Product data is no longer needed for order statistics - // 获取代理数据(总数) - const agentResponse = await getAgentList({ page: 1, pageSize: 1 }); - const agentTotal = agentResponse.total || 0; - - // 获取今日新增代理数 - const newAgentResponse = await getAgentList({ - page: 1, - pageSize: 100, - create_time_start: startTime, - create_time_end: endTime - }); - const newAgentCount = newAgentResponse.total || 0; + // 获取代理统计数据 + const agentStatsResponse = await getAgentStatistics(); + const agentTotal = agentStatsResponse.total_agent_count || 0; + const newAgentCount = agentStatsResponse.today_agent_count || 0; // 获取提现统计数据 const withdrawalStatsResponse = await getWithdrawalStatistics();