<template>
	<view class="content">
		<!-- 状态栏占位 -->
		<view :style="{height:statusBarHeight+'px'}"></view>
		<view class="bg-box"></view>
		<!-- 随访 -->
		<view class="tab-content">
			<!-- 患者信息 -->
			<view class="user-info-box">
				<!-- 头像 -->
				<view class="head-box">
					<image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/orangeShop/detault_head.jpg" mode="aspectFill"></image>
				</view>
				<view class="user-info">
					<view class="left" v-if="doc!=null">
						<view class="name">{{doc.userName}}</view>
						<text class="gray-tag" v-if="doc.sex==1">男</text>
						<text class="gray-tag" v-if="doc.sex==2">女</text>
						<view class="gray-tag" >{{utils.getAge(doc.birthday)}}岁</view>
						<view class="blue-tag">标签</view>
					</view>
					<!-- <image class="phone" src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/orangeShop/icon_phone.png" mode="" @click="callPhone('114')"></image> -->
				</view>
				<!-- 方案 -->
				<view class="copy-writing">
					<view class="label">建档时间：</view>
					<view class="text">{{doc.createTime}}</view>
				</view>
				<view class="copy-writing">
					<view class="label">备注：</view>
					<view class="text">{{doc.remark}}</view>
				</view>
				 
			</view>
			<view class="hand-box">
				<view class="title">基本操作</view>
				<view class="hand-list">
					<view class="item" @click="navTo('./docRecord?docId='+docId)">
						<image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/orangeShop/suifang_record.png" mode=""></image>
						<text class="text">随访记录</text>
					</view>
					<!-- <view class="item">
						<image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/orangeShop/health_archives.png" mode=""></image>
						<text class="text">问医生</text>
					</view> -->
					<view class="item">
						<image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/orangeShop/msg_remind.png" mode=""></image>
						<text class="text">消息</text>
					</view>
				</view>
			</view>
			<!-- 服务团队 -->
			<view class="hand-box">
				<view class="title">服务团队</view>
				<scroll-view class="team-scroll" scroll-x="true" >
					<view class="team-list">
						<view v-for="(item,index) in users" :key="index" class="item">
							<image class="img" src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/orangeShop/detault_head.jpg" mode=""></image>
							<text class="name">{{item.nickName}}</text>
							<text class="title">{{item.deptName}}</text>
						</view>
					</view>
				</scroll-view>
				
			</view>
		</view>
	</view>
</template>

