<template>
	<view class="list-body">
		<uni-nav-bar @clickLeft="goBack()" class="nav-bar" height="110rpx" leftWidth="200rpx" leftText="人员选择"
			leftIcon="left" border backgroundColor="#2cade8" color="#fff" fixed statusBar shadow></uni-nav-bar>
		<view class="apply-info">
			<checkbox-group @change="checkboxChange">
				<label class="uni-list-cell uni-list-cell-pd" v-for="row in userRange" :key="row.value">
					<view>
						<checkbox :value="row.value" :checked="row.checked" />
					</view>
					<view>
						<view class="name">姓名：{{row.name}}</view>
						<view class="tel">手机号：{{row.phone}}</view>
						<view class="tel">身份证号：{{row.id_number}}</view>
					</view>
				</label>
			</checkbox-group>
			<!-- <view class="row" v-for="(row,index) in userRange" :key="index" @tap="select(row)">
				<view class="center">
					<view class="name-tel">
						<view class="name">姓名：{{row.name}}</view>
						<view class="tel">手机号：{{row.phone}}</view>
						<view class="tel">身份证号：{{row.id_number}}</view>
					</view>
					<view class="photo">
						{{row.photo}}
					</view>
				</view>
				<view class="right">
					<view class="icon bianji" @tap.stop="edit(row)">
					</view>
				</view>
			</view>
		 -->

		</view>
		<view class="add">
			<view class="btn">
				<button type="primary" class="save-btn" @click="add">新增人员</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "userList",
		data() {
			return {
				formData: {
					name: '',
				},
				userRange: [{
					id: "1553943890468409344",
					name: "一一",
					phone: "1",
					photo: null,
					id_number: "",
					employee: null,
					visit: null,
				}, {
					id: "1547149802700148736",
					name: "test3",
					phone: "13112340003",
					photo: "/media/2022/07/13/微信图片_20220713172755.jpg",
					id_number: "371324198302029824",
					employee: "1547406632219185152",
					visit: "1547754231795159040"
				}],
			}
		},

		onShow() {
			// this.getUserRange();
		},
		methods: {
			//获取用户
			getUserRange() {
				let that = this;
				this.$u.api.vmVisitor({
					page: 0
				}).then(res => {
					that.userRange = [];
					res.forEach(item=>{
						let obj = {};
						obj=item;
						obj.checked  = false;
						that.userRange.push(obj)
					})
					
				})
			},
			select(row) {},
			goBack() {
				uni.navigateBack({
					delta: 1
				})
			},

			add() {
				uni.navigateTo({
					url: '/pages/workSpace/newWork/addUser'
				})
			},
			edit(row) {},
		}
	}
</script>

<style>
	>>>.uni-navbar__header,
	>>>.uni-status-bar {
		background-image: linear-gradient(90deg, #164cc3 0%, #2c6fd9 100%), linear-gradient(#e60012, #e60012) !important;
	}

	.list-body {
		background-color: #f3fbff;
		padding-bottom: 113px;
	}

	.apply-info {
		min-height: 70vh;
		width: 710upx;
		margin: 0 auto;
		background-color: #FFFFFF;
		border-radius: 5px;
		padding: 12px 16px;
		box-sizing: border-box;
		margin-top: 12px;
	}

	.row {
		padding: 10upx;
		margin-bottom: 20upx;
		border-bottom: 1upx solid #eeeeee;
	}

	.uni-list-cell {
		display: flex;
		padding: 10upx;
		margin-bottom: 20upx;
		border-bottom: 1upx solid #eeeeee;
	}

	.add {
		position: fixed;
		bottom: 0;
		width: 100%;
		height: 120upx;
		justify-content: center;
		align-items: center;
	}

	.btn {
		margin: auto;
		box-shadow: 0upx 5upx 10upx rgba(0, 0, 0, 0.4);
		width: 70%;
	}

	.save-btn {
		height: 80rpx;
		color: #fff;
		font-size: 30upx;
		justify-content: center;
		align-items: center;
	}
</style>
