|
@@ -0,0 +1,136 @@
|
|
1
|
+import Taro, { Component } from '@tarojs/taro';
|
|
2
|
+import './index.scss'
|
|
3
|
+import { connect } from '@tarojs/redux'
|
|
4
|
+import ready from '@/utils/ready'
|
|
5
|
+
|
|
6
|
+@connect(
|
|
7
|
+ ({ user }) => ({ ...user })
|
|
8
|
+)
|
|
9
|
+
|
|
10
|
+export default class Index extends Component {
|
|
11
|
+ config = {
|
|
12
|
+ navigationBarTitleText: '筛选房源',
|
|
13
|
+ }
|
|
14
|
+
|
|
15
|
+ state = {
|
|
16
|
+ current: 0,
|
|
17
|
+ priceCurrent: 0,
|
|
18
|
+ startPrice: '100',
|
|
19
|
+ endPrice: null,
|
|
20
|
+ }
|
|
21
|
+
|
|
22
|
+ componentWillMount() {
|
|
23
|
+
|
|
24
|
+ ready.queue(() => {
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+ })
|
|
28
|
+ }
|
|
29
|
+ handleCondition(value) {
|
|
30
|
+ this.setState({
|
|
31
|
+ current: value,
|
|
32
|
+ })
|
|
33
|
+ }
|
|
34
|
+ handlePriceItem(item) {
|
|
35
|
+ this.setState({
|
|
36
|
+ priceCurrent: item.value,
|
|
37
|
+ startPrice: item.startPrice,
|
|
38
|
+ endPrice: item.endPrice,
|
|
39
|
+ })
|
|
40
|
+ }
|
|
41
|
+
|
|
42
|
+ render() {
|
|
43
|
+ const { current, priceCurrent, startPrice, endPrice } = this.state
|
|
44
|
+ const condition = [{ title: '按价格', value: 0 }, { title: '按户型', value: 1 }]
|
|
45
|
+ const priceList = [
|
|
46
|
+ { startPrice: null, endPrice: '100', value: 0 },
|
|
47
|
+ { startPrice: '100', endPrice: '150', value: 1 },
|
|
48
|
+ { startPrice: '150', endPrice: '200', value: 2 },
|
|
49
|
+ { startPrice: '200', endPrice: '250', value: 3 },
|
|
50
|
+ { startPrice: '250', endPrice: '300', value: 4 },
|
|
51
|
+ { startPrice: '300', endPrice: '400', value: 5 },
|
|
52
|
+ { startPrice: '400', endPrice: '500', value: 6 },
|
|
53
|
+ { startPrice: '500', endPrice: '600', value: 7 },
|
|
54
|
+ { startPrice: '600', endPrice: null, value: 8 },
|
|
55
|
+ ]
|
|
56
|
+ const apartmentList = [
|
|
57
|
+ { name: 'A 户型', area1: '149', area2: '131' },
|
|
58
|
+ { name: 'B 户型', area1: '95', area2: '84.7' },
|
|
59
|
+ { name: 'C 户型', area1: '95', area2: '84.7' },
|
|
60
|
+ ]
|
|
61
|
+ return (
|
|
62
|
+ <View className="screen-page">
|
|
63
|
+ <View className="screen-top">
|
|
64
|
+ 筛选房源
|
|
65
|
+ {condition.map(item => (
|
|
66
|
+ <View key={item.value} onClick={() => this.handleCondition(item.value)} className={current == item.value ? 'top-item active' : 'top-item'}>
|
|
67
|
+ {item.title}
|
|
68
|
+ </View>
|
|
69
|
+ ))}
|
|
70
|
+ </View>
|
|
71
|
+ {current == 0 &&
|
|
72
|
+ <View>
|
|
73
|
+ <View className="price-con">
|
|
74
|
+ {priceList.map(priceItem => (
|
|
75
|
+ <View key={priceItem.value} className={priceCurrent == priceItem.value ? 'active-item' : 'price-item'} onClick={() => { this.handlePriceItem(priceItem) }}>
|
|
76
|
+ {!priceItem.startPrice && <View className="item-con">{priceItem.endPrice}万以下</View>}
|
|
77
|
+ {priceItem.startPrice && priceItem.endPrice && <View className="item-con">{priceItem.startPrice}万-{priceItem.endPrice}万</View>}
|
|
78
|
+ {!priceItem.endPrice && <View className="item-con">{priceItem.startPrice}万以上</View>}
|
|
79
|
+ </View>
|
|
80
|
+ ))}
|
|
81
|
+ </View>
|
|
82
|
+ <View style="color:#666;font-size:28rpx;margin-left:40rpx">
|
|
83
|
+ 填写价格(万元)
|
|
84
|
+ </View>
|
|
85
|
+ <View className="search">
|
|
86
|
+ <Input
|
|
87
|
+ type="number"
|
|
88
|
+ placeholder="最低价"
|
|
89
|
+ class="search-input"
|
|
90
|
+ placeholder-style="color:#dcdcdc;font-size:28rpx"
|
|
91
|
+ maxlength="6"
|
|
92
|
+ value={startPrice}
|
|
93
|
+ onInput={() => this.handleInput}
|
|
94
|
+ />
|
|
95
|
+ <Text style="margin:0 8rpx;color:#999;font-size:28rpx">-</Text>
|
|
96
|
+ <Input
|
|
97
|
+ type="number"
|
|
98
|
+ placeholder="最低价"
|
|
99
|
+ class="search-input"
|
|
100
|
+ placeholder-style="color:#dcdcdc;font-size:28rpx"
|
|
101
|
+ maxlength="6"
|
|
102
|
+ value={endPrice}
|
|
103
|
+ onInput={() => this.handleInput}
|
|
104
|
+ />
|
|
105
|
+ <View className="sure-btn">
|
|
106
|
+ 确定
|
|
107
|
+ </View>
|
|
108
|
+ </View>
|
|
109
|
+ </View>}
|
|
110
|
+ {
|
|
111
|
+ current == 1 &&
|
|
112
|
+ <View style="padding:40rpx 20rpx">
|
|
113
|
+ {apartmentList.map((apartmentItem, index) => (
|
|
114
|
+ <View className='item' key={index + 'apartment'}>
|
|
115
|
+ <View className='house__img-info'>
|
|
116
|
+ <Image className='house__img' src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1581369637322&di=6065c2aee90f790b00d0c815f465ebc5&imgtype=0&src=http%3A%2F%2Fcyzs97.com%2FUploads%2FEditor%2FPicture%2F2018-10-18%2F5bc8330f2d06f.jpg" mode="widthFix"></Image>
|
|
117
|
+ </View>
|
|
118
|
+ <View className="rest-info">
|
|
119
|
+ <View className='house-type__name'>{apartmentItem.name || ''}</View>
|
|
120
|
+ <View className='construction__area'>
|
|
121
|
+ <Text>{apartmentItem.area1 ? '建筑面积约' + apartmentItem.area1 + 'm²' : '建筑面积待定'}</Text>
|
|
122
|
+ {
|
|
123
|
+ apartmentItem.area2 ? <Text>使用面积约{apartmentItem.area2}m²</Text> : <Text>使用面积待定</Text>
|
|
124
|
+ }
|
|
125
|
+ </View>
|
|
126
|
+ </View>
|
|
127
|
+ </View>
|
|
128
|
+ ))}
|
|
129
|
+ </View>
|
|
130
|
+ }
|
|
131
|
+
|
|
132
|
+ </View>
|
|
133
|
+
|
|
134
|
+ );
|
|
135
|
+ }
|
|
136
|
+}
|