liujq %!s(int64=2) %!d(string=hai) anos
pai
achega
1eaf7e52aa

+ 111 - 0
src/components/chat/com.jsx

@@ -0,0 +1,111 @@
+import Taro, { Component } from '@tarojs/taro'
+import { View, Image } from '@tarojs/components'
+import './com.scss'
+export default class Comment extends Component {
+  constructor (props) {
+    super(props)
+    this.state = {
+      otherObj: '',
+      curObj: {},
+    }
+  }
+
+
+  componentWillMount () {
+    this.props.onRef(this)
+  }
+
+  getData = (otherObj, str) => {
+    const curSaleObj = Taro.getStorageSync('APP_cur_sale')
+    if (curSaleObj.curObj) {
+      if (str === 'estateDtl') {
+        this.getList(otherObj)
+      } else {
+        this.setState({
+          curObj: curSaleObj.curObj,
+          otherObj,
+        })
+      }
+    } else {
+      this.getList(otherObj)
+    }
+  }
+
+  getList (otherObj) {
+    let params = {
+      show_status: 1,
+      page_size: 99
+    }
+    const referrer = Taro.getStorageSync('APP_MY_REFERRER')
+    if (referrer) params.referrer = referrer
+    Taro.api.room.apisalelist(params).then(res => {
+      const list = res.list || []
+      const arrIndex = Math.floor(Math.random() * list.length)
+      this.setState({
+        curObj: list[arrIndex],
+        otherObj,
+      })
+      Taro.setStorageSync('APP_cur_sale', {curObj: list[arrIndex]})
+    })
+  }
+
+
+
+  netLink () {
+    const { curObj, otherObj } = this.state
+    Taro.navigateTo({
+      url: `/pagesQa/msg/chat?to_user_id=${curObj.user_id}&eTitle=${otherObj.name}&eId=${otherObj.id}`
+    })
+  }
+  callHandle () {
+    const { curObj } = this.state
+    Taro.makePhoneCall({
+      phoneNumber: curObj.sale_phone
+    })
+  }
+  afterCount (type) {
+    if (type === 'chat') {
+      this.netLink()
+    }
+    if (type === 'call') {
+      this.callHandle()
+    }
+  }
+  countHandle (type) {
+    const { curObj, otherObj } = this.state
+    let params = {
+      target_id: otherObj.id,
+      target_type: 2,
+      sale_id: curObj.sale_id,
+      click_type: type === 'call' ? '2' : '1' // 1在线聊 2打电话
+    }
+    Taro.api.room.apiusercontactclick(params).then((res) => {
+      this.afterCount(type)
+    }).catch(() => {
+      this.afterCount(type)
+    })
+  }
+
+
+
+
+  render () {
+    const { curObj } = this.state
+    const tagStr = curObj.custom_tag ? curObj.custom_tag.substring(0, 8) : ''
+    return (
+      <View className="scoped-sale">
+        <View className="ss-img">
+          <Image src={curObj.sale_avatar} className="img"/>
+        </View>
+        <View className="ss-info">
+          <View className="p1">{curObj.sale_name}</View>
+          <View className="p2">{tagStr}</View>
+        </View>
+        <View className="ss-r">
+          <View className="b" onClick={this.countHandle.bind(this, 'chat')}>在线问</View>
+          <View className="b t2" onClick={this.countHandle.bind(this, 'call')}>打电话</View>
+        </View>
+      </View>
+    )
+  }
+}

+ 63 - 0
src/components/chat/com.scss

@@ -0,0 +1,63 @@
+@import '@css/mixin.scss';
+.scoped-sale {
+  position: fixed;
+  left: 0;
+  bottom: 0;
+  width: 100%;
+  height: 140px;
+  background: #fff;
+  display: flex;
+  box-sizing: border-box;
+  padding: 20px;
+  z-index: 99;
+  border: 1PX solid #f2f2f2;
+  .ss-img {
+    width: 90px;
+    height: 90px;
+    border-radius: 50%;
+    overflow: hidden;
+    margin-right: 20px;
+    .img {
+      width: 90px;
+      height: 90px;
+      border-radius: 50%;
+      overflow: hidden;
+    }
+  }
+  .ss-info {
+    flex: 1;
+    .p1 {
+      color: #313131;
+      font-weight: bold;
+      font-size: 30px;
+      padding-bottom: 6px;
+      padding-left: 10px;
+    }
+    .p2 {
+      display: inline-block;
+      padding: 6px 10px;
+      color: #8b94b1;
+      background: #eceff5;
+      font-size: 24px;
+      border-radius: 10px;
+    }
+  }
+  .ss-r {
+    width: 350px;
+    display: flex;
+    padding-top: 10px;
+    justify-content: space-between;
+    .b {
+      width: 170px;
+      height: 80px;
+      line-height: 80px;
+      text-align: center;
+      background: #3bc48b;
+      color: #fff;
+      border-radius: 10px;
+      &.t2 {
+        background: #3072f6;
+      }
+    }
+  }
+}

