update order chart style
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
caption="当前订单快照"
|
||||
:option="chartOption"
|
||||
:loading="loading"
|
||||
height="17rem"
|
||||
height="6rem"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -27,16 +27,35 @@ const chartOption = computed<EChartsOption>(() => {
|
||||
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<string, string>)[value || ""] || "未知状态";
|
||||
return ({
|
||||
UNPAID: "未付款",
|
||||
PARTIALLY_PAID: "部分付款",
|
||||
PAID: "已付款"
|
||||
} as Record<string, string>)[value || ""] || "未知状态";
|
||||
}
|
||||
function getPaymentStatusColor(value?: string): string {
|
||||
return ({
|
||||
UNPAID: "#F33434",
|
||||
PARTIALLY_PAID: "#EB9C25",
|
||||
PAID: "#0F766E"
|
||||
} as Record<string, string>)[value || ""] || "#94A3B8";
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user