|
|
@ -68,6 +68,7 @@ Page({ |
|
|
sidebarBtnTop: 500, |
|
|
sidebarBtnTop: 500, |
|
|
sidebarBtnHidden: false, |
|
|
sidebarBtnHidden: false, |
|
|
isPageHidden: false, |
|
|
isPageHidden: false, |
|
|
|
|
|
hasGoodsManagePermission: false, |
|
|
|
|
|
|
|
|
// 搜索区域相关
|
|
|
// 搜索区域相关
|
|
|
searchSectionVisible: true, |
|
|
searchSectionVisible: true, |
|
|
@ -176,8 +177,47 @@ Page({ |
|
|
if (this.data.isDragging) { |
|
|
if (this.data.isDragging) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const newShowSidebar = !this.data.showSidebar; |
|
|
|
|
|
|
|
|
|
|
|
if (newShowSidebar) { |
|
|
|
|
|
this.checkGoodsManagePermission(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.setData({ |
|
|
this.setData({ |
|
|
showSidebar: !this.data.showSidebar |
|
|
showSidebar: newShowSidebar |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 检查用户是否有货源管理权限
|
|
|
|
|
|
checkGoodsManagePermission() { |
|
|
|
|
|
const users = wx.getStorageSync('users') || {}; |
|
|
|
|
|
const userId = wx.getStorageSync('userId'); |
|
|
|
|
|
let userPhone = null; |
|
|
|
|
|
|
|
|
|
|
|
if (userId && users[userId] && users[userId].phoneNumber) { |
|
|
|
|
|
userPhone = users[userId].phoneNumber; |
|
|
|
|
|
} else { |
|
|
|
|
|
const userInfo = wx.getStorageSync('userInfo'); |
|
|
|
|
|
if (userInfo && userInfo.phoneNumber) { |
|
|
|
|
|
userPhone = userInfo.phoneNumber; |
|
|
|
|
|
} else { |
|
|
|
|
|
userPhone = wx.getStorageSync('phoneNumber'); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!userPhone) { |
|
|
|
|
|
console.log('用户未绑定手机号,无货源管理权限'); |
|
|
|
|
|
this.setData({ hasGoodsManagePermission: false }); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
API.checkPersonnelByPhone(userPhone).then(res => { |
|
|
|
|
|
console.log('货源管理权限检查结果:', res); |
|
|
|
|
|
this.setData({ hasGoodsManagePermission: res.exists }); |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.error('检查货源管理权限失败:', err); |
|
|
|
|
|
this.setData({ hasGoodsManagePermission: false }); |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|