From 12075acefa2925a00d19085f247baa3ce783718a Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 20 Oct 2025 09:45:49 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=20=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E3=80=91=E4=BA=A4=E6=98=93=E7=BB=9F=E8=AE=A1=E3=80=81=E5=95=86?= =?UTF-8?q?=E5=93=81=E7=BB=9F=E8=AE=A1=E3=80=90ele=E3=80=9160%=EF=BC=9A?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/components/product-rank.vue | 147 -------- .../product/components/product-summary.vue | 332 ------------------ .../views/mall/statistics/product/index.vue | 30 +- .../statistics/product/modules/rank-card.vue | 137 ++++++++ .../product/modules/summary-card.vue | 255 ++++++++++++++ .../product/modules/summary-chart-options.ts | 130 +++++++ 6 files changed, 540 insertions(+), 491 deletions(-) delete mode 100644 apps/web-ele/src/views/mall/statistics/product/components/product-rank.vue delete mode 100644 apps/web-ele/src/views/mall/statistics/product/components/product-summary.vue create mode 100644 apps/web-ele/src/views/mall/statistics/product/modules/rank-card.vue create mode 100644 apps/web-ele/src/views/mall/statistics/product/modules/summary-card.vue create mode 100644 apps/web-ele/src/views/mall/statistics/product/modules/summary-chart-options.ts diff --git a/apps/web-ele/src/views/mall/statistics/product/components/product-rank.vue b/apps/web-ele/src/views/mall/statistics/product/components/product-rank.vue deleted file mode 100644 index c01ea3527..000000000 --- a/apps/web-ele/src/views/mall/statistics/product/components/product-rank.vue +++ /dev/null @@ -1,147 +0,0 @@ - - - diff --git a/apps/web-ele/src/views/mall/statistics/product/components/product-summary.vue b/apps/web-ele/src/views/mall/statistics/product/components/product-summary.vue deleted file mode 100644 index c7ec77f7f..000000000 --- a/apps/web-ele/src/views/mall/statistics/product/components/product-summary.vue +++ /dev/null @@ -1,332 +0,0 @@ - - - diff --git a/apps/web-ele/src/views/mall/statistics/product/index.vue b/apps/web-ele/src/views/mall/statistics/product/index.vue index 26d1b86ca..2e3834059 100644 --- a/apps/web-ele/src/views/mall/statistics/product/index.vue +++ b/apps/web-ele/src/views/mall/statistics/product/index.vue @@ -1,21 +1,27 @@ diff --git a/apps/web-ele/src/views/mall/statistics/product/modules/rank-card.vue b/apps/web-ele/src/views/mall/statistics/product/modules/rank-card.vue new file mode 100644 index 000000000..a2bc11462 --- /dev/null +++ b/apps/web-ele/src/views/mall/statistics/product/modules/rank-card.vue @@ -0,0 +1,137 @@ + + + + diff --git a/apps/web-ele/src/views/mall/statistics/product/modules/summary-card.vue b/apps/web-ele/src/views/mall/statistics/product/modules/summary-card.vue new file mode 100644 index 000000000..0a9a0bfe9 --- /dev/null +++ b/apps/web-ele/src/views/mall/statistics/product/modules/summary-card.vue @@ -0,0 +1,255 @@ + + + + diff --git a/apps/web-ele/src/views/mall/statistics/product/modules/summary-chart-options.ts b/apps/web-ele/src/views/mall/statistics/product/modules/summary-chart-options.ts new file mode 100644 index 000000000..ccec70195 --- /dev/null +++ b/apps/web-ele/src/views/mall/statistics/product/modules/summary-chart-options.ts @@ -0,0 +1,130 @@ +/** 商品统计折线图配置 */ +export function getProductSummaryChartOptions(data: any[]): any { + // 处理数据:将金额从分转换为元 + const processedData = data.map((item) => ({ + ...item, + orderPayPrice: Number((item.orderPayPrice / 100).toFixed(2)), + afterSaleRefundPrice: Number((item.afterSaleRefundPrice / 100).toFixed(2)), + })); + + return { + dataset: { + dimensions: [ + 'time', + 'browseCount', + 'browseUserCount', + 'orderPayPrice', + 'afterSaleRefundPrice', + ], + source: processedData, + }, + grid: { + left: 20, + right: 20, + bottom: 20, + top: 80, + containLabel: true, + }, + legend: { + top: 50, + }, + series: [ + { + name: '商品浏览量', + type: 'line', + smooth: true, + itemStyle: { color: '#B37FEB' }, + }, + { + name: '商品访客数', + type: 'line', + smooth: true, + itemStyle: { color: '#FFAB2B' }, + }, + { + name: '支付金额', + type: 'bar', + smooth: true, + yAxisIndex: 1, + itemStyle: { color: '#1890FF' }, + }, + { + name: '退款金额', + type: 'bar', + smooth: true, + yAxisIndex: 1, + itemStyle: { color: '#00C050' }, + }, + ], + toolbox: { + feature: { + // 数据区域缩放 + dataZoom: { + yAxisIndex: false, // Y轴不缩放 + }, + brush: { + type: ['lineX', 'clear'], // 区域缩放按钮、还原按钮 + }, + saveAsImage: { + show: true, + name: '商品状况', + }, // 保存为图片 + }, + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross', + }, + padding: [5, 10], + }, + xAxis: { + type: 'category', + boundaryGap: true, + axisTick: { + show: false, + }, + }, + yAxis: [ + { + type: 'value', + name: '金额', + axisLine: { + show: false, + }, + axisTick: { + show: false, + }, + axisLabel: { + color: '#7F8B9C', + }, + splitLine: { + show: true, + lineStyle: { + color: '#F5F7F9', + }, + }, + }, + { + type: 'value', + name: '数量', + axisLine: { + show: false, + }, + axisTick: { + show: false, + }, + axisLabel: { + color: '#7F8B9C', + }, + splitLine: { + show: true, + lineStyle: { + color: '#F5F7F9', + }, + }, + }, + ], + }; +} +