<template>
	  <view class="worker-box">
		  
		  <view :id="`zp-id-${item.zp_index}`" :key="item.zp_index" v-for="(item,index) in virtualList" class="worker-card">
		  		
		  		<view class="main-box">
					<view class="avatar-box">
						<u-avatar mode="square" size="120" :src="item.avatar"></u-avatar>
						<view class="online-box" v-if="item.onlineStatus">在线</view>
						<view class="online-box" v-else>离线</view>
					</view>
		  			
		  			<view class="right-box">
		  				<view class="nickname-box">
		  					<view class="nickname">
								<text class="name">{{item.nickname}}</text>
								<view class="man-box" v-if="item.sex == 0">
									<u-icon name="man"></u-icon>
									<text>{{item.age}}</text>
								</view>
								<view class="woman-box" v-if="item.sex == 1">
									<u-icon name="woman"></u-icon>
									<text>{{item.age}}</text>
								</view>
							</view>
							<view class="status" v-if="item.status == 0">待审核</view>
							<view class="status" v-if="item.status == 1">已审核</view>
		  				</view>
						
						<view class="btn-box">
							<view class="btn" @click="editApply(item)">编辑资料</view>
							<view class="btn" @click="levelList(item)">技能管理</view>
							<view class="btn" @click="setOnline(item)">在线状态</view>
						</view>
		  				
		  			</view>
		  		</view>
		  		
		  </view>
		  
	  </view>
  
</template>

<script>
	export default {
		components: {
			
		},
		props: {
			virtualList: {
				type: Array,
				default: [],
			},
		},
		data() {
			return {
				
			}
		},
		methods: {
			editApply(e) {
				this.$u.route({
					url: 'pages/clerk/apply/edit',
					params: {
						id: e.id,
					}
				});
			},
			levelList(e) {
				this.$u.route({
					url: 'pages/worker/levelList/index',
					params: {
						id: e.id,
					}
				});
			},
			setOnline(e) {
				this.$u.route({
					url: 'pages/worker/workerList/set',
					params: {
						id: e.id,
					}
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.worker-box {
		padding: 0 10px;
	}
	
	.worker-card {
		padding: 10px;
		margin-top: 10px;
		background-color: #fff;
		display: flex;
		flex-direction: column;
		flex: 1;
		border-radius: 10px;
		
		.main-box {
			display: flex;
			align-items: center;
			
			.avatar-box {
				position: relative;
				width: 120rpx;
				height: 120rpx;
				
				.online-box {
					position: absolute;
					bottom: 0;
					display: flex;
					justify-content: center;
					align-items: center;
					width: 100%;
					color: #fff;
					background-color: var(--ui-BG-Main);
					font-size: 11px;
					padding: 1px 0;
					border-bottom-left-radius: 5px;
					border-bottom-right-radius: 5px;
				}
			}
			
			.right-box {
				display: flex;
				flex: 1;
				flex-direction: column;
				margin-left: 10px;
				
				.nickname-box {
					display: flex;
					justify-content: space-between;
					flex: 1;
					align-items: center;
				}
				
				.nickname {
					display: flex;
					align-items: center;
					
					.name {
						font-size: 28rpx;
						font-weight: bold;
						margin-right: 5px;
						text-overflow: ellipsis;
						white-space: nowrap;
						max-width: 300rpx;
						overflow: hidden;
					}
				}
				
				.man-box {
					background: linear-gradient(90deg,#2b99ca,#87b5e7);
					display: flex;
					justify-content: center;
					align-items: center;
					border-radius: 40px;
					color: #fff;
					font-size: 20rpx;
					padding: 1px 5px;
				}
				
				.woman-box {
					background: linear-gradient(90deg,#c33239,#de8189);
					display: flex;
					justify-content: center;
					align-items: center;
					border-radius: 40px;
					color: #fff;
					font-size: 20rpx;
					padding: 1px 5px;
				}
				
				.status {
					font-size: 24rpx;
					font-weight: bold;
					color: var(--ui-BG-Main);
				}
				
				.btn-box {
					display: flex;
					justify-content: flex-end;
					
					.btn {
						background-color: var(--ui-BG-Main);
						color: #fff;
						border-radius: 40px;
						font-size: 22rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						padding: 10rpx 20rpx;
						margin-left: 5px;
						margin-top: 20rpx;
					}
				}
				
				
			}
		}
		
	}
</style>