|
@@ -3,7 +3,7 @@
|
3
|
3
|
const app = getApp()
|
4
|
4
|
|
5
|
5
|
const page = require('../../utils/page.js');
|
6
|
|
-const HttpSever = require('../../utils/http.js').HttpSever;
|
|
6
|
+import fetch from '../../utils/http'
|
7
|
7
|
const $api = require('../../config/api.js').$api;
|
8
|
8
|
|
9
|
9
|
Page({
|
|
@@ -15,27 +15,34 @@ Page({
|
15
|
15
|
onLoad: function (options) {
|
16
|
16
|
const id = page.getCurrentPageOptions().id
|
17
|
17
|
const _that = this
|
18
|
|
- HttpSever.Ajax({
|
19
|
|
- url: $api.building.detail.url.replace(':id', id),
|
20
|
|
- method: $api.building.detail.method,
|
21
|
|
- }).then((data) => {
|
22
|
|
- const dicts = app.globalData.Dict
|
23
|
|
- const apart = data.data.buildingApartment.map(x => {
|
24
|
|
- return {
|
25
|
|
- ...x,
|
26
|
|
- imgUrl: (x.buildingImgList[0] || {}).url,
|
27
|
|
- marketStatus: (dicts.filter(d => d.id == x.marketStatus)[0] || {}).name
|
28
|
|
- }
|
29
|
|
- })
|
30
|
|
- let propertyType = ''
|
31
|
|
- data.data.propertyType.split(',').map(x => {
|
32
|
|
- const f = dicts.filter(d => d.id == x)
|
33
|
|
- if (f.length > 0) {
|
34
|
|
- propertyType += (propertyType === '' ? '' : ',') + f[0].name
|
35
|
|
- }
|
36
|
|
- })
|
37
|
|
- _that.setData({
|
38
|
|
- EstateDetail: { ...data.data, propertyType: propertyType, buildingApartment: apart}
|
|
18
|
+
|
|
19
|
+ fetch({
|
|
20
|
+ url: $api.collection.getByUser.replace(':openid', app.globalData.UserInfo.openid),
|
|
21
|
+ method: $api.collection.getByUser.method
|
|
22
|
+ }).then((collects) => {
|
|
23
|
+ console.log(collects)
|
|
24
|
+ fetch({
|
|
25
|
+ url: $api.building.detail.url.replace(':id', id),
|
|
26
|
+ method: $api.building.detail.method,
|
|
27
|
+ }).then((data) => {
|
|
28
|
+ const dicts = app.globalData.Dict
|
|
29
|
+ const apart = data.data.buildingApartment.map(x => {
|
|
30
|
+ return {
|
|
31
|
+ ...x,
|
|
32
|
+ imgUrl: (x.buildingImgList[0] || {}).url,
|
|
33
|
+ marketStatus: (dicts.filter(d => d.id == x.marketStatus)[0] || {}).name
|
|
34
|
+ }
|
|
35
|
+ })
|
|
36
|
+ let propertyType = ''
|
|
37
|
+ data.data.propertyType.split(',').map(x => {
|
|
38
|
+ const f = dicts.filter(d => d.id == x)
|
|
39
|
+ if (f.length > 0) {
|
|
40
|
+ propertyType += (propertyType === '' ? '' : ',') + f[0].name
|
|
41
|
+ }
|
|
42
|
+ })
|
|
43
|
+ _that.setData({
|
|
44
|
+ EstateDetail: { ...data.data, propertyType: propertyType, buildingApartment: apart }
|
|
45
|
+ })
|
39
|
46
|
})
|
40
|
47
|
})
|
41
|
48
|
},
|
|
@@ -49,6 +56,17 @@ Page({
|
49
|
56
|
url: '/pages/AppointmentTime/index?id=' + this.data.EstateDetail.buildingId + '&name=' + this.data.EstateDetail.buildingName
|
50
|
57
|
})
|
51
|
58
|
},
|
|
59
|
+ MakeCollect() {
|
|
60
|
+ app.globalData.UserInfo.openid
|
|
61
|
+ fetch({
|
|
62
|
+ url: $api.collection.save.url.replace(':openid', app.globalData.UserInfo.openid) + '?buildingId=' + this.data.EstateDetail.buildingId,
|
|
63
|
+ method: $api.collection.save.method,
|
|
64
|
+ }).then((data) => {
|
|
65
|
+ wx.showToast({
|
|
66
|
+ title: '收藏成功!'
|
|
67
|
+ })
|
|
68
|
+ })
|
|
69
|
+ },
|
52
|
70
|
OpenPhone() { // 电话咨询
|
53
|
71
|
let _self = this
|
54
|
72
|
wx.makePhoneCall({
|