<template>
	<view class="content">
	<!-- 	<view class="filter-box">
			<u-search placeholder="请输入关键字" v-model="filterText" @search="setFilterText" @custom="setFilterText"></u-search>
		</view> -->
		<template v-if="tableList.length">
			<scroll-view scroll-y class="scroll-box" :refresher-enabled="true" refresher-background="white">
				<u-card :show-head="false" :foot-border-top="false" margin="10px 15px" borderRadius="40" :foot-style="{padding: '0 10px 5px 0'}" v-for="(site, index2) in tableList"
				 :key="index2" class="card-box">
					<view slot="body" class="card-content">
						<view class="student-info">
							<view style="width: 100%;margin-bottom: 5px;">
								<text class="info-name" style="margin-right: 10px;">{{site.studentName}}</text>
								<text class="info-name">{{site.className}}</text>
							</view>
							<view style="width: 100%;margin-bottom: 5px;">
								<text class="info-name" style="margin-right: 10px;">{{site.leaveReason}}</text>
								<text class="info-name">{{site.time}}</text>
							</view>
							<view class="info-phone" style="margin-bottom: 5px;">{{ site.type == 1 ? '事假' : '病假' }}</view>
							<view class="info-phone">{{ computedAgreeType(site.agreeType) }}</view>
						</view>
					</view>
				</u-card>
				<u-divider v-if="item.isOver" bg-color="transparent" :style="{paddingTop : tabList[0].tableList.length == 0 ? '10px' : ''}">没有更多了</u-divider>
			</scroll-view>
		</template>
		<template v-else>
			<u-empty mode="data"></u-empty>
		</template>
		</u-popup>
		<u-top-tips ref="uTips"></u-top-tips>
	</view>
</template>

<script>
	import {
		mapGetters
	} from 'vuex'
	const NET = require('@/utils/request')
	const API = require('@/config/api')
	export default {
		computed: {
			...mapGetters([
				'customStyle',
				'handleCustomStyle',
			]),
			computedAgreeType() {
				return function(agreeType) {
					switch(agreeType) {
						case 0: 
							return '未处理'
						case 1:
							return  '同意'
						case 2:
							return  '不同意'
					}
				}
			}
		},
		data() {
			return {
				customerId: '',
				tableList: [],
			}
		},
		onShow() {
			this.tabList = Object.assign([], this.$options.data().tabList)
			this.getTableList()
		},
		methods: {
			//  获取列表数据
			getTableList() {
				NET.request(API.stuLeaveLessonsList, {
					page: 1,
					size: 100,
				}, 'POST').then(res => {
					this.triggered = false
					this.tableList = res.data.row
				})
			},
		},
	}
</script>

<style>
	page {
		width: 100%;
		height: 100%;
		background-color: #f7f7f7;
	}
</style>
<style lang="scss" scoped>
	@import "@/static/css/themes.scss";

	.content {
		width: 100%;
		float: left;
		
		.filter-box {
			height: 48px;
			padding: 10px 15px;
			background-color: #FFFFFF;
		}

		.swiper-box {
			height: calc(100vh - 82px);

			.swiper-item {
				height: calc(100vh - 82px);

				.scroll-box {
					width: 100%;
					height: calc(100vh - 82px);

					.card-box {
						.card-content {
							display: flex;
							align-items: center;

							.student-info {
								flex: 1;

								.info-name {
									// width: 64px;
									// float: left;
									line-height: 28px;
									font-size: 14px;
									font-weight: bold;
								}

								.info-type {
									padding: 0 10px;
									margin-top: 3px;
									border-radius: 20px;
									float: left;
									line-height: 20px;
									font-size: 10px;
									color: #FFFFFF;
									background-color: #999999;
								}

								.info-type-active {
									background-color: $mainColor;
								}

							}
						}
					}
				}
			}
		}
	}
	.menber-box {
		width: 100%;
		// float: left;
		padding: 10px 15px;
		margin-bottom: 10px;
		
		.menber-col {
			width: 100%;
			padding: 15px;
			margin-bottom: 10px;
			display: inline-block;
			background-color: #FFFFFF;
			border-radius: 15px;
			box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
			position: relative;
			overflow: hidden;
			box-sizing: border-box;
			
			.menber-label {
				width: 100%;
				margin-bottom: 5px;
				float: left;
				font-size: 14px;
				// line-height: 20px;
			}
	
			.menber-num {
				width: 100%;
				float: left;
				font-size: 26px;
				line-height: 28px;
				color: $mainColor;
			}
	
			.menber-icon {
				font-size: 100px;
				color: $mainColor;
				position: absolute;
				right: -5px;
				bottom: -30px;
				opacity: 0.5;
			}
		}
	}
	.common-title {
		width:100%;
		text-align: center;
		font-size: 20px;
		margin: 10px 0;
	}
	.fix-add-icon {
		position: fixed;
		bottom: 15px;
		right: 15px;
	}
	.button-box {
		// width: 100%;
		padding: 10px 15px;
		box-sizing: border-box;
	}
	.info-phone {
		font-size: 12px;
		color: #999999;
	}
</style>