+ 86 - 0
src/components/chat/index.jsx

@@ -0,0 +1,86 @@
+import Taro, { Component } from '@tarojs/taro'
+import { View, Image } from '@tarojs/components'
+import './index.scss'
+export default class Comment extends Component {
+  constructor (props) {
+    super(props)
+    this.state = {
+      otherObj: '',
+      dataList: [],
+      curObj: {},
+    }
+  }
+
+
+  componentWillMount () {
+    this.props.onRef(this)
+  }
+
+  getData = (dataList, otherObj) => {
+    const arrIndex = Math.floor(Math.random() * dataList.length)
+    this.setState({
+      curObj: dataList[arrIndex],
+      otherObj,
+    })
+  }
+
+
+
+  netLink () {
+    const { curObj, otherObj } = this.state
+    Taro.navigateTo({
+      url: `/pagesQa/msg/chat?to_user_id=${curObj.user_id}&eTitle=${otherObj.name}&eId=${otherObj.id}`
+    })
+  }
+  callHandle () {
+    const { curObj } = this.state
+    Taro.makePhoneCall({
+      phoneNumber: curObj.sale_phone
+    })
+  }
+  afterCount (type) {
+    if (type === 'chat') {
+      this.netLink()
+    }
+    if (type === 'call') {
+      this.callHandle()
+    }
+  }
+  countHandle (type) {
+    const { curObj, otherObj } = this.state
+    let params = {
+      target_id: otherObj.id,
+      target_type: 2,
+      sale_id: curObj.sale_id,
+      click_type: type === 'call' ? '2' : '1' // 1在线聊 2打电话
+    }
+    Taro.api.room.apiusercontactclick(params).then(() => {
+      this.afterCount(type)
+    }).catch(() => {
+      this.afterCount(type)
+    })
+  }
+
+
+
+
+  render () {
+    const { curObj } = this.state
+    const tagStr = curObj.custom_tag ? curObj.custom_tag.substring(0, 8) : ''
+    return (
+      <View className="scoped-sale">
+        <View className="ss-img">
+          <Image src={curObj.sale_avatar} className="img"/>
+        </View>
+        <View className="ss-info">
+          <View className="p1">{curObj.sale_name}</View>
+          <View className="p2">{tagStr}</View>
+        </View>
+        <View className="ss-r">
+          <View className="b" onClick={this.countHandle.bind(this, 'chat')}>在线问</View>
+          <View className="b t2" onClick={this.countHandle.bind(this, 'call')}>打电话</View>
+        </View>
+      </View>
+    )
+  }
+}

+ 63 - 0
src/components/chat/index.scss

@@ -0,0 +1,63 @@
+@import '@css/mixin.scss';
+.scoped-sale {
+  position: fixed;
+  left: 0;
+  bottom: 0;
+  width: 100%;
+  height: 140px;
+  background: #fff;
+  display: flex;
+  box-sizing: border-box;
+  padding: 20px;
+  z-index: 99;
+  border: 1PX solid #f2f2f2;
+  .ss-img {
+    width: 90px;
+    height: 90px;
+    border-radius: 50%;
+    overflow: hidden;
+    margin-right: 20px;
+    .img {
+      width: 90px;
+      height: 90px;
+      border-radius: 50%;
+      overflow: hidden;
+    }
+  }
+  .ss-info {
+    flex: 1;
+    .p1 {
+      color: #313131;
+      font-weight: bold;
+      font-size: 30px;
+      padding-bottom: 6px;
+      padding-left: 10px;
+    }
+    .p2 {
+      display: inline-block;
+      padding: 6px 10px;
+      color: #8b94b1;
+      background: #eceff5;
+      font-size: 24px;
+      border-radius: 10px;
+    }
+  }
+  .ss-r {
+    width: 350px;
+    display: flex;
+    padding-top: 10px;
+    justify-content: space-between;
+    .b {
+      width: 170px;
+      height: 80px;
+      line-height: 80px;
+      text-align: center;
+      background: #3bc48b;
+      color: #fff;
+      border-radius: 10px;
+      &.t2 {
+        background: #3072f6;
+      }
+    }
+  }
+}

