<template>
	<view class="content">
		<!-- 背景图 -->
		<view class="index_bg">
			<view class="welcome"><image class="welcome_img" src="../../static/index/welcome.png"></image></view>
		</view>
		<!-- 第一层公寓名称卡片 -->
		<uni-card style="margin-top: -40px;margin-bottom:0px; width:660rpx;height: 254rpx;" title="墨轩湖姬子公寓（南昌交通学院）" sub-title="2021年装修 | 智能门锁 | 房间wifi | 免费停车" extra="设施/详情＞" @click="navigateToXiangqing">
			<text class="uni-body">宜春市靖安县北高速路口什么路899号</text>
			<image class="uni-phone" src="../../static/index/index_phone.svg"></image>
			<image class="uni-map" src="../../static/index/index_map.svg"></image>
			<br><text class="uni-body2">距离我520km</text>
		</uni-card>
		<!-- 第二层工具 -->
		<view class="item-list">
		  <view class="item-list-one" @click="navigateToXuzhi">
		    <image src="../../static/index/index_xuzhi.svg" class="img-btn"></image>
		    <text class="list-txt">入住须知</text>
		  </view>
		  <view class="item-list-one" @click="navigateToDairuzhu">
		    <image src="../../static/index/index_ruzhu.svg" class="img-btn"></image>
		    <text class="list-txt">办理入住</text>
		  </view>
		  <view class="item-list-one" @click="navigateToPay">
		    <image src="../../static/index/index_xuzhu.svg" class="img-btn"></image>
		    <text class="list-txt">办理续住</text>
		  </view>
		  <view class="item-list-one" @click="navigateToTuifang">
		    <image src="../../static/index/index_tuifang.svg" class="img-btn"></image>
		    <text class="list-txt">办理退房</text>
		  </view>
		</view>
		<!-- 第三层订房 -->
		<view class="room-list">
			<!-- 选择住房日期 -->
			<view class="select-time" @click="openCalendar">
				<view class="select-time-one">
				  <text class="select-list">周四入住</text>
				  <text class="select-list-time">07月21日</text>
				</view>
				<view class="select-center">
					<view class="select-line1"></view>
					<view class="select-circle">1晚</view>
					<view class="select-line2"></view>
				</view>
				<view class="select-time-one">
				  <text class="select-list">周五离店</text>
				  <text class="select-list-time">07月22日</text>
				</view>
				<uni-calendar ref="calendar" :selected="info.selected" class="uni-calendar--hook" :clear-date="true" :date="info.date" :insert="info.insert" :lunar="info.lunar" :startDate="info.startDate"
				:endDate="info.endDate" :range="info.range" @change="change" @confirm="confirm" @close="close"/>
			</view>
			<!-- 房型列表 -->
			<view class="room-kuang">
				<view class="room-xinxi" v-for="(item,index) in room" :key="index">
					<image class="room-image" src="../../static/index/room_image.svg" @click="inputDialogToggle"></image>
					<view class="room-name">{{item.name}}</view>
					<view class="room-mark">{{item.mark1}} {{item.mark2}} {{item.mark3}}</view>
					<view class="room-icon">
						<image src="../../static/index/index_wifi.svg" style="width: 30rpx;height: 30rpx;"></image>
						<image src="../../static/index/index_kongtiao.svg" style="width: 26rpx;height: 26rpx;margin-left: 10rpx;"></image>
						<image src="../../static/index/index_nosmoking.svg" style="width: 30rpx;height: 30rpx;margin-left: 10rpx;"></image>
						<image src="../../static/index/index_lock.svg" style="width: 30rpx;height: 30rpx;margin-left: 10rpx;"></image>
					</view>
					<view class="before-price"><strike>{{item.before_price}}</strike></view>
					<view class="room-price">{{item.price}}</view>
					<view class="room-button" @click="navigateToOrderRoom"><text>订</text></view>
					<view class="room-line"  v-if="index<(room.length-1)"></view>
				</view>
			</view>
			
		</view>
		<!-- 房间样式弹窗页面 -->
		<uni-popup ref="popup" type="dialog" :mask-click="false">
			<view class="popup_bg">
				<text class="popup_title">户型详情</text>
				<text class="popup_error" @click="popupClose"></text>
				<!-- 轮播图 -->
				<swiper class="swiper" circular :indicator-dots="indicatorDots">
					<swiper-item v-for="(item, index) in img" :key="index">
						<view class="swiper-item">
							<image :src="item.srcUrl" class="swiper-img"></image>
						</view>
					</swiper-item>
				</swiper>
				<text class="popup_title2">便利设施</text>
				<view class="popup_txt">尤其是刚上线的产品，很难通过产品的内部体系来实现快速的用户增长，所以会更加依赖于分享来达到广泛的传播，获取目标用户。
