|
@@ -3,7 +3,8 @@
|
|
<view class="revenue">
|
|
<view class="revenue">
|
|
<template v-if="type === 'line'">
|
|
<template v-if="type === 'line'">
|
|
<view class="revenue-line">
|
|
<view class="revenue-line">
|
|
- <LineChart v-if="chartData.series[0].data.length" :chartData="chartData" :title="title"/>
|
|
|
|
|
|
+ <LineChart v-if="chartData.series[0].data.length || chartData.series[1].data.length"
|
|
|
|
+ :chartData="chartData" :title="title" :opts="opts" />
|
|
<view class="empty" v-else>
|
|
<view class="empty" v-else>
|
|
<u-empty></u-empty>
|
|
<u-empty></u-empty>
|
|
</view>
|
|
</view>
|
|
@@ -11,7 +12,8 @@
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
<view class="revenue-line">
|
|
<view class="revenue-line">
|
|
- <ColumnChart v-if="chartData.series[0].data.length" :chartData="chartData" :title="title"/>
|
|
|
|
|
|
+ <ColumnChart v-if="chartData.series[0].data.length || chartData.series[1].data.length"
|
|
|
|
+ :chartData="chartData" :title="title" :opts="opts" />
|
|
<view class="empty" v-else>
|
|
<view class="empty" v-else>
|
|
<u-empty></u-empty>
|
|
<u-empty></u-empty>
|
|
</view>
|
|
</view>
|
|
@@ -47,20 +49,56 @@
|
|
chartData: {
|
|
chartData: {
|
|
categories: [],
|
|
categories: [],
|
|
series: [{
|
|
series: [{
|
|
- name: '',
|
|
|
|
|
|
+ name: '路段',
|
|
|
|
+ data: []
|
|
|
|
+ }, {
|
|
|
|
+ name: '停车场',
|
|
data: []
|
|
data: []
|
|
}]
|
|
}]
|
|
},
|
|
},
|
|
- loading: false
|
|
|
|
|
|
+ loading: false,
|
|
|
|
+ opts: {
|
|
|
|
+ xAxis: {
|
|
|
|
+ rotateLabel: false,
|
|
|
|
+ labelCount: 6
|
|
|
|
+ },
|
|
|
|
+ yAxis: {
|
|
|
|
+ showTitle: true,
|
|
|
|
+ splitNumber: 5,
|
|
|
|
+ data: [{
|
|
|
|
+ title: '收益(元)',
|
|
|
|
+ titleOffsetY: -5
|
|
|
|
+ }]
|
|
|
|
+ },
|
|
|
|
+ legend: {
|
|
|
|
+ show: true
|
|
|
|
+ },
|
|
|
|
+ dataLabel: false,
|
|
|
|
+ extra: {
|
|
|
|
+ column: {
|
|
|
|
+ width: 20
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
/**
|
|
/**
|
|
* 获取数据
|
|
* 获取数据
|
|
*/
|
|
*/
|
|
- getData({ reportType, queryDate }) {
|
|
|
|
|
|
+ getData({
|
|
|
|
+ reportType,
|
|
|
|
+ queryDate
|
|
|
|
+ }) {
|
|
this.loading = true
|
|
this.loading = true
|
|
- uni.$u.api.operationalAnalysisApi.getRevenueDataApi({ reportType, queryDate }).then(res => {
|
|
|
|
|
|
+ this.chartData.categories = []
|
|
|
|
+ this.chartData.series[0].data = []
|
|
|
|
+ this.chartData.series[1].data = []
|
|
|
|
+ // 路段数据
|
|
|
|
+ uni.$u.api.operationalAnalysisApi.getRevenueDataApi({
|
|
|
|
+ reportType,
|
|
|
|
+ queryDate
|
|
|
|
+ }).then(res => {
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
if (res.data.itemList && res.data.itemList.length) {
|
|
if (res.data.itemList && res.data.itemList.length) {
|
|
this.chartData.categories = res.data.itemList.map(item => {
|
|
this.chartData.categories = res.data.itemList.map(item => {
|
|
@@ -69,9 +107,23 @@
|
|
this.chartData.series[0].data = res.data.itemList.map(item => {
|
|
this.chartData.series[0].data = res.data.itemList.map(item => {
|
|
return item.amt
|
|
return item.amt
|
|
})
|
|
})
|
|
- } else {
|
|
|
|
- this.chartData.categories = []
|
|
|
|
- this.chartData.series[0].data = []
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.loading = false
|
|
|
|
+ })
|
|
|
|
+ // 停车场数据
|
|
|
|
+ uni.$u.api.operationalAnalysisApi.getParkingRevenueDataApi({
|
|
|
|
+ reportType,
|
|
|
|
+ queryDate
|
|
|
|
+ }).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ if (res.data.itemList && res.data.itemList.length) {
|
|
|
|
+ this.chartData.categories = res.data.itemList.map(item => {
|
|
|
|
+ return item.statisTime
|
|
|
|
+ })
|
|
|
|
+ this.chartData.series[1].data = res.data.itemList.map(item => {
|
|
|
|
+ return item.amt
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.loading = false
|
|
this.loading = false
|
|
@@ -85,6 +137,7 @@
|
|
.revenue {
|
|
.revenue {
|
|
background-color: #fff;
|
|
background-color: #fff;
|
|
border-radius: 5px;
|
|
border-radius: 5px;
|
|
|
|
+
|
|
.empty {
|
|
.empty {
|
|
padding: 15px;
|
|
padding: 15px;
|
|
}
|
|
}
|