|
@@ -15,17 +15,29 @@ export default class Index extends Component {
|
15
|
15
|
visible: false,
|
16
|
16
|
tabIndex: null,
|
17
|
17
|
priceTypeIndex: 0,
|
18
|
|
- selectedIndex: new Array(3).fill([0]),
|
|
18
|
+ selectedIndex: new Array(4).fill([0]),
|
19
|
19
|
tabs: [
|
20
|
|
- // {
|
21
|
|
- // name: '户型',
|
22
|
|
- // id: 'huxing',
|
23
|
|
- // list: ['不限', '一室', '两室', '三室', '四室', '五室以上']
|
24
|
|
- // },
|
|
20
|
+ {
|
|
21
|
+ name: '户型',
|
|
22
|
+ id: 'huxing',
|
|
23
|
+ list: ['不限', '一室', '两室', '三室', '四室', '五室以上']
|
|
24
|
+ },
|
25
|
25
|
{
|
26
|
26
|
name: '价格',
|
27
|
27
|
id: 'price',
|
28
|
28
|
list: ['不限', '10000元/㎡以下', '10000-20000元/㎡', '20000-30000元/㎡', '30000-50000元/㎡', '50000-70000元/㎡', '70000-100000元/㎡', '100000元/㎡以上']
|
|
29
|
+ // list: [
|
|
30
|
+ // {
|
|
31
|
+ // name: '总价',
|
|
32
|
+ // id: 'totalPrice',
|
|
33
|
+ // list: ['不限', '100万以下', '100-150万', '150-200万', '200-500万', '500-1000万', '1000万以上']
|
|
34
|
+ // },
|
|
35
|
+ // {
|
|
36
|
+ // name: '单价',
|
|
37
|
+ // id: 'unitPrice ',
|
|
38
|
+ // list: ['不限', '10000/㎡以下', '10000-20000元/㎡', '20000-30000元/㎡', '30000-50000元/㎡', '50000-70000元/㎡', '70000-100000元/㎡', '100000元/㎡以上']
|
|
39
|
+ // }
|
|
40
|
+ // ]
|
29
|
41
|
},
|
30
|
42
|
{
|
31
|
43
|
name: '面积',
|
|
@@ -47,7 +59,7 @@ export default class Index extends Component {
|
47
|
59
|
queryItemTypeList().then(res => {
|
48
|
60
|
let houseTypeList = res.records
|
49
|
61
|
houseTypeList.unshift('不限')
|
50
|
|
- tabs[2].list = houseTypeList
|
|
62
|
+ tabs[3].list = houseTypeList
|
51
|
63
|
this.setState({ tabs })
|
52
|
64
|
})
|
53
|
65
|
}
|
|
@@ -107,6 +119,7 @@ export default class Index extends Component {
|
107
|
119
|
|
108
|
120
|
handleFilter() {
|
109
|
121
|
|
|
122
|
+ console.log("111")
|
110
|
123
|
const { tabs, keywords, selectedIndex } = this.state
|
111
|
124
|
console.log(this.state)
|
112
|
125
|
let values = selectedIndex.map((selectedList, tabIndex) => {
|
|
@@ -118,13 +131,13 @@ export default class Index extends Component {
|
118
|
131
|
}
|
119
|
132
|
|
120
|
133
|
// 类型
|
121
|
|
- // if (tabIndex === 0) {
|
122
|
|
- // let val = selectedList.map(index => curTabList[index])
|
123
|
|
- // return val.join(',')
|
124
|
|
- // }
|
|
134
|
+ if (tabIndex === 0) {
|
|
135
|
+ let val = selectedList.map(index => curTabList[index])
|
|
136
|
+ return val.join(',')
|
|
137
|
+ }
|
125
|
138
|
|
126
|
139
|
// 价格 面积
|
127
|
|
- if (tabIndex === 0 || tabIndex === 1) {
|
|
140
|
+ if (tabIndex === 1 || tabIndex === 2) {
|
128
|
141
|
let val = selectedList.map(index => {
|
129
|
142
|
let value = curTabList[index]
|
130
|
143
|
let regVal = value.match(/\d*([-\d]*)?/)
|
|
@@ -147,7 +160,7 @@ export default class Index extends Component {
|
147
|
160
|
}
|
148
|
161
|
|
149
|
162
|
// 类型
|
150
|
|
- if (tabIndex === 2) {
|
|
163
|
+ if (tabIndex === 3) {
|
151
|
164
|
let val = selectedList.map(index => curTabList[index].buildingTypeId)
|
152
|
165
|
return val.join(',')
|
153
|
166
|
}
|
|
@@ -155,10 +168,10 @@ export default class Index extends Component {
|
155
|
168
|
console.log(values)
|
156
|
169
|
let params = {
|
157
|
170
|
name: keywords,
|
158
|
|
- // houseType: values[0],
|
159
|
|
- price: values[0],
|
160
|
|
- area: values[1],
|
161
|
|
- buildingType: values[2],
|
|
171
|
+ houseType: values[0],
|
|
172
|
+ price: values[1],
|
|
173
|
+ area: values[2],
|
|
174
|
+ buildingType: values[3],
|
162
|
175
|
}
|
163
|
176
|
console.log(params)
|
164
|
177
|
this.props.onFilter(params, () => {
|
|
@@ -205,7 +218,7 @@ export default class Index extends Component {
|
205
|
218
|
{
|
206
|
219
|
tabs[tabIndex].list.map((item, index) => (
|
207
|
220
|
<View
|
208
|
|
- key={index+'tab'}
|
|
221
|
+ key={index + 'tab'}
|
209
|
222
|
className={`row ${selectedIndex[tabIndex].includes(index) ? 'active' : ''}`}
|
210
|
223
|
onClick={this.handleFilterItemClick.bind(this, index)}>
|
211
|
224
|
{item.name || item.buildingTypeName || item}
|
|
@@ -223,7 +236,7 @@ export default class Index extends Component {
|
223
|
236
|
|
224
|
237
|
renderPrice() {
|
225
|
238
|
const { priceTypeIndex, tabs, tabIndex, selectedIndex } = this.state
|
226
|
|
- const priceArr = tabs[0].list
|
|
239
|
+ const priceArr = tabs[1].list
|
227
|
240
|
const list = priceArr[priceTypeIndex].list
|
228
|
241
|
return (
|
229
|
242
|
<View className="price">
|
|
@@ -242,7 +255,7 @@ export default class Index extends Component {
|
242
|
255
|
{
|
243
|
256
|
list.map((text, index) => (
|
244
|
257
|
<View
|
245
|
|
- key={index+'list'}
|
|
258
|
+ key={index + 'list'}
|
246
|
259
|
className={`price-item ${selectedIndex[tabIndex].includes(index) ? 'selected' : ''}`}
|
247
|
260
|
onClick={this.handleFilterItemClick.bind(this, index)}>
|
248
|
261
|
{text}
|
|
@@ -285,7 +298,7 @@ export default class Index extends Component {
|
285
|
298
|
<View className="search-box">
|
286
|
299
|
<View className="search">
|
287
|
300
|
<Text className="search-icon icon-sousuo iconfont"></Text>
|
288
|
|
- <Input className="search-input" type="text" confirm-type="搜索" onConfirm={this.handleFilter} value={keywords} onInput={this.onInputText.bind(this)} placeholder="请输入你想查询的楼盘"></Input>
|
|
301
|
+ <Input className="search-input" type="text" focus confirm-type="搜索" onConfirm={this.handleFilter} value={keywords} onInput={this.onInputText.bind(this)} placeholder="请输入你想查询的楼盘"></Input>
|
289
|
302
|
</View>
|
290
|
303
|
<View className="location" onClick={this.handleLocationClick}>
|
291
|
304
|
<Text className="location-icon iconfont icon-daohangdizhi"></Text>
|