张延森 4 anni fa
parent
commit
814f20b051

+ 64
- 64
src/router.js Vedi File

@@ -1,133 +1,133 @@
1
-import { createRouter, createWebHashHistory } from "vue-router"
1
+import { createRouter, createWebHashHistory } from 'vue-router'
2 2
 
3 3
 const routes = [
4 4
   {
5
-    name: "notFound",
6
-    path: "/:path(.*)+",
5
+    name: 'notFound',
6
+    path: '/:path(.*)+',
7 7
     redirect: {
8
-      name: "home",
8
+      name: 'home',
9 9
     },
10 10
   },
11 11
   {
12
-    name: "login",
13
-    path: "/login",
14
-    component: () => import("./view/login"),
12
+    name: 'login',
13
+    path: '/login',
14
+    component: () => import('./view/login'),
15 15
     meta: {
16
-      title: "登录",
16
+      title: '登录',
17 17
     },
18 18
   },
19 19
   {
20
-    path: "/",
21
-    redirect: "/home",
22
-    name: "layout",
23
-    component: () => import("./layout"),
20
+    path: '/',
21
+    redirect: '/home',
22
+    name: 'layout',
23
+    component: () => import('./layout'),
24 24
     children: [
25 25
       {
26
-        path: "/home",
27
-        name: "home",
28
-        component: () => import("./view/home"),
26
+        path: '/home',
27
+        name: 'home',
28
+        component: () => import('./view/home'),
29 29
         meta: {
30
-          title: "房源管理",
30
+          title: '房源管理',
31 31
         },
32 32
       },
33 33
       {
34
-        path: "/house/add",
35
-        name: "house.add",
36
-        component: () => import("./view/addhouse"),
34
+        path: '/house/add',
35
+        name: 'house.add',
36
+        component: () => import('./view/addhouse'),
37 37
         meta: {
38
-          title: "房源录入",
38
+          title: '房源录入',
39 39
         },
40 40
       },
41 41
       {
42
-        name: "user",
43
-        path: "/user",
44
-        component: () => import("./view/user"),
42
+        name: 'user',
43
+        path: '/user',
44
+        component: () => import('./view/user'),
45 45
         meta: {
46
-          title: "我的",
46
+          title: '我的',
47 47
         },
48 48
       },
49 49
     ],
50 50
   },
51 51
   {
52
-    path: "/secondhand/detail",
53
-    name: "secondhand.detail",
54
-    component: () => import("./view/secondhand/detail"),
52
+    path: '/secondhand/detail',
53
+    name: 'secondhand.detail',
54
+    component: () => import('./view/secondhand/detail'),
55 55
     meta: {
56
-      title: "二手房详情",
56
+      title: '二手房详情',
57 57
     },
58 58
   },
59 59
   {
60
-    path: "/renting/detail",
61
-    name: "renting.detail",
62
-    component: () => import("./view/renting/detail"),
60
+    path: '/renting/detail',
61
+    name: 'renting.detail',
62
+    component: () => import('./view/renting/detail'),
63 63
     meta: {
64
-      title: "租房详情",
64
+      title: '租房详情',
65 65
     },
66 66
   },
67 67
 
68 68
   {
69
-    path: "/house/close",
70
-    name: "house.close",
71
-    component: () => import("./view/closehouse"),
69
+    path: '/house/close',
70
+    name: 'house.close',
71
+    component: () => import('./view/closehouse'),
72 72
     meta: {
73
-      title: "关闭房源",
73
+      title: '关闭房源',
74 74
     },
75 75
   },
76 76
   {
77
-    path: "/followup",
78
-    name: "followup",
79
-    component: () => import("./view/followup"),
77
+    path: '/followup',
78
+    name: 'followup',
79
+    component: () => import('./view/followup'),
80 80
     meta: {
81
-      title: "跟进房源",
81
+      title: '跟进房源',
82 82
     },
83 83
   },
84 84
   {
85
-    path: "/look",
86
-    name: "look",
87
-    component: () => import("./view/look"),
85
+    path: '/look',
86
+    name: 'look',
87
+    component: () => import('./view/look'),
88 88
     meta: {
89
-      title: "添加空看",
89
+      title: '添加空看',
90 90
     },
91 91
   },
92 92
 
93 93
   {
94
-    path: "/secondhand/edit",
95
-    name: "secondhand.edit",
96
-    component: () => import("./view/secondhand/edithouse"),
94
+    path: '/secondhand/edit',
95
+    name: 'secondhand.edit',
96
+    component: () => import('./view/secondhand/edithouse'),
97 97
     meta: {
98
-      title: "编辑房源",
98
+      title: '编辑房源',
99 99
     },
100 100
   },
101 101
   {
102
-    path: "/renting/edit",
103
-    name: "renting.edit",
104
-    component: () => import("./view/renting/edithouse"),
102
+    path: '/renting/edit',
103
+    name: 'renting.edit',
104
+    component: () => import('./view/renting/edithouse'),
105 105
     meta: {
106
-      title: "编辑房源",
106
+      title: '编辑房源',
107 107
     },
108 108
   },
109 109
   {
110
-    path: "/resc",
111
-    name: "resc",
112
-    component: () => import("./view/resc"),
110
+    path: '/resc',
111
+    name: 'resc',
112
+    component: () => import('./view/resc'),
113 113
     meta: {
114
-      title: "实勘上传",
114
+      title: '实勘上传',
115 115
     },
116 116
   },
117 117
   {
118
-    path: "/room-auth",
119
-    name: "room.auth",
120
-    component: () => import("./view/room-auth"),
118
+    path: '/room-auth',
119
+    name: 'room.auth',
120
+    component: () => import('./view/room-auth'),
121 121
     meta: {
122
-      title: "委托书新增",
122
+      title: '委托书新增',
123 123
     },
124 124
   },
125 125
   {
126
-    path: "/room-key",
127
-    name: "room.key",
128
-    component: () => import("./view/room-key"),
126
+    path: '/room-key',
127
+    name: 'room.key',
128
+    component: () => import('./view/room-key'),
129 129
     meta: {
130
-      title: "添加钥匙",
130
+      title: '添加钥匙',
131 131
     },
132 132
   },
133 133
 ]

