goods_cate.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view :style="colorStyle">
  3. <goodsCate1 v-show="category==1" ref="classOne"></goodsCate1>
  4. <goodsCate2 v-show="category==2" ref="classTwo" @jumpIndex="jumpIndex"></goodsCate2>
  5. <goodsCate3 v-show="category==3" ref="classThree" @jumpIndex="jumpIndex"></goodsCate3>
  6. <!-- <tabBar v-show="category == 1" :pagePath="'/pages/goods_cate/goods_cate'"></tabBar> -->
  7. </view>
  8. </template>
  9. <script>
  10. import colors from "@/mixins/color";
  11. import goodsCate1 from './goods_cate1';
  12. import goodsCate2 from './goods_cate2';
  13. import goodsCate3 from './goods_cate3';
  14. import {
  15. colorChange
  16. } from '@/api/api.js';
  17. import {
  18. mapGetters
  19. } from 'vuex';
  20. import tabBar from "@/pages/index/visualization/components/tabBar.vue"
  21. export default {
  22. computed: mapGetters(['isLogin', 'uid']),
  23. components: {
  24. goodsCate1,
  25. goodsCate2,
  26. goodsCate3,
  27. tabBar
  28. },
  29. mixins: [colors],
  30. data() {
  31. return {
  32. category: '',
  33. is_diy: uni.getStorageSync('is_diy'),
  34. status: 0,
  35. }
  36. },
  37. onLoad() {
  38. this.classStyle();
  39. },
  40. onReady() {
  41. },
  42. onShow() {
  43. if (this.status == 2 || this.status == 3) {
  44. uni.hideTabBar()
  45. } else if (this.status == 1) {
  46. if (!this.is_diy) {
  47. uni.hideTabBar()
  48. } else {
  49. this.$refs.classOne.getNav();
  50. }
  51. }
  52. },
  53. methods: {
  54. jumpIndex() {
  55. if (this.is_diy) {
  56. if (!uni.getStorageSync('FOOTER_BAR')) {
  57. uni.showTabBar()
  58. }
  59. }
  60. },
  61. classStyle() {
  62. colorChange('category').then(res => {
  63. let status = res.data.status;
  64. this.status = res.data.status
  65. this.category = status
  66. if (status == 2) {
  67. if (this.isLogin) {
  68. this.$refs.classTwo.getCartNum();
  69. this.$refs.classTwo.getCartList(1);
  70. }
  71. this.$refs.classTwo.getAllCategory()
  72. }
  73. if (status == 3) {
  74. if (this.isLogin) {
  75. this.$refs.classThree.getCartNum();
  76. this.$refs.classThree.getCartList(1);
  77. }
  78. this.$refs.classThree.getAllCategory()
  79. }
  80. if (status == 2 || status == 3) {
  81. uni.hideTabBar()
  82. } else {
  83. if (!this.is_diy) {
  84. uni.hideTabBar()
  85. } else {
  86. this.$refs.classOne.getNav();
  87. }
  88. }
  89. })
  90. }
  91. },
  92. onReachBottom: function() {
  93. if (this.category == 2) {
  94. this.$refs.classTwo.productslist();
  95. }
  96. if (this.category == 3) {
  97. this.$refs.classThree.productslist();
  98. }
  99. }
  100. }
  101. </script>
  102. <style scoped lang="scss">
  103. /deep/.mask {
  104. z-index: 99;
  105. }
  106. </style>