<template>
	<view class="content">
		<view class="title">
			<view class="item" :class="active_item == 0?'active':''" @click="click_btn(0)">待审核</view>
			<view class="item" :class="active_item == 1?'active':''" @click="click_btn(1)">已审核</view>
		</view>
		<view class="list" v-if="active_item == 0">
			<view class="item" v-for="(item,index) in list" :key="index" v-if="item.staff_state == 0">
				<view class="top">
					<view class="user">
						<view class="info">
							<view class="text">{{item.name}}</view>
							<view class="text">编号: #{{item.id}} {{item.created_at}}</view>
						</view>
					</view>
					<view class="state">{{item.status}}</view>
				</view>
				<view class="inner">
					<view class="class_name">{{item.classify}}</view>
					<view class="name">{{item.title}}</view>
					<view class="tip">{{item.introduce}}</view>
				</view>
				<view class="bottom">
					<view class="btn" @click="go_shenhe(item.id,item.title)">审核</view>
				</view>
			</view>
		</view>
		<view class="list" v-if="active_item == 1">
			<view class="item" v-for="(item,index) in list" :key="index"  v-if="item.staff_state == 1" :style="item.state == 3?'border-top: 2px solid red;':''">
				<view class="top">
					<view class="user">
						<view class="info">
							<view class="text">{{item.name}}</view>
							<view class="text">编号: #{{item.id}} {{item.created_at}}</view>
						</view>
					</view>
					
					<view class="state" v-if="item.state == 2" style="color: #00D983;">{{item.status}}</view>
					<view class="state" v-if="item.state == 3" style="color: red;">{{item.status}}</view>
				</view>
				<view class="inner">
					<view class="class_name">{{item.classify}}</view>
					<view class="name">{{item.title}}</view>
					<view class="tip">{{item.introduce}}</view>
				</view>
				<view class="bottom">
					<view class="btn" style="background-color: #009FE8;" @click="go_chakan(item.id,item.title)">查看</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				active_item:0,
				list:[],
				
				
				page:1,
				page_size:20,
				state:0
			};
		},
		onLoad() {
			// this.get_worksheet_check_listmei()
		},
		onShow() {
			// this.active_item = 0
			// this.state = 0
			
			console.log(this.state)
			this.page = 1
			this.list = []
			this.get_worksheet_check_listmei()
		},
		onReachBottom(){
			this.page++
			this.get_worksheet_check_listmei()
		},
		methods:{
			// 切换列表
			click_btn(item){
				this.active_item = item
				this.state = item
				this.page = 1
				this.list = []
				
				// 刷新数据
				this.get_worksheet_check_listmei()
			},
			go_shenhe(id,title){
				uni.navigateTo({
					url:"shenhe/shenhe?id=" + id + "&title=" + title
				})
			},
			go_chakan(id,title){
				uni.navigateTo({
					url:"chakan/chakan?id=" + id + "&title=" + title
				})
			},
			get_worksheet_check_listmei(){
				uni.showLoading({
					mask:true
				})
				
				this.$api.worksheet_check_listmei({
					page:this.page,
					size:this.page_size,
					state:this.state,
					
				}).then((res)=>{
					console.log(res)
					console.log(res.data.data)
					this.list = this.list.concat(res.data.data)
					
					uni.hideLoading()
				})
			},
		}
	}
</script>

<style lang="scss">
	.content{
		width: 749rpx;
	}
	
	.title{
		position: fixed;
		top: 1;
		left: 0rpx;
		z-index: 999;
		background-color: #FFFFFF;
		
		height: 43px;
		display: flex;
	
		border-bottom: 1px solid #E4E4E4;
		.item{
			width: 374rpx;
			line-height: 43px;
			text-align: center;
			font-size: 16px;
			color: #BDC3C7;
		}
		.active{
			border-bottom: 2px solid #16A085;
			color: #16A085;
		}
		
	}
	
	.list{
		box-sizing: border-box;
		padding: 24rpx;
		
		padding-top: 53px;
		.item{
			width: 700rpx;
			border-radius: 6px;
			border: 1px solid #EDEFF9;
			border-top: 2px solid #00D983;
			
			box-sizing: border-box;
			padding: 10px 25rpx;
			
			margin-bottom: 15px;
			.top{
				display: flex;
				justify-content: space-between;
				.user{
					display: flex;
					.img{
						width: 60px;
						height: 60px;
						border-radius: 50%;
						overflow: hidden;
						image{
							width: 60px;
							height: 60px;
						}
					}
					.info{
						margin-left: 10rpx;
						height: 60px;
						.text{
							line-height: 25px;
							font-size: 12px;
						}
					}
				}
				.state{
					width: 150rpx;
					text-align: right;
					line-height: 25px;
					font-size: 12px;
					color: #2ECC71;
				}
				
			}
			.inner{
				margin: 10px auto;
				width: 650rpx;
				border: 1px solid #EDEFF9;
				border-radius: 6px;
				box-sizing: border-box;
				padding: 10px;
				font-size: 12px;
				.class_name{
					line-height: 20px;
					color: #3498DB;
				}
				.name{
					line-height: 20px;
				}
				.tip{
					line-height: 20px;
					text-indent: 2em;
				}
			}
			.bottom{
				text-align: right;
				.btn{
					display: inline-block;
					width: 80px;
					text-align: center;
					line-height: 30px;
					font-size: 12px;
					color: #FFFFFF;
					background-color: #16A085;
				}
			}
		}
	}
</style>
