|
@@ -1,16 +1,48 @@
|
1
|
|
-import { useState } from 'react'
|
|
1
|
+import { useEffect, useState } from 'react'
|
|
2
|
+import Taro from '@tarojs/taro'
|
2
|
3
|
import withLayout from '@/layout'
|
3
|
4
|
import { ScrollView, Image } from '@tarojs/components'
|
4
|
5
|
import Disclaimer from '@/components/Disclaimer'
|
|
6
|
+import { getSpecialRoomList } from '@/services/project'
|
|
7
|
+import { getImgURL } from '@/utils/image'
|
|
8
|
+import { formateLeftTime } from '@/utils/tools'
|
5
|
9
|
import '@/assets/css/iconfont.css'
|
6
|
10
|
import './index.scss'
|
7
|
11
|
|
8
|
12
|
const defaultRuleImage = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg'
|
9
|
13
|
|
10
|
|
-export default withLayout(() => {
|
|
14
|
+export default withLayout((props) => {
|
|
15
|
+ const { city } = props
|
11
|
16
|
|
|
17
|
+ const [list, setList] = useState([])
|
12
|
18
|
|
13
|
|
- const [PageList, setPageList] = useState(['', '', ''])
|
|
19
|
+ const getRoomList = (params) => {
|
|
20
|
+ Taro.showLoading()
|
|
21
|
+ getSpecialRoomList({
|
|
22
|
+ cityId: city?.id,
|
|
23
|
+ ...params,
|
|
24
|
+ }).then((res) => {
|
|
25
|
+ const { records } = res
|
|
26
|
+ setList(records || [])
|
|
27
|
+ Taro.hideLoading()
|
|
28
|
+ }).catch((err) => {
|
|
29
|
+ console.error(err)
|
|
30
|
+ Taro.hideLoading()
|
|
31
|
+ })
|
|
32
|
+ }
|
|
33
|
+
|
|
34
|
+ const goto = (it) => {
|
|
35
|
+ Taro.navigateTo({
|
|
36
|
+ url: `/pages/index/buildingDetail/index?id=${it.buildingId}`
|
|
37
|
+ })
|
|
38
|
+ }
|
|
39
|
+
|
|
40
|
+ useEffect(() => {
|
|
41
|
+ console.log('------params---->', city, city?.id)
|
|
42
|
+ if (city?.id) {
|
|
43
|
+ getRoomList({ pageNum: 1 })
|
|
44
|
+ }
|
|
45
|
+ }, [city?.id])
|
14
|
46
|
|
15
|
47
|
return (
|
16
|
48
|
<view className='Page specialPriceHouse'>
|
|
@@ -25,74 +57,97 @@ export default withLayout(() => {
|
25
|
57
|
{/* 列表 */}
|
26
|
58
|
<view className='List'>
|
27
|
59
|
{
|
28
|
|
- PageList.map((item, index) => (
|
29
|
|
- <view key={`ListItem-${index}`}>
|
30
|
|
-
|
31
|
|
- <view className='Title'>
|
32
|
|
- <view>
|
33
|
|
- <text className='iconfont icon-shoucang'></text>
|
34
|
|
- <text>{index + 1 > 9 ? index + 1 : `0${index + 1}`}</text>
|
35
|
|
- <text className='iconfont icon-shoucang'></text>
|
36
|
|
- </view>
|
37
|
|
- </view>
|
|
60
|
+ list.map((item, index) => {
|
|
61
|
+ const mainImg = getImgURL(item?.buildingListImg?.length ? item.buildingListImg[0].url : null)
|
|
62
|
+ const price = item.price || '价格待定'
|
|
63
|
+ const shareNum = item.shareList?.total || 0
|
|
64
|
+ const uvNum = item.uvList?.length || 0
|
38
|
65
|
|
39
|
|
- <view className='InfoContent'>
|
40
|
|
- <view className='Img'>
|
41
|
|
- <Image mode='scaleToFill' src={null} className='centerLabel'></Image>
|
42
|
|
- </view>
|
43
|
|
- <view className='Name flex-h'>
|
44
|
|
- <view className='flex-item'>
|
45
|
|
- <text>奥园金基天著尚居</text>
|
|
66
|
+ // 最多6个
|
|
67
|
+ const tags = (item.buildingTag || []).map(x => x.tagName).slice(0, 6)
|
|
68
|
+
|
|
69
|
+ //
|
|
70
|
+ const specialRoomList = item.specialRoomList || []
|
|
71
|
+
|
|
72
|
+ return (
|
|
73
|
+ <view key={item.buildingId}>
|
|
74
|
+ <view className='Title'>
|
|
75
|
+ <view>
|
|
76
|
+ <text className='iconfont icon-shoucang'></text>
|
|
77
|
+ <text>{index + 1 > 9 ? index + 1 : `0${index + 1}`}</text>
|
|
78
|
+ <text className='iconfont icon-shoucang'></text>
|
46
|
79
|
</view>
|
47
|
|
- <text>约</text>
|
48
|
|
- <text>20000/㎡</text>
|
49
|
|
- </view>
|
50
|
|
- <text className='Address'>江宁禄口云熙99路号(诚信大道)</text>
|
51
|
|
- <view className='Tag'>
|
52
|
|
- <text>纯新盘</text>
|
53
|
|
- <text>纯新盘</text>
|
54
|
|
- <text>纯新盘</text>
|
55
|
80
|
</view>
|
56
|
|
- <view className='Views flex-h'>
|
57
|
|
- <view className='flex-item'>
|
58
|
|
- <text className='iconfont icon-fenxiang'></text>
|
59
|
|
- <text>3次分享</text>
|
|
81
|
+
|
|
82
|
+ <view className='InfoContent'>
|
|
83
|
+ <view className='Img' onClick={() => goto(item)}>
|
|
84
|
+ <Image mode='scaleToFill' src={mainImg} className='centerLabel'></Image>
|
60
|
85
|
</view>
|
61
|
|
- <view className='Icons'>
|
62
|
|
- <view>
|
63
|
|
- <Image mode='scaleToFill' src={null} className='centerLabel'></Image>
|
64
|
|
- </view>
|
65
|
|
- <view>
|
66
|
|
- <Image mode='scaleToFill' src={null} className='centerLabel'></Image>
|
67
|
|
- </view>
|
68
|
|
- <view>
|
69
|
|
- <Image mode='scaleToFill' src={null} className='centerLabel'></Image>
|
|
86
|
+ <view className='Name flex-h' onClick={() => goto(item)}>
|
|
87
|
+ <view className='flex-item'>
|
|
88
|
+ <text>{item.buildingName}</text>
|
70
|
89
|
</view>
|
|
90
|
+ <text></text>
|
|
91
|
+ <text>{price}</text>
|
71
|
92
|
</view>
|
72
|
|
- <text>...9人围观</text>
|
73
|
|
- </view>
|
74
|
|
- <view className='SpecialList'>
|
75
|
|
- <ScrollView scrollX>
|
|
93
|
+ <text className='Address' onClick={() => goto(item)}>{item.address}</text>
|
|
94
|
+ <view className='Tag' onClick={() => goto(item)}>
|
|
95
|
+ {
|
|
96
|
+ tags.map((x) => (<text key={x}>{x}</text>))
|
|
97
|
+ }
|
|
98
|
+ </view>
|
|
99
|
+ <view className='Views flex-h' onClick={() => goto(item)}>
|
|
100
|
+ <view className='flex-item'>
|
|
101
|
+ <text className='iconfont icon-fenxiang'></text>
|
|
102
|
+ <text>{`${shareNum} 次分享`}</text>
|
|
103
|
+ </view>
|
76
|
104
|
{
|
77
|
|
- [{}, {}].map((subItem, subIndex) => (
|
78
|
|
- <view className='ListItem' key={`List-${subIndex}`}>
|
79
|
|
- <text className='Tips'>省17.6万</text>
|
80
|
|
- <view className='Price'>
|
81
|
|
- <text>879万</text>
|
82
|
|
- <text>932万</text>
|
83
|
|
- </view>
|
84
|
|
- <text className='Time'>距结束06天10时14分</text>
|
85
|
|
- <text className='HouseType'>4室2厅2卫 234/㎡</text>
|
86
|
|
- <text className='DoorNumber'>1#-5单元-401</text>
|
|
105
|
+ uvNum > 0 && (
|
|
106
|
+ <view className='Icons'>
|
|
107
|
+ {
|
|
108
|
+ item.uvList.map((x) => (
|
|
109
|
+ <view key={x.uvId}>
|
|
110
|
+ <Image mode='scaleToFill' src={getImgURL(x.photoOravatar)} className='centerLabel'></Image>
|
|
111
|
+ </view>
|
|
112
|
+ ))
|
|
113
|
+ }
|
87
|
114
|
</view>
|
88
|
|
- ))
|
|
115
|
+ )
|
89
|
116
|
}
|
90
|
|
- </ScrollView>
|
|
117
|
+ <text>{`...${uvNum}人围观`}</text>
|
|
118
|
+ </view>
|
|
119
|
+ <view className='SpecialList'>
|
|
120
|
+ <ScrollView scrollX>
|
|
121
|
+ {
|
|
122
|
+ specialRoomList.map((it) => {
|
|
123
|
+ const unitPrice = it.area ? it.currentPrice / it.area : undefined
|
|
124
|
+ const unitW = unitPrice ? `${Number(unitPrice).toFixed(0)}/㎡` : '单价待定'
|
|
125
|
+ const currentW = it.currentPrice ? `${Number(it.currentPrice / 10000).toFixed(1)}万` : '待定'
|
|
126
|
+ const originalW = it.originalPrice ? `${Number(it.originalPrice / 10000).toFixed(1)}万` : '待定'
|
|
127
|
+ const thriftW = it.thriftPrice ? `省${Number(it.thriftPrice / 10000).toFixed(1)}万` : '待定'
|
|
128
|
+ const leftTime = formateLeftTime(new Date(it.endTime) - new Date(), 'min');
|
|
129
|
+
|
|
130
|
+ return (
|
|
131
|
+ <view className='ListItem' key={it.specialRoomId}>
|
|
132
|
+ <text className='Tips'>{thriftW}</text>
|
|
133
|
+ <view className='Price'>
|
|
134
|
+ <text>{currentW}</text>
|
|
135
|
+ <text>{originalW}</text>
|
|
136
|
+ </view>
|
|
137
|
+ <text className='Time'>{`距结束 ${leftTime}`}</text>
|
|
138
|
+ <text className='HouseType'>{`${it.unitType} ${unitW}`}</text>
|
|
139
|
+ <text className='DoorNumber'>{it.roomName}</text>
|
|
140
|
+ </view>
|
|
141
|
+ )
|
|
142
|
+ })
|
|
143
|
+ }
|
|
144
|
+ </ScrollView>
|
|
145
|
+ </view>
|
91
|
146
|
</view>
|
92
|
|
- </view>
|
93
|
147
|
|
94
|
|
- </view>
|
95
|
|
- ))
|
|
148
|
+ </view>
|
|
149
|
+ )
|
|
150
|
+ })
|
96
|
151
|
}
|
97
|
152
|
</view>
|
98
|
153
|
|