goods_cate.vue 2.1 KB

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