<template>
    <div class="user-box shadow radius16 flexflex"> 
        <img class="user-img" :src="user.avatar">
        <div class="user-username">{{ user.nickname }}</div>
        <div class="housing-info-box">
            <div class="housing-info-top flexacenter">
                <div class="housing-info-location flexacenter">
                    <img class="housing-info-location-icon" src="@/assets/img/edit/location-icon.png" />
                    香港
                </div>
                <img v-if="userIntermediary" class="housing-info-certifying"
                    src="@/assets/img/publicImage/certifying-agent.png">
                <div v-else class="housing-info-identity flexcenter">{{ intermediaryObj[intermediary] }}</div>
            </div>
            <div class="housing-info-list" v-if="type != 'plus'">
                <div class="housing-info-item flexacenter" v-if="id">
                    <div class="housing-info-head flexcenter">房源ID</div>
                    <div class="longString"></div>
                    <div class="housing-info-trail">{{ id }}</div>
                </div>
                <div class="housing-info-item flexacenter">
                    <div class="housing-info-head flexcenter">状态</div>
                    <div class="longString"></div>
                    <div class="housing-info-trail">{{ stateObj[status < 0 ? -1 : status] }}</div>
                </div>
                <div class="housing-info-item flexacenter" v-if="status > 0">
                    <div class="housing-info-head flexcenter">发布</div>
                    <div class="longString"></div>
                    <div class="housing-info-trail">{{ time['timestamp'] }}</div>
                </div>
                <div class="housing-info-item flexacenter" v-if="status > 0">
                    <div class="housing-info-head flexcenter">更新</div>
                    <div class="longString"></div>
                    <div class="housing-info-trail">{{ time['updatetime'] }}</div>
                </div>
                <div class="housing-info-item flexacenter" v-if="status < 0">
                    <div class="housing-info-head flexcenter">下架</div>
                    <div class="longString"></div>
                    <div class="housing-info-trail">{{ time['offshelftime'] }}</div>
                </div>
            </div>
            <div class="listing-verified flexacenter" v-if="verified == 1">
                <img class="listing-verified-tick" src="@/assets/img/edit/tick.svg" />
                房源已认证
            </div>

            <div class="housing-info-amount flexcenter" v-if="status != 1">
                <div class="housing-hint flexacenter">您还可以发布 <div class="bold">{{ allowpublishednum }}</div>
                    条普通房源</div>
                <div class="learn-more-btn flexcenter" @click="$emit('handleAboutPopState')">了解更多 <img
                        class="learn-more-icon" src="@/assets/img/edit/learn-more-icon.svg" /></div>
            </div>
        </div>
    </div>
</template>

<script setup>
const props = defineProps({
    user: Object,
    time: Object,
    verified: Number,
    allowpublishednum: Number,
    id: Number,
    status: Number,
    intermediary: Number,
    userIntermediary: Number,
    type:String
});

let stateObj = {
    1: "已上架",
    0: "未发布",
    "-1": "已下架"
}

let intermediaryObj = {
    1: "中介",
    2: "非中介",
    3: "房东",
    4: "有房招室友",
    5: "其他",
    6: "求房源",
}
</script>

<style lang="less" scoped>
.user-box {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 320px;
    margin-right: 20px;
    background: #fff;
    border: 1px solid rgba(235, 235, 235, 1);
    padding: 40px 0 20px;

    .user-img {
        width: 64px;
        height: 64px;
        border-radius: 50%;
        margin-bottom: 10px;
    }

    .user-username {
        color: #555;
        font-size: 14px;
        margin-bottom: 30px;
    }

    .housing-info-box {
        width: 280px;
        background-color: rgba(246, 246, 246, 1);
        border-radius: 8px;

        .housing-info-top {
            justify-content: space-between;
            height: 83px;
            padding: 0 16px;

            .housing-info-location {
                color: #333;
                font-size: 24px;
                line-height: 30px;
                font-weight: 650;

                .housing-info-location-icon {
                    width: 24px;
                    height: 24px;
                    margin-right: 6px;
                }
            }

            .housing-info-certifying {
                width: 85px;
                height: 20px
            }

            .housing-info-identity {
                padding: 0 10px;
                height: 28px;
                border-radius: 42px;
                border: 1px solid rgba(215, 215, 215, 1);
                color: #555;
                font-size: 14px;
            }
        }

        .housing-info-list {
            border-top: 1px solid #ebebeb;
            font-size: 14px;
            padding: 30px 0;

            .housing-info-item {
                line-height: 24px;

                &:not(:last-of-type) {
                    margin-bottom: 12px;
                }

                .longString {
                    width: 1px;
                    height: 15px;
                    background-color: #aaaaaa;
                }

                .housing-info-head {
                    width: 75px;
                    color: #7F7F7F;
                }

                .housing-info-trail {
                    color: #333;
                    padding-left: 16px;
                }
            }

        }

        .listing-verified {
            width: 121px;
            height: 28px;
            border-radius: 42px;
            border: 1px solid rgba(215, 215, 215, 1);
            font-size: 14px;
            color: #555555;
            margin: 10px auto 50px;
            justify-content: space-evenly;

            .listing-verified-tick {
                width: 16px;
                height: 16px;
            }
        }

        .housing-info-amount {
            border-top: 1px solid #ebebeb;
            flex-direction: column;
            padding-top: 49px;
            padding-bottom: 47px;

            .housing-hint {
                color: #555;
                font-size: 14px;
                margin-bottom: 30px;

                .bold {
                    font-weight: 900;
                    color: #000;
                    margin: 0 5px;
                }
            }

            .learn-more-btn {
                width: 124px;
                height: 40px;
                border-radius: 62px;
                background-color: rgba(51, 51, 51, 1);
                font-size: 15px;
                color: #fff;
                font-weight: 400;
                cursor: pointer;

                .learn-more-icon {
                    width: 16px;
                    height: 16px;
                    margin-left: 8px;
                }
            }

        }



    }

}
</style>