<template>
	<view>
		<cpn-navbar title="今日护理"></cpn-navbar>

		<view class="content">
			<view class="map">
				<view class="map-text">护理地图</view>
				<view class="map-icon" @click="toMap">
					<u-image src="/static/todayNursing/map.png" height="84" width="84" shape="circle"></u-image>
				</view>
			</view>

			<view class="nursing-list">
				<view v-for="(item,index) in nursingList" :key="index" class="list-item">
					<view class="top">
						<view class="time">{{item.time}}</view>
						<view class="status">
							<view class="status-icon"
								:class="{icon1:item.status === 0,icon2:item.status === 1,icon3:item.status === 2}">
							</view>
							<view v-if="item.status === 2" class="status-text">进行中</view>
							<view v-else-if="item.status === 0" class="status-text">待护理</view>
							<view v-else class="status-text">已完成</view>
						</view>
					</view>

					<view class="line"></view>

					<view class="center">
						<view class="avatar">
							<u-image src="/static/logo.png" height="104" width="104" shape="circle"></u-image>
						</view>
						<view class="user-info">
							<view class="name">{{item.name}}</view>
							<view class="tel">
								<view>
									<u-icon name="phone" size="28" color="#1479FF"></u-icon>
								</view>
								<view class="text">{{item.tel}}</view>
							</view>
							<view class="address">
								<view>
									<u-icon name="map" size="28" color="#1479FF"></u-icon>
								</view>
								<view class="text">{{item.address}}</view>
							</view>
						</view>
						<view class="sex">
							<view class="sex-text">
								{{item.sex}}
							</view>
						</view>
					</view>

					<view class="bottom">
						<view class="distance">
							<view class="distance-icon">
								<u-image src="/static/todayNursing/distance.png" height="42" width="42"></u-image>
							</view>
							<view class="distance-text">{{item.distance}}</view>
						</view>
						<view class="to-there">
							<view class="to-there-text">去那里</view>
							<view class="to-there-icon">
								<u-image src="/static/todayNursing/to-there.png" height="46" width="46"></u-image>
							</view>
						</view>
					</view>

				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				nursingList: [{
						time: "2022-06-25",
						name: "冯美君",
						tel: "158****5455",
						address: "通园路666号（地图：通园路66号）",
						distance: "距您1.7km",
						status: 2,
						sex: "女"
					},
					{
						time: "2022-06-25",
						name: "冯美君",
						tel: "158****5455",
						address: "通园路666号（地图：通园路66号）",
						distance: "距您1.7km",
						status: 0,
						sex: "女"
					},
					{
						time: "2022-06-25",
						name: "冯美君",
						tel: "158****5455",
						address: "通园路666号（地图：通园路66号）",
						distance: "距您1.7km",
						status: 1,
						sex: "男"
					}
				]
			}
		},
		methods: {
			//跳转护理地图
			toMap() {
				uni.$u.throttle(() => {
					uni.navigateTo({
						url: "/pages/map/map"
					})
				})
			}
		},
		computed: {

		},
	}
</script>

