<template>
	<view class="waper">
		<u-navbar bgColor="transparent" leftIconSize="0">
			<view slot='center' class="navbar_title">平台端</view>
		</u-navbar>
		<view class="banner-box">
			<image class="banner" src="../../static/img/banner.png" mode=""></image>
		</view>
		<view class="con-box">
	
			<navigator url="/pages/code/code" hover-class="none" class="card">
				<image class="bgm" src="../../static/img/shmhx.png" mode=""></image>
				<view class="title">今日售票：</view>
				<view class="mintitle">{{data.TodayTicketsCount}}元</view>
				<image class="icon" src="../../static/img/shmhx-icon.png" mode=""></image>
			</navigator>
			<navigator url="/pages/code/code" hover-class="none" class="card">
				<image class="bgm" src="../../static/img/shmhx.png" mode=""></image>
				<view class="title">今日门票营收：</view>
				<view class="mintitle">{{data.TodayTicketsMoney}}元</view>
				<image class="icon" src="../../static/img/shmhx-icon.png" mode=""></image>
			</navigator>
			<navigator url="/pages/code/code" hover-class="none" class="card">
				<image class="bgm" src="../../static/img/shmhx.png" mode=""></image>
				<view class="title">本月售票：</view>
				<view class="mintitle">{{data.MonthTicketsCount}}元</view>
				<image class="icon" src="../../static/img/shmhx-icon.png" mode=""></image>
			</navigator>
			<navigator url="/pages/code/code" hover-class="none" class="card">
				<image class="bgm" src="../../static/img/shmhx.png" mode=""></image>
				<view class="title">本月门票营收：</view>
				<view class="mintitle">{{data.MonthTicketsMoney}}元</view>
				<image class="icon" src="../../static/img/shmhx-icon.png" mode=""></image>
			</navigator>
			<navigator url="/pages/order/order" hover-class="none" class="card">
				<view class="card" @click="scanCode">
					<image class="bgm" src="../../static/img/smhx.png" mode=""></image>
					<view class="title">入驻商家：</view>
					<view class="mintitle">{{data.ShopCount}}单</view>
					<image class="icon" src="../../static/img/smhx-icon.png" mode=""></image>
				</view>
			</navigator>
			<navigator url="/pages/order/order" hover-class="none" class="card">
				<view class="card" @click="scanCode">
					<image class="bgm" src="../../static/img/smhx.png" mode=""></image>
					<view class="title">营业商家：</view>
					<view class="mintitle">{{data.BusinessShopCount}}单</view>
					<image class="icon" src="../../static/img/smhx-icon.png" mode=""></image>
				</view>
			</navigator>
			<navigator url="/pages/code/code" hover-class="none" class="card">
				<image class="bgm" src="../../static/img/shmhx.png" mode=""></image>
				<view class="title">本月商家流水：</view>
				<view class="mintitle">{{data.TodayShopMoney}}元</view>
				<image class="icon" src="../../static/img/shmhx-icon.png" mode=""></image>
			</navigator>
			<navigator url="/pages/code/code" hover-class="none" class="card">
				<image class="bgm" src="../../static/img/shmhx.png" mode=""></image>
				<view class="title">今日商家流水：</view>
				<view class="mintitle">{{data.MonthShopMoney}}元</view>
				<image class="icon" src="../../static/img/shmhx-icon.png" mode=""></image>
			</navigator>
			<view class="card" @click="scanCode">
				<image class="bgm" src="../../static/img/smhx.png" mode=""></image>
				<view class="title">本月客流量：</view>
				<view class="mintitle">{{data.MonthPersonNum}}单</view>
				<image class="icon" src="../../static/img/smhx-icon.png" mode=""></image>
			</view>
			<navigator url="/pages/order/order" hover-class="none" class="card">
				<view class="card" @click="scanCode">
					<image class="bgm" src="../../static/img/smhx.png" mode=""></image>
					<view class="title">今日客流量：</view>
					<view class="mintitle">{{data.TodayPersonNum}}单</view>
					<image class="icon" src="../../static/img/smhx-icon.png" mode=""></image>
				</view>
			</navigator>
			<navigator hover-class="none" class="card">
				<image class="bgm" src="../../static/img/shmhx.png" mode=""></image>
				<view class="title">本月流水：</view>
				<view class="mintitle">{{data.monthOrderMoney}}元</view>
				<image class="icon" src="../../static/img/shmhx-icon.png" mode=""></image>
			</navigator>
			
			<navigator url="/pages/statistics/index" hover-class="none" class="card">
				<image class="bgm" src="../../static/img/yytj.png" mode=""></image>
				<view class="title">接待游客</view>
				<view class="mintitle">{{data.monthPerson}}人</view>
				<image class="icon" src="../../static/img/yytj-icon.png" mode=""></image>
			</navigator>
			<navigator  hover-class="none" class="card">
				<image class="bgm" src="../../static/img/hxjl.png" mode=""></image>
				<view class="title">景区用水</view>
				<view class="mintitle">{{data.monthWater}}吨</view>
				<image class="icon" src="../../static/img/hxjl-icon.png" mode=""></image>
			</navigator>
			<navigator hover-class="none" class="card">
				<image class="bgm" src="../../static/img/hxjl.png" mode=""></image>
				<view class="title">景区用电</view>
				<view class="mintitle">{{data.monthElectricity}}度</view>
				<image class="icon" src="../../static/img/hxjl-icon.png" mode=""></image>
			</navigator>
			
		
		</view>
		<tabbar name="home"></tabbar>
	</view>
