LeneS 5 年前
父节点
当前提交
2983ce80f7

+ 2
- 2
src/components/home/propertySection.vue 查看文件

30
     propertyCard,
30
     propertyCard,
31
   },
31
   },
32
   computed: {
32
   computed: {
33
-    ...mapState('property', ['latestProperties']),
33
+    ...mapState('propertySearch', ['latestProperties']),
34
   },
34
   },
35
   methods: {
35
   methods: {
36
-    ...mapActions('property', ['searchLatestProperties']),
36
+    ...mapActions('propertySearch', ['searchLatestProperties']),
37
   },
37
   },
38
   mounted() {
38
   mounted() {
39
     this.searchLatestProperties();
39
     this.searchLatestProperties();

+ 1
- 1
src/components/misc/contactUs.vue 查看文件

28
             width="900"
28
             width="900"
29
             height="450"
29
             height="450"
30
             frameborder="0"
30
             frameborder="0"
31
-            style="border:0"
31
+            style="border-radius:10px"
32
             allowfullscreen
32
             allowfullscreen
33
           ></iframe>
33
           ></iframe>
34
           <br />
34
           <br />

+ 64
- 24
src/components/property/propertySearchFields.vue 查看文件

12
           <select
12
           <select
13
             class="form-control form-control-lg form-control-a"
13
             class="form-control form-control-lg form-control-a"
14
             id="forSelector"
14
             id="forSelector"
15
-            v-model="selectedType"
16
-            @change="TypeSelected"
15
+            v-model="propertySearch.salesType"
16
+            @change="salesTypeSelected"
17
           >
17
           >
18
             <option value="Sale">Sale</option>
18
             <option value="Sale">Sale</option>
19
             <option value="Rent">Rent</option>
19
             <option value="Rent">Rent</option>
31
           <select
31
           <select
32
             class="form-control form-control-lg form-control-a"
32
             class="form-control form-control-lg form-control-a"
33
             id="forSelector"
33
             id="forSelector"
34
-            v-model="selectedPropertyTypeRes"
34
+            v-model="resType"
35
             @change="PropertyTypeSelected"
35
             @change="PropertyTypeSelected"
36
           >
36
           >
37
             <option>All</option>
37
             <option>All</option>
40
               :key="i"
40
               :key="i"
41
             >{{ propertyType.description }}</option>
41
             >{{ propertyType.description }}</option>
42
           </select>
42
           </select>
43
+          <div class="input-group-append" @click="clearResType">
44
+            <span class="input-group-text cursor-pointer" style="color: #60CBEB">
45
+              <b>X</b>
46
+            </span>
47
+          </div>
43
         </div>
48
         </div>
44
       </div>
49
       </div>
45
       <div v-else class="form-group">
50
       <div v-else class="form-group">
53
           <select
58
           <select
54
             class="form-control form-control-lg form-control-a"
59
             class="form-control form-control-lg form-control-a"
55
             id="forSelector"
60
             id="forSelector"
56
-            v-model="selectedPropertyTypeCom"
61
+            v-model="comType"
57
             @change="PropertyTypeSelected"
62
             @change="PropertyTypeSelected"
58
           >
63
           >
59
             <option>All</option>
64
             <option>All</option>
62
               :key="i"
67
               :key="i"
63
             >{{ propertyType.description }}</option>
68
             >{{ propertyType.description }}</option>
64
           </select>
69
           </select>
70
+          <div class="input-group-append" @click="clearComType">
71
+            <span class="input-group-text cursor-pointer" style="color: #60CBEB">
72
+              <b>X</b>
73
+            </span>
74
+          </div>
65
         </div>
75
         </div>
66
       </div>
76
       </div>
67
       <div class="form-group">
77
       <div class="form-group">
76
             class="form-control form-control-lg form-control-a"
86
             class="form-control form-control-lg form-control-a"
77
             id="provinceselector"
87
             id="provinceselector"
78
             @change="ProvinceSelected"
88
             @change="ProvinceSelected"
79
-            v-model="selectedProvince"
89
+            v-model="propertySearch.province"
80
           >
90
           >
81
             <option>All</option>
91
             <option>All</option>
82
             <option v-for="(province, i) in provinces" :key="i">{{ province.description }}</option>
92
             <option v-for="(province, i) in provinces" :key="i">{{ province.description }}</option>
83
           </select>
93
           </select>
94
+          <div class="input-group-append" @click="clearFilter('province')">
95
+            <span class="input-group-text cursor-pointer" style="color: #60CBEB">
96
+              <b>X</b>
97
+            </span>
98
+          </div>
84
         </div>
99
         </div>
85
       </div>
100
       </div>
86
     </div>
101
     </div>
97
             class="form-control form-control-lg form-control-a"
112
             class="form-control form-control-lg form-control-a"
98
             id="cityselector"
113
             id="cityselector"
99
             @change="CitySelected"
114
             @change="CitySelected"
100
-            v-model="selectedCity"
115
+            v-model="propertySearch.city"
101
           >
116
           >
102
             <option>All</option>
117
             <option>All</option>
103
             <option v-for="(city, i) in cities" :key="i">{{ city.description }}</option>
118
             <option v-for="(city, i) in cities" :key="i">{{ city.description }}</option>
104
           </select>
119
           </select>
120
+          <div class="input-group-append" @click="clearFilter('city')">
121
+            <span class="input-group-text cursor-pointer" style="color: #60CBEB">
122
+              <b>X</b>
123
+            </span>
124
+          </div>
105
         </div>
125
         </div>
106
       </div>
126
       </div>
107
     </div>
127
     </div>
117
           <select
137
           <select
118
             class="form-control form-control-lg form-control-a"
138
             class="form-control form-control-lg form-control-a"
119
             id="suburbselector"
139
             id="suburbselector"
120
-            v-model="selectedSuburb"
121
-            @change="SuburbSelected"
140
+            v-model="propertySearch.suburb"
141
+            @change="SuburbSeleted"
122
           >
142
           >
123
             <option>All</option>
143
             <option>All</option>
124
             <option v-for="(suburb, i) in suburbs" :key="i">{{ suburb.description }}</option>
144
             <option v-for="(suburb, i) in suburbs" :key="i">{{ suburb.description }}</option>
125
           </select>
145
           </select>
146
+          <div class="input-group-append" @click="clearFilter('suburb')">
147
+            <span class="input-group-text cursor-pointer" style="color: #60CBEB">
148
+              <b>X</b>
149
+            </span>
150
+          </div>
126
         </div>
151
         </div>
127
       </div>
152
       </div>
128
     </div>
153
     </div>
138
   },
163
   },
