|
|
@@ -1,11 +1,18 @@
|
|
|
-
|
|
|
import HouseApi from '../../../apis/house'
|
|
|
-import { fotmatDate } from '../../../utils/date'
|
|
|
+import {
|
|
|
+ fotmatDate
|
|
|
+} from '../../../utils/date'
|
|
|
import loginFn from '../../../utils/login'
|
|
|
import MsgManager from '../../../pages/chat/msg-manager'
|
|
|
-import { randomString } from './../../../utils/tools'
|
|
|
-import { saveViewHistory } from '../../../utils/storage'
|
|
|
-import { loginByUserInfo } from '../../../utils/login'
|
|
|
+import {
|
|
|
+ randomString
|
|
|
+} from './../../../utils/tools'
|
|
|
+import {
|
|
|
+ saveViewHistory
|
|
|
+} from '../../../utils/storage'
|
|
|
+import {
|
|
|
+ loginByUserInfo
|
|
|
+} from '../../../utils/login'
|
|
|
const app = getApp();
|
|
|
Component({
|
|
|
/**
|
|
|
@@ -28,8 +35,7 @@ Component({
|
|
|
user_code: '',
|
|
|
markers: [],
|
|
|
house: getApp().globalData.lastHouse,
|
|
|
- detailItems: [
|
|
|
- {
|
|
|
+ new_detailItems: [{
|
|
|
label: '单价',
|
|
|
value: '',
|
|
|
name: 'unit_price'
|
|
|
@@ -72,8 +78,7 @@ Component({
|
|
|
},
|
|
|
],
|
|
|
|
|
|
- new_detailItems: [
|
|
|
- {
|
|
|
+ detailItems: [{
|
|
|
label: '建设年份',
|
|
|
value: '2009',
|
|
|
name: 'constructionYear',
|
|
|
@@ -113,7 +118,7 @@ Component({
|
|
|
]
|
|
|
},
|
|
|
pageLifetimes: {
|
|
|
- show () {
|
|
|
+ show() {
|
|
|
this.setData({
|
|
|
loginStatus: app.globalData.token ? true : false,
|
|
|
userinfo: app.globalData.userinfo,
|
|
|
@@ -121,7 +126,9 @@ Component({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- ready () {
|
|
|
+ ready() {
|
|
|
+
|
|
|
+
|
|
|
this.setData({
|
|
|
loginStatus: app.globalData.token ? true : false,
|
|
|
userinfo: app.globalData.userinfo,
|
|
|
@@ -129,7 +136,7 @@ Component({
|
|
|
this.getHouseDetail(this.properties.house_id)
|
|
|
this.fetchRecommendHouseList()
|
|
|
this.msgManager = new MsgManager(this)
|
|
|
-
|
|
|
+
|
|
|
if (!this.data.loginStatus) {
|
|
|
// wx.login({
|
|
|
// success: (res) => {
|
|
|
@@ -139,22 +146,22 @@ Component({
|
|
|
// }
|
|
|
// })
|
|
|
} else {
|
|
|
-
|
|
|
+
|
|
|
this.getHouseFocusStatus()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
/**
|
|
|
* 组件的方法列表
|
|
|
*/
|
|
|
methods: {
|
|
|
- toMap () {
|
|
|
+ toMap() {
|
|
|
const house = this.data.house
|
|
|
wx.navigateTo({
|
|
|
url: `/pages/map/map?longitude=${house.longitude}&latitude=${house.latitude}&housename=${house.district || ''} ${house.estate_name || ''}${this.properties.isAgency ? '' : `&agency_id=${this.properties.agent_user.agency_user_id}&agency_name=${this.properties.agent_user.name}&phone=${this.properties.agent_user.phone}`}`
|
|
|
})
|
|
|
},
|
|
|
- sendSchoolMsg () {
|
|
|
+ sendSchoolMsg() {
|
|
|
if (!getApp().globalData.token) {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/login/login',
|
|
|
@@ -167,12 +174,14 @@ Component({
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- getHouseDetail(house_id){
|
|
|
+ getHouseDetail(house_id) {
|
|
|
wx.showLoading({
|
|
|
title: '加载数据中'
|
|
|
})
|
|
|
HouseApi.houseDetail(house_id).then(res => {
|
|
|
- let { detailItems } = this.data
|
|
|
+ let {
|
|
|
+ detailItems
|
|
|
+ } = this.data
|
|
|
let house = res.data
|
|
|
detailItems.forEach(item => {
|
|
|
if (house[item.name]) {
|
|
|
@@ -186,24 +195,24 @@ Component({
|
|
|
}
|
|
|
})
|
|
|
house.tags = JSON.parse(house.tags || "[]")
|
|
|
- house.remarks = JSON.parse(house.remarks || "[]")[0].text
|
|
|
+ house.ancillaryFacility = JSON.parse(house.ancillaryFacility || "[]")
|
|
|
+ // house.remarks = JSON.parse(house.remarks || "[]")[0].text
|
|
|
+ house.remarks = JSON.parse(house.remarks || "[]")
|
|
|
res.data.detail_images = JSON.parse(res.data.detail_images)
|
|
|
res.data.detail_images = res.data.detail_images.map(item => `${item}?x-oss-process=image/resize,w_750,limit_0/quality,q_75`)
|
|
|
- let markers = [
|
|
|
- {
|
|
|
- longitude: house.longitude,
|
|
|
- latitude: house.latitude,
|
|
|
- housename: house.title,
|
|
|
- iconPath: "/image/4Dage/location-cycle.png",
|
|
|
- zIndex: -1,
|
|
|
- callout: {
|
|
|
- content: `${house.district || ''} ${house.estate_name || ''}`,
|
|
|
- display: 'ALWAYS',
|
|
|
- padding: 15,
|
|
|
- anchorY: 10
|
|
|
- }
|
|
|
+ let markers = [{
|
|
|
+ longitude: house.longitude,
|
|
|
+ latitude: house.latitude,
|
|
|
+ housename: house.title,
|
|
|
+ iconPath: "/image/4Dage/location-cycle.png",
|
|
|
+ zIndex: -1,
|
|
|
+ callout: {
|
|
|
+ content: `${house.district || ''} ${house.estate_name || ''}`,
|
|
|
+ display: 'ALWAYS',
|
|
|
+ padding: 15,
|
|
|
+ anchorY: 10
|
|
|
}
|
|
|
- ]
|
|
|
+ }]
|
|
|
this.setData({
|
|
|
house: res.data,
|
|
|
detailItems: detailItems,
|
|
|
@@ -217,8 +226,10 @@ Component({
|
|
|
wx.hideLoading()
|
|
|
})
|
|
|
},
|
|
|
- getHouseFocusStatus () {
|
|
|
- const { loginStatus } = this.data
|
|
|
+ getHouseFocusStatus() {
|
|
|
+ const {
|
|
|
+ loginStatus
|
|
|
+ } = this.data
|
|
|
if (!loginStatus) {
|
|
|
return
|
|
|
}
|
|
|
@@ -232,7 +243,7 @@ Component({
|
|
|
return res.data
|
|
|
})
|
|
|
},
|
|
|
- bindgetphonenumber (e) {
|
|
|
+ bindgetphonenumber(e) {
|
|
|
loginFn(e, this.data.user_code, this.properties.isAgency ? true : false).then(res => {
|
|
|
this.setData({
|
|
|
loginStatus: app.globalData.token ? true : false,
|
|
|
@@ -245,7 +256,7 @@ Component({
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- changeFocusStatus () {
|
|
|
+ changeFocusStatus() {
|
|
|
const is_valid = this.data.isFocused ? 0 : 1
|
|
|
HouseApi.focusHouse({
|
|
|
is_valid,
|
|
|
@@ -256,14 +267,16 @@ Component({
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- cancleFocusStatus () {
|
|
|
- return HouseApi.cancleFocusHouse({house_id: this.properties.house_id}).then(() => {
|
|
|
+ cancleFocusStatus() {
|
|
|
+ return HouseApi.cancleFocusHouse({
|
|
|
+ house_id: this.properties.house_id
|
|
|
+ }).then(() => {
|
|
|
this.setData({
|
|
|
isFocused: 0
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- fetchRecommendHouseList () {
|
|
|
+ fetchRecommendHouseList() {
|
|
|
const fetchData = {
|
|
|
city: app.globalData.city,
|
|
|
saleState: 1,
|
|
|
@@ -275,16 +288,18 @@ Component({
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- toMoreIntro () {
|
|
|
+ toMoreIntro() {
|
|
|
wx.navigateTo({
|
|
|
url: `/pages/detail-intro/detail-intro?house_id=${this.properties.house_id}`
|
|
|
})
|
|
|
},
|
|
|
- addReadHistory () {
|
|
|
- HouseApi.addReadHistory({ house_id: this.properties.house_id })
|
|
|
+ addReadHistory() {
|
|
|
+ HouseApi.addReadHistory({
|
|
|
+ house_id: this.properties.house_id
|
|
|
+ })
|
|
|
},
|
|
|
// 发送带看
|
|
|
- onlineWatch () {
|
|
|
+ onlineWatch() {
|
|
|
if (!this.data.loginStatus) {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/login/login'
|
|
|
@@ -301,8 +316,10 @@ Component({
|
|
|
this.toVrHouse(room_id, true)
|
|
|
},
|
|
|
// 发送房屋卡片
|
|
|
- sendVrMsg (room_id, is_vr_invite) {
|
|
|
- const { house } = this.data
|
|
|
+ sendVrMsg(room_id, is_vr_invite) {
|
|
|
+ const {
|
|
|
+ house
|
|
|
+ } = this.data
|
|
|
let content = {
|
|
|
house_name: house.title,
|
|
|
image_url: house.detail_images[0],
|
|
|
@@ -313,13 +330,22 @@ Component({
|
|
|
vr_link: is_vr_invite ? `${house.vrLink}${encodeURIComponent(`&room_id=${room_id}`)}` : '',
|
|
|
house_id: house.house_id
|
|
|
}
|
|
|
- return this.sendMsg({content, msgType: 'vr'})
|
|
|
+ return this.sendMsg({
|
|
|
+ content,
|
|
|
+ msgType: 'vr'
|
|
|
+ })
|
|
|
},
|
|
|
// 发送文字
|
|
|
- sendTextMsg (content) {
|
|
|
- return this.sendMsg({content, msgType: 'text'})
|
|
|
+ sendTextMsg(content) {
|
|
|
+ return this.sendMsg({
|
|
|
+ content,
|
|
|
+ msgType: 'text'
|
|
|
+ })
|
|
|
},
|
|
|
- sendMsg ({content, msgType}) {
|
|
|
+ sendMsg({
|
|
|
+ content,
|
|
|
+ msgType
|
|
|
+ }) {
|
|
|
let defaultContent = {
|
|
|
fromId: app.globalData.userinfo.user_id,
|
|
|
fromName: app.globalData.userinfo.phone,
|
|
|
@@ -329,30 +355,38 @@ Component({
|
|
|
msgType,
|
|
|
content: content
|
|
|
}
|
|
|
- return getApp().getIMHandler().newFriendSendMsg({content: defaultContent})
|
|
|
+ return getApp().getIMHandler().newFriendSendMsg({
|
|
|
+ content: defaultContent
|
|
|
+ })
|
|
|
},
|
|
|
- toVrHouse (room_id, isAuto) {
|
|
|
+ toVrHouse(room_id, isAuto) {
|
|
|
// console.log(app.globalData)
|
|
|
if (typeof room_id !== 'string') room_id = ''
|
|
|
-
|
|
|
+
|
|
|
this.postDataToOpen(room_id).then(res => {
|
|
|
const vr_link = res.data.vrLink
|
|
|
wx.navigateTo({
|
|
|
url: `/pages/web/web?room_id=${res.data.roomId}&vr_link=${encodeURIComponent(vr_link)}&house_id=${this.properties.house_id}${isAuto ? `&is_auto=${isAuto}` : ''}`
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
- postDataToOpen (room_id) {
|
|
|
- return HouseApi.postDataToOpen({house_id: this.properties.house_id, room_id, type: 'customer'})
|
|
|
+ postDataToOpen(room_id) {
|
|
|
+ return HouseApi.postDataToOpen({
|
|
|
+ house_id: this.properties.house_id,
|
|
|
+ room_id,
|
|
|
+ type: 'customer'
|
|
|
+ })
|
|
|
},
|
|
|
- toAgentDetail () {
|
|
|
+ toAgentDetail() {
|
|
|
wx.navigateTo({
|
|
|
url: `/pages/agent-detail/agent-detail?agency_id=${this.properties.agent_user.agency_user_id}`,
|
|
|
})
|
|
|
},
|
|
|
- bindgetuserinfo (e) {
|
|
|
- const { action } = e.currentTarget.dataset
|
|
|
+ bindgetuserinfo(e) {
|
|
|
+ const {
|
|
|
+ action
|
|
|
+ } = e.currentTarget.dataset
|
|
|
loginByUserInfo().then(res => {
|
|
|
this.setData({
|
|
|
loginStatus: app.globalData.token ? true : false,
|
|
|
@@ -363,4 +397,4 @@ Component({
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
-})
|
|
|
+})
|