<template>
	<view class="house-list">
		<view class="house-item" v-for="(item,index) in houseList" :key="index">
			<view class="house-item-box">
				<view class="house-item-img">
					<image :src="item.privewImage" mode="aspectFill"></image>
					<view class="house-item-floor">
						<uni-icons type="location" color="#fff" size="12"></uni-icons>
						<text>{{item.projectItemName}}-{{item.projectItemTargetName}}</text>
					</view>
				</view>
				<view class="house-item-info">
					<view class="house-item-name">{{item.name}}</view>
					<view class="house-item-tag">
						<text v-for="(tag,i) in item.tagList" :key="i">
							<text>{{tag}}</text>
							<text class="line" v-if="i < item.tagList.length-1">|</text>
						</text>
					</view>
					<view class="house-item-price">
						<text>{{item.price}}</text>
						<view class="price-type">{{item.priceType}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'houseList',
		data() {
			return {
				houseList: [{
					privewImage: 'https://file-node.oss-cn-shanghai.aliyuncs.com/youji/3556e2b4f9c844758c3af76407b3a5d5',
					projectItemName: '一号楼',
					projectItemTargetName: '一层',
					name: '1602，可短租～',
					tagList: ['标签1', '标签2', '标签3'],
					price: '1200',
					priceType: '元/月'
				}, {
					privewImage: 'https://file-node.oss-cn-shanghai.aliyuncs.com/youji/3556e2b4f9c844758c3af76407b3a5d5',
					projectItemName: '一号楼',
					projectItemTargetName: '一层',
					name: '1602，可短租～',
					tagList: ['标签1', '标签2', '标签3'],
					price: '1200',
					priceType: '元/月'
				}, {
					privewImage: 'https://file-node.oss-cn-shanghai.aliyuncs.com/youji/3556e2b4f9c844758c3af76407b3a5d5',
					projectItemName: '一号楼',
					projectItemTargetName: '一层',
					name: '1602，可短租～',
					tagList: ['标签1', '标签2', '标签3'],
					price: '1200',
					priceType: '元/月'
				}, {
					privewImage: 'https://file-node.oss-cn-shanghai.aliyuncs.com/youji/3556e2b4f9c844758c3af76407b3a5d5',
					projectItemName: '一号楼',
					projectItemTargetName: '一层',
					name: '1602，可短租～',
					tagList: ['标签1', '标签2', '标签3'],
					price: '1200',
					priceType: '元/月'
				}, {
					privewImage: 'https://file-node.oss-cn-shanghai.aliyuncs.com/youji/3556e2b4f9c844758c3af76407b3a5d5',
					projectItemName: '一号楼',
					projectItemTargetName: '一层',
					name: '1602，可短租～',
					tagList: ['标签1', '标签2', '标签3'],
					price: '1200',
					priceType: '元/月'
				}, {
					privewImage: 'https://file-node.oss-cn-shanghai.aliyuncs.com/youji/3556e2b4f9c844758c3af76407b3a5d5',
					projectItemName: '一号楼',
					projectItemTargetName: '一层',
					name: '1602，可短租～',
					tagList: ['标签1', '标签2', '标签3'],
					price: '1200',
					priceType: '元/月'
				}, {
					privewImage: 'https://file-node.oss-cn-shanghai.aliyuncs.com/youji/3556e2b4f9c844758c3af76407b3a5d5',
					projectItemName: '一号楼',
					projectItemTargetName: '一层',
					name: '1602，可短租～',
					tagList: ['标签1', '标签2', '标签3'],
					price: '1200',
					priceType: '元/月'
				}, {
					privewImage: 'https://file-node.oss-cn-shanghai.aliyuncs.com/youji/3556e2b4f9c844758c3af76407b3a5d5',
					projectItemName: '一号楼',
					projectItemTargetName: '一层',
					name: '1602，可短租～',
					tagList: ['标签1', '标签2', '标签3'],
					price: '1200',
					priceType: '元/月'
				}, {
					privewImage: 'https://file-node.oss-cn-shanghai.aliyuncs.com/youji/3556e2b4f9c844758c3af76407b3a5d5',
					projectItemName: '一号楼',
					projectItemTargetName: '一层',
					name: '1602，可短租～',
					tagList: ['标签1', '标签2', '标签3'],
					price: '1200',
					priceType: '元/月'
				}]
			}
		},
		onShow() {

		},
		onLoad() {

		}
	}
</script>

<style lang="scss">
	.house-list {
		display: flex;
		flex-wrap: wrap;
		margin-top: 30rpx;
		padding-bottom: 60rpx;

		.house-item {
			width: 50%;
			box-sizing: border-box;
			margin-bottom: 30rpx;

			&:nth-child(2n-1) {
				padding-right: 16rpx;
			}

			&:nth-child(2n) {
				padding-left: 16rpx;
			}

			.house-item-box {
				background: $uni-white;
				border-radius: 16rpx;
				overflow: hidden;

				.house-item-img {
					position: relative;

					image {
						width: 100%;
						height: 260rpx !important;
					}
				}

				.house-item-floor {
					position: absolute;
					left: 0;
					bottom: 20rpx;
					width: 100%;
					color: #FFFFFF;
					font-size: 24rpx;
					display: flex;
					align-items: center;
					padding-left: 10rpx;
				}

				.house-item-info {
					padding: 10rpx 0 20rpx 0;

					.house-item-name {
						font-size: 28rpx;
						padding: 0 20rpx;
					}

					.house-item-tag {
						display: flex;
						padding-top: 10rpx;
						padding-left: 20rpx;
						color: $uni-extra-color;

						text {
							font-size: 24rpx;
						}

						.line {
							margin: 0 10rpx;
						}
					}

					.house-item-price {
						display: flex;
						align-items: center;
						padding-top: 6rpx;
						color: $uni-error;
						padding-left: 20rpx;

						text {
							font-weight: bold;
							font-size: 30rpx;
						}

						.price-type {
							display: inline-block;
							font-size: 24rpx;
							scale: 0.9;
						}
					}
				}
			}
		}
	}
</style>