123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- // components/custom-tab-bar/index.js
- Component({
- data: {
- selected: null,//null
- color: "#000000",
- roleId: '',
- selectedColor: "#4B70EA",
- allList: [{
- list1: [{ //driver
- "pagePath": "/pages/index/index",
- "iconPath": "gonghuiyuyue-wodeyuyuelan",
- "selectedIconPath": "yuyue1",
- "text": "扫码预约"
- },{
- "pagePath": "/pages/weighingRecord/index",
- "iconPath": "jiluliebiao",
- "selectedIconPath": "jilu1",
- "text": "过磅记录"
- },{
- "pagePath": "/pages/mine/index",
- "iconPath": "wode2",
- "selectedIconPath": "wode-active",
- "text": "我的"
- }],
- list2: [{ //bizAdmin
- "pagePath": "/pages/queueCar/index",
- "iconPath": "paiduiguanli",
- "selectedIconPath": "paiduiquhao",
- "text": "排队车辆"
- },{
- "pagePath": "/pages/salesOrderMan/index",
- "iconPath": "yundans",
- "selectedIconPath": "yundans-fill",
- "text": "物流订单"
- },{
- "pagePath": "/pages/reservationMan/index",
- "iconPath": "gonghuiyuyue-wodeyuyuelan",
- "selectedIconPath": "yuyue1",
- "text": "预约管理"
- },{
- "pagePath": "/pages/weighingRecord/index",
- "iconPath": "jiluliebiao",
- "selectedIconPath": "jilu1",
- "text": "过磅记录"
- },{
- "pagePath": "/pages/mine/index",
- "iconPath": "wode2",
- "selectedIconPath": "wode-active",
- "text": "我的"
- }],
- list3: [{ //send
- "pagePath": "/pages/deliveryConfirm/index",
- "iconPath": "truck_line",
- "selectedIconPath": "truck_fill",
- "text": "发货确认"
- },{
- "pagePath": "/pages/mine/index",
- "iconPath": "wode2",
- "selectedIconPath": "wode-active",
- "text": "我的"
- }],
- list4: [{ //sale
- "pagePath": "/pages/salesOrderMan/index",
- "iconPath": "yundans",
- "selectedIconPath": "yundans-fill",
- "text": "物流订单"
- },{
- "pagePath": "/pages/signReview/index",
- "iconPath": "qianshoushenpitongguo-xianxing",
- "selectedIconPath": "qianshoushenpitongguo",
- "text": "签收审核"
- },{
- "pagePath": "/pages/mine/index",
- "iconPath": "wode2",
- "selectedIconPath": "wode-active",
- "text": "我的"
- }],
- list5: [{ //customer
- "pagePath": "/pages/index/index",
- "iconPath": "gonghuiyuyue-wodeyuyuelan",
- "selectedIconPath": "yuyue1",
- "text": "扫码预约"
- },{
- "pagePath": "/pages/salesOrderMan/index",
- "iconPath": "yundans",
- "selectedIconPath": "yundans-fill",
- "text": "物流订单"
- },{
- "pagePath": "/pages/mine/index",
- "iconPath": "wode2",
- "selectedIconPath": "wode-active",
- "text": "我的"
- }],
- }],
- list: []
- },
- attached() {
- const roleCodeList = wx.getStorageSync('roleCodeList')
- //角色编码: 业务管理员:bizAdmin 司机:driver 客户:customer 发货:send 销售:sale roleCodeList.includes('send')
- if (roleCodeList=='bizAdmin') {
- this.setData({
- list: this.data.allList[0].list2
- })
- } else if (roleCodeList=='send') {
- this.setData({
- list: this.data.allList[0].list3
- })
- } else if (roleCodeList=='sale') {
- this.setData({
- list: this.data.allList[0].list4
- })
- } else if (roleCodeList=='customer') {
- this.setData({
- list: this.data.allList[0].list5
- })
- } else if (roleCodeList=='driver'||roleCodeList==''){
- this.setData({
- list: this.data.allList[0].list1
- })
- }
- //替代switchTab里的setData,解决闪烁问题
- // let pages = getCurrentPages()
- // let page = pages[0].route,curSelect = 0
- // if (page == 'pages/index/index') {
- // curSelect = 0
- // }else if (page == 'pages/weighingRecord/list') {
- // curSelect = 1
- // }else if(page == 'pages/mine/index'){
- // if (roleCodeList == '1') {
- // curSelect = 2
- // }else{
- // curSelect = 1
- // }
- // }
- // this.setData({
- // selected:curSelect
- // })
- },
- methods: {
- switchTab(e) {
- const data = e.currentTarget.dataset
- const url = data.path
- wx.switchTab({
- url
- })
- this.setData({
- selected: data.index
- })
- }
- },
- })
|