张延森 3 jaren geleden
bovenliggende
commit
13ee0d6f93

+ 61
- 0
src/components/FixedConsultant/index.jsx Bestand weergeven

1
+import { useState } from 'react'
2
+import Taro from '@tarojs/taro'
3
+import { Image } from '@tarojs/components'
4
+import { getImgURL } from '@/utils/image'
5
+import './index.scss'
6
+
7
+export default function FixedCard (props) {
8
+  const { consultant } = props
9
+  const { id: consultantId, name, picture, company, avatar, phone } = consultant || {}
10
+
11
+  const [Show, setShow] = useState(false)
12
+
13
+  const handleChat = () => {
14
+    Taro.navigateTo({
15
+      url: `/pages/chat/chatDetail/index?targetPerson=${consultantId}}`
16
+    })
17
+  }
18
+  
19
+  const handleCall = () => {
20
+    if (phone) {
21
+      Taro.makePhoneCall({ phoneNumber: phone })
22
+      return
23
+    }
24
+
25
+    Taro.showToast({ title: '暂无联系电话', icon: 'none' })
26
+  }
27
+
28
+  return !!consultantId && (
29
+    <view className='components FixedCard'>
30
+      <view className='Icon' onClick={() => setShow(true)}>
31
+        <Image mode='aspectFill' src={getImgURL(picture||avatar)}></Image>
32
+      </view>
33
+      <view className='Name'>
34
+        <text>{name}</text>
35
+        <text style={{display: Show ? 'block' : 'none'}}>{company}</text>
36
+      </view>
37
+      <text
38
+        style={{display: Show ? 'inline-block' : 'none'}}
39
+        className='iconfont icon-liaotian Btn'
40
+        onClick={handleChat}
41
+      ></text>
42
+
43
+      <text
44
+        style={{display: Show ? 'inline-block' : 'none'}}
45
+        className='iconfont icon-dianhua1 Btn'
46
+        onClick={handleCall}
47
+      ></text>
48
+
49
+      <text
50
+        style={{display: Show ? 'inline-block' : 'none'}}
51
+        className='iconfont icon-guanbi Btn'
52
+        onClick={() => setShow(false)}
53
+      ></text>
54
+
55
+      <text
56
+        style={{display: Show ? 'none' : 'inline-block'}}
57
+        className='iconfont icon-jiantouright'
58
+      ></text>
59
+    </view>
60
+  )
61
+}

src/pages/index/buildingDetail/components/FixedCard/index.scss → src/components/FixedConsultant/index.scss Bestand weergeven


+ 8
- 1
src/pages/index/buildingDetail/components/BasicInfo/index.jsx Bestand weergeven

15
 
15
 
16
   const goto = (url) => Taro.navigateTo({ url })
16
   const goto = (url) => Taro.navigateTo({ url })
17
 
17
 
