浏览代码

Fixes to properties when saving.

master
George Williams 5 年前
父节点
当前提交
3eb30bce43
共有 2 个文件被更改,包括 26 次插入4 次删除
  1. 25
    3
      src/components/property/propertyeditPage.vue
  2. 1
    1
      src/store/modules/property/property.js

+ 25
- 3
src/components/property/propertyeditPage.vue 查看文件

168
                     name="propertyType"
168
                     name="propertyType"
169
                     id="suburbselector"
169
                     id="suburbselector"
170
                     v-model="property.suburbId"
170
                     v-model="property.suburbId"
171
+                    @change="getPostalCode"
171
                   >
172
                   >
172
                     <option value="0">Please select suburb</option>
173
                     <option value="0">Please select suburb</option>
173
                     <option
174
                     <option
184
                   <span class="input-group-text">
185
                   <span class="input-group-text">
185
                     <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
186
                     <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
186
                   </span>
187
                   </span>
187
-                  <input class="form-control" type="text" name="postalcode" />
188
+                  <input
189
+                    class="form-control"
190
+                    type="text"
191
+                    name="postalcode"
192
+                    v-model="property.addressLine3"
193
+                  />
188
                 </div>
194
                 </div>
189
               </div>
195
               </div>
190
             </div>
196
             </div>
269
                 </div>
275
                 </div>
270
               </div>
276
               </div>
271
             </div>
277
             </div>
272
-            <ImageLoad :loadedImages="loadedImages" :savedImages="propertyImages" />
278
+            <ImageLoad
279
+              :loadedImages="loadedImages"
280
+              :savedImages="propertyImages"
281
+              @DefaultImage="UpdateDefaultImage"
282
+            />
273
             <button
283
             <button
274
               v-if="!wait"
284
               v-if="!wait"
275
               type="button"
285
               type="button"
288
 <script>
298
 <script>
289
 import { mapState, mapActions } from 'vuex';
299
 import { mapState, mapActions } from 'vuex';
290
 import TextEditor from 'vue-trix';
300
 import TextEditor from 'vue-trix';
301
+import { setTimeout } from 'timers';
291
 import UserField from './propertyUserField.vue';
302
 import UserField from './propertyUserField.vue';
292
 import ImageLoad from './propertyImage.vue';
303
 import ImageLoad from './propertyImage.vue';
293
 
304
 
328
     ]),
339
     ]),
329
     SubmitData() {
340
     SubmitData() {
330
       this.wait = true;
341
       this.wait = true;
342
+      if (this.salesType === 'Sale') {
343
+        this.property.isSale = true;
344
+      }
331
       for (let i = 0; i < this.images.length; i++) {
345
       for (let i = 0; i < this.images.length; i++) {
332
         let setAsDefault = false;
346
         let setAsDefault = false;
333
         if (i === this.defaultImage) {
347
         if (i === this.defaultImage) {
338
           isDefault: setAsDefault,
352
           isDefault: setAsDefault,
339
         });
353
         });
340
       }
354
       }
341
-      this.property.createdBy = 'GeorgeW';
355
+      this.property.propertyUserFields = this.propertyFieldValues;
342
 
356
 
343
       this.saveProperty(this.property);
357
       this.saveProperty(this.property);
344
 
358
 
371
         );
385
         );
372
       }
386
       }
373
     },
387
     },
388
+    getPostalCode(item) {
389
+      this.property.addressLine3 = this.suburbs[
390
+        item.target.options.selectedIndex - 1
391
+      ].postalCode;
392
+    },
374
     loadedImages(values) {
393
     loadedImages(values) {
375
       this.images = values;
394
       this.images = values;
376
     },
395
     },
403
     if (this.propertyFields.length > 0) {
422
     if (this.propertyFields.length > 0) {
404
       this.propertyFields = [];
423
       this.propertyFields = [];
405
     }
424
     }
425
+    if (this.property.description !== '') {
426
+      this.property.description = '';
427
+    }
406
 
428
 
407
     this.propertyType = this.$route.params.propType;
429
     this.propertyType = this.$route.params.propType;
408
     this.salesType = this.$route.params.saleType;
430
     this.salesType = this.$route.params.saleType;

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

36
   },
36
   },
37
   mutations: {
37
   mutations: {
38
     setProperty(state, property) {
38
     setProperty(state, property) {
39
-      state.properties.push(property);
39
+      state.property = property;
40
     },
40
     },
41
     setPropertyImages(state, images) {
41
     setPropertyImages(state, images) {
42
       state.propertyImages = images;
42
       state.propertyImages = images;

正在加载...
取消
保存