<template>
	<view class="staff-warp">
		<view class="warp-box" v-for="(item,index) in list" :key="index">
			<view class="staff-list">
				<view class="staff-left"> 
					<view class="staff-top-left">
						<image :src="item.img ? item.img : BASE_IMG_URL+'headImg.png'" class="headerimg"  mode="scaleToFill"></image>
						<view class="staff-name">{{item.name}}</view>
					</view>
					<view class="staff-post">岗位：{{item.post ? item.post : '--'}}</view>
				</view>
				<view class="staff-right">
					<view class="staff-mobile">手机号：{{item.mobile ? item.mobile : '--'}}</view>
					<view class="staff-super">员工编号：{{item.num ? item.num : '--'}}</view>
				</view>
			</view>
			<view class="btn-list">
				<view class="btn tongguo" @click="passInfo(item.id)">通过</view>
				<view class="btn jujue" @click="refuseInfo(item.id)">拒绝</view>
			</view>
		</view>
		<view style="height: 200rpx;"></view>
				<u-empty v-if="list.length == 0" text="暂无更多"></u-empty>
	</view>
</template>

<script>
	import { netExamineStaffList, netRefuseStaffInfo } from '@/api/index.js'
	import { BASE_IMG_URL } from '@/util/api.js'
	export default{
		data(){
			return{
				BASE_IMG_URL:BASE_IMG_URL,
				list:[
					//测试数据，需要清空
					{
						// img:'13',
						name:'name',
						post:'post',
						mobile:'mobile',
						num:'num',
						id:'id'
					}
				]
			}
		},
		onLoad() {
			
		},
		onShow() {
			this.getList()
		},
		methods:{
			getList() {
				netExamineStaffList().then(res=>{
					this.list = res.data
				})
			},
			//通过
			passInfo(id) {
				uni.navigateTo({
					url:'/pagesA/profile/staff/stafflist/editStaff?id='+id+'&type=1'
				})
			},
			//拒绝
			refuseInfo(id) {
				uni.showModal({
					title:'提示',
					content:'请确认是否拒绝？',
					success:(re=>{
						if(re.confirm){
							netRefuseStaffInfo({id}).then(res=>{
								uni.showToast({
									title:res.msg,
									icon:'none'
								})
								setTimeout(()=>{
									this.getList()
								},2000)
							})
						}
					})
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.staff-warp{
		padding:30rpx 0;
		.warp-box{
			padding: 30rpx 0;
			background-color: #fff;
			margin: 0 30rpx;
			margin-bottom: 20rpx;
			border-radius: 10rpx;
			box-shadow: 2rpx 2rpx 50rpx rgba(0,0,0,0.1);
		}
	}
	.staff-list{
		padding:0 30rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		.staff-left{
			.staff-top-left{
				display: flex;
				justify-content: flex-start;
				align-items: center;
				margin-bottom:20rpx;
				font-size:26rpx;
				color:#666;
				.headerimg{
					width:46rpx;
					height:46rpx;
					border-radius: 50%;
					margin-right:15rpx;
				}
			}
			.staff-post{
				font-size:26rpx;
				color:#666;
			}
		}
		.staff-right{
			flex-shrink: 0;
			font-size:26rpx;
			color:#666;
			.staff-mobile{
				margin-bottom:20rpx;
			}
		}
	}
	.btn-list{
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top:20rpx;
		padding:30rpx 30rpx 0;
		border-top:1rpx solid #CCC;
		.btn{
			width:180rpx;
			height:60rpx;
			border-radius: 30rpx;
			font-size:26rpx;
			color:#fff;
			text-align: center;
			line-height: 60rpx;
		}
		.tongguo{
			background:$uni-text-color;
		}
		.jujue{
			background:#F43F3B;
		}
	}
</style>
