indexRouter.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <!-- 底部tab导航 -->
  3. <view>
  4. <Home v-if="nowchos === 0"></Home>
  5. <Order ref="order" v-else-if="nowchos === 1"></Order>
  6. <Mine ref="mine" v-else-if="nowchos === 2"></Mine>
  7. <!-- <Information v-else-if="nowchos === 2"></Information>
  8. <Mine ref="mine" v-else-if="nowchos === 3"></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. }
  34. },
  35. onShow() {
  36. const that = this
  37. uni.$on('booking', () => {
  38. that.nowchos = 1
  39. that.$forceUpdate()
  40. that.$nextTick(() => {
  41. setTimeout(function() {
  42. that.$refs.order.getOrderList()
  43. }, 100);
  44. })
  45. })
  46. if (that.nowchos == 2) {
  47. that.$nextTick(() => {
  48. setTimeout(function() {
  49. that.$refs.mine.refreshTokenil()
  50. }, 100);
  51. })
  52. }
  53. },
  54. mounted() {
  55. var userInfo = this.$cache.getCache('userInfo')
  56. if (userInfo.provUser) {
  57. this.isorders = userInfo.provUser.isorders
  58. this.userType = userInfo.provUser.userType
  59. }
  60. this.userInfo = userInfo
  61. },
  62. methods: {
  63. // tab
  64. botomchos(e) {
  65. const that = this
  66. if (e == 2) {
  67. that.$nextTick(() => {
  68. setTimeout(function() {
  69. that.$refs.mine.refreshTokenil()
  70. }, 100);
  71. })
  72. }
  73. uni.setStorageSync('nowchos', e);
  74. that.nowchos = e
  75. },
  76. }
  77. }
  78. </script>
  79. <style lang="scss">
  80. .bottomboxs {
  81. position: relative;
  82. bottom: 0;
  83. z-index: 2023;
  84. height: 100rpx;
  85. }
  86. </style>