123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- import { useState, useEffect } from 'react'
- import Taro from '@tarojs/taro'
- import withLayout from '@/layout'
- import { ScrollView, Image } from '@tarojs/components'
- import { getCardList } from '@/services/card'
- import { getImgURL } from '@/utils/image'
- import '@/assets/css/iconfont.css'
- import './index.scss'
-
- export default withLayout((props) => {
- const { router } = props
- const { buldingId } = router.params
-
- const [List, setList] = useState([])
- const [PageList, setPageList] = useState([])
- const [ShowMore, setShowMore] = useState(false)
-
- useEffect(() => {
- if(List.length) {
- if(ShowMore) {
- setPageList([...List])
- } else {
- setPageList(List.slice(0, 3))
- }
- }
- }, [ShowMore, List])
-
- const handleChat = (item) => {
- Taro.navigateTo({
- url: `/pages/chat/chatDetail/index?friend=${item.id}`
- })
- }
-
- const handleCall = (item) => {
- if (item.phone) {
- Taro.makePhoneCall({ phoneNumber: item.phone })
- return
- }
-
- Taro.showToast({ title: '暂无联系电话', icon: 'none' })
- }
-
- const gotoDetail = (item) => {
- Taro.navigateTo({
- url: `/subpackages/pages/consultant/myHomepage/index?id=${item.id}`
- })
- }
-
- useEffect(() => {
- if (!buldingId) {
- Taro.showToast({
- title: '没有楼盘信息',
- icon: 'none',
- })
- return
- }
-
- getCardList({ pageSize: 500, buildingId: buldingId }).then((res) => {
- const { records } = res || []
- setList(records)
- })
- }, [buldingId])
-
- return (
- <view className='Page buildingPropertyConsultant'>
- <ScrollView scroll-y>
- <text className='TopTips'>有任何买卖房屋的问题,欢迎随时咨询</text>
- <view className='List'>
- {
- PageList.map((item, index) => (
- <view key={`ListItem-${index}`}>
-
- <view className='flex-h'>
-
- <view className='Icon'>
- <Image mode='scaleToFill' src={getImgURL(item.photo || item.avatar)}></Image>
- </view>
-
- <view className='flex-item' onClick={() => gotoDetail(item)}>
- <view className='Name'>
- <text>{item.name}</text>
- <Image mode='heightFix' src={require('@/assets/index-icon17.png')}></Image>
- </view>
- <text>{item.phone}</text>
- </view>
-
- <text
- className='iconfont icon-liaotian'
- onClick={() => handleChat(item)}
- ></text>
- <text
- className='iconfont icon-dianhua'
- onClick={() => handleCall(item)}
- ></text>
-
- </view>
-
- <view className='Desc'>
- <text>{item.description || '暂无简介'}</text>
- </view>
-
- </view>
- ))
- }
- {
- List.length > 3 && !ShowMore &&
- <view className='More'>
- <text onClick={() => { setShowMore(true) }}>查看更多置业顾问</text>
- </view>
- }
- {
- !(List.length > 3 && !ShowMore) &&
- <text className='BottomTips'>已经到底了~</text>
- }
- </view>
- </ScrollView>
- </view>
- )
- })
|