优化首页销售趋势数据变化

This commit is contained in:
gyq 2024-10-08 13:34:59 +08:00
parent 89d5974fd2
commit 544038bb36
1 changed files with 23 additions and 4 deletions

View File

@ -658,7 +658,7 @@ export default {
} }
} }
], ],
color: "#409eff", color: ["#409eff", "#FFC83A", "#F98B26"],
yAxis: [ yAxis: [
{ {
type: "value", type: "value",
@ -677,9 +677,22 @@ export default {
], ],
series: [ series: [
{ {
data: data, name: '订单金额',
type: "bar", type: "bar",
barWidth: time.length <= 7 ? "50%" : "30%" barWidth: time.length <= 7 ? "30%" : "20%",
data: data.map(item => item.orderAmount),
},
{
name: '实收金额',
type: "bar",
barWidth: time.length <= 7 ? "30%" : "20%",
data: data.map(item => item.actualAmount),
},
{
name: '优惠金额',
type: "bar",
barWidth: time.length <= 7 ? "30%" : "20%",
data: data.map(item => item.discountAmount),
} }
] ]
}); });
@ -737,7 +750,13 @@ export default {
try { try {
this.saleLoading = true; this.saleLoading = true;
const res = await dateAmount(this.saleActive); const res = await dateAmount(this.saleActive);
const data = res.total.map(item => item.amount); const data = res.total.map(item => {
return {
orderAmount: item.orderAmount,
actualAmount: item.actualAmount,
discountAmount: item.discountAmount
}
});
const time = res.total.map(item => item.tradeDay); const time = res.total.map(item => item.tradeDay);
this.initSaleChart(time, data); this.initSaleChart(time, data);
setTimeout(() => { setTimeout(() => {