<template>
	<view class="orderlist">
		<view class="orderbtn" @click="goScreenOrder">
			新增预约
		</view>
		<template  v-for="(item, index) in pageList">
			<view class="content"  :key="index">
				<view class="c_top" >
					<view class="c_right">
						<text>预约项目：{{ item.projectName }}</text>
						<text>预约时间：{{ item.applyStartTime ? item.applyStartTime.substring(0, 16) : '' + '-' + item.applyEndTime ?  item.applyEndTime.substring(10, 16) : '' }}</text>
						<text>预约机构：{{ item.hospitalName }}</text>
						<text>登记状态：
							<text v-if="item.screeningStatus < 3">未登记</text>
							<!-- <text v-if="item.screeningStatus == 2">取消预约</text> -->
							<text v-if="item.screeningStatus >= 3">已登记</text>
							<!-- <text v-else>已完成</text> -->
						</text>
						<view style="color:#333;margin-bottom: 30rpx;">
							预约状态：
							<uni-tag v-if="item.exceedStatus == '0'" text="生效中" size="mini" type="success" />
							<uni-tag v-if="item.exceedStatus == '1'" size="mini" text="已过期" />
						</view>
						<text v-if="item.registrationDate">登记时间：{{ item.registrationDate }}</text>
					</view>
					<image style="width: 100%;" :src="item.applyBarcode"></image>
				</view>
			</view>
		</template>
	</view>
</template>

<script>
	import {
		getOrderList
	} from '@/api/pagesB/orderlist/orderlist.js'
	export default {
		data() {
			return {
				pageList: {},
				patientId: "",
				userInfo: {},
				pageSize:10,
				pageNum:1,
			}
		},
		onLoad(e) {
			if (e) {
				this.userInfo = JSON.parse(e.userinfo)
			}
		},
		onShow() {
			this.getOrderList()
		},
		// onUnload() {
		// 	uni.navigateBack({
		// 		delta: 1
		// 	})
		// },
		methods: {
			getOrderList() {
				const value= uni.getStorageSync('userinfo');
				this.patientId =value.id
				getOrderList(this.patientId,this.pageNum,this.pageSize).then(res => {
					if (res.code == 200) {
						this.pageList = res.rows
					}
				})
			},
			goScreenOrder() {
				let userInfo = JSON.stringify(this.userInfo)
				console.log(userInfo,'999999')
				uni.navigateTo({
					url: `/pagesB/screenorder/screenorder?userInfo=${userInfo}`
				})

			},
			// goitemDetail(e) {
			// 	uni.navigateTo({
			// 		url: `../../pagesB/screensuccess/screensuccess?screenInfo=${encodeURIComponent(JSON.stringify(e))}`
			// 	})
			// }
		}
	}
</script>

<style lang="scss">
	.orderlist {
		padding: 20rpx 30rpx;

		.orderbtn {
			border: 2rpx solid #4AC4AB;
			border-radius: 10rpx;
			padding: 15rpx 0;
			color: #4AC4AB;
			text-align: center;
		}

		.content {
			padding: 20rpx;
			margin-top: 40rpx;
			border-radius: 20rpx;
			background: #fff;

			.c_top {

				// display: flex;
				image {
					// min-width: 220rpx;
					// max-width: 220rpx;
					// height: 220rpx;
					height: 160rpx;
				}

				.c_right {
					font-size: 28rpx;
					margin-left: 25rpx;
					display: flex;
					flex-direction: column;
					justify-content: center;

					text {
						// line-height: 75rpx;
						color: #333;
						margin-bottom: 30rpx;
					}
				}
			}
		}

		button {
			color: white;
			background: red;
		}
	}

	/deep/ .checklist-text {
		font-size: 15px !important;
	}

	/deep/ .uni-tag--success.data-v-1516016e,
	.uni-tag--mini.data-v-1516016e {
		color: #fff !important;
		border-radius: 10rpx !important;
	}
</style>
