<template>
	<view class="content">
		<view class="select-top">
			<view class="">
				本月统计
			</view>
			<view class="top-right">
				<view class="">
					{{showdate}}月
				</view>
				<!-- <image src="../../static/img/downxia.png" mode=""></image> -->
			</view>
		</view>
		<view class="dk-info">
			<view class="dk-day big">
				<view class="dk-left">
					20
				</view>
				<view class="dk-center">
					/
				</view>
				<view class="dk-right err">
					20
				</view>
			</view>
			<view class="dk-tit">
				<view class="dk-left">
					正常天数
				</view>
				<view class="dk-center">
					/
				</view>
				<view class="dk-right">
					异常天数
				</view>
			</view>
			<view class="dk-detail">
				<view class="detail-item green">
					<view class="">
						20
					</view>
					<view class="item-tit">
						已打卡(次)
					</view>
				</view>
				<view class="detail-item">
					<view class="">
						20
					</view>
					<view class="item-tit">
						未打卡(次)
					</view>
				</view>
				<view class="detail-item">
					<view class="err">
						20
					</view>
					<view class="item-tit">
						迟到(次)
					</view>
				</view>
			</view>
		</view>
		<scroll-view scroll-y="true" class="yg-list" :style="{'height': height}">
			<template  v-for="item in list">
				<view class="yg-wrap">
					<view class="yg-name">
						{{item.name}}
					</view>
					<view class="dk-status" :class="{'err': item.qknum > 0 }" @click="openDetail(item)">
						{{item.qknum > 0 ? `缺卡${item.qknum}次`: '正常'}}<image :src="item.open? '../../static/img/downup.png': '../../static/img/downxia.png' " mode="" ></image>
					</view>
				</view>
				<view class="info-info" v-if="item.open">
					<view class="base-left">
						<view class="">
							08:30
						</view>
						<view class="jg">
							
						</view>
						<view class="">
							17:30
						</view>
					</view>
					<view class="base-right">
						<view class="right-item up">
							<view class="item-tit">
								上班
							</view>
							<view class="">
								考勤机下班打卡(17:02)
							</view>
						</view>
						<view class="right-item">
							<view class="item-tit">
								下班
							</view>
							<view class="">
								考勤机下班打卡(17:02)
							</view>
						</view>
					</view>
				</view>
			</template>
			
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showdate: new Date().getMonth() + 1,
				height: '',
				list: [
					{
						id: 1,
						name: '狗强',
						sstatus: 0,
						xstatus: 0,
						open: false,
						qknum: 0,
					},
					{
						id: 1,
						name: '狗虎',
						sstatus: 1,
						xstatus: 1,
						qknum: 2,
						open: false,
					}
				]
			}
		},
		onLoad() {

		},
		onShow() {

		},
		onReachBottom() {

		},
		onReady() {
			var obj = this;
			uni.getSystemInfo({
				success: resu => {
					const query = uni.createSelectorQuery();
					query.select('.yg-list').boundingClientRect();
					query.exec(function(res) {
						obj.height = resu.windowHeight - res[0].top + 'px';
					});
				},
				fail: res => {}
			});
		},
		methods: {
			openDetail(item) {
				item.open = !item.open
			}
		}
	}
</script>

<style lang="scss">
	.err {
		color: #E05742;
	}
	.select-top {
		width: 100%;
		height: 100rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border: 1px solid #F5F5F5;
		font-size: 32rpx;
		font-weight: bold;
		color: #000000;
		padding: 0 30rpx;
		background-color: #fff;

		.top-right {
			font-size: 28rpx;
			font-weight: bold;
			color: #000000;
			display: flex;
			align-items: center;
			justify-content: flex-end;

			image {
				width: 19rpx;
				height: 11rpx;
			}
		}
	}

	.dk-info {
		height: 326rpx;
		width: 100%;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		background-color: #fff;
		margin-bottom: 20rpx;
		.big {
			font-size: 46rpx !important;
			font-weight: 800;
			color: #000000;
			margin-bottom: 10rpx;
		}

		

		.dk-day,
		.dk-tit {
			display: flex;
			flex-direction: row;
			justify-content: center;
			width: 100%;
			font-size: 26rpx;

			.dk-left {
				width: 48%;
				text-align: right;
			}

			.dk-center {
				width: 4%;
				flex-shrink: 0;
				text-align: center;
				color: #D7D7D7;

			}

			.dk-right {
				width: 48%;
			}
		}

		.dk-detail {
			display: flex;
			justify-content: center;
			width: 100%;
			margin-top: 50rpx;

			.detail-item {
				width: 30%;
				text-align: center;
				font-size: 28rpx;
				font-weight: bold;
				color: #000000;

				.item-tit {
					margin-top: 15rpx;
					font-size: 24rpx;
					font-weight: 500;
					color: #666666;
				}
			}

		}
	}
	.yg-list {
		background-color: #fff;
		width: 100%;
		.yg-wrap {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 0 40rpx 0 30rpx;
			height: 100rpx;
			border-bottom: 1px solid #F2F2F2;
			font-size: 28rpx;
			font-weight: bold;
			color: #000000;
			.yg-name {
				
			}
			.dk-status {
				display: flex;
				align-items: center;
				image {
					width: 19rpx;
					height: 11rpx;
					margin-left: 10rpx;
				}
			}
		}
	}
	.info-info {
		width:100%;
		height: 267rpx;
		background-color: #f8f8f8;
		display: flex;
		.base-left {
			flex-shrink: 0;
			width: 180rpx;
			height: 100%;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			font-size: 30rpx;
			font-weight: 800;
			color: #000000;
			.jg {
				width: 5rpx;
				height: 75rpx;
				background: #ECECEC;
				margin: 20rpx 0;
			}
		}
		.base-right {
			flex-grow: 1;
			width: 100%;
			.up {
				border-bottom: 1px solid #E4E4E4;
			}
			.right-item {
				height: 50%;
				padding-top: 30rpx;
				font-size: 26rpx;
				font-weight: 500;
				.item-tit {
					font-size: 30rpx;
					font-weight: 800;
				}
			}
		}
	}
</style>
