Files
gterFang/src/components/indexWaterfallBox/indexWaterfallBox.vue
2024-03-12 17:51:50 +08:00

460 lines
14 KiB
Vue

<template>
<div class="item" v-if="itemData.type !== 'adv'" :class="{ 'waterfall-box-housing': itemData.type === 'housing' }" @click="watchInfo">
<div class="flexflex pos-r">
<img class="intermediary-type" v-if="itemData.isintermediary" src="@/assets/homeImage/intermediaryTabImg.png" />
<div class="box-tab-type" v-else-if="itemData.intermediarytext">
{{ itemData.intermediarytext }}
</div>
<!-- <div class="intermediary-type" v-if="itemData.isintermediary">
认证中介
</div> -->
<img class="apartment-img" v-lazy="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">
<div class="type" v-if="itemData.type === 'housing' && itemData.gptype">{{ itemData.gptype }}</div>
{{ 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 class="ellipsis" style="width: 272px; display: block;" 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; align-items: end;" class="rent-box dis-f" v-if="itemData.type === 'housing'">
<div class="unit">HK$</div>
<div class="price">{{ itemData.rent }}</div>
<div class="date">/</div>
</div>
<!-- <div class="title">
iRent油麻地二期公寓
</div> -->
<!-- <div class="info-text">
年轻有活力且超有玩趣的公寓
</div> -->
<div class="suite-box" v-if="itemData.type === 'apartment'">
<div v-for="(item, i) in itemData.specifications">
<div class="line" v-if="i > 0"></div>
<div class="dis-f al-item jus-bet">
<div class="suite-type">
{{ item.title }}
</div>
<div class="dis-f" style="align-items: end; line-height: 20px;">
<span class="unit">HK$</span>
<span class="price">{{ item.value }}</span>
<span class="date">/</span>
</div>
</div>
</div>
<!-- <div class="dis-f al-item jus-bet" v-if="itemData.specifications &&
itemData.specifications[1] && itemData.specifications[1].value">
<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">{{ .rentalperiod }}</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); margin: 0 -1px 0 0;" 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="{ 'no-click': !itemData.path && !itemData.url }" class="live-img item" v-if="itemData.type === 'adv'" alt="" @click="watchAdv" />
</template>
<script setup>
import { defineProps, reactive, watchEffect } from "vue"
import store from "../../store/index"
import { useRouter } from "vue-router"
const props = defineProps({
data: {
type: Object,
default: function () {
return {}
},
},
})
let itemData = props.data
let location = reactive({ data: {} })
location.data = store.state.indexData.config.location
let router = useRouter()
let watchInfo = () => {
window.open(`${document.location.origin}/${itemData.type === "apartment" ? "apartmentDetail" : "detail"}?${itemData.type == "apartment" ? "uniqid" : "id"}=${itemData.type == "apartment" ? itemData.id : itemData.uniqid}`)
// router.push({
// path: itemData.type === 'apartment' ? '/apartmentDetail' : '/detail',
// query: {
// // id: itemData.type=='apartment'?itemData.id:itemData.uniqid,
// [itemData.type == 'apartment' ? "uniqid" : "id"]: itemData.type == 'apartment' ? itemData.id : itemData.uniqid
// }
// })
}
let watchAdv = () => {
if (itemData.url) {
window.open(itemData.url)
} else {
if (!itemData.path) return
watchInfo()
}
}
watchEffect(() => {
itemData = props.data
})
</script>
<style scoped lang="less">
.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: 13px;
line-height: 19px;
}
.price {
font-family: "Arial-Black", "Arial Black", sans-serif;
font-weight: 900;
font-size: 20px;
color: #f95d5d;
margin-left: 3px;
line-height: 23px;
}
.date {
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
font-weight: 400;
font-style: normal;
font-size: 13px;
color: #555555;
margin-left: 3px;
}
.pd-b-10 {
padding-bottom: 10px;
}
.waterfall-box-housing {
border-radius: 16px 16px 16px 16px !important;
}
.no-click {
cursor: default !important;
}
.item:hover {
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
}
.item {
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;
transition: box-shadow linear 0.2s;
.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(90deg);
width: 33px;
height: 33px;
margin: 0 -1px 0 0;
}
}
.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;
word-wrap: break-word;
}
.rent-box {
line-height: 20px;
}
.address-text {
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
font-weight: 400;
font-style: normal;
font-size: 14px;
color: #555555;
}
.long-title {
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
font-weight: 400;
font-size: 15px;
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: 4px;
display: -webkit-box;
line-height: 28px;
.type {
width: 34px;
height: 20px;
// display: flex;
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
font-weight: 400;
font-style: normal;
font-size: 13px;
color: #ffffff;
text-align: center;
line-height: 20px;
background-color: rgba(51, 51, 51, 1);
display: inline-block;
// float: left;
border-radius: 5px;
margin-right: 10px;
margin-top: 4px;
}
}
.box-tab-type {
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
font-weight: 400;
font-style: normal;
font-size: 14px;
color: #ffffff;
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;
padding: 0 6px;
}
.intermediary-type {
position: absolute;
top: 15px;
right: 15px;
width: 85px;
height: 20px;
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
font-weight: 400;
font-style: normal;
font-size: 13px;
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: 14px;
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; */
min-height: 370px;
border-radius: 16px;
margin-bottom: 20px;
cursor: pointer;
}
.live-img:hover {
-moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
}
</style>