house.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. <template>
  2. <view class="house-detail">
  3. <swiper class="swiper" circular :indicator-dots="true">
  4. <swiper-item v-for="item in responsibility" :key="item.id">
  5. <image class="image" :src="item.url" mode="aspectFill">
  6. </image>
  7. </swiper-item>
  8. </swiper>
  9. <view class="house-title">
  10. <view class="house-name">{{detail.name}}</view>
  11. <view class="tag">
  12. <text style="margin-right: 6rpx;">{{detail.area}}m²</text>
  13. <text v-for="(tag,index) in detail.tagList" :key="index"> | {{tag.name}}</text>
  14. </view>
  15. <view class="pirce">
  16. <text class="number">{{detail.price}}</text>
  17. <text class="label">/月</text>
  18. </view>
  19. <view class="project-label">距离您2km</view>
  20. <uni-icons class="wx-icon" type="weixin" size="38" color="#43b156"></uni-icons>
  21. </view>
  22. <view class="house-label house-article">{{detail.comment}}</view>
  23. <view class="house-content">
  24. <view class="content-title">基本信息</view>
  25. <view class="information-list">
  26. <view class="information-box">
  27. <text class="information-title">所属楼宇:</text>
  28. <text class="information-text">{{detail.projectItemName}}</text>
  29. </view>
  30. <view class="information-box">
  31. <text class="information-title">所属楼层:</text>
  32. <text class="information-text">{{detail.projectItemTargetName}}</text>
  33. </view>
  34. <view class="information-box">
  35. <text class="information-title">房源类型:</text>
  36. <text class="information-text">{{$field.findTypeName('houseType',detail.roomTypeId)}}</text>
  37. </view>
  38. <view class="information-box">
  39. <text class="information-title">房间号码:</text>
  40. <text class="information-text">{{detail.roomNumber}}</text>
  41. </view>
  42. <view class="information-box">
  43. <text class="information-title">房源面积:</text>
  44. <text class="information-text">{{detail.area}}</text>
  45. </view>
  46. <view class="information-box">
  47. <text class="information-title">付款方式:</text>
  48. <text class="information-text">{{$field.findTypeName('payWay',detail.payWay)}}</text>
  49. </view>
  50. <view class="information-box" style="margin-bottom: 0;">
  51. <text class="information-title">产权证书:</text>
  52. <text class="information-text">{{detail.propertyCertificateNumber}}</text>
  53. </view>
  54. <view class="information-box" style="margin-bottom: 0;">
  55. <text class="information-title">是否装修:</text>
  56. <text class="information-text">{{detail.decoration === 1 ? '已装修':'未装修'}}</text>
  57. </view>
  58. </view>
  59. <view class="content-title">房源简介</view>
  60. <view class="desc-text" v-html="detail.introduce"></view>
  61. <view class="people-tell">
  62. <image class="people-avatar" :src="detail.chargePersonPortrait" mode="aspectFill">
  63. </image>
  64. <view class="people-text">
  65. <view class="people-name">{{detail.chargePersonName}}</view>
  66. <view class="people-organization">
  67. 组织名称
  68. </view>
  69. </view>
  70. <view class="people-icon" @click="tell">
  71. <uni-icons type="phone-filled" color="#fff"></uni-icons>
  72. </view>
  73. </view>
  74. <view class="content-title">地理位置</view>
  75. <view class="content-map">
  76. <map id="map" class="map" :show-location="true" :latitude="latitude" :longitude="longitude"></map>
  77. </view>
  78. <view class="content-title">配套设施</view>
  79. <view class="content-device">
  80. <view class="device-item"
  81. v-for="item in $field.findTypeNameByList('supportingFacilities',detail.supportingFacilities)"
  82. :key="item.id">
  83. <uni-icons class="device-icon" custom-prefix="iconfont" :type="item.icon" size="18"></uni-icons>
  84. <text class="device-label">{{item.name}}</text>
  85. </view>
  86. </view>
  87. <view class="content-title">
  88. <text>访客记录</text>
  89. <text class="more">查看更多>></text>
  90. </view>
  91. <view class="visitor">
  92. <view class="visitor-item">
  93. <image class="visitor-avatar"
  94. src="https://assets.api.uizard.io/api/cdn/stream/d841c8c9-37cc-4fa1-9720-cff12a84352b.png"
  95. mode="aspectFill">
  96. </image>
  97. <text class="visitor-label">林夕三访问了您的房源</text>
  98. <text class="visitor-time">2024-01-01</text>
  99. </view>
  100. <view class="visitor-item">
  101. <image class="visitor-avatar"
  102. src="https://assets.api.uizard.io/api/cdn/stream/d841c8c9-37cc-4fa1-9720-cff12a84352b.png"
  103. mode="aspectFill">
  104. </image>
  105. <text class="visitor-label">林夕三访问了您的房源</text>
  106. <text class="visitor-time">2024-01-01</text>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. </template>
  112. <script>
  113. import {
  114. getHouseDetailById
  115. } from '@/request/api/house.js'
  116. export default {
  117. data() {
  118. return {
  119. detail: {},
  120. houseId: 15,
  121. responsibility: [],
  122. coordinates: [],
  123. latitude: 39.90923,
  124. longitude: 116.397428,
  125. mapContext: {},
  126. }
  127. },
  128. onLoad(body) {
  129. if (body.houseId) this.houseId = body.houseId;
  130. this.init();
  131. },
  132. onReady() {
  133. this.mapContext = uni.createMapContext("map", this);
  134. },
  135. methods: {
  136. init() {
  137. getHouseDetailById(this.houseId).then(res => {
  138. if (res.code === 200) {
  139. this.detail = res.data;
  140. if (this.detail.picture) this.responsibility = JSON.parse(this.detail.picture);
  141. if (this.detail.coordinates) {
  142. this.coordinates = this.detail.coordinates.split(',');
  143. this.latitude = this.coordinates[1];
  144. this.longitude = this.coordinates[0];
  145. this.addMarkers();
  146. }
  147. }
  148. })
  149. },
  150. tell() {
  151. uni.makePhoneCall({
  152. phoneNumber: '17601274604' //仅为示例
  153. });
  154. },
  155. addMarkers() {
  156. const positions = [{
  157. latitude: this.coordinates[1],
  158. longitude: this.coordinates[0],
  159. }]
  160. const markers = []
  161. positions.forEach((p, i) => {
  162. markers.push(
  163. Object.assign({}, {
  164. id: i + 1,
  165. width: 50,
  166. height: 50,
  167. joinCluster: true, // 指定了该参数才会参与聚合
  168. }, p)
  169. )
  170. })
  171. this.mapContext.addMarkers({
  172. markers,
  173. clear: false,
  174. complete(res) {}
  175. })
  176. }
  177. },
  178. }
  179. </script>
  180. <style lang="scss">
  181. .house-detail {
  182. background: #fff;
  183. padding-bottom: 60rpx;
  184. .swiper {
  185. height: 400rpx;
  186. .image {
  187. width: 100%;
  188. height: 100%;
  189. }
  190. }
  191. .house-label {
  192. font-size: 24rpx;
  193. color: $uni-secondary-color;
  194. font-weight: 300;
  195. }
  196. .house-article {
  197. font-size: 28rpx;
  198. padding: 0 30rpx;
  199. }
  200. .house-title {
  201. padding: 40rpx 130rpx 30rpx 30rpx;
  202. position: relative;
  203. .house-name {
  204. font-size: 36rpx;
  205. font-weight: 500;
  206. }
  207. .project-label {
  208. font-size: 24rpx;
  209. color: $uni-secondary-color;
  210. font-weight: 300;
  211. position: absolute;
  212. bottom: 50rpx;
  213. right: 30rpx;
  214. }
  215. .tag {
  216. font-size: 24rpx;
  217. font-weight: 300;
  218. color: $uni-secondary-color;
  219. padding: 12rpx 0;
  220. }
  221. .pirce {
  222. color: $uni-primary;
  223. .number {
  224. font-weight: 600;
  225. font-size: 48rpx;
  226. }
  227. .label {
  228. font-size: 24rpx;
  229. }
  230. }
  231. .wx-icon {
  232. position: absolute;
  233. top: 0;
  234. right: 30rpx;
  235. transform: translateY(50%);
  236. }
  237. }
  238. .content-map {
  239. width: 100%;
  240. height: 360rpx;
  241. border-radius: 16rpx;
  242. overflow: hidden;
  243. display: flex;
  244. .map {
  245. flex: 1;
  246. height: 100%;
  247. border-radius: 16rpx;
  248. }
  249. }
  250. .house-content {
  251. padding: 0 30rpx;
  252. box-sizing: border-box;
  253. .content-title {
  254. font-size: 32rpx;
  255. font-weight: 500;
  256. margin: 30rpx 0;
  257. display: flex;
  258. align-items: center;
  259. justify-content: space-between;
  260. .more {
  261. color: $uni-secondary-color;
  262. font-weight: 300;
  263. font-size: 24rpx;
  264. }
  265. }
  266. .people-tell {
  267. margin: 40rpx 0;
  268. height: 140rpx;
  269. border-radius: 20rpx;
  270. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  271. display: flex;
  272. align-items: center;
  273. padding: 0 30rpx;
  274. .people-avatar {
  275. width: 90rpx;
  276. height: 90rpx;
  277. border-radius: 50%;
  278. margin-right: 30rpx;
  279. }
  280. .people-text {
  281. flex: 1;
  282. width: 0;
  283. overflow: hidden;
  284. }
  285. .people-name {
  286. font-size: 16px;
  287. font-weight: 500;
  288. margin-bottom: 8rpx;
  289. }
  290. .people-organization {
  291. font-weight: 300;
  292. font-size: 24rpx;
  293. color: $uni-secondary-color;
  294. }
  295. .people-icon {
  296. width: 60rpx;
  297. height: 60rpx;
  298. border-radius: 50%;
  299. background: $uni-primary;
  300. text-align: center;
  301. line-height: 60rpx;
  302. }
  303. }
  304. .visitor {
  305. .visitor-item {
  306. margin-bottom: 20rpx;
  307. display: flex;
  308. align-items: center;
  309. font-weight: 300;
  310. .visitor-avatar {
  311. width: 80rpx;
  312. height: 80rpx;
  313. border-radius: 80rpx;
  314. }
  315. .visitor-label {
  316. flex: 1;
  317. width: 0;
  318. overflow: hidden;
  319. white-space: nowrap;
  320. text-overflow: ellipsis;
  321. margin: 0 20rpx;
  322. }
  323. &:last-child {
  324. margin-bottom: 0;
  325. }
  326. }
  327. }
  328. .desc-text {
  329. font-weight: 300;
  330. }
  331. .information-list {
  332. display: flex;
  333. flex-wrap: wrap;
  334. .information-box {
  335. width: 50%;
  336. display: flex;
  337. margin-bottom: 30rpx;
  338. }
  339. .information-title {
  340. color: $uni-secondary-color;
  341. font-weight: 500;
  342. }
  343. .information-text {
  344. flex: 1;
  345. width: 0;
  346. overflow: hidden;
  347. white-space: nowrap;
  348. font-weight: 300;
  349. }
  350. }
  351. .content-device {
  352. display: flex;
  353. flex-wrap: wrap;
  354. .device-item {
  355. width: 50%;
  356. display: flex;
  357. align-items: center;
  358. margin-bottom: 20rpx;
  359. .device-label {
  360. flex: 1;
  361. width: 0;
  362. color: $uni-secondary-color;
  363. font-weight: 200;
  364. margin-left: 10rpx;
  365. }
  366. .device-icon {
  367. color: $uni-base-color;
  368. }
  369. }
  370. }
  371. }
  372. }
  373. </style>