zlisen 4 years ago
parent
commit
875226bb45

+ 153
- 23
src/store/models/dicts.js View File

@@ -1,9 +1,12 @@
1
-import { reactive, computed } from 'vue'
1
+import {
2
+  reactive,
3
+  computed,
4
+  onMounted,
5
+} from 'vue'
2 6
 import request from '../../utils/request'
3 7
 
4 8
 // 户型
5
-const roomType = [
6
-  {
9
+const roomType = [{
7 10
     text: '一室',
8 11
     value: '1',
9 12
   },
@@ -22,8 +25,7 @@ const roomType = [
22 25
 ]
23 26
 
24 27
 // 实勘状态
25
-const rescStatus = [
26
-  {
28
+const rescStatus = [{
27 29
     text: '已实勘',
28 30
     value: '0',
29 31
   },
@@ -38,8 +40,7 @@ const rescStatus = [
38 40
 ]
39 41
 
40 42
 // 钥匙状态
41
-const keyStatus = [
42
-  {
43
+const keyStatus = [{
43 44
     text: '有钥匙',
44 45
     value: '0',
45 46
   },
@@ -54,8 +55,7 @@ const keyStatus = [
54 55
 ]
55 56
 
56 57
 // 业主委托
57
-const authStatus = [
58
-  {
58
+const authStatus = [{
59 59
     text: '有委托',
60 60
     value: '0',
61 61
   },
@@ -70,8 +70,7 @@ const authStatus = [
70 70
 ]
71 71
 
72 72
 // 电梯
73
-const elevator = [
74
-  {
73
+const elevator = [{
75 74
     text: '有',
76 75
     value: '0',
77 76
   },
@@ -82,8 +81,7 @@ const elevator = [
82 81
 ]
83 82
 
84 83
 // 带看
85
-const lookTimes = [
86
-  {
84
+const lookTimes = [{
87 85
     text: '有',
88 86
     value: '1',
89 87
   },
@@ -94,8 +92,7 @@ const lookTimes = [
94 92
 ]
95 93
 
96 94
 // 锁盘
97
-const lockRoom = [
98
-  {
95
+const lockRoom = [{
99 96
     text: '未锁盘',
100 97
     value: '0',
101 98
   },
@@ -110,8 +107,7 @@ const lockRoom = [
110 107
 ]
111 108
 
112 109
 //租房类型
113
-const leaseWay = [
114
-  {
110
+const leaseWay = [{
115 111
     text: '整租',
116 112
     value: '0',
117 113
   },
@@ -136,9 +132,14 @@ export default () => {
136 132
   const getDict = (key) => {
137 133
     request({
138 134
       url: '/comm/dict',
139
-      params: { groupCode: key },
135
+      params: {
136
+        groupCode: key
137
+      },
140 138
     }).then((res) => {
141
-      dicts[key] = (res || []).map((x) => ({ text: x.name, value: x.code }))
139
+      dicts[key] = (res || []).map((x) => ({
140
+        text: x.name,
141
+        value: x.code
142
+      }))
142 143
     })
143 144
   }
144 145
 
@@ -150,7 +151,10 @@ export default () => {
150 151
 
151 152
     request({
152 153
       url: '/comm/dict/business-city',
153
-      params: { areaType, pcode },
154
+      params: {
155
+        areaType,
156
+        pcode
157
+      },
154 158
     }).then((res) => {
155 159
       if (1 === areaType) {
156 160
         // 区县
@@ -162,10 +166,18 @@ export default () => {
162 166
     })
163 167
   }
164 168
 
165
-  const getBuilding = ({ buildingName, pageNo = 1, pageSize = 20 }) => {
169
+  const getBuilding = ({
170
+    buildingName,
171
+    pageNo = 1,
172
+    pageSize = 20
173
+  }) => {
166 174
     return request({
167 175
       url: '/comm/dict/building-list',
168
-      params: { buildingName, pageNo, pageSize },
176
+      params: {
177
+        buildingName,
178
+        pageNo,
179
+        pageSize
180
+      },
169 181
     }).then((res) => {
170 182
       if (res.result && res.result.length && !buildingName && pageNo === 1) {
171 183
         // 只缓存第一页的
@@ -259,6 +271,113 @@ export default () => {
259 271
     return buildTimeDict
260 272
   })
261 273
 
274
+  // 隔断
275
+  const separateOptions = computed(() => {
276
+    const separateDict = dicts['separate'] || []
277
+    if (!separateDict.length) {
278
+      getDict('separate')
279
+    }
280
+
281
+    return separateDict
282
+  })
283
+
284
+  // 付款方式
285
+  const payWayOptions = computed(() => {
286
+    const payWayDict = dicts['payWay'] || []
287
+    if (!payWayDict.length) {
288
+      getDict('payWay')
289
+    }
290
+
291
+    return payWayDict
292
+  })
293
+
294
+  // 居住现状
295
+  const liveStatusOptions = computed(() => {
296
+    const liveStatusDict = dicts['liveStatus'] || []
297
+    if (!liveStatusDict.length) {
298
+      getDict('liveStatus')
299
+    }
300
+
301
+    return liveStatusDict
302
+  })
303
+
304
+  // 卧室
305
+  const livingRoomOptions = computed(() => {
306
+    const livingRoomDict = dicts['livingRoom'] || []
307
+    // if (!livingRoomDict.length) {
308
+    //   getDict('livingRoom')
309
+    // }
310
+
311
+    return livingRoomDict
312
+  })
313
+
314
+  const loadDictOnMount = () =>
315
+    onMounted(() => {
316
+      if (!livingRoomOptions.value.length) {
317
+        getDict('livingRoom')
318
+      }
319
+    })
320
+
321
+  // 限制性别
322
+  const limitSexOptions = computed(() => {
323
+    const limitSexDict = dicts['limitSex'] || []
324
+    if (!limitSexDict.length) {
325
+      getDict('limitSex')
326
+    }
327
+
328
+    return limitSexDict
329
+  })
330
+
331
+  // 房屋特色
332
+  const roomSpecialOptions = computed(() => {
333
+    const roomSpecialDict = dicts['roomSpecial'] || []
334
+    if (!roomSpecialDict.length) {
335
+      getDict('roomSpecial')
336
+    }
337
+
338
+    return roomSpecialDict
339
+  })
340
+
341
+  // 限制性别
342
+  const parkingOptions = computed(() => {
343
+    const parkingDict = dicts['parking'] || []
344
+    if (!parkingDict.length) {
345
+      getDict('parking')
346
+    }
347
+
348
+    return parkingDict
349
+  })
350
+
351
+  // 房屋特色
352
+  const basementOptions = computed(() => {
353
+    const basementDict = dicts['basement'] || []
354
+    if (!basementDict.length) {
355
+      getDict('basement')
356
+    }
357
+
358
+    return basementDict
359
+  })
360
+
361
+  // 限制性别
362
+  const gasOptions = computed(() => {
363
+    const gasDict = dicts['gas'] || []
364
+    if (!gasDict.length) {
365
+      getDict('gas')
366
+    }
367
+
368
+    return gasDict
369
+  })
370
+
371
+  // 房屋特色
372
+  const electricEquipmentOptions = computed(() => {
373
+    const electricEquipmentDict = dicts['electricEquipment'] || []
374
+    if (!electricEquipmentDict.length) {
375
+      getDict('electricEquipment')
376
+    }
377
+
378
+    return electricEquipmentDict
379
+  })
380
+
262 381
   const namedDicts = reactive({
263 382
     decorationOptions,
264 383
     aspectOptions,
@@ -269,6 +388,16 @@ export default () => {
269 388
     purposeOptions,
270 389
     mortgageOptions,
271 390
     buildTimeOptions,
391
+    separateOptions,
392
+    payWayOptions,
393
+    liveStatusOptions,
394
+    livingRoomOptions,
395
+    limitSexOptions,
396
+    roomSpecialOptions,
397
+    parkingOptions,
398
+    basementOptions,
399
+    gasOptions,
400
+    electricEquipmentOptions,
272 401
   })
273 402
 
274 403
   return {
@@ -277,5 +406,6 @@ export default () => {
277 406
     getDict,
278 407
     getBusinessCity,
279 408
     getBuilding,
409
+    loadDictOnMount,
280 410
   }
281
-}
411
+}

+ 23
- 0
src/store/models/renting.js View File

@@ -207,6 +207,27 @@ export default () => {
207 207
     })
208 208
   }
209 209
 
210
+  // 查看业务房源数
211
+  const countOwnerTel = (ownerTel) => {
212
+    return request({
213
+      url: '/rent/owner-tel/count',
214
+      params: {
215
+        ownerTel
216
+      },
217
+      toast: '请稍候...',
218
+    })
219
+  }
220
+
221
+  // 新增房源
222
+  const addHouse = (params, data) => {
223
+    return request({
224
+      url: '/rent/add',
225
+      params,
226
+      data,
227
+      toast: '请稍候...',
228
+    })
229
+  }
230
+
210 231
   return {
211 232
     list,
212 233
     page,
@@ -226,5 +247,7 @@ export default () => {
226 247
     setRescCover,
227 248
     saveResc,
228 249
     deleteResc,
250
+    countOwnerTel,
251
+    addHouse,
229 252
   }
230 253
 }

+ 43
- 0
src/view/addhouse/addrenting/components/BuildingPicker.vue View File

@@ -0,0 +1,43 @@
1
+<template>
2
+  <van-popup
3
+    v-model:show="showPicker"
4
+    position="right"
5
+    get-container="#app"
6
+    style="width: 90vw; height: 100vh"
7
+  >
8
+    <BuildingSelector @change="handleChange" @cancel="showPicker = false" />
9
+  </van-popup>
10
+</template>
11
+
12
+<script>
13
+import { computed } from 'vue'
14
+import { Popup } from 'vant'
15
+import BuildingSelector from './BuildingSelector'
16
+
17
+export default {
18
+  components: {
19
+    [Popup.name]: Popup,
20
+    BuildingSelector,
21
+  },
22
+  emits: ['change', 'update:show'],
23
+  props: {
24
+    show: Boolean,
25
+  },
26
+  setup(props, { emit }) {
27
+    const showPicker = computed({
28
+      get: () => props.show,
29
+      set: (val) => emit('update:show', val),
30
+    })
31
+
32
+    const handleChange = (e) => {
33
+      showPicker.value = false
34
+      emit('change', e)
35
+    }
36
+
37
+    return {
38
+      showPicker,
39
+      handleChange,
40
+    }
41
+  },
42
+}
43
+</script>

+ 163
- 0
src/view/addhouse/addrenting/components/BuildingSelector.vue View File

@@ -0,0 +1,163 @@
1
+<template>
2
+  <div class="building-sider">
3
+    <div class="search-box">
4
+      <van-search
5
+        v-model="params.buildingName"
6
+        placeholder="请输入搜索关键词"
7
+        @search="handleSearch"
8
+        @cancel="handleReset"
9
+      />
10
+    </div>
11
+    <div class="list-box">
12
+      <van-list
13
+        v-model="loading"
14
+        :finished="finished"
15
+        finished-text="没有更多了"
16
+        @load="handleLoad"
17
+      >
18
+        <van-cell
19
+          v-for="item in list"
20
+          :key="item.buildingId"
21
+          :title="item.buildingName"
22
+          @click="handleSelect(item)"
23
+        >
24
+          <template #right-icon v-if="item.id === selectedId">
25
+            <van-icon name="success" color="#07c160" />
26
+          </template>
27
+        </van-cell>
28
+      </van-list>
29
+    </div>
30
+    <div class="action-box">
31
+      <van-button size="small" type="warning" @click="handleSubmit">
32
+        确定
33
+      </van-button>
34
+      <van-button size="small" @click="handleCancel">取消</van-button>
35
+    </div>
36
+  </div>
37
+</template>
38
+
39
+<script>
40
+import { reactive, ref } from 'vue'
41
+import { Button, Search, List, Cell, Icon } from 'vant'
42
+import { useModel } from '@zjxpcyc/vue-tiny-store'
43
+
44
+export default {
45
+  components: {
46
+    [Button.name]: Button,
47
+    [Search.name]: Search,
48
+    [List.name]: List,
49
+    [Cell.name]: Cell,
50
+    [Icon.name]: Icon,
51
+  },
52
+
53
+  emits: ['change', 'cancel'],
54
+
55
+  setup(props, { emit }) {
56
+    const loading = ref(false)
57
+    const finished = ref(false)
58
+    const selectedId = ref()
59
+    const selectedItem = ref()
60
+
61
+    const params = reactive({
62
+      buildingName: undefined,
63
+      pageNo: 1,
64
+      pageSize: 20,
65
+    })
66
+
67
+    const { dicts, getBuilding } = useModel('dicts')
68
+    const list = ref(dicts.building || [])
69
+
70
+    const handleSearch = () => {
71
+      params.pageNo = 1
72
+      finished.value = false
73
+      handleLoad()
74
+    }
75
+
76
+    const handleReset = () => {
77
+      params.pageNo = 1
78
+      params.buildingName = undefined
79
+      finished.value = false
80
+      handleLoad()
81
+    }
82
+
83
+    const handleLoad = () => {
84
+      if (loading.value) {
85
+        return
86
+      }
87
+
88
+      loading.value = true
89
+      getBuilding(params)
90
+        .then((res) => {
91
+          params.pageNo += 1
92
+          loading.value = false
93
+          finished.value = res.currentPage >= res.totalPages
94
+          if (res.currentPage === 1) {
95
+            list.value = res.result || []
96
+          } else {
97
+            list.value = list.value.concat(res.result || [])
98
+          }
99
+        })
100
+        .catch((e) => {
101
+          console.error(e)
102
+          loading.value = false
103
+        })
104
+    }
105
+
106
+    const handleSelect = (item) => {
107
+      selectedId.value = item.id
108
+      selectedItem.value = item
109
+    }
110
+
111
+    const handleSubmit = () => {
112
+      emit('change', { id: selectedId.value, item: selectedItem.value })
113
+    }
114
+
115
+    const handleCancel = () => {
116
+      emit('cancel')
117
+    }
118
+
119
+    return {
120
+      loading,
121
+      params,
122
+      finished,
123
+      list,
124
+      selectedId,
125
+      handleSelect,
126
+      handleLoad,
127
+      handleSearch,
128
+      handleReset,
129
+      handleSubmit,
130
+      handleCancel,
131
+    }
132
+  },
133
+}
134
+</script>
135
+
136
+<style lang="less" scoped>
137
+.building-sider {
138
+  height: 100vh;
139
+  display: flex;
140
+  flex-direction: column;
141
+  overflow: hidden;
142
+
143
+  .search-box {
144
+    flex: none;
145
+  }
146
+
147
+  .action-box {
148
+    flex: none;
149
+    padding: 1em 0;
150
+    display: flex;
151
+    justify-content: space-around;
152
+
153
+    & > * {
154
+      padding: 0 2em;
155
+    }
156
+  }
157
+
158
+  .list-box {
159
+    flex: auto;
160
+    overflow-y: auto;
161
+  }
162
+}
163
+</style>

+ 51
- 0
src/view/addhouse/addrenting/components/Floor.vue View File

@@ -0,0 +1,51 @@
1
+<template>
2
+  <van-row gutter="16">
3
+    <van-col span="12">
4
+      <van-field v-model="current" placeholder="所在楼层">
5
+        <template #extra>/ </template>
6
+      </van-field>
7
+    </van-col>
8
+    <van-col span="12">
9
+      <van-field v-model="total" placeholder="总楼层"></van-field>
10
+    </van-col>
11
+  </van-row>
12
+</template>
13
+
14
+<script>
15
+import { watch, ref } from 'vue'
16
+import { Row, Col, Field } from 'vant'
17
+
18
+export default {
19
+  components: {
20
+    [Row.name]: Row,
21
+    [Col.name]: Col,
22
+    [Field.name]: Field,
23
+  },
24
+
25
+  props: {
26
+    modelValue: undefined,
27
+  },
28
+
29
+  emits: ['update:modelValue'],
30
+
31
+  setup(props, { emit }) {
32
+    const current = ref('')
33
+    const total = ref('')
34
+
35
+    watch([current, total], (nw) => {
36
+      emit('update:modelValue', nw.join(','))
37
+    })
38
+
39
+    return {
40
+      current,
41
+      total,
42
+    }
43
+  },
44
+}
45
+</script>
46
+
47
+<style lang="less" scoped>
48
+:deep(.van-cell) {
49
+  padding: 0;
50
+}
51
+</style>

+ 66
- 0
src/view/addhouse/addrenting/components/Proportion.vue View File

@@ -0,0 +1,66 @@
1
+<template>
2
+  <div style="width: 100%">
3
+    <van-field type="number" v-model="proportion.elevator" placeholder="请输入">
4
+      <template #extra>梯</template>
5
+    </van-field>
6
+    <van-field type="number" v-model="proportion.family" placeholder="请输入">
7
+      <template #extra>户</template>
8
+    </van-field>
9
+  </div>
10
+</template>
11
+
12
+<script>
13
+import { reactive, watch } from "vue"
14
+import { Field } from "vant"
15
+
16
+export default {
17
+  components: {
18
+    [Field.name]: Field,
19
+  },
20
+
21
+  props: {
22
+    modelValue: undefined,
23
+  },
24
+
25
+  emits: ["update:modelValue"],
26
+
27
+  setup(props, { emit }) {
28
+    const proportion = reactive({
29
+      room: undefined,
30
+      family: undefined,
31
+    })
32
+
33
+    watch(
34
+      () => props.modelValue,
35
+      (nw, od) => {
36
+        if (nw && !od) {
37
+          const typeArr = props.modelValue.split(",")
38
+          proportion.elevator = typeArr[0]
39
+          proportion.family = typeArr[1]
40
+        }
41
+      },
42
+      { immediate: true }
43
+    )
44
+
45
+    watch(
46
+      proportion,
47
+      () => {
48
+        const vals = [proportion.elevator, proportion.family]
49
+        emit("update:modelValue", vals.join(","))
50
+      },
51
+      { deep: true }
52
+    )
53
+
54
+    return {
55
+      proportion,
56
+    }
57
+  },
58
+}
59
+</script>
60
+
61
+<style lang="less" scoped>
62
+:deep(.van-cell) {
63
+  padding-left: 0;
64
+  padding-right: 0;
65
+}
66
+</style>

+ 87
- 0
src/view/addhouse/addrenting/components/RoomType.vue View File

@@ -0,0 +1,87 @@
1
+<template>
2
+  <div style="width: 100%">
3
+    <van-field type="number" v-model="roomType.room" placeholder="请输入">
4
+      <template #extra>室</template>
5
+    </van-field>
6
+    <van-field type="number" v-model="roomType.hall" placeholder="请输入">
7
+      <template #extra>厅</template>
8
+    </van-field>
9
+    <van-field type="number" v-model="roomType.kitchen" placeholder="请输入">
10
+      <template #extra>厨</template>
11
+    </van-field>
12
+    <van-field type="number" v-model="roomType.toilet" placeholder="请输入">
13
+      <template #extra>卫</template>
14
+    </van-field>
15
+    <van-field type="number" v-model="roomType.balcony" placeholder="请输入">
16
+      <template #extra>阳台</template>
17
+    </van-field>
18
+  </div>
19
+</template>
20
+
21
+<script>
22
+import { reactive, watch } from 'vue'
23
+import { Field } from 'vant'
24
+
25
+export default {
26
+  components: {
27
+    [Field.name]: Field,
28
+  },
29
+
30
+  props: {
31
+    modelValue: undefined,
32
+  },
33
+
34
+  emits: ['update:modelValue'],
35
+
36
+  setup(props, { emit }) {
37
+    const roomType = reactive({
38
+      room: undefined,
39
+      hall: undefined,
40
+      kitchen: undefined,
41
+      toilet: undefined,
42
+      balcony: undefined,
43
+    })
44
+
45
+    watch(
46
+      () => props.modelValue,
47
+      (nw, od) => {
48
+        if (nw && !od) {
49
+          const typeArr = props.modelValue.split(',')
50
+          roomType.room = typeArr[0]
51
+          roomType.hall = typeArr[1]
52
+          roomType.kitchen = typeArr[2]
53
+          roomType.toilet = typeArr[3]
54
+          roomType.balcony = typeArr[4]
55
+        }
56
+      },
57
+      { immediate: true }
58
+    )
59
+
60
+    watch(
61
+      roomType,
62
+      () => {
63
+        const vals = [
64
+          roomType.room,
65
+          roomType.hall,
66
+          roomType.kitchen,
67
+          roomType.toilet,
68
+          roomType.balcony,
69
+        ]
70
+        emit('update:modelValue', vals.join(','))
71
+      },
72
+      { deep: true }
73
+    )
74
+
75
+    return {
76
+      roomType,
77
+    }
78
+  },
79
+}
80
+</script>
81
+
82
+<style lang="less" scoped>
83
+:deep(.van-cell) {
84
+  padding-left: 0;
85
+  padding-right: 0;
86
+}
87
+</style>

+ 675
- 188
src/view/addhouse/addrenting/index.vue
File diff suppressed because it is too large
View File


+ 8
- 1
src/view/addhouse/addsecondhand/index.vue View File

@@ -648,7 +648,14 @@ export default {
648 648
 .addsecondhand {
649 649
   text-align: left;
650 650
 }
651
-.secondhand-main::-webkit-scrollbar {
651
+
652
+.addsecondhand {
653
+  width: 100%;
654
+  height: calc(100vh - 94px);
655
+  overflow: hidden;
656
+  overflow-y: auto;
657
+}
658
+.addsecondhand::-webkit-scrollbar {
652 659
   display: none; /*隐藏滚动条*/
653 660
 }
654 661
 

+ 5
- 5
src/view/addhouse/index.vue View File

@@ -14,13 +14,13 @@
14 14
 </template>
15 15
 
16 16
 <script>
17
-import { ref } from "vue"
18
-import { Tab, Tabs } from "vant"
19
-import Addsecondhand from "./addsecondhand"
20
-import Addrenting from "./addrenting"
17
+import { ref } from 'vue'
18
+import { Tab, Tabs } from 'vant'
19
+import Addsecondhand from './addsecondhand'
20
+import Addrenting from './addrenting'
21 21
 
22 22
 export default {
23
-  name: "home",
23
+  name: 'home',
24 24
   components: {
25 25
     [Tab.name]: Tab,
26 26
     [Tabs.name]: Tabs,

+ 5
- 5
src/view/home/index.vue View File

@@ -14,13 +14,13 @@
14 14
 </template>
15 15
 
16 16
 <script>
17
-import { ref } from "vue"
18
-import { Tab, Tabs } from "vant"
19
-import secondhand from "../secondhand"
20
-import renting from "../renting"
17
+import { ref } from 'vue'
18
+import { Tab, Tabs } from 'vant'
19
+import secondhand from '../secondhand'
20
+import renting from '../renting'
21 21
 
22 22
 export default {
23
-  name: "home",
23
+  name: 'home',
24 24
   components: {
25 25
     [Tab.name]: Tab,
26 26
     [Tabs.name]: Tabs,

+ 1
- 1
src/view/renting/edithouse/components/Form.vue View File

@@ -476,7 +476,7 @@ export default {
476 476
         return false
477 477
       }
478 478
       if (!formData.aspect) {
479
-        showWarn("请选择朝向")
479
+        showWarn('请选择朝向')
480 480
         return false
481 481
       }
482 482
       if (!formData.sourceFrom) {