This commit is contained in:
parent
2acce82e3f
commit
63fa5681de
|
@ -2,61 +2,73 @@
|
|||
<div class="box-card statistics">
|
||||
<el-tabs stretch v-model="activeName">
|
||||
<el-tab-pane label="用户分析图" name="first">
|
||||
<echarts-from v-if="activeName=='first'" ref="optionUserData" :option-data="optionUserData" :styles="style" height="100%" width="100%" />
|
||||
<echarts-from
|
||||
v-if="activeName == 'first'"
|
||||
ref="optionUserData"
|
||||
:option-data="optionUserData"
|
||||
:styles="style"
|
||||
height="100%"
|
||||
width="100%"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="订单数量分析图" name="second">
|
||||
<echarts-from v-if="activeName=='second'" ref="optionOrderData" :option-data="optionOrderData" :styles="style" height="100%" width="100%" />
|
||||
<echarts-from
|
||||
v-if="activeName == 'second'"
|
||||
ref="optionOrderData"
|
||||
:option-data="optionOrderData"
|
||||
:styles="style"
|
||||
height="100%"
|
||||
width="100%"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="订单金额分析图" name="third">
|
||||
<echarts-from v-if="activeName=='third'" ref="optionOrderNumber" :option-data="optionOrderNumber" :styles="style" height="100%" width="100%" />
|
||||
<echarts-from
|
||||
v-if="activeName == 'third'"
|
||||
ref="optionOrderNumber"
|
||||
:option-data="optionOrderNumber"
|
||||
:styles="style"
|
||||
height="100%"
|
||||
width="100%"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import echartsFrom from '@/components/echarts/index'
|
||||
import { roterPre } from '@/settings'
|
||||
export default {
|
||||
name: 'DayData',
|
||||
<script>
|
||||
import echartsFrom from "@/components/echarts/index";
|
||||
import { roterPre } from "@/settings";
|
||||
export default {
|
||||
name: "DayData",
|
||||
components: {
|
||||
echartsFrom
|
||||
echartsFrom,
|
||||
},
|
||||
props:{
|
||||
props: {
|
||||
tableData: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statisticsData: [],
|
||||
roterPre: roterPre,
|
||||
optionUserData:{},
|
||||
optionOrderData:{},
|
||||
optionOrderNumber:{},
|
||||
newUserList:[],
|
||||
order_amount:[],
|
||||
order_coupon:[],
|
||||
refund_amount:[],
|
||||
pay_count:[],
|
||||
order_count:[],
|
||||
userList:[],
|
||||
timer:[],
|
||||
listLoading:true,
|
||||
activeName:'first',
|
||||
style:{
|
||||
height: '360px'
|
||||
}
|
||||
}
|
||||
optionUserData: {},
|
||||
optionOrderData: {},
|
||||
optionOrderNumber: {},
|
||||
listLoading: true,
|
||||
activeName: "first",
|
||||
style: {
|
||||
height: "360px",
|
||||
},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
tableData() {
|
||||
this.getList();
|
||||
},
|
||||
watch:{
|
||||
tableData(){
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getLine(newUserList,userList,timer){
|
||||
getLine(newUserList, userList, timer, activeCountList) {
|
||||
const seriesData = [
|
||||
{
|
||||
name: "新增用户(人)",
|
||||
|
@ -66,12 +78,27 @@
|
|||
normal: {
|
||||
color: "#5AD8A6",
|
||||
lineStyle: {
|
||||
color: "#5AD8A6"
|
||||
}
|
||||
}
|
||||
color: "#5AD8A6",
|
||||
},
|
||||
},
|
||||
},
|
||||
data: newUserList,
|
||||
smooth: false
|
||||
smooth: false,
|
||||
},
|
||||
{
|
||||
name: "活跃人数(人)",
|
||||
type: "line",
|
||||
stack: "用户量",
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#5D7092",
|
||||
lineStyle: {
|
||||
color: "#5D7092",
|
||||
},
|
||||
},
|
||||
},
|
||||
data: activeCountList,
|
||||
smooth: false,
|
||||
},
|
||||
{
|
||||
name: "累计用户(人)",
|
||||
|
@ -82,13 +109,13 @@
|
|||
normal: {
|
||||
color: "#5B8FF9",
|
||||
lineStyle: {
|
||||
color: "#5B8FF9"
|
||||
}
|
||||
}
|
||||
color: "#5B8FF9",
|
||||
},
|
||||
},
|
||||
},
|
||||
data: userList,
|
||||
smooth: false
|
||||
}
|
||||
smooth: false,
|
||||
},
|
||||
];
|
||||
this.optionUserData = {
|
||||
tooltip: {
|
||||
|
@ -96,52 +123,52 @@
|
|||
axisPointer: {
|
||||
type: "cross",
|
||||
label: {
|
||||
backgroundColor: "#6a7985"
|
||||
}
|
||||
}
|
||||
backgroundColor: "#6a7985",
|
||||
},
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
data: ["新增用户(人)", "累计用户(人)"],
|
||||
data: ["新增用户(人)", "累计用户(人)", "活跃人数(人)"],
|
||||
orient: "vertical",
|
||||
x:'right',
|
||||
y:'center',
|
||||
align:'left'
|
||||
x: "right",
|
||||
y: "center",
|
||||
align: "left",
|
||||
},
|
||||
grid: {
|
||||
top:'8%',
|
||||
top: "8%",
|
||||
left: "2%",
|
||||
right: "8%",
|
||||
bottom: "3%",
|
||||
containLabel: true
|
||||
containLabel: true,
|
||||
},
|
||||
axisLine: {
|
||||
show: false
|
||||
show: false,
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
boundaryGap: false,
|
||||
axisLine: {
|
||||
show: false
|
||||
show: false,
|
||||
},
|
||||
axisTick: {
|
||||
alignWithLabel: true,
|
||||
lineStyle: {
|
||||
color: "#D7DDE4"
|
||||
}
|
||||
color: "#D7DDE4",
|
||||
},
|
||||
},
|
||||
splitLine: {
|
||||
show: false
|
||||
show: false,
|
||||
},
|
||||
axisLabel: {
|
||||
interval: 0,
|
||||
rotate: 50,
|
||||
textStyle: {
|
||||
color: "#7F8B9C"
|
||||
}
|
||||
color: "#7F8B9C",
|
||||
},
|
||||
},
|
||||
data: Array.from(new Set(timer)),
|
||||
},
|
||||
data: Array.from(new Set(timer))
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
|
@ -151,208 +178,242 @@
|
|||
{
|
||||
type: "value",
|
||||
splitLine: {
|
||||
show: false
|
||||
}
|
||||
}
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
series: seriesData
|
||||
series: seriesData,
|
||||
};
|
||||
},
|
||||
getOrderLine(order_amount,order_coupon,refund_amount,timer){
|
||||
getOrderLine(order_amount, order_coupon, refund_amount, timer) {
|
||||
this.optionOrderData = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: 'cross',
|
||||
type: "cross",
|
||||
label: {
|
||||
backgroundColor: '#6a7985'
|
||||
}
|
||||
}
|
||||
backgroundColor: "#6a7985",
|
||||
},
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
data: ['实付订单金额(含运费/元)', '抵扣券使用数量', '退订单退款金额(元)'],
|
||||
data: [
|
||||
"实付订单金额(含运费/元)",
|
||||
"抵扣券使用数量",
|
||||
"退订单退款金额(元)",
|
||||
],
|
||||
orient: "vertical",
|
||||
x:'right',
|
||||
y:'center',
|
||||
align:'left'
|
||||
x: "right",
|
||||
y: "center",
|
||||
align: "left",
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '12%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
left: "3%",
|
||||
right: "12%",
|
||||
bottom: "3%",
|
||||
containLabel: true,
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
boundaryGap: false,
|
||||
axisLine: {
|
||||
show: false
|
||||
show: false,
|
||||
},
|
||||
axisTick: {
|
||||
alignWithLabel: true,
|
||||
lineStyle: {
|
||||
color: "#D7DDE4"
|
||||
}
|
||||
color: "#D7DDE4",
|
||||
},
|
||||
},
|
||||
splitLine: {
|
||||
show: false
|
||||
show: false,
|
||||
},
|
||||
axisLabel: {
|
||||
interval: 0,
|
||||
rotate: 50,
|
||||
textStyle: {
|
||||
color: "#7F8B9C"
|
||||
}
|
||||
color: "#7F8B9C",
|
||||
},
|
||||
},
|
||||
data: Array.from(new Set(timer)),
|
||||
},
|
||||
data: Array.from(new Set(timer))
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value'
|
||||
}
|
||||
type: "value",
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '实付订单金额(含运费/元)',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
name: "实付订单金额(含运费/元)",
|
||||
type: "line",
|
||||
stack: "Total",
|
||||
areaStyle: {},
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
focus: "series",
|
||||
},
|
||||
data: order_amount
|
||||
data: order_amount,
|
||||
},
|
||||
{
|
||||
name: '抵扣券使用数量',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
name: "抵扣券使用数量",
|
||||
type: "line",
|
||||
stack: "Total",
|
||||
areaStyle: {},
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
focus: "series",
|
||||
},
|
||||
data: order_coupon
|
||||
data: order_coupon,
|
||||
},
|
||||
{
|
||||
name: '退订单退款金额(元)',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
name: "退订单退款金额(元)",
|
||||
type: "line",
|
||||
stack: "Total",
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top'
|
||||
position: "top",
|
||||
},
|
||||
areaStyle: {},
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
focus: "series",
|
||||
},
|
||||
data: refund_amount
|
||||
}
|
||||
]
|
||||
data: refund_amount,
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
getBar(order_count,pay_count,timer){
|
||||
getBar(order_count, pay_count, timer) {
|
||||
this.optionOrderNumber = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: 'cross',
|
||||
type: "cross",
|
||||
label: {
|
||||
backgroundColor: '#6a7985'
|
||||
}
|
||||
}
|
||||
backgroundColor: "#6a7985",
|
||||
},
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
left: "3%",
|
||||
right: "12%",
|
||||
bottom: "3%",
|
||||
containLabel: true,
|
||||
},
|
||||
legend: {
|
||||
data: ['支付人数(人)', '支付订单数(单)'],
|
||||
data: ["支付人数(人)", "支付订单数(单)"],
|
||||
orient: "vertical",
|
||||
x:'right',
|
||||
y:'center',
|
||||
align:'left'
|
||||
x: "right",
|
||||
y: "center",
|
||||
align: "left",
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
boundaryGap: false,
|
||||
// boundaryGap: false,
|
||||
axisLine: {
|
||||
show: false
|
||||
show: false,
|
||||
},
|
||||
axisTick: {
|
||||
alignWithLabel: true,
|
||||
lineStyle: {
|
||||
color: "#D7DDE4"
|
||||
}
|
||||
color: "#D7DDE4",
|
||||
},
|
||||
},
|
||||
splitLine: {
|
||||
show: false
|
||||
show: false,
|
||||
},
|
||||
axisLabel: {
|
||||
interval: 0,
|
||||
rotate: 50,
|
||||
textStyle: {
|
||||
color: "#7F8B9C"
|
||||
}
|
||||
color: "#7F8B9C",
|
||||
},
|
||||
},
|
||||
data: Array.from(new Set(timer)),
|
||||
},
|
||||
data: Array.from(new Set(timer))
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value'
|
||||
type: "value",
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '支付人数(人)',
|
||||
type: 'bar',
|
||||
barGap: 0,
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
name: "支付人数(人)",
|
||||
type: "bar",
|
||||
// barGap: 0,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#ff9900",
|
||||
lineStyle: {
|
||||
color: "#ff9900",
|
||||
},
|
||||
data: order_count
|
||||
},
|
||||
},
|
||||
emphasis: {
|
||||
focus: "series",
|
||||
},
|
||||
data: pay_count,
|
||||
},
|
||||
{
|
||||
name: '支付订单数(单)',
|
||||
type: 'bar',
|
||||
name: "支付订单数(单)",
|
||||
type: "bar",
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#20894d",
|
||||
lineStyle: {
|
||||
color: "#20894d",
|
||||
},
|
||||
},
|
||||
},
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
focus: "series",
|
||||
},
|
||||
data: pay_count
|
||||
}
|
||||
]
|
||||
}
|
||||
data: order_count,
|
||||
},
|
||||
getList(){
|
||||
this.newUserList= []
|
||||
this.userList= []
|
||||
this.timer= []
|
||||
this.order_coupon= []
|
||||
this.refund_amount= []
|
||||
this.order_count= []
|
||||
this.pay_count= []
|
||||
this.order_amount = []//订单金额
|
||||
this.tableData.map(item => {
|
||||
this.newUserList.push(item.reg_count);
|
||||
this.userList.push(item.user_count);
|
||||
this.timer.push(item.date);
|
||||
this.order_amount.push(item.order_amount) //订单金额
|
||||
this.order_coupon.push(item.order_coupon) //优惠券
|
||||
this.refund_amount.push(item.refund_amount) //退款
|
||||
this.order_count.push(item.order_count)
|
||||
this.pay_count.push(item.pay_count)
|
||||
],
|
||||
};
|
||||
},
|
||||
getList() {
|
||||
let newUserList = [];
|
||||
let userList = [];
|
||||
let timer = [];
|
||||
let order_coupon = [];
|
||||
let refund_amount = [];
|
||||
let order_count = [];
|
||||
let pay_count = [];
|
||||
let order_amount = []; //订单金额
|
||||
let activeCountList = [];
|
||||
let Daydata = [...this.tableData]
|
||||
// 对日期数组进行排序
|
||||
Daydata.sort((a, b) => {
|
||||
let dateA = new Date(a.date);
|
||||
let dateB = new Date(b.date);
|
||||
return dateA - dateB;
|
||||
});
|
||||
this.getLine(this.newUserList,this.userList,this.timer);
|
||||
this.getOrderLine(this.order_amount,this.order_coupon,this.refund_amount,this.timer);
|
||||
this.getBar(this.order_count,this.pay_count,this.timer)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Daydata.map((item) => {
|
||||
newUserList.push(item.reg_count);
|
||||
userList.push(item.user_count);
|
||||
timer.push(item.date);
|
||||
order_amount.push(item.order_amount); //订单金额
|
||||
order_coupon.push(item.order_coupon); //优惠券
|
||||
refund_amount.push(item.refund_amount); //退款
|
||||
order_count.push(item.order_count);
|
||||
pay_count.push(item.pay_count);
|
||||
activeCountList.push(item.active_count);
|
||||
});
|
||||
this.getLine(newUserList, userList, timer, activeCountList);
|
||||
this.getOrderLine(order_amount, order_coupon, refund_amount, timer);
|
||||
this.getBar(order_count, pay_count, timer);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.statistics {
|
||||
<style lang="scss" scoped>
|
||||
.statistics {
|
||||
min-width: 700px;
|
||||
margin-top: 0;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
}
|
||||
</style>
|
|
@ -32,6 +32,7 @@
|
|||
<el-table-column label="id" min-width="130" prop="id"></el-table-column>
|
||||
<el-table-column label="时间" min-width="130" prop="date"></el-table-column>
|
||||
<el-table-column label="新增用户(人)" min-width="130" prop="reg_count"></el-table-column>
|
||||
<el-table-column label="活跃人数(人)" min-width="130" prop="active_count"></el-table-column>
|
||||
<el-table-column label="累计用户(人)" min-width="130" prop="user_count"></el-table-column>
|
||||
<el-table-column label="支付人数(人)" min-width="130" prop="pay_count"></el-table-column>
|
||||
<el-table-column label="支付订单数(单)" min-width="130" prop="order_count"></el-table-column>
|
||||
|
|
Loading…
Reference in New Issue