From 7595df5df9c19507f9dd501c4255e0a37e94f0f7 Mon Sep 17 00:00:00 2001 From: Timi Date: Wed, 23 Sep 2026 14:59:50 +0800 Subject: [PATCH] update order chart style --- .../component/CustomerOrderRankChart.vue | 15 +-- .../product/component/OrderDailyChart.vue | 1 + .../product/component/OrderPaymentChart.vue | 29 ++++- .../product/component/OrderReceivableCard.vue | 103 +++++++----------- .../product/component/OrderStatusChart.vue | 24 +++- .../product/component/OrderTypeChart.vue | 2 +- .../component/ProductSalesTrendChart.vue | 20 ++++ .../component/ProductStockHealthTable.vue | 13 +-- .../component/ProductStockMovementChart.vue | 9 +- src/pages/product/component/chartUtils.ts | 8 +- 10 files changed, 129 insertions(+), 95 deletions(-) diff --git a/src/pages/product/component/CustomerOrderRankChart.vue b/src/pages/product/component/CustomerOrderRankChart.vue index 648326b..e376b30 100644 --- a/src/pages/product/component/CustomerOrderRankChart.vue +++ b/src/pages/product/component/CustomerOrderRankChart.vue @@ -4,7 +4,7 @@ caption="排除已取消订单,前 10" :option="chartOption" :loading="loading" - height="17rem" + height="14rem" /> @@ -27,17 +27,18 @@ const chartOption = computed(() => { const list = props.list.slice(0, 10); return { ...buildHorizontalBarOption(list.map(getCustomerName)), - legend: { show: false }, + grid: { + top: 0, + left: 0, + right: 0, + bottom: 0, + showLabel: false + }, xAxis: { type: "value", - axisLabel: { - color: "#52607a", - formatter: (value: number) => `${formatChartYuan(value)} 元` - }, splitLine: { lineStyle: { color: "rgba(148, 163, 184, .2)" } } }, series: [{ - name: "净收款", type: "bar", tooltip: { valueFormatter: value => `${formatChartYuan(Number(value))} 元` }, data: list.map(item => getNumber(item.netPaidAmount) / 100) diff --git a/src/pages/product/component/OrderDailyChart.vue b/src/pages/product/component/OrderDailyChart.vue index 90462d9..737bfb8 100644 --- a/src/pages/product/component/OrderDailyChart.vue +++ b/src/pages/product/component/OrderDailyChart.vue @@ -39,6 +39,7 @@ function buildOption(visibleDateTextList: string[]): EChartsOption { { type: "value", name: "订单", + minInterval: 1, axisLabel: { color: "#52607a" }, splitLine: { lineStyle: { color: "rgba(148, 163, 184, .2)" } } }, diff --git a/src/pages/product/component/OrderPaymentChart.vue b/src/pages/product/component/OrderPaymentChart.vue index cd76f61..c375a1c 100644 --- a/src/pages/product/component/OrderPaymentChart.vue +++ b/src/pages/product/component/OrderPaymentChart.vue @@ -4,7 +4,7 @@ caption="当前订单快照" :option="chartOption" :loading="loading" - height="17rem" + height="6rem" /> @@ -27,16 +27,35 @@ const chartOption = computed(() => { const list = props.list; return { ...buildHorizontalBarOption(list.map(item => getPaymentStatusText(item.paymentStatus))), - legend: { show: false }, + grid: { + top: 0, + left: 0, + right: 0, + bottom: 0, + showLabel: false + }, series: [{ - name: "订单数", type: "bar", - data: list.map(item => getNumber(item.orderCount)) + data: list.map(item => ({ + value: getNumber(item.orderCount), + itemStyle: { color: getPaymentStatusColor(item.paymentStatus) } + })) }] }; }); function getPaymentStatusText(value?: string): string { - return ({ UNPAID: "未付款", PARTIALLY_PAID: "部分付款", PAID: "已付款" } as Record)[value || ""] || "未知状态"; + return ({ + UNPAID: "未付款", + PARTIALLY_PAID: "部分付款", + PAID: "已付款" + } as Record)[value || ""] || "未知状态"; +} +function getPaymentStatusColor(value?: string): string { + return ({ + UNPAID: "#F33434", + PARTIALLY_PAID: "#EB9C25", + PAID: "#0F766E" + } as Record)[value || ""] || "#94A3B8"; } diff --git a/src/pages/product/component/OrderReceivableCard.vue b/src/pages/product/component/OrderReceivableCard.vue index d73f200..4b8ba49 100644 --- a/src/pages/product/component/OrderReceivableCard.vue +++ b/src/pages/product/component/OrderReceivableCard.vue @@ -2,25 +2,17 @@

- -

-
-
- - -
+ 成交金额拆分;待收余额已扣除待核销
+
diff --git a/src/pages/product/component/OrderStatusChart.vue b/src/pages/product/component/OrderStatusChart.vue index 1a37fec..696cc27 100644 --- a/src/pages/product/component/OrderStatusChart.vue +++ b/src/pages/product/component/OrderStatusChart.vue @@ -4,7 +4,7 @@ caption="当前订单快照" :option="chartOption" :loading="loading" - height="17rem" + height="6rem" /> @@ -27,11 +27,19 @@ const chartOption = computed(() => { const list = props.list; return { ...buildHorizontalBarOption(list.map(item => getOrderStatusText(item.status))), - legend: { show: false }, + grid: { + top: 0, + left: 0, + right: 0, + bottom: 0, + showLabel: false + }, series: [{ - name: "订单数", type: "bar", - data: list.map(item => getNumber(item.orderCount)) + data: list.map(item => ({ + value: getNumber(item.orderCount), + itemStyle: { color: getOrderStatusColor(item.status) } + })) }] }; }); @@ -39,4 +47,12 @@ const chartOption = computed(() => { function getOrderStatusText(value?: string): string { return ({ ACTIVE: "进行中", FULFILLED: "已完成", CANCELLED: "已取消" } as Record)[value || ""] || "未知状态"; } + +function getOrderStatusColor(value?: string): string { + return ({ + ACTIVE: "#EB9C25", + FULFILLED: "#0F766E", + CANCELLED: "#F33434" + } as Record)[value || ""] || "#94A3B8"; +} diff --git a/src/pages/product/component/OrderTypeChart.vue b/src/pages/product/component/OrderTypeChart.vue index cf36ee4..bf088dc 100644 --- a/src/pages/product/component/OrderTypeChart.vue +++ b/src/pages/product/component/OrderTypeChart.vue @@ -4,7 +4,7 @@ caption="按订单数量" :option="chartOption" :loading="loading" - height="17rem" + height="10rem" /> diff --git a/src/pages/product/component/ProductSalesTrendChart.vue b/src/pages/product/component/ProductSalesTrendChart.vue index 7d91e5f..32948a5 100644 --- a/src/pages/product/component/ProductSalesTrendChart.vue +++ b/src/pages/product/component/ProductSalesTrendChart.vue @@ -35,23 +35,43 @@ function buildOption(visibleDateTextList: string[]): EChartsOption { axisTick: { show: false }, axisLabel: { color: "#52607a", interval: "auto", hideOverlap: true } }, + yAxis: [ + { + type: "value", + name: "基础单位", + minInterval: 1, + axisLabel: { color: "#52607a" }, + splitLine: { lineStyle: { color: "rgba(148, 163, 184, .2)" } } + }, + { + type: "value", + name: "订单", + position: "right", + minInterval: 1, + axisLabel: { color: "#52607a" }, + splitLine: { show: false } + } + ], series: [ { name: "直接销量", type: "bar", stack: "quantity", + yAxisIndex: 0, data: visibleDateTextList.map(dateText => getNumber(getDailyItem(props.list, dateText)?.directBaseQuantity)) }, { name: "套餐权益", type: "bar", stack: "quantity", + yAxisIndex: 0, data: visibleDateTextList.map(dateText => getNumber(getDailyItem(props.list, dateText)?.packageBaseQuantity)) }, { name: "订单数", type: "line", smooth: true, + yAxisIndex: 1, data: visibleDateTextList.map(dateText => getNumber(getDailyItem(props.list, dateText)?.orderCount)) } ] diff --git a/src/pages/product/component/ProductStockHealthTable.vue b/src/pages/product/component/ProductStockHealthTable.vue index fdaa30a..cdab9e2 100644 --- a/src/pages/product/component/ProductStockHealthTable.vue +++ b/src/pages/product/component/ProductStockHealthTable.vue @@ -20,8 +20,7 @@ -
-
+
@@ -73,10 +72,6 @@ function getLowStockSkuList(item: GaoProductStockHealthView): GaoProductSkuStock function getSkuName(item: GaoProductSkuStockHealthView): string { return [item.skuName || "未命名规格", item.specSummary].filter(Boolean).join(" · "); } - -function getProductTypeText(value?: string): string { - return ({ SERVICE: "服务", GOODS: "商品", CONSUMABLE: "耗材" } as Record)[value || ""] || "未分类"; -}