18
+  const handleSubscribeMessage = () => {
19
+    Taro.showToast({
20
+      title: '暂未开启',
21
+      icon: 'none',
22
+    })
23
+  }
24
+
18
   return (
25
   return (
19
     <view className='components BasicInfo'>
26
     <view className='components BasicInfo'>
20
 
27
 
161
       {/* 互动 */}
168
       {/* 互动 */}
162
       <view className='Interact flex-h'>
169
       <view className='Interact flex-h'>
163
         <text className='flex-item' onClick={() => goto(`/pages/index/buildingInfo/index?id=${buildingId}`)}>更多楼盘信息</text>
170
         <text className='flex-item' onClick={() => goto(`/pages/index/buildingInfo/index?id=${buildingId}`)}>更多楼盘信息</text>
164
-        <text className='flex-item active'>订阅活动通知</text>
171
+        <text className='flex-item active' onClick={handleSubscribeMessage}>订阅活动通知</text>
165
       </view>
172
       </view>
166
 
173
 
167
       {/* 提示 */}
174
       {/* 提示 */}

+ 1
- 1
src/pages/index/buildingDetail/components/DetailBottom/index.jsx Bestand weergeven

30
 
30
 
31
     if (consultant?.id) {
31
     if (consultant?.id) {
32
       Taro.navigateTo({
32
       Taro.navigateTo({
33
-        url: `/pages/chat/detail?targetPerson=${consultant.id}}`
33
+        url: `/pages/chat/chatDetail/index?targetPerson=${consultant.id}}`
34
       })
34
       })
35
     } else {
35
     } else {
36
       Taro.navigateTo({
36
       Taro.navigateTo({

+ 0
- 31
src/pages/index/buildingDetail/components/FixedCard/index.jsx Bestand weergeven

1
-import { useState } from 'react'
2
-import { Image } from '@tarojs/components'
3
-import { getImgURL } from '@/utils/image'
4
-import './index.scss'
5
-
6
-export default function FixedCard () {
7
-
8
-  const [Show, setShow] = useState(false)
9
-
10
-  const TriggerShow = (bool) => {
11
-    return () => {
12
-      setShow(bool)
13
-    }
14
-  }
15
-
16
-  return (
17
-    <view className='components FixedCard'>
18
-      <view className='Icon' onClick={TriggerShow(true)}>
19
-        <Image mode='aspectFill' src={null}></Image>
20
-      </view>
21
-      <view className='Name'>
22
-        <text>李双舟</text>
23
-        <text style={{display: Show ? 'block' : 'none'}}>南京云致科技服务有限公司</text>
24
-      </view>
25
-      <text style={{display: Show ? 'inline-block' : 'none'}} className='iconfont icon-liaotian Btn'></text>
26
-      <text style={{display: Show ? 'inline-block' : 'none'}} className='iconfont icon-dianhua1 Btn'></text>
27
-      <text style={{display: Show ? 'inline-block' : 'none'}} className='iconfont icon-guanbi Btn' onClick={TriggerShow(false)}></text>
28
-      <text style={{display: Show ? 'none' : 'inline-block'}} className='iconfont icon-jiantouright'></text>
29
-    </view>
30
-  )
31
-}

+ 33
- 14
src/pages/index/buildingDetail/components/PropertyConsultant/index.jsx Bestand weergeven

1
-import { useState } from 'react'
1
+
2
 import { Image } from '@tarojs/components'
2
 import { Image } from '@tarojs/components'
3
 import Taro from '@tarojs/taro'
3
 import Taro from '@tarojs/taro'
4
 import '@/assets/css/iconfont.css'
4
 import '@/assets/css/iconfont.css'
5
 import './index.scss'
5
 import './index.scss'
6
 
6
 
7
-export default function PropertyConsultant (props) {
7
+const TipsList = [
8
+  {name: '官方保障', icon: 'icon-baozhang'},
9
+  {name: '免费咨询', icon: 'icon-zixun'},
10
+  {name: '户型解读', icon: 'icon-jiedu'},
11
+  {name: '贴心服务', icon: 'icon-tiexin'}
12
+]
8
 
13
 
9
-  const { List = [] } = props
10
-  const [TipsList] = useState([
11
-    {name: '官方保障', icon: 'icon-baozhang'},
12
-    {name: '免费咨询', icon: 'icon-zixun'},
13
-    {name: '户型解读', icon: 'icon-jiedu'},
14
-    {name: '贴心服务', icon: 'icon-tiexin'}
15
-  ])
14
+export default function PropertyConsultant (props) {
15
+  const { Info } = props
16
+  const List = Info?.consultants || []
16
 
17
 
17
   const CallPhone = (phone) => { // 拨打电话
18
   const CallPhone = (phone) => { // 拨打电话
18
     Taro.makePhoneCall({ phoneNumber: phone })
19
     Taro.makePhoneCall({ phoneNumber: phone })
19
   }
20
   }
20
 
21
 
22
+  const handleMore = () => {
23
+    Taro.navigateTo({
24
+      url: `/pages/index/buildingPropertyConsultant/index?buildingId=${Info?.buildingId}`
25
+    })
26
+  }
27
+
28
+  const handleChat = (item) => {
29
+    Taro.navigateTo({
30
+      url: `/pages/chat/chatDetail/index?targetPerson=${item.id}}`
31
+    })
32
+  }
33
+  
34
+  const gotoDetail = (item) => {
35
+    Taro.navigateTo({
36
+      url: `/pages/mine/myHomepage/index?id=${item.id}`
37
+    })
38
+  }
39
+
21
   return List.length > 0 ? (
40
   return List.length > 0 ? (
22
     <view className='components PropertyConsultant'>
41
     <view className='components PropertyConsultant'>
23
 
42
 
25
         <view className='flex-item'>
44
         <view className='flex-item'>
26
           <text>置业顾问</text>
45
           <text>置业顾问</text>
27
         </view>
46
         </view>
28
-        <text>更多</text>
47
+        <text onClick={handleMore}>更多</text>
29
         <text className='iconfont icon-jiantouright'></text>
48
         <text className='iconfont icon-jiantouright'></text>
30
       </view>
49
       </view>
31
 
50
 
44
         {
63
         {
45
           List.map((item, index) => (
64
           List.map((item, index) => (
46
             <view key={`PersonItem-${index}`} className='flex-h'>
65
             <view key={`PersonItem-${index}`} className='flex-h'>
47
-              <view className='Icon'>
66
+              <view className='Icon' onClick={() => gotoDetail(item)}>
48
                 <Image mode='aspectFill' src={item.photo || item.avatar}></Image>
67
                 <Image mode='aspectFill' src={item.photo || item.avatar}></Image>
49
               </view>
68
               </view>
50
-              <view className='flex-item'>
69
+              <view className='flex-item' onClick={() => gotoDetail(item)}>
51
                 <text>{item.userName}</text>
70
                 <text>{item.userName}</text>
52
                 <text>{item.description || ''}</text>
71
                 <text>{item.description || ''}</text>
53
               </view>
72
               </view>
54
-              <text className='iconfont icon-liaotian Chat'></text>
55
-              <text className='iconfont icon-dianhua Phone' onClick={CallPhone(item.phone || item.tel)}></text>
73
+              <text className='iconfont icon-liaotian Chat' onClick={() => handleChat(item)}></text>
74
+              <text className='iconfont icon-dianhua Phone' onClick={() => CallPhone(item.phone || item.tel)}></text>
56
             </view>
75
             </view>
57
           ))
76
           ))
58
         }
77
         }

+ 1
- 4
src/pages/index/buildingDetail/index.jsx Bestand weergeven

20
 import LivingActivity from './components/LivingActivity/index'
20
 import LivingActivity from './components/LivingActivity/index'
21
 import News from './components/News/index'
21
 import News from './components/News/index'
22
 import Pictures from './components/Pictures/index'
22
 import Pictures from './components/Pictures/index'
23
-import FixedCard from './components/FixedCard/index'
24
 
23
 
25
 import './index.scss'
24
 import './index.scss'
26
 
25
 
101
 
100
 
102
                 {/* 置业顾问 */}
101
                 {/* 置业顾问 */}
103
                 <view className='PropertyConsultant' style={{minHeight: 0}}>
102
                 <view className='PropertyConsultant' style={{minHeight: 0}}>
104
-                  <PropertyConsultant List={DetailInfo?.consultants}></PropertyConsultant>
103
+                  <PropertyConsultant Info={DetailInfo}></PropertyConsultant>
105
                 </view>
104
                 </view>
106
 
105
 
107
                 {/* 位置及周边 */}
106
                 {/* 位置及周边 */}
153
         onClose={() => setShowPoster(false)}
152
         onClose={() => setShowPoster(false)}
154
         onSuccess={() => setShowPoster(false)}
153
         onSuccess={() => setShowPoster(false)}
155
       />
154
       />
156
-
157
-      <FixedCard></FixedCard>
158
     </view>
155
     </view>
159
   )
156
   )
160
 })
157
 })

+ 52
- 27
src/pages/index/buildingPropertyConsultant/index.jsx Bestand weergeven

1
 import { useState, useEffect } from 'react'
1
 import { useState, useEffect } from 'react'
2
+import Taro from '@tarojs/taro'
2
 import withLayout from '@/layout'
3
 import withLayout from '@/layout'
3
 import { ScrollView, Image } from '@tarojs/components'
4
 import { ScrollView, Image } from '@tarojs/components'
5
+import { getCardList } from '@/services/card'
6
+import { getImgURL } from '@/utils/image'
4
 import '@/assets/css/iconfont.css'
7
 import '@/assets/css/iconfont.css'
5
 import './index.scss'
8
 import './index.scss'
6
 
9
 
7
 export default withLayout((props) => {
10
 export default withLayout((props) => {
11
+  const { router } = props
12
+  const { buildingId } = router.params
8
 
13
 
9
-  const [IsPull, setPull] = useState(false)
10
-  const [PullTimer, setPullTimer] = useState(null)
11
-  const [List, setList] = useState([
12
-    { name: '乖戾', icon: '', time: '11:49' },
13
-    { name: '乖戾', icon: '', time: '11:49' },
14
-    { name: '乖戾', icon: '', time: '11:49' },
15
-    { name: '乖戾', icon: '', time: '11:49' },
16
-    { name: '乖戾', icon: '', time: '11:49' },
17
-    { name: '乖戾', icon: '', time: '11:49' },
18
-  ])
14
+  const [List, setList] = useState([])
19
 
15
 
20
-  const PageRefresh = () => { // 页面下拉刷新回调
21
-    setPull(true)
16
+  const handleChat = (item) => {
17
+    Taro.navigateTo({
18
+      url: `/pages/chat/chatDetail/index?targetPerson=${item.id}}`
19
+    })
22
   }
20
   }
23
 
21
 
24
-  useEffect(() => { // 下拉刷新触发
25
-    if (IsPull) {
26
-      clearTimeout(PullTimer)
27
-      setPullTimer(setTimeout(() => {
28
-        setPull(false)
29
-      }, 2000))
22
+  const handleCall = (item) => {
23
+    if (item.phone) {
24
+      Taro.makePhoneCall({ phoneNumber: item.phone })
25
+      return
30
     }
26
     }
31
-  }, [IsPull])
27
+
28
+    Taro.showToast({ title: '暂无联系电话', icon: 'none' })
29
+  }
30
+
31
+  const gotoDetail = (item) => {
32
+    Taro.navigateTo({
33
+      url: `/pages/mine/myHomepage/index?id=${item.id}`
34
+    })
35
+  }
36
+
37
+  useEffect(() => {
38
+    if (!buildingId) {
39
+      Taro.showToast({
40
+        title: '没有楼盘信息',
41
+        icon: 'none',
42
+      })
43
+      return
44
+    }
45
+
46
+    getCardList({ pageSize: 500, buildingId }).then((res) => {
47
+      const { records } = res || []
48
+      setList(records)
49
+    })
50
+  }, [buildingId])
32
 
51
 
33
   return (
52
   return (
34
     <view className='Page buildingPropertyConsultant'>
53
     <view className='Page buildingPropertyConsultant'>
35
-      <ScrollView scroll-y refresher-enabled refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
54
+      <ScrollView scroll-y>
36
         <text className='TopTips'>有任何买卖房屋的问题,欢迎随时咨询</text>
55
         <text className='TopTips'>有任何买卖房屋的问题,欢迎随时咨询</text>
37
         <view className='List'>
56
         <view className='List'>
38
           {
57
           {
42
                 <view className='flex-h'>
61
                 <view className='flex-h'>
43
 
62
 
44
                   <view className='Icon'>
63
                   <view className='Icon'>
45
-                    <Image mode='scaleToFill' src={item.icon || null}></Image>
64
+                    <Image mode='scaleToFill' src={getImgURL(item.photo || item.avatar)}></Image>
46
                   </view>
65
                   </view>
47
 
66
 
48
-                  <view className='flex-item'>
67
+                  <view className='flex-item' onClick={() => gotoDetail(item)}>
49
                     <view className='Name'>
68
                     <view className='Name'>
50
-                      <text>陆毅</text>
69
+                      <text>{item.name}</text>
51
                       <Image mode='heightFix' src={require('@/assets/index-icon17.png')}></Image>
70
                       <Image mode='heightFix' src={require('@/assets/index-icon17.png')}></Image>
52
                     </view>
71
                     </view>
53
-                    <text>13045678976</text>
72
+                    <text>{item.phone}</text>
54
                   </view>
73
                   </view>
55
 
74
 
56
-                  <text className='iconfont icon-liaotian'></text>
57
-                  <text className='iconfont icon-dianhua'></text>
75
+                  <text
76
+                    className='iconfont icon-liaotian'
77
+                    onClick={() => handleChat(item)}
78
+                  ></text>
79
+                  <text
80
+                    className='iconfont icon-dianhua'
81
+                    onClick={() => handleCall(item)}
82
+                  ></text>
58
                   
83
                   
59
                 </view>
84
                 </view>
60
 
85
 
61
                 <view className='Desc'>
86
                 <view className='Desc'>
62
-                  <text>好评经纪人,熟悉楼盘特色</text>
87
+                  <text>{item.description}</text>
63
                 </view>
88
                 </view>
64
 
89
 
65
               </view>
90
               </view>

+ 0
- 1
src/routes.js Bestand weergeven

39
     name: '聊天',
39
     name: '聊天',
40
     page: 'pages/chat/chatDetail/index',
40
     page: 'pages/chat/chatDetail/index',
41
     pkg: 'main',
41
     pkg: 'main',
42
-    isTab: true,
43
     type: 'other',
42
     type: 'other',
44
   },
43
   },
45
 
44