zlisen 4 år sedan
förälder
incheckning
b2f08120ea
2 ändrade filer med 51 tillägg och 47 borttagningar
  1. 21
    21
      src/store/models/dicts.js
  2. 30
    26
      src/view/secondhand/components/secondhandscreen.vue

+ 21
- 21
src/store/models/dicts.js Visa fil

@@ -4,19 +4,19 @@ import request from "../../utils/request"
4 4
 // 户型
5 5
 const roomType = [
6 6
   {
7
-    label: '一室',
7
+    text: '一室',
8 8
     value: '1',
9 9
   },
10 10
   {
11
-    label: '两室',
11
+    text: '两室',
12 12
     value: '2',
13 13
   },
14 14
   {
15
-    label: '三室',
15
+    text: '三室',
16 16
     value: '3',
17 17
   },
18 18
   {
19
-    label: '三室以上',
19
+    text: '三室以上',
20 20
     value: '4',
21 21
   },
22 22
 ]
@@ -24,15 +24,15 @@ const roomType = [
24 24
 // 实勘状态
25 25
 const rescStatus = [
26 26
   {
27
-    label: '已实勘',
27
+    text: '已实勘',
28 28
     value: '0',
29 29
   },
30 30
   {
31
-    label: '待审核',
31
+    text: '待审核',
32 32
     value: '1',
33 33
   },
34 34
   {
35
-    label: '未实勘',
35
+    text: '未实勘',
36 36
     value: '9',
37 37
   },
38 38
 ]
@@ -40,15 +40,15 @@ const rescStatus = [
40 40
 // 钥匙状态
41 41
 const keyStatus = [
42 42
   {
43
-    label: '有钥匙',
43
+    text: '有钥匙',
44 44
     value: '0',
45 45
   },
46 46
   {
47
-    label: '待审核',
47
+    text: '待审核',
48 48
     value: '1',
49 49
   },
50 50
   {
51
-    label: '无钥匙',
51
+    text: '无钥匙',
52 52
     value: '9',
53 53
   },
54 54
 ]
@@ -56,15 +56,15 @@ const keyStatus = [
56 56
 // 业主委托
57 57
 const authStatus = [
58 58
   {
59
-    label: '有委托',
59
+    text: '有委托',
60 60
     value: '0',
61 61
   },
62 62
   {
63
-    label: '待审核',
63
+    text: '待审核',
64 64
     value: '1',
65 65
   },
66 66
   {
67
-    label: '无委托',
67
+    text: '无委托',
68 68
     value: '9',
69 69
   },
70 70
 ]
@@ -72,11 +72,11 @@ const authStatus = [
72 72
 // 电梯
73 73
 const elevator = [
74 74
   {
75
-    label: '有',
75
+    text: '有',
76 76
     value: '0',
77 77
   },
78 78
   {
79
-    label: '无',
79
+    text: '无',
80 80
     value: '1',
81 81
   },
82 82
 ]
@@ -84,11 +84,11 @@ const elevator = [
84 84
 // 带看
85 85
 const lookTimes = [
86 86
   {
87
-    label: '有',
87
+    text: '有',
88 88
     value: '1',
89 89
   },
90 90
   {
91
-    label: '无',
91
+    text: '无',
92 92
     value: '0',
93 93
   },
94 94
 ]
@@ -96,15 +96,15 @@ const lookTimes = [
96 96
 // 锁盘
97 97
 const lockRoom = [
98 98
   {
99
-    label: '未锁盘',
99
+    text: '未锁盘',
100 100
     value: '0',
101 101
   },
102 102
   {
103
-    label: '锁盘已关联',
103
+    text: '锁盘已关联',
104 104
     value: '1',
105 105
   },
106 106
   {
107
-    label: '锁盘未关联',
107
+    text: '锁盘未关联',
108 108
     value: '2',
109 109
   },
110 110
 ]
@@ -140,7 +140,7 @@ export default () => {
140 140
       url: '/comm/dict/business-city',
141 141
       params: { areaType, pcode }
142 142
     }).then(res => {
143
-      if (1 === type) {
143
+      if (1 === areaType) {
144 144
         // 区县
145 145
         dicts['roomDistrict'] = res
146 146
       } else {

+ 30
- 26
src/view/secondhand/components/secondhandscreen.vue Visa fil

@@ -9,7 +9,7 @@
9 9
             :title="item.title"
10 10
             v-model="item.value"
11 11
             :options="item.option"
12
-            @change='onChange()'
12
+            @change="onChange()"
13 13
           />
14 14
         </van-dropdown-menu>
15 15
       </van-col>
@@ -21,16 +21,13 @@
21 21
           @click="onMore"
22 22
       /></van-col>
23 23
     </van-row>
24
-
25
-    
26 24
   </div>
27 25
 </template>
28 26
 
29 27
 <script>
30
-
31
-
28
+import { computed, onMounted } from "vue";
32 29
 import { DropdownMenu, DropdownItem, row, col, cell } from "vant";
33
-
30
+import { useModel } from "@zjxpcyc/vue-tiny-store";
34 31
 export default {
35 32
   name: "secondhandscreen",
36 33
   components: {
@@ -92,14 +89,29 @@ export default {
92 89
   },
93 90
   mounted() {},
94 91
 
95
-  setup(props,cex) {
92
+  setup(props, cex) {
93
+    const { dicts, getDict, getBusinessCity } = useModel("dicts");
94
+    console.log(dicts.roomType, getDict, getBusinessCity);
95
+
96
+    // const roomDistrict = dicts.roomDistrict;
96 97
 
97
-    const options = [
98
+    onMounted(() => {
99
+      if (!dicts.roomDistrict) {
100
+        getBusinessCity(1);
101
+      }
102
+    });
103
+
104
+    const options = computed(() => [
98 105
       {
99 106
         id: 0,
100 107
         value: 0,
101 108
         title: "区域",
102
-        option: [],
109
+        option: (dicts.roomDistrict || []).map((x) => {
110
+          return {
111
+            text: x.label,
112
+            ...x,
113
+          };
114
+        }),
103 115
       },
104 116
       {
105 117
         id: 2,
@@ -117,28 +129,20 @@ export default {
117 129
         id: 3,
118 130
         value: "a",
119 131
         title: "户型",
120
-        option: [
121
-          { text: "1室", value: "1" },
122
-          { text: "2室", value: "2" },
123
-          { text: "3室", value: "3" },
124
-          { text: "3室以上", value: "4" },
125
-        ],
132
+        option: dicts.roomType,
126 133
       },
127
-    ];
134
+    ]);
128 135
 
129
-    const onMore=()=>{
130
-      console.log(props,cex,'3332')
131
-      cex.emit('onShowMore',333)
132
-      
133
-    }
136
+    const onMore = () => {
137
+      console.log(props, cex, "3332");
138
+      cex.emit("onShowMore", 333);
139
+    };
134 140
 
135
- const onChange=()=>{
136
-      console.log(props,cex,'3332')
141
+    const onChange = () => {
142
+      console.log(props, cex, "3ss332");
137 143
       // cex.emit('onShowMore',333)
138
-      
139
-    }
144
+    };
140 145
     return {
141
-    
142 146
       onMore,
143 147
       options,
144 148
       onChange,