+ 71 - 0
src/components/login/Judge.jsx

@@ -0,0 +1,71 @@
+import Taro, { Component } from '@tarojs/taro'
+import LoginPopup from '@/c/login/Popup'
+import './Judge.scss'
+export default class SelectSearch extends Component {
+  constructor (props) {
+    super(props)
+    this.state = {
+      isLoginPopupShow: false,
+      userInfo: {},
+      token: ''
+    }
+  }
+  
+  componentDidUpdate (prevProps, prevState) {}
+
+
+  componentDidMount () {
+    let userInfo = Taro.getStorageSync('APP_userInfo')
+    let token = Taro.getStorageSync('APP_token')
+    if (userInfo) {
+      this.setState({
+        userInfo,
+        token
+      })
+    }
+  }
+
+  openLoginPopup (obj) {
+    this.setState({
+      isLoginPopupShow: true
+    })
+  }
+  closeLoginPopup (str) {
+    this.setState({
+      isLoginPopupShow: false
+    })
+    if (str && str === 'success') {
+      this.getDtl()
+    }
+  }
+  getUserProfile (e) {
+    wx.getUserProfile({
+      desc: '用于完善头像和昵称资料',
+      success: (res) => {
+        const dtlObj = res || {}
+        this.setState({
+          userInfo: dtlObj.userInfo
+        })
+        Taro.setStorageSync('APP_userInfo', dtlObj.userInfo)
+        Taro.$msgConfirm(`登录成功~有任何建议或者反馈,可以进个人中心给我们反馈哦`, () => {}, () => {})
+      }
+    })
+  }
+
+  render () {
+    const { userInfo, token, isLoginPopupShow } = this.state
+    const uInfo = userInfo || {}
+    return (
+      <View style={uInfo && uInfo.avatarUrl && token ? '' : 'position: absolute;height: 100%;width: 100%;'}>
+        <LoginPopup show={isLoginPopupShow} close={this.closeLoginPopup.bind(this)} />
+        {
+          uInfo && uInfo.avatarUrl
+          ? token || isLoginPopupShow
+          ? ''
+          : <Button className="g-u-btn t2" onClick={this.openLoginPopup.bind(this)}></Button>
+          : <Button className="g-u-btn t2" onClick={this.getUserProfile.bind(this)}></Button>
+        }
+      </View>
+    )
+  }
+}

+ 1 - 0
src/components/login/Judge.scss

@@ -0,0 +1 @@
+@import '@css/mixin.scss';

+ 30 - 1
src/pagesHouse/indexDtl.jsx

@@ -6,7 +6,7 @@ import Comment from './components/indexDtl/comment'
 import ListMore from '@/c/pageDataList/listMore'
 import Header from './components/indexDtl/header'
 import News from './components/indexDtl/news'
-import Chat from './components/indexDtl/chat/com'
+import Chat from '@/c/chat/com'
 import Rooms from './components/indexDtl/rooms'
 import MoreHouse from './components/indexDtl/moreHouse'
 import HouseChannel from './components/indexDtl/channel'
@@ -940,6 +940,35 @@ class Index extends Component {
     )
   }
 
+  openLoginPopup (obj) {
+    this.setState({
+      isLoginPopupShow: true
+    })
+  }
+  closeLoginPopup (str) {
+    this.setState({
+      isLoginPopupShow: false
+    })
+    if (str && str === 'success') {
+      this.getDtl()
+    }
+  }
+  getUserProfile (e) {
+    wx.getUserProfile({
+      desc: '用于完善头像和昵称资料',
+      success: (res) => {
+        const dtlObj = res || {}
+        this.setState({
+          userInfo: dtlObj.userInfo
+        })
+        Taro.setStorageSync('APP_userInfo', dtlObj.userInfo)
+        Taro.$msgConfirm(`登录成功~有任何建议或者反馈,可以进个人中心给我们反馈哦`, () => {}, () => {})
+      }
+    })
+  }
+
+
+
   renderAdBanner () {
     const { curObj, curId } = this.state
     const adBanner = require('./img/dtl/ad_banner3.jpg')

+ 9 - 0
src/pagesHouse/indexDtlAround.jsx

@@ -3,6 +3,8 @@ import { View, Map } from '@tarojs/components'
 import { arrToObj } from '@utils'
 var QQMapWX = require('@js/qqmap-wx-jssdk.js')
 import ListMore from '@/c/pageDataList/listMore'
+import Chat from '@/c/chat/com'
+import LoginJudge from '@/c/login/Judge'
 var qqmapsdk
 import './indexDtlAround.scss'
 
@@ -87,6 +89,8 @@ class Index extends Component {
         aroundArr
       }, () => {
         this.navChange(0)
+        const { id, name } = this.$router.params
+        if (this.subChat) this.subChat.getData({name, id}, 'pt')
         // Taro.api.house.apiestateperipherydata({estate_id: curId}).then(eObj => {
         //   if (eObj.periphery) {
         //     this.setState({
@@ -103,6 +107,9 @@ class Index extends Component {
     })
   }
 