<script>
	import {getMyDocList,getDocDetails} from '@/api/doc.js'
	export default {
		data() {
			return {
				users:[],
				docId:null,
				doc:null,
				statusBarHeight: uni.getStorageSync('statusBarHeight'),
				bottomBlackLineHeight: uni.getStorageSync('bottomBlackLineHeight'),
				activeDetTab: 1, // 1、随访；2、日志；3、沟通
				stageArr: ['阶段一','阶段二','阶段三','阶段四','阶段五','阶段六','阶段七'],
				activeStage: 2, // 当前进行的阶段。下标从1开始
			}
		},
		onLoad(options) {
			this.docId=options.docId;
			this.getDocDetails();
		},
		methods: {
			getDocDetails(){
				uni.showLoading({
					title:"正在加载中"
				})
				var data={docId:this.docId}
				getDocDetails(data).then(
					res => {
						uni.hideLoading()
						if(res.code==200){
							this.doc=res.data;
							this.users=res.users;
						}else{
							uni.showToast({
								icon:'none',
								title: "请求失败",
							});
						}
					},
					rej => {}
				);
			},
			// 返回
			goBack() {
				uni.navigateBack()
			},
			// 顶部tab切换
			topTabHand(index) {
				this.activeDetTab = index
			},
			// 打电话
			callPhone(phone) {
				uni.makePhoneCall({
					phoneNumber: phone
				})
			},
			// 发布日志
			publishLog() {
				uni.navigateTo({
					url: './publishLog'
				})
			},
			// 基本操作
			navTo(url) {
				uni.navigateTo({
					url: url
				})
			},
			// 查看随访阶段
			showPhaseDet(item) {
				uni.navigateTo({
					url: './followupPhase?type='+ item
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #F7F7F7;
	}
</style>
<style scoped lang="scss">
	.content{
		position: relative;
		.bg-box{
			width: 100%;
			height: 508upx;
			position: absolute;
			top: 0;
			left: 0;
			z-index: -1;
			background-image: url(https://zkzh-2025.oss-cn-beijing.aliyuncs.com/orangeShop/doc_top_bg.png);
			background-repeat: repeat-x;
			background-size: 20upx 508upx;
		}
		 
	}
	.tab-content{
		padding: 88upx 20upx 20upx;
		&.illness{
			padding-top: 30upx;
		}
		.user-info-box{
			padding: 78upx 35upx 50upx;
			background: #FFFFFF;
			border: 2upx solid #EEEEEE;
			box-shadow: 0px 16upx 30upx 0px rgba(0,0,0,0.03);
			border-radius: 20upx;
			position: relative;
			.head-box{
				width: 110upx;
				height: 110upx;
				background: #EDF1F4;
				border: 4upx solid #FFFFFF;
				border-radius: 50%;
				overflow: hidden;
				position: absolute;
				left: 40upx;
				top: -56upx;
				image{
					width: 100%;
					height: 100%;
				}
			}
			.user-info{
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 60upx;
				.left{
					display: flex;
					align-items: center;
					.name{
						font-size: 36upx;
						font-family: PingFang SC;
						font-weight: bold;
						color: #111111;
						line-height: 1;
						margin-right: 20upx;
					}
					.gray-tag{
						height: 46upx;
						line-height: 46upx;
						padding: 0 16upx;
						font-size: 24upx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #333333;
						background: #F7F7F7;
						border-radius: 8upx;
						margin-right: 10upx;
					}
					.blue-tag{
						height: 46upx;
						line-height: 46upx;
						padding: 0 16upx;
						font-size: 24upx;
						font-family: PingFang SC;
						font-weight: bold;
						color: #4BC9B1;
						background: #E2F6F2;
						border-radius: 8upx;
					}
				}
				.phone{
					width: 36upx;
					height: 36upx;
				}
			}
			.copy-writing{
				display: flex;
				margin-bottom: 30upx;
				&:last-child{
					margin-bottom: 0;
				}
				.label{
					flex-shrink: 0;
					font-size: 28upx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #666666;
				}
				.text{
					font-size: 28upx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #111111;
				}
			}
		}
		.hand-box{
			margin-top: 20upx;
			background: #FFFFFF;
			border-radius: 20upx;
			padding: 40upx 30upx;
			.hand-list{
				display: flex;
				align-items: center;
				justify-content: flex-start;
				margin-top: 40upx;
				.item{
					width: 25%;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					image{
						width: 50upx;
						height: 50upx;
						margin-bottom: 20upx;
					}
					.text{
						font-size: 24upx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #333333;
						line-height: 1;
					}
				}
			}
			.team-scroll{
				margin-top: 40upx;
				.team-list{
					display: flex;
					align-items: center;
					.item{
						display: flex;
						flex-direction: column;
						align-items: center;
						justify-content: center;
						margin-right: 40upx;
						&:last-child{
							margin-right: 0;
						}
						.img{
							width: 120upx;
							height: 120upx;
							background: #F2F5F9;
							border-radius: 50%;
						}
						.name{
							margin-top: 20upx;
							font-size: 28upx;
							font-family: PingFang SC;
							font-weight: 500;
							color: #111111;
							line-height: 1;
						}
						.title{
							font-size: 26upx;
							font-family: PingFang SC;
							font-weight: 500;
							color: #999999;
							margin-top: 15upx;
							line-height: 1;
						}
					}
				}
			}
		}
		 
	}
	.communicate{
		padding: 20upx 30upx 170upx;
		.chat-item{
			padding: 30upx 0;
			.time{
				font-size: 26upx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #999999;
				line-height: 1;
				text-align: center;
				margin-bottom: 30upx;
			}
			&.other{
				.chat-inner{
					.head{
						margin-right: 20upx;
					}
				}
			}
			&.my{
				.chat-inner{
					justify-content: flex-end;
					.head{
						margin-left: 20upx;
					}
					.info-box{
						display: flex;
						flex-direction: column;
						align-items: flex-end;
						.chat-text{
							background: #4BC9B1;
							color: #FFFFFF;
							border-radius: 20upx 0 20upx 20upx;
						}
					}
				}
			}
			.chat-inner{
				display: flex;
				.head{
					flex-shrink: 0;
					width: 80upx;
					height: 80upx;
					border-radius: 50%;
					overflow: hidden;
					image{
						width: 100%;
						height: 100%;
					}
				}
				.info-box{
					flex: 1;
					.name{
						font-size: 28upx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #666666;
						line-height: 1;
					}
					.chat-text{
						box-sizing: border-box;
						max-width: 88%;
						padding: 20upx 26upx;
						background: #FFFFFF;
						border-radius: 0 20upx 20upx 20upx;
						margin-top: 20upx;
						font-size: 32upx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #111111;
						line-height: 50upx;
					}
				}
			}
		}
		.bottom-input-cont{
			width: 100%;
			z-index: 99;
			position: fixed;
			left: 0;
			bottom: 0;
			background: #fff;
			.inner{
				padding: 20upx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.voice{
					flex-shrink: 0;
					width: 54upx;
					height: 54upx;
				}
				.input-box{
					flex-shrink: 0;
					width: 63.73%;
					height: 80upx;
					background: #F2F2F2;
					border-radius: 40upx;
					padding: 0 30upx;
					display: flex;
					align-items: center;
					input{
						width: 100%;
						height: 80upx;
						font-size: 28upx;
						font-family: PingFang SC;
						font-weight: 500;
					}
					.place-hold{
						font-size: 28upx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #999999;
					}
				}
				.expression{
					flex-shrink: 0;
					width: 54upx;
					height: 54upx;
				}
				.add{
					flex-shrink: 0;
					width: 54upx;
					height: 54upx;
				}
			}
		}
	}
</style>
