瀏覽代碼

feat:更新实例化信息

jinx 4 年之前
父節點
當前提交
dd06de2e20

+ 94 - 60
apps/RealtorEasier/components/detail-components/detail-scroll/detail-scroll.js

@@ -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({
       })
     }
   }
-})
+})

+ 7 - 6
apps/RealtorEasier/components/detail-components/detail-scroll/detail-scroll.wxml

@@ -3,7 +3,7 @@
 <scroll-view class="contanerbox" scroll-y="true" wx:if="{{house.house_id}}">
     <view class="house-info padding-container">
         <view class="tab-list">
-            <view class="tab-item" wx:for="{{house.houseLabel}}" wx:key="index">{{ item }}</view>
+            <view class="tab-item" wx:for="{{house.tags}}" wx:key="index">{{ item }}</view>
             <!-- <view class="tab-item" wx:for="{{house.tags}}" wx:key="index">{{ item }}</view> -->
             <!-- <view class="tab-item" > 满两年 </view>
             <view class="tab-item" > 随时可看 </view> -->
@@ -34,7 +34,7 @@
         <view class="house-parameter">
             <view class="parameter-item">
                 <!-- <view class="price">${{ house.price / 10000 }}万</view> -->
-                <view class="price">${{ house.price }}万</view>
+                <view class="price">${{ house.price/10000 }}万</view>
                 <view class="parameter-name">售价</view>
             </view>
             <view class="parameter-item">
@@ -49,7 +49,7 @@
             </view>
         </view>
         <view class="house-detail">
-            <view class="detail-item" wx:for="{{new_detailItems}}" wx:key="name">
+            <view class="detail-item" wx:for="{{detailItems}}" wx:key="name">
                 <text class="label">{{ item.label }}:</text>
                 <text class="value"> <text class="value" wx:if="{{item.name=='unit_price' }}"> $</text>{{ item.value
                     }}</text>
@@ -89,7 +89,8 @@
     </view>
 
     <!-- <view class=" padding-container" bind:tap="toMoreIntro"> -->
-    <view class=" padding-container">
+    <view class=" padding-container" wx:if="{{!( house.remarks.length == 1 &&house.remarks[0].title == '' &&house.remarks[0].text == '') }}">
+
         <view class="location-text-info border-btn">
             <!-- <view class="detail-title">房源介绍 -->
             <view class="detail-title">物业特色
@@ -98,7 +99,7 @@
             <view wx:for="house.remarks" :key="name">
                 <view class="detail-text">{{item.title}}</view>
                 <view class="detail-text">
-                  {{item.text}}
+                    {{item.text}}
                 </view>
             </view>
 
@@ -111,7 +112,7 @@
             <view class="detail-title m-t-32">配套设施
             </view>
             <view class="detail-tag">
-                <text class="tag-item" wx:for="{{house.ancillaryFacility}}" wx:key="name">{{item}}</text>
+                <view class="tag-item" wx:for="{{house.ancillaryFacility}}" wx:key="index">{{item}}</view>
                 <!-- <text class="tag-item">壁炉</text> -->
                 <!-- <text class="tag-item">大理石</text>
                 <text class="tag-item">微波炉</text>

+ 1 - 1
apps/RealtorEasier/components/house-item/house-item.wxml

@@ -20,7 +20,7 @@
       </view>
     <view class="price-w">
         <!-- <text class="price text-bold">${{ house.price/10000 }}万</text> -->
-        <text class="price text-bold">${{ house.price }}万</text>
+        <text class="price text-bold">${{ house.price /10000}}万</text>
         <!-- <text class="price-tip">{{ house.unit_price }}元/平</text> -->
       </view>
     </view>

+ 1 - 1
apps/agent/apis/user.js

@@ -20,7 +20,7 @@ export default {
     return request.post(`user/login${str}`, data)
   },
   loginByUserInfo (data) {
-    return request.post(`user/login`, data)
+    return request.post(`agency/login`, data)
   },
   loginByPhoneCodeAgency (data) {
     let str = '?'