<template>
	<view class="">
		<view @click="goDetail(item)"  class="data" v-for="(item, index) in list" :key="index">
			<view class="top">
				<view class="left">
					<view class="title">
						<u-icon name="fangjian" custom-prefix="custom-icon" size="30" color="#50baca"></u-icon>
						<text class="padding-left-20">房间名称：{{item.name}}</text>
						<!-- <text @click.stop="copy(item.name)" style="text-decoration: underline;" class="text-blue padding-left-20">复制</text> -->
					</view>
				</view>
			</view>
			<view class="item">
				<view class="left">
					<view style="padding: 0 30rpx;">
						<!-- <view class="content flex">
							<u-icon name="menpaihao" custom-prefix="custom-icon" size="30" color="#fdb524"></u-icon>
							<text class="text-bold  padding-left-10">门牌号：</text>
							<text>{{item.houseNumber}}</text>
						</view> -->
						<view  class="content flex">
							<u-icon name="xiaoqu" custom-prefix="custom-icon" size="30" color="#2fc500"></u-icon>
							<text class="text-bold padding-left-10">所属小区：</text>
							<text  v-text="item.residentialName?item.residentialName:'未知'"></text>
						</view>
						<view  class="content flex">
							<u-icon name="zhuhuzongshu" custom-prefix="custom-icon" size="30" color="#d4237a"></u-icon>
							<text class="text-bold padding-left-10">所属楼栋：</text>
							<text  v-text="item.buildingName" ></text>
						</view>
						<view  class="content flex">
							<u-icon name="danyuan" custom-prefix="custom-icon" size="30" color="#5ca8f0"></u-icon>
							<text class="text-bold padding-left-10">所属单元：</text>
							<text  v-text="item.unitName?item.unitName:'未知'" ></text>
						</view>
						<!-- <view  class="content flex">
							<u-icon name="zhuhuzongshu" custom-prefix="custom-icon" size="30" color="#d4237a"></u-icon>
							<text class="text-bold padding-left-10">住户总数：</text>
							<text class="text-bold" v-text="item.userNumber" ></text>
						</view> -->
					</view>
				</view>
			</view>
			<view class="bottom flex" >
				<view @click.stop="edit(item)" class="cu-btn  sm round line-blue" style="margin: 0 10rpx;">
					修改房间
				</view>
				<view @click.stop="delItem(item)" class="cu-btn  sm round bg-red" style="margin: 0 10rpx;">
					删除房间
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	name: 'card',
	props:{
		list:{
			type:Array,
			default:()=>{
				[]
			}
		}
	},
	data() {
		return {
			loading:false
		};
	},
	created() {
		
	},
	methods:{
		copy(data){
			uni.setClipboardData({
				data:data
			})
		},
		goDetail(item){
			uni.navigateTo({
				url:"/pages/room/detail?id="+item.id
			})
		},
		edit(item){
			uni.navigateTo({
				url:"/pages/room/add?id="+item.id
			})
		},
		delItem(item){
			this.$emit('delItem',item)
		}
	}
};
</script>

<style lang="scss">
.data {
	background-color: #ffffff;
	margin: 10rpx ;
	border-radius: 6rpx;
	box-sizing: border-box;
	padding: 20rpx 10rpx;
	font-size: 28rpx;
	.top {
		display: flex;
		justify-content: space-between;
		padding-bottom: 20rpx;
		border-bottom: 1rpx solid #dedede;
		.left {
			display: flex;
			align-items: center;
			.title {
				margin: 0 10rpx;
				font-size: 30rpx;
			}
		}
		.right{
			margin-right: 10rpx;
		}
	}
	.item {
		margin: 5rpx 0 20rpx 0;
		.content {
			border-bottom: 1rpx dashed #DDDDDD;
			padding: 30rpx 0;
		}
	}
	.bottom {
		display: flex;
		margin-top: 30rpx;
		justify-content: flex-end;
		align-items: center;
	}
}
</style>