139
   data() {
164
   data() {
140
     return {
165
     return {
141
-      selectedType: 'Sale',
142
-      selectedProvince: 'All',
143
-      selectedCity: 'All',
144
-      selectedSuburb: 'All',
145
-      selectedPropertyTypeRes: 'All',
146
-      selectedPropertyTypeCom: 'All',
166
+      resType: 'All',
167
+      comType: 'All',
147
     };
168
     };
148
   },
169
   },
149
   mounted() {
170
   mounted() {
150
     this.getProvince();
171
     this.getProvince();
151
-    this.$emit('TypeSelectedUpdated', this.selectedType);
152
     this.getPropertyTypesRes();
172
     this.getPropertyTypesRes();
153
     this.getPropertyTypesCom();
173
     this.getPropertyTypesCom();
174
+    this.getPropertySearchObject();
175
+    setTimeout(() => {
176
+      this.propertySearch.propertyUsageType = this.propertyType;
177
+    }, 100);
154
   },
178
   },
155
   computed: {
179
   computed: {
156
     ...mapState('searchTab', ['provinces', 'cities', 'suburbs']),
180
     ...mapState('searchTab', ['provinces', 'cities', 'suburbs']),
157
     ...mapState('property', ['propertyTypesRes', 'propertyTypesCom']),
181
     ...mapState('property', ['propertyTypesRes', 'propertyTypesCom']),
182
+    ...mapState('propertySearch', ['propertySearch']),
158
   },
183
   },
