<template>
	<view class="">
		<view @click="goDetail(item)"  class="data" v-for="(item, index) in list" :key="index">
			<view class="top">
				<view class="left">
					<view class="title flex align-center justify-center">
						<image @click.stop="preview(item)"  style="width: 60rpx;height: 60rpx; border-radius: calc(8rpx);" v-if="item.imageUri" :src="item.imageUri"></image>
						<u-icon v-else name="man-add-fill"  size="34" color="#50baca"></u-icon>
						<text class="padding-left-10" >姓名：{{item.name}}</text>
						
						<view class="padding-left-50">
							<text>人脸状态：</text>
							<text class="text-orange" v-if="item.faceEnable==-1">未上传</text>
							<text class="text-green" v-else-if="item.faceEnable==1">已下发</text>
							<text class="text-red " v-else-if="item.faceEnable==2">已禁用</text>
						</view>
					</view>
				</view>
				<view class="right" @click="del(item.id)">
					<text class="cuIcon-deletefill text-red padding-left-50" style="font-size: 40rpx;"></text>
				</view>
			</view>
			<view class="item">
				<view class="left">
					<view style="padding: 0 30rpx;">
						<view class="content flex">
							<u-icon v-if="item.sex==1" name="man"   size="30" color="#fdb524"></u-icon>
							<u-icon v-else name="woman"   size="30" color="#fdb524"></u-icon>
							<text class="text-bold  padding-left-10">性别：</text>
							<text v-text="item.sex==1?'男':'女'"></text>
						</view>
						<view  class="content flex">
							<u-icon name="bookmark"  size="30" color="#5ca8f0"></u-icon>
							<text class="text-bold padding-left-10">人员类型：</text>
							<text class="" v-if="item.type==0">保安</text>
							<text class="" v-else-if="item.type==1">快递</text>
							<text class="" v-else-if="item.type==2">外卖</text>
							<text class="" v-else-if="item.type==3">保洁</text>
							<text class="" v-else-if="item.type==4">其他</text>
						</view>
						<view  class="content flex align-center">
							<u-icon name="xiaoqu" custom-prefix="custom-icon" size="30" color="#2fc500"></u-icon>
							<text style="width: 25%;" class="text-bold padding-left-10">所属小区：</text>
							<text style="line-height: 42rpx;">{{item.residentialName}}</text>
						</view>
						<view  class="content flex">
							<text class="cuIcon-mobile" style="color: #007AFF;font-size: 32rpx;"></text>
							<text class="text-bold padding-left-10">联系方式：</text>
							<text class="text-bold" style="padding-top: 6rpx;" v-text="item.tel" ></text>
							<text @click="$util.call(item.tel)" class="padding-left-10 text-blue" style="text-decoration: underline;">拨打</text>
						</view>
					</view>
				</view>
			</view>
			<view class="bottom flex" >
				<!-- 待审核 -->
				<view @click.stop="openAccess(item)"  class="cu-btn  sm round line-blue" style="margin: 0 10rpx;">
					开门权限
				</view>
				<view v-if="item.faceEnable==1" @click.stop="operFace(item.id,5)" class="cu-btn  sm round bg-red" style="margin: 0 10rpx;">
					人脸禁用
				</view>
				<view v-if="item.faceEnable==2" @click.stop="operFace(item.id,3)" class="cu-btn  sm round bg-base" style="margin: 0 10rpx;">
					人脸启用
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	name: 'card',
	props:{
		list:{
			type:Array,
			default:()=>{
				[]
			}
		}
	},
	data() {
		return {
			loading:false
		};
	},
	created() {
		
	},
	methods:{
		preview(item){
			let img=this.$global.getImgBaseUrl()+item.serverUserFaceImage.imageUri
			this.$util.preview(img)
		},
		goDetail(item){
			getApp().globalData.userAuthData=item
			uni.navigateTo({
				url:"detail"
			})
		},
		copy(data){
			uni.setClipboardData({
				data:data
			})
		},
		del(id){
			this.$emit('del',id)
		},
		openAccess(item){
			this.$emit('openAccess',item)
		},
		operFace(userId,operType){
			let params={
				userId,
				operType
			}
			this.$emit('operFace',params)
		},
		fail(id){
			let params={
				id:id,
				checkState:2
			}
			this.$emit('fail',params)
		}
		
	}
};
</script>

<style lang="scss">
.data {
	width: 710rpx;
	background-color: #ffffff;
	margin: 20rpx auto;
	border-radius: 6rpx;
	box-sizing: border-box;
	padding: 20rpx 10rpx;
	font-size: 28rpx;
	position: relative;
	
	.delicon{
		position: absolute;
		right: 5rpx;
		top: 5rpx;
	}
	
	.top {
		display: flex;
		justify-content: space-between;
		padding-bottom: 20rpx;
		border-bottom: 1rpx solid #dedede;
		.left {
			display: flex;
			align-items: center;
			.title {
				margin: 0 10rpx;
				font-size: 30rpx;
			}
		}
		.right{
			margin-right: 5rpx;
		}
	}
	.item {
		margin: 5rpx 0 20rpx 0;
		.content {
			border-bottom: 1rpx dashed #DDDDDD;
			padding: 30rpx 0;
		}
	}
	.bottom {
		display: flex;
		margin-top: 30rpx;
		justify-content: flex-end;
		align-items: center;
	}
}
</style>