<template>
	<div class="hui-detail">
		<div class="hui-detail-title">基础信息</div>
		<div class="hui-detail-content">
			<div class="hui-detail-item">
				<div class="hui-detail-label">楼宇名称</div>
				<div class="hui-detail-value">{{detail.projectItemName}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">楼层名称</div>
				<div class="hui-detail-value">{{detail.projectItemTargetName}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">推广名称</div>
				<div class="hui-detail-value">{{detail.name}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">房间号</div>
				<div class="hui-detail-value">{{detail.roomNumber}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">房源类型</div>
				<div class="hui-detail-value">{{$field.findTypeName('houseType',detail.roomTypeId)}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">房源单价</div>
				<div class="hui-detail-value">{{detail.price}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">付款类型</div>
				<div class="hui-detail-value">{{detail.payType === 0 ? '按月' : '按年'}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">房源面积</div>
				<div class="hui-detail-value">{{detail.area}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">付款方式</div>
				<div class="hui-detail-value">{{$field.findTypeName('payWay',detail.payWay)}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">产权证书</div>
				<div class="hui-detail-value">{{detail.propertyCertificateNumber}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">启用日期</div>
				<div class="hui-detail-value">{{detail.invocationDate}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">是否装修</div>
				<div class="hui-detail-value">{{detail.decoration === 1 ? '已装修':'未装修'}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">公开房源</div>
				<div class="hui-detail-value">{{detail.openState === 1 ? '公开':'不公开'}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">招商状态</div>
				<div class="hui-detail-value">{{detail.investmentState === 1 ? '已招商':'未招商'}}</div>
			</div>
		</div>
		<div v-if="detail.data && detail.data != '[]'">
			<div class="hui-detail-title">自定义信息</div>
			<div class="hui-detail-content">
				<div class="hui-detail-item" v-for="(item,index) in JSON.parse(detail.data)">
					<div class="hui-detail-label">{{item.keyName}}</div>
					<div class="hui-detail-value">{{item.value}}</div>
				</div>
			</div>
		</div>
		<div class="hui-detail-title">房源标签</div>
		<div class="hui-detail-content hui-detail-image">
			<tag ref="tag" type="look" :tagType="3" :tagActive="detail.tagIds ? detail.tagIds.split(',') : []">
			</tag>
		</div>
		<div class="hui-detail-title">列表展示照片</div>
		<div class="hui-detail-content hui-detail-image">
			<upload :list="detail.showPicture ? JSON.parse(detail.showPicture) : []" type="preview">
			</upload>
		</div>
		<div class="hui-detail-title">房源图片</div>
		<div class="hui-detail-content hui-detail-image">
			<upload :list="detail.picture ? JSON.parse(detail.picture) : []" type="preview">
			</upload>
		</div>
		<div class="hui-detail-title">房源视频</div>
		<div class="hui-detail-content hui-detail-image">
			<upload :list="detail.video ? JSON.parse(detail.video) : []" type="preview">
			</upload>
		</div>
	</div>
</template>

<script>
	import {
		getHouseDetailById
	} from '@/httpApi/space'
	import upload from '@/components/common/upload'
	import tag from '@/components/common/tag'
	export default {
		props: ['detailId'],
		data() {
			return {
				detail: {
					name: '', //房源名称
					roomNumber: '',
					roomState: '', //房源状态
					roomType: '', //房源类型
					area: '',
					price: '',
					payWay: 0,
					decoration: 0,
					investmentState: 0,
					invocationDate: '',
					openState: 0,
					propertyCertificateNumber: '',
					picture: '',
					tagIds: '',
					data: '',
					projectId: '',
					projectItemId: '',
					projectItemTargetId: ''
				},
				customData: []
			}
		},
		created() {
			if (this.detailId) this.init();
		},
		components: {
			upload,
			tag
		},
		methods: {
			init() {
				getHouseDetailById(this.detailId).then(res => {
					if (res.state) {
						this.detail = res.data;
						if (this.detail.data) {
							this.customData = JSON.parse(this.detail.data);
						}
					}
				})
			}
		},
	}
</script>
<style lang="scss">

</style>