<template>
	<view class="page" :style="{'height':(h-th)+'px','padding-top':mt+'px'}">
			<c-nav-bar title="房型列表" :showIcon="false" :titleStyle="titleStyle"></c-nav-bar>
			<!-- 房型数量 -->
			<view class="typeNum">
					<text style="font-size: 24rpx; color: #777;">共{{roomType.length}}个房型</text>
			</view>
			<!-- 房型选择 -->
			<view class="type" v-for="item in roomType" :key="item.houseBaseId" @click="goEditTypeInfo(item.houseBaseId)">
				<view class="top">
					<text style="font-size: 30rpx; color: #333;" >{{item.name}}</text>
					<u-icon name="arrow-right"></u-icon>
				</view>
				<view class="under">
					<text style="font-size: 24rpx; color: #777;">大床房</text>
					<text style="font-size: 24rpx; color: #777;">{{item.roomCount}}间</text>
				</view>
				
			</view>
		
			<!-- 新增按钮 -->
			<view class="btn" @click="addType(id)">
				新增			
			</view>
		</view>
</template>

<script>
	export default {
		data(){
			return {
				homestayId:this.$store.state.moduleHouse.homestayId,
				roomType:[]
			}
		},
		onLoad(){
			// console.log(this.homestayId)
			this.getHomestayId()
		},
		methods:{
			// 获取房型列表信息
			getHomestayId(){
			
				
				this.$api.get(`/merchant/hotel/mine/getHouseBaseList/${this.homestayId}`,{
					homestayId:this.homestayId
				}).then((res)=>{
					// console.log(res)
					this.roomType=res.data.data
					
					// let roomSymbleName=this.roomType.name
					// console.log(roomSymbleName)
					// console.log(this.roomType)
				})
			},
			// 新增房型
			addType(id){
				uni.navigateTo({
					url:`/pages/my/houseList?id=${this.homestayId}`
				})
			},
			// 修改房型信息
			goEditTypeInfo(houseBaseId){
				uni.navigateTo({
					url:`/pages/my/houseList?houseBaseId=${houseBaseId}`
				})
				// console.log(houseBaseId)
			}
		}
	}
</script>

<style lang="scss">
	.page {
		background: #F3F4F4;
		padding-bottom: 260rpx;
		box-sizing: border-box;
		overflow-y: auto;
		overflow-x: auto;
	}
	.typeNum{
		width: 100%;
		height: 73rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.type{
		margin: 0 auto;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		width: 86%;
		height: 155rpx;
		background-color: #fff;
		padding: 30rpx;
		margin-bottom: 20rpx;
	}
	.top{
		display: flex;
		justify-content: space-between;
	}
	.under{
		margin-top: 40rpx;
		display: flex;
		justify-content: space-between;
	}
	.btn{
		width: 690rpx;
		height: 96rpx;
		background-color: #1372FF;
		color: #fff;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 34rpx;
		position: fixed;
		bottom: 40rpx;
		margin-top: 30rpx;
		margin-left: 30rpx;
		border-radius: 48rpx;
	}
</style>