<template>
    <div class="goodsContent">
        <div class="goods" :style="{borderBottom:hasLine?'0.02rem solid #f2f4f5':''}" @click="goDetail" :class="[type==1?'goodsmini':'']">
            <template v-if="goodsInfo.houseImages">
                <div class="goodsImg" v-if="goodsInfo.houseImages.length>0" :style="{backgroundImage:'url('+goodsInfo.houseImages[0].imageUrl+')'}"></div>
            </template>

            <div class="goodsRight">
                <div class="title">{{goodsInfo.title}}</div>
                <div class="subTitle">{{goodsInfo.houseArea}}m² {{goodsInfo.housing_district}}</div>
                <div class="lable" v-if="type==0">
                    <div class="lable-item" v-for="item in goodsInfo.houseFeatures">{{item.name}}</div>
                </div>
                <div class="money">
                    <span>{{goodsInfo.price}}</span>
                    <small>元/月</small>
                </div>
            </div>

        </div>
        <div class="line" v-if="hasLine"></div>
    </div>

</template>
<script>
import { mapState } from "vuex";
export default {
    name: 'largeGoodsItem',
    props: {
        goodsInfo: {
            type: Object,
            default: {}
        },
        type: {
            type: Number,
            default: 0
        },
        hasLine: {
            type: Boolean,
            default: false
        }
    },
    data() {
        return {
            city: '上海市'
        }
    },
    created() {


    },
    computed: {
        ...mapState(["locationInfo"])
    },
    methods: {
        goDetail() {

            this.$router.push({
                name: 'houseDetail',
                query: {
                    id: this.goodsInfo.id
                },
                params: {
                    isNext: 1
                }
            })
        }
    }
}
</script>
<style lang="less" scoped>
.goodsContent {
    padding: 0 0.3rem;
}
.goods {
    display: flex;
    padding: 0.3rem 0;
    &.goodsmini {
        .goodsImg {
            width: 2rem;
            height: 1.5rem;
            min-width: 2rem;
        }
        .subTitle {
            margin-bottom: 0.36rem;
        }
        .money {
            font-size: 0.38rem;
        }
    }
}
.goodsImg {
    background-image: url(https://ke-image.ljcdn.com/rent-house-1/92b7541638b3b9d384be099eab31711c-1528275019493/7f8610df30329b36632edffbd1540f23.jpg.750x585.jpg);
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    width: 2.4rem;
    height: 1.8rem;
    border-radius: 0.08rem;
    min-width: 2.4rem;
    &.goodsminiImg {
        width: 2rem;
        height: 1.5rem;
        min-width: 2rem;
    }
}
.goodsRight {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-left: 0.2rem;
    overflow: hidden;
}
.title {
    font-size: 0.3rem;
    color: rgba(0, 0, 0, 1);
    line-height: 0.42rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: bold;
}
.money {
    font-weight: bold;
    font-size: 0.3rem;
    color: rgba(249, 93, 48, 1);
    line-height: 0.3rem;
    display: flex;
    align-items: flex-end;

    small {
        font-size: 0.2rem;
        font-weight: normal;
        color: rgba(153, 153, 153, 1);
        line-height: 0.28rem;
        margin-left: 0.04rem;
    }
}
.subTitle {
    font-size: 0.26rem;
    color: rgba(153, 153, 153, 1);
    line-height: 0.36rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lable {
    display: flex;
    overflow: hidden;
    flex-wrap: wrap;
    height: 0.32rem;
    .lable-item {
        height: 0.32rem;
        background: rgba(242, 244, 245, 1);
        border-radius: 0.04rem;
        line-height: 0.32rem;
        font-size: 0.22rem;
        color: rgba(21, 168, 170, 1);
        padding: 0 0.1rem;
        margin-right: 0.1rem;
    }
}
</style>


