<template>
	<view class="fullHeight personContent">
		<!-- <image src="/static/personManage/titleBG.png" class="titleBg"></image> -->
		<headers :showBack="true" :themeType="'white'">
			<view class="headerName">
				车辆管理
			</view>
		</headers>

		<view class="topBox" :style="{ 'margin-top': (200-statusBarHeight-44 - 110) + 'px' }">
			<!-- <image src="/static/personManage/left.png" class="topBoxBG" v-show="tabIndex==0"></image>
			<image src="/static/personManage/right.png" class="topBoxBG" v-show="tabIndex==1"></image> -->
			<view class="item item1" :class="tabIndex==0?'itemInner_active':'itemInner_active1'">
				<view class="itemInner" @click="tabIndex=0">
					<view class="">
						<view class="txt" :class="tabIndex==0?'active':''">
							今日总进场次数：
						</view>
						<view class="num">
							{{statictisData.innum}}
						</view>
					</view>

				</view>
				<view class="itemInner" @click="tabIndex=1">
					<view class="">
						<view class="txt" :class="tabIndex==1?'active':''">
							今日总出场次数：
						</view>
						<view class="num">
							{{statictisData.outnum}}
						</view>
					</view>
				</view>
			</view>
			<view class="safe_content">
				<view>
					<view></view>
					<view class="el-statistic">
						<view class="head">
							外来车辆
						</view>
						<view class="con">
							{{tabIndex==0?statictisData.wlcInNum:statictisData.wlcOutNum}}
						</view>

					</view>
				</view>
				<view>
					<view></view>
					<view class="el-statistic">
						<view class="head">
							固定车辆
						</view>
						<view class="con">
							{{tabIndex==0?statictisData.gdcInNum:statictisData.gdcOutNum}}
						</view>

					</view>
				</view>
				<view>
					<view></view>
					<view class="el-statistic">
						<view class="head">
							长期车
						</view>
						<view class="con">
							{{tabIndex==0?statictisData.cqcInNum:statictisData.cqcOutNum}}
						</view>
					</view>
				</view>
				<view>
					<view></view>
					<view class="el-statistic">
						<view class="head">
							临时车
						</view>
						<view class="con">
							{{tabIndex==0?statictisData.lscInNum:statictisData.lscOutNum}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="container">
			<view class="middleBox" v-if="COMPANY != 'longguang' && COMPANY != 'nanchang'">
				<view class="box" @click="toCarList(1)">
					<view class="box_1">
						<!-- <image src="/static/bthgIcon/zggrfx.png" class="img" style="width: 60rpx;height: 60rpx;"> 
						</image>
						-->
						<view class="">
							<view class="num">
								固定车总数
							</view>
							<text class="num">共{{carstatictisData.gdcNum}}个</text>
						</view>
					</view>	
					<uni-icons2 class="arrowright" type="arrowright"></uni-icons2>
				</view>
				<view class="box"@click="toCarList(2)">
					<view class="box_1">
						<!-- <image src="/static/bthgIcon/cdw.png" class="img" style="width: 64rpx;height: 64rpx;"></image> -->
						<view class="">
							<view class="num">
								长期车总数
							</view>
							<text class="num">共{{carstatictisData.cqcNum}}个</text>
						</view>
					</view>
					<uni-icons2 class="arrowright" type="arrowright"></uni-icons2>
				</view>
				<view class="box"@click="toCarList(3)">
					<view class="box_1">
						<!-- <image src="/static/bthgIcon/cdw.png" class="img" style="width: 64rpx;height: 64rpx;"></image> -->
						<view class="">
							<view class="num">
								临时车总数
							</view>
							<text class="num">共{{carstatictisData.lscNum}}个</text>
						</view>
					</view>
					<uni-icons2 class="arrowright" type="arrowright"></uni-icons2>
				</view>
			</view>
			<view class="box operateBox">
				<view class="item" @click="viewRecord(0)">
					<view class="imgBox">
						<image src="/static/bthgIcon/cltxjl.png" mode=""></image>
					</view>
					<view class="txt">
						车辆通行记录
					</view>
				</view>
				<view class="item" @click="viewRecord(1)">
					<view class="imgBox">
						<image src="/static/bthgIcon/clhbmd.png" mode=""></image>
					</view>
					<view class="txt">
						车辆黑白名单
					</view>
				</view>
			</view>
			<!-- <view class="tabBarBox">
				<view class="item active">
					<image src="/static/personManage/index.png" class="img"></image>
					<view class="txt">
						首页
					</view>
				</view>
				<view class="item" @click="queryStaff">
					<image src="/static/personManage/search.png" class="img"></image>
					<view class="txt">
						查人员
					</view>
				</view>
				<view class="item">
				<image src="/static/personManage/location.png" class="img"></image>
				<view class="txt">
					定位
				</view>
			</view>
			</view> -->
		</view>
		<levitatedsphere :x="100" :y="80"></levitatedsphere>
	</view>
</template>

<script>
	import levitatedsphere from "@/components/levitatedsphere/levitatedsphere.vue"
	import headers from "../../../components/headers/headers.vue"
	export default {
		data() {
			return {
				projectDetail: null,
				statictisData: {},
				statusBarHeight: 0,
				tabIndex: 0,
				mobileAttendance:1,//是否能移动考勤，0是，1否
				carstatictisData: {}
			};
		},
		onLoad() {
			this.statusBarHeight = uni.getStorageSync('systemInfo').statusBarHeight
			this.projectDetail = JSON.parse(uni.getStorageSync('projectDetail'))
			this.mobileAttendance=JSON.parse(uni.getStorageSync('userInfo')).mobileAttendance
			this.loadData()
			this.loadCarData()
		},
		methods: {
			loadCarData(){
				var that = this
				this.sendRequest({
					url: 'xmgl/carInfo/countCarModuleType',
					data: {
						projectSn: this.projectDetail.projectSn
					},
					method: "POST",
					success(res) {
						that.carstatictisData = res.result
						console.log('获取的数据',that.carstatictisData);
					}
				})
			},
			loadData() {
				var that = this
				this.sendRequest({
					url: 'xmgl/carPassRecord/getTodayOutInNumber',
					data: {
						projectSn: this.projectDetail.projectSn
					},
					method: "GET",
					success(res) {
						that.statictisData = res.result
						console.log('获取的数据',that.statictisData);
					}
				})
			},
			viewWorkerAnalysis() {
				uni.navigateTo({
					url: './workerAnalysis'
				})
			},
			viewSafeMange() {
				uni.navigateTo({
					url: './safetyEducationManage/index'
				})
			},
			viewTeamList() {
				uni.navigateTo({
					url: './searchTeam/teamList'
				})
			},
			goClockIn() {
				var userInfo = JSON.parse(uni.getStorageSync('userInfo'))
				if (userInfo.accountType == 6) {
					uni.navigateTo({
						url: './clockIn?faceScore='
					})
					// uni.navigateTo({
					// 	url:'./faceRecognition'
					// })
				} else {
					uni.showModal({
						title: '提示',
						content: '只有项目子账号才能使用该功能！'
					})
				}

			},
			toCarList(carType){
				uni.navigateTo({
					url: './index?listType=1' + '&carType=' + carType
				})
			},
			viewRecord(type) {
				uni.navigateTo({
					url: './index?listType=' + type
				})
			},
			safeMeeting(){
				uni.navigateTo({
					url:'../../videoManage/safeMeeting?sn='+this.projectDetail.projectSn
				})
			},
			viewVideo(){
				uni.navigateTo({
					url: '../../videoManage/videoList?sn='+this.projectDetail.projectSn+'&pageType=backEnd'
				})
			},
			//查询人员
			queryStaff(){
				uni.navigateTo({
					url: './queryStaff'
				})
			},
		}
	}
</script>
<style lang="scss" scoped>
	.personContent {
		color: $uni-text-color2;
		font-size: 30rpx;
		background-image: url(@/static/bthgIcon/main_bg1.png);
		background-repeat: no-repeat;
		background-size: 100%;
		background-color: #F3F5F7;
		height: 100%;

		:deep(.headerBox ){
			background-color: transparent;
			border-bottom: none;
		}
	}

	.container {
		height: calc(100vh - 264rpx - 88rpx - 144rpx);
		background-color: #F3F5F7;
	}


	.safe_content {
		display: flex;
		height: 140rpx;
		// background-color: #E9F2FF;
		background-color: #FFFFFF;
		// border-radius: 16rpx;
		padding: 0 24rpx;

		>view:nth-child(1) {
			width: 20%;

			>view:first-child {
				border: 6rpx solid #7caaf9;
			}
		}

		>view:nth-child(2) {
			width: 20%;

			>view:first-child {
				border: 6rpx solid #98e87a;
			}
		}

		>view:nth-child(3) {
			width: 30%;

			>view:first-child {
				border: 6rpx solid #f97c7c;
			}
		}

		>view:nth-child(4) {
			width: 30%;

			>view:first-child {
				border: 6rpx solid #98e87a;
			}
		}

		>view {

			display: flex;
			// align-items: center;

			>view:first-child {
				width: 30rpx;
				height: 30rpx;
				background-color: white;
				border-radius: 50%;
				margin-left: 10rpx;
				margin-top: 30rpx;
			}

			.el-statistic {
				flex: 1;
				text-align: left;
				margin-left: 16rpx;
				display: flex;
				flex-direction: column;
				justify-content: center;

				.head {
					color: #666666;
					font-size: 26rpx;
				}

				.con {
					color: #0056a8;
					font-weight: bold;
					justify-content: flex-start;
					font-size: 36rpx;
					margin-top: 10rpx;
				}
			}
		}
	}


	.titleBg {
		width: 100%;
		position: absolute;
		top: 0;
		left: 0;
		height: 200px;
	}

	.middleBox {
		// display: flex;
		// align-items: center;
		margin: 0 30rpx 30rpx;
		padding-top: 30rpx;

		.box {
			// flex: 1;
			// display: inline-flex;

			height: 100rpx;
			background: #FFFFFF;
			border-radius: 8rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-bottom: 36rpx;
			padding: 0 40rpx 0 10rpx;

			.box_1 {
				display: flex;
				align-items: center;

				.img {
					margin-right: 16rpx;
					// margin-left: 40rpx;
				}

				>view {
					display: flex;
				}

				.num {
					color: #2D8EF3;
					font-size: 30rpx;
					margin-left: 36rpx;
				}
			}

			.arrowright {
				color: #2D8EF3 !important;
				font-size: 40rpx !important;
			}

		}
	}

	.box {
		// box-shadow: 0 4px 24px 0px rgba(212, 220, 236, 0.69);
		// border-radius: 16rpx;
	}

	.operateBox {
		display: flex;
		align-items: center;
		font-size: 24rpx;
		// height: 120rpx;
		margin: 0 30rpx;
		flex-wrap: wrap;
		justify-content: space-between;

		// >.item:last-child {
		// 	margin-left: 34rpx;
		// }

		.item {
			width: 48%;
			height: 120rpx;
			display: flex;
			align-items: center;
			background-color: white;
			border-radius: 8rpx;
			padding: 0 16rpx;

			.imgBox {
				display: flex;
				align-items: center;
				justify-content: center;

				// margin-bottom: 20rpx;
				>image {
					width: 88rpx;
					height: 88rpx;
				}
			}

			.txt {
				font-size: 28rpx;
				text-align: center;
				margin-left: 40rpx;
			}
		}
		.item:not(:nth-child(-n + 2)) {
			margin-top: 32rpx;
		}
	}

	.tabBarBox {
		display: flex;
		align-items: center;
		font-size: 24rpx;
		border-top: 1px solid rgba(151, 151, 151, 0.2);
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 64rpx;

		.item {
			flex: 1;
			// display: inline-flex;
			text-align: center;
			color: rgba(148, 149, 173, 1);

			.img {
				width: 70rpx;
				height: 70rpx;
			}

			&.active {
				color: rgba(72, 141, 236, 1);
			}
		}
	}

	.topBox {
		position: relative;
		// height: 270px;
		z-index: 4;
		margin-top: 164rpx !important;
		// background-color: #FFFFFF;
		// border-radius: 40rpx 40rpx 0 0;

		.topBoxBG {
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			z-index: -1;
		}

		.item {
			// margin: 0 20rpx;
			display: flex;

			.itemInner {
				display: inline-flex;
				flex: 1;
				align-items: center;
				justify-content: center;

				&:first-child {
					border-right: 1px solid rgba(55, 45, 102, 0.1);
				}
			}

			.txt {
				// color: rgba(55, 45, 102, 0.6);
				color: #FFFFFF;
				font-size: 30rpx;
				text-align: center;
			}

			.active {
				color: rgba(55, 45, 102, 1);
				font-weight: bold;
			}

			.num {
				font-size: 40rpx;
				font-weight: bold;
				text-align: center;
				color: #4A8EEC;
			}
		}

		.item1 {
			height: 100rpx;
			border-radius: 40rpx 40rpx 0 0;
			// background-color: #97C6F9;
			// padding-top: 20rpx;
			background-repeat: no-repeat;
			background-size: 100% 100%;

			.itemInner {

				>view {
					display: flex;
					align-items: center;
				}

				&:first-child {
					border-right: none;
				}
			}
		}
		
		.itemInner_active {
			// background-color: white;
			// border-radius: 40rpx 120rpx 0 0;
			background-image: url("@/static/bthgIcon/itemInner_active.png");
			
		}
		
		.itemInner_active1 {
			background-image: url("@/static/bthgIcon/itemInner_active1.png");
			// background-color: white;
			// border-radius: 120rpx 40rpx 0 0;
		}

		.item2 {
			height: 20%;
			margin: 4% 20rpx;
			// padding-bottom: 2%;
			// .itemInner{
			// 	padding-bottom: 20rpx;

			// }

		}

		.item3 {

			padding-top: 4%;
			height: 20%;
			position: relative;

			&::after {
				content: "";
				position: absolute;
				left: 5%;
				width: 90%;
				top: 0px;
				border-top: 1px solid rgba(55, 45, 102, 0.1);
			}

		}
	}
</style>