123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561 |
- <template>
- <div class="home-detail">
- <div class="container">
- <div class="container-box" v-if="detail.id">
- <div class="title">{{detail.projectName}}</div>
- <div class="home-detail-content">
- <div class="home-detail-swiper">
- <div class="swiper-container">
- <div class="swiper-wrapper">
- <div v-for="item in swiperList" :key="item.id" class="swiper-slide"
- :style="`background-image:url(${item.url})`" @click.stop="openImage(item)">
- <div class="open-video-icon" v-if="item.fileType === 'video'"
- @click.stop="openVideo(item)">
- <i class="iconfont huifont-bofang"></i>
- </div>
- </div>
- </div>
- <div class="swiper-button-prev"></div>
- <div class="swiper-button-next"></div>
- </div>
- </div>
- <div class="home-detail-information">
- <div class="house-name">{{detail.name}}</div>
- <div class="tag">
- <span>{{detail.area}}m²</span>
- <span v-for="(tag,index) in detail.tagList" :key="index">{{tag.name}}</span>
- </div>
- <div class="house-price">
- <div>
- <span class="average alibaba">{{detail.price}}</span><span class="unit">元/月</span>
- </div>
- <div class="hui-button" @click="reservation">预约看房</div>
- </div>
- <div class="content-title">基本信息</div>
- <div class="information-list">
- <div class="information-box">
- <div class="information-title">所属楼宇:</div>
- <div class="information-div">{{detail.projectItemName}}</div>
- </div>
- <div class="information-box">
- <div class="information-title">所属楼层:</div>
- <div class="information-div">{{detail.projectItemTargetName}}</div>
- </div>
- <div class="information-box">
- <div class="information-title">房源类型:</div>
- <div class="information-div">{{$field.findTypeName('houseType',detail.roomTypeId)}}
- </div>
- </div>
- <div class="information-box">
- <div class="information-title">房间号码:</div>
- <div class="information-div">{{detail.roomNumber}}</div>
- </div>
- <div class="information-box">
- <div class="information-title">房源面积:</div>
- <div class="information-div">{{detail.area}}m²</div>
- </div>
- <div class="information-box">
- <div class="information-title">付款方式:</div>
- <div class="information-div">{{$field.findTypeName('payWay',detail.payWay)}}</div>
- </div>
- <div class="information-box">
- <div class="information-title">产权证书:</div>
- <div class="information-div">{{detail.propertyCertificateNumber?'有':'无'}}</div>
- </div>
- <div class="information-box">
- <div class="information-title">是否装修:</div>
- <div class="information-div">{{detail.decoration === 1 ? '已装修':'未装修'}}</div>
- </div>
- </div>
- <div class="content-title">房源简介</div>
- <div class="desc-text" v-html="detail.introduce"></div>
- </div>
- </div>
- <div class="sub-title">周边配套</div>
- <div class="map-container">
- <div id="map"></div>
- <div class="content-device">
- <div class="people-tell">
- <avatar class="people-avatar"
- :user="{portrait:detail.chargePersonPortrait,name:detail.chargePersonName}" :size="24">
- </avatar>
- <div class="people-text">
- <div class="people-name">{{detail.chargePersonName}}</div>
- <div class="people-organization">组织名称</div>
- </div>
- </div>
- <div class="device-list">
- <div class="device-item"
- v-for="item in $field.findTypeNameByList('supportingFacilities',detail.supportingFacilities)"
- :key="item.id">
- <i :class="'iconfont device-icon ' + item.icon"></i>
- <span class="device-label">{{item.name}}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="skeleton-box" v-else>
- <el-empty :description="description">
- <span class="color-blue" style="cursor: pointer;" @click="login" v-if="description === '请登录后查看'">
- 点击登录>>
- </span>
- </el-empty>
- </div>
- </div>
- <house-foot></house-foot>
- <el-dialog :close-on-click-modal="false" title="预约看房" :visible.sync="visible" width="900px"
- :append-to-body="true">
- <reservation v-if="visible" @callback="visible = false" :houseId="detail.id" :projectId="detail.projectId"
- :chargePersonId="detail.chargePersonId">
- </reservation>
- </el-dialog>
- <el-dialog title="预览" :visible.sync="fileVisible" width="900px" :append-to-body="true">
- <video v-if="videoSrc && fileVisible" :src="videoSrc" width="100%" height="100%" style="background: #000;"
- controls>
- </video>
- </el-dialog>
- <image-viewer v-if="isShow" :url-list="[imageUrl]" :on-close="()=>isShow = false"></image-viewer>
- </div>
- </template>
- <script>
- // 引入插件
- import Swiper from 'swiper'; // 注意引入的是Swiper
- import 'swiper/css/swiper.min.css' // 注意这里的引入
- import houseFoot from "@/components/website/houseFoot.vue"
- import Crypto from '@/uitls/crypto'
- import {
- getToken
- } from '@/uitls/auth'
- import {
- getHouseDetailById
- } from '@/httpApi/space'
- import {
- mapGetters
- } from 'vuex';
- import reservation from '@/components/website/reservation';
- import imageViewer from 'element-ui/packages/image/src/image-viewer.vue';
- export default {
- data() {
- return {
- swiper: null,
- swiperList: [],
- detail: {},
- detailId: '',
- description: '无房源信息',
- visible: false,
- isShow: false,
- imageUrl: '',
- videoSrc: '',
- fileVisible: false
- };
- },
- mounted() {
- window.scrollTo(0, 0);
- this.init();
- },
- methods: {
- init() {
- if (!getToken()) return this.description = '请登录后查看';
- this.detailId = Crypto.AES.decrypt(decodeURIComponent(this.$route.query.id), 'bosshand');
- if (!this.detailId) return this.description = '无房源信息';
- this.getDetail();
- },
- openImage(item) {
- if (item.fileType === 'video') return;
- this.imageUrl = item.url;
- this.isShow = true;
- },
- openVideo(item) {
- this.videoSrc = item.videoUrl;
- this.fileVisible = true;
- },
- getDetail() {
- getHouseDetailById(this.detailId).then(res => {
- if (res.state) {
- this.detail = res.data;
- let imageBox = [],
- videoBox = [];
- if (this.detail.picture) {
- imageBox = JSON.parse(this.detail.picture).map(node => {
- node['fileType'] = 'image';
- return node;
- });
- }
- if (this.detail.video) {
- videoBox = JSON.parse(this.detail.video).map(node => {
- node['fileType'] = 'video';
- node['videoUrl'] = node.url;
- node['url'] = node.url + '?x-oss-process=video/snapshot,t_0,f_jpg'
- return node;
- });
- }
- this.swiperList = videoBox.concat(imageBox);
- this.getSwiper();
- if (this.detail.coordinates) {
- this.coordinates = this.detail.coordinates.split(',');
- this.initMap();
- }
- }
- })
- },
- initMap() {
- this.$nextTick(() => {
- let position = new T.LngLat(this.coordinates[0], this.coordinates[1]);
- let map = new T.Map('map');
- map.centerAndZoom(position, 18);
- let mark = new T.Marker(position, {
- z: 12
- });
- map.addOverLay(mark);
- })
- },
- getSwiper() {
- this.$nextTick(() => {
- this.swiper = new Swiper(".swiper-container", {
- loop: true,
- navigation: {
- nextEl: '.swiper-button-next',
- prevEl: '.swiper-button-prev',
- },
- })
- })
- },
- login() {
- this.$store.dispatch('app/changeEvent', {
- type: 'login'
- })
- },
- reservation() {
- this.visible = true;
- }
- },
- components: {
- houseFoot,
- reservation,
- imageViewer
- },
- computed: {
- ...mapGetters(['event'])
- },
- watch: {
- event() {
- let event = this.$store.getters.event;
- if (event.type == 'homeDetailReload') this.init();
- }
- },
- };
- </script>
- <style lang="scss">
- .home-detail {
- padding-top: 60px;
- color: #000;
- .login-toggle {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- z-index: 998;
- background: rgba(0, 0, 0, 0.5);
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .title {
- font-size: 30px;
- font-weight: bolder;
- line-height: 30px;
- margin: 20px 0;
- }
- .sub-title {
- font-size: 24px;
- font-weight: bolder;
- line-height: 30px;
- margin: 20px 0;
- }
- .map-container {
- display: flex;
- margin-bottom: 30px;
- #map {
- width: 670px;
- height: 400px;
- }
- .content-device {
- width: 470px;
- height: 400px;
- margin-left: 60px;
- .people-tell {
- border-bottom: 1px solid #e7ebee;
- display: flex;
- align-items: center;
- padding: 15px 0;
- margin-bottom: 15px;
- .people-avatar {
- width: 50px;
- height: 50px;
- border-radius: 50%;
- margin-right: 15px;
- overflow: hidden;
- }
- .people-text {
- flex: 1;
- width: 0;
- overflow: hidden;
- }
- .people-name {
- font-size: 20px;
- font-weight: 500;
- }
- .people-organization {
- font-weight: 300;
- font-size: 14px;
- }
- }
- .device-list {
- display: flex;
- flex-wrap: wrap;
- align-content: flex-start;
- }
- .device-item {
- width: 50%;
- display: flex;
- align-items: center;
- margin-bottom: 15px;
- .device-label {
- flex: 1;
- width: 0;
- font-weight: 200;
- margin-left: 10px;
- }
- .device-icon {
- font-size: 18px;
- margin-right: 5px;
- }
- }
- }
- }
- .container {
- width: 1200px;
- margin: 0 auto;
- min-height: calc(100vh - 117px);
- }
- .skeleton-box {
- padding-top: 50px;
- }
- .home-detail-content {
- display: flex;
- }
- .home-detail-swiper {
- width: 670px;
- height: 480px;
- .swiper-container,
- .swiper-wrapper,
- .swiper-slide {
- width: 100%;
- height: 100%;
- }
- .swiper-slide {
- background-size: cover;
- background-position: center;
- background-repeat: no-repeat;
- cursor: pointer;
- position: relative;
- .open-video-icon {
- position: absolute;
- top: 50%;
- left: 50%;
- width: 40px;
- height: 40px;
- border-radius: 40px;
- background: rgba(0, 0, 0, 0.6);
- display: flex;
- align-items: center;
- justify-content: center;
- margin-left: -20px;
- margin-top: -20px;
- box-sizing: border-box;
- .huifont-bofang {
- color: #fff;
- font-size: 20px;
- }
- }
- }
- .swiper-button-next:after,
- .swiper-button-prev:after {
- color: #eee;
- font-size: 16px;
- }
- .swiper-button-prev,
- .swiper-container-rtl .swiper-button-next {
- left: 0;
- background: rgba(0, 0, 0, 0.3);
- height: 70px;
- margin-top: -35px;
- }
- .swiper-button-next,
- .swiper-container-rtl .swiper-button-prev {
- right: 0;
- background: rgba(0, 0, 0, 0.3);
- height: 70px;
- margin-top: -35px;
- }
- }
- .home-detail-information {
- width: 470px;
- height: 480px;
- margin-left: 60px;
- .house-name {
- font-size: 26px;
- font-weight: 500;
- }
- .tag {
- margin: 10px 0;
- span {
- background: #eee;
- padding: 5px 10px;
- border-radius: 4px;
- margin: 5px 5px 5px 0;
- font-size: 12px;
- color: #7b7979;
- }
- }
- .content-title {
- font-size: 16px;
- font-weight: 500;
- }
- .house-price {
- display: flex;
- align-items: center;
- justify-content: space-between;
- span {
- color: $--color-red;
- }
- border-bottom: 1px solid #e7ebee;
- margin-bottom: 15px;
- padding-bottom: 5px;
- .hui-button {
- color: #fff;
- background: $--color-primary;
- width: 100px;
- height: 34px;
- text-align: center;
- line-height: 34px;
- border-radius: 4px;
- cursor: pointer;
- &:hover {
- opacity: 0.8;
- }
- }
- }
- .average {
- font-size: 30px;
- font-weight: 900;
- margin-right: 5px;
- }
- .desc-text {
- margin-top: 10px;
- }
- .information-list {
- display: flex;
- flex-wrap: wrap;
- margin-bottom: 10px;
- .information-box {
- width: 50%;
- display: flex;
- padding: 7px 20px 7px 0;
- box-sizing: border-box;
- }
- .information-title {
- color: #979b9e;
- font-weight: 500;
- }
- .information-div {
- flex: 1;
- width: 0;
- overflow: hidden;
- white-space: nowrap;
- font-weight: 300;
- }
- }
- }
- .footer {
- background: #212631;
- min-width: 1200px;
- .footer-box {
- width: 1200px;
- margin: 0 auto
- }
- .foot-information {
- font-weight: 400;
- font-size: 12px;
- color: #98999d;
- line-height: 17px;
- display: flex;
- align-items: center;
- padding: 20px;
- justify-content: center
- }
- .foot-information a {
- color: #98999d;
- margin-right: 30px
- }
- .foot-information img {
- width: 14px;
- height: 14px;
- margin-left: 30px;
- margin-right: 10px
- }
- }
- }
- </style>
|