<template>
    <div>
        <div class="waterfall-box" v-if="itemData.type !== 'adv'"
            :class="{ 'waterfall-box-housing': itemData.type === 'housing' }">
            <div class="flexflex pos-r">
                <div class="box-tab-type" v-if="itemData.intermediarytext">
                    {{ itemData.intermediarytext }}
                </div>
                <div class="intermediary-type" v-if="itemData.isintermediary">
                    认证中介
                </div>
                <img class="apartment-img" :src="itemData.imageLocal || itemData.image"
                    v-if="itemData.type === 'housing' || itemData.type === 'apartment'" />
                <div class="authentication-box"
                    v-if="(itemData&&itemData.type === 'housing' && itemData&&itemData.verified) || (itemData&&itemData.type === 'apartment' &&itemData&& itemData.isintermediary)">
                    <img src="../../assets/homeImage/authenticationLogo.png" class="logo" alt="">
                    <img src="../../assets/homeImage/authenticationBg.svg" class="authentication-bg" alt="">
                    <img src="../../assets/homeImage/authenticationText.png" class="authentication-text" alt="">
                </div>
            </div>
            <div class="long-title">
                <span class="type" v-if="itemData.type === 'housing'">{{ itemData.gptype }}</span>{{ itemData&&itemData.title }}
            </div>
            <div class="type-tab">
                <span v-if="itemData.type === 'housing'">
                    {{ itemData.housingtype }}
                    {{ itemData.elevator === -1 || !itemData.elevator ? '' : `· ${itemData.elevator}` }}
                    {{ itemData.sunshinearea === -1 || !itemData.sunshinearea ? '' : `· ${itemData.sunshinearea}` }}
                    {{ `· ${itemData.gender}` }}
                    {{ itemData.leaseterm ? `· ${itemData.leaseterm}` : '' }}
                </span>
                <span v-if="itemData.type === 'apartment'">{{ itemData.propaganda }}</span>
            </div>
            <div style="padding: 0 10px;margin-top:15px;" class="dis-f al-item" v-if="itemData.type === 'housing'">
                <img src="../../assets/homeImage/addMarker.png" class="add-marker" alt="">
                <span class="address-text">{{ location.data&&location.data[itemData.location&&itemData.location.substring(0,1)] }} > {{ location.data&&location.data[itemData.location] }}</span>
            </div>
            <div style="padding:0 10px;margin-top:12px;" v-if="itemData.type === 'housing'">
                <span class="unit">{{ itemData.currency }}</span>
                <span class="price">{{ itemData.rent }}</span>
                <span class="date">/月</span>
            </div>
            <!-- <div class="title">
                iRent油麻地二期公寓
            </div> -->
            <!-- <div class="info-text">
                年轻有活力且超有玩趣的公寓
            </div> -->
            <div class="suite-box" v-if="itemData.type === 'apartment'">
                <div class="dis-f al-item jus-bet">
                    <div class="suite-type">
                        {{ itemData.specifications && itemData.specifications[0]&&itemData.specifications[0].title }}
                    </div>
                    <div>
                        <span class="unit">HK$</span>
                        <span class="price">{{ itemData.specifications && itemData.specifications[0]&&itemData.specifications[0].value }}</span>
                        <span class="date">/月</span>
                    </div>
                </div>
                <div class="line"></div>
                <div class="dis-f al-item jus-bet">
                    <div class="suite-type">
                        {{ itemData.specifications && itemData.specifications[1]&&itemData.specifications[1].title }}
                    </div>
                    <div>
                        <span class="unit">HK$</span>
                        <span class="price">{{ itemData.specifications && itemData.specifications[1]&&itemData.specifications[1].value }}</span>
                        <span class="date">/月</span>
                    </div>
                </div>
            </div>
            <div class="corner-box">
                <img src="../../assets/homeImage/corner.svg" v-if="itemData.type === 'housing'&&itemData.intermediary!==1" class="corner-img" alt="">
                <img src="../../assets/homeImage/intermediaryCorner.svg" v-if="itemData.type === 'housing'&&itemData.intermediary===1" style="transform: rotate(90deg);" class="tab-img" alt="">
            </div>
            <!-- <div class="apartment-price-more flexcenter">更多</div> -->

            <!-- <div class="color-scheme" style="background: #b3c7f4;"></div> -->
            <div class="apartment-top flexcenter" v-if="itemData.type === 'apartment'">
                <img class="apartment-bottom-icon" src="../../assets/homeImage/apartment-bottom.png" />
                <img class="apartment-icon" src="../../assets/homeImage/apartment-icon.png" />
                <img class="apartment-text" src="../../assets/homeImage/apartment-text.png" />
            </div>

            <!-- 广告 -->
        </div>
        <img :src="itemData.imageLocal || itemData.image" class="live-img" v-if="itemData.type === 'adv'" alt="">
    </div>
</template>
  
<script setup>
import { defineProps, reactive } from 'vue'
import store from '../../store/index';
const props = defineProps({
    data: {
        type: Object,
        default: function () {
            return {}
        }
    }
})
let itemData = props.data
let location=reactive({data:{}})
location.data=store.state.indexData.config.location

</script>
<style scoped>
.pos-r {
    position: relative;
}

.dis-f {
    display: flex;
}

