张延森 преди 4 години
родител
ревизия
7c9ceedead
променени са 3 файла, в които са добавени 100 реда и са изтрити 14 реда
  1. 12
    0
      src/store/models/room.js
  2. 79
    0
      src/view/secondhand/detail/components/MoreActions.vue
  3. 9
    14
      src/view/secondhand/detail/index.vue

+ 12
- 0
src/store/models/room.js Целия файл

@@ -109,6 +109,17 @@ export default () => {
109 109
     })
110 110
   }
111 111
 
112
+  // 房源保护
113
+  const updateProtection = data => {
114
+    return request({
115
+      url: '/room/protection/update-status',
116
+      data,
117
+    }).then(() => {
118
+      detail.roomInfo.protectionFlag = data.protectionFlag
119
+      return
120
+    })
121
+  }
122
+
112 123
   return {
113 124
     list,
114 125
     page,
@@ -122,5 +133,6 @@ export default () => {
122 133
     getAuth,
123 134
     getKey,
124 135
     roomKeyBox,
136
+    updateProtection,
125 137
   }
126 138
 }

+ 79
- 0
src/view/secondhand/detail/components/MoreActions.vue Целия файл

@@ -0,0 +1,79 @@
1
+<template>
2
+  <van-popover v-model:show="show" placement="bottom-end">
3
+    <template #reference>
4
+      <div style="width: 64px; text-align: center;">
5
+        <van-icon name="wap-nav" />
6
+      </div>
7
+    </template>
8
+    <div style="width: 160px">
9
+      <van-cell-group>
10
+        <van-cell
11
+          v-shiro="'room:info:protection'"
12
+          v-show="!roomInfo.protectionFlag || roomInfo.protectionFlag === '0'"
13
+          title="设置房源保护"
14
+          icon="fire"
15
+        />
16
+
17
+        <van-cell
18
+          v-shiro="'room:info:protection'"
19
+          v-show="roomInfo.protectionFlag === '1'"
20
+          title="取消房源保护"
21
+          icon="fire"
22
+        />
23
+
24
+        <van-cell
25
+          v-shiro="'room:info:addTel'"
26
+          title="新增业主电话"
27
+          icon="add"
28
+        />
29
+
30
+        <van-cell
31
+          v-shiro="'room:info:doneRoom'"
32
+          v-show="roomInfo.status === '0'"
33
+          title="下架房源"
34
+          icon="delete"
35
+        />
36
+
37
+        <van-cell
38
+          v-shiro="'room:info:edit'"
39
+          v-show="roomInfo.status !== '7'"
40
+          title="修改房源"
41
+          icon="expand"
42
+        />
43
+        <van-cell
44
+          v-shiro="'room:info:share'"
45
+          title="分享房源"
46
+          icon="share"
47
+        />
48
+      </van-cell-group>
49
+    </div>
50
+  </van-popover>
51
+</template>
52
+
53
+<script>
54
+import { ref } from 'vue'
55
+import { Popover, CellGroup, Cell, Icon } from 'vant'
56
+
57
+export default {
58
+  components: {
59
+    [Popover.name]: Popover,
60
+    [CellGroup.name]: CellGroup,
61
+    [Cell.name]: Cell,
62
+    [Icon.name]: Icon,
63
+  },
64
+  props: {
65
+    roomInfo: {
66
+      type: Object,
67
+      default: () => ({})
68
+    }
69
+  },
70
+  setup() {
71
+    const show = ref(false)
72
+
73
+    return {
74
+      show
75
+    }
76
+  }
77
+}
78
+</script>
79
+

+ 9
- 14
src/view/secondhand/detail/index.vue Целия файл

@@ -9,18 +9,7 @@
9 9
       <div class="title">
10 10
         <p class="body">{{ detail.roomInfo?.title }}</p>
11 11
         
12
-        <van-popover
13
-          v-model:show="showPopover"
14
-          :actions="actions"
15
-          @select="onSelect"
16
-          placement="bottom-end"
17
-        >
18
-          <template #reference>
19
-            <div class="action">
20
-              <van-icon name="wap-nav" />
21
-            </div>
22
-          </template>
23
-        </van-popover>
12
+        <MoreActions :room-info="detail.roomInfo" />
24 13
       </div>
25 14
 
26 15
       <van-cell-group title="房源信息">
@@ -122,6 +111,7 @@ import {
122 111
   CollapseItem,
123 112
 } from "vant";
124 113
 import { useModel } from "@zjxpcyc/vue-tiny-store"
114
+import MoreActions from './components/MoreActions'
125 115
 import RoomMain from './components/Main'
126 116
 import RoomBase from './components/Base'
127 117
 import RoomEstate from './components/Estate'
@@ -151,7 +141,8 @@ export default {
151 141
     [Field.name]: Field,
152 142
     [Dialog.Component.name]: Dialog.Component,
153 143
 
154
-    Swiper: Swiper,
144
+    Swiper,
145
+    MoreActions,
155 146
     RoomMain,
156 147
     RoomBase,
157 148
     RoomEstate,
@@ -174,7 +165,11 @@ export default {
174 165
     const collapseItem = ref()
175 166
     const phone = ref("")
176 167
 
177
-    const { detail, getDetail } = useModel("room")
168
+    const {
169
+      detail,
170
+      getDetail,
171
+      updateProtection,
172
+    } = useModel("room")
178 173
 
179 174
     onMounted(() => {
180 175
       getDetail(roomId);