<template>
	<view class="app" v-if="list">
		<view class="top">
			<view class="title">
				患者信息
			</view>
			<view class="text">
				姓名：{{list.patientName}}
			</view>
			<view class="text">
				性别：{{list.sex}}
			</view>
			<view class="text">
				身份证号：{{list.cardNo}}
			</view>
			<view class="text">
				手机号码：{{list.phone}}
			</view>
			<view class="text">
				家庭住址：{{list.address}}
			</view>
		</view>
		<view class="center top">
			<view class="title">
				预约时间
			</view>
			<view class="time">
				{{list.appointmentDate}}{{' '+list.appointmentStartTime+'-'+list.appointmentEndTime}}
			</view>
		</view>
		<view class="bottom top">
			<view class="title">
				咨询内容
			</view>
			<view class="text-area">
				{{list.problemStatement}}
			</view>
		</view>
		<view class="fileimage top">
			<view class="title">
				检查单/患处照片
			</view>
			<view class="images" v-for='(item,index) in fileUrls'>
				<image :src="item" mode="" @click.stop='previewImage(index)'></image>
			</view>
		</view>
	</view>
</template>

<script>
	import baseurl from '@/api/baseurl.js'
	import {
		consultationInfo
	} from '@/api/taskDetails/index.js'
	import {
		getSex
	} from '@/utils/conversion.js'
	export default {
		data() {
			return {
				list: null,
				baseurl: null,
				fileUrls: [],
			};
		},
		onLoad(options) {
			this.baseurl = baseurl
			this.info(options.id)
		},
		methods: {
			previewImage(index) {
				uni.previewImage({
					urls: this.fileUrls,
					current: index,
					indicator: "default",
					loop: true
				})
			},
			info(id) {
				consultationInfo(id).then(res => {
					res.data.fileUrls.forEach(e => {
						e = this.baseurl + e
						this.fileUrls.push(e)
					})
					res.data.sex = getSex(res.data.cardNo)
					this.list = res.data
				})
			}
		}
	}
</script>

<style lang="scss">
	.app {
		.fileimage {
			.images {
				width: 90%;
				margin: 0 auto;
				display: flex;
				flex-wrap: wrap;
				justify-content: space-between;

				image {
					width: 100%;
				}
			}
		}

		.bottom {
			.text-area {
				width: 90%;
				margin: 30rpx auto;
				font-weight: 500;
				word-break: break-all;
			}
		}

		.center {
			.time {
				width: 90%;
				margin: 0 auto;
				height: 80rpx;
				line-height: 80rpx;
				background: #F7F9F8;
				margin-top: 20rpx;
				border-radius: 14rpx;
				font-size: 28rpx;
				font-weight: 500;
				color: #333333;
				padding-left: 20rpx;
			}
		}

		.title {
			width: 90%;
			height: 80rpx;
			line-height: 80rpx;
			margin: 0 auto;
			font-size: 28rpx;
			font-weight: 500;
			color: #333333;
			border-bottom: 2rpx solid #E6E6E6;
		}

		.top {
			width: 94%;
			margin: 0 auto;
			background-color: #fff;
			border-radius: 10rpx;
			margin-top: 20rpx;
			padding-bottom: 20rpx;

			.text {
				font-size: 24rpx;
				font-weight: 500;
				color: #333333;
				line-height: 60rpx;
				width: 90%;
				margin: 0 auto;
			}
		}
	}
</style>