修改物业管理部分关于小区的逻辑
This commit is contained in:
parent
7d1aa498b4
commit
49120a2e1f
@ -1,4 +1,4 @@
|
|||||||
m<template>
|
<template>
|
||||||
<view class="group-purchase-container">
|
<view class="group-purchase-container">
|
||||||
<!-- 顶部横幅 -->
|
<!-- 顶部横幅 -->
|
||||||
<view class="banner">
|
<view class="banner">
|
||||||
|
|||||||
@ -39,22 +39,43 @@ import { apiArr } from "../../../api/community";
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
communityVal: "添加我的房产",
|
communityVal: "切换小区",
|
||||||
showWorkOrderSection: false
|
showWorkOrderSection: false,
|
||||||
|
communityList: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
async onLoad() {
|
||||||
const workOrderPermission = uni.getStorageSync('work_order_permission');
|
const workOrderPermission = uni.getStorageSync('work_order_permission');
|
||||||
const orderDispatchPermission = uni.getStorageSync('order_dispatch_permission');
|
const orderDispatchPermission = uni.getStorageSync('order_dispatch_permission');
|
||||||
this.showWorkOrderSection = !(workOrderPermission === false && orderDispatchPermission === false);
|
this.showWorkOrderSection = !(workOrderPermission === false && orderDispatchPermission === false);
|
||||||
|
|
||||||
|
// 获取小区列表并设置默认选中第一个
|
||||||
|
await request(apiArr.workCommunityList, "POST", {
|
||||||
|
user_id: uni.getStorageSync('userId'),
|
||||||
|
}).then(res => {
|
||||||
|
res.rows.forEach(item => {
|
||||||
|
item.pic = item.pic.startsWith('http') ? item.pic : picUrl + item.pic
|
||||||
|
});
|
||||||
|
this.communityList = res.rows;
|
||||||
|
|
||||||
|
// 如果没有选中的小区且有小区列表,则默认选中第一个
|
||||||
|
if (!uni.getStorageSync('changeWorkOrderData') && res.rows.length > 0) {
|
||||||
|
uni.setStorageSync('changeWorkOrderData', { id: res.rows[0].community_id, name: res.rows[0].name });
|
||||||
|
this.communityVal = res.rows[0].name;
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
async onShow() {
|
async onShow() {
|
||||||
this.communityVal = uni.getStorageSync('changeCommData').name;
|
const changeCommData = uni.getStorageSync('changeWorkOrderData');
|
||||||
const params = {
|
this.communityVal = changeCommData ? changeCommData.name : "切换小区";
|
||||||
community_id: uni.getStorageSync('changeCommData').id,
|
|
||||||
|
if (changeCommData) {
|
||||||
|
const params = {
|
||||||
|
community_id: changeCommData.id,
|
||||||
|
}
|
||||||
|
const res = await request(apiArr.communityInfo, "POST", params);
|
||||||
|
uni.setStorageSync('allow_grab_order', res.allow_grab_order == 1 ? true : false);
|
||||||
}
|
}
|
||||||
const res = await request(apiArr.communityInfo, "POST", params);
|
|
||||||
uni.setStorageSync('allow_grab_order', res.allow_grab_order == 1 ? true : false);
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
addCommunity() {
|
addCommunity() {
|
||||||
@ -63,8 +84,17 @@ export default {
|
|||||||
|
|
||||||
// 跳转到工单台
|
// 跳转到工单台
|
||||||
navigateToWorkOrderDashboard() {
|
navigateToWorkOrderDashboard() {
|
||||||
|
const changeCommData = uni.getStorageSync('changeWorkOrderData');
|
||||||
|
if (!changeCommData) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先选择小区',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/packages/workOrderDashboard/index/index?communityId=' + uni.getStorageSync('changeCommData').id
|
url: '/packages/workOrderDashboard/index/index?communityId=' + changeCommData.id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,24 +65,19 @@ export default {
|
|||||||
this.communityList = res.rows
|
this.communityList = res.rows
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// toUpview(item) {
|
|
||||||
// uni.setStorageSync('changeCommData', { id: item.community_id, name: item.name });
|
|
||||||
// NavgateTo("/packages/community/index/index")
|
|
||||||
// },
|
|
||||||
|
|
||||||
choseCommunity(e) {
|
choseCommunity(e) {
|
||||||
this.currentCommunity = e
|
this.currentCommunity = e
|
||||||
uni.setStorageSync('changeCommData', { id: e.community_id, name: e.name });
|
uni.setStorageSync('changeWorkOrderData', { id: e.community_id, name: e.name });
|
||||||
uni.setStorageSync('currentCommunityAddr',e.addr);
|
uni.setStorageSync('currentCommunityAddr',e.addr);
|
||||||
NavgateTo("1")
|
NavgateTo("1")
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.currentCommunity = uni.getStorageSync('changeCommData')
|
this.currentCommunity = uni.getStorageSync('changeWorkOrderData')
|
||||||
console.log(this.currentCommunity, 'currentCommunity');
|
console.log(this.currentCommunity, 'currentCommunity');
|
||||||
this.getList();
|
this.getList();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onReachBottom() { },
|
onReachBottom() { },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user