张延森 4 jaren geleden
bovenliggende
commit
ad2d132dde

+ 2
- 2
src/App.vue Bestand weergeven

@@ -1,7 +1,7 @@
1 1
 <template>
2 2
   <div id="app">
3
-    <router-view />
4
-    
3
+    <!-- 加 key 是为了强制路由刷新 -->
4
+    <router-view :key="$route.fullPath" />
5 5
   </div>
6 6
 </template>
7 7
 

+ 112
- 0
src/view/secondhand/detail/components/Base.vue Bestand weergeven

@@ -0,0 +1,112 @@
1
+<template>
2
+  <div>
3
+    <x-field label="户型">
4
+      {{roomType}}
5
+    </x-field>
6
+
7
+    <x-field label="朝向">
8
+      {{getDictLabel(roomInfo.aspect, 'aspect')}}
9
+    </x-field>
10
+
11
+    <x-field label="装修">
12
+      {{getDictLabel(roomInfo.decoration, 'decoration')}}
13
+    </x-field>
14
+
15
+    <x-field label="房屋用途">
16
+      {{getDictLabel(roomInfo.purpose, 'purpose')}}
17
+    </x-field>
18
+
19
+    <x-field label="建筑类型">
20
+      {{getDictLabel(roomInfo.buildType, 'build_type')}}
21
+    </x-field>
22
+
23
+    <x-field label="配备电梯">
24
+      {{getDictLabel(roomInfo.elevator, 'elevator')}}
25
+    </x-field>
26
+
27
+    <x-field label="抵押信息">
28
+      {{getDictLabel(roomInfo.isMortgage, 'mortgage') || '无'}}
29
+    </x-field>
30
+
31
+    <x-field label="税费">
32
+      {{getDictLabel(roomInfo.buildTime, 'build_time') || '未知'}}
33
+    </x-field>
34
+
35
+    <x-field label="来源">
36
+      {{getDictLabel(roomInfo.sourceFrom, 'sourceFrom')}}
37
+    </x-field>
38
+
39
+  </div>
40
+</template>
41
+
42
+<script>
43
+import { computed } from 'vue'
44
+import { useModel } from '@zjxpcyc/vue-tiny-store'
45
+
46
+export default {
47
+  props: {
48
+    roomInfo: {
49
+      type: Object,
50
+      default: () => ({})
51
+    }
52
+  },
53
+  setup(props) {
54
+    const { dicts, getDict } = useModel('dicts')
55
+
56
+    // 朝向
57
+    if (!dicts.aspect || !dicts.aspect.length) {
58
+      getDict('aspect')
59
+    }
60
+
61
+    // 装修
62
+    if (!dicts.decoration || !dicts.decoration.length) {
63
+      getDict('decoration')
64
+    }
65
+
66
+    // 房屋用途
67
+    if (!dicts.purpose || !dicts.purpose.length) {
68
+      getDict('purpose')
69
+    }
70
+
71
+    // 建筑类型
72
+    if (!dicts['build_type'] || !dicts['build_type'].length) {
73
+      getDict('build_type')
74
+    }
75
+
76
+    // 电梯
77
+    if (!dicts.elevator || !dicts.elevator.length) {
78
+      getDict('elevator')
79
+    }
80
+
81
+    // 抵押信息
82
+    if (!dicts.mortgage || !dicts.mortgage.length) {
83
+      getDict('mortgage')
84
+    }
85
+
86
+    // 税费
87
+    if (!dicts['build_time'] || !dicts['build_time'].length) {
88
+      getDict('build_time')
89
+    }
90
+
91
+    // 来源
92
+    if (!dicts.sourceFrom || !dicts.sourceFrom.length) {
93
+      getDict('sourceFrom')
94
+    }
95
+
96
+    const roomType = computed(() => {
97
+      const [a, b, c, d] = (props.roomInfo.roomType || '').split(',')
98
+      return `${a || ''}室 ${b || '0'}厅 ${c || '0'}厨 ${d || '0'}卫`
99
+    })
100
+
101
+    // 获取字典对应名称
102
+    const getDictLabel = (val, key) => {
103
+      return dicts[key]?.filter(x => x.code === val)[0]?.name
104
+    }
105
+
106
+    return {
107
+      roomType,
108
+      getDictLabel,
109
+    }
110
+  }
111
+}
112
+</script>

