<template>
	<view class="container">
		<!-- 评价状态区域 -->
		<view class="status">
			<img v-if="status === '1'" src="../../static/index/success.png" />
			<img v-if="status === '2'" src="../../static/index/fail.png" />
			<view class="status_msg">{{ msg }}</view>
			<view class="status_btn" @click="handleClickBtn">{{ btnMsg }}</view>
		</view>

		<!-- 民宿信息区域 -->
		<view class="info">
			<img mode="aspectFill" src="https://img1.baidu.com/it/u=4085584268,3308739054&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=375" />
			<view class="info_name">
				<view class="top">民宿名称</view>
				<view class="bottom">500人收藏</view>
			</view>
			<view class="info_btn">收藏</view>
		</view>

		<!-- 订单列表区域 -->
		<view class="body">
			<!-- 每一个订单区域 -->
			<view class="body_box">
				<!-- 标题区域 -->
				<view class="box_header">
					<img class="img" src="../../static/my/hotel.png" />
					<view class="title">民宿名称</view>
					<view class="type">已消费</view>
				</view>

				<!-- 酒店信息区域 -->
				<view class="box_info">
					<img class="img" mode="aspectFill" src="https://img1.baidu.com/it/u=4085584268,3308739054&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=375" />
					<view class="info_right">
						<view class="info_right_item">1间，大床房</view>
						<view class="info_right_item">2023-07-26 - 2023-07-27</view>
						<view class="info_right_item">总价：¥666</view>
					</view>
				</view>

				<!-- 按钮区域 -->
				<view class="box_btn">
					<view class="btn_item" @click="handleEvaluate">去评价</view>
				</view>
			</view>
			<view class="body_box">
				<!-- 标题区域 -->
				<view class="box_header">
					<img class="img" src="../../static/my/hotel.png" />
					<view class="title">民宿名称</view>
					<view class="type">已消费</view>
				</view>

				<!-- 酒店信息区域 -->
				<view class="box_info">
					<img class="img" mode="aspectFill" src="https://img1.baidu.com/it/u=4085584268,3308739054&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=375" />
					<view class="info_right">
						<view class="info_right_item">1间，大床房</view>
						<view class="info_right_item">2023-07-26 - 2023-07-27</view>
						<view class="info_right_item">总价：¥666</view>
					</view>
				</view>

				<!-- 按钮区域 -->
				<view class="box_btn">
					<view class="btn_item" @click="handleEvaluate">去评价</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			// 评价是否成功 1成功 2失败
			status: null,
			// 评价状态信息
			msg: '',
			// 按钮文字信息
			btnMsg: ''
		}
	},
	onLoad(options) {
		// console.log(options)
		this.status = options.status
		if (this.status === '1') {
			uni.setNavigationBarTitle({
				title: '评价成功'
			})
			this.msg = '评价成功'
			this.btnMsg = '查看我的评价'
		} else {
			uni.setNavigationBarTitle({
				title: '评价失败'
			})
			this.msg = '评价失败'
			this.btnMsg = '重新评价'
		}
	},
	methods: {
		// 点击按钮回调
		handleClickBtn() {
			if (this.status === '1') {
				uni.navigateTo({
					url: '/pages/myEvaluate/myEvaluate'
				})
			} else {
				uni.navigateBack(1)
			}
		}
	}
}
</script>

<style lang="scss" scoped>
.container {
	min-height: 100vh;
	background-color: #f7f7f7;

	.status {
		display: flex;
		flex-direction: column;
		align-items: center;
		height: 554rpx;
		background-color: #fff;

		img {
			margin: 80rpx 0 40rpx;
			width: 134rpx;
			height: 134rpx;
		}

		.status_msg {
			font-size: 32rpx;
		}

		.status_btn {
			display: flex;
			justify-content: center;
			align-items: center;
			margin-top: 87rpx;
			width: 330rpx;
			height: 84rpx;
			color: #fff;
			font-size: 28rpx;
			border-radius: 22rpx;
			background-color: #096562;
		}
	}

	.info {
		display: flex;
		align-items: center;
		margin: 20rpx 0;
		padding: 0 30rpx;
		height: 144rpx;
		background-color: #fff;

		img {
			width: 80rpx;
			height: 80rpx;
			border-radius: 9rpx;
		}

		.info_name {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			margin-left: 24rpx;
			height: 80rpx;

			.top {
				font-weight: bold;
				font-size: 32rpx;
			}
			.bottom {
				color: #a6a6a6;
				font-size: 24rpx;
			}
		}

		.info_btn {
			display: flex;
			justify-content: center;
			align-items: center;
			margin-left: auto;
			width: 137rpx;
			height: 71rpx;
			color: #fff;
			font-size: 28rpx;
			border-radius: 22rpx;
			background-color: #096562;
		}
	}

	.body {
		padding-bottom: 20rpx;

		.body_box {
			margin-top: 20rpx;
			box-sizing: border-box;
			padding: 0 40rpx;
			background-color: #fff;

			.box_header {
				display: flex;
				align-items: center;
				height: 94rpx;

				.img {
					width: 47rpx;
					height: 47rpx;
				}

				.title {
					margin-left: 16rpx;
					width: 350rpx;
					font-size: 32rpx;
					font-weight: bold;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
				}

				.type {
					display: flex;
					justify-content: flex-end;
					align-items: center;
					margin-left: auto;
					margin-right: 25rpx;
					width: 285rpx;
					color: #808080;
					font-size: 28rpx;
				}
			}

			.box_info {
				display: flex;
				height: 140rpx;

				.img {
					width: 100rpx;
					height: 100rpx;
					border-radius: 9rpx;
				}

				.info_right {
					display: flex;
					flex-direction: column;
					justify-content: space-around;
					margin-top: -5rpx;
					margin-left: 18rpx;
					height: 120rpx;
					color: #808080;
					font-size: 28rpx;

					.info_right_item {
						flex: 1;
					}
				}
			}

			.box_btn {
				display: flex;
				justify-content: flex-end;
				margin-top: -10rpx;
				height: 100rpx;

				.btn_item {
					display: flex;
					justify-content: center;
					align-items: center;
					margin-left: 20rpx;
					width: 178rpx;
					height: 68rpx;
					border-radius: 64rpx;
					color: #808080;
					font-size: 28rpx;
					border: 1rpx solid #808080;
				}
			}
		}
	}
}
</style>