.al-item {
    align-items: center;
}

.jus-bet {
    justify-content: space-between;
}

.unit {
    font-family: 'Arial-Black', 'Arial Black', sans-serif;
    font-weight: 900;
    color: #000000;
    font-size: 14px;
}

.price {
    font-family: 'Arial-Black', 'Arial Black', sans-serif;
    font-weight: 900;
    font-size: 20px;
    color: #F95D5D;
    margin-left: 3px;
}

.date {
    font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 14px;
    color: #555555;
    margin-left: 3px;
}

.pd-b-10 {
    padding-bottom: 10px;
}

.waterfall-box-housing {
    border-radius: 16px 16px 35px 16px !important;
}

.waterfall-box {
    width: 285px;
    background: inherit;
    background-color: rgba(255, 255, 255, 1);
    border: none;
    border-radius: 16px;
    -moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.0784313725490196);
    -webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.0784313725490196);
    box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.0784313725490196);
    margin-bottom: 20px;
    cursor: pointer;

    .authentication-box {
        width: 275px;
        height: 28px;
        border-radius: 0 0 16px 16px;
        position: absolute;
        bottom: 5px;
        left: 5px;
        display: flex;
        align-items: center;

        .logo {
            width: 16px;
            height: 16px;
            position: absolute;
            left: 10px;
        }

        .authentication-text {
            width: 72px;
            height: 16px;
            position: absolute;
            left: 30px;
        }

        .authentication-bg {
            width: 100%;
            height: 28px;
        }
    }

    .corner-box {
        display: flex;
        flex-direction: row-reverse;

        .corner-img {
            transform: rotate(91deg);
            width: 33px;
            height: 33px;
        }
    }

    .add-marker {
        width: 18px;
        height: 18px;
        margin-right: 5px;
    }

    .type-tab {
        font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
        font-weight: 400;
        font-style: normal;
        font-size: 14px;
        color: #AAAAAA;
        margin-top: 15px;
        padding: 0 10px;
    }

    .address-text {
        font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
        font-weight: 400;
        font-style: normal;
        font-size: 15px;
        color: #555555;
    }

    .long-title {
        font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
        font-weight: 400;
        font-style: normal;
        font-size: 18px;
        color: #000000;
        text-align: left;
        line-height: 25px;
        padding: 0 10px;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-all;
        margin-top: 8px;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;

        .type {
            width: 40px;
            height: 24px;
            display: flex;
            font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
            font-weight: 400;
            font-style: normal;
            font-size: 14px;
            color: #FFFFFF;
            text-align: center;
            line-height: 24px;
            background-color: rgba(51, 51, 51, 1);
            display: inline-block;
            float: left;
            border-radius: 5px;
            margin-right: 10px;
        }
    }

    .box-tab-type {
        font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
        font-weight: 400;
        font-style: normal;
        font-size: 14px;
        color: #FFFFFF;
        width: 54px;
        height: 24px;
        border-radius: 5px;
        position: absolute;
        top: 15px;
        right: 15px;
        background-color: rgba(51, 51, 51, 0.56078431372549);
        text-align: center;
        line-height: 24px;
    }

    .intermediary-type {
        position: absolute;
        top: 15px;
        right: 15px;
        width: 66px;
        height: 24px;
        font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
        font-weight: 400;
        font-style: normal;
        font-size: 14px;
        color: #FFFFFF;
        background: #6081d5;
        line-height: 24px;
        text-align: center;
        border-radius: 5px;
    }

    .title {
        font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
        font-weight: 400;
        font-style: normal;
        font-size: 18px;
        color: #000000;
        text-align: left;
        margin-top: 15px;
        padding: 0 15px;
    }

    .info-text {
        font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
        font-weight: 400;
        font-style: normal;
        font-size: 14px;
        color: #AAAAAA;
        text-align: left;
        padding: 0 15px;
        margin-top: 12px;
    }

    .suite-box {
        margin-top: 20px;
        padding: 0 15px;
        margin-bottom: 30px;

        .suite-type {
            font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
            font-weight: 400;
            font-style: normal;
            font-size: 15px;
            color: #000000;
            width: 120px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .line {
            height: 1px;
            background: #ebebeb;
            margin: 10px 0;
        }
    }
}

.apartment-top .apartment-icon {
    width: 20px;
    height: 20px;
    margin-right: 5px;
}

.apartment-top {
    border-radius: 0;
    height: 38px;
}

.apartment-text {
    width: 65px;
    height: 21px;
}

.apartment-img {
    width: 275px;
    height: 193px;
    border-radius: 10px;
    margin: 5px auto;
    object-fit: cover;
}

.apartment-top {
    background: none;
    position: relative;
}

.apartment-top .apartment-bottom-icon {
    width: 100%;
    position: absolute;
    bottom: -1px;
    left: 0;
}

.apartment-icon,
.apartment-text {
    z-index: 6;
}

.flexcenter {
    display: flex;
    justify-content: center;
    align-items: center;
}

.live-img {
    width: 285px;
    /* height: 349px; */
    border-radius: 16px;
    margin-bottom: 20px;
    cursor: pointer;
}

.live-img:hover {
    -moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.0784313725490196);
    -webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.0784313725490196);
    box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.0784313725490196);
}</style>
  