159
   methods: {
184
   methods: {
160
     ...mapActions('searchTab', ['getProvince', 'getCities', 'getSuburbs']),
185
     ...mapActions('searchTab', ['getProvince', 'getCities', 'getSuburbs']),
161
     ...mapActions('property', ['getPropertyTypesRes', 'getPropertyTypesCom']),
186
     ...mapActions('property', ['getPropertyTypesRes', 'getPropertyTypesCom']),
162
-    TypeSelected(item) {
163
-      this.$emit('TypeSelectedUpdated', item.target.value);
187
+    ...mapActions('propertySearch', ['getPropertySearchObject', 'clearFilter']),
188
+    clearResType() {
189
+      this.clearFilter('propertyType');
190
+      this.resType = 'All';
191
+    },
192
+    clearComType() {
193
+      this.clearFilter('propertyType');
194
+      this.comType = 'All';
195
+    },
196
+    salesTypeSelected() {
197
+      this.$emit('updateSearch', this.propertySearch);
164
     },
198
     },
165
     PropertyTypeSelected(item) {
199
     PropertyTypeSelected(item) {
166
-      this.$emit('PropertyTypeSelectedUpdated', item.target.value);
200
+      this.propertySearch.propertyType = item.target.value;
201
+      this.$emit('updateSearch', this.propertySearch);
167
     },
202
     },
168
     ProvinceSelected(item) {
203
     ProvinceSelected(item) {
169
       if (item.target.value !== 'All') {
204
       if (item.target.value !== 'All') {
170
-        this.getCities(Object.assign({}, { province: this.selectedProvince }));
205
+        this.getCities(
206
+          Object.assign({}, { province: this.propertySearch.province }),
207
+        );
171
       }
208
       }
172
-      this.$emit('ProvinceSelectedUpdated', item.target.value);
209
+      this.$emit('updateSearch', this.propertySearch);
173
     },
210
     },
174
     CitySelected(item) {
211
     CitySelected(item) {
175
       if (item.target.value !== 'All') {
212
       if (item.target.value !== 'All') {
176
         this.getSuburbs(
213
         this.getSuburbs(
177
           Object.assign(
214
           Object.assign(
178
             {},
215
             {},
179
-            { province: this.selectedProvince, city: this.selectedCity },
216
+            {
217
+              province: this.propertySearch.province,
218
+              city: this.propertySearch.city,
219
+            },
180
           ),
220
           ),
181
         );
221
         );
182
       }
222
       }
183
-      this.$emit('CitySelectedUpdated', item.target.value);
223
+      this.$emit('updateSearch', this.propertySearch);
184
     },
224
     },
185
-    SuburbSelected(item) {
186
-      this.$emit('SuburbSelectedUpdated', item.target.value);
225
+    SuburbSeleted() {
226
+      this.$emit('updateSearch', this.propertySearch);
187
     },
227
     },
188
   },
228
   },
189
 };
229
 };

+ 82
- 61
src/components/property/propertySearchPage.vue 查看文件

1
 <template>
1
 <template>
2
   <!-- eslint-disable max-len -->
2
   <!-- eslint-disable max-len -->
3
   <div class="container">
3
   <div class="container">
4
-    <div class="container col-md-12" v-if="propertyType === 'Residential'">
4
+    <div class="container col-md-12" v-if="propertySearch.propertyUsageType === 'Residential'">
5
       <div class="col-sm-12">
5
       <div class="col-sm-12">
6
         <div class="about-img-box">
6
         <div class="about-img-box">
7
           <img
7
           <img
47
         </div>
47
         </div>
48
         <div class="col-md-4">
48
         <div class="col-md-4">
49
           <p>
49
           <p>
50
-            <img class="img-fluid" src="./../../../public/img/residential.jpg" alt="About Resale" />
50
+            <img class="img-fluid" src="./../../../public/img/residential.jpg" alt="About Resale" style="border-radius:10px"/>
51
           </p>
51
           </p>
52
         </div>
52
         </div>
53
       </div>
53
       </div>
63
       <br />
63
       <br />
64
     </div>
64
     </div>
65
 
65
 
66
-    <div class="container col-md-12" v-if="propertyType === 'Commercial'">
66
+    <div class="container col-md-12" v-if="propertySearch.propertyUsageType === 'Commercial'">
67
       <div class="col-sm-12">
67
       <div class="col-sm-12">
68
         <div class="about-img-box">
68
         <div class="about-img-box">
69
           <img
69
           <img
117
         </div>
117
         </div>
118
       </div>
118
       </div>
119
       <div>
119
       <div>
120
-        <propertyCard
121
-          v-if="properties.length > 0"
122
-          name="propertyholder"
123
-          :properties="properties"
124
-          :key="propertysearch"
125
-        />
120
+        <propertyCard v-if="properties.length > 0" name="propertyholder" :properties="properties" />
126
         <div v-if="properties.length === 0">