<style scoped lang="scss">
	// 待护理
	.icon1 {
		width: 16rpx;
		height: 16rpx;
		background: #FDB030;
		border-radius: 100%;

		margin-right: 14rpx;
	}

	//已完成
	.icon2 {
		width: 16rpx;
		height: 16rpx;
		background: #1173FF;
		border-radius: 100%;

		margin-right: 14rpx;
	}

	//进行中
	.icon3 {
		width: 12rpx;
		height: 12rpx;
		background: #2EC28B;
		border-radius: 100%;

		margin-right: 14rpx;
		position: relative;

		&::after {
			content: '';
			width: 24rpx;
			height: 24rpx;
			border: 2rpx solid #2EC28B;
			border-radius: 100%;
			animation: icon-scale 3s linear infinite;

			position: absolute;
			top: -8rpx;
			left: -8rpx;
		}

		@keyframes icon-scale {

			0%,
			30%,
			100%,
			40% {
				transform: scale(0.7, 0.7);
			}

			70% {
				transform: scale(1, 1);
			}
		}
	}

	.map {
		display: flex;
		align-items: center;

		margin-top: 20rpx;
		margin-left: 470rpx;

		.map-text {
			width: 128rpx;
			height: 42rpx;
			font-size: 32rpx;
			font-family: PingFang-SC-Medium, PingFang-SC;
			font-weight: 500;
			color: #36596A;
			line-height: 42rpx;

		}

		.map-icon {

			margin-left: 24rpx;
		}
	}

	.nursing-list {

		margin-top: 16rpx;

		.list-item {
			width: 710rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(219, 218, 218, 0.5);

			margin: 0 20rpx 26rpx 22rpx;

			.top {
				display: flex;
				justify-content: space-between;
				align-items: center;

				padding: 22rpx 0;

				.time {
					height: 40rpx;
					font-size: 28rpx;
					font-family: PingFang-SC-Medium, PingFang-SC;
					font-weight: 500;
					color: #36596A;
					line-height: 40rpx;

					padding-left: 20rpx;
				}

				.status {
					display: flex;
					align-items: center;

					.status-icon {

						margin-right: 10rpx;
					}

					.status-text {
						width: 84rpx;
						height: 40rpx;
						font-size: 28rpx;
						font-family: PingFang-SC-Medium, PingFang-SC;
						font-weight: 500;
						color: #36596A;
						line-height: 40rpx;

						margin-right: 20rpx;
					}
				}
			}

			.line {
				width: 670rpx;
				height: 2rpx;
				border: 2rpx solid #EEEFF5;

				margin: 0 auto;
			}

			.center {
				display: flex;
				justify-content: space-between;

				padding-top: 24rpx;

				.avatar {

					padding-top: 4rpx;
					padding-left: 20rpx;
				}

				.user-info {

					padding-left: 24rpx;

					.name {
						width: 270rpx;
						height: 48rpx;
						font-size: 32rpx;
						font-family: PingFang-SC-Medium, PingFang-SC;
						font-weight: 500;
						color: #333333;
					}

					.tel {
						height: 40rpx;
						font-size: 28rpx;
						font-family: PingFang-SC-Medium, PingFang-SC;
						font-weight: 500;
						color: #36596A;
						line-height: 40rpx;
						display: flex;

						margin-top: 18rpx;

						.text {

							margin-left: 10rpx;
						}
					}

					.address {
						font-size: 28rpx;
						font-family: PingFang-SC-Medium, PingFang-SC;
						font-weight: 500;
						color: #36596A;
						line-height: 40rpx;
						display: flex;

						margin-top: 14rpx;

						.text {

							margin-left: 10rpx;
						}
					}
				}

				.sex {
					width: 40rpx;
					height: 40rpx;
					background: #FDECEC;
					opacity: 0.5;
					display: flex;
					justify-content: center;
					align-items: center;

					margin-right: 20rpx;

					.sex-text {
						width: 28rpx;
						height: 34rpx;
						font-size: 28rpx;
						font-family: PingFang-SC-Medium, PingFang-SC;
						font-weight: 500;
						color: #36596A;
						line-height: 34rpx;
					}
				}
			}

			.bottom {
				display: flex;
				justify-content: space-between;
				align-items: center;

				margin-top: 16rpx;
				padding-bottom: 26rpx;

				.distance {
					align-items: center;
					display: flex;

					.distance-icon {

						padding-left: 20rpx;
					}

					.distance-text {
						height: 34rpx;
						font-size: 24rpx;
						font-family: PingFang-SC-Medium, PingFang-SC;
						font-weight: 500;
						color: #A7AFBC;
						line-height: 34rpx;

						padding-left: 20rpx;
					}
				}

				.to-there {
					display: flex;
					align-items: center;

					margin-right: 20rpx;

					.to-there-text {
						height: 34rpx;
						font-size: 24rpx;
						font-family: PingFang-SC-Medium, PingFang-SC;
						font-weight: 500;
						color: #A7AFBC;
						line-height: 34rpx;

						margin-right: 14rpx;
					}

					.to-there-icon {

						margin-left: 3rpx;
					}
				}
			}
		}
	}
</style>
