<template>
	<view class="goW0rk-wrap">
		<view class="card-list">
			<z-paging ref="paging" :fixed="false" v-model="staffList" @query="getList" :auto="false">
				<view class="card-item" @click="goDetails(item.id)" v-for="(item,index) in staffList" :key="index">
					<view class="card-left">
						<view class="card-info">
							<u--image src="/static/tabar/ic_my_info.png" width="30px" height="30px"></u--image>
							<view class="card-name">{{item.staffName}}</view>
							<view class="card-phone">{{item.staffPhone}}</view>
						</view>
						<view class="punch-wrap">
							<view class="item-info">
								<view :class="item.goWorkTime?'dot-box green-color':'dot-box info-color'"></view>
								上班打卡 {{item.goWorkTime}}
							</view>
							<view class="item-info ml20">
								<view :class="item.offWorkTime?'dot-box green-color':'dot-box info-color'"></view>
								下班打卡 {{item.offWorkTime}}
							</view>
						</view>
					</view>
					<view class="card-right">
						<u-icon name="arrow-right" size="18"></u-icon>
					</view>
				</view>
			</z-paging>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				staffList: []
			}
		},

		onShow() {

			this.getList()
		},




		methods: {

			// 列表
			getList(pageNo, pageSize) {
				const params = {
					pageNumber: pageNo || 1,
					pageSize: pageSize || 10,
					storeUserId: uni.getStorageSync('storeUserId')
				}
				this.$http.get('/api/store/staff/clock', params).then(res => {
					if (res.code == 200) {
						this.staffList = res.data.records
						// console.log(res.data.records,'=---')
						this.$refs.paging.complete(this.staffList);
					} else {
						this.$refs.paging.complete([]);
					}
				})
			},
			// 详情
			goDetails(id){
				uni.navigateTo({
					url:`/pages/goWorkDetails/goWorkDetails?id=${id}`
				})
			}




		}
	}
</script>

<style lang="scss">
	page {
		background: #FAF7F6;
		padding-bottom: 200rpx;
	}

	.left {
		width: 30rpx;
		height: 30rpx;
	}

	.card-list {
		height:100vh;
		margin: 20rpx;

	}

	.card-item {
		padding: 20rpx;
		display: flex;
		background: #fff;
		border-radius: 10rpx;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 20rpx;
	}

	.card-left {}

	.card-info {
		display: flex;
		align-items: center;
	}

	.card-name {
		color: #333;
		font-size: 30rpx;
		margin: 0 20rpx;
	}

	.card-phone {
		font-size: 28rpx;
		color: #333333;
	}

	.punch-wrap {
		display: flex;
		padding: 20rpx 0;
	}

	.item-info {
		display: flex;
		align-items: center;
	}

	.dot-box {
		width: 15rpx;
		height: 15rpx;
		border-radius: 50%;
		margin-right: 20rpx;
	}

	.green-color {
		background: #FF4602;
	}

	.info-color {
		background: #C8C8C8;
	}

	.ml20 {
		margin-left: 30rpx;
	}
</style>