<template>
	<view style="height: 100vh;background: #F1F2F8;padding: 30rpx;">

		<view style="background-color: #ffffff;border-radius: 20rpx;padding:30rpx">
			<view style="display: flex;align-self: center;align-items: center;">
				<view style="width: 45%;">
					<image :src="info.detail.headimage" style="width: 280rpx; height: 200rpx;" mode="aspectFill">
					</image>
				</view>
				<view style="padding-left: 20rpx;">
					<view style="font-size: 36rpx;font-weight: 600;">{{info.detail.title}}</view>
				<!-- 	<view style="font-size: 26rpx;color: #7A7A7A;margin-top: 20rpx;">
						日期：{{info.detail.classes_date_text}}</view> -->
						<view style="font-size: 26rpx;color: #7A7A7A;margin-top: 20rpx;"  @click.stop="callPhone(info.user.mobile)">
							课程联系人：{{mobile}}</view>
					<view style="font-size: 26rpx;color: #7A7A7A;margin-top: 5rpx;">地址：{{info.detail.address}}</view>
				</view>
			</view>
			<view style="height: 1px;width: 70%;background: #D9D9D9;margin: 65rpx auto;"></view>
			<view class="item-spacing" style="display: flex; justify-content: space-between; font-size: 26rpx;">
				<view style="color: #7A7A7A;">课时名称</view>
				<view style="color: #343434;">{{info.name}}</view>
			</view>
			<view class="item-spacing" style="display: flex; justify-content: space-between; font-size: 26rpx;">
				<view style="color: #7A7A7A;">订单号</view>
				<view style="color: #343434;">{{info.order_no}}</view>
			</view>
			<view class="item-spacing" style="display: flex; justify-content: space-between; font-size: 26rpx;">
				<view style="color: #7A7A7A;">开始时间</view>
				<view style="color: #343434;">{{info.start_time_text}}</view>
			</view>
			<view class="item-spacing" style="display: flex; justify-content: space-between; font-size: 26rpx;">
				<view style="color: #7A7A7A;">结束时间</view>
				<view style="color: #343434;">{{info.end_time_text}}</view>
			</view>
			<view class="item-spacing" style="display: flex; justify-content: space-between; font-size: 26rpx;">
				<view style="color: #7A7A7A;">预约人数</view>
				<view style="color: #343434;">{{info.detail.limit_num}}</view>
			</view>
			<view class="item-spacing" style="display: flex; justify-content: space-between; font-size: 26rpx;">
				<view style="color: #7A7A7A;">预约时间</view>
				<view style="color: #343434;">{{info.reservation_time_text}}</view>
			</view>
			<view class="item-spacing" style="display: flex; justify-content: space-between; font-size: 26rpx;">
				<view style="color: #7A7A7A;">当前状态</view>
				<view v-if="info.status==-1" style="color: #008CFF;">审核中</view>
				<view v-if="info.status==0" style="color: #34DC12;">已预约</view>
				<view v-if="info.status==3" style="color: #000000;">已完成</view>
				<view v-if="info.status==-3 && info.reason!=''" style="color: #FF6D6D;">未通过</view>
				<view v-if="info.status==-3 && info.reason==''" style="color: #FF6D6D;">已取消</view>
			</view>
			<view v-if="info.status==-3&& info.reason!=''" class=" item-spacing"
				style="display: flex; justify-content: space-between; font-size: 26rpx;">
				<view style="color: #7A7A7A;">原因</view>
				<view style="color: #FF6D6D;">{{info.reason}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	// import indexBackgroundImage from "@/static/center/firstBack.png"
	export default {
		data() {
			return {
				id: 0,
				info: {},
				mobile:''
			};
		},
		onLoad(options) {
			this.id = options.id
			this.getMyinfo();
		},

		methods: {
			callPhone(phone) {
				uni.makePhoneCall({
					phoneNumber: phone
				})
			},
			getMyinfo() {
				uni.$u.http.get('/api/school/hour_order/detail', {
					params: {
						id: this.id,
					}
				}).then(res => {
					console.log(res.data.detail);
					if (res.code == 1) {
						this.info = res.data.detail;
						this.mobile = this.info.user.mobile.slice(0, 3) + 'XXXX' + this.info.user.mobile.slice(7);
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						})
					}
				}).catch(error => {

				});
			},
		},
	}
</script>

<style lang="scss" scoped>
	.item-spacing {
		padding-bottom: 30rpx;
	}
</style>