所以监听用户的截图操作，提示用户进行分享，既缩短了以前分享截...</view>
			</view>
			
		</uni-popup>
			
	</view>
</template>

<script>
	// 导入图片
	import room1 from '../../static/index/swiper_img1.svg'
	import room2 from '../../static/index/swiper_img1.svg'
	export default {
		data() {
			return {
				showCalendar: false,
				info: {
					lunar: true,
					range: true,
					insert: false,
					selected: []
				},
				room:[
					{id:1,room_img:({ url: "../../static/index/room_image.svg" }),name:'01户型',before_price:'¥419',price:'¥0.00',mark1:'22m',mark2:'无早',mark3:'大床'},
					{id:2,room_img:'url(../../static/index/index_bg.svg)',name:'02户型',before_price:'¥419',price:'¥0.00',mark1:'22m',mark2:'无早',mark3:'大床'},
					{id:3,room_img:({ url: "../../static/index/room_image.svg" }),name:'01户型',before_price:'¥419',price:'¥0.00',mark1:'22m',mark2:'无早',mark3:'大床'},
					{id:4,room_img:'url(../../static/index/index_bg.svg)',name:'02户型',before_price:'¥419',price:'¥0.00',mark1:'22m',mark2:'无早',mark3:'大床'},
				],
				indicatorDots: true,//滚动图片提示条默认出现
				img:[
					{
						value: '1',
						srcUrl:room1,
						name: '图1'
					},
					{
						value: '2',
						srcUrl:room2,
						name: '图2'
					},
				]
			}
		},
		onLoad() {
			
		},
		onReady() {
			this.$nextTick(() => {
				this.showCalendar = true
			})
			// TODO 模拟请求异步同步数据
			// setTimeout(() => {
			// 	this.info.date = getDate(new Date(),-30).fullDate
			// 	this.info.startDate = getDate(new Date(),-60).fullDate
			// 	this.info.endDate =  getDate(new Date(),30).fullDate
			// 	this.info.selected = [{
			// 			date: getDate(new Date(),-3).fullDate,
			// 			info: '打卡'
			// 		},
			// 		{
			// 			date: getDate(new Date(),-2).fullDate,
			// 			info: '签到',
			// 			data: {
			// 				custom: '自定义信息',
			// 				name: '自定义消息头'
			// 			}
			// 		},
			// 		{
			// 			date: getDate(new Date(),-1).fullDate,
			// 			info: '已打卡'
			// 		}
			// 	]
			// }, 2000)
		},
		methods: {
			// 跳转到入住须知
			navigateToXuzhi(){
				uni.navigateTo({
				  url: "../ruzhuxuzhi/ruzhuxuzhi",
				});
			},
			// 跳转到公寓详情
			navigateToXiangqing(){
				uni.navigateTo({
				  url: "../gongyuxiangqing/gongyuxiangqing",
				});
			},
			// 订房间 
			navigateToOrderRoom() {
				uni.navigateTo({
				  url: "../order_room/order_room",
				});
			},
			//办理入住跳转
			navigateToDairuzhu(){
				uni.navigateTo({
					url: "../my_orderlist/my_orderlist?Inv=2",
				})
			},
			//办理退房
			navigateToTuifang(){
				uni.navigateTo({
					url:"../my_orderlist/my_orderlist?Inv=3"
				})
			},
			//弹窗
			inputDialogToggle() {
				this.$refs.popup.open()
			},
			popupClose() {
				this.$refs.popup.close()
			},
			// 日期选择器弹窗
			openCalendar() {
				this.$refs.calendar.open()
			},
			close(){
				console.log('弹窗关闭');
			},
			confirm(e) {
				console.log('confirm 返回:', e)
				// 模拟动态打卡
				if (this.info.selected.length > 5) return
				this.info.selected.push({
					date: e.fulldate,
					info: '打卡'
				})
			},
		}
	}
</script>

<style>
	@import url("./css/index.css");
</style>
