zlisen 4 年前
父节点
当前提交
f4f9c1d989

+ 138
- 30
src/store/models/renting.js 查看文件

@@ -1,6 +1,11 @@
1
-import { reactive, ref } from "vue"
1
+import {
2
+  reactive,
3
+  ref
4
+} from "vue"
2 5
 import request from "@/utils/request"
3
-import { showDanger } from "@/utils"
6
+import {
7
+  showDanger
8
+} from "@/utils"
4 9
 
5 10
 export default () => {
6 11
   const loading = ref(false)
@@ -12,16 +17,21 @@ export default () => {
12 17
   const getList = (data) => {
13 18
     loading.value = true
14 19
     request({
15
-      loadingId: "renting.list",
16
-      url: "/rent/list",
17
-      data: {
18
-        pageNo: 1,
19
-        pageSize: 10,
20
-        ...data,
21
-      },
22
-    })
20
+        loadingId: "renting.list",
21
+        url: "/rent/list",
22
+        data: {
23
+          pageNo: 1,
24
+          pageSize: 10,
25
+          ...data,
26
+        },
27
+      })
23 28
       .then((res) => {
24
-        const { pageNo, pageSize, endRow, result } = res || {}
29
+        const {
30
+          pageNo,
31
+          pageSize,
32
+          endRow,
33
+          result
34
+        } = res || {}
25 35
         Object.assign(page, {
26 36
           pageNo,
27 37
           pageSize,
@@ -39,12 +49,12 @@ export default () => {
39 49
   const getDetail = (data) => {
40 50
     // loading.value = true
41 51
     request({
42
-      loadingId: "rent.view",
43
-      url: "/rent/view",
44
-      params: {
45
-        id: data,
46
-      },
47
-    })
52
+        loadingId: "rent.view",
53
+        url: "/rent/view",
54
+        params: {
55
+          id: data,
56
+        },
57
+      })
48 58
       .then((res) => {
49 59
         console.log(res, "res")
50 60
 
@@ -60,12 +70,12 @@ export default () => {
60 70
   // 角色人信息
61 71
   const getRole = (data) => {
62 72
     request({
63
-      loadingId: "rent.role.view",
64
-      url: "/rent/role/view",
65
-      params: {
66
-        roomId: data,
67
-      },
68
-    })
73
+        loadingId: "rent.role.view",
74
+        url: "/rent/role/view",
75
+        params: {
76
+          roomId: data,
77
+        },
78
+      })
69 79
       .then((res) => {
70 80
         Object.assign(rentRole, res)
71 81
       })
@@ -78,12 +88,12 @@ export default () => {
78 88
   // 钥匙信息
79 89
   const getKey = (data) => {
80 90
     request({
81
-      loadingId: "rent.key.view",
82
-      url: "/rent/key/view",
83
-      params: {
84
-        roomId: data,
85
-      },
86
-    })
91
+        loadingId: "rent.key.view",
92
+        url: "/rent/key/view",
93
+        params: {
94
+          roomId: data,
95
+        },
96
+      })
87 97
       .then((res) => {
88 98
         Object.assign(rentKeyBox, res)
89 99
       })
@@ -93,6 +103,96 @@ export default () => {
93 103
       })
94 104
   }
95 105
 
106
+  // 业主电话
107
+  const addOwnerTel = (params) => {
108
+    return request({
109
+      url: "/rent/own-tel/add",
110
+      params,
111
+      toast: "请稍候...",
112
+    }).then(() => {
113
+      const ownerTel = detail.roomInfo.ownerTel || ""
114
+      detail.roomInfo.ownerTel = ownerTel
115
+        .split(",")
116
+        .filter(Boolean)
117
+        .concat(params.newOwnerTel)
118
+        .join(",")
119
+      return
120
+    })
121
+  }
122
+
123
+  // 获取楼栋详情
124
+  const getBuilding = (estateId) => {
125
+    return request({
126
+      url: "/rent/building",
127
+      params: {
128
+        estateId
129
+      },
130
+    })
131
+  }
132
+
133
+  // 房源下架
134
+  const closeHouse = (data) => {
135
+    return request({
136
+      url: "/rent/close",
137
+      params: {
138
+        estateId: data.estateId
139
+      },
140
+      data,
141
+      toast: "请稍候...",
142
+    }).then(() => {
143
+      return
144
+    })
145
+  }
146
+
147
+  // 房源编辑
148
+  const houseEdit = (data) => {
149
+    return request({
150
+      url: "/rent/save",
151
+      data,
152
+      toast: "请稍候...",
153
+    })
154
+  }
155
+
156
+   // 实勘列表
157
+   const getRescList = (roomId) => {
158
+    return request({
159
+      url: "/rent/resc/list",
160
+      params: { roomId },
161
+      loadingId: "room.resc.list",
162
+    })
163
+  }
164
+
165
+  // 设置封面
166
+  const setRescCover = (rescId) => {
167
+    return request({
168
+      url: "/rent/resc/cover",
169
+      params: { id: rescId },
170
+      toast: "请稍候...",
171
+    })
172
+  }
173
+
174
+  // 保存
175
+  const saveResc = (data, roomId) => {
176
+    return request({
177
+      url: "/rent/resc/save",
178
+      headers: {
179
+        "Content-Type": "application/json",
180
+      },
181
+      params: { roomId },
182
+      data,
183
+      toast: "请稍候...",
184
+    })
185
+  }
186
+
187
+  // 删除
188
+  const deleteResc = ({ roomId, rescId, rescType }) => {
189
+    return request({
190
+      url: "/rent/resc/delete",
191
+      params: { roomId, rescId, rescType },
192
+      toast: "请稍候...",
193
+    })
194
+  }
195
+
96 196
   return {
97 197
     list,
98 198
     page,
@@ -104,5 +204,13 @@ export default () => {
104 204
     rentRole,
105 205
     getKey,
106 206
     rentKeyBox,
207
+    addOwnerTel,
208
+    getBuilding,
209
+    closeHouse,
210
+    houseEdit,
211
+    getRescList,
212
+    setRescCover,
213
+    saveResc,
214
+    deleteResc,
107 215
   }
108
-}
216
+}

+ 4
- 1
src/view/closehouse/index.vue 查看文件

@@ -94,7 +94,10 @@ export default {
94 94
   setup() {
95 95
     const route = useRoute()
96 96
     const router = useRouter()
97
-    const { detail, getDetail, getBuilding, closeHouse } = useModel("room")
97
+    const type = router.currentRoute.value.query.type
98
+    const { detail, getDetail, getBuilding, closeHouse } = useModel(
99
+      type === "room" ? "room" : "renting"
100
+    )
98 101
 
99 102
     const building = ref({})
100 103
 

+ 162
- 0
src/view/renting/detail/components/MoreActions.vue 查看文件

@@ -0,0 +1,162 @@
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
+          @click="handleRoomProtection(1)"
16
+        />
17
+
18
+        <van-cell
19
+          v-shiro="'room:info:protection'"
20
+          v-show="roomInfo.protectionFlag === '1'"
21
+          title="取消房源保护"
22
+          icon="fire"
23
+          @click="handleRoomProtection(0)"
24
+        /> -->
25
+
26
+        <van-cell
27
+          v-shiro="'room:renting:addTel'"
28
+          title="新增业主电话"
29
+          icon="add"
30
+          @click="phoneShow = true"
31
+        />
32
+
33
+        <van-cell
34
+          v-shiro="'room:renting:doneRoom'"
35
+          v-show="roomInfo.status === '0'"
36
+          title="下架房源"
37
+          icon="delete"
38
+          @click="
39
+            $router.push({
40
+              name: 'house.close',
41
+              query: { roomId: roomInfo.id, type: 'rent' },
42
+            })
43
+          "
44
+        />
45
+
46
+        <van-cell
47
+          v-shiro="'room:renting:edit'"
48
+          v-show="roomInfo.status !== '7' && roomInfo.status !== '8'"
49
+          title="修改房源"
50
+          icon="expand"
51
+          @click="
52
+            $router.push({
53
+              name: 'renting.edit',
54
+              query: { roomId: roomInfo.id, type: 'rent' },
55
+            })
56
+          "
57
+        />
58
+
59
+        <van-cell
60
+          title="房源实勘"
61
+          icon="photograph"
62
+          @click="
63
+            $router.push({
64
+              name: 'resc',
65
+              query: { roomId: roomInfo.id, type: 'rent' },
66
+            })
67
+          "
68
+        />
69
+      </van-cell-group>
70
+    </div>
71
+  </van-popover>
72
+
73
+  <van-dialog
74
+    v-model:show="phoneShow"
75
+    title="新增电话"
76
+    show-cancel-button
77
+    @confirm="handleAddOwnerTel"
78
+    @cancel="phoneShow = false"
79
+  >
80
+    <van-field
81
+      v-model="newOwnerTel"
82
+      type="tel"
83
+      label="业主电话"
84
+      placeholder="请输入电话"
85
+    />
86
+  </van-dialog>
87
+</template>
88
+
89
+<script>
90
+import { ref } from "vue"
91
+import { Dialog, Popover, CellGroup, Cell, Field, Icon, Notify } from "vant"
92
+import { useModel } from "@zjxpcyc/vue-tiny-store"
93
+
94
+export default {
95
+  components: {
96
+    [Popover.name]: Popover,
97
+    [CellGroup.name]: CellGroup,
98
+    [Cell.name]: Cell,
99
+    [Icon.name]: Icon,
100
+    [Field.name]: Field,
101
+  },
102
+  props: {
103
+    roomInfo: {
104
+      type: Object,
105
+      default: () => ({}),
106
+    },
107
+  },
108
+  setup(props) {
109
+    const show = ref(false)
110
+    const phoneShow = ref(false)
111
+    const newOwnerTel = ref()
112
+
113
+    const { updateProtection, addOwnerTel } = useModel("renting")
114
+
115
+    // 房源(确定/取消)保护
116
+    const handleRoomProtection = (status) => {
117
+      show.value = false
118
+      const title = `${status === 1 ? "确定" : "取消"}房源保护`
119
+      const message =
120
+        status === 1
121
+          ? "设为房源保护后,只有录入人、同部门的上级以及上级部门的上级可以看到房源敏感信息。"
122
+          : "取消房源保护后,其他人可以查看当前房源的敏感信息。"
123
+
124
+      Dialog.confirm({ title, message }).then(() => {
125
+        updateProtection({
126
+          id: props.roomInfo.id,
127
+          protectionFlag: status,
128
+        }).then(() => {
129
+          Notify({ type: "success", message: "设置成功" })
130
+        })
131
+      })
132
+    }
133
+
134
+    // 添加户主电话
135
+    const handleAddOwnerTel = () => {
136
+      if (!newOwnerTel.value || newOwnerTel.value.length !== 11) {
137
+        Notify({ type: "warning", message: "请正确填写手机号" })
138
+        return
139
+      }
140
+
141
+      addOwnerTel({
142
+        newOwnerTel: newOwnerTel.value,
143
+        newOwnerRoomId: props.roomInfo.id,
144
+      })
145
+        .then(() => {
146
+          Notify({ type: "success", message: "设置成功" })
147
+        })
148
+        .catch((e) => {
149
+          Notify({ type: "danger", message: e.message })
150
+        })
151
+    }
152
+
153
+    return {
154
+      show,
155
+      phoneShow,
156
+      newOwnerTel,
157
+      handleRoomProtection,
158
+      handleAddOwnerTel,
159
+    }
160
+  },
161
+}
162
+</script>

+ 5
- 3
src/view/renting/detail/index.vue 查看文件

@@ -8,8 +8,8 @@
8 8
 
9 9
       <div class="title">
10 10
         <p class="body">{{ detail.roomInfo?.title }}</p>
11
-
12
-        <van-popover
11
+        <MoreActions :room-info="detail.roomInfo" />
12
+        <!-- <van-popover
13 13
           v-model:show="showPopover"
14 14
           :actions="actions"
15 15
           @select="onSelect"
@@ -20,7 +20,7 @@
20 20
               <van-icon name="wap-nav" />
21 21
             </div>
22 22
           </template>
23
-        </van-popover>
23
+        </van-popover> -->
24 24
       </div>
25 25
 
26 26
       <van-cell-group title="房源信息">
@@ -128,6 +128,7 @@ import {
128 128
   CollapseItem,
129 129
 } from "vant"
130 130
 import { useModel } from "@zjxpcyc/vue-tiny-store"
131
+import MoreActions from "./components/MoreActions"
131 132
 import RoomMain from "./components/Main"
132 133
 import RoomBase from "./components/Base"
133 134
 // import RoomEstate from './components/Estate'
@@ -158,6 +159,7 @@ export default {
158 159
     [Dialog.Component.name]: Dialog.Component,
159 160
 
160 161
     Swiper: Swiper,
162
+    MoreActions,
161 163
     RoomMain,
162 164
     RoomBase,
163 165
     // RoomEstate,

+ 62
- 0
src/view/renting/edithouse/components/Basic.vue 查看文件

@@ -0,0 +1,62 @@
1
+<template>
2
+  <van-collapse v-model="activeName" accordion>
3
+    <van-collapse-item title="基础信息" name="1">
4
+      <!-- <x-field label="房源编号">
5
+        {{ roomInfo.roomCode }}{{ roomInfo.id }}
6
+      </x-field> -->
7
+      <x-field label="楼盘名称">
8
+        {{ building.buildingName }}
9
+      </x-field>
10
+      <!-- <x-field label="楼盘地址">
11
+        {{ building.address }}
12
+      </x-field> -->
13
+      <x-field label="栋号">
14
+        {{ roomInfo.roomBuild }}
15
+      </x-field>
16
+      <x-field label="单元">
17
+        {{ roomInfo.roomUnit }}
18
+      </x-field>
19
+      <x-field label="楼层">
20
+        {{ floor }}
21
+      </x-field>
22
+      <x-field label="房号">
23
+        {{ roomInfo.roomNum }}
24
+      </x-field>
25
+    </van-collapse-item>
26
+  </van-collapse>
27
+</template>
28
+
29
+<script>
30
+import { computed, ref } from "vue"
31
+import { Collapse, CollapseItem } from "vant"
32
+
33
+export default {
34
+  components: {
35
+    [Collapse.name]: Collapse,
36
+    [CollapseItem.name]: CollapseItem,
37
+  },
38
+  props: {
39
+    roomInfo: {
40
+      type: Object,
41
+      default: () => ({}),
42
+    },
43
+    building: {
44
+      type: Object,
45
+      default: () => ({}),
46
+    },
47
+  },
48
+  setup(props) {
49
+    const activeName = ref("1")
50
+
51
+    const floor = computed(() => {
52
+      const roomFloor = (props.roomInfo.roomFloor || "").split(",")
53
+      return `${roomFloor[0]}/${roomFloor[1]}(${roomFloor[2]})`
54
+    })
55
+
56
+    return {
57
+      activeName,
58
+      floor,
59
+    }
60
+  },
61
+}
62
+</script>

+ 532
- 0
src/view/renting/edithouse/components/Form.vue 查看文件

@@ -0,0 +1,532 @@
1
+<template>
2
+  <van-form @submit="handleSumbit">
3
+    <van-field
4
+      v-model="formData.title"
5
+      name="title"
6
+      label="标题"
7
+      placeholder="请输入"
8
+      :rules="[{ required: true, message: '请填写标题' }]"
9
+    />
10
+
11
+    <van-field
12
+      v-model="formData.buildingName"
13
+      name="buildingName"
14
+      label="楼盘名称"
15
+      placeholder="请输入"
16
+    />
17
+
18
+    <van-field name="aspect" label="朝向" required>
19
+      <template #input>
20
+        <Picker
21
+          :options="aspectOptions"
22
+          v-model="formData.aspect"
23
+          placeholder="请选择"
24
+        />
25
+      </template>
26
+    </van-field>
27
+
28
+    <van-field name="leaseWay" label="出租方式" required>
29
+      <template #input>
30
+        <Picker
31
+          :options="leaseWayOptions"
32
+          v-model="formData.leaseWay"
33
+          placeholder="请选择"
34
+        />
35
+      </template>
36
+    </van-field>
37
+
38
+    <van-field
39
+      v-model="formData.acreage"
40
+      name="totalPrice"
41
+      label="租金"
42
+      placeholder="请输入"
43
+      required
44
+      type="number"
45
+      :rules="[{ required: true, message: '请填写租金' }]"
46
+    >
47
+      <template #extra> 元/月 </template>
48
+    </van-field>
49
+
50
+    <van-field name="decoration" label="装修" required>
51
+      <template #input>
52
+        <Picker
53
+          :options="decorationOptions"
54
+          v-model="formData.decoration"
55
+          placeholder="请选择"
56
+        />
57
+      </template>
58
+    </van-field>
59
+
60
+    <van-field
61
+      v-model="formData.acreage"
62
+      name="acreage"
63
+      label="面积"
64
+      placeholder="请输入"
65
+      required
66
+      type="number"
67
+      :rules="[{ required: true, message: '请填写面积' }]"
68
+    >
69
+      <template #extra> ㎡ </template>
70
+    </van-field>
71
+
72
+    <van-field
73
+      v-model="formData.innerAcreage"
74
+      name="innerAcreage"
75
+      label="套内面积"
76
+      placeholder="请输入"
77
+    />
78
+
79
+    <van-field name="roomType" label="户型" placeholder="请输入" required>
80
+      <template #input>
81
+        <RoomType v-model="formData.roomType" />
82
+      </template>
83
+    </van-field>
84
+
85
+    <van-field name="sourceFrom" label="房源来源" required>
86
+      <template #input>
87
+        <Picker
88
+          :options="sourceFromOptions"
89
+          v-model="formData.sourceFrom"
90
+          placeholder="请选择"
91
+        />
92
+      </template>
93
+    </van-field>
94
+
95
+    <van-field name="payWay" label="付款方式">
96
+      <template #input>
97
+        <Picker
98
+          :options="payWayOptions"
99
+          v-model="formData.payWay"
100
+          placeholder="请选择"
101
+        />
102
+      </template>
103
+    </van-field>
104
+
105
+    <van-field name="liveStatus" label="居住现状">
106
+      <template #input>
107
+        <Picker
108
+          :options="liveStatusOptions"
109
+          v-model="formData.liveStatus"
110
+          placeholder="请选择"
111
+        />
112
+      </template>
113
+    </van-field>
114
+
115
+    <van-field name="limitSex" label="限制性别">
116
+      <template #input>
117
+        <Picker
118
+          :options="limitSexOptions"
119
+          v-model="formData.limitSex"
120
+          placeholder="请选择"
121
+        />
122
+      </template>
123
+    </van-field>
124
+
125
+    <van-field name="roomSpecial" label="房屋特色">
126
+      <template #input>
127
+        <Picker
128
+          :options="roomSpecialOptions"
129
+          v-model="formData.roomSpecial"
130
+          placeholder="请选择"
131
+        />
132
+      </template>
133
+    </van-field>
134
+
135
+    <van-field name="proportion" label="梯户比例" placeholder="请输入">
136
+      <template #input>
137
+        <Proportion v-model="formData.proportion" />
138
+      </template>
139
+    </van-field>
140
+
141
+    <van-field name="buildType" label="建筑类型">
142
+      <template #input>
143
+        <Picker
144
+          :options="buildTypeOptions"
145
+          v-model="formData.buildType"
146
+          placeholder="请选择"
147
+        />
148
+      </template>
149
+    </van-field>
150
+
151
+    <van-field name="purpose" label="房屋用途">
152
+      <template #input>
153
+        <Picker
154
+          :options="purposeOptions"
155
+          v-model="formData.purpose"
156
+          placeholder="请选择"
157
+        />
158
+      </template>
159
+    </van-field>
160
+
161
+    <van-field name="mortgage" label="抵押信息">
162
+      <template #input>
163
+        <Picker
164
+          :options="mortgageOptions"
165
+          v-model="formData.isMortgage"
166
+          placeholder="请选择"
167
+        />
168
+      </template>
169
+    </van-field>
170
+
171
+    <van-field
172
+      v-model="formData.buildYear"
173
+      label="建筑年代"
174
+      placeholder="请输入"
175
+      type="number"
176
+    />
177
+
178
+    <van-field name="elevator" label="电梯">
179
+      <template #input>
180
+        <Picker
181
+          :options="elevatorOptions"
182
+          v-model="formData.elevator"
183
+          placeholder="请选择"
184
+        />
185
+      </template>
186
+    </van-field>
187
+
188
+    <van-field name="parking" label="车位">
189
+      <template #input>
190
+        <Picker
191
+          :options="parkingOptions"
192
+          v-model="formData.parking"
193
+          placeholder="请选择"
194
+        />
195
+      </template>
196
+    </van-field>
197
+
198
+    <van-field name="basement" label="地下室">
199
+      <template #input>
200
+        <Picker
201
+          :options="basementOptions"
202
+          v-model="formData.basement"
203
+          placeholder="请选择"
204
+        />
205
+      </template>
206
+    </van-field>
207
+
208
+    <van-field
209
+      v-model="formData.propertyFee"
210
+      name="propertyFee"
211
+      label="面积"
212
+      placeholder="请输入"
213
+      type="number"
214
+    >
215
+      <template #extra> 元/月/平 </template>
216
+    </van-field>
217
+
218
+    <van-field name="gas" label="燃气">
219
+      <template #input>
220
+        <Picker
221
+          :options="gasOptions"
222
+          v-model="formData.gas"
223
+          placeholder="请选择"
224
+        />
225
+      </template>
226
+    </van-field>
227
+
228
+    <van-field name="electricEquipment" label="家电">
229
+      <template #input>
230
+        <Picker
231
+          :options="electricEquipmentOptions"
232
+          v-model="formData.electricEquipment"
233
+          placeholder="请选择"
234
+        />
235
+      </template>
236
+    </van-field>
237
+
238
+    <van-field name="separate" label="隔断">
239
+      <template #input>
240
+        <Picker
241
+          :options="separateOptions"
242
+          v-model="formData.separate"
243
+          placeholder="请选择"
244
+        />
245
+      </template>
246
+    </van-field>
247
+
248
+    <van-field
249
+      v-model="formData.specialDesc"
250
+      label="优势推荐"
251
+      placeholder="请输入"
252
+      rows="3"
253
+      type="textarea"
254
+    />
255
+
256
+    <div style="margin: 1em">
257
+      <van-button block type="warning" native-type="submit"> 提交 </van-button>
258
+    </div>
259
+  </van-form>
260
+</template>
261
+
262
+<script>
263
+import { reactive, computed, watch } from "vue"
264
+import { Form, Field, Button } from "vant"
265
+import { useModel } from "@zjxpcyc/vue-tiny-store"
266
+import Picker from "@/components/Picker"
267
+import { showWarn } from "@/utils"
268
+import RoomType from "./RoomType"
269
+import Proportion from "./Proportion"
270
+
271
+export default {
272
+  components: {
273
+    [Form.name]: Form,
274
+    [Field.name]: Field,
275
+    [Button.name]: Button,
276
+    RoomType,
277
+    Proportion,
278
+    Picker,
279
+  },
280
+  emits: ["submit"],
281
+  setup(props, { emit }) {
282
+    const formData = reactive({})
283
+    const { dicts, getDict } = useModel("dicts")
284
+    const { detail } = useModel("renting")
285
+
286
+    // 装修
287
+    const decorationOptions = computed(() => {
288
+      const decorationDict = dicts.decoration || []
289
+      if (!decorationDict.length) {
290
+        getDict("decoration")
291
+      }
292
+
293
+      return decorationDict
294
+    })
295
+
296
+    // 朝向
297
+    const aspectOptions = computed(() => {
298
+      const aspectDict = dicts.aspect || []
299
+      if (!aspectDict.length) {
300
+        getDict("aspect")
301
+      }
302
+
303
+      return aspectDict
304
+    })
305
+
306
+    // 房源来源
307
+    const sourceFromOptions = computed(() => {
308
+      const sourceFromDict = dicts.sourceFrom || []
309
+      if (!sourceFromDict.length) {
310
+        getDict("sourceFrom")
311
+      }
312
+
313
+      return sourceFromDict
314
+    })
315
+
316
+    // 建筑类型
317
+    const buildTypeOptions = computed(() => {
318
+      const buildTypeDict = dicts["build_type"] || []
319
+      if (!buildTypeDict.length) {
320
+        getDict("build_type")
321
+      }
322
+
323
+      return buildTypeDict
324
+    })
325
+
326
+    // 电梯
327
+    const elevatorOptions = dicts.elevator
328
+
329
+    //出租方式
330
+    const leaseWayOptions = dicts.leaseWay
331
+
332
+    // 交易属性
333
+    const natureOptions = computed(() => {
334
+      const natureDict = dicts.nature || []
335
+      if (!natureDict.length) {
336
+        getDict("nature")
337
+      }
338
+
339
+      return natureDict
340
+    })
341
+
342
+    // 房屋用途
343
+    const purposeOptions = computed(() => {
344
+      const purposeDict = dicts.purpose || []
345
+      if (!purposeDict.length) {
346
+        getDict("purpose")
347
+      }
348
+
349
+      return purposeDict
350
+    })
351
+
352
+    // 抵押信息
353
+    const mortgageOptions = computed(() => {
354
+      const mortgageDict = dicts.mortgage || []
355
+      if (!mortgageDict.length) {
356
+        getDict("mortgage")
357
+      }
358
+
359
+      return mortgageDict
360
+    })
361
+
362
+    // 税费
363
+    const buildTimeOptions = computed(() => {
364
+      const buildTimeDict = dicts["build_time"] || []
365
+      if (!buildTimeDict.length) {
366
+        getDict("build_time")
367
+      }
368
+
369
+      return buildTimeDict
370
+    })
371
+
372
+    // 付款方式
373
+    const payWayOptions = computed(() => {
374
+      const payWayDict = dicts["payWay"] || []
375
+      if (!payWayDict.length) {
376
+        getDict("payWay")
377
+      }
378
+
379
+      return payWayDict
380
+    })
381
+
382
+    // 居住现状
383
+    const liveStatusOptions = computed(() => {
384
+      const liveStatusDict = dicts["liveStatus"] || []
385
+      if (!liveStatusDict.length) {
386
+        getDict("liveStatus")
387
+      }
388
+
389
+      return liveStatusDict
390
+    })
391
+
392
+    //性别限制
393
+    const limitSexOptions = computed(() => {
394
+      const limitSexDict = dicts["limitSex"] || []
395
+      if (!limitSexDict.length) {
396
+        getDict("limitSex")
397
+      }
398
+
399
+      return limitSexDict
400
+    })
401
+
402
+    //房屋特色
403
+    const roomSpecialOptions = computed(() => {
404
+      const roomSpecialDict = dicts["roomSpecial"] || []
405
+      if (!roomSpecialDict.length) {
406
+        getDict("roomSpecial")
407
+      }
408
+
409
+      return roomSpecialDict
410
+    })
411
+
412
+    //车位
413
+    const parkingOptions = computed(() => {
414
+      const parkingDict = dicts["parking"] || []
415
+      if (!parkingDict.length) {
416
+        getDict("parking")
417
+      }
418
+
419
+      return parkingDict
420
+    })
421
+
422
+    //地下室
423
+    const basementOptions = computed(() => {
424
+      const basementDict = dicts["basement"] || []
425
+      if (!basementDict.length) {
426
+        getDict("basement")
427
+      }
428
+
429
+      return basementDict
430
+    })
431
+
432
+    //燃气
433
+    const gasOptions = computed(() => {
434
+      const gasDict = dicts["gas"] || []
435
+      if (!gasDict.length) {
436
+        getDict("gas")
437
+      }
438
+
439
+      return gasDict
440
+    })
441
+
442
+    //家电
443
+    const electricEquipmentOptions = computed(() => {
444
+      const electricEquipmentDict = dicts["electricEquipment"] || []
445
+      if (!electricEquipmentDict.length) {
446
+        getDict("electricEquipment")
447
+      }
448
+
449
+      return electricEquipmentDict
450
+    })
451
+
452
+    //隔断
453
+    const separateOptions = computed(() => {
454
+      const separateDict = dicts["separate"] || []
455
+      if (!separateDict.length) {
456
+        getDict("separate")
457
+      }
458
+
459
+      return separateDict
460
+    })
461
+
462
+    const validManually = () => {
463
+      // if (
464
+      //   !formData.roomType ||
465
+      //   formData.roomType.split(",").filter(Boolean).length != 5
466
+      // ) {
467
+      //   showWarn("请正确设置户型")
468
+      //   return false
469
+      // }
470
+      // if (!formData.decoration) {
471
+      //   showWarn("请选择装修")
472
+      //   return false
473
+      // }
474
+      // if (!formData.aspect) {
475
+      //   showWarn("请选择朝向")
476
+      //   return false
477
+      // }
478
+      // if (!formData.sourceFrom) {
479
+      //   showWarn("请选择房源来源")
480
+      //   return false
481
+      // }
482
+
483
+      return true
484
+    }
485
+
486
+    // 提交
487
+    const handleSumbit = () => {
488
+      console.log(formData)
489
+      if (!validManually()) {
490
+        return
491
+      }
492
+      console.log(formData, "console.log(formData)")
493
+      emit("submit", formData)
494
+    }
495
+
496
+    //
497
+    watch(
498
+      () => detail.roomInfo,
499
+      (nw, od) => {
500
+        if (nw && !od) {
501
+          Object.assign(formData, { ...nw })
502
+        }
503
+      },
504
+      { immediate: true }
505
+    )
506
+
507
+    return {
508
+      formData,
509
+      handleSumbit,
510
+      decorationOptions,
511
+      aspectOptions,
512
+      sourceFromOptions,
513
+      buildTypeOptions,
514
+      elevatorOptions,
515
+      natureOptions,
516
+      purposeOptions,
517
+      mortgageOptions,
518
+      buildTimeOptions,
519
+      leaseWayOptions,
520
+      payWayOptions,
521
+      liveStatusOptions,
522
+      limitSexOptions,
523
+      roomSpecialOptions,
524
+      parkingOptions,
525
+      basementOptions,
526
+      gasOptions,
527
+      electricEquipmentOptions,
528
+      separateOptions,
529
+    }
530
+  },
531
+}
532
+</script>

+ 66
- 0
src/view/renting/edithouse/components/Proportion.vue 查看文件

@@ -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/renting/edithouse/components/RoomType.vue 查看文件

@@ -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>

+ 41
- 244
src/view/renting/edithouse/index.vue 查看文件

@@ -1,263 +1,60 @@
1 1
 <template>
2
-  <div class="secondhanddetail">
3
-    <div class="detailcard van-hairline--bottom">
4
-      <div class="detailcard-title">
5
-        <span>编辑房源信息</span>
6
-      </div>
7
-      <Contextc :options="baseInformationOptions"></Contextc>
8
-    </div>
9
-
10
-    <div>
11
-      <van-form @submit="onSubmit">
12
-        <van-field
13
-          v-model="state.username"
14
-          name="title"
15
-          label="标题"
16
-          placeholder="请输入"
17
-          required
18
-          :rules="[{ required: true, message: '请填写标题' }]"
19
-        />
20
-        <van-field
21
-          v-model="state.username"
22
-          name="aaaa"
23
-          label="面积"
24
-          placeholder="请输入"
25
-          required
26
-          type="number"
27
-          :rules="[{ required: true, message: '请填写面积' }]"
28
-        >
29
-          <template #extra> ㎡ </template>
30
-        </van-field>
31
-        <van-field
32
-          v-model="state.username"
33
-          name="3333"
34
-          label="出租方式"
35
-          placeholder="请输入"
36
-          type="number"
37
-          :rules="[{ required: true, message: '请填写出租方式' }]"
38
-        />
39
-        <van-field
40
-          v-model="state.username"
41
-          name="aaaa"
42
-          label="租金"
43
-          placeholder="请输入"
44
-          required
45
-          type="number"
46
-          :rules="[{ required: true, message: '请填写租金' }]"
47
-        >
48
-          <template #extra> 元/月 </template>
49
-        </van-field>
50
-        <Pickerc
51
-          v-model="state.username"
52
-          name="title"
53
-          label="装修"
54
-          required
55
-        ></Pickerc>
56
-
57
-        <Pickerc
58
-          v-model="state.username"
59
-          name="title"
60
-          label="朝向"
61
-          required
62
-        ></Pickerc>
63
-
64
-        <van-field
65
-          v-model="state.username"
66
-          name="title"
67
-          label="户型"
68
-          placeholder="请输入"
69
-          required
70
-          :rules="[{ required: true, message: '请填写楼户比例' }]"
71
-        />
72
-
73
-        <Pickerc
74
-          v-model="state.username"
75
-          name="title"
76
-          label="房源来源"
77
-          required
78
-        ></Pickerc>
79
-
80
-        <Pickerc
81
-          v-model="state.username"
82
-          name="title"
83
-          label="付款方式"
84
-        ></Pickerc>
85
-
86
-        <Pickerc
87
-          v-model="state.username"
88
-          name="title"
89
-          label="居住现状"
90
-        ></Pickerc>
91
-
92
-        <Pickerc v-model="state.username" name="title" label="卧室"></Pickerc>
93
-
94
-        <Pickerc
95
-          v-model="state.username"
96
-          name="title"
97
-          label="性别限制"
98
-        ></Pickerc>
99
-
100
-        <Pickerc
101
-          v-model="state.username"
102
-          name="title"
103
-          label="房屋特色"
104
-        ></Pickerc>
105
-
106
-        <van-field
107
-          v-model="state.username"
108
-          name="title"
109
-          label="楼户比例"
110
-          placeholder="请输入"
111
-          required
112
-          :rules="[{ required: true, message: '请填写楼户比例' }]"
113
-        />
114
-        <Pickerc
115
-          v-model="state.username"
116
-          name="title"
117
-          label="建筑类型"
118
-        ></Pickerc>
119
-
120
-        <Pickerc
121
-          v-model="state.username"
122
-          name="title"
123
-          label="房屋用途"
124
-        ></Pickerc>
125
-        <van-field
126
-          v-model="state.username"
127
-          name="title"
128
-          label="建成年代"
129
-          placeholder="请输入"
130
-          :rules="[{ required: true, message: '请填写楼户比例' }]"
131
-        />
132
-
133
-        <Pickerc v-model="state.username" name="title" label="电梯"></Pickerc>
134
-        <Pickerc v-model="state.username" name="title" label="车位"></Pickerc>
135
-
136
-        <Pickerc v-model="state.username" name="title" label="地下室"></Pickerc>
137
-
138
-        <van-field
139
-          v-model="state.username"
140
-          name="aaaa"
141
-          label="物业费"
142
-          placeholder="请输入"
143
-          type="number"
144
-        >
145
-          <template #extra> 元/月/平 </template>
146
-        </van-field>
2
+  <x-loading x-id="rent.view">
3
+    <div class="secondhanddetail">
4
+      <RoomBasic :room-info="detail.roomInfo" :building="detail.building" />
147 5
 
148
-        <Pickerc v-model="state.username" name="title" label="燃气"></Pickerc>
149
-
150
-        <Pickerc v-model="state.username" name="title" label="家电"></Pickerc>
151
-
152
-        <van-field
153
-          v-model="state.username"
154
-          name="aaaa1"
155
-          label="物业推荐"
156
-          placeholder="请输入"
157
-          type="textarea"
158
-        >
159
-        </van-field>
160
-
161
-        <div style="margin: 16px">
162
-          <van-button round block type="primary" native-type="submit">
163
-            提交
164
-          </van-button>
165
-        </div>
166
-      </van-form>
6
+      <div style="margin-top: 1em">
7
+        <RoomForm @submit="handleSumbit" />
8
+      </div>
167 9
     </div>
168
-  </div>
10
+  </x-loading>
169 11
 </template>
170 12
 
171 13
 <script>
172
-import { reactive } from "vue"
173
-
174
-import {
175
-  Icon,
176
-  Popover,
177
-  Row,
178
-  Col,
179
-  Button,
180
-  steps,
181
-  step,
182
-  //   Dialog,
183
-  Form,
184
-  Field,
185
-} from "vant"
186
-import Contextc from "../../../components/contextC"
187
-import { Pickerc } from "../../../components/editCompents"
188
-
189
-// import { router } from "../../../router";
14
+import { watch } from "vue"
15
+import { useModel } from "@zjxpcyc/vue-tiny-store"
16
+import { useRoute, useRouter } from "vue-router"
17
+import { alert, showDanger } from "@/utils"
18
+import RoomBasic from "./components/Basic"
19
+import RoomForm from "./components/Form"
190 20
 
191 21
 export default {
192 22
   name: "secondhanddetail",
193 23
   components: {
194
-    [Row.name]: Row,
195
-    [Col.name]: Col,
196
-    [Popover.name]: Popover,
197
-    [Icon.name]: Icon,
198
-    [Button.name]: Button,
199
-    [steps.name]: steps,
200
-    [step.name]: step,
201
-    [Form.name]: Form,
202
-    [Field.name]: Field,
203
-    Pickerc: Pickerc,
204
-    Contextc: Contextc,
205
-  },
206
-  data() {
207
-    return {}
24
+    RoomBasic,
25
+    RoomForm,
208 26
   },
209 27
 
210 28
   setup() {
211
-    const state = reactive({
212
-      username: "",
213
-      password: "",
214
-    })
215
-
216
-    // 房源信息
217
-    const baseInformationOptions = [
218
-      {
219
-        name: "房源编号",
220
-        value: "123",
29
+    const route = useRoute()
30
+    const router = useRouter()
31
+    const { detail, getDetail, houseEdit } = useModel("renting")
32
+
33
+    watch(
34
+      () => route.query.roomId,
35
+      (nw, od) => {
36
+        if (nw != od && nw) {
37
+          getDetail(nw)
38
+        }
221 39
       },
222
-      {
223
-        name: "楼盘名称",
224
-        value: "123",
225
-      },
226
-      {
227
-        name: "楼盘地址",
228
-        value: "123",
229
-        span: 24,
230
-      },
231
-      {
232
-        name: "栋号",
233
-        value: "123",
234
-        required: true,
235
-      },
236
-      {
237
-        name: "单元",
238
-        value: "123",
239
-        required: true,
240
-      },
241
-      {
242
-        name: "楼层",
243
-        value: "123",
244
-        required: true,
245
-      },
246
-      {
247
-        name: "房号",
248
-        value: "123",
249
-        required: true,
250
-      },
251
-    ]
252
-
253
-    const onSubmit = (values) => {
254
-      console.log("submit", values)
40
+      { immediate: true }
41
+    )
42
+
43
+    const handleSumbit = (values) => {
44
+      houseEdit(values)
45
+        .then(() => {
46
+          alert("编辑成功").then(() => {
47
+            router.go(-1)
48
+          })
49
+        })
50
+        .catch((e) => {
51
+          showDanger(e.message)
52
+        })
255 53
     }
256 54
 
257 55
     return {
258
-      state,
259
-      onSubmit,
260
-      baseInformationOptions,
56
+      handleSumbit,
57
+      detail,
261 58
     }
262 59
   },
263 60
 }
@@ -266,7 +63,7 @@ export default {
266 63
 <!-- Add "scoped" attribute to limit CSS to this component only -->
267 64
 <style lang="less" scoped>
268 65
 .secondhanddetail {
269
-  text-align: left;
66
+  // padding: 1em;
270 67
 }
271 68
 .secondhand-main::-webkit-scrollbar {
272 69
   display: none; /*隐藏滚动条*/

+ 2
- 2
src/view/resc/index.vue 查看文件

@@ -135,7 +135,7 @@ export default {
135 135
     const route = useRoute()
136 136
     const router = useRouter()
137 137
     const willSave = ref([])
138
-
138
+    const type = router.currentRoute.value.query.type
139 139
     const {
140 140
       detail,
141 141
       getRescList,
@@ -143,7 +143,7 @@ export default {
143 143
       setRescCover,
144 144
       saveResc,
145 145
       deleteResc,
146
-    } = useModel("room")
146
+    } = useModel(type === "room" ? "room" : "renting")
147 147
 
148 148
     const roomId = route.query.roomId - 0
149 149
 

+ 6
- 3
src/view/secondhand/detail/components/MoreActions.vue 查看文件

@@ -38,7 +38,7 @@
38 38
           @click="
39 39
             $router.push({
40 40
               name: 'house.close',
41
-              query: { roomId: roomInfo.id },
41
+              query: { roomId: roomInfo.id, type: 'room' },
42 42
             })
43 43
           "
44 44
         />
@@ -51,7 +51,7 @@
51 51
           @click="
52 52
             $router.push({
53 53
               name: 'secondhand.edit',
54
-              query: { roomId: roomInfo.id },
54
+              query: { roomId: roomInfo.id, type: 'room' },
55 55
             })
56 56
           "
57 57
         />
@@ -61,7 +61,10 @@
61 61
           title="房源实勘"
62 62
           icon="photograph"
63 63
           @click="
64
-            $router.push({ name: 'resc', query: { roomId: roomInfo.id } })
64
+            $router.push({
65
+              name: 'resc',
66
+              query: { roomId: roomInfo.id, type: 'room' },
67
+            })
65 68
           "
66 69
         />
67 70