liujq 3 years ago
parent
commit
189e460ebd

+ 3 - 0
src/api/room.js

@@ -18,4 +18,7 @@ export default {
   apiusersendmessage: params => { // 消息 - 发送消息
     return request('/api/user/send/message', params)
   },
+  apiusercontactclick: params => { // 用户联系方式点击
+    return request('/api/user/contact/click', params)
+  },
 }

+ 1 - 0
src/app.jsx

@@ -83,6 +83,7 @@ class App extends Component {
         root: 'pagesPlan/',
         pages: [
           'apply',
+          'apply2',
           'discountGroup',
           'queryBuyHouse',
         ]

+ 3 - 2
src/pagesHouse/indexDtl.jsx

@@ -327,7 +327,7 @@ class Index extends Component {
             <View className="t">历史成交</View>
           </Navigator>
           :
-          <Navigator url={`/pagesPlan/apply?eId=${curId}`} className="de-op">
+          <Navigator url={`/pagesPlan/apply2?eId=${curId}&eName=${curObj.estate_name}`} className="de-op">
             <Image className="i" src={icon6} />
             <View className="t">看房报名</View>
           </Navigator>
@@ -739,8 +739,9 @@ class Index extends Component {
 
   linkPlan () {
     const {id} = this.$router.params
+    const { curObj } = this.state
     Taro.navigateTo({
-      url: `/pagesPlan/apply?eId=${id}`
+      url: `/pagesPlan/apply2?eId=${id}&eName=${curObj.estate_name}`
     })
   }
   renderPlan () {

+ 2 - 2
src/pagesMember/integralRecord.jsx

@@ -89,8 +89,8 @@ class Index extends Component {
           <View className="sl-p2">{item.create_at}</View>
           {
             item.total_point > 0
-            ? <View className="sl-r1 t2">+{item.total_point}成长值</View>
-            : <View className="sl-r1">{item.total_point}成长值</View>
+            ? <View className="sl-r1">+{item.total_point}成长值</View>
+            : <View className="sl-r1 t2">{item.total_point}成长值</View>
           }
         </View>
       )

+ 3 - 3
src/pagesPlan/apply.jsx

@@ -120,9 +120,9 @@ class Index extends Component {
     const yesnoMoreOptions = {arr: [{key: '不限', val: '-1'}, ...dictData.sys_yesno]}
     const area_type = {arr: dictData.area_type}
     const house_type = {arr: dictData.house_type}
-    const topBg = require('./img/banner.jpg')
-    const moreIcon = require('./img/more.gif')
-    const footerBg = require('./img/slogan.jpg')
+    const topBg = require('./img/apply/banner.jpg')
+    const moreIcon = require('./img/apply/more.gif')
+    const footerBg = require('./img/apply/slogan.jpg')
     return (
       <View className="l-box scoped-box">
         {this.renderGoHome()}

+ 160 - 0
src/pagesPlan/apply2.jsx

@@ -0,0 +1,160 @@
+import Taro, { Component } from '@tarojs/taro'
+import { View } from '@tarojs/components'
+import LFormGroup from '@/c/lform/formGroup'
+import './apply2.scss'
+
+class Index extends Component {
+  onShareAppMessage() {
+    const {eId, eName} = this.$router.params
+    return {
+      title: '南昌买房,来洪楼领取专属优惠',
+      path: `/pagesPlan/apply2?eId=${eId}&eName=${eName}`,
+    }
+  }
+  onShareTimeline () {
+    return {
+      title: '南昌买房,来洪楼领取专属优惠',
+      path: `/pagesPlan/apply2?eId=${eId}&eName=${eName}`,
+    }
+  }
+
+
+  constructor (props) {
+    super(props)
+    this.state = {
+      formObj: {},
+      isMoreShow: false,
+    }
+  }
+  config = {
+    navigationBarTitleText: '报名看房',
+    // navigationStyle: 'custom',
+    // navigationBarTextStyle: 'white'
+  }
+
+  componentWillMount () {
+    Taro.$AHU(this)
+  }
+
+  saveHandle () {
+    const that = this
+    const { formObj } = this.state
+    if (formObj.name && formObj.phone) {
+      const userInfo = Taro.getStorageSync('APP_userInfo')
+      const {eId} = this.$router.params
+      Taro.api.other.planadd({
+        ...formObj,
+        estate_id: eId || '',
+        userinfo: userInfo ? JSON.stringify(userInfo) : ''
+      }).then(res => {
+        Taro.$msgConfirm('提交成功,洪楼将根据您的情况联系您', () => {
+          that.linkPrev()
+        }, () => {
+          that.linkPrev()
+        })
+      })
+    } else {
+      Taro.$msg('请输入您的称呼和手机号~')
+    }
+  }
+
+  baseFormChange (key, val) {
+    let { formObj } = this.state
+    formObj[key] = val
+    this.setState({
+      formObj
+    })
+  }
+
+  renderGoHome () {
+    const {eId} = this.$router.params
+    const icon = require('./img/apply/btn.png')
+    const icon2 = require('./img/apply/btn2.png')
+    const btn = eId ? icon : icon2
+    return (
+      <Image className="scoped-prev" src={btn} onClick={this.linkPrev.bind(this)}/>
+    )
+  }
+  linkPrev () {
+    const {eId} = this.$router.params
+    if (eId) {
+      Taro.reLaunch({
+        url: `/pagesHouse/indexDtl?id=${eId}`
+      })
+    } else {
+      Taro.reLaunch({
+        url: '/pages/index/index'
+      })
+    }
+  }
+
+
+
+  openMore () {
+    this.setState({
+      isMoreShow: true
+    })
+  }
+
+  render () {
+    const {eName} = this.$router.params
+    const { formObj } = this.state
+    const bg = require('./img/apply/bg.jpg')
+    return (
+      <View className="l-box scoped-box">
+        {this.renderGoHome()}
+        <View className="sb-bg">
+          <Image src={bg} className="img" />
+        </View>
+        <View className="sb-title">{eName || '洪楼Plus'}</View>
+        <View className="sb-main">
+          <LFormGroup
+            val={formObj.name}
+            valStr="name"
+            keyStr="您的称呼(必填)"
+            keyStr2="请输入您的称呼"
+            labelWidth="30%"
+            bc={this.baseFormChange.bind(this)}
+          />
+          <LFormGroup
+            val={formObj.phone}
+            valStr="phone"
+            keyStr="联系方式(必填)"
+            keyStr2="请输入联系方式"
+            inputType="digit"
+            labelWidth="30%"
+            bc={this.baseFormChange.bind(this)}
+          />
+          <LFormGroup
+            val={formObj.sfk}
+            valStr="sfk"
+            keyStr="首付款"
+            keyStr2="请输入"
+            inputType="digit"
+            typeStr="inputFont"
+            inputFont="万"
+            bc={this.baseFormChange.bind(this)}
+          />
+          <LFormGroup
+            val={formObj.ygys}
+            valStr="ygys"
+            keyStr="月供预算"
+            keyStr2="请输入"
+            inputType="digit"
+            typeStr="inputFont"
+            inputFont="元"
+            bc={this.baseFormChange.bind(this)}
+          />
+          <View className="l-floor-footer t2">
+            <View className="lff-flex">
+              <View className="lff-btn full t6 b" onClick={this.saveHandle.bind(this)}>提交</View>
+            </View>
+          </View>
+          <View className="scoped-tips">平台一直严格保护用户隐私,请放心填写</View>
+        </View>
+      </View>
+    )
+  }
+}
+
+export default Index

+ 68 - 0
src/pagesPlan/apply2.scss

@@ -0,0 +1,68 @@
+@import '@css/mixin.scss';
+Page {
+  background: #ffab40;
+  height: 100%;
+}
+.scoped-box {
+  background: #ffab40;
+  position: relative;
+  width: 750px;
+  height: 1245px;
+  .sb-bg {
+    position: absolute;
+    top: 0;
+    left: 0;
+    z-index: 1;
+    width: 750px;
+    height: 1245px;
+    .img {
+      width: 750px;
+      height: 1245px;
+    }
+  }
+  .sb-main {
+    position: absolute;
+    top: 420px;
+    left: 40px;
+    z-index: 2;
+    width: 670px;
+    height: 540px;
+    background: #fff;
+    box-sizing: border-box;
+  }
+  .sb-title {
+    position: absolute;
+    top: 110px;
+    left: 0;
+    z-index: 2;
+    text-align: center;
+    color: #fff;
+    font-size: 60px;
+    text-align: center;
+    width: 100%;
+    font-weight: bold;
+    @include textOverflows();
+  }
+  .sb-footer {
+    padding: 30px 0;
+    .img {
+      width: 100%;
+      height: 79px;
+    }
+  }
+}
+
+.scoped-prev {
+  position: absolute;
+  top: 60px;
+  left: 0;
+  z-index: 3;
+  width: 158px;
+  height: 50px;
+}
+
+.scoped-tips {
+  color: #ccc;
+  font-size: 24px;
+  text-align: center;
+}

+ 2 - 1
src/pagesPlan/discountGroup.jsx

@@ -310,6 +310,7 @@ class Index extends Component {
     const bged1 = require('./img/discountGroup/bg_sed1.png')
     const bged2 = require('./img/discountGroup/bg_sed2.png')
     const { eId } = this.$router.params
+    const { eName } = this.$router.params
     return (
       <View className="get-success">
         <View className="bg"></View>
@@ -340,7 +341,7 @@ class Index extends Component {
           </View>
           <View className="gs-footer">
             <View className="b t2" onClick={this.closeGetPopup.bind(this)}>关闭</View>
-            <Navigator url={`/pagesPlan/apply?eId=${eId}`} className="b">去填写意向</Navigator>
+            <Navigator url={`/pagesPlan/apply2?eId=${eId}&eName=${eName}`} className="b">去填写意向</Navigator>
           </View>
           {
             launchObj.status === 3

BIN
src/pagesPlan/img/apply/banner.jpg


BIN
src/pagesPlan/img/apply/bg.jpg


BIN
src/pagesPlan/img/apply/btn.png


BIN
src/pagesPlan/img/apply/btn2.png


BIN
src/pagesPlan/img/apply/more.gif


BIN
src/pagesPlan/img/apply/slogan.jpg


+ 17 - 8
src/pagesQa/msg/chat.jsx

@@ -36,8 +36,9 @@ class Index extends Component {
     let pages = getCurrentPages()
     let prevPage = pages[ pages.length - 2 ]
     if (prevPage.$component.getNotifycount) prevPage.$component.getNotifycount()
+    if (prevPage.$component.getNewData) prevPage.$component.getNewData()
   }
-
+  
   closeSocket () {
     Taro.closeSocket()
     const { socketTimer } = this.state
@@ -133,14 +134,13 @@ class Index extends Component {
     const { uObj } = this.state
     const that = this
     Taro.connectSocket({
-      url: 'ws://192.168.101.147:8089/acc',
+      url: 'wss://chat.honglouplus.com/acc',
       success: function () {
         console.log('connect success')
       }
     }).then(task => {
       task.onOpen(function () {
         // console.log('onOpen')
-        // const { to_user_id } = that.$router.params
         let token = Taro.getStorageSync('APP_token')
         task.send({ data: '{"seq":"' + that.sendId() + '","cmd":"login","data":{"userId":"' + uObj.user_id + '","appId":101,"serviceToken":"' + token + '"}}' })
         const socketTimer = setInterval(() => {
@@ -161,11 +161,18 @@ class Index extends Component {
             if (data.cmd === 'login') {
               msgSocketList.push({msg: '登录成功~'})
             } else {
-              msgSocketList.push(res.data)
+              const { to_user_id } = that.$router.params
+              if (to_user_id === res.data.from) {
+                msgSocketList.push(res.data)
+              } else {
+                msgSocketList.push({msg: '有其他人给你发消息啦,返回消息列表查看'})
+              }
             }
             that.setState({
               msgSocketList
             }, () => {
+              const { qTitle } = that.$router.params
+              if (qTitle) that.sendHandle('text', `你好,我想了解一下# ${qTitle} #这个房源`)
               setTimeout(() => {
                 that.setState({
                   viewId: `item${msgSocketList.length - 1}`
@@ -289,22 +296,24 @@ class Index extends Component {
   }
 
 
-  sendHandle () {
+  sendHandle (type, defaultMsg) {
     const that = this
     const { uObj } = this.state
     const { commentVal } = this.state
     let { msgSocketList } = this.state
     const { to_user_id } = this.$router.params
     let apiStr = 'apiusersendmessage'
-    if (commentVal) {
+    let msg = commentVal
+    if (type === 'text') msg = defaultMsg
+    if (msg) {
       Taro.api.room[apiStr]({
-        message: commentVal,
+        message: msg,
         type: 'text',
         to_user: to_user_id,
       }).then(res => {
         msgSocketList.push({
           from: uObj.user_id,
-          msg: commentVal
+          msg
         })
         this.setState({
           msgSocketList,

+ 8 - 1
src/pagesQa/msg/index.jsx

@@ -50,6 +50,13 @@ class Index extends Component {
       })
     })
   }
+  getNewData = () => {
+    this.setState({
+      page: 1
+    }, () =>{
+      this.getDataList()
+    })
+  }
 
   getDataList () {
     let { page_size, page, dataList, isListEmpty } = this.state
@@ -111,7 +118,7 @@ class Index extends Component {
             </View>
             <View className="sl-right">
               <View className="sl-p1">{item.nickname}</View>
-              <View className="sl-p2">{item.message_content}</View>
+              <View className="sl-p2">{item.message_content || ''}</View>
               {
                 item.num > 0
                 &&

+ 2 - 1
src/pagesQa/msg/index.scss

@@ -23,7 +23,8 @@
     }
   }
   .sl-right {
-    flex: 1;
+    display: inline-block;
+    max-width: 450px;
     padding-left: 20px;
   }
   .sl-p1 {

+ 25 - 3
src/pagesRoom/dtl.jsx

@@ -279,8 +279,9 @@ class Index extends Component {
 
 
   netLink (saleObj) {
+    const { curObj } = this.state
     Taro.navigateTo({
-      url: `/pagesQa/msg/chat?to_user_id=${saleObj.user_id}`
+      url: `/pagesQa/msg/chat?to_user_id=${saleObj.user_id}&qTitle=${curObj.title}`
     })
   }
   callHandle (saleObj) {
@@ -288,6 +289,27 @@ class Index extends Component {
       phoneNumber: saleObj.sale_phone
     })
   }
+  afterCount (type) {
+    const { curObj } = this.state
+    if (type === 'chat') {
+      this.netLink(curObj.sale_user)
+    }
+    if (type === 'call') {
+      this.callHandle(curObj.sale_user)
+    }
+  }
+  countHandle (type) {
+    const { curObj } = this.state
+    Taro.api.room.apiusercontactclick({
+      target_id: curObj.id,
+      sale_id: curObj.sale_id,
+      click_type: type === 'call' ? '2' : '1' // 1在线聊 2打电话
+    }).then(() => {
+      this.afterCount(type)
+    }).catch(() => {
+      this.afterCount(type)
+    })
+  }
 
   renderSale () {
     const { curObj } = this.state
@@ -303,8 +325,8 @@ class Index extends Component {
           <View className="p2">{tagStr}</View>
         </View>
         <View className="ss-r">
-          <View className="b" onClick={this.netLink.bind(this, saleObj)}>在线问</View>
-          <View className="b t2" onClick={this.callHandle.bind(this, saleObj)}>打电话</View>
+          <View className="b" onClick={this.countHandle.bind(this, 'chat')}>在线问</View>
+          <View className="b t2" onClick={this.countHandle.bind(this, 'call')}>打电话</View>
         </View>
       </View>
     )

+ 2 - 2
src/utils/http.js

@@ -23,8 +23,8 @@ const Http = (options = { data: {} }) => {
       }
     }
     try {
-      let baseUrl = 'http://api.dev.com'
-      // let baseUrl = 'https://api.honglouplus.com'
+      // let baseUrl = 'http://api.dev.com'
+      let baseUrl = 'https://api.honglouplus.com'
       // let baseUrl = 'https://api.honglounews.com'
       const resX = Taro.request({
         url: baseUrl + options.url,