|
@@ -1,16 +1,21 @@
|
1
|
|
-import React, { useState, useEffect } from 'react'
|
|
1
|
+import React, { useState, useEffect, useRef } from 'react'
|
2
|
2
|
import Taro from '@tarojs/taro'
|
3
|
3
|
import { API_SPECIAL_ROOM_LIST } from '@/constants/api'
|
4
|
4
|
import { ScrollView, Image } from '@tarojs/components'
|
5
|
5
|
import { fetch } from '@/utils/request'
|
6
|
6
|
import '@/assets/css/iconfont.css'
|
|
7
|
+import useTimer from './useTimer'
|
7
|
8
|
import './index.scss'
|
8
|
9
|
|
|
10
|
+const toW = n => `${Number(n / 10000).toFixed(1)}万`
|
|
11
|
+const itFmt = it => `${it.unitType} ${Number(it.currentPrice / it.area).toFixed(0)}元/㎡`
|
|
12
|
+
|
9
|
13
|
export default function SpecialPriceHouse (props) {
|
10
|
14
|
const { Info } = props
|
11
|
15
|
const { buildingId } = Info || {}
|
12
|
16
|
|
13
|
17
|
const [list, setList] = useState([])
|
|
18
|
+ const [leftTime] = useTimer(list)
|
14
|
19
|
|
15
|
20
|
const handleMore = () => {
|
16
|
21
|
Taro.navigateTo({ url: '/pages/index/specialPriceHouse/index' })
|
|
@@ -44,18 +49,18 @@ export default function SpecialPriceHouse (props) {
|
44
|
49
|
</view>
|
45
|
50
|
|
46
|
51
|
<view className='List'>
|
47
|
|
- <ScrollView scroll-x={true}>
|
|
52
|
+ <ScrollView scrollX>
|
48
|
53
|
{
|
49
|
54
|
list.map((item, index) => (
|
50
|
55
|
<view className='ListItem' key={`List-${index}`}>
|
51
|
|
- <text className='Tips'>省17.8万</text>
|
|
56
|
+ <text className='Tips'>{`${toW(item.thriftPrice)}`}</text>
|
52
|
57
|
<view className='Price'>
|
53
|
|
- <text>867.3万</text>
|
54
|
|
- <text>888.1万</text>
|
|
58
|
+ <text>{toW(item.currentPrice)}</text>
|
|
59
|
+ <text>{toW(item.originalPrice)}</text>
|
55
|
60
|
</view>
|
56
|
|
- <text className='Time'>距结束还有06天10时14分</text>
|
57
|
|
- <text className='HouseType'>4室2厅2卫 23433元/㎡</text>
|
58
|
|
- <text className='DoorNumber'>1#-5单元-401</text>
|
|
61
|
+ <text className='Time'>{`距结束还有 ${leftTime[index] ? leftTime[index][1] : ''}`}</text>
|
|
62
|
+ <text className='HouseType'>{itFmt(item)}</text>
|
|
63
|
+ <text className='DoorNumber'>{item.roomName}</text>
|
59
|
64
|
</view>
|
60
|
65
|
))
|
61
|
66
|
}
|