+  refChat = (ref) => {
+    this.subChat = ref
+  }
 
   renderTop () {
     const { name } = this.$router.params
@@ -470,6 +477,7 @@ class Index extends Component {
     const { aroundArr } = this.state
     return (
       <View className="l-box">
+        <LoginJudge />
         {this.renderShare()}
         {this.renderTop()}
         {
@@ -478,6 +486,7 @@ class Index extends Component {
           this.renderPos()
         }
         {this.renderOptionsInfo()}
+        <Chat onRef={this.refChat} />
       </View>
     )
   }

+ 2 - 1
src/pagesHouse/indexDtlAround.scss

@@ -2,6 +2,7 @@
 @import '@css/house-entry.scss';
 .l-box {
   padding-top: 156px;
+  padding-bottom: 140px;
 }
 page {
   height: 100%;
@@ -11,7 +12,7 @@ page {
 .scoped-options {
   background: #fff;
   position: fixed;
-  bottom: 0;
+  bottom: 140px;
   width: 100%;
   left: 0;
   padding-top: 10px;

+ 8 - 0
src/pagesHouse/indexDtlMore.jsx

@@ -1,5 +1,6 @@
 import Taro, { Component } from '@tarojs/taro'
 import { View, Map } from '@tarojs/components'
+import Chat from '@/c/chat/com'
 import { arrToObj } from '@utils'
 
 import './indexDtlMore.scss'
@@ -43,10 +44,16 @@ class Index extends Component {
     Taro.api.house.admestatedetail({id: curId}).then(res => {
       this.setState({
         curObj: res || {}
+      }, () => {
+        if (this.subChat) this.subChat.getData({name: res.estate_name, id: res.id}, 'pt')
       })
     })
   }
 
+  refChat = (ref) => {
+    this.subChat = ref
+  }
+
   componentDidShow () { }
 
   componentDidHide () { }
@@ -319,6 +326,7 @@ class Index extends Component {
       <View className="l-box">
         {this.renderHeader()}
         {this.renderOptionsInfo()}
+        <Chat onRef={this.refChat} />
       </View>
     )
   }

+ 3 - 0
src/pagesHouse/indexDtlMore.scss

@@ -6,6 +6,9 @@ page {
   background: #f2f2f2;
   font-size: 28px;
 }
+.l-box {
+  padding-bottom: 140px;
+}
 .dtl-header {
   position: relative;
   overflow: hidden;

+ 15 - 4
src/pagesHouse/price.jsx

@@ -4,6 +4,8 @@ import { View, Image, ScrollView } from '@tarojs/components'
 import { AtNoticebar } from 'taro-ui'
 import ListMore from '@/c/pageDataList/listMore'
 import EchartLine from './components/price/EchartLine'
+import Chat from '@/c/chat/com'
+import LoginJudge from '@/c/login/Judge'
 import './price.scss'
 
 class Index extends Component {
@@ -40,11 +42,17 @@ class Index extends Component {
 
   componentWillMount () {
     Taro.$AHU(this)
-    const { name } = this.$router.params
+    const {id, name } = this.$router.params
     Taro.setNavigationBarTitle({
       title: `${name}的历史成交价`
     })
-    this.getDataList()
+    this.getDataList(() => {
+      if (this.subChat) this.subChat.getData({name, id}, 'pt')
+    })
+  }
+
+  refChat = (ref) => {
+    this.subChat = ref
   }
 
   componentDidShow () { }
@@ -52,7 +60,7 @@ class Index extends Component {
   componentDidHide () { }
 
 
-  getDataList () {
+  getDataList (bc) {
     const {id: estate_id} = this.$router.params
     let { page_size, page, dataList, isListEmpty } = this.state
     Taro.api.house.apiestatepricelist({
@@ -91,6 +99,7 @@ class Index extends Component {
       if (lineData.length > 0) {
         if (this.subLine) this.subLine.getData(lineData.reverse() || [])
       }
+      if (bc) bc()
     })
   }
   onScrollToLower (e) {
@@ -220,9 +229,11 @@ class Index extends Component {
   render () {
     return (
       <View className="l-box">
+        <LoginJudge />
         {this.renderTop()}
         {this.renderList()}
-        {this.renderFooter()}
+        <Chat onRef={this.refChat} />
+        {/* {this.renderFooter()} */}
       </View>
     )
   }

+ 2 - 2
src/pagesHouse/price.scss

@@ -2,7 +2,7 @@
 @import '@css/house-entry.scss';
 .l-box {
   padding-top: 156px;
-  padding-bottom: 170px;
+  padding-bottom: 140px;
 }
 page {
   height: 100%;
@@ -10,7 +10,7 @@ page {
   font-size: 28px;
 }
 .l-scroll-view {
-  height: calc(100vh - 156px - 170px);
+  height: calc(100vh - 156px - 140px);
   box-sizing: border-box;
 }
 

+ 3 - 1
src/pagesHouse/produceType.jsx

@@ -2,7 +2,8 @@ import Taro, { Component } from '@tarojs/taro'
 import { View, Map } from '@tarojs/components'
 import { arrToObj } from '@utils'
 import ListMore from '@/c/pageDataList/listMore'
-import Chat from './components/indexDtl/chat/com'
+import Chat from '@/c/chat/com'
+import LoginJudge from '@/c/login/Judge'
 import './produceType.scss'
 
 class Index extends Component {
@@ -204,6 +205,7 @@ class Index extends Component {
     let areaData = curObj.area_data || []
     return (
       <View className="l-box">
+        <LoginJudge />
         {this.renderQaAdd()}
         {this.renderShare()}
         {this.renderTop()}

+ 2 - 2
src/pagesQa/msg/chat.jsx

@@ -179,9 +179,9 @@ class Index extends Component {
               msgSocketList
             }, () => {
               const { qId } = that.$router.params
-              if (qId) that.sendHandle('house')
+              if (qId && res.codeMsg === 'Success') that.sendHandle('house')
               const { eTitle, eId } = that.$router.params
-              if (eId) that.sendHandle('text', `我刚刚浏览了楼盘:${eTitle},想咨询你一下`)
+              if (eId && res.codeMsg === 'Success') that.sendHandle('text', `我刚刚浏览了楼盘:${eTitle},想咨询你一下`)
               setTimeout(() => {
                 that.setState({
                   viewId: `item${msgSocketList.length - 1}`

+ 12 - 1
src/pagesRoom/roomPrice.jsx

@@ -1,7 +1,9 @@
 import Taro, { Component } from '@tarojs/taro'
 import { View } from '@tarojs/components'
+import LoginJudge from '@/c/login/Judge'
 import { arrToObj } from '@utils'
 import { AtTabs } from 'taro-ui'
+import Chat from '@/c/chat/com'
 import './roomPrice.scss'
 
 class Index extends Component {
@@ -60,7 +62,7 @@ class Index extends Component {
   getDtl = () => {
     const { curObj, curNav } = this.state
     const bn = curObj.building_num.split(',')
-    const {eId, id} = this.$router.params
+    const {eId, name, id} = this.$router.params
     Taro.api.house.apiestatelotterypricelist({
       estate_id: eId,
       lottery_id: id,
@@ -69,9 +71,16 @@ class Index extends Component {
       this.setState({
         roomArr: res || []
       })
+      if (this.subChat) {
+        this.subChat.getData({name, id: eId}, 'pt')
+      }
     })
   }
 
+  refChat = (ref) => {
+    this.subChat = ref
+  }
+
   componentDidShow () { }
 
   componentDidHide () { }
@@ -306,10 +315,12 @@ class Index extends Component {
   render () {
     return (
       <View className="l-box">
+        <LoginJudge />
         {this.renderTop()}
         {this.renderInfo()}
         {this.renderDtl()}
         {this.renderShare()}
+        <Chat onRef={this.refChat} />
       </View>
     )
   }

+ 3 - 0
src/pagesRoom/roomPrice.scss

@@ -1,5 +1,8 @@
 @import '@css/mixin.scss';
 @import '@css/modal.scss';
+.l-box {
+  padding-bottom: 140px;
+}
 .scoped-header {
   position: fixed;
   top: 0;