121
         <div v-if="properties.length === 0">
127
           <img src="../../../public/img/no-homes.gif" />
122
           <img src="../../../public/img/no-homes.gif" />
128
           <br />
123
           <br />
154
       suburb: '',
149
       suburb: '',
155
       proptype: '',
150
       proptype: '',
156
       keyword: '',
151
       keyword: '',
152
+      propertySearch: {
153
+        userID: 0,
154
+        keyword: '',
155
+        salesType: 'All',
156
+        propertyUsageType: 'All',
157
+        propertyType: 'All',
158
+        province: 'All',
159
+        city: 'All',
160
+        suburb: 'All',
161
+      },
157
     };
162
     };
158
   },
163
   },
159
   methods: {
164
   methods: {
160
-    ...mapActions('property', [
161
-      'searchPropertiesParams',
162
-      'searchPropertiesKeyword',
163
-    ]),
165
+    ...mapActions('propertySearch', ['searchProperties']),
164
   },
166
   },
165
   computed: {
167
   computed: {
166
-    ...mapState('property', ['properties']),
168
+    ...mapState('propertySearch', ['properties']),
167
     ParamsChanged() {
169
     ParamsChanged() {
168
-      this.propertyTypeparam = this.$route.params.propertyType;
169
-      this.type = this.$route.query.type;
170
-      this.propertyType = this.$route.query.propertyType;
171
-      this.province = this.$route.query.province;
172
-      this.city = this.$route.query.city;
173
-      this.suburb = this.$route.query.suburb;
174
-      this.proptype = this.$route.query.propType;
175
-      this.keyword = this.$route.query.keyword;
176
-
177
-      if (typeof this.propertyType === 'undefined') {
178
-        this.propertyType = this.propertyTypeparam;
179
-      }
170
+      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
171
+      this.propertySearch = {
172
+        userID: 0,
173
+        keyword: '',
174
+        salesType: 'All',
175
+        propertyUsageType: 'All',
176
+        propertyType: 'All',
177
+        province: 'All',
178
+        city: 'All',
179
+        suburb: 'All',
180
+      };
180
 
181
 
181
-      if (this.type === '') {
182
-        this.type = 'undefined';
183
-      }
184
-      if (this.propertyType === '') {
185
-        this.propertyType = 'undefined';
186
-      }
187
-      if (this.province === '') {
188
-        this.province = 'undefined';
189
-      }
190
-      if (this.city === '') {
191
-        this.city = 'undefined';
192
-      }
193
-      if (this.suburb === '') {
194
-        this.suburb = 'undefined';
195
-      }
196
-      if (this.proptype === '') {
197
-        this.propType = 'undefined';
198
-      }
199
-      if (typeof this.keyword === 'undefined' || this.keyword === '') {
200
-        this.searchPropertiesParams(
201
-          Object.assign(
202
-            {},
203
-            {
204
-              type: this.type,
205
-              propertyType: this.propertyType,
206
-              province: this.province,
207
-              city: this.city,
208
-              suburb: this.suburb,
209
-              propType: this.proptype,
210
-            },
211
-          ),
212
-        );
182
+      if (typeof this.$route.params.propertyType === 'undefined') {
183
+        // eslint-disable-next-line vue/no-side-effects-in-computed-properties
184
+        this.propertySearch = this.$route.query;
213
       } else {
185
       } else {
214
-        this.searchPropertiesKeyword(
215
-          Object.assign({}, { keyword: this.keyword }),
216
-        );
186
+        // eslint-disable-next-line vue/no-side-effects-in-computed-properties
187
+        this.propertySearch.propertyUsageType = this.$route.params.propertyType;
217
       }
188
       }
218
 
189
 
190
+      console.log('PropertySearch = ' + JSON.stringify(this.propertySearch));
191
+
192
+      this.searchProperties(this.propertySearch);
193
+      // this.type = this.$route.query.type;
194
+      // this.propertyType = this.$route.query.propertyType;
195
+      // this.province = this.$route.query.province;
196
+      // this.city = this.$route.query.city;
197
+      // this.suburb = this.$route.query.suburb;
198
+      // this.proptype = this.$route.query.propType;
199
+      // this.keyword = this.$route.query.keyword;
200
+      // if (typeof this.propertyType === 'undefined') {
201
+      //   this.propertyType = this.propertyTypeparam;
202
+      // }
203
+      // if (this.type === '') {
204
+      //   this.type = 'undefined';
205
+      // }
206
+      // if (this.propertyType === '') {
207
+      //   this.propertyType = 'undefined';
208
+      // }
209
+      // if (this.province === '') {
210
+      //   this.province = 'undefined';
211
+      // }
212
+      // if (this.city === '') {
213
+      //   this.city = 'undefined';
214
+      // }
215
+      // if (this.suburb === '') {
216
+      //   this.suburb = 'undefined';
217
+      // }
218
+      // if (this.proptype === '') {
219
+      //   this.propType = 'undefined';
220
+      // }
221
+      // if (typeof this.keyword === 'undefined' || this.keyword === '') {
222
+      //   this.searchPropertiesParams(
223
+      //     Object.assign(
224
+      //       {},
225
+      //       {
226
+      //         type: this.type,
227
+      //         propertyType: this.propertyType,
228
+      //         province: this.province,
229
+      //         city: this.city,
230
+      //         suburb: this.suburb,
231
+      //         propType: this.proptype,
232
+      //       },
233
+      //     ),
234
+      //   );
235
+      // } else {
236
+      //   this.searchPropertiesKeyword(
237
+      //     Object.assign({}, { keyword: this.keyword }),
238
+      //   );
239
+      // }
219
       return null;
240
       return null;
220
     },
241
     },
221
   },
242
   },

