浏览代码

projectdetail

xujing 5 年前
父节点
当前提交
4300c1ea06

+ 51
- 15
src/components/consultant/index.js 查看文件

1
 import Taro, { Component } from '@tarojs/taro';
1
 import Taro, { Component } from '@tarojs/taro';
2
 import './index.scss'
2
 import './index.scss'
3
 import { transferImage } from '@utils/tools'
3
 import { transferImage } from '@utils/tools'
4
+import { reportClient } from '@services/report'
4
 
5
 
5
 export default class Index extends Component {
6
 export default class Index extends Component {
6
     state = {
7
     state = {
13
         style: {},
14
         style: {},
14
         data: []
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
     handleClick() {
45
     handleClick() {
17
         setTimeout(() => {
46
         setTimeout(() => {
18
             this.setState({
47
             this.setState({
27
             })
56
             })
28
         }, 260)
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
     render() {
73
     render() {
31
         const { show } = this.state
74
         const { show } = this.state
32
-        const { data,style } = this.props
75
+        const { data, style } = this.props
33
         return (
76
         return (
34
             <View >
77
             <View >
35
-                {/* {show && */}
36
                 <View className={show ? "consultant show" : "consultant hide"} style={style} onClick={this.handleClick}  >
78
                 <View className={show ? "consultant show" : "consultant hide"} style={style} onClick={this.handleClick}  >
37
                     <Image src={require('@assets/person/left.png')} className='left-img'></Image>
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
                 </View>
82
                 </View>
41
-                {/* } */}
42
-                {/* {!show && */}
43
                 <View className={show ? "consultant-more hide " : "consultant-more more-show "} style={style} >
83
                 <View className={show ? "consultant-more hide " : "consultant-more more-show "} style={style} >
44
                     <Image src={require('@assets/person/cancel.png')} onClick={this.handleClickTwo} className='cancel-img'></Image>
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
                     <View className="text">
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
                     </View>
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
                 </View>
92
                 </View>
57
             </View>
93
             </View>
58
         );
94
         );

+ 26
- 9
src/pages/news/detail/index.js 查看文件

5
 import Poster from './poster'
5
 import Poster from './poster'
6
 import WxParse from '@components/wxParse/wxParse'
6
 import WxParse from '@components/wxParse/wxParse'
7
 import BackHomeBtn from '@components/BackHomeBtn'
7
 import BackHomeBtn from '@components/BackHomeBtn'
8
-import Consultant from '@components/consultant'
9
 import Notice from '@components/Notice'
8
 import Notice from '@components/Notice'
10
 import { getMiniQrcode, savePoint, updatePoint } from '@services/common'
9
 import { getMiniQrcode, savePoint, updatePoint } from '@services/common'
11
 import { getDownloadURL, transferImage } from '@utils/tools'
10
 import { getDownloadURL, transferImage } from '@utils/tools'
12
 import { getQrCodeParams } from '@utils/qrcode'
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
 import {
15
 import {
14
   addNewsUv,
16
   addNewsUv,
15
   favorNews,
17
   favorNews,
34
     posterShow: 'none',
36
     posterShow: 'none',
35
     posterData: {},
37
     posterData: {},
36
     posterVisible: false,
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
   componentWillMount() {
43
   componentWillMount() {
46
 
49
 
47
       const newsId = this.$router.params.id || router.query.id
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
       if (!newsId) {
63
       if (!newsId) {
50
         getQrCodeParams(this.$router.params.scene).then(res => {
64
         getQrCodeParams(this.$router.params.scene).then(res => {
51
           this.setState({ newsId: res.id }, () => {
65
           this.setState({ newsId: res.id }, () => {
109
   }
123
   }
110
   onShareAppMessage = () => {
124
   onShareAppMessage = () => {
111
     const { detail: { shareContents, newsName, newsId, newsImg } } = this.state
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
     savePoint({
129
     savePoint({
114
       event: 'share',
130
       event: 'share',
115
       eventType: 'activity',
131
       eventType: 'activity',
124
 
140
 
125
     return {
141
     return {
126
       title: shareContents[0].shareContentTitle,
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
       imageUrl: shareContents[0].shareContentImg
144
       imageUrl: shareContents[0].shareContentImg
129
     }
145
     }
130
   }
146
   }
220
     })
236
     })
221
   }
237
   }
222
   render() {
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
     return (
241
     return (
225
       <Block>
242
       <Block>
226
         {/* 生成海报 */}
243
         {/* 生成海报 */}
245
                   <template is='wxParse' data='{{wxParseData:article.nodes}}' />
262
                   <template is='wxParse' data='{{wxParseData:article.nodes}}' />
246
                 </View>
263
                 </View>
247
               </ScrollView>
264
               </ScrollView>
248
-
249
               <Notice></Notice>
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
               <View className="bot-nav flex">
270
               <View className="bot-nav flex">
254
                 <View className='btn poster-btn' style={{ display: posterShow }} onClick={() => { this.handleTogglePoster(true) }}>
271
                 <View className='btn poster-btn' style={{ display: posterShow }} onClick={() => { this.handleTogglePoster(true) }}>
255
                   {/* <Text className="iconfont icon-xiazai"></Text> */}
272
                   {/* <Text className="iconfont icon-xiazai"></Text> */}

+ 5
- 5
src/pages/person/customerAnalysis/index.scss 查看文件

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

+ 12
- 1
src/pages/person/customerAnalysis/myCustomer.js 查看文件

13
 const maleImg = require('@assets/person/male.png')
13
 const maleImg = require('@assets/person/male.png')
14
 const femaleImg = require('@assets/person/female.png')
14
 const femaleImg = require('@assets/person/female.png')
15
 const phoneImg = require('@assets/person/phone.png')
15
 const phoneImg = require('@assets/person/phone.png')
16
+const messageImg = require('@assets/person/message.png')
16
 
17
 
17
 @connect(({ user, city }) => ({ user, city }))
18
 @connect(({ user, city }) => ({ user, city }))
18
 export default class myCustomer extends Taro.Component {
19
 export default class myCustomer extends Taro.Component {
363
       followVisible: false,
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
   renderBaseBox() {
374
   renderBaseBox() {
367
     const { baseInfo, desc, selector, sexSelector } = this.state
375
     const { baseInfo, desc, selector, sexSelector } = this.state
368
     return (
376
     return (
462
               customerDetail.sex == '2' && <Image style="width:36rpx;height:36rpx;margin-left:10rpx" src={femaleImg} />
470
               customerDetail.sex == '2' && <Image style="width:36rpx;height:36rpx;margin-left:10rpx" src={femaleImg} />
463
             }
471
             }
464
           </View>
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
         </View>
477
         </View>
467
         <AtTabs height="calc(100vh - 300rpx)" className="my-tab" current={this.state.current} tabList={tabList} onClick={this.handleClick.bind(this)}>
478
         <AtTabs height="calc(100vh - 300rpx)" className="my-tab" current={this.state.current} tabList={tabList} onClick={this.handleClick.bind(this)}>
468
           <AtTabsPane current={this.state.current} index={0} >
479
           <AtTabsPane current={this.state.current} index={0} >

+ 35
- 16
src/pages/project/detail/index.js 查看文件

27
 import { dispatchProjectDetail } from '@actions/project'
27
 import { dispatchProjectDetail } from '@actions/project'
28
 import getUserPhone from '@utils/getUserPhone'
28
 import getUserPhone from '@utils/getUserPhone'
29
 import { ROLE_CODE } from '@constants/user'
29
 import { ROLE_CODE } from '@constants/user'
30
+import { getCardDetail } from '@services/card'
31
+import Consultant from '@components/consultant'
30
 const buildBg = 'https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/images/buildbg.png'
32
 const buildBg = 'https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/images/buildbg.png'
31
 const dotImg = require('@assets/dot.png')
33
 const dotImg = require('@assets/dot.png')
32
 
34
 
61
     albumCurrent: 0,
63
     albumCurrent: 0,
62
     videoPlayShow: 'flex',
64
     videoPlayShow: 'flex',
63
     grantPhoneVisible: false, // 授权手机弹框
65
     grantPhoneVisible: false, // 授权手机弹框
66
+    consultData: {}, // 分享的置业顾问信息
67
+    consultShow: false  // 置业顾问悬浮框显示隐藏
64
   }
68
   }
65
 
69
 
66
   componentWillMount() {
70
   componentWillMount() {
69
       // const options = wx.getLaunchOptionsSync()
73
       // const options = wx.getLaunchOptionsSync()
70
       // console.log('-------options----->', options)
74
       // console.log('-------options----->', options)
71
       // if (sceneInShare(options.scene)) {
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
       const id = this.$router.params.id || router.query.id
101
       const id = this.$router.params.id || router.query.id
86
 
102
 
87
       // 没有找到 id , 再重新找一次
103
       // 没有找到 id , 再重新找一次
291
     }).then(res => {
307
     }).then(res => {
292
       console.log('项目详情分享')
308
       console.log('项目详情分享')
293
     })
309
     })
294
-
310
+    const router = Taro.getStorageSync('router')
311
+    const consultant = this.$router.params.consultant || router.query.consultant || " "
295
     return {
312
     return {
296
       title: shareContents[0].shareContentTitle,//分享内容
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
       imageUrl: shareContents[0].shareContentImg
315
       imageUrl: shareContents[0].shareContentImg
299
     }
316
     }
300
   }
317
   }
1056
   }
1073
   }
1057
 
1074
 
1058
   render() {
1075
   render() {
1059
-    const { posterStatus, posterData, loaded, btnstate, grantPhoneVisible } = this.state
1076
+    const { posterStatus, posterData, loaded, btnstate, grantPhoneVisible, consultData, consultShow } = this.state
1060
     const { projectDetail, userInfo } = this.props
1077
     const { projectDetail, userInfo } = this.props
1061
     const { uvList = {} } = projectDetail
1078
     const { uvList = {} } = projectDetail
1062
     const { total = 0, records = [] } = uvList
1079
     const { total = 0, records = [] } = uvList
1063
     const openDate = projectDetail.openingDate ? dayjs(projectDetail.openingDate).locale('zh-cn').format('YYYY年M月D日') : '暂无'
1080
     const openDate = projectDetail.openingDate ? dayjs(projectDetail.openingDate).locale('zh-cn').format('YYYY年M月D日') : '暂无'
1064
-
1065
     return (
1081
     return (
1066
       <Block>
1082
       <Block>
1067
         {
1083
         {
1068
           (grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone) &&
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
           loaded && (
1088
           loaded && (
1217
                 <Text className="iconfont icon-shouyeshouye"></Text>
1233
                 <Text className="iconfont icon-shouyeshouye"></Text>
1218
                 <Text className="text">首页</Text>
1234
                 <Text className="text">首页</Text>
1219
               </View> */}
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
             </View>
1240
             </View>
1222
           )
1241
           )
1223
         }
1242
         }