Browse Source

feat(market): 根据用户角色动态显示客户列表

- 添加 getUserInfo 方法获取用户信息
- 根据用户角色(是否为经理)动态显示"区域公海"选项
- 优化初始化逻辑,先获取用户信息再决定是否显示"区域公海"
master
liutong 11 months ago
parent
commit
52d376031d
  1. 63
      pages/market/clue/index.vue

63
pages/market/clue/index.vue

@ -136,6 +136,7 @@
<script> <script>
import AQTabber from "@/components/AQ/AQTabber.vue" import AQTabber from "@/components/AQ/AQTabber.vue"
import apiRoute from '@/api/apiRoute.js';
import marketApi from '@/api/market.js'; import marketApi from '@/api/market.js';
export default { export default {
@ -168,21 +169,26 @@ export default {
},// },//
tableList:[],// tableList:[],//
values: [{ values: [
id: 1, {
name: '我的客户' id: 1,
}, { name: '我的客户'
id: 2, },
name: '区域公海' // {
}], // id: 2,
// name: ''
// }
],
select_type: 1,//|1,2,3,4 select_type: 1,//|1,2,3,4
segmented_type: 1,//1=,2= segmented_type: 1,//1=,2=
userInfo:{},//
} }
}, },
onLoad(options) {}, onLoad(options) {},
onShow(){ onShow(){
// this.init()// this.init()//
}, },
// //
async onPullDownRefresh() { async onPullDownRefresh() {
@ -193,9 +199,48 @@ export default {
methods: { methods: {
// //
async init(){ async init(){
await this.getList(); await this.getUserInfo();
// await this.getList();
},
//
async getUserInfo(){
let res = await apiRoute.getPersonnelInfo({})
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.userInfo = res.data
//,""
if(this.userInfo.role_key_arr.includes('manager')){
this.values = [
{
id: 1,
name: '我的客户'
},
{
id: 2,
name: '区域公海'
}
]
}else{
this.values = [
{
id: 1,
name: '我的客户'
},
]
}
console.log('用户',this.userInfo)
}, },
//() //()
loadMoreData() { loadMoreData() {
// //

Loading…
Cancel
Save