+ 4
- 1
src/components/property/propertyeditPage.vue 查看文件

356
       setTimeout(
356
       setTimeout(
357
         () => this.$router.push({
357
         () => this.$router.push({
358
             path: '/property/search',
358
             path: '/property/search',
359
-            query: { type: this.salesType, propertyType: this.propertyType },
359
+            query: {
360
+              salesType: this.salesType,
361
+              propertyUsageType: this.propertyType,
362
+            },
360
           }),
363
           }),
361
         3000,
364
         3000,
362
       );
365
       );

+ 21
- 45
src/components/shared/searchTab.vue 查看文件

73
                 role="tabpanel"
73
                 role="tabpanel"
74
                 aria-labelledby="pills-plans-tab"
74
                 aria-labelledby="pills-plans-tab"
75
               >
75
               >
76
-                <propertySearch
77
-                  propertyType="Residential"
78
-                  @TypeSelectedUpdated="TypeSelectedUpdated"
79
-                  @ProvinceSelectedUpdated="ProvinceSelectedUpdated"
80
-                  @CitySelectedUpdated="CitySelectedUpdated"
81
-                  @SuburbSelectedUpdated="SuburbSelectedUpdated"
82
-                  @PropertyTypeSelectedUpdated="PropertyTypeSelectedUpdated"
83
-                />
76
+                <propertySearch propertyType="Residential" @updateSearch="updateSearch" />
84
               </div>
77
               </div>
85
               <div
78
               <div
86
                 class="tab-pane fade"
79
                 class="tab-pane fade"
88
                 role="tabpanel"
81
                 role="tabpanel"
89
                 aria-labelledby="pills-map-tab"
82
                 aria-labelledby="pills-map-tab"
90
               >
83
               >
91
-                <propertySearch
92
-                  propertyType="Commercial"
93
-                  @TypeSelectedUpdated="TypeSelectedUpdated"
94
-                  @ProvinceSelectedUpdated="ProvinceSelectedUpdated"
95
-                  @CitySelectedUpdated="CitySelectedUpdated"
96
-                  @SuburbSelectedUpdated="SuburbSelectedUpdated"
97
-                  @PropertyTypeSelectedUpdated="PropertyTypeSelectedUpdated"
98
-                />
84
+                <propertySearch propertyType="Commercial" />
99
               </div>
85
               </div>
100
             </div>
86
             </div>
101
           </div>
87
           </div>
102
-          {{selectedPropertyType}}
88
+          <!-- {{selectedPropertyType}} -->
103
           <div class="col-md-12">
89
           <div class="col-md-12">
104
             <button type="submit" class="btn btn-b-n" @click="Search">Search</button>
90
             <button type="submit" class="btn btn-b-n" @click="Search">Search</button>
105
           </div>
91
           </div>
110
 </template>
96
 </template>
111
 
97
 
112
 <script>
98
 <script>
