소스 검색

Merge branch 'master' of http://git.ycjcjy.com/ershoufang/mp-agent into master

zlisen 4 년 전
부모
커밋
931825ac87
6개의 변경된 파일127개의 추가작업 그리고 103개의 파일을 삭제
  1. 5
    23
      src/components/detailCompents/swiper/index.vue
  2. 23
    0
      src/store/models/room.js
  3. 9
    2
      src/view/resc/components/Items.vue
  4. 73
    27
      src/view/resc/index.vue
  5. 15
    49
      src/view/secondhand/detail/index.vue
  6. 2
    2
      vue.config.js

+ 5
- 23
src/components/detailCompents/swiper/index.vue 파일 보기

@@ -4,7 +4,6 @@
4 4
       <van-swipe-item v-for="(image, index) in images" :key="index" >
5 5
         <van-image
6 6
           height="300"
7
-          fit="contain"
8 7
           :src="image.image"
9 8
           @click="onPerView(index)"
10 9
         />
@@ -24,9 +23,7 @@
24 23
           v-for="(image, index) in images"
25 24
           :key="index"
26 25
           :title="image.text"
27
-          
28 26
         >
29
-          <!-- {{ image.text }} -->
30 27
         </van-tab>
31 28
       </van-tabs>
32 29
     </div>
@@ -53,31 +50,16 @@ export default {
53 50
     [Tabs.name]: Tabs,
54 51
     [Tab.name]: Tab,
55 52
   },
56
-
57
-  //   images = [
58
-  //       'https://img.yzcdn.cn/vant/apple-1.jpg',
59
-  //       'https://img.yzcdn.cn/vant/apple-2.jpg',
60
-  //     ];
61
-
62 53
   props: {
63 54
     images: {
64 55
       type: Array,
65
-      default: () => [
66
-        {
67
-          image: "https://img.yzcdn.cn/vant/apple-1.jpg",
68
-          text: "户型",
69
-        },
70
-        {
71
-          image: "https://img.yzcdn.cn/vant/apple-2.jpg",
72
-          text: "客厅",
73
-        },
74
-      ],
56
+      default: () => [],
75 57
     },
76 58
   },
77 59
 
78 60
   setup(props,) {
79 61
     const current = ref(0);
80
-const swipe = ref();
62
+    const swipe = ref();
81 63
     
82 64
     const onChange = (index) => {
83 65
       current.value = index;
@@ -91,8 +73,8 @@ const swipe = ref();
91 73
     };
92 74
     const onClickTab = (index) => {
93 75
       current.value=index
94
-    swipe.value.swipeTo(index)
95
-swipe.value.resize()
76
+      swipe.value.swipeTo(index)
77
+      swipe.value.resize()
96 78
     
97 79
       console.log(index,  "ongchawng");
98 80
     };
@@ -100,7 +82,7 @@ swipe.value.resize()
100 82
     // refs.checkbox.toggle();
101 83
     onPerView;
102 84
     return {
103
-        swipe,
85
+      swipe,
104 86
       current,
105 87
       onChange,
106 88
       onPerView,

+ 23
- 0
src/store/models/room.js 파일 보기

@@ -178,6 +178,27 @@ export default () => {
178 178
     })
179 179
   }
180 180
 
181
+  // 保存
182
+  const saveResc = (data, roomId) => {
183
+    return request({
184
+      url: '/room/resc/save',
185
+      headers: {
186
+        'Content-Type': 'application/json',
187
+      },
188
+      params: { roomId },
189
+      data,
190
+      toast: '请稍候...',
191
+    })
192
+  }
193
+
194
+  // 删除
195
+  const deleteResc = ({roomId, rescId, rescType}) => {
196
+    return request({
197
+      url: '/room/resc/delete',
198
+      params: { roomId, rescId, rescType },
199
+      toast: '请稍候...',
200
+    })
201
+  }
181 202
 
182 203
   return {
183 204
     list,
@@ -199,5 +220,7 @@ export default () => {
199 220
     houseEdit,
200 221
     getRescList,
201 222
     setRescCover,
223
+    saveResc,
224
+    deleteResc,
202 225
   }
203 226
 }

+ 9
- 2
src/view/resc/components/Items.vue 파일 보기