+ 32
- 0
src/view/secondhand/detail/components/Estate.vue Bestand weergeven

@@ -0,0 +1,32 @@
1
+<template>
2
+  <div>
3
+    <x-field label="物业费">
4
+      {{buildInfo.propertyPrice}} 元/m²/月
5
+    </x-field>
6
+    <x-field label="建筑年代">
7
+      {{buildInfo.buildYear}}
8
+    </x-field>
9
+    <x-field label="均价">
10
+      {{buildInfo.averagePrice}}
11
+    </x-field>
12
+    <x-field label="开发商">
13
+      {{buildInfo.developer}}
14
+    </x-field>
15
+    <x-field label="物业公司">
16
+      {{buildInfo.propertyCompany}}
17
+    </x-field>
18
+  </div>
19
+
20
+</template>
21
+
22
+<script>
23
+export default {
24
+  props: {
25
+    buildInfo: Object,
26
+    default: () => ({})
27
+  },
28
+  setup() {
29
+    //
30
+  }
31
+}
32
+</script>

+ 9
- 347
src/view/secondhand/detail/index.vue Bestand weergeven

@@ -33,14 +33,14 @@
33 33
             <template #title>
34 34
               <div>基础信息</div>
35 35
             </template>
36
-            <Contextc :options="baseInformationOptions"></Contextc>
36
+            <RoomBase :room-info="detail.roomInfo" />
37 37
           </van-collapse-item>
38 38
 
39 39
           <van-collapse-item name="2">
40 40
             <template #title>
41 41
               <div>物业信息</div>
42 42
             </template>
43
-            <Contextc :options="propertyInformationOptions"></Contextc>
43
+            <RoomEstate :build-info="detail.buildInfo" />
44 44
           </van-collapse-item>
45 45
 
46 46
           <van-collapse-item name="role">
@@ -48,7 +48,7 @@
48 48
               <div>角色人</div>
49 49
             </template>
50 50
             <x-loading x-id="room.role" tips="请稍等...">
51
-              <Contextc :options="roleInformationOptions"></Contextc>
51
+              <!-- <Contextc :options="roleInformationOptions"></Contextc> -->
52 52
             </x-loading>
53 53
           </van-collapse-item>
54 54
           
@@ -125,11 +125,13 @@ import {
125 125
 } from "vant";
126 126
 import { useModel } from "@zjxpcyc/vue-tiny-store"
127 127
 import RoomMain from './components/Main'
128
+import RoomBase from './components/Base'
129
+import RoomEstate from './components/Estate'
128 130
 import RoomAuth from './components/Auth'
129 131
 import RoomKey from './components/Key'
130 132
 import RoomFollow from './components/Follow'
131 133
 import RoomLook from './components/Look'
132
-import Contextc from "../../../components/contextC"
134
+// import Contextc from "../../../components/contextC"
133 135
 // import { router } from "../../../router";
134 136
 
