|
@@ -1,7 +1,7 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div class="secondhandmorescreen">
|
3
|
3
|
<van-search
|
4
|
|
- v-model="serchValue"
|
|
4
|
+ v-model="searchValue"
|
5
|
5
|
placeholder="请输入搜索关键词"
|
6
|
6
|
:actions="searchActions"
|
7
|
7
|
@select="onSearchSelect"
|
|
@@ -25,41 +25,102 @@
|
25
|
25
|
<div>
|
26
|
26
|
<van-form @submit="onSubmit">
|
27
|
27
|
<van-cell-group title="区位">
|
28
|
|
- <AreaQuery v-model="roomArea"></AreaQuery>
|
|
28
|
+ <van-row :gutter="12">
|
|
29
|
+ <van-col span="12">
|
|
30
|
+ <van-field label="区县">
|
|
31
|
+ <template #input>
|
|
32
|
+ <Picker
|
|
33
|
+ placeholder="选择区县"
|
|
34
|
+ :options="roomDistrictOptions"
|
|
35
|
+ v-model="formData.roomDistrict"
|
|
36
|
+ />
|
|
37
|
+ </template>
|
|
38
|
+ </van-field>
|
|
39
|
+ </van-col>
|
|
40
|
+ <van-col span="12">
|
|
41
|
+ <van-field label="商圈">
|
|
42
|
+ <template #input>
|
|
43
|
+ <Picker
|
|
44
|
+ placeholder="选择商圈"
|
|
45
|
+ :options="roomBussinesOptions"
|
|
46
|
+ v-model="formData.roomBussines"
|
|
47
|
+ />
|
|
48
|
+ </template>
|
|
49
|
+ </van-field>
|
|
50
|
+ </van-col>
|
|
51
|
+ </van-row>
|
29
|
52
|
</van-cell-group>
|
30
|
53
|
<van-cell-group title="房间要求">
|
31
|
|
- <van-field name="number">
|
|
54
|
+ <van-field label="楼层" ex>
|
32
|
55
|
<template #input>
|
33
|
|
- <DemandQuery></DemandQuery>
|
|
56
|
+ <NumberRange v-model="roomFloors" />
|
|
57
|
+ </template>
|
|
58
|
+ </van-field>
|
|
59
|
+ <van-field label="面积">
|
|
60
|
+ <template #input>
|
|
61
|
+ <NumberRange v-model="roomSQ" />
|
|
62
|
+ </template>
|
|
63
|
+ <template #extra>㎡</template>
|
|
64
|
+ </van-field>
|
|
65
|
+ <van-field label="总价">
|
|
66
|
+ <template #input>
|
|
67
|
+ <NumberRange v-model="roomPrices" />
|
|
68
|
+ </template>
|
|
69
|
+ <template #extra>万</template>
|
|
70
|
+ </van-field>
|
|
71
|
+ <van-field label="户型">
|
|
72
|
+ <template #input>
|
|
73
|
+ <Picker
|
|
74
|
+ placeholder="请选择户型"
|
|
75
|
+ :options="roomTypeOptions"
|
|
76
|
+ v-model="formData.roomType"
|
|
77
|
+ />
|
|
78
|
+ </template>
|
|
79
|
+ </van-field>
|
|
80
|
+ <van-field label="装修">
|
|
81
|
+ <template #input>
|
|
82
|
+ <Picker
|
|
83
|
+ placeholder="请选择装修类型"
|
|
84
|
+ :options="decorationOptions"
|
|
85
|
+ v-model="formData.decoration"
|
|
86
|
+ />
|
|
87
|
+ </template>
|
|
88
|
+ </van-field>
|
|
89
|
+ <van-field label="房源状态">
|
|
90
|
+ <template #input>
|
|
91
|
+ <Picker
|
|
92
|
+ placeholder="请选择房源状态"
|
|
93
|
+ :options="roomStatusOptions"
|
|
94
|
+ v-model="formData.roomStatus"
|
|
95
|
+ />
|
|
96
|
+ </template>
|
|
97
|
+ </van-field>
|
|
98
|
+ <van-field label="实勘状态">
|
|
99
|
+ <template #input>
|
|
100
|
+ <Picker
|
|
101
|
+ placeholder="请选择实勘状态"
|
|
102
|
+ :options="rescStatusOptions"
|
|
103
|
+ v-model="formData.rescStatus"
|
|
104
|
+ />
|
34
|
105
|
</template>
|
35
|
106
|
</van-field>
|
36
|
|
- </van-cell-group>
|
37
|
|
- <van-cell-group title="户型">
|
38
|
|
- <CheeckButtomQuery
|
39
|
|
- v-model="state.housetype"
|
40
|
|
- :options="housetypeoptions"
|
41
|
|
- ></CheeckButtomQuery>
|
42
|
|
- </van-cell-group>
|
43
|
|
- <van-cell-group title="装修">
|
44
|
|
- <CheeckButtomQuery
|
45
|
|
- v-model="state.renovation"
|
46
|
|
- :options="housetypeoptions"
|
47
|
|
- ></CheeckButtomQuery>
|
48
|
|
- </van-cell-group>
|
49
|
|
- <van-cell-group title="房源状态">
|
50
|
|
- <CheeckButtomQuery
|
51
|
|
- v-model="state.housetype"
|
52
|
|
- :options="housetypeoptions"
|
53
|
|
- ></CheeckButtomQuery>
|
54
|
|
- </van-cell-group>
|
55
|
|
- <van-cell-group title="实勘状态">
|
56
|
|
- <CheeckButtomQuery
|
57
|
|
- v-model="state.housetype"
|
58
|
|
- :options="housetypeoptions"
|
59
|
|
- ></CheeckButtomQuery>
|
60
|
107
|
</van-cell-group>
|
61
|
108
|
<van-cell-group title="房间位置">
|
62
|
|
- <PositionQuery></PositionQuery>
|
|
109
|
+ <van-row :gutter="12">
|
|
110
|
+ <van-col span="12">
|
|
111
|
+ <van-field label="楼栋" v-model="formData.roomBuild" placeholder="请输入" />
|
|
112
|
+ </van-col>
|
|
113
|
+ <van-col span="12">
|
|
114
|
+ <van-field label="单元" v-model="formData.roomUnit" placeholder="请输入" />
|
|
115
|
+ </van-col>
|
|
116
|
+ </van-row>
|
|
117
|
+ <van-row :gutter="12">
|
|
118
|
+ <van-col span="12">
|
|
119
|
+ <van-field label="房号" v-model="formData.roomFloor" placeholder="请输入" />
|
|
120
|
+ </van-col>
|
|
121
|
+ <van-col span="12">
|
|
122
|
+ </van-col>
|
|
123
|
+ </van-row>
|
63
|
124
|
</van-cell-group>
|
64
|
125
|
|
65
|
126
|
<div style="margin-top: 16px;">
|
|
@@ -67,7 +128,7 @@
|
67
|
128
|
<van-action-bar-icon
|
68
|
129
|
icon="replay"
|
69
|
130
|
text="重置"
|
70
|
|
- @click="onClickIcon"
|
|
131
|
+ @click="handleReset"
|
71
|
132
|
/>
|
72
|
133
|
|
73
|
134
|
<van-action-bar-button
|
|
@@ -76,18 +137,6 @@
|
76
|
137
|
native-type="submit"
|
77
|
138
|
/>
|
78
|
139
|
</van-action-bar>
|
79
|
|
- <!-- <van-row justify="center">
|
80
|
|
- <van-col span="6">
|
81
|
|
- <van-button block icon="replay" type="primary"
|
82
|
|
- >重置</van-button
|
83
|
|
- ></van-col
|
84
|
|
- >
|
85
|
|
- <van-col span="18">
|
86
|
|
- <van-button round block type="primary" native-type="submit"
|
87
|
|
- >确定</van-button
|
88
|
|
- ></van-col
|
89
|
|
- >
|
90
|
|
- </van-row> -->
|
91
|
140
|
</div>
|
92
|
141
|
</van-form>
|
93
|
142
|
</div>
|
|
@@ -98,7 +147,7 @@
|
98
|
147
|
</template>
|
99
|
148
|
|
100
|
149
|
<script>
|
101
|
|
-import { computed, reactive, ref } from "vue";
|
|
150
|
+import { computed, reactive, ref, watch } from "vue";
|
102
|
151
|
import {
|
103
|
152
|
Col,
|
104
|
153
|
Row,
|
|
@@ -116,14 +165,10 @@ import {
|
116
|
165
|
Icon,
|
117
|
166
|
Popover,
|
118
|
167
|
} from "vant";
|
119
|
|
-// import { useModel } from '@zjxpcyc/vue-tiny-store'
|
|
168
|
+import { useModel } from '@zjxpcyc/vue-tiny-store'
|
120
|
169
|
|
121
|
|
-import {
|
122
|
|
- AreaQuery,
|
123
|
|
- DemandQuery,
|
124
|
|
- CheeckButtomQuery,
|
125
|
|
- PositionQuery,
|
126
|
|
-} from "../../../../components/queryCompents";
|
|
170
|
+import Picker from "@/components/Picker";
|
|
171
|
+import NumberRange from "@/components/NumberRange";
|
127
|
172
|
|
128
|
173
|
export default {
|
129
|
174
|
name: "secondhandmorescreen",
|
|
@@ -143,11 +188,8 @@ export default {
|
143
|
188
|
[ActionBarButton.name]: ActionBarButton,
|
144
|
189
|
[Icon.name]: Icon,
|
145
|
190
|
[Popover.name]: Popover,
|
146
|
|
-
|
147
|
|
- AreaQuery,
|
148
|
|
- DemandQuery,
|
149
|
|
- CheeckButtomQuery,
|
150
|
|
- PositionQuery,
|
|
191
|
+ Picker,
|
|
192
|
+ NumberRange,
|
151
|
193
|
},
|
152
|
194
|
props: {
|
153
|
195
|
// options: [],
|
|
@@ -155,29 +197,141 @@ export default {
|
155
|
197
|
data() {
|
156
|
198
|
return {};
|
157
|
199
|
},
|
158
|
|
-emits:["onBack"],
|
|
200
|
+ emits:["back", 'search'],
|
159
|
201
|
setup(props,{emit}) {
|
160
|
|
- // const { dicts, getBusinessCity } = useModel('dicts')
|
|
202
|
+ const formData = reactive({
|
|
203
|
+ // 楼盘
|
|
204
|
+ estateName: undefined,
|
|
205
|
+ // 房源
|
|
206
|
+ roomCodeId: undefined,
|
|
207
|
+ // 业主电话
|
|
208
|
+ ownerTel: undefined,
|
|
209
|
+ // 区县
|
|
210
|
+ roomDistrict: undefined,
|
|
211
|
+ // 商圈
|
|
212
|
+ roomBussines: undefined,
|
|
213
|
+ // 楼层1
|
|
214
|
+ floorMin: undefined,
|
|
215
|
+ // 楼层2
|
|
216
|
+ floorMax: undefined,
|
|
217
|
+ // 面积1
|
|
218
|
+ sqMin: undefined,
|
|
219
|
+ // 面积2
|
|
220
|
+ sqMax: undefined,
|
|
221
|
+ // 总价1 -- 注意单词拼写
|
|
222
|
+ pirceMin: undefined,
|
|
223
|
+ // 总价2 -- 注意单词拼写
|
|
224
|
+ priceMax: undefined,
|
|
225
|
+ // 户型
|
|
226
|
+ roomType: undefined,
|
|
227
|
+ // 装修
|
|
228
|
+ decoration: undefined,
|
|
229
|
+ // 房源状态
|
|
230
|
+ roomStatus: undefined,
|
|
231
|
+ // 实勘状态
|
|
232
|
+ rescStatus: undefined,
|
|
233
|
+ // 楼栋
|
|
234
|
+ roomBuild: undefined,
|
|
235
|
+ // 单元
|
|
236
|
+ roomUnit: undefined,
|
|
237
|
+ // 房号
|
|
238
|
+ roomFloor: undefined,
|
|
239
|
+ })
|
|
240
|
+
|
|
241
|
+ const { dicts, getBusinessCity, getDict } = useModel('dicts')
|
|
242
|
+ // 区县
|
|
243
|
+ const roomDistrictOptions = computed(() => {
|
|
244
|
+ const roomDistrictDict = dicts.roomDistrict
|
|
245
|
+ if (!roomDistrictDict) {
|
|
246
|
+ getBusinessCity(1)
|
|
247
|
+ }
|
|
248
|
+ return (roomDistrictDict || []).map(x => ({...x, text: x.label}))
|
|
249
|
+ })
|
|
250
|
+ // 商圈 - 依据区县联动
|
|
251
|
+ const roomBussinesOptions = computed(() => {
|
|
252
|
+ if (!formData.roomDistrict) {
|
|
253
|
+ return []
|
|
254
|
+ }
|
|
255
|
+
|
|
256
|
+ const roomBussinesDict = dicts.roomBussines
|
|
257
|
+ return (roomBussinesDict || []).map(x => ({...x, text: x.label}))
|
|
258
|
+ })
|
161
|
259
|
|
162
|
|
- const roomDistrict = ref()
|
163
|
|
- const roomBussines = ref()
|
164
|
|
- const roomArea = computed({
|
165
|
|
- get: () => ({roomDistrict: roomDistrict.value, roomBussines: roomBussines.value}),
|
166
|
|
- set: val => {
|
167
|
|
- roomDistrict.value = val.roomDistrict
|
168
|
|
- roomBussines.value = val.roomBussines
|
|
260
|
+ watch(
|
|
261
|
+ () => formData.roomDistrict,
|
|
262
|
+ (nw) => {
|
|
263
|
+ dicts.roomBussines = []
|
|
264
|
+ formData.roomBussines = undefined
|
|
265
|
+ getBusinessCity(2, nw)
|
|
266
|
+ }
|
|
267
|
+ )
|
|
268
|
+
|
|
269
|
+ // 楼层
|
|
270
|
+ const roomFloors = computed({
|
|
271
|
+ get: () => [formData.floorMin, formData.floorMax],
|
|
272
|
+ set: (nw) => {
|
|
273
|
+ formData.floorMin = nw[0]
|
|
274
|
+ formData.floorMax = nw[1]
|
|
275
|
+ }
|
|
276
|
+ })
|
|
277
|
+
|
|
278
|
+ // 面积
|
|
279
|
+ const roomSQ = computed({
|
|
280
|
+ get: () => [formData.sqMin, formData.sqMax],
|
|
281
|
+ set: (nw) => {
|
|
282
|
+ formData.sqMin = nw[0]
|
|
283
|
+ formData.sqMax = nw[1]
|
169
|
284
|
}
|
170
|
285
|
})
|
171
|
286
|
|
|
287
|
+ // 总价
|
|
288
|
+ const roomPrices = computed({
|
|
289
|
+ get: () => [formData.pirceMin, formData.priceMax],
|
|
290
|
+ set: (nw) => {
|
|
291
|
+ formData.pirceMin = nw[0]
|
|
292
|
+ formData.priceMax = nw[1]
|
|
293
|
+ }
|
|
294
|
+ })
|
|
295
|
+
|
|
296
|
+ // 户型
|
|
297
|
+ const roomTypeOptions = computed(() => {
|
|
298
|
+ return dicts.roomType
|
|
299
|
+ })
|
|
300
|
+
|
|
301
|
+ // 装修
|
|
302
|
+ const decorationOptions = computed(() => {
|
|
303
|
+ const decorationDict = dicts.decoration || []
|
|
304
|
+ if (!decorationDict.length) {
|
|
305
|
+ getDict('decoration')
|
|
306
|
+ }
|
|
307
|
+
|
|
308
|
+ return decorationDict
|
|
309
|
+ })
|
|
310
|
+
|
|
311
|
+ // 房源状态
|
|
312
|
+ const roomStatusOptions = computed(() => {
|
|
313
|
+ const roomStatusDict = dicts.roomStatus || []
|
|
314
|
+ if (!roomStatusDict.length) {
|
|
315
|
+ getDict('roomStatus')
|
|
316
|
+ }
|
|
317
|
+
|
|
318
|
+ return roomStatusDict
|
|
319
|
+ })
|
172
|
320
|
|
|
321
|
+ // 实勘状态
|
|
322
|
+ const rescStatusOptions = computed(() => {
|
|
323
|
+ return dicts.rescStatus
|
|
324
|
+ })
|
|
325
|
+
|
173
|
326
|
const state = reactive({
|
174
|
327
|
housetype: [],
|
175
|
328
|
renovation: [],
|
176
|
329
|
});
|
177
|
|
- const serchValue = ref("");
|
|
330
|
+
|
|
331
|
+ const searchValue = ref("");
|
178
|
332
|
const searchType = ref("楼盘");
|
179
|
333
|
const showPopover = ref(false);
|
180
|
|
- const phoneShow = ref(false);
|
|
334
|
+ const phoneShow = ref(false);
|
181
|
335
|
|
182
|
336
|
// 通过 actions 属性来定义菜单选项
|
183
|
337
|
const searchActions = [
|
|
@@ -185,62 +339,63 @@ emits:["onBack"],
|
185
|
339
|
{ text: "房源", value: "2" },
|
186
|
340
|
{ text: "业主电话", value: "3" },
|
187
|
341
|
];
|
188
|
|
- const onSearchSelect = (action) => {
|
189
|
|
- console.log("housetypeChange", action);
|
190
|
342
|
|
|
343
|
+ const onSearchSelect = (action) => {
|
191
|
344
|
searchType.value = action.text;
|
|
345
|
+ searchValue.value = undefined
|
|
346
|
+ formData.estateName = undefined
|
|
347
|
+ formData.roomCodeId = undefined
|
|
348
|
+ formData.ownerTel = undefined
|
192
|
349
|
};
|
193
|
350
|
|
194
|
|
- const onHousetypeChange = (values) => {
|
195
|
|
- console.log("housetypeChange", values);
|
|
351
|
+ watch(searchValue, (nw) => {
|
|
352
|
+ switch(searchType.value) {
|
|
353
|
+ case '楼盘':
|
|
354
|
+ formData.estateName = nw
|
|
355
|
+ break
|
|
356
|
+ case '房源':
|
|
357
|
+ formData.roomCodeId = nw
|
|
358
|
+ break
|
|
359
|
+ default:
|
|
360
|
+ formData.ownerTel = nw
|
|
361
|
+ }
|
|
362
|
+ })
|
196
|
363
|
|
197
|
|
- state.housetype = values;
|
198
|
|
- };
|
199
|
|
- const onSubmit = (values) => {
|
200
|
|
- console.log(state, "submit", values);
|
|
364
|
+ const onSubmit = () => {
|
|
365
|
+ emit('search', formData)
|
201
|
366
|
};
|
202
|
367
|
|
203
|
368
|
const onBack = ()=>{
|
204
|
|
- console.log('onBack');
|
205
|
|
- emit("onBack", 333);
|
|
369
|
+ emit("back");
|
206
|
370
|
}
|
207
|
371
|
|
208
|
|
- const housetypeoptions = [
|
209
|
|
- {
|
210
|
|
- title: "1室",
|
211
|
|
- value: "a",
|
212
|
|
- },
|
213
|
|
- {
|
214
|
|
- title: "2室",
|
215
|
|
- value: "b",
|
216
|
|
- },
|
217
|
|
- {
|
218
|
|
- title: "3室",
|
219
|
|
- value: "c",
|
220
|
|
- },
|
221
|
|
- {
|
222
|
|
- title: "3室及以上",
|
223
|
|
- value: "d",
|
224
|
|
- },
|
225
|
|
- {
|
226
|
|
- title: "全部",
|
227
|
|
- value: "all",
|
228
|
|
- },
|
229
|
|
- ];
|
|
372
|
+ const handleReset = () => {
|
|
373
|
+ Object.keys(formData).forEach(k => {
|
|
374
|
+ formData[k] = undefined
|
|
375
|
+ })
|
|
376
|
+ }
|
230
|
377
|
|
231
|
378
|
return {
|
232
|
|
- roomArea,
|
|
379
|
+ formData,
|
|
380
|
+ roomDistrictOptions,
|
|
381
|
+ roomBussinesOptions,
|
|
382
|
+ roomFloors,
|
|
383
|
+ roomSQ,
|
|
384
|
+ roomPrices,
|
|
385
|
+ roomTypeOptions,
|
|
386
|
+ decorationOptions,
|
|
387
|
+ roomStatusOptions,
|
|
388
|
+ rescStatusOptions,
|
233
|
389
|
phoneShow,
|
234
|
|
- serchValue,
|
|
390
|
+ searchValue,
|
235
|
391
|
searchType,
|
236
|
392
|
state,
|
237
|
393
|
onSubmit,
|
238
|
|
- housetypeoptions,
|
239
|
|
- onHousetypeChange,
|
240
|
394
|
showPopover,
|
241
|
395
|
searchActions,
|
242
|
396
|
onSearchSelect,
|
243
|
397
|
onBack,
|
|
398
|
+ handleReset,
|
244
|
399
|
};
|
245
|
400
|
},
|
246
|
401
|
};
|
|
@@ -252,4 +407,8 @@ emits:["onBack"],
|
252
|
407
|
text-align: left;
|
253
|
408
|
background-color: #f4f4f4;
|
254
|
409
|
}
|
|
410
|
+
|
|
411
|
+:deep(.van-field__label) {
|
|
412
|
+ width: 4.8em;
|
|
413
|
+}
|
255
|
414
|
</style>
|