From 62add33884c2ae20cb85a94d8dd834e3d24bafd5 Mon Sep 17 00:00:00 2001 From: Timi Date: Fri, 11 Sep 2026 17:33:28 +0800 Subject: [PATCH] update customer chart --- package.json | 3 +- pnpm-lock.yaml | 12 +++ src/api/CustomerChartAPI.ts | 15 +++- .../DateRangeChartCard.vue} | 42 ++++----- src/pages/customer/CustomerDataCharts.vue | 88 ++++++++++++------- .../CustomerConsumptionDailyChart.vue | 7 +- .../component/CustomerOrderCalendarChart.vue | 7 +- .../component/CustomerOrderCharts.vue | 7 -- .../CustomerOrderProductRankChart.vue | 9 +- .../component/CustomerOrderSkuRankChart.vue | 9 +- .../component/CustomerRepeatDailyChart.vue | 7 +- .../component/CustomerRepeatIntervalChart.vue | 7 +- .../component/CustomerOrderRankChart.vue | 5 +- .../product/component/OrderDailyChart.vue | 8 +- .../product/component/OrderPaymentChart.vue | 5 +- .../product/component/OrderStatusChart.vue | 5 +- .../product/component/OrderTypeChart.vue | 5 +- .../component/ProductFulfillmentRankChart.vue | 5 +- .../ProductFulfillmentTrendChart.vue | 5 +- .../component/ProductSalesRankChart.vue | 5 +- .../component/ProductSalesTrendChart.vue | 5 +- .../component/ProductStockMovementChart.vue | 5 +- src/pages/product/component/chartUtils.ts | 8 +- src/pages/store/StoreDataCharts.vue | 6 +- src/types/Customer.ts | 5 ++ 25 files changed, 150 insertions(+), 135 deletions(-) rename src/{pages/product/component/GaoChartCard.vue => components/DateRangeChartCard.vue} (78%) diff --git a/package.json b/package.json index 01eb2f5..2642157 100644 --- a/package.json +++ b/package.json @@ -21,12 +21,13 @@ "@zxing/library": "^0.21.3", "browser-image-compression": "^2.0.2", "echarts": "^6.0.0", + "echarts-wordcloud": "^2.1.0", "less": "^4.3.0", "pinia": "^3.0.2", "tdesign-mobile-vue": "^1.16.0", "timi-tdesign-mobile": "link:E:/WebProject/timi-tdesign-mobile", - "timi-web-api": "link:E:/WebProject/timi-web-api", "timi-web": "link:E:/WebProject/timi-web", + "timi-web-api": "link:E:/WebProject/timi-web-api", "ts-node": "^10.9.2", "vue": "^3.5.16", "vue-draggable-next": "^2.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6e77b6c..e8bda09 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25,6 +25,9 @@ importers: echarts: specifier: ^6.0.0 version: 6.1.0 + echarts-wordcloud: + specifier: ^2.1.0 + version: 2.1.0(echarts@6.1.0) less: specifier: ^4.3.0 version: 4.8.0 @@ -971,6 +974,11 @@ packages: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} + echarts-wordcloud@2.1.0: + resolution: {integrity: sha512-Kt1JmbcROgb+3IMI48KZECK2AP5lG6bSsOEs+AsuwaWJxQom31RTNd6NFYI01E/YaI1PFZeueaupjlmzSQasjQ==} + peerDependencies: + echarts: ^5.0.1 + echarts@6.1.0: resolution: {integrity: sha512-q0yaFPggC9FUdsWH4blavRWFmxdrIodbkoKNAjJudAI6CA9gNPxHtV2RcZNEepZVlk4yvBYkOkbk6HIVpIyHZA==} @@ -2807,6 +2815,10 @@ snapshots: es-errors: 1.3.0 gopd: 1.2.0 + echarts-wordcloud@2.1.0(echarts@6.1.0): + dependencies: + echarts: 6.1.0 + echarts@6.1.0: dependencies: tslib: 2.3.0 diff --git a/src/api/CustomerChartAPI.ts b/src/api/CustomerChartAPI.ts index db8c238..94f5b38 100644 --- a/src/api/CustomerChartAPI.ts +++ b/src/api/CustomerChartAPI.ts @@ -1,9 +1,14 @@ import { axios } from "timi-web-api"; -import type { CustomerChartReq } from "@/types/Customer"; +import type { CustomerChartReq, CustomerDiseaseWordView } from "@/types/Customer"; import type { StoreEventRecordCalendarView, StoreEventRecordDailyStatView } from "@/types/Store"; +import { getStoreChartCache } from "@/utils/storeChartCache"; import { withCurrentStoreId } from "@/utils/store"; const BASE_URI = "/gao/customer/chart"; +type CustomerDiseaseWordReq = { + storeId?: string; + topN: number; +}; async function eventRecordDailyStat(req: CustomerChartReq): Promise { return await axios.post(`${BASE_URI}/event/record/daily`, withCurrentStoreId(req)); @@ -13,7 +18,13 @@ async function eventRecordCalendar(req: CustomerChartReq): Promise { + const request = withCurrentStoreId({ topN }); + return await getStoreChartCache(`customer-disease-word:${JSON.stringify(request)}`, async () => await axios.post(`${BASE_URI}/customer/disease/word`, request)); +} + export default { eventRecordDailyStat, - eventRecordCalendar + eventRecordCalendar, + diseaseWord }; diff --git a/src/pages/product/component/GaoChartCard.vue b/src/components/DateRangeChartCard.vue similarity index 78% rename from src/pages/product/component/GaoChartCard.vue rename to src/components/DateRangeChartCard.vue index d7f9b6e..248c058 100644 --- a/src/pages/product/component/GaoChartCard.vue +++ b/src/components/DateRangeChartCard.vue @@ -1,16 +1,13 @@