Parcourir la source

projectdetail

xujing il y a 5 ans
Parent
révision
4300c1ea06

+ 51
- 15
src/components/consultant/index.js Voir le fichier

@@ -1,6 +1,7 @@
1 1
 import Taro, { Component } from '@tarojs/taro';
2 2
 import './index.scss'
3 3
 import { transferImage } from '@utils/tools'
4
+import { reportClient } from '@services/report'
4 5
 
5 6
 export default class Index extends Component {
6 7
     state = {
@@ -13,6 +14,34 @@ export default class Index extends Component {
13 14
         style: {},
14 15
         data: []
15 16
     }
17
+    componentDidMount() {
18
+        
19
+    }
20
+    // 报备客户
21
+    reportClient() {
22
+
23
+        // const router = Taro.getStorageSync('router')
24
+        // const consultant = this.$router.params.consultant || router.query.consultant || ""
25
+        // const {
26
+        //     userInfo: { person: { phone, tel, userId } }
27
+        // } = this.props
28
+        // // debugger
29
+        // if (consultant && consultant != userId) {
30
+        //     const realPhone = phone || tel
31
+        //     const payload = {
32
+        //         realtyConsultant: consultant, //报备人 置业顾问
33
+        //         phone: realPhone,
34
+        //         showToast: false
35
+        //     }
36
+
37
+        //     reportClient(payload).then(res => {
38
+        //         console.log('恭喜您绑定成功')
39
+        //     }).catch(err => {
40
+        //         console.error(err)
41
+        //     })
42
+        // }
43
+    }
44
+    //   悬浮框显示隐藏
16 45
     handleClick() {
17 46
         setTimeout(() => {
18 47
             this.setState({
@@ -27,32 +56,39 @@ export default class Index extends Component {
27 56
             })
28 57
         }, 260)
29 58
     }
59
+    // 拨打电话
60
+    handleTelClick(data, e) {
61
+        e.stopPropagation()
62
+        Taro.makePhoneCall({
63
+            phoneNumber: data.phone
64
+        })
65
+    }
66
+    handleChatClick(data, e) {
67
+        e.stopPropagation()
68
+        const { personId, name } = this.props
69
+        Taro.navigateTo({
70
+            url: `/pages/im/index?sendId=${personId}&sendName=${encodeURIComponent(name)}&receiverId=${data.id}&receiverName=${encodeURIComponent(data.name)}`
71
+        })
72
+    }
30 73
     render() {
31 74
         const { show } = this.state
32
-        const { data,style } = this.props
75
+        const { data, style } = this.props
33 76
         return (
34 77
             <View >
35
-                {/* {show && */}
36 78
                 <View className={show ? "consultant show" : "consultant hide"} style={style} onClick={this.handleClick}  >
37 79
                     <Image src={require('@assets/person/left.png')} className='left-img'></Image>
38
-                    <Image src={transferImage(data.touxiang)} className='img'></Image>
39
-                    <View className="text">{data.name}</View>
80
+                    <Image src={transferImage(data.picture || require('@assets/default-avatar.png'))} className='img'></Image>
81
+                    <View className="text">{data.name || ''}</View>
40 82
                 </View>
41
-                {/* } */}
42
-                {/* {!show && */}
43 83
                 <View className={show ? "consultant-more hide " : "consultant-more more-show "} style={style} >
44 84
                     <Image src={require('@assets/person/cancel.png')} onClick={this.handleClickTwo} className='cancel-img'></Image>
45
-                    <Image src={transferImage(data.touxiang)}  className='touxiang'></Image>
85
+                    <Image src={transferImage(data.picture || require('@assets/default-avatar.png'))} className='touxiang'></Image>
46 86
                     <View className="text">
47
-                        <View className="name">{data.name}</View>
48
-                        <View className="company">{data.company}</View>
87
+                        <View className="name">{data.name || ''}</View>
88
+                        <View className="company">{data.company || ''}</View>
49 89
                     </View>
50
-                    <Image src={require('@assets/person/phone.png')} className='phone-img'></Image>
51
-                    <Image src={require('@assets/person/message.png')} className='message-img'></Image>
52
-                </View>
53
-                {/* } */}
54
-
55
-                <View>
90
+                    <Image src={require('@assets/person/phone.png')} onClick={this.handleTelClick.bind(this, data)} className='phone-img'></Image>
91
+                    <Image src={require('@assets/person/message.png')} onClick={this.handleChatClick.bind(this, data)} className='message-img'></Image>
56 92
                 </View>
57 93
             </View>
58 94
         );

+ 26
- 9
src/pages/news/detail/index.js Voir le fichier

@@ -5,11 +5,13 @@ import dayjs from 'dayjs'
5 5
 import Poster from './poster'
6 6
 import WxParse from '@components/wxParse/wxParse'
7 7
 import BackHomeBtn from '@components/BackHomeBtn'
8
-import Consultant from '@components/consultant'
9 8
 import Notice from '@components/Notice'
10 9
 import { getMiniQrcode, savePoint, updatePoint } from '@services/common'
11 10
 import { getDownloadURL, transferImage } from '@utils/tools'
12 11
 import { getQrCodeParams } from '@utils/qrcode'
12
+import { getCardDetail } from '@services/card'
13
+import { ROLE_CODE } from '@constants/user'
14
+import Consultant from '@components/consultant'
13 15
 import {
14 16
   addNewsUv,
15 17
   favorNews,
@@ -34,7 +36,8 @@ export default class NewsDetail extends Component {
34 36
     posterShow: 'none',
35 37
     posterData: {},
36 38
     posterVisible: false,
37
-    btnData: { name: '哈哈哈哈', touxiang: 'http://pic3.zhimg.com/50/v2-55f854baa56381deff541029d51662d0_hd.jpg', company: '南京橙蕉互动数字科技有限公司' }
39
+    consultData: {},
40
+    consultShow: false
38 41
   }
39 42
 
40 43
   componentWillMount() {
@@ -46,6 +49,17 @@ export default class NewsDetail extends Component {
46 49
 
47 50
       const newsId = this.$router.params.id || router.query.id
48 51
 
52
+      const consultant = this.$router.params.consultant || router.query.consultant
53
+      if (consultant) {
54
+        getCardDetail(consultant).then(res => {
55
+
56
+          this.setState({
57
+            consultData: res,
58
+            consultShow: true
59
+          })
60
+        })
61
+      }
62
+
49 63
       if (!newsId) {
50 64
         getQrCodeParams(this.$router.params.scene).then(res => {
51 65
           this.setState({ newsId: res.id }, () => {
@@ -109,7 +123,9 @@ export default class NewsDetail extends Component {
109 123
   }
110 124
   onShareAppMessage = () => {
111 125
     const { detail: { shareContents, newsName, newsId, newsImg } } = this.state
112
-    const { userInfo: { person: { personId } } } = this.props
126
+    const { userInfo: { person: { personId, personType } } } = this.props
127
+    const consultant = personType == ROLE_CODE['CONSULTANT'] ? personId : ""
128
+
113 129
     savePoint({
114 130
       event: 'share',
115 131
       eventType: 'activity',
@@ -124,7 +140,7 @@ export default class NewsDetail extends Component {
124 140
 
125 141
     return {
126 142
       title: shareContents[0].shareContentTitle,
127
-      path: `/pages/news/detail/index?id=${newsId}&from=news_share&recommender=${personId}`,//分享地址
143
+      path: `/pages/news/detail/index?id=${newsId}&from=news_share&recommender=${personId}&consultant=${consultant}`,//分享地址
128 144
       imageUrl: shareContents[0].shareContentImg
129 145
     }
130 146
   }
@@ -220,7 +236,8 @@ export default class NewsDetail extends Component {
220 236
     })
221 237
   }
222 238
   render() {
223
-    const { detail, loaded, isSaved, posterVisible, posterData, posterShow, btnData } = this.state
239
+    const { detail, loaded, isSaved, posterVisible, posterData, posterShow, consultData, consultShow } = this.state
240
+    const { userInfo: { person: { personId, nickname, name } } } = this.props
224 241
     return (
225 242
       <Block>
226 243
         {/* 生成海报 */}
@@ -245,11 +262,11 @@ export default class NewsDetail extends Component {
245 262
                   <template is='wxParse' data='{{wxParseData:article.nodes}}' />
246 263
                 </View>
247 264
               </ScrollView>
248
-
249 265
               <Notice></Notice>
250
-              <BackHomeBtn style="bottom:160px" ></BackHomeBtn>
251
-              {/* <Consultant data={btnData}></Consultant> */}
252
-
266
+              <BackHomeBtn style={consultShow ? "bottom:320rpx" : ''}></BackHomeBtn>
267
+              {
268
+                consultShow && <Consultant personId={personId} name={name || nickname} data={consultData}></Consultant>
269
+              }
253 270
               <View className="bot-nav flex">
254 271
                 <View className='btn poster-btn' style={{ display: posterShow }} onClick={() => { this.handleTogglePoster(true) }}>
255 272
                   {/* <Text className="iconfont icon-xiazai"></Text> */}

+ 5
- 5
src/pages/person/customerAnalysis/index.scss Voir le fichier

@@ -182,15 +182,15 @@
182 182
     border-radius: 50%;
183 183
     position: absolute;
184 184
     top:50%;
185
-    left: 128px;
185
+    left: 56px;
186 186
     margin-top: -88px;
187 187
   }
188 188
   .user__left__name{
189 189
     font-size:32px;
190 190
     color: $primary-color;
191 191
     position: absolute;
192
-    top:76px;
193
-    left:320px;
192
+    top:66px;
193
+    left:250px;
194 194
     display: flex;
195 195
     align-items: center;
196 196
     .text{
@@ -202,8 +202,8 @@
202 202
     font-size:32px;
203 203
     color: #333;
204 204
     position: absolute;
205
-    bottom:76px;
206
-    left:320px;
205
+    bottom:62px;
206
+    left:250px;
207 207
     display: flex;
208 208
     align-items: center;
209 209
   }

+ 12
- 1
src/pages/person/customerAnalysis/myCustomer.js Voir le fichier

@@ -13,6 +13,7 @@ import emptyImg from '@assets/empty.png'
13 13
 const maleImg = require('@assets/person/male.png')
14 14
 const femaleImg = require('@assets/person/female.png')
15 15
 const phoneImg = require('@assets/person/phone.png')
16
+const messageImg = require('@assets/person/message.png')
16 17
 
17 18
 @connect(({ user, city }) => ({ user, city }))
18 19
 export default class myCustomer extends Taro.Component {
@@ -363,6 +364,13 @@ export default class myCustomer extends Taro.Component {
363 364
       followVisible: false,
364 365
     })
365 366
   }
367
+  handleChatClick(item, e) {
368
+    e.stopPropagation()
369
+    const { userInfo: { person: { personId, nickname, name } } } = this.props
370
+    Taro.navigateTo({
371
+      url: `/pages/im/index?sendId=${personId}&sendName=${encodeURIComponent(name || nickname)}&receiverId=${item.personId}&receiverName=${encodeURIComponent(item.name || item.nickname)}`
372
+    })
373
+  }
366 374
   renderBaseBox() {
367 375
     const { baseInfo, desc, selector, sexSelector } = this.state
368 376
     return (
@@ -462,7 +470,10 @@ export default class myCustomer extends Taro.Component {
462 470
               customerDetail.sex == '2' && <Image style="width:36rpx;height:36rpx;margin-left:10rpx" src={femaleImg} />
463 471
             }
464 472
           </View>
465
-          <View onClick={this.handleTelClick.bind(this, customerDetail)} className='user__left__phone'>{customerDetail.phone}<Image style="width:36rpx;height:36rpx;margin-left:20rpx;" src={phoneImg} /></View>
473
+          <View className='user__left__phone'>{customerDetail.phone}
474
+            <Image onClick={this.handleTelClick.bind(this, customerDetail)} style="width:36rpx;height:36rpx;margin-left:20rpx;background:rgba(255,219,179,0.2);padding: 14rpx;border-radius: 30rpx;" src={phoneImg} />
475
+            <Image onClick={this.handleChatClick.bind(this, item)} style="width:36rpx;height:36rpx;margin-left:40rpx;background:rgba(255,219,179,0.2);padding: 14rpx;border-radius: 30rpx;" src={messageImg} />
476
+          </View>
466 477
         </View>
467 478
         <AtTabs height="calc(100vh - 300rpx)" className="my-tab" current={this.state.current} tabList={tabList} onClick={this.handleClick.bind(this)}>
468 479
           <AtTabsPane current={this.state.current} index={0} >

+ 35
- 16
src/pages/project/detail/index.js Voir le fichier

@@ -27,6 +27,8 @@ import { connect } from '@tarojs/redux'
27 27
 import { dispatchProjectDetail } from '@actions/project'
28 28
 import getUserPhone from '@utils/getUserPhone'
29 29
 import { ROLE_CODE } from '@constants/user'
30
+import { getCardDetail } from '@services/card'
31
+import Consultant from '@components/consultant'
30 32
 const buildBg = 'https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/images/buildbg.png'
31 33
 const dotImg = require('@assets/dot.png')
32 34
 
@@ -61,6 +63,8 @@ export default class Index extends Component {
61 63
     albumCurrent: 0,
62 64
     videoPlayShow: 'flex',
63 65
     grantPhoneVisible: false, // 授权手机弹框
66
+    consultData: {}, // 分享的置业顾问信息
67
+    consultShow: false  // 置业顾问悬浮框显示隐藏
64 68
   }
65 69
 
66 70
   componentWillMount() {
@@ -69,19 +73,31 @@ export default class Index extends Component {
69 73
       // const options = wx.getLaunchOptionsSync()
70 74
       // console.log('-------options----->', options)
71 75
       // if (sceneInShare(options.scene)) {
72
-        const { person = {} } = this.props.userInfo || {}
73
-        console.log('-------person----->', person)
74
-        if ((person.tel || person.phone) && (person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
75
-          Taro.reLaunch({ url: '/pages/auth/index' })
76
-          return
77
-        }
78
-
79
-        this.setState({
80
-          grantPhoneVisible: true,
76
+      const router = Taro.getStorageSync('router')
77
+      const consultant = this.$router.params.consultant || router.query.consultant
78
+      if (consultant) {
79
+        console.log(consultant, "$$$$$$$$$$$$$$$$$$$$$$$$$$$4444")
80
+        getCardDetail(consultant).then(res => {
81
+          console.log(res, "$$$$$$$$$$$$$$$$$$$$$$$$$$$")
82
+          this.setState({
83
+            consultData: res,
84
+            consultShow: true
85
+          })
81 86
         })
87
+      }
88
+      const { person = {} } = this.props.userInfo || {}
89
+      console.log('-------person----->', person)
90
+      if ((person.tel || person.phone) && (person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
91
+        Taro.reLaunch({ url: '/pages/auth/index' })
92
+        return
93
+      }
94
+
95
+      this.setState({
96
+        grantPhoneVisible: true,
97
+      })
82 98
       // }
83 99
 
84
-      const router = Taro.getStorageSync('router')
100
+
85 101
       const id = this.$router.params.id || router.query.id
86 102
 
87 103
       // 没有找到 id , 再重新找一次
@@ -291,10 +307,11 @@ export default class Index extends Component {
291 307
     }).then(res => {
292 308
       console.log('项目详情分享')
293 309
     })
294
-
310
+    const router = Taro.getStorageSync('router')
311
+    const consultant = this.$router.params.consultant || router.query.consultant || " "
295 312
     return {
296 313
       title: shareContents[0].shareContentTitle,//分享内容
297
-      path: `/pages/project/detail/index?id=${buildingId}&from=building_share&recommender=${personId}`,//分享地址
314
+      path: `/pages/project/detail/index?id=${buildingId}&from=building_share&recommender=${personId}&consultant=${consultant}`,//分享地址
298 315
       imageUrl: shareContents[0].shareContentImg
299 316
     }
300 317
   }
@@ -1056,17 +1073,16 @@ export default class Index extends Component {
1056 1073
   }
1057 1074
 
1058 1075
   render() {
1059
-    const { posterStatus, posterData, loaded, btnstate, grantPhoneVisible } = this.state
1076
+    const { posterStatus, posterData, loaded, btnstate, grantPhoneVisible, consultData, consultShow } = this.state
1060 1077
     const { projectDetail, userInfo } = this.props
1061 1078
     const { uvList = {} } = projectDetail
1062 1079
     const { total = 0, records = [] } = uvList
1063 1080
     const openDate = projectDetail.openingDate ? dayjs(projectDetail.openingDate).locale('zh-cn').format('YYYY年M月D日') : '暂无'
1064
-
1065 1081
     return (
1066 1082
       <Block>
1067 1083
         {
1068 1084
           (grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone) &&
1069
-          <AchievePhone user={userInfo.person} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
1085
+          <AchievePhone user={person} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
1070 1086
         }
1071 1087
         {
1072 1088
           loaded && (
@@ -1217,7 +1233,10 @@ export default class Index extends Component {
1217 1233
                 <Text className="iconfont icon-shouyeshouye"></Text>
1218 1234
                 <Text className="text">首页</Text>
1219 1235
               </View> */}
1220
-              <BackHomeBtn></BackHomeBtn>
1236
+              <BackHomeBtn style={consultShow ? "bottom:320rpx" : ''}></BackHomeBtn>
1237
+              {
1238
+                consultShow && <Consultant style="bottom:170rpx" personId={userInfo.person.personId} name={userInfo.person.name || userInfo.person.nickname} data={consultData}></Consultant>
1239
+              }
1221 1240
             </View>
1222 1241
           )
1223 1242
         }