修改物业管理部分关于小区的逻辑
This commit is contained in:
parent
7d1aa498b4
commit
49120a2e1f
@ -1,4 +1,4 @@
|
||||
m<template>
|
||||
<template>
|
||||
<view class="group-purchase-container">
|
||||
<!-- 顶部横幅 -->
|
||||
<view class="banner">
|
||||
|
||||
@ -39,22 +39,43 @@ import { apiArr } from "../../../api/community";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
communityVal: "添加我的房产",
|
||||
showWorkOrderSection: false
|
||||
communityVal: "切换小区",
|
||||
showWorkOrderSection: false,
|
||||
communityList: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
async onLoad() {
|
||||
const workOrderPermission = uni.getStorageSync('work_order_permission');
|
||||
const orderDispatchPermission = uni.getStorageSync('order_dispatch_permission');
|
||||
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() {
|
||||
this.communityVal = uni.getStorageSync('changeCommData').name;
|
||||
const changeCommData = uni.getStorageSync('changeWorkOrderData');
|
||||
this.communityVal = changeCommData ? changeCommData.name : "切换小区";
|
||||
|
||||
if (changeCommData) {
|
||||
const params = {
|
||||
community_id: uni.getStorageSync('changeCommData').id,
|
||||
community_id: changeCommData.id,
|
||||
}
|
||||
const res = await request(apiArr.communityInfo, "POST", params);
|
||||
uni.setStorageSync('allow_grab_order', res.allow_grab_order == 1 ? true : false);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addCommunity() {
|
||||
@ -63,8 +84,17 @@ export default {
|
||||
|
||||
// 跳转到工单台
|
||||
navigateToWorkOrderDashboard() {
|
||||
const changeCommData = uni.getStorageSync('changeWorkOrderData');
|
||||
if (!changeCommData) {
|
||||
uni.showToast({
|
||||
title: '请先选择小区',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
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
|
||||
})
|
||||
},
|
||||
// toUpview(item) {
|
||||
// uni.setStorageSync('changeCommData', { id: item.community_id, name: item.name });
|
||||
// NavgateTo("/packages/community/index/index")
|
||||
// },
|
||||
|
||||
choseCommunity(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);
|
||||
NavgateTo("1")
|
||||
},
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.currentCommunity = uni.getStorageSync('changeCommData')
|
||||
this.currentCommunity = uni.getStorageSync('changeWorkOrderData')
|
||||
console.log(this.currentCommunity, 'currentCommunity');
|
||||
this.getList();
|
||||
|
||||
},
|
||||
|
||||
onReachBottom() { },
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user