135 137
 export default {
@@ -150,9 +152,10 @@ export default {
150 152
     [Field.name]: Field,
151 153
     [Dialog.Component.name]: Dialog.Component,
152 154
 
153
-    Contextc: Contextc,
154 155
     Swiper: Swiper,
155 156
     RoomMain,
157
+    RoomBase,
158
+    RoomEstate,
156 159
     RoomAuth,
157 160
     RoomKey,
158 161
     RoomFollow,
@@ -170,91 +173,13 @@ export default {
170 173
     const phoneShow = ref(false)
171 174
     const collapseItem = ref()
172 175
     const phone = ref("")
173
-    const showInfo = ref(false)
174 176
 
175 177
     const { detail, roomRole, getDetail, getRole } = useModel("room")
176
-    const { dicts, getDict } = useModel("dicts")
177 178
 
178 179
     onMounted(() => {
179 180
       getDetail(roomId);
180 181
     });
181 182
 
182
-    // 字典
183
-    // 朝向
184
-    const aspectOptions = computed(() => {
185
-      const aspectDict = dicts.aspect || [];
186
-      if (!aspectDict.length) {
187
-        getDict("aspect");
188
-      }
189
-      console.log(aspectDict, "aspectDict");
190
-      return aspectDict;
191
-    });
192
-    // 装修
193
-    const decorationOptions = computed(() => {
194
-      const decorationDict = dicts.decoration || [];
195
-      if (!decorationDict.length) {
196
-        getDict("decoration");
197
-      }
198
-
199
-      return decorationDict;
200
-    });
201
-    //房屋用途
202
-    const purposeOptions = computed(() => {
203
-      const purposeDict = dicts.purpose || [];
204
-      if (!purposeDict.length) {
205
-        getDict("purpose");
206
-      }
207
-
208
-      return purposeDict;
209
-    });
210
-    //建筑类型
211
-    const buildTypeOptions = computed(() => {
212
-      const buildTypeDict = dicts.buildType || [];
213
-      if (!buildTypeDict.length) {
214
-        getDict("build_type");
215
-      }
216
-
217
-      return buildTypeDict;
218
-    });
219
-
220
-    //配备电梯
221
-    const elevatorOptions = computed(() => {
222
-      const elevatorDict = dicts.elevator || [];
223
-      if (!elevatorDict.length) {
224
-        getDict("elevator");
225
-      }
226
-
227
-      return elevatorDict;
228
-    });
229
-    // 抵押信息
230
-    const mortgageOptions = computed(() => {
231
-      const mortgageDict = dicts.mortgage || [];
232
-      if (!mortgageDict.length) {
233
-        getDict("mortgage");
234
-      }
235
-
236
-      return mortgageDict;
237
-    });
238
-    // 税费
239
-    const buildTimeOptions = computed(() => {
240
-      const buildTimeDict = dicts.buildTime || [];
241
-      if (!buildTimeDict.length) {
242
-        getDict("build_time");
243
-      }
244
-
245
-      return buildTimeDict;
246
-    });
247
-
248
-    // 来源
249
-    const sourceFromOptions = computed(() => {
250
-      const sourceFromDict = dicts.sourceFrom || [];
251
-      if (!sourceFromDict.length) {
252
-        getDict("sourceFrom");
253
-      }
254
-
255
-      return sourceFromDict;
256
-    });
257
-
258 183
     // 通过 actions 属性来定义菜单选项
259 184
     const actions = [
260 185
       { text: "设置房源保护", value: "1" },
@@ -299,264 +224,7 @@ export default {
299 224
         router.push("/resc");
300 225
       }
301 226
     };
302
-    const onLookClick = () => {
303
-      console.log("onLookClick");
304
-      if (showInfo.value) return;
305
-    };
306
-    const getRoomFloor = (data) => {
307
-      const [a, b, c] = (data || "").split(",");
308
-
309
-      return `${a || ""}/${b || ""}(${c || ""})`;
310
-    };
311
-
312
-    // 房源信息
313
-    const housingInformationOptions = computed(() => [
314
-      {
315
-        name: "所属楼盘",
316
-        value: detail.building?.buildingName,
317
-        span: 24,
318
-      },
319
-      {
320
-        name: "房源id",
321
-        value: `${detail.roomInfo?.roomCode || ""}${detail.roomInfo?.id || ""}`,
322
-      },
323
-      {
324
-        name: "楼层",
325
-        value: getRoomFloor(detail.roomInfo?.roomFloor),
326
-      },
327
-      {
328
-        name: "所属区县",
329
-        value: detail.roomCity?.areaName,
330
-      },
331
-      {
332
-        name: "面积",
333
-        value: detail.roomInfo?.acreage + "㎡",
334
-      },
335
-      {
336
-        name: "所属商圈",
337
-        value: detail.roomBusiness?.areaName,
338
-      },
339
-      {
340
-        name: "价格",
341
-        value: `${detail.roomInfo?.totalPrice}万元/${(
342
-          (detail.roomInfo?.totalPrice * 1000) /
343
-          detail.roomInfo?.acreage
344
-        ).toFixed(2)}元/㎡`,
345
-      },
346
-      {
347
-        name: "楼房号",
348
-        value: showInfo.value ? detail.roomInfo?.roomNum : "敏感信息",
349
-      },
350
-      {
351
-        name: "单元",
352
-        value: showInfo.value ? detail.roomInfo?.roomUnit : "敏感信息",
353
-      },
354
-      {
355
-        name: "业主姓名",
356
-        value: showInfo.value ? detail.roomInfo?.ownerName : "敏感信息",
357
-      },
358
-      {
359
-        name: "楼栋",
360
-        value: showInfo.value ? detail.roomInfo?.roomBuild : "敏感信息",
361
-      },
362
-      {
363
-        name: "业主电话",
364
-        value: showInfo.value
365
-          ? (detail.roomInfo?.ownerTel || "").split(",")[0]
366
-          : "敏感信息",
367
-      },
368
-      {
369
-        name: ' ',
370
-        value: detail.leftSecurityNum,
371
-        type: "SECURITY",
372
-        click: () => onLookClick(),
373
-      },
374
-    ]);
375
-
376
-    const getRoomType = (data) => {
377
-      const [a, b, c, d] = (data || "").split(",");
378
-
379
-      return `${a || ""}室 ${b || ""}厅 ${c || ""}厨 ${d || ""}卫`;
380
-    };
381
-    // 基本信息
382
-    const baseInformationOptions = computed(() => [
383
-      {
384
-        name: "户型",
385
-        value: getRoomType(detail.roomInfo?.roomType),
386
-      },
387
-      {
388
-        name: "朝向",
389
-        value: aspectOptions.value.filter(
390
-          (x) => x.value == detail.roomInfo?.aspect
391
-        )[0]?.text,
392
-      },
393
-      {
394
-        name: "装修",
395
-        value: decorationOptions.value.filter(
396
-          (x) => x.value == detail.roomInfo?.decoration
397
-        )[0]?.text,
398
-      },
399
-      {
400
-        name: "房屋用途",
401
-        value: purposeOptions.value.filter(
402
-          (x) => x.value == detail.roomInfo?.purpose
403
-        )[0]?.text,
404
-      },
405
-      {
406
-        name: "建筑类型",
407
-        value: buildTypeOptions.value.filter(
408
-          (x) => x.value == detail.roomInfo?.buildType
409
-        )[0]?.text,
410
-      },
411
-      {
412
-        name: "配备电梯",
413
-        value: elevatorOptions.value.filter(
414
-          (x) => x.value == detail.roomInfo?.elevator
415
-        )[0]?.text,
416
-      },
417
-      {
418
-        name: "抵押信息",
419
-        value:
420
-          mortgageOptions.value.filter(
421
-            (x) => x.value == detail.roomInfo?.isMortgage
422
-          )[0]?.text || "暂无",
423
-      },
424
-      {
425
-        name: "税费",
426
-        value:
427
-          buildTimeOptions.value.filter(
428
-            (x) => x.value == detail.roomInfo?.buildTime
429
-          )[0]?.text || "未知",
430
-      },
431
-
432
-      {
433
-        name: "来源",
434
-        value: sourceFromOptions.value.filter(
435
-          (x) => x.value == detail.roomInfo?.sourceFrom
436
-        )[0]?.text,
437
-
438
-        span: 24,
439
-      },
440
-    ]);
441
-    // 物业信息
442
-    const propertyInformationOptions = computed(() =>[
443
-      {
444
-        name: "物业费",
445
-        value: `${(detail.building?.propertyPrice||0).toFixed(2)}元/m²/月`
446
-      },
447
-      {
448
-        name: "建筑年代",
449
-        value:  detail.building?.buildYear
450
-      },
451
-      {
452
-        name: "均价",
453
-        value: `${(detail.building?.averagePrice||0).toFixed(2)}元/m²` 
454
-      },
455
-      {
456
-        name: "开发商",
457
-        value:  detail.building?.developer
458
-      },
459
-      {
460
-        name: "物业公司",
461
-        value: detail.building?.propertyCompany
462
-      },
463
-    ]);
464
-
465
-    // 角色人
466
-    const roleInformationOptions = computed(() => [
467
-      {
468
-        name: "首次录入人",
469
-        value: detail.createMethod === '1' ? '外部录入' : `${roomRole.createName}(ID: ${roomRole.createId})`,
470
-      },
471
-      {
472
-        name: "首次录入时间",
473
-        value: roomRole.createTime
474
-      },
475
-      {
476
-        name: "录入人",
477
-        value: detail.createMethod === '1' ? '外部录入' : `${roomRole.recordName}(ID: ${roomRole.recordId})`,
478
-      },
479
-      {
480
-        name: "录入时间",
481
-        value: roomRole.recordTime
482
-      },
483
-      {
484
-        name: "维护人",
485
-        value: roomRole.belongName && `${roomRole.belongName}(ID: ${roomRole.belongId})`,
486
-      },
487
-      {
488
-        name: "查看电话",
489
-        value: "123",
490
-        type: "BUTTOM",
491
-        onClick: () => {},
492
-      },
493
-      {
494
-        name: "实勘人",
495
-        value: roomRole.rescName && `${roomRole.rescName}(ID: ${roomRole.rescId})`,
496
-      },
497
-      {
498
-        name: "达成时间",
499
-        value: roomRole.rescTime,
500
-      },
501
-      {
502
-        name: "钥匙人",
503
-        value: roomRole.keyName && `${roomRole.keyName}(ID: ${roomRole.keyId})`,
504
-      },
505
-      {
506
-        name: "委托人",
507
-        value: roomRole.authName && `${roomRole.authName}(ID: ${roomRole.authId})`,
508
-      },
509
-      {
510
-        name: "委托时间",
511
-        value: roomRole.authTime,
512
-      },
513
-      {
514
-        name: "最后修改人",
515
-        value: roomRole.updateName && `${roomRole.updateName}(ID: ${roomRole.updateId})`,
516
-      },
517
-      {
518
-        name: "最后修改时间",
519
-        value: roomRole.updateTime,
520
-      },
521
-    ]);
522
-
523
-    // 委托书
524
-    const entrustOptions = computed(() => [
525
-      {
526
-        name: "委托书编号",
527
-        value: "123",
528
-      },
529
-      {
530
-        name: "查看委托书",
531
-        value: "123",
532
-        type: "BUTTOM",
533
-        onClick: () => {},
534
-      },
535
-      {
536
-        name: "开始时间",
537
-        value: "123",
538
-      },
539
-      {
540
-        name: "截止时间",
541
-        value: "123",
542
-      },
543
-    ]);
544
-
545
-    // 钥匙
546
-    const keyOptions = [
547
-      {
548
-        name: "钥匙编号",
549
-        value: "123",
550
-        span: 24,
551
-      },
552
-
553
-      {
554
-        name: "存放地址",
555
-        value: "123",
556
-        span: 24,
557
-      },
558
-    ];
559
-
227
+        
560 228
     const shareOptions = [
561 229
       { name: "微信", icon: "wechat" },
562 230
       { name: "微博", icon: "weibo" },
@@ -587,12 +255,6 @@ export default {
587 255
 
588 256
     return {
589 257
       phone,
590
-      housingInformationOptions,
591
-      baseInformationOptions,
592
-      propertyInformationOptions,
593
-      roleInformationOptions,
594
-      entrustOptions,
595
-      keyOptions,
596 258
       actions,
597 259
       onSelect,
598 260
       showPopover,