index.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. // components/custom-tab-bar/index.js
  2. Component({
  3. data: {
  4. selected: null,//null
  5. color: "#000000",
  6. roleId: '',
  7. selectedColor: "#4B70EA",
  8. allList: [{
  9. list1: [{ //driver
  10. "pagePath": "/pages/index/index",
  11. "iconPath": "gonghuiyuyue-wodeyuyuelan",
  12. "selectedIconPath": "yuyue1",
  13. "text": "扫码预约"
  14. },{
  15. "pagePath": "/pages/weighingRecord/index",
  16. "iconPath": "jiluliebiao",
  17. "selectedIconPath": "jilu1",
  18. "text": "过磅记录"
  19. },{
  20. "pagePath": "/pages/mine/index",
  21. "iconPath": "wode2",
  22. "selectedIconPath": "wode-active",
  23. "text": "我的"
  24. }],
  25. list2: [{ //bizAdmin
  26. "pagePath": "/pages/queueCar/index",
  27. "iconPath": "paiduiguanli",
  28. "selectedIconPath": "paiduiquhao",
  29. "text": "排队车辆"
  30. },{
  31. "pagePath": "/pages/salesOrderMan/index",
  32. "iconPath": "yundans",
  33. "selectedIconPath": "yundans-fill",
  34. "text": "物流订单"
  35. },{
  36. "pagePath": "/pages/reservationMan/index",
  37. "iconPath": "gonghuiyuyue-wodeyuyuelan",
  38. "selectedIconPath": "yuyue1",
  39. "text": "预约管理"
  40. },{
  41. "pagePath": "/pages/weighingRecord/index",
  42. "iconPath": "jiluliebiao",
  43. "selectedIconPath": "jilu1",
  44. "text": "过磅记录"
  45. },{
  46. "pagePath": "/pages/mine/index",
  47. "iconPath": "wode2",
  48. "selectedIconPath": "wode-active",
  49. "text": "我的"
  50. }],
  51. list3: [{ //send
  52. "pagePath": "/pages/deliveryConfirm/index",
  53. "iconPath": "truck_line",
  54. "selectedIconPath": "truck_fill",
  55. "text": "发货确认"
  56. },{
  57. "pagePath": "/pages/mine/index",
  58. "iconPath": "wode2",
  59. "selectedIconPath": "wode-active",
  60. "text": "我的"
  61. }],
  62. list4: [{ //sale
  63. "pagePath": "/pages/salesOrderMan/index",
  64. "iconPath": "yundans",
  65. "selectedIconPath": "yundans-fill",
  66. "text": "物流订单"
  67. },{
  68. "pagePath": "/pages/signReview/index",
  69. "iconPath": "qianshoushenpitongguo-xianxing",
  70. "selectedIconPath": "qianshoushenpitongguo",
  71. "text": "签收审核"
  72. },{
  73. "pagePath": "/pages/mine/index",
  74. "iconPath": "wode2",
  75. "selectedIconPath": "wode-active",
  76. "text": "我的"
  77. }],
  78. list5: [{ //customer
  79. "pagePath": "/pages/index/index",
  80. "iconPath": "gonghuiyuyue-wodeyuyuelan",
  81. "selectedIconPath": "yuyue1",
  82. "text": "扫码预约"
  83. },{
  84. "pagePath": "/pages/salesOrderMan/index",
  85. "iconPath": "yundans",
  86. "selectedIconPath": "yundans-fill",
  87. "text": "物流订单"
  88. },{
  89. "pagePath": "/pages/mine/index",
  90. "iconPath": "wode2",
  91. "selectedIconPath": "wode-active",
  92. "text": "我的"
  93. }],
  94. list6: [{ //ship
  95. "pagePath": "/pages/index/index",
  96. "iconPath": "gonghuiyuyue-wodeyuyuelan",
  97. "selectedIconPath": "yuyue1",
  98. "text": "扫码预约"
  99. },{
  100. "pagePath": "/pages/salesOrderMan/index",
  101. "iconPath": "yundans",
  102. "selectedIconPath": "yundans-fill",
  103. "text": "物流订单"
  104. },{
  105. "pagePath": "/otherPages/loadArrive/index",
  106. "iconPath": "loadArrive",
  107. "selectedIconPath": "yundans-fill",
  108. "text": "报港预约"
  109. },{
  110. "pagePath": "/pages/mine/index",
  111. "iconPath": "wode2",
  112. "selectedIconPath": "wode-active",
  113. "text": "我的"
  114. }],
  115. }],
  116. list: []
  117. },
  118. attached() {
  119. const roleCodeList = wx.getStorageSync('roleCodeList')
  120. //角色编码: 业务管理员:bizAdmin 司机:driver 客户:customer 发货:send 销售:sale roleCodeList.includes('send')
  121. if (roleCodeList=='bizAdmin') {
  122. this.setData({
  123. list: this.data.allList[0].list2
  124. })
  125. } else if (roleCodeList=='send') {
  126. this.setData({
  127. list: this.data.allList[0].list3
  128. })
  129. } else if (roleCodeList=='sale') {
  130. this.setData({
  131. list: this.data.allList[0].list4
  132. })
  133. } else if (roleCodeList=='customer') {
  134. this.setData({
  135. list: this.data.allList[0].list5
  136. })
  137. } else if (roleCodeList=='ship') {
  138. this.setData({
  139. list: this.data.allList[0].list6
  140. })
  141. } else if (roleCodeList=='driver'||roleCodeList==''){
  142. this.setData({
  143. list: this.data.allList[0].list1
  144. })
  145. }
  146. //替代switchTab里的setData,解决闪烁问题
  147. // let pages = getCurrentPages()
  148. // let page = pages[0].route,curSelect = 0
  149. // if (page == 'pages/index/index') {
  150. // curSelect = 0
  151. // }else if (page == 'pages/weighingRecord/list') {
  152. // curSelect = 1
  153. // }else if(page == 'pages/mine/index'){
  154. // if (roleCodeList == '1') {
  155. // curSelect = 2
  156. // }else{
  157. // curSelect = 1
  158. // }
  159. // }
  160. // this.setData({
  161. // selected:curSelect
  162. // })
  163. },
  164. methods: {
  165. switchTab(e) {
  166. const data = e.currentTarget.dataset
  167. const url = data.path
  168. wx.switchTab({
  169. url
  170. })
  171. this.setData({
  172. selected: data.index
  173. })
  174. }
  175. },
  176. })