<template>
	<view class="container">
		<view class="user-info-box">
			<view class="img-box">
				<u-avatar :src="nurseInfo.photographUrl || defaultImg" size="121rpx" mode="aspectFill"></u-avatar>
			</view>
			<view class="info-r">
				<view class="info-r-top">
					<span class="name">{{nurseInfo.name || '-'}}</span>
					<span class="status" v-if="nurseInfo.orderReceivingStatus == '0'">正常接单</span>
					<span class="status" v-else>关闭接单</span>
				</view>
				<span class="phone">{{nurseInfo.phoneNumber || '-'}}</span>
			</view>
		</view>
		<view class="num-box flex-ac">
			<view class="num-item flex-ac">
				<view class="num-item-l">
					<span class="name">今日订单数</span>
					<span class="num">{{nurseInfo.todayCount || 0}}</span>
				</view>
				<image src="/static/copy.png" mode="aspectFill"></image>
			</view>
			<view class="num-item flex-ac">
				<view class="num-item-l">
					<span class="name">总订单数</span>
					<span class="num">{{nurseInfo.orderCount || 0}}</span>
				</view>
				<image src="/static/copy.png" mode="aspectFill"></image>
			</view>
		</view>

		<view class="order-box flex-dc">
			<view class="title-box flex-box-c-b">
				<span class="title">订单管理</span>
				<span class="more" @click="toPath(0)">查看全部></span>
			</view>
			<view class="order-list flex-box">
				<view class="order-item flex-box-cloum" v-for="item,index in orderType" :key="index"
					@click="toPath(item.index)">
					<image :src="item.icon" mode="aspectFill"></image>
					<span class="name">{{item.name}}</span>
				</view>
			</view>
		</view>

		<view class="order-box flex-dc">
			<view class="title-box flex-box-c-b">
				<span class="title">应用中心</span>
			</view>
			<view class="order-list flex-box">
				<view class="order-item flex-box-cloum" @click="toPath(2)">
					<image src="@/static/my/icon-04.png" mode="aspectFill"></image>
					<span class="name">待服务</span>
					<u-badge type="error" max="99" :value="nurseInfo.waitServiceCount" :offset="[-10, -10]"
						absolute></u-badge>
				</view>
				<view class="order-item flex-box-cloum" @click="toPath(3)">
					<image src="@/static/my/icon-04.png" mode="aspectFill"></image>
					<span class="name">服务中</span>
					<u-badge type="error" max="99" :value="nurseInfo.inServiceCount" :offset="[-10, -10]"
						absolute></u-badge>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	
	import {
		getNurseInfo
	} from "@/api/hospital.js"
	export default {
		data() {
			return {

				defaultImg: require('@/static/default-head-photo.png'),
				nurseInfo: {
					nickname: '张三',
					phone: '18509887879'
				},
				orderType: [{
					index: 2,
					name: '待服务',
					icon: require('@/static/my/icon-04.png'),
				}, {
					index: 3,
					name: '服务中',
					icon: require('@/static/my/icon-04.png'),
				}, {
					index: 4,
					name: '待评价',
					icon: require('@/static/my/icon-04.png'),
				}, {
					index: 5,
					name: '已完成',
					icon: require('@/static/my/icon-04.png'),
				}, ],
				nurseInfo: {},
			}
		},
		onLoad() {
			this.getNurseInfo()
		},
		methods: {
			//获取信息
			getNurseInfo(){
				let that = this;
				getNurseInfo().then(res => {
						if (res.code == 200) {
							let data = res.data;
							this.nurseInfo = data;
							
						}
				
					})
					.catch((err) => {
						console.log(err);
					})
			},
			toPath(val) {
				uni.navigateTo({
					url: '/pages/workbench/order/list?type=' + val 
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		padding: 30rpx;

		.user-info-box {
			display: flex;
			align-items: center;
			padding: 20rpx;
			background-color: #fff;
			border-radius: 20rpx;

			.img-box {}

			.info-r {
				display: flex;
				flex-direction: column;
				margin-left: 25rpx;

				.info-r-top {
					display: flex;
					align-items: center;
					margin-bottom: 10rpx;

					.name {
						display: inline-flex;
						font-size: 36rpx;
						height: 36rpx;
						line-height: 36rpx;
						justify-content: center;
						font-weight: bold;
					}

					.status {
						display: inline-flex;
						font-size: 24rpx;
						margin-left: 10rpx;
						height: 40rpx;
						line-height: 40rpx;
						padding: 0 20rpx;
						background-color: #FFF9D9;
						color: #B16E55;
						border-radius: 50rpx;

					}
				}

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

			}


		}

		.num-box {
			margin-top: 20rpx;

			.num-item {
				width: 48%;
				padding: 20rpx;
				background-color: #fff;
				border-radius: 20rpx;
				justify-content: center;

				&:first-child {
					margin-right: 20rpx;

				}

				.num-item-l {
					display: flex;
					align-items: center;
					flex-direction: column;
					margin-right: 20rpx;

					.name {
						font-size: 36rpx;
						color: #101010;

					}

					.num {
						font-size: 36rpx;
						font-weight: bold;
						color: #101010;

					}

				}

				image {
					width: 40rpx;
					height: 40rpx;
					border-radius: 50%;
				}
			}
		}

		.order-box {
			background-color: #fff;
			padding: 20rpx;
			border-radius: 20rpx;
			margin-top: 20rpx;

			.title-box {
				margin-bottom: 20rpx;

				.title {
					font-size: 36rpx;
					font-weight: bold;
					color: #101010;
				}

				.more {
					font-size: 28rpx;
					color: #9a9a9a;
				}
			}

			.order-list {
				.order-item {
					position: relative;
					margin: 20rpx 40rpx;

					image {
						width: 90rpx;
						height: 90rpx;
					}

					.name {
						margin-top: 15rpx;
						font-size: 28rpx;
						color: #101010;
					}
				}
			}

		}
	}
</style>