<!-- 停车场实收统计 -->
<template>
	<view class="container">
		<view class="table">
			<view class="table-date" v-if="currentDate">{{ currentDate.join(' 至 ') }}</view>
			<view class="table-box">
				<TableRanking :loading="loading" :padding="'0'" :tableTh="tableTh" :tableData="tableData"
					@pageChange="pageChange" />
			</view>
		</view>
		<view class="total">
			<view>
				停车数量<text>{{ totalData.num || 0 }}</text>辆，实收金额<text>{{ totalData.really || 0 }}</text>元
			</view>
		</view>
	</view>
</template>

<script>
	import TableRanking from '@/components/tableRanking.vue'
	export default {
		components: {
			TableRanking
		},
		props: {
			tableTh: {
				type: Array,
				default: () => {
					return [{
							field: '停车场名称',
							width: 120
						},
						{
							field: '停车数量(次)',
							width: 120
						},
						{
							field: '实收金额(元)',
							width: 80
						}
					]
				}
			}
		},
		data() {
			return {
				loading: false,
				tableData: {
					current: 1,
					total: 0,
					list: []
				},
				totalData: {},
				currentDate: [],
				beginTime: undefined,
				endTime: undefined
			}
		},
		methods: {
			getData(data) {
				if (data.length) {
					this.beginTime = data[0]
					this.endTime = data[1]
				}
				this.currentDate = data
				this.tableData.current = 1
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import './report.scss';
</style>
