|
@@ -2,22 +2,30 @@
|
2
|
2
|
<div class="areaQuery">
|
3
|
3
|
<van-row :gutter="12">
|
4
|
4
|
<van-col span="12">
|
5
|
|
- <Picker
|
6
|
|
- title="区县"
|
7
|
|
- :options="roomDistrictOptions"
|
8
|
|
- v-model="val1"
|
9
|
|
- />
|
|
5
|
+ <van-cell title="区县">
|
|
6
|
+ <Picker
|
|
7
|
+ placeholder="请选择区县"
|
|
8
|
+ :options="roomDistrictOptions"
|
|
9
|
+ v-model="val1"
|
|
10
|
+ />
|
|
11
|
+ </van-cell>
|
10
|
12
|
</van-col>
|
11
|
13
|
<van-col span="12">
|
12
|
|
-
|
|
14
|
+ <van-cell title="商圈">
|
|
15
|
+ <Picker
|
|
16
|
+ placeholder="请选择商圈"
|
|
17
|
+ :options="roomBussinesOptions"
|
|
18
|
+ v-model="val2"
|
|
19
|
+ />
|
|
20
|
+ </van-cell>
|
13
|
21
|
</van-col>
|
14
|
22
|
</van-row>
|
15
|
23
|
</div>
|
16
|
24
|
</template>
|
17
|
25
|
|
18
|
26
|
<script>
|
19
|
|
-import { computed, ref } from 'vue';
|
20
|
|
-import { Col, Row } from "vant";
|
|
27
|
+import { computed } from 'vue';
|
|
28
|
+import { Cell, Col, Row } from "vant";
|
21
|
29
|
import { useModel } from '@zjxpcyc/vue-tiny-store'
|
22
|
30
|
import Picker from '../../Picker'
|
23
|
31
|
|
|
@@ -26,35 +34,55 @@ export default {
|
26
|
34
|
components: {
|
27
|
35
|
[Row.name]: Row,
|
28
|
36
|
[Col.name]: Col,
|
|
37
|
+ [Cell.name]: Cell,
|
29
|
38
|
Picker,
|
30
|
39
|
},
|
31
|
40
|
props: {
|
32
|
|
- name:String,
|
33
|
|
- label:String,
|
34
|
|
- other:Object,
|
35
|
|
- // placeholder:'请选择',
|
|
41
|
+ modelValue: undefined,
|
36
|
42
|
},
|
|
43
|
+ emits: ['update:modelValue'],
|
37
|
44
|
|
38
|
|
- setup() {
|
39
|
|
- const val1 = ref()
|
40
|
|
- const val2 = ref()
|
|
45
|
+ setup(props, {emit}) {
|
|
46
|
+ const val1 = computed({
|
|
47
|
+ get: () => (props.modelValue || {}).roomDistrict,
|
|
48
|
+ set: val => emit('update:modelValue', { ...(props.modelValue || {}), roomDistrict: val })
|
|
49
|
+ })
|
|
50
|
+ const val2 = computed({
|
|
51
|
+ get: () => (props.modelValue || {}).roomBussines,
|
|
52
|
+ set: val => emit('update:modelValue', { ...(props.modelValue || {}), roomBussines: val })
|
|
53
|
+ })
|
41
|
54
|
|
42
|
55
|
const { dicts, getBusinessCity } = useModel('dicts')
|
43
|
|
- // 楼盘
|
44
|
|
- // 区位
|
45
|
|
- const roomDistrict = dicts.roomDistrict
|
46
|
|
- if (!roomDistrict) {
|
47
|
|
- getBusinessCity(1)
|
48
|
|
- }
|
49
|
56
|
|
50
|
57
|
const roomDistrictOptions = computed(() => {
|
|
58
|
+ // 楼盘
|
|
59
|
+ // 区县
|
|
60
|
+ const roomDistrict = dicts.roomDistrict
|
|
61
|
+ if (!roomDistrict) {
|
|
62
|
+ getBusinessCity(1)
|
|
63
|
+ }
|
51
|
64
|
return (roomDistrict || []).map(x => ({...x, text: x.label}))
|
52
|
65
|
})
|
|
66
|
+
|
|
67
|
+ // 商圈 - 依据区县联动
|
|
68
|
+ const roomBussinesOptions = computed(() => {
|
|
69
|
+ if (!val1.value) {
|
|
70
|
+ return []
|
|
71
|
+ }
|
|
72
|
+
|
|
73
|
+ const roomBussines = dicts.roomBussines
|
|
74
|
+ if (!roomBussines) {
|
|
75
|
+ getBusinessCity(2, val1.value)
|
|
76
|
+ }
|
|
77
|
+
|
|
78
|
+ return (roomBussines || []).map(x => ({...x, text: x.label}))
|
|
79
|
+ })
|
53
|
80
|
|
54
|
81
|
return {
|
55
|
82
|
val1,
|
56
|
83
|
val2,
|
57
|
84
|
roomDistrictOptions,
|
|
85
|
+ roomBussinesOptions,
|
58
|
86
|
};
|
59
|
87
|
},
|
60
|
88
|
};
|