goods_cate.vue 2.2 KB

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