Files
RentWeAppFront/pages/detail/assetsDetail.vue
2025-12-25 08:26:09 +08:00

324 lines
7.5 KiB
Vue

<template>
<view class="asset-detail">
<!-- 顶部导航栏 -->
<customNavbar
title="不动资产详情" ref="navbar"/>
<!-- 顶部信息块 -->
<view :style="{ paddingTop: navTotalHeight + 'px' }">
<!-- <u-swiper
:list="asset.images"
height="220"
border-radius="12"
autoplay
interval="3000"
></u-swiper> -->
<AssetGallery
:insideImages="asset.images"
:vrImage="asset.vrImage"
:vrSrc="asset.vr"
:videos="asset.videos"
:plans="asset.plans"
:adImage="asset.adImage"
@vr-click="viewVR"
@video-play="playVideo"
@ad-click="onAdClick"
/>
</view>
<view class="content">
<!-- 基本信息 -->
<mycard title="资产信息">
<view class="info-list">
<u-cell-group>
<u-cell-item title="资产编号" :value="asset.code" :arrow="false"/>
<u-cell-item title="资产类别" :value="asset.category" :arrow="false"/>
<u-cell-item title="资产面积" :value="asset.area + '㎡'" :arrow="false"/>
<u-cell-item title="资产价值" :value="'¥' + formatMoney(asset.value)" :arrow="false"/>
<u-cell-item title="权属单位" :value="asset.owner" :arrow="false"/>
</u-cell-group>
</view>
</mycard>
<!-- 位置信息 -->
<mycard title="位置信息" >
<view class="map-section">
<u-cell-group>
<u-cell-item title="地址" :value="asset.address" :arrow="false"/>
</u-cell-group>
<map
:latitude="asset.lat"
:longitude="asset.lng"
:markers="markers"
style="width: 100%; height: 300rpx; border-radius: 12rpx; margin-top: 20rpx;"
></map>
</view>
</mycard>
<!-- 备注信息 -->
<mycard title="备注信息">
<view class="remark">
{{ asset.remark || '暂无备注信息' }}
</view>
</mycard>
</view>
<!-- 预约弹窗 -->
<u-popup v-model="showReserve" mode="bottom" border-radius="20">
<view class="popup-content">
<text class="popup-title">预约看房</text>
<u-input v-model="reserveName" placeholder="请输入姓名" />
<u-input v-model="reservePhone" placeholder="请输入电话" />
<u-button type="primary" @click="submitReserve">提交预约</u-button>
</view>
</u-popup>
<!-- 底部导航栏 -->
<assetBottomBar v-if ="asset.status === 0" :phone="asset.contact" @reserve="showReserve = true" />
</view>
</template>
<script>
import mycard from '../../components/card/mycard.vue';
import assetBottomBar from '../../components/bottom/assetBottomBar.vue';
import AssetGallery from '../../components/gallery/AssetGallery.vue'
export default {
components:{
mycard,
assetBottomBar,
AssetGallery
},
data() {
return {
// 控制预约弹窗显示
showReserve: false,
navTotalHeight: 0,
// 预约表单数据
reserveName: '',
reservePhone: '',
assetId: null,
asset: {
name: '',
community: '',
code: '',
category: '',
area: '',
value: '',
rent: '',
owner: '',
address: '',
lat: 0,
lng: 0,
images: [],
remark: '',
isFavorite: false,
status: 0
},
markers: [],
};
},
onLoad(options) {
this.assetId = options.id || 'A001';
this.loadAssetDetail();
// this.recordView();
},
mounted() {
const navbar = this.$refs.navbar;
const navHeight = navbar.navContentHeight; // 直接拿子组件 data
this.navTotalHeight = navHeight; // 加上额外间距
},
methods: {
// 模拟接口请求
loadAssetDetail() {
setTimeout(() => {
console.log("fork数据")
this.asset = {
name: '广州市中心写字楼A栋',
community: '天河国际商务区',
code: 'GDZC2025001',
category: '商业用房',
area: 1250.5,
value: 28000000,
rent: 88000,
owner: '广州市国资委',
address: '广州市天河区体育西路88号',
lat: 23.135,
lng: 113.327,
images: [
{
image:'/static/img/index/swiper/swiper3.jpg'
}
],
remark: '该资产目前用于办公出租,维护状态良好。',
isFavorite: false,
status: 0
};
this.markers = [
{
id: 1,
latitude: this.asset.lat,
longitude: this.asset.lng,
title: this.asset.name,
},
];
}, 300);
},
formatMoney(num) {
return Number(num).toLocaleString();
},
toggleFavorite() {
this.asset.isFavorite = !this.asset.isFavorite;
uni.showToast({
title: this.asset.isFavorite ? '已收藏' : '取消收藏',
icon: 'success',
});
},
contactManager() {
uni.makePhoneCall({
phoneNumber: '400-123-4567',
});
},
viewVR() {
uni.showToast({
title: '打开卫星图...',
icon: 'none',
});
// 可扩展:跳转到 VR 页面或调用地图 API
},
submitReserve (){
console.log('提交预约看房申请')
this.showReserve = false;
},
recordView(assetId) {
let lifeData = uni.getStorageSync('lifeData');
let token = lifeData.vuex_token
let url = "/assets/viewRecord";
this.$u.get(url, {}, {'WT': token}).then(obj => {
});
}
},
};
</script>
<style lang="scss" scoped>
.asset-detail {
background-color: #f7f8fa;
min-height: 100vh;
padding-bottom: 120rpx;
padding-top: 175rpx; /* 给导航栏留空间 */
.top-block {
background-color: #fff;
border-radius: 16rpx;
margin: 20rpx;
box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.05);
.left-swiper {
width: 45%;
}
.right-info {
width: 50%;
padding-left: 20rpx;
.asset-name {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 10rpx;
}
.asset-community {
font-size: 26rpx;
color: #666;
margin-bottom: 10rpx;
}
.asset-rent {
font-size: 26rpx;
color: #444;
.price {
color: #e54d42;
font-weight: bold;
margin-left: 4rpx;
}
}
.btn-group {
margin-top: 20rpx;
align-self: flex-start;
}
}
}
.content {
padding: 20rpx;
background-color: #f5f6fa;
min-height: 100vh;
padding-bottom: 140rpx; /* 避免内容被遮住 */
.info-list {
padding: 10rpx 20rpx;
background-color: #ffffff;
border-radius: 12rpx;
box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.05);
}
.map-section {
padding: 10rpx 20rpx 20rpx;
background-color: #ffffff;
border-radius: 12rpx;
box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.05);
display: flex;
flex-direction: column;
map {
width: 100%;
height: 320rpx;
border-radius: 12rpx;
margin-top: 20rpx;
overflow: hidden;
}
}
.remark {
padding: 20rpx;
font-size: 28rpx;
color: #555;
line-height: 1.6;
background-color: #ffffff;
border-radius: 12rpx;
box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.05);
}
}
}
.popup-content {
padding: 40rpx 30rpx;
background-color: #fff;
border-radius: 20rpx 20rpx 0 0;
}
.popup-title {
display: block;
font-size: 32rpx;
font-weight: bold;
color: #333;
text-align: center;
margin-bottom: 30rpx;
}
.u-input {
margin-bottom: 20rpx;
}
.u-button {
margin-top: 20rpx;
border-radius: 50rpx;
}
</style>