<template>
	<view class="app">
		<!-- v-if="list.trainingOrderStatus=='WAIT_PAY'" -->
		<view class="time" style="">
			剩余付款时间：
			<u-count-down :timestamp="timestamp"></u-count-down>
		</view>
		<view class="trainingOrderStatus"
			v-if="list.trainingOrderStatus=='REFUNDED'||list.trainingOrderStatus=='CANCEL'">
			订单已关闭
		</view>
		<view class="content">
			<view class="details">
				<view class="detailslist">
					<image :src="baseurl+list.trainingItemCoverUrl" mode=""></image>
					<view class="model">
						<span>{{list.trainingItemTitle}}</span>
					</view>
				</view>
				<view class="payinfo">
					<text class="pay">实付款</text>
					<text class="price" v-if="list.trainingItemPrice">￥{{list.trainingItemPrice}}</text>
					<text class="price" v-else>￥0</text>
				</view>
			</view>
		</view>
		<view class="info">
			<span>护理人员：<text>{{list.nursePersonName}}</text></span>
			<!-- <span>联系电话：<text>{{list.phone}}</text></span> -->
			<span>订单编号：<text>{{list.trainingOrderNo}}</text></span>
			<!-- <span>下单时间：<text>{{list.orderTime}}</text></span> -->
		</view>
		<!-- v-if="list.trainingOrderStatus == 'WAIT_PAY'" -->
		<view class="buy" @tap='pay'>
			<view class="pay">
				去支付
			</view>
		</view>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import baseurl from '@/api/baseurl.js'
	export default {
		data() {
			return {
				baseurl: undefined,
				list: {},
				timestamp: 0,
			};
		},
		onLoad(options) {
			this.baseurl = baseurl
			this.list = JSON.parse(options.list)
			// var ordertimes = this.list.orderTime.replaceAll(/\-/gi, "/")
			// var time = new Date(ordertimes).getTime() / 1000 + (60 * 60 * 2)
			// var times = new Date().getTime() / 1000
			// this.timestamp = time - times
			console.log(this.list)
		}
	}
</script>

<style lang="scss">
	.app {
		padding: 0;

		.buy {
			background: #FFFFFF;
			position: fixed;
			bottom: 0;
			height: 100rpx;
			width: 100%;

			.logistics {
				width: 216rpx;
				height: 68rpx;
				text-align: center;
				color: #ffffff;
				border-radius: 26rpx;
				font-size: 36rpx;
				line-height: 68rpx;
				position: absolute;
				right: 260rpx;
				top: 50%;
				background: #E1AE3C;
				transform: translateY(-50%);
				z-index: 999;
			}

			.pay {
				width: 216rpx;
				height: 68rpx;
				text-align: center;
				color: #ffffff;
				background: #4C7BC9;
				border-radius: 26rpx;
				font-size: 36rpx;
				line-height: 68rpx;
				position: absolute;
				right: 20rpx;
				top: 50%;
				transform: translateY(-50%);
			}
		}

		.info {
			padding: 30rpx 0;
			height: 40%;
			background: #FFFFFF;
			box-shadow: 0px 9px 31px 9px rgba(0, 0, 0, 0.03);
			border-radius: 20rpx;
			width: 95%;
			margin: 0 auto;
			font-size: 30rpx;
			color: #020000;

			span {
				display: block;
				line-height: 65rpx;
				margin-left: 20rpx;

				text {
					color: #BFBDBE;
					word-break: break-all;
				}
			}
		}

		.content {
			width: 95%;
			background: #FFFFFF;
			box-shadow: 0px 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
			border-radius: 20rpx;
			margin: 30rpx auto;
			position: relative;

			.details {
				height: 380rpx;
				position: relative;

				.detailslist {
					display: flex;

					image {
						width: 182rpx;
						height: 182rpx;
						margin: 20rpx 0 0 20rpx;
					}

					.model {
						width: 70%;
						margin: 30rpx 0 0 20rpx;

						span {
							font-size: 32rpx;
							color: #000000;
						}

						span:nth-child(1) {
							display: inline-block;
							overflow: hidden;
							text-overflow: ellipsis;
							white-space: nowrap;
							width: 95%;
						}
					}
				}

				.payinfo {
					width: 95%;
					position: absolute;
					left: 2.5%;
					bottom: 20rpx;

					.pay {
						font-size: 30rpx;
						color: #020000;
					}

					.price {
						float: right;
						font-size: 41rpx;
						color: #D43953;
						margin-right: 10rpx;
					}
				}
			}
		}

		.time {
			height: 80rpx;
			width: 95%;
			text-align: center;
			line-height: 80rpx;
			background-color: #fff;
			margin: 30rpx auto 0;
			border-radius: 20rpx;
		}
	}
</style>
