<!-- 订单详情 -->
<template>
	<view class="orderdetail">
		<!-- <Header :title="title"></Header>
		<view class="" style="height: 94upx;"></view> -->
		<view class="order-detail-content">
			<view class="order-message">
				<view class="title">订单信息</view>
				<view class="ordername titlebar">产品名称：<text class="txt">{{orderMessage.goodsName }}</text></view>
				<view class="shopname titlebar">店铺名称：<text class="txt">{{orderMessage.shopName}}</text></view>
				<view class="waternum titlebar" v-if="orderMessage.outOrderNo">流水号：<text class="txt">{{orderMessage.outOrderNo}}</text></view>
				<view class="ordernum titlebar">订单号：<text class="txt">{{orderMessage.ordersNo}}</text></view>
				<view class="ordernum titlebar">支付时间：<text class="txt">{{orderMessage.payTime}}</text></view>
				<view class="phonenum titlebar">手机号：<text class="txt">{{orderMessage.buyPhone}}</text></view>
				<view class="price titlebar">产品价格：<text class="txt">{{orderMessage.price | doMoney}}</text></view>
				<view class="buynum titlebar">购买数量：<text class="txt">{{orderMessage.playManList.length}}</text></view>
				<view class="palytime titlebar">游玩时间：<text class="txt">{{ orderMessage.palyTime ? orderMessage.palyTime : '' }} {{ orderMessage.timePart ?orderMessage.timePart : ''}}</text></view>
				<view class="orderstatus titlebar">订单状态：<text class="txt">{{orderMessage.statusName}}</text> </view>
				<view class="tourist">
					<view class="title">游客信息</view>
					<view v-for="(item,index) in orderMessage.playManList" :key="index">
						<view class="name touristbar">姓名：<text class="txt">{{item.name}}</text></view>
						<view class="idcard touristbar">身份证：<text class="txt">{{item.idcard}}</text></view>
					</view>
				</view>
			</view>
			<view class="paymessage">
				<view class="title">支付信息</view>
				<view class="shoppric">产品价格:<text class="money">{{orderMessage.price | doMoney}}</text></view>
				<view class="realitypirc">实付金额:<text class="money">{{orderMessage.ordersPrice | doMoney}}</text></view>
			</view>
		</view>
		<rf-loading v-if="loading"></rf-loading>
	</view>
</template>

<script>
	import Header from '../components/header.vue';
	export default {
		components: {
			Header
		},
		data() {
			return {
				loading: true,
				title: '订单详情',
				orderMessage: {},
				ordernum: ''
			}
		},
		filters:{
			doMoney (val) {
				return `￥${(val / 100)}`
			}
		},
		onLoad() {
			this.ordernum = uni.getStorageSync('order')
			console.log(this.ordernum);
			this.getOrderDetail()
		},

		methods: {
			
			// 详情
			async getOrderDetail () {
				this.loading = true
				await this.$http.get('/orders/getOrdersByNo/'+this.ordernum).then(async (res)=>{
					console.log(res);
					if (res.code === 200) {
						if (res.data.palyTime.indexOf('00:00:00')) {
							res.data.palyTime.slice(0,10)
							res.data.palyTime = res.data.palyTime.slice(0,10);
						}
						this.loading = false
						this.orderMessage = res.data
					}
				}).catch(error=>{
					if (error === '该订单已失效！') {
						setTimeout(() => {
							this.$mRouter.back()
						}, 1000);
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.orderdetail {
		.order-detail-content {
			padding: 24upx 32upx 44upx;

			.order-message {
				background-color: #FFFFFF;
				padding: 31upx 33upx 35upx;
				border-radius: 17upx;

				.title {
					font-size: 34upx;
					color: #111111;
				}

				.titlebar {
					font-size: 28upx;
					color: #666666;
					letter-spacing: 2upx;
					margin-top: 12upx;

					.txt {
						margin-left: 10upx;
						font-size: 28upx;
					}
				}

				.ordername {
					margin-top: 15upx;
				}

				.orderstatus {
					height: 98upx;
					line-height: 98upx;
					border-top: 1px solid #e1e1e1;
					border-bottom: 1px solid #e1e1e1;
				}

				.tourist {
					.title {
						padding: 15upx 0;
						font-size: 34upx;
						color: #111111;
					}

					.touristbar {
						color: #666666;
					}

					.txt {
						margin-left: 10upx;
						font-size: 28upx;
					}
				}
			}

			.paymessage {
				background-color: #FFFFFF;
				padding: 31upx 33upx 35upx;
				border-radius: 17upx;
				margin-top: 24upx;

				.title {
					font-size: 34upx;
					color: #111111;
				}
				.shoppric {
					color: #666666;
					margin-top: 20upx;
					.money {
						margin-left: 10upx;
					}
				}

				.realitypirc {
					color: #666666;
					font-size: 28upx;
					margin-top: 20upx;
					border-top: 1upx solid #e1e1e1;
					padding-top: 20upx;
					.money {
						margin-left: 10upx;
						color: #fa4141;
					}
				}
			}
		}
	}
</style>