indexRouter.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <!-- 底部tab导航 -->
  3. <view>
  4. <Home :dataList="dataList" :genreTitle="genreTitle" ref="home" v-if="nowchos === 0"></Home>
  5. <!-- isorders == 0 同时userType == 3 送气员 -->
  6. <Order v-else-if="nowchos === 1 && isorders == 0 && userType == 3"></Order>
  7. <Information v-else-if="steelCylinder(isorders,userType)"></Information>
  8. <Mine :token="token" :userInfo="userInfo" v-else-if="getType(isorders,userType)"></Mine>
  9. <view class="bottomboxs">
  10. <x-navbottom :nowchos='nowchos' @botomchos='botomchos'></x-navbottom>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. import Home from './home/index.vue' // 引入首页
  16. import Order from './order/index.vue' // 引入收益首页
  17. import Information from './information/index.vue' // 记录
  18. import Mine from './mine/index.vue' // 记录
  19. export default {
  20. components: { //在这里注册相应的组件
  21. Home,
  22. Order,
  23. Information,
  24. Mine,
  25. },
  26. data() {
  27. return {
  28. nowchos: 0, //当前选择了那个底部菜单
  29. userInfo: {},
  30. isorders: 0,
  31. userType: 3,
  32. token: '',
  33. aspirated: [{
  34. id: '25',
  35. title: '领重瓶出库',
  36. icon: 'icon-chukudan',
  37. color: '#f4b237',
  38. }, {
  39. id: '27',
  40. title: '扫空瓶入库',
  41. icon: 'icon-fankudengji',
  42. color: '#6db1ff',
  43. }],
  44. shopList: [{
  45. id: '37',
  46. title: '重瓶出库',
  47. icon: 'icon-peizaizhuangche',
  48. color: '#f4b237',
  49. }, {
  50. id: '10',
  51. title: '空瓶出库',
  52. icon: 'icon-peizaizhuangche-xianxing',
  53. color: '#6db1ff',
  54. }, {
  55. id: '31',
  56. title: '重瓶入库',
  57. icon: 'icon-fankudengji',
  58. color: '#6db1ff',
  59. }, {
  60. id: '21',
  61. title: '回收空瓶',
  62. icon: 'icon-recycling',
  63. color: '#8ac247',
  64. }, {
  65. id: '35',
  66. // 未配送
  67. title: '重瓶返库',
  68. icon: 'icon-fankudengji',
  69. color: '#22b9f9',
  70. }, {
  71. id: '33',
  72. title: '重瓶退回',
  73. icon: 'icon-tuihuo',
  74. color: '#f3553e',
  75. }, ],
  76. driverList: [{
  77. id: '11',
  78. title: '门店空瓶装车',
  79. icon: 'icon-owNote',
  80. color: '#22b9f9',
  81. }, {
  82. id: '12',
  83. title: '空瓶到达气站',
  84. icon: 'icon-yidaoda',
  85. color: '#8ac247',
  86. }, {
  87. id: '17',
  88. title: '气站重瓶出库',
  89. icon: 'icon-chukudan',
  90. color: '#6db1ff',
  91. }, {
  92. id: '19',
  93. title: '重瓶交付门店',
  94. icon: 'icon-yunsonghejiaofu',
  95. color: '#f4b237',
  96. }],
  97. stationList: [{
  98. id: '13',
  99. title: '空瓶到达气站',
  100. icon: 'icon-daichuku',
  101. color: '#37c4f4',
  102. }, {
  103. id: '14',
  104. title: '气站充装空瓶',
  105. icon: 'icon-peizaizhuangche-xianxing',
  106. color: '#6db1ff',
  107. }, {
  108. id: '15',
  109. title: '气站重瓶出库',
  110. icon: 'icon-owNote',
  111. color: '#8ac247',
  112. }, {
  113. id: 'inspect',
  114. title: '充气前后检查',
  115. icon: 'icon-jianchaxiang',
  116. color: '#f4b237',
  117. }, ],
  118. dataList: [],
  119. genreTitle: '',
  120. }
  121. },
  122. onLoad() {
  123. var userInfo = this.$cache.getCache('userInfo')
  124. if (userInfo.provUser) {
  125. if (userInfo.provUser.isorders == 0 && userInfo.provUser.userType == 3) {
  126. this.dataList = this.aspirated
  127. this.genreTitle = '送气员端'
  128. } else if (userInfo.provUser.userType == 3) {
  129. this.dataList = this.shopList
  130. this.genreTitle = '门店端'
  131. } else if (userInfo.provUser.userType == 4) {
  132. this.dataList = this.driverList
  133. this.genreTitle = '司机端'
  134. } else if (userInfo.provUser.userType == 5) {
  135. this.dataList = this.stationList
  136. this.genreTitle = '气站端'
  137. }
  138. } else {
  139. this.dataList = this.aspirated
  140. this.genreTitle = '送气员端'
  141. }
  142. },
  143. onShow() {
  144. var token = this.$cache.getToken()
  145. this.token = token
  146. var userInfo = this.$cache.getCache('userInfo')
  147. if (userInfo) {
  148. this.userInfo = userInfo
  149. }
  150. },
  151. mounted() {
  152. var userInfo = this.$cache.getCache('userInfo')
  153. if (userInfo.provUser) {
  154. this.isorders = userInfo.provUser.isorders
  155. this.userType = userInfo.provUser.userType
  156. }
  157. },
  158. methods: {
  159. // tab
  160. botomchos(e) {
  161. uni.setStorageSync('nowchos', e);
  162. this.nowchos = e
  163. },
  164. getType(isorders, userType) {
  165. if (isorders == 0) {
  166. if (userType == 3) {
  167. if (this.nowchos == 3) {
  168. return true
  169. }
  170. } else {
  171. if (this.nowchos == 2) {
  172. return true
  173. }
  174. }
  175. } else {
  176. if (this.nowchos == 2) {
  177. return true
  178. }
  179. }
  180. },
  181. steelCylinder(isorders, userType) {
  182. if (isorders == 0) {
  183. if (userType == 3) {
  184. if (this.nowchos == 2) {
  185. return true
  186. }
  187. } else {
  188. if (this.nowchos == 1) {
  189. return true
  190. }
  191. }
  192. } else {
  193. if (this.nowchos == 1) {
  194. return true
  195. }
  196. }
  197. }
  198. }
  199. }
  200. </script>
  201. <style lang="scss">
  202. .bottomboxs {
  203. position: relative;
  204. bottom: 0;
  205. z-index: 2023;
  206. height: 100rpx;
  207. }
  208. </style>