<template>
	<view class="main">
		<view class="header-content">
			<image src="https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/img/mybanner.png" style="width:100%;height:260rpx;"></image>
		</view>
		<view class="pr" style="z-index:2">
			<view class="plr15">
				<view class="bdr4 pb20">
					<view class="m-dpflex m-justify-start m-align-center" style="height: 165rpx;">
						<image binderror="_binderror" mode="scaleToFill" :src="infodata.patient.avatar" style="width: 120rpx;height: 120rpx;border-radius: 50%;"></image>
						<text class="line1 f20 fb plr15 text-white">{{infodata.patient.name}}</text>
						<view class="pr tr m-flex">
							<navigator hoverClass="none" :url="'add_archives?info='+JSON.stringify(infodata.patient)">
								<u-icon name="arrow-right" color="#fff" size="36"></u-icon>
							</navigator>
						</view>
					</view>
					<view class=" header-box" style="padding: 0 8rpx;background-color: #fff;border-radius: 16rpx;">
						<view class="cu-list menu">
							<view class="cu-item arrow" @click="gotoupcard(infodata.patient)">
								<view class="content">
									<text class="text-grey">证件照</text>
								</view>
								<view class="action">
									<text v-if="infodata.patient.card_img_url==''" class="text-grey text-sm">未上传</text>
									<text v-else class="text-grey text-sm">已上传</text>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="fb f18 plr20" style="margin-bottom: 24rpx;" v-if="infodata.orders.cases.length!=0">病例信息</view>
		<view class="margin-lr-sm">
			<view class="margin-top-sm" v-for="(item,index) in infodata.orders.cases" :key="index" style="border-radius: 16rpx;box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);">
				<view class="flex justify-between align-center bg-white" style="padding: 28rpx;border-radius: 16rpx;">
					<view class="jinxing">
						<text style="display: inline-block;width: 12rpx;height: 12rpx;border-radius: 50%;background-color:#EEAA3F;margin-right: 8rpx;"></text>
						<text v-if="item.order_status==3">进行中</text>
						<text v-else-if="item.order_status==1">未支付</text>
						<text v-else-if="item.order_status==2">待接单</text>
						<text v-else-if="item.order_status==4">已完成</text>
						<text v-else>已取消</text>
					</view>
					<text class="phonezi" v-if="item.product_type==1">电话咨询</text>
					<text class="phonezi" v-else-if="item.product_type==2">图文咨询</text>
					<text class="phonezi" v-else-if="item.product_type==3">门诊预约</text>
					<text class="phonezi" v-else-if="item.product_type==4">疫苗接种预约</text>
					<text class="phonezi" v-else-if="item.product_type==5">儿保预约</text>
					<text class="phonezi" v-else-if="item.product_type==6">服务包</text>
				</view>
				<view class="" style="background: #FBFBFB;padding: 28rpx; border-radius: 16rpx;" v-if="item.product_type!=5">
					<view class="nametaile flex align-center">
						<text>{{item.docter.name}}</text>
						<text class="text_style" v-for="(itm,idx) in item.docter.label" :key="index">{{itm}}</text>
					</view>
					<view class="textstyle margin-top-xs">
						科室：<text style="color: #333333;">{{item.docter.office.name}} {{item.docter.qualification.name}}</text>
					</view>
					<view class="textstyle margin-top-xs">
						编号：<text style="color: #333333;">{{item.order_sn}}</text>
					</view>
					<view class="textstyle margin-top-xs">
						咨询时间：<text style="color: #333333;">{{item.created_at}}</text>
					</view>
				</view>
				<view class="" style="background: #FBFBFB;padding: 28rpx; border-radius: 16rpx;" v-else>
					<view class="nametaile flex align-center">
						<text>{{item.organization.docter[0].name}}</text>
						<text class="text_style" v-for="(itm,idx) in item.organization.docter[0].label" :key="index">{{itm}}</text>
					</view>
					<!-- <view class="textstyle margin-top-xs">
						科室：<text style="color: #333333;">{{item.docter.office.name}} {{item.docter.qualification.name}}</text>
					</view> -->
					<view class="textstyle margin-top-xs">
						编号：<text style="color: #333333;">{{item.order_sn}}</text>
					</view>
					<view class="textstyle margin-top-xs">
						咨询时间：<text style="color: #333333;">{{item.created_at}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="fb f18 plr20" style="margin-bottom: 24rpx;margin-top: 40rpx;" v-if="infodata.orders.service_packs.length!=0">服务包</view>
		<view style="width: 100vw;height: auto;background-color: #f6f6f6;">
			<view style="width: 100%;height: 100%;">
				<view v-for="(item,index) in infodata.orders.service_packs" :key="index">
					<view class="card flex justify-center">
						<view class="taocan" :data-id="item.order_pack.id" @click="details">
							<view class="tc_left">
								<text>{{item.order_pack.pack_name}}</text>
							</view>
							<view class="tc_right">
								<view style="width: 100%;">
									<view class="text">{{item.order_pack.pack_intro}}</view>
									<!-- <view class="text">{{item.desc}}</view> -->
									<view class="text">
										<text style="text-align: left;">时长:{{item.order_pack.effective_days}}天</text>
										<text style="float: right;color: #FF4F61;font-weight: bold;">¥{{item.order_pack.pack_price/100}}</text>
									</view>
								</view>
								<view class="margin-top-xs">
									剩余时长：<u-count-down v-if="true" color="#EEAA3F" separator="zh" :timestamp="item.order_pack.end_time-miao"></u-count-down><text
									 v-else>已结束</text>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<u-empty text="暂无数据" :show="show" mode="order" margin-top="300"></u-empty>
		<view class="cu-tabbar-height"></view>
		<view class="cu-tabbar-height"></view>
	</view>
</template>

<script>
	export default {
		onLoad(options) {
			this.id = options.id
		},
		onShow() {
			this.getarchivesInfo()
			this.miao = parseInt(new Date().getTime() / 1000)
		},
		mounted() {

		},
		data() {
			return {
				id: "",
				infodata: "",
				miao: "",
				show: false
			}
		},
		methods: {
			getarchivesInfo: async function() {
				let res = await this.$request.post("/api/v1/patient/patientDetail", {
					patient_id: this.id
				})
				console.log(res)
				if (res.status == 0) {
					this.infodata = res.data
				}
				if (this.infodata.orders.cases.length == 0 && this.infodata.orders.service_packs.length == 0) {
					this.show = true
				} else {
					this.show = false
				}
			},
			gotoupcard(item) {
				let imglist = [{
					url: item.card_img_url
				}, {
					url: item.card_back_img_url
				}]
				uni.navigateTo({
					url: "upcard?id=" + item.id + "&data=" + JSON.stringify(imglist)
				})
			}
		}
	};
</script>

<style scoped lang="scss">
	@import url("../index/mine.css");

	.main {}

	.text_style {
		font-weight: 400;
		margin-left: 15rpx;
		background-color: #E5F5FF;
		color: #0B73B9;
		width: 100rpx;
		height: 28rpx;
		font-size: 20rpx;
		border-radius: 10rpx;
		text-align: center;
		align-items: center;
	}

	.nametaile {
		font-size: 30rpx;
		font-weight: 500;
		color: #333333;
	}

	.textstyle {
		font-size: 26rpx;
		color: #666666;
		font-weight: 400;
	}

	.phonezi {
		width: 160rpx;
		height: 54rpx;
		background: #F6F6F6;
		border-radius: 27rpx;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #666666;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.jinxing {
		height: 30rpx;
		font-size: 30rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #EEAA3F;
		display: flex;
		align-items: center;
	}

	.header-content {
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		width: 100%;
		z-index: -1;
		overflow: hidden;
		box-sizing: border-box;
	}

	.header-box {
		box-shadow: 0px 8rpx 34rpx -6rpx rgba(248, 151, 164, 0.13);
	}

	.header-img {
		width: 36rpx;
		height: 36rpx;
	}

	.tip {
		position: absolute;
		top: 0;
		right: 20%;
		bottom: 0;
		background-color: red;
		width: 12rpx;
		height: 12rpx;
		border-radius: 50%;
	}

	.msg {
		top: -3rpx;
		right: -9rpx;
	}

	swiper {
		height: 320rpx;
	}

	.swiper-wrapper {
		padding: 0 10rpx;
		box-sizing: border-box;
	}

	.swiper-item {
		width: 100%;
		height: 300rpx;
		box-shadow: 0 26rpx 40rpx 0 rgba(255, 255, 255, 0.31);
		background: url("http://file.supermm.me/miniProgram/images/personal/bg_doc.png") no-repeat bottom center;
	}

	.dots {
		position: absolute;
		left: 0;
		right: 0;
		bottom: -40rpx;
		display: flex;
		justify-content: center;
	}

	.dots .dot {
		margin: 0 8rpx;
		width: 14rpx;
		height: 14rpx;
		background: #E4E4E4;
		border-radius: 8rpx;
		transition: all .6s;
	}

	.dots .dot.active {
		width: 24rpx;
		background: rgb(153, 153, 153);
	}

	.game-wrap {
		position: relative;
		width: 100%;
		height: 100%;
		overflow: hidden;
		box-sizing: border-box;
	}

	.game-item {
		height: 100%;
		background: url("https://file.supermm.me/h5/wechat-h5/integral/personeBg001.jpg") no-repeat;
		background-size: 100% 100%;
		background-position: center center;
		border-radius: 100rpx;
	}

	.card {
		width: 100%;
		height: auto;
		margin-top: 20rpx;

		// background-image: url(../../static/服务包.png);
		.taocan {
			width: 710rpx;
			height: 230rpx;
			position: relative;
			display: flex;
			border-radius: 10rpx;
			background: radial-gradient(circle at right top, transparent 15rpx, #ffffff 0) top left / 152rpx 51% no-repeat,
				radial-gradient(circle at right bottom, transparent 15rpx, #ffffff 0) bottom left /152rpx 51% no-repeat,
				radial-gradient(circle at left top, transparent 15rpx, #ffffff 0) top right /560rpx 51% no-repeat,
				radial-gradient(circle at left bottom, transparent 15rpx, #ffffff 0) bottom right /560rpx 51% no-repeat;
			filter: drop-shadow(0rpx 2rpx 12rpx 0rpx rgba(0, 0, 0, 0.04));
		}
	}

	.tc_left {
		display: flex;

		justify-content: center;
		align-items: center;
		width: 152rpx;

		text {
			font-size: 30rpx;
			font-weight: bold;
		}
	}

	.tc_right {
		display: flex;
		flex-direction: column;
		justify-content: center;
		width: 550rpx;
		padding: 0 20rpx;
		font-size: 26rpx;

		.text {
			padding: 10rpx 0rpx;
			width: 100%;
		}
	}
</style>
