goods_cate.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. let res = {
  60. data:{
  61. status: 1
  62. }
  63. }
  64. // colorChange('category').then(res => {
  65. let status = res.data.status;
  66. this.status = res.data.status
  67. this.category = status
  68. if (status == 2) {
  69. if (this.isLogin) {
  70. this.$refs.classTwo.getCartNum();
  71. this.$refs.classTwo.getCartList(1);
  72. }
  73. this.$refs.classTwo.getAllCategory()
  74. }
  75. if (status == 3) {
  76. if (this.isLogin) {
  77. this.$refs.classThree.getCartNum();
  78. this.$refs.classThree.getCartList(1);
  79. }
  80. this.$refs.classThree.getAllCategory()
  81. }
  82. if (status == 2 || status == 3) {
  83. uni.hideTabBar()
  84. } else {
  85. if (!this.is_diy) {
  86. uni.hideTabBar()
  87. } else {
  88. this.$refs.classOne.getNav();
  89. }
  90. }
  91. // })
  92. }
  93. },
  94. onReachBottom: function() {
  95. if (this.category == 2) {
  96. this.$refs.classTwo.productslist();
  97. }
  98. if (this.category == 3) {
  99. this.$refs.classThree.productslist();
  100. }
  101. }
  102. }
  103. </script>
  104. <style scoped lang="scss">
  105. /deep/.mask {
  106. z-index: 99;
  107. }
  108. </style>