|
|
@ -1,13 +1,11 @@ |
|
|
|
<template> |
|
|
|
<view class="container"> |
|
|
|
<view class="detail-card" v-if="detail"> |
|
|
|
<u-cell-group> |
|
|
|
<u-cell-group :border="false"> |
|
|
|
<u-cell title="小区名称" :value="detail.name"></u-cell> |
|
|
|
<u-cell title="联系电话" :value="detail.contactPhone || '暂无'"></u-cell> |
|
|
|
<u-cell title="服务等级" :value="detail.serviceLevel || '暂无'"></u-cell> |
|
|
|
<u-cell title="物业费单价" :value="detail.propertyFeeUnit ? detail.propertyFeeUnit + '元/㎡' : '暂无'"></u-cell> |
|
|
|
<u-cell title="地址" :value="detail.address || '暂无'"></u-cell> |
|
|
|
<u-cell title="简介" :value="detail.intro || '暂无'"></u-cell> |
|
|
|
<u-cell title="联系电话" :value="detail.contactPhone || detail.tel || '暂无'"></u-cell> |
|
|
|
<u-cell title="服务等级" :value="[ '一级', '二级', '三级', '四级', '五级' ][detail.level] || detail.serviceLevel || '暂无'"></u-cell> |
|
|
|
<u-cell title="物业费单价" :value="detail.feeItem || '暂无'"></u-cell> |
|
|
|
</u-cell-group> |
|
|
|
|
|
|
|
<view class="intro-section" v-if="detail.intro"> |
|
|
@ -23,36 +21,55 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import {communityListReq} from "@/api/common"; |
|
|
|
import {communityDetailReq} from "@/api/common"; |
|
|
|
|
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
id: null, |
|
|
|
detail: null, |
|
|
|
allCommunityList: [] // 缓存所有小区数据 |
|
|
|
detail: null |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
async getCommunityList() { |
|
|
|
async getCommunityDetail() { |
|
|
|
try { |
|
|
|
const {data} = await communityListReq() |
|
|
|
this.allCommunityList = data |
|
|
|
// 根据ID找到对应的小区详情 |
|
|
|
this.detail = data.find(item => item.id === this.id) || null |
|
|
|
// 显示加载提示 |
|
|
|
uni.showLoading({ |
|
|
|
title: '加载中...' |
|
|
|
}) |
|
|
|
|
|
|
|
const {data} = await communityDetailReq(this.id) |
|
|
|
this.detail = data |
|
|
|
|
|
|
|
// 添加调试信息 |
|
|
|
console.log('获取到的小区详情:', data) |
|
|
|
} catch (error) { |
|
|
|
console.error('获取小区详情失败:', error) |
|
|
|
uni.showToast({ |
|
|
|
title: '获取数据失败', |
|
|
|
icon: 'none' |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
}) |
|
|
|
} finally { |
|
|
|
// 隐藏加载提示 |
|
|
|
uni.hideLoading() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
|
console.log('页面加载参数:', options) |
|
|
|
this.id = options.id |
|
|
|
|
|
|
|
// 检查ID是否存在 |
|
|
|
if (this.id) { |
|
|
|
this.getCommunityList() |
|
|
|
this.getCommunityDetail() |
|
|
|
} else { |
|
|
|
console.error('缺少小区ID参数') |
|
|
|
uni.showToast({ |
|
|
|
title: '参数错误', |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|