master
parent
011d8cf7f6
commit
5de5036c0b
@ -1,312 +1,307 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="statistics">
|
||||
<el-card>
|
||||
<template v-slot:header>
|
||||
<i class="el-icon-data-line"></i>
|
||||
<span class="statistics-title">营业统计</span>
|
||||
</template>
|
||||
<div class="statistics-content">
|
||||
<div class="statistics-content-top">
|
||||
<div class="statistics-content-top__num">¥40.5万</div>
|
||||
<div class="statistics-content-top__name">服务金额</div>
|
||||
</div>
|
||||
<div class="statistics-content-bottom">
|
||||
<div class="statistics-content-bottom-left">
|
||||
<div class="statistics-content-bottom-left__num">¥26.9万</div>
|
||||
<div class="statistics-content-bottom-left__name">护工金额</div>
|
||||
</div>
|
||||
<div class="statistics-content-bottom-right">
|
||||
<div class="statistics-content-bottom-right__num">¥13.6万</div>
|
||||
<div class="statistics-content-bottom-right__name">留存金额</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<template v-slot:header>
|
||||
<i class="el-icon-user"></i>
|
||||
<span class="statistics-title">人效统计</span>
|
||||
</template>
|
||||
<div class="statistics-content">
|
||||
<div class="statistics-content-top">
|
||||
<div class="statistics-content-top__num">120人</div>
|
||||
<div class="statistics-content-top__name">照护人员</div>
|
||||
</div>
|
||||
<div class="statistics-content-bottom">
|
||||
<div class="statistics-content-bottom-left">
|
||||
<div class="statistics-content-bottom-left__num">8小时/天</div>
|
||||
<div class="statistics-content-bottom-left__name">预期照护时长</div>
|
||||
</div>
|
||||
<div class="statistics-content-bottom-right">
|
||||
<div class="statistics-content-bottom-right__num">6.3小时/天</div>
|
||||
<div class="statistics-content-bottom-right__name">人均照护时长</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<template v-slot:header>
|
||||
<i class="el-icon-s-custom"></i>
|
||||
<span class="statistics-title">客户统计</span>
|
||||
</template>
|
||||
<div class="statistics-content">
|
||||
<div class="statistics-content-top">
|
||||
<div class="statistics-content-top__num">800人</div>
|
||||
<div class="statistics-content-top__name">活跃客户</div>
|
||||
</div>
|
||||
<div class="statistics-content-bottom">
|
||||
<div class="statistics-content-bottom-left">
|
||||
<div class="statistics-content-bottom-left__num">100</div>
|
||||
<div class="statistics-content-bottom-left__name">新增</div>
|
||||
</div>
|
||||
<div class="statistics-content-bottom-right">
|
||||
<div class="statistics-content-bottom-right__num">20</div>
|
||||
<div class="statistics-content-bottom-right__name">流失</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<template v-slot:header>
|
||||
<i class="el-icon-document"></i>
|
||||
<span class="statistics-title">订单统计</span>
|
||||
</template>
|
||||
<div class="statistics-content">
|
||||
<div class="statistics-content-top">
|
||||
<div class="statistics-content-top__num">500</div>
|
||||
<div class="statistics-content-top __name">服务订单</div>
|
||||
</div>
|
||||
<div class="statistics-content-bottom">
|
||||
<div class="statistics-content-bottom-left">
|
||||
<div class="statistics-content-bottom-left__num">450</div>
|
||||
<div class="statistics-content-bottom-left__name">周期性订单</div>
|
||||
</div>
|
||||
<div class="statistics-content-bottom-right">
|
||||
<div class="statistics-content-bottom-right__num">50</div>
|
||||
<div class="statistics-content-bottom-right__name">单次订单</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<div class="chart">
|
||||
<div id="col-chart"></div>
|
||||
<div id="line-chart"></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import echarts from "echarts"
|
||||
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
col:'',
|
||||
line:''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.col = echarts.init(document.getElementById('col-chart'))
|
||||
this.col.setOption({
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
},
|
||||
position:'bottom'
|
||||
},
|
||||
legend: {},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
boundaryGap: [0, 0.01]
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['第一周', '第二周', '第三周', '第四周']
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '服务金额',
|
||||
type: 'bar',
|
||||
data: [18203, 23489, 29034, 104970],
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgb(42,182,252)'
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: '收款',
|
||||
type: 'bar',
|
||||
data: [19325, 23438, 31000, 121594],
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgb(34,228,255)'
|
||||
},
|
||||
},
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
this.line = echarts.init(document.getElementById('line-chart'))
|
||||
this.line.setOption({
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: ['活跃客户', '服务订单']
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '6%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
toolbox: {
|
||||
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['第一周', '第二周', '第三周', '第四周']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '活跃客户',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: [120, 132, 101, 134],
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgb(42,182,252)'
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: '服务订单',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: [220, 182, 191, 234],
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgb(34,228,255)'
|
||||
},
|
||||
},
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init()
|
||||
|
||||
window.onresize = () => {
|
||||
this.col.resize()
|
||||
this.line.resize()
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
window.onresize = null
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.statistics{
|
||||
display: flex;
|
||||
|
||||
margin-top: 20px;
|
||||
&-title{
|
||||
|
||||
padding-left: 6px;
|
||||
}
|
||||
&-content{
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
&-top{
|
||||
|
||||
&__num{
|
||||
font-weight: 600;
|
||||
}
|
||||
&__name{
|
||||
font-size: 10px;
|
||||
color: rgb(140,140,140);
|
||||
}
|
||||
}
|
||||
&-bottom{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
&-left{
|
||||
|
||||
&__num{
|
||||
font-weight: 600;
|
||||
}
|
||||
&__name{
|
||||
font-size: 10px;
|
||||
color: rgb(140,140,140);
|
||||
}
|
||||
}
|
||||
&-right{
|
||||
|
||||
&__num{
|
||||
font-weight: 600;
|
||||
}
|
||||
&__name{
|
||||
font-size: 10px;
|
||||
color: rgb(140,140,140);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&>div{
|
||||
flex: 1;
|
||||
margin-right: 20px;
|
||||
|
||||
&:last-child{
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
.chart{
|
||||
display: flex;
|
||||
|
||||
margin-top: 50px;
|
||||
#col-chart {
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
flex: 1;
|
||||
height: 300px;
|
||||
margin-right: 30px;
|
||||
}
|
||||
#line-chart {
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
flex: 1;
|
||||
height: 300px;
|
||||
}
|
||||
}
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div class="statistics">
|
||||
<panel-group :totaldata="list" />
|
||||
</div>
|
||||
|
||||
<div class="chart">
|
||||
<div class="chartItem" style="margin-right: 1%;">
|
||||
<div class="chartItemTitle">营业与收入</div>
|
||||
<div id="col-chart"></div>
|
||||
</div>
|
||||
<div class="chartItem" style="margin-left: 1%;">
|
||||
<div class="chartItemTitle">客户与订单</div>
|
||||
<div id="line-chart"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import echarts from "echarts"
|
||||
import PanelGroup from './components/PanelGroup'
|
||||
import {
|
||||
getChartsHome
|
||||
} from "../../api/dashboard.js"
|
||||
|
||||
export default {
|
||||
components: {
|
||||
PanelGroup
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
col: '',
|
||||
line: '',
|
||||
business_data: [],
|
||||
collect_data: [],
|
||||
list: {},
|
||||
customerArr: [],
|
||||
orderArr: [],
|
||||
chartData: {},
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
chartData(val, newval) {
|
||||
if (newval){
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async loadData() {
|
||||
await getChartsHome().then((res) => {
|
||||
console.log(res);
|
||||
this.list = res.list;
|
||||
this.chartData = res;
|
||||
let _business_data = [];
|
||||
let _collect_data = [];
|
||||
res.business_data.map(item => {
|
||||
_business_data.push(item.server_money_total)
|
||||
_collect_data.push(item.collect_money)
|
||||
})
|
||||
this.business_data = _business_data;
|
||||
this.collect_data = _collect_data;
|
||||
let _customerArr = [];
|
||||
let _orderArr = [];
|
||||
|
||||
res.order_data.map(item => {
|
||||
_customerArr.push(item.active_customer)
|
||||
_orderArr.push(item.order_total)
|
||||
})
|
||||
this.customerArr = _customerArr;
|
||||
this.orderArr = _orderArr;
|
||||
}).catch()
|
||||
},
|
||||
init() {
|
||||
this.col = echarts.init(document.getElementById('col-chart'))
|
||||
this.col.setOption({
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
},
|
||||
position: 'bottom'
|
||||
},
|
||||
legend: {},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
boundaryGap: [0, 0.01]
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['第一周', '第二周', '第三周', '第四周']
|
||||
},
|
||||
series: [{
|
||||
name: '服务金额',
|
||||
type: 'bar',
|
||||
data: this.business_data,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgb(42,182,252)'
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: '收款',
|
||||
type: 'bar',
|
||||
data: this.collect_data,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgb(34,228,255)'
|
||||
},
|
||||
},
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
this.line = echarts.init(document.getElementById('line-chart'))
|
||||
this.line.setOption({
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: ['活跃客户', '服务订单']
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '6%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
toolbox: {
|
||||
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['第一周', '第二周', '第三周', '第四周']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
},
|
||||
series: [{
|
||||
name: '活跃客户',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: this.customerArr,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgb(42,182,252)'
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: '服务订单',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: this.orderArr,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgb(34,228,255)'
|
||||
},
|
||||
},
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
this.loadData();
|
||||
},
|
||||
mounted() {
|
||||
|
||||
|
||||
//this.init()
|
||||
|
||||
window.onresize = () => {
|
||||
this.col.resize()
|
||||
this.line.resize()
|
||||
}
|
||||
|
||||
},
|
||||
destroyed() {
|
||||
window.onresize = null
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.statistics {
|
||||
display: flex;
|
||||
|
||||
margin-top: 20px;
|
||||
|
||||
&-title {
|
||||
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
&-content {
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
|
||||
&-top {
|
||||
|
||||
&__num {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
&__name {
|
||||
font-size: 10px;
|
||||
color: rgb(140, 140, 140);
|
||||
}
|
||||
}
|
||||
|
||||
&-bottom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
&-left {
|
||||
|
||||
&__num {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
&__name {
|
||||
font-size: 10px;
|
||||
color: rgb(140, 140, 140);
|
||||
}
|
||||
}
|
||||
|
||||
&-right {
|
||||
|
||||
&__num {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
&__name {
|
||||
font-size: 10px;
|
||||
color: rgb(140, 140, 140);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&>div {
|
||||
flex: 1;
|
||||
margin-right: 20px;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.chart {
|
||||
display: flex;
|
||||
|
||||
margin-top: 20px;
|
||||
|
||||
|
||||
.chartItem {
|
||||
|
||||
width: 49%;
|
||||
|
||||
.chartItemTitle {
|
||||
font-size: 16px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#col-chart {
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
flex: 1;
|
||||
margin-right: 20px;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
min-height: 400px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#line-chart {
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
flex: 1;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
min-height: 400px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
Reference in new issue