</template>

<script>
	import tabbar from '@/components/tabbar.vue'
	import getHomeMsg from '@/common/http/index.js'
import { data } from '../../uni_modules/uview-ui/libs/mixin/mixin'
	export default {
		components: {
			tabbar
		},
		data() {
			return {
				show: false,
				data:{
					TodayPersonNum: 0,
					TodayTicketsCount: 0,
					TodayTicketsMoney:0,
					MonthPersonNum:0,
					MonthTicketsCount:0,
					MonthTicketsMoney:0,
					ShopCount:0,
					BusinessShopCount:0,
					TodayShopMoney:0,
					MonthShopMoney:0,
					MonthWater:0,
					MonthElectricity:0,	
				}
			}
		},
		onLoad() {
			this.$http.getHomeMsg().then(res=>{
				this.data=res
				console.log(this.data())
			})
			
		},
		methods: {
			async scanCode() {
				let info = await this.$http.getInfo();
				// #ifdef APP-PLUS
				uni.navigateTo({
					url: '/pages/scan/index'
				})
				// #endif
				// #ifdef MP-WEIXIN
				uni.scanCode({
					onlyFromCamera: true,
					success: async (res) => {
						uni.navigateTo({
							url: `/pages/info/info?code=${res.result}`
						})
					}
				});
				// #endif
			}
		}
	}
</script>

<style lang="scss">
	page {
		height: 100%;
	}

	.waper {
		width: 100%;
		height: 100%;
		background: #FFF;

		.navbar_title {
			font-weight: 500;
			font-size: 36rpx;
			color: #FFFFFF;
		}

		.banner-box {
			position: relative;

			.banner {
				width: 750rpx;
				height: 564rpx;
			}
		}

		.con-box {
			position: relative;
			top: -176rpx;
			border-radius: 50rpx 50rpx 0 0;
			padding: 48rpx 32rpx;
			background: #FFF;
			display: flex;
			align-items: center;
			flex-wrap: wrap;

			.card {
				width: 333rpx;
				height: 210rpx;
				position: relative;
				margin: 0 20rpx 20rpx 0;

				&:nth-child(2n) {
					margin-right: 0;
				}

				.bgm {
					width: 333rpx;
					height: 210rpx;
				}

				.title {
					position: absolute;
					top: 40rpx;
					left: 32rpx;
					font-weight: 600;
					font-size: 36rpx;
					color: #FFFFFF;
				}

				.mintitle {
					position: absolute;
					top: 90rpx;
					left: 32rpx;
					font-weight: 600;
					font-size: 36rpx;
					color: #FFFFFF;
				}

				.icon {
					position: absolute;
					bottom: 22rpx;
					right: 30rpx;
					width: 88rpx;
					height: 88rpx;
				}
			}
		}
	}
</style>