|
|
@@ -12,16 +12,18 @@
|
|
|
<el-date-picker
|
|
|
v-model="tenantPlatformBills.time"
|
|
|
type="month"
|
|
|
+ @change="getTenantPlatformBills"
|
|
|
+ value-format="yyyy-MM"
|
|
|
placeholder="选择月">
|
|
|
</el-date-picker>
|
|
|
- <div ref="tenantPlatformBills" style="height: 300px;width: 100%"></div>
|
|
|
+ <div ref="tenantPlatformBills" style="height: 600px;width: 100%"></div>
|
|
|
</div>
|
|
|
</basic-container>
|
|
|
</template>
|
|
|
<script>
|
|
|
import * as echarts from 'echarts';
|
|
|
import moment from "moment";
|
|
|
-import {getTenantCensusCount, getTenantPlatformBills} from '@/api/census/census';
|
|
|
+import {getTenantCensusCount, getTenantPlatformBills, getTenantTodayCensusCount} from '@/api/census/census';
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
@@ -34,7 +36,6 @@ export default {
|
|
|
alert(JSON.stringify(item));
|
|
|
},
|
|
|
count: 0,
|
|
|
- decimals: 2,
|
|
|
title: '新增商场',
|
|
|
href: 'https://avuejs.com',
|
|
|
target: '_blank'
|
|
|
@@ -71,7 +72,8 @@ export default {
|
|
|
alert(JSON.stringify(item));
|
|
|
},
|
|
|
count: 0,
|
|
|
- title: '今日收入',
|
|
|
+ decimals: 2,
|
|
|
+ title: '今日充值',
|
|
|
href: 'https://avuejs.com',
|
|
|
target: '_blank'
|
|
|
},
|
|
|
@@ -80,10 +82,21 @@ export default {
|
|
|
alert(JSON.stringify(item));
|
|
|
},
|
|
|
count: 0,
|
|
|
- title: '今日提现',
|
|
|
+ decimals: 2,
|
|
|
+ title: '今日收入',
|
|
|
href: 'https://avuejs.com',
|
|
|
target: '_blank'
|
|
|
- }
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // click: function (item) {
|
|
|
+ // alert(JSON.stringify(item));
|
|
|
+ // },
|
|
|
+ // count: 0,
|
|
|
+ // decimals: 2,
|
|
|
+ // title: '今日提现',
|
|
|
+ // href: 'https://avuejs.com',
|
|
|
+ // target: '_blank'
|
|
|
+ // }
|
|
|
]
|
|
|
},
|
|
|
optionTotal: {
|
|
|
@@ -129,20 +142,32 @@ export default {
|
|
|
click: function (item) {
|
|
|
alert(JSON.stringify(item));
|
|
|
},
|
|
|
- title: '收入总额',
|
|
|
+ title: '充值总额',
|
|
|
count: 0,
|
|
|
- icon: 'el-icon-s-marketing',
|
|
|
- color: '#f37b1d',
|
|
|
+ decimals: 2,
|
|
|
+ icon: 'el-icon-s-finance',
|
|
|
+ color: '#1cbbb4',
|
|
|
},
|
|
|
{
|
|
|
click: function (item) {
|
|
|
alert(JSON.stringify(item));
|
|
|
},
|
|
|
- title: '提现总额',
|
|
|
+ title: '收入总额',
|
|
|
count: 0,
|
|
|
- icon: 'el-icon-s-finance',
|
|
|
- color: '#1cbbb4',
|
|
|
- }
|
|
|
+ decimals: 2,
|
|
|
+ icon: 'el-icon-s-marketing',
|
|
|
+ color: '#f37b1d',
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // click: function (item) {
|
|
|
+ // alert(JSON.stringify(item));
|
|
|
+ // },
|
|
|
+ // title: '提现总额',
|
|
|
+ // count: 0,
|
|
|
+ // decimals: 2,
|
|
|
+ // icon: 'el-icon-s-finance',
|
|
|
+ // color: '#1cbbb4',
|
|
|
+ // }
|
|
|
]
|
|
|
},
|
|
|
tenantPlatformBills: {
|
|
|
@@ -155,8 +180,6 @@ export default {
|
|
|
show: false,
|
|
|
type: 'continuous',
|
|
|
seriesIndex: 0,
|
|
|
- min: 0,
|
|
|
- max: 400
|
|
|
},
|
|
|
{
|
|
|
show: false,
|
|
|
@@ -182,13 +205,14 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
yAxis: [
|
|
|
- { // 纵轴标尺固定
|
|
|
+ {
|
|
|
+ // 纵轴标尺固定
|
|
|
type: 'value',
|
|
|
scale: true,
|
|
|
max: 100,
|
|
|
min: 0,
|
|
|
splitNumber: 5,
|
|
|
- boundaryGap: [10, 10]
|
|
|
+ boundaryGap: [5, 5]
|
|
|
}
|
|
|
],
|
|
|
grid: [
|
|
|
@@ -217,34 +241,50 @@ export default {
|
|
|
//初始化方法
|
|
|
init() {
|
|
|
this.getTenantCensusCount();
|
|
|
+ this.getTenantTodayCensusCount();
|
|
|
this.getTenantPlatformBills();
|
|
|
},
|
|
|
- //获取租户数量
|
|
|
+ //获取租户数据统计
|
|
|
getTenantCensusCount() {
|
|
|
//获取租户数量
|
|
|
getTenantCensusCount().then(res => {
|
|
|
- this.optionTotal.option.data[0].count = res.data.data.userCount;
|
|
|
- this.optionTotal.option.data[1].count = res.data.data.memberCount;
|
|
|
- this.optionTotal.option.data[2].count = res.data.data.shopCount;
|
|
|
- this.optionTotal.option.data[3].count = res.data.data.mallCount;
|
|
|
+ this.optionTotal.data[0].count = res.data.data.mallCount;
|
|
|
+ this.optionTotal.data[1].count = res.data.data.shopCount;
|
|
|
+ this.optionTotal.data[2].count = res.data.data.userCount;
|
|
|
+ this.optionTotal.data[3].count = res.data.data.agentCount;
|
|
|
+ this.optionTotal.data[4].count = res.data.data.rechargeTotal;
|
|
|
});
|
|
|
},
|
|
|
- //获取租户数量
|
|
|
+ //获取租户当日数据统计
|
|
|
+ getTenantTodayCensusCount() {
|
|
|
+ //获取租户数量
|
|
|
+ getTenantTodayCensusCount().then(res => {
|
|
|
+ this.optionToday.data[0].count = res.data.data.mallCount;
|
|
|
+ this.optionToday.data[1].count = res.data.data.shopCount;
|
|
|
+ this.optionToday.data[2].count = res.data.data.userCount;
|
|
|
+ this.optionToday.data[3].count = res.data.data.agentCount;
|
|
|
+ this.optionToday.data[4].count = res.data.data.rechargeTotal;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //获取租户平台收益趋势
|
|
|
getTenantPlatformBills() {
|
|
|
let time = moment(this.tenantPlatformBills.time);
|
|
|
//获取租户数量
|
|
|
getTenantPlatformBills({
|
|
|
time: time.format("yyyy-MM-DD HH:mm:ss")
|
|
|
}).then(res => {
|
|
|
+ //清空内容
|
|
|
+ this.tenantPlatformBills.option.xAxis[0].data = [];
|
|
|
+ this.tenantPlatformBills.option.series[0].data = [];
|
|
|
+
|
|
|
//获取某月总天数
|
|
|
const day = time.format("yyyy-MM") === moment(new Date()).format("yyyy-MM") ? Number(moment(new Date()).format("DD"))
|
|
|
: new Date(time.format("yyyy"), time.format("MM"), 0).getDate();
|
|
|
for (let i = 0; i < day; i++) {
|
|
|
//添加日期X坐标
|
|
|
const date = time.format("yyyy-MM-DD");
|
|
|
-
|
|
|
this.tenantPlatformBills.option.xAxis[0].data.push(date);
|
|
|
-
|
|
|
+ //添加金额Y坐标
|
|
|
let fee = 0;
|
|
|
res.data.data.forEach(ele => {
|
|
|
if (ele.time === date) {
|
|
|
@@ -258,12 +298,19 @@ export default {
|
|
|
//加上一天
|
|
|
time.add(1, 'days');
|
|
|
}
|
|
|
- this.tenantPlatformBills.dom = echarts.init(this.$refs.tenantPlatformBills);
|
|
|
- this.tenantPlatformBills.dom.setOption(this.tenantPlatformBills.option);
|
|
|
+ //第一次渲染
|
|
|
+ if (this.tenantPlatformBills.dom === null) {
|
|
|
+ this.tenantPlatformBills.dom = echarts.init(this.$refs.tenantPlatformBills);
|
|
|
+ this.tenantPlatformBills.dom.setOption(this.tenantPlatformBills.option);
|
|
|
|
|
|
- window.onresize = () => {
|
|
|
- this.tenantPlatformBills.dom.resize()
|
|
|
- };
|
|
|
+ window.onresize = () => {
|
|
|
+ this.tenantPlatformBills.dom.resize()
|
|
|
+ };
|
|
|
+ } else { //第二次渲染
|
|
|
+ this.tenantPlatformBills.dom.clear();
|
|
|
+ this.tenantPlatformBills.dom = echarts.init(this.$refs.tenantPlatformBills);
|
|
|
+ this.tenantPlatformBills.dom.setOption(this.tenantPlatformBills.option);
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
}
|