+ 3
- 3
src/store/models/shiro.js Vedi File

@@ -1,12 +1,12 @@
1
-import { reactive } from "vue"
2
-import request from "../../utils/request"
1
+import { reactive } from 'vue'
2
+import request from '@/utils/request'
3 3
 
4 4
 export default () => {
5 5
   const permissions = reactive({})
6 6
 
7 7
   const getPermission = (x) => {
8 8
     return request({
9
-      url: "/comm/rights",
9
+      url: '/comm/rights',
10 10
       data: { name: x },
11 11
     }).then((res) => {
12 12
       permissions[x] = Boolean(res)

+ 20
- 22
src/view/followup/index.vue Vedi File

@@ -70,16 +70,16 @@
70 70
 </template>
71 71
 
72 72
 <script>
73
-import { reactive, onMounted, computed } from "vue"
74
-import { Form, Button, Field, Popup } from "vant"
75
-import { useRouter } from "vue-router"
76
-import { useModel } from "@zjxpcyc/vue-tiny-store"
77
-import Picker from "@/components/Picker"
78
-import request from "@/utils/request"
79
-import { alert } from "@/utils"
73
+import { reactive, onMounted, computed } from 'vue'
74
+import { Form, Button, Field, Popup } from 'vant'
75
+import { useRouter } from 'vue-router'
76
+import { useModel } from '@zjxpcyc/vue-tiny-store'
77
+import Picker from '@/components/Picker'
78
+import request from '@/utils/request'
79
+import { alert } from '@/utils'
80 80
 
81 81
 export default {
82
-  name: "closehouse",
82
+  name: 'closehouse',
83 83
   components: {
84 84
     [Form.name]: Form,
85 85
     [Button.name]: Button,
@@ -101,27 +101,27 @@ export default {
101 101
     const pattern = /[\u4E00-\u9FA5\uF900-\uFA2D]/
102 102
     // var reg = ;
103 103
     //  const pattern = /\d{6}/;
104
-    const { detail, getDetail } = useModel(type === "room" ? "room" : "renting")
104
+    const { detail, getDetail } = useModel(type === 'room' ? 'room' : 'renting')
105 105
 
106 106
     const followTypeOptions = computed(() => {
107 107
       const options = [
108 108
         {
109
-          text: "日常跟进",
110
-          value: "2",
109
+          text: '日常跟进',
110
+          value: '2',
111 111
         },
112 112
         {
113
-          text: "带看",
114
-          value: "1",
113
+          text: '带看',
114
+          value: '1',
115 115
         },
116 116
         {
117
-          text: "查看敏感信息",
118
-          value: "3",
117
+          text: '查看敏感信息',
118
+          value: '3',
119 119
         },
120 120
       ]
121 121
       if (detail.roomInfo.status !== 7 && detail.roomInfo.status !== 8) {
122 122
         options.push({
123
-          text: "价格调整",
124
-          value: "4",
123
+          text: '价格调整',
124
+          value: '4',
125 125
         })
126 126
       }
127 127
 
@@ -132,18 +132,16 @@ export default {
132 132
       request({
133 133
         url: `/${type}/follow/save`,
134 134
         data: formData,
135
-        toast: "请稍候...",
135
+        toast: '请稍候...',
136 136
       }).then(() => {
137
-        alert("添加成功").then(() => {
137
+        alert('添加成功').then(() => {
138 138
           router.go(-1)
139 139
         })
140 140
       })
141 141
     }
142 142
 
143 143
     onMounted(() => {
144
-      if (!detail.roomInfo) {
145
-        getDetail(roomId)
146
-      }
144
+      getDetail(roomId)
147 145
     })
148 146
 
149 147
     return {

+ 33
- 43
src/view/secondhand/detail/components/Profile.vue Vedi File

@@ -49,33 +49,20 @@
49 49
     </x-field>
50 50
 
51 51
     <x-field label=" " v-shiro="'room:info:security'">
52
-      <van-button
53
-        block
54
-        v-if="!unfollowRoom"
55
-        size="small"
56
-        type="warning"
57
-        @click="handleSecurityClick"
52
+      <van-button block size="small" type="warning" @click="handleSecurityClick"
58 53
         >查看敏感信息(剩余 {{ otherData.leftSecurityNum }} 次)</van-button
59 54
       >
60
-      <van-button
61
-        block
62
-        v-else
63
-        size="small"
64
-        type="info"
65
-        v-shiro="'room:info:addFollow'"
66
-        @click="goToAddFollow"
67
-        >去跟进</van-button
68
-      >
69 55
     </x-field>
70 56
   </x-loading>
71 57
 </template>
72 58
 
73 59
 <script>
74
-import { computed, ref, watch } from 'vue'
60
+import { computed, ref } from 'vue'
75 61
 import { useRouter } from 'vue-router'
76 62
 import { Button } from 'vant'
63
+import { useModel } from '@zjxpcyc/vue-tiny-store'
77 64
 import request from '@/utils/request'
78
-import { showDanger, alert } from '@/utils'
65
+import { showDanger, alert, confirm } from '@/utils'
79 66
 
80 67
 const getSecurity = (roomId) => {
81 68
   return request({
@@ -111,8 +98,17 @@ export default {
111 98
   },
112 99
   setup(props) {
113 100
     const router = useRouter()
101
+    const { permissions, getPermission } = useModel('shiro')
114 102
     const securityInfo = ref({})
115
-    const unfollowRoom = ref()
103
+    const hasFollowPermission = computed(
104
+      () => permissions['room:info:addFollow']
105
+    )
106
+    if (
107
+      permissions['room:info:addFollow'] === undefined ||
108
+      permissions['room:info:addFollow'] === null
109
+    ) {
110
+      getPermission('room:info:addFollow')
111
+    }
116 112
 
117 113
     const floor = computed(() => {
118 114
       const [a, b, c] = (props.roomInfo?.roomFloor || '').split(',')
@@ -130,51 +126,45 @@ export default {
130 126
       return `${total || ''} 万元 / ${avg || ''} 元/㎡`
131 127
     })
132 128
 
133
-    const goToAddFollow = () =>
134
-      router.push({
135
-        name: 'secondhand.detail',
136
-        query: { roomId: unfollowRoom.value.id },
137
-      })
138
-
139 129
     const handleSecurityClick = () => {
140 130
       if (!securityInfo.value.roomBuild) {
141 131
         getSecurity(props.roomInfo.id)
142 132
           .then((res) => {
143 133
             securityInfo.value = res || {}
144
-            unfollowRoom.value = undefined
145 134
           })
146 135
           .catch((e) => {
147 136
             if ('1003' === e.code) {
148
-              unfollowRoom.value = JSON.parse(e.message)
149
-
150
-              alert({
151
-                title: '去跟进',
152
-                message: `您存在未跟进的房源,房源编号: ${unfollowRoom.value.id}`,
153
-              }).then(() => {
154
-                // todo
155
-              })
137
+              const followRoom = JSON.parse(e.message)
138
+
139
+              // 有跟进权限
140
+              if (hasFollowPermission.value) {
141
+                confirm({
142
+                  title: '去跟进',
143
+                  message: `您存在未跟进的房源,房源编号: ${followRoom}`,
144
+                }).then(() => {
145
+                  router.push({
146
+                    name: 'secondhand.detail',
147
+                    query: { roomId: followRoom },
148
+                  })
149
+                })
150
+              } else {
151
+                alert({
152
+                  title: '去跟进',
153
+                  message: `您存在未跟进的房源,房源编号: ${followRoom}`,
154
+                })
155
+              }
156 156
             } else {
157
-              unfollowRoom.value = undefined
158 157
               showDanger('查看敏感信息失败')
159 158
             }
160 159
           })
161 160
       }
162 161
     }
163 162
 
164
-    watch(
165
-      () => props.roomInfo,
166
-      () => {
167
-        console.log('------Main-------->')
168
-      }
169
-    )
170
-
171 163
     return {
172 164
       floor,
173 165
       price,
174 166
       securityInfo,
175 167
       handleSecurityClick,
176
-      unfollowRoom,
177
-      goToAddFollow,
178 168
     }
179 169
   },
180 170
 }