Selaa lähdekoodia

对接营收分析停车场

空白格 3 vuotta sitten
vanhempi
sitoutus
f376e25ee0

+ 3 - 3
common/apiurl.js

@@ -10,14 +10,14 @@ export const apiurl = {
 		// 获取今日概况接口
 		getTodayDataUrl: '/admin/overview/today',
 		// 获取路段概况接口
-		getRoadDataUrl: '/admin/overview/roadspacecount',
-		// 获取停车场概况接口
-		getParkingLotDataUrl: '/admin/overview/roadspacecount'
+		getRoadDataUrl: '/admin/overview/roadspacecount'
 	},
 	// 运营分析模块接口
 	operationalAnalysis: {
 		// 获取营收分析接口
 		getRevenueDataUrl: '/admin/statis/amt',
+		// 获取营收分析(停车场)接口
+		getParkingRevenueDataUrl: '/admin/statis/parkamt',
 		// 获取路段/停车场营收排行接口
 		getParkingLotRevenueDataUrl: '/admin/overview/roadtop',
 		// 获取车流量分析接口

+ 4 - 4
common/http.api.js

@@ -19,10 +19,6 @@ const install = (Vue, vm) => {
 		// 获取路段概况
 		getRoadDataApi: (params = {}) => vm.$u.http.get(apiurl.todayOverview.getRoadDataUrl, {
 			params
-		}),
-		// 获取停车场概况
-		getParkingLotDataApi: (params = {}) => vm.$u.http.get(apiurl.todayOverview.getParkingLotDataUrl, {
-			params
 		})
 	};
 	// 运营分析
@@ -31,6 +27,10 @@ const install = (Vue, vm) => {
 		getRevenueDataApi: (params = {}) => vm.$u.http.get(apiurl.operationalAnalysis.getRevenueDataUrl, {
 			params
 		}),
+		// 获取营收分析(停车场)
+		getParkingRevenueDataApi: (params = {}) => vm.$u.http.get(apiurl.operationalAnalysis.getParkingRevenueDataUrl, {
+			params
+		}),
 		// 获取路段/停车场营收排行
 		getParkingLotRevenueDataApi: (params = {}) => vm.$u.http.get(apiurl.operationalAnalysis
 			.getParkingLotRevenueDataUrl, {

+ 0 - 1
common/http.interceptor.js

@@ -43,7 +43,6 @@ const install = (Vue, vm) => {
 					}
 				}
 			});
-			return;
 		} else {
 			uni.showToast({
 				title: res.msg,

+ 62 - 9
pages/dataOverview/operationalAnalysis/components/revenueAnalysis.vue

@@ -3,7 +3,8 @@
 	<view class="revenue">
 		<template v-if="type === '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>
 					<u-empty></u-empty>
 				</view>
@@ -11,7 +12,8 @@
 		</template>
 		<template v-else>
 			<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>
 					<u-empty></u-empty>
 				</view>
@@ -47,20 +49,56 @@
 				chartData: {
 					categories: [],
 					series: [{
-						name: '',
+						name: '路段',
+						data: []
+					}, {
+						name: '停车场',
 						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: {
 			/**
 			 * 获取数据
 			 */
-			getData({ reportType, queryDate }) {
+			getData({
+				reportType,
+				queryDate
+			}) {
 				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.data.itemList && res.data.itemList.length) {
 							this.chartData.categories = res.data.itemList.map(item => {
@@ -69,9 +107,23 @@
 							this.chartData.series[0].data = res.data.itemList.map(item => {
 								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
@@ -85,6 +137,7 @@
 	.revenue {
 		background-color: #fff;
 		border-radius: 5px;
+
 		.empty {
 			padding: 15px;
 		}

+ 2 - 19
pages/dataOverview/todayOverview/todayOverview.vue

@@ -77,7 +77,7 @@
 						<view class="title">停车场总数</view>
 						<view class="content">
 							<view class="content-left">
-								<text>{{ parkingLotData.total || 0 }}</text>个
+								<text>{{ parkingLotData.parkingTotal || 0 }}</text>个
 							</view>
 						</view>
 					</view>
@@ -85,7 +85,7 @@
 						<view class="title">泊位总数</view>
 						<view class="content">
 							<view class="content-left">
-								<text>{{ parkingLotData.total || 0 }}</text>个
+								<text>{{ parkingLotData.parkingSpaceTotal || 0 }}</text>个
 							</view>
 						</view>
 					</view>
@@ -108,7 +108,6 @@
 		onShow() {
 			this.getTodayData();
 			this.getRoadData();
-			// this.getParkingLotData();
 		},
 		methods: {
 			/**
@@ -142,22 +141,6 @@
 						})
 					}
 				})
-			},
-			/**
-			 * 获取停车场概况
-			 */
-			getParkingLotData() {
-				uni.$u.api.todayOverviewApi.getParkingLotDataApi().then(res => {
-					if (res.code === 200) {
-						this.parkingLotData = res.data
-					} else {
-						this.$refs.uToast.show({
-							loading: true,
-							message: res.msg || '获取停车场概况失败!',
-							type: 'error'
-						})
-					}
-				})
 			}
 		}
 	}