@@ -67,7 +67,14 @@ export default {
67 67
 
68 68
     // 看不到图
69 69
     const notAllowed = computed(() => {
70
-      return props.rescType === '0' && !permissions['room:info:viewNum'] && !permissions['room:info:delResc']
70
+      // 只控制门牌
71
+      const isDoor = props.rescType === '0'
72
+      // 是否新数据
73
+      const nwData = !!props.rescList[0]?.id
74
+      // 是否有对应的权限
75
+      const hasRight = permissions['room:info:viewNum'] || permissions['room:info:delResc']
76
+
77
+      return nwData && isDoor && !hasRight
71 78
     })
72 79
 
73 80
     // 是否允许删除图片
@@ -79,7 +86,7 @@ export default {
79 86
 
80 87
     // 是否允许上传图片
81 88
     const canUpload = computed(() => {
82
-      const inProtected = props.limitFlag !== 'rescLimit' && props.roomInfo?.rescStatus === '9'
89
+      const inProtected = props.limitFlag === 'rescLimit' && props.roomInfo?.rescStatus === '9'
83 90
       const validating = props.roomInfo?.rescStatus === '1'
84 91
 
85 92
       return !inProtected && !validating

+ 73
- 27
src/view/resc/index.vue 파일 보기

@@ -1,17 +1,16 @@
1 1
 <template>
2 2
   <x-loading x-id="room.resc.list">
3
-    <div class="resc-mgtp" v-if="initData.limitFlag === 'rescLimit' && detail.roomInfo?.rescStatus === '9'">
4
-      <p>房源录入后4小时内仅允许房源录入人上传图片,目前尚无权限上传实勘图</p>
5
-    </div>
6
-    <div class="resc-mgtp" v-if="detail.roomInfo?.rescStatus === '1'">
7
-      <p>当前实勘图正在审核中</p>
8
-    </div>
9
-    <div class="resc-mgtp" v-if="detail.roomInfo?.rescStatus === '0'">
10
-      <x-field label="实勘人">{{initData.rescUser}}</x-field>
11
-      <x-field label="达成时间">{{initData.rescTime}}</x-field>
12
-    </div>
13
-
14 3
     <div class="resc">
4
+      <div class="resc-tip" v-if="initData.limitFlag === 'rescLimit' && detail.roomInfo?.rescStatus === '9'">
5
+        <p>房源录入后4小时内仅允许房源录入人上传图片,目前尚无权限上传实勘图</p>
6
+      </div>
7
+      <div class="resc-tip" v-if="detail.roomInfo?.rescStatus === '1'">
8
+        <p>当前实勘图正在审核中</p>
9
+      </div>
10
+      <div class="resc-tip" v-if="detail.roomInfo?.rescStatus === '0'">
11
+        <x-field label="实勘人">{{initData.rescUser}}</x-field>
12
+        <x-field label="达成时间">{{initData.rescTime}}</x-field>
13
+      </div>
15 14
       <van-row>
16 15
         <van-col span="12">
17 16
           <g-section title="门牌">
@@ -92,8 +91,8 @@
92 91
         />
93 92
       </g-section>
94 93
 
95
-      <div style="margin-top: 2em">
96
-        <van-button block type="warning" v-shiro="'room:info:addResc'">
94
+      <div style="margin-top: 2em" v-if="canSubmit">
95
+        <van-button block type="warning" v-shiro="'room:info:addResc'" @click="handleSubmit">
97 96
           保存审核并提交
98 97
         </van-button>
99 98
       </div>
@@ -102,8 +101,8 @@
102 101
 </template>
103 102
 
104 103
 <script>
105
-import { onMounted, ref } from "vue";
106
-import { useRoute } from 'vue-router'
104
+import { computed, onMounted, ref } from "vue";
105
+import { useRoute, useRouter } from 'vue-router'
107 106
 import { useModel } from '@zjxpcyc/vue-tiny-store'
108 107
 //
109 108
 import {
@@ -113,7 +112,7 @@ import {
113 112
   Button,
114 113
 } from "vant"
115 114
 import RescItems from './components/Items'
116
-import { showDanger, showSuccess } from '@/utils'
115
+import { showDanger, showSuccess, alert } from '@/utils'
117 116
 import uploadImage from '@/utils/uploadImage'
118 117
 
119 118
 export default {
@@ -128,12 +127,26 @@ export default {
128 127
   setup() {
129 128
     const initData = ref({})
130 129
     const route = useRoute()
130
+    const router = useRouter()
131 131
     const willSave = ref([])
132 132
 
133
-    const { detail, getRescList, getDetail, setRescCover } = useModel('room')
133
+    const { detail, getRescList, getDetail, setRescCover, saveResc, deleteResc } = useModel('room')
134 134
 
135 135
     const roomId = route.query.roomId - 0
136 136
 
137
+    const canSubmit = computed(() => {
138
+      // 报单锁定
139
+      const isLocked = detail.roomInfo?.status === '7'
140
+      // 已实勘
141
+      const rescDone = detail.roomInfo?.rescStatus === '0'
142
+      // 非保护期
143
+      const notProteced = detail.roomInfo?.rescStatus === '9' && initData.value.limitFlag != 'rescLimit'
144
+      // 存在未保存的数据
145
+      const hasNoSaved = willSave.value.length > 0
146
+
147
+      return !isLocked && (rescDone || notProteced) && hasNoSaved
148
+    })
149
+
137 150
     // 设置封面
138 151
     const handleCover = resc => {
139 152
       setRescCover(resc.id).then(() => {
@@ -151,7 +164,9 @@ export default {
151 164
 
152 165
     // 上传图片
153 166
     const handleUpload = ({file, type}) => {
154
-      const sort = (initData.value.rescList[type] || []).length + willSave.value.filter(x => x.imgType === type).length
167
+      const rescListData = initData.value.rescList || {}
168
+      const list = rescListData[type] || []
169
+      const sort = list.length + willSave.value.filter(x => x.imgType === type).length
155 170
 
156 171
       uploadImage(file, '1').then(url => {
157 172
         const img = {
@@ -165,8 +180,8 @@ export default {
165 180
         initData.value = {
166 181
           ...initData.value,
167 182
           rescList: {
168
-            ...initData.value.rescList || {},
169
-            [type]: (initData.value.rescList[type] || []).concat(img)
183
+            ...rescListData,
184
+            [type]: list.concat(img)
170 185
           }
171 186
         }
172 187
       })
@@ -174,9 +189,9 @@ export default {
174 189
 
175 190
     // 删除图片
176 191
     const handleDelete = ({resc, index, rescType}) => {
177
-      // 尚未保存
178
-      if (!resc.id) {
179
-        const list = initData.value.rescList[rescType] || []        
192
+      const del = () => {
193
+        const rescListData = initData.value.rescList || {}
194
+        const list = rescListData[rescType] || []
180 195
         list.splice(index, 1)
181 196
 
182 197
         initData.value = {
@@ -186,10 +201,38 @@ export default {
186 201
             [rescType]: list
187 202
           }
188 203
         }
204
+
205
+        if (willSave.value.length) {
206
+          willSave.value = willSave.value.filter(x => x.url !== resc.url && x.imgType !== rescType)
207
+        }
208
+      }
209
+
210
+      if (resc.id) {
211
+        deleteResc({
212
+          roomId,
213
+          rescId: resc.id,
214
+          rescType
215
+        }).then(() => {
216
+          del()
217
+          showSuccess('删除成功')
218
+        })
189 219
       } else {
190
-        // 
220
+        // 没有 id 的说明未提交, 可以直接删除
221
+        del()
191 222
       }
192 223
     }
224
+
225
+    // 保存
226
+    const handleSubmit = () => {
227
+      saveResc(willSave.value, roomId).then(() => {
228
+        alert('成功提交实勘审核').then(() => {
229
+          router.go(-1)
230
+        })
231
+      }).catch(e => {
232
+        console.error(e)
233
+        showDanger(e.message)
234
+      })
235
+    }
193 236
     
194 237
     onMounted(() => {
195 238
       getDetail(roomId)
@@ -203,9 +246,11 @@ export default {
203 246
     return {
204 247
       initData,
205 248
       detail,
249
+      canSubmit,
206 250
       handleCover,
207 251
       handleUpload,
208 252
       handleDelete,
253
+      handleSubmit,
209 254
     };
210 255
   },
211 256
 };
@@ -215,10 +260,11 @@ export default {
215 260
 <style lang="less" scoped>
216 261
 .resc {
217 262
   padding: 1em;
218
-}
219 263
 
220
-.resc-mgtp {
221
-  margin-top: 1em;
264
+  .resc-tip {
265
+    font-weight: 500;
266
+    color: rgba(0,0,0, .8)
267
+  }
222 268
 }
223 269
 
224 270
 </style>

+ 15
- 49
src/view/secondhand/detail/index.vue 파일 보기

@@ -3,7 +3,7 @@
3 3
     <!-- xId='room.view' -->
4 4
     <x-loading x-id="room.view" tip="正在加载详情">
5 5
       <div>
6
-        <Swiper></Swiper>
6
+        <Swiper :images="imageList"></Swiper>
7 7
       </div>
8 8
 
9 9
       <div class="title">
@@ -92,7 +92,7 @@
92 92
 <script>
93 93
 import { ref, onMounted, computed } from "vue";
94 94
 import { useRouter } from "vue-router";
95
-import { Swiper } from "../../../components/detailCompents";
95
+import { Swiper } from "@/components/detailCompents";
96 96
 import {
97 97
   Icon,
98 98
   Popover,
@@ -170,55 +170,22 @@ export default {
170 170
       getDetail,
171 171
     } = useModel("room")
172 172
 
173
+    const { dicts, getDict } = useModel('dicts')
174
+
175
+    const getRescType = val => {
176
+      const rescTypes = dicts['roomResc_type'] || []
177
+      return (rescTypes.filter(x => x.value === val)[0] || {}).text
178
+    }
179
+
180
+    const imageList = computed(() => {
181
+      return (detail.RoomResc || []).filter(x => x.imgType !== '0').map(x => ({image: x.url, text: getRescType(x.imgType)}))
182
+    })
183
+
173 184
     onMounted(() => {
174 185
       getDetail(roomId);
186
+      getDict('roomResc_type')
175 187
     });
176 188
 
177
-    // 通过 actions 属性来定义菜单选项
178
-    const actions = [
179
-      { text: "设置房源保护", value: "1" },
180
-      { text: "新增业主电话", value: "2" },
181
-      { text: "下架房源", value: "3" },
182
-      { text: "修改房源", value: "4" },
183
-      { text: "分享房源", value: "5" },
184
-      { text: "房源实勘", value: "6" },
185
-    ];
186
-    // 设为房源保护后,只有录入人、同部门的上级以及上级部门的上级可以看到房源敏感信息。
187
-    const onSelect = (action) => {
188
-      console.log(action);
189
-      if (action.value == 1) {
190
-        // 设置房源保护
191
-        Dialog.confirm({
192
-          title: "提示",
193
-          message:
194
-            "设为房源保护后,只有录入人、同部门的上级以及上级部门的上级可以看到房源敏感信息。",
195
-          theme: "round-button",
196
-        })
197
-          .then(() => {
198
-            // on close
199
-          })
200
-          .catch(() => {
201
-            // on cancel
202
-          });
203
-      } else if (action.value == 2) {
204
-        // 新增业主电话
205
-        phoneShow.value = true;
206
-      } else if (action.value == 3) {
207
-        // 下架房源
208
-
209
-        router.push("/closehouse");
210
-      } else if (action.value == 4) {
211
-        // 修改房源
212
-        router.push("/editsecondhandhouse");
213
-      } else if (action.value == 5) {
214
-        // 分享房源
215
-        showShare.value = true;
216
-      } else if (action.value == 6) {
217
-        // 房源实勘
218
-        router.push("/resc");
219
-      }
220
-    };
221
-        
222 189
     const shareOptions = [
223 190
       { name: "微信", icon: "wechat" },
224 191
       { name: "微博", icon: "weibo" },
@@ -243,8 +210,7 @@ export default {
243 210
 
244 211
     return {
245 212
       phone,
246
-      actions,
247
-      onSelect,
213
+      imageList,
248 214
       showPopover,
249 215
       showShare,
250 216
       phoneShow,

+ 2
- 2
vue.config.js 파일 보기

@@ -11,8 +11,8 @@ module.exports = {
11 11
     disableHostCheck: true,
12 12
     proxy: {
13 13
       '/mp': {
14
-        target: 'http://10.161.7.66:8080/',
15
-        // target: 'http://localhost:8080/',
14
+        // target: 'http://10.161.7.66:8080/',
15
+        target: 'http://localhost:8080/',
16 16
         ws: true,
17 17
         changeOrigin: true,
18 18
         // pathRewrite: {'^/mp': ''}