99
+import { mapState, mapActions } from 'vuex';
113
 import propertySearch from '../property/propertySearchFields.vue';
100
 import propertySearch from '../property/propertySearchFields.vue';
114
 import timeshareSearch from '../timeshare/searchTimeshare.vue';
101
 import timeshareSearch from '../timeshare/searchTimeshare.vue';
115
 
102
 
121
   data() {
108
   data() {
122
     return {
109
     return {
123
       selectedPropertyType: 'timeshare',
110
       selectedPropertyType: 'timeshare',
124
-      selectedType: '',
125
-      selectedProvince: '',
126
-      selectedCity: '',
127
-      selectedSuburb: '',
128
-      selectedPropType: '',
129
       keyword: '',
111
       keyword: '',
112
+      propertySearch: {
113
+        userID: 0,
114
+        keyword: '',
115
+        salesType: 'Sale',
116
+        propertyUsageType: 'All',
117
+        propertyType: 'All',
118
+        province: 'All',
119
+        city: 'All',
120
+        suburb: 'All',
121
+      },
130
     };
122
     };
131
   },
123
   },
124
+  computed: {},
132
   methods: {
125
   methods: {
133
     updateType(item) {
126
     updateType(item) {
134
       this.selectedPropertyType = item;
127
       this.selectedPropertyType = item;
135
     },
128
     },
136
-    TypeSelectedUpdated(item) {
137
-      this.selectedType = item;
138
-    },
139
-    PropertyTypeSelectedUpdated(item) {
140
-      this.selectedPropType = item;
141
-    },
142
-    ProvinceSelectedUpdated(item) {
143
-      this.selectedProvince = item;
144
-    },
145
-    CitySelectedUpdated(item) {
146
-      this.selectedCity = item;
147
-    },
148
-    SuburbSelectedUpdated(item) {
149
-      this.selectedSuburb = item;
129
+    updateSearch(item) {
130
+      this.propertySearch = item;
131
+      this.propertySearch.propertyUsageType = this.selectedPropertyType;
132
+      this.propertySearch.keyword = this.keyword;
150
     },
133
     },
151
     Search() {
134
     Search() {
152
       if (this.selectedPropertyType === 'timeshare') {
135
       if (this.selectedPropertyType === 'timeshare') {
154
       } else {
137
       } else {
155
         this.$router.push({
138
         this.$router.push({
156
           path: '/property/search',
139
           path: '/property/search',
157
-          query: {
158
-            type: this.selectedType,
159
-            propertyType: this.selectedPropertyType,
160
-            province: this.selectedProvince,
161
-            city: this.selectedCity,
162
-            suburb: this.selectedSuburb,
163
-            propType: this.selectedPropType,
164
-            keyword: this.keyword,
165
-          },
140
+          query: this.propertySearch,
166
         });
141
         });
142
+        // this.$router.push('/property/search');
167
       }
143
       }
168
     },
144
     },
169
   },
145
   },

+ 2
- 0
src/store/index.js 查看文件

17
 import WeekList from './modules/timeshare/weekList';
17
 import WeekList from './modules/timeshare/weekList';
18
 import Bid from './modules/processFlow/bid';
18
 import Bid from './modules/processFlow/bid';
19
 import Authentication from './modules/user/authentication';
19
 import Authentication from './modules/user/authentication';
20
+import PropertySearch from './modules/property/propertySearch';
20
 
21
 
21
 Vue.use(Vuex);
22
 Vue.use(Vuex);
22
 /* eslint no-param-reassign: ["error", { "props": false }] */
23
 /* eslint no-param-reassign: ["error", { "props": false }] */
39
     weekList: WeekList,
40
     weekList: WeekList,
40
     bid: Bid,
41
     bid: Bid,
41
     authentication: Authentication,
42
     authentication: Authentication,
43
+    propertySearch: PropertySearch,
42
   },
44
   },
43
 });
45
 });

+ 0
- 31
src/store/modules/property/property.js 查看文件

31
     propertyTypesCom: [],
31
     propertyTypesCom: [],
32
     propertyOverviewFields: [],
32
     propertyOverviewFields: [],
33
     propertyFields: [],
33
     propertyFields: [],
34
-    properties: [],
35
-    latestProperties: [],
36
   },
34
   },
37
   mutations: {
35
   mutations: {
38
     setProperty(state, property) {
36
     setProperty(state, property) {
59
     updateCurrentProperty(state, property) {
57
     updateCurrentProperty(state, property) {
60
       state.properties.push(property);
58
       state.properties.push(property);
61
     },
59
     },
62
-    updateSearch(state, propertySearch) {
63
-      state.properties = propertySearch;
64
-    },
65
-    setLatestProperties(state, properties) {
66
-      state.latestProperties = properties;
67
-    },
68
     clearProperty(state) {
60
     clearProperty(state) {
69
       state.property = {
61
       state.property = {
70
         createdBy: '',
62
         createdBy: '',
92
     clearPropertyImages(state) {
84
     clearPropertyImages(state) {
93
       state.propertyImages = [];
85
       state.propertyImages = [];
94
     },
86
     },
95
-    setProperties(state, properties) {
96
-      state.properties = properties;
97
-    },
98
   },
87
   },
99
   getters: {},
88
   getters: {},
100
   actions: {
89
   actions: {
156
         .then(result => commit('updateCurrentProperty', result.data))
145
         .then(result => commit('updateCurrentProperty', result.data))
157
         .catch(console.error);
146
         .catch(console.error);
158
     },
147
     },
159
-    searchPropertiesParams({ commit }, item) {
160
-      axios
161
-        .get(
162
-          `/api/property/search/${item.type}/${item.propertyType}/${item.province}/${item.city}/${item.suburb}/${item.propType}`,
163
-        )
164
-        .then(response => commit('updateSearch', response.data))
165
-        .catch(console.error);
166
-    },
167
-    searchPropertiesKeyword({ commit }, item) {
168
-      axios
169
-        .get(`/api/Property/Search/${item.keyword}`)
170
-        .then(response => commit('updateSearch', response.data))
171
-        .catch(console.error);
172
-    },
173
-    searchLatestProperties({ commit }) {
174
-      axios
175
-        .get('/api/property/latestProperties')
176
-        .then(response => commit('setLatestProperties', response.data))
177
-        .catch(console.error);
178
-    },
179
     clearProperty({ commit }) {
148
     clearProperty({ commit }) {
180
       commit('clearProperty');
149
       commit('clearProperty');
181
     },
150
     },

+ 65
- 0
src/store/modules/property/propertySearch.js 查看文件

1
+import axios from 'axios';
2
+
3
+export default {
4
+  namespaced: true,
5
+  state: {
6
+    propertySearch: {
7
+      userID: 0,
8
+      keyword: '',
9
+      salesType: 'Sale',
10
+      propertyUsageType: 'All',
11
+      propertyType: 'All',
12
+      province: 'All',
13
+      city: 'All',
14
+      suburb: 'All',
15
+    },
16
+    properties: [],
17
+    latestProperties: [],
18
+  },
19
+  mutations: {
20
+    updateSearch(state, propertySearch) {
21
+      state.properties = [];
22
+      state.properties = propertySearch;
23
+    },
24
+    setLatestProperties(state, properties) {
25
+      state.latestProperties = properties;
26
+    },
27
+    setPropertySearch(state, search) {
28
+      state.propertySearch = search;
29
+    },
30
+    onClearFilter(state, filter) {
31
+      state.propertySearch[filter] = 'All';
32
+    },
33
+  },
34
+  getters: {},
35
+  actions: {
36
+    clearFilter({ commit }, filter) {
37
+      commit('onClearFilter', filter);
38
+    },
39
+    getPropertySearchObject({ commit }) {
40
+      const search = {
41
+        userID: 0,
42
+        keyword: '',
43
+        salesType: 'Sale',
44
+        propertyUsageType: 'All',
45
+        propertyType: 'All',
46
+        province: 'All',
47
+        city: 'All',
48
+        suburb: 'All',
49
+      };
50
+      commit('setPropertySearch', search);
51
+    },
52
+    searchProperties({ commit }, item) {
53
+      axios
54
+        .post('/api/Property/Search', item)
55
+        .then(result => commit('updateSearch', result.data))
56
+        .catch(console.error);
57
+    },
58
+    searchLatestProperties({ commit }) {
59
+      axios
60
+        .get('/api/property/latestProperties')
61
+        .then(response => commit('setLatestProperties', response.data))
62
+        .catch(console.error);
63
+    },
64
+  },
65
+};

正在加载...
取消
保存