goods_cate.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view :style="colorStyle">
  3. <goodsCate1 v-if="category == 1" ref="classOne" :isNew="isNew"></goodsCate1>
  4. <goodsCate2 v-if="category == 2" ref="classTwo" :isNew="isNew" @jumpIndex="jumpIndex"></goodsCate2>
  5. <goodsCate3 v-if="category == 3" ref="classThree" :isNew="isNew" @jumpIndex="jumpIndex"></goodsCate3>
  6. <pageFooter v-if="category == 1" @newDataStatus="newDataStatus" v-show="showBar"></pageFooter>
  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 { colorChange } from '@/api/api.js';
  15. import { mapGetters } from 'vuex';
  16. import { getCategoryVersion } from '@/api/public.js';
  17. import pageFooter from '@/components/pageFooter/index.vue';
  18. export default {
  19. computed: mapGetters(['isLogin', 'uid']),
  20. components: {
  21. goodsCate1,
  22. goodsCate2,
  23. goodsCate3,
  24. pageFooter
  25. },
  26. mixins: [colors],
  27. data() {
  28. return {
  29. category: '',
  30. is_diy: uni.getStorageSync('is_diy'),
  31. status: 0,
  32. version: '',
  33. isNew: false,
  34. isFooter: false,
  35. showBar: false
  36. };
  37. },
  38. onLoad() {},
  39. onReady() {},
  40. onShow() {
  41. this.getCategoryVersion();
  42. },
  43. methods: {
  44. newDataStatus(val, num) {
  45. this.isFooter = val ? true : false;
  46. this.showBar = val ? true : false;
  47. this.pdHeight = num;
  48. },
  49. getCategoryVersion() {
  50. uni.$emit('uploadFooter');
  51. getCategoryVersion().then((res) => {
  52. if (!uni.getStorageSync('CAT_VERSION') || res.data.version != uni.getStorageSync('CAT_VERSION')) {
  53. uni.setStorageSync('CAT_VERSION', res.data.version);
  54. uni.$emit('uploadCatData');
  55. }
  56. this.classStyle();
  57. });
  58. },
  59. jumpIndex() {
  60. uni.reLaunch({
  61. url: '/pages/index/index'
  62. })
  63. },
  64. classStyle() {
  65. colorChange('category').then((res) => {
  66. let status = res.data.status;
  67. this.category = status;
  68. uni.setStorageSync('is_diy', res.data.is_diy);
  69. this.$nextTick((e) => {
  70. if (status == 2 || status == 3) {
  71. uni.hideTabBar();
  72. } else {
  73. this.$refs.classOne.is_diy = res.data.is_diy;
  74. if (!this.is_diy) {
  75. uni.hideTabBar();
  76. } else {
  77. this.$refs.classOne.getNav();
  78. }
  79. }
  80. });
  81. });
  82. }
  83. },
  84. onReachBottom: function () {
  85. if (this.category == 2) {
  86. this.$refs.classTwo.productslist();
  87. }
  88. if (this.category == 3) {
  89. this.$refs.classThree.productslist();
  90. }
  91. }
  92. };
  93. </script>
  94. <style scoped lang="scss">
  95. /deep/.mask {
  96. z-index: 99;
  97. }
  98. ::-webkit-scrollbar {
  99. width: 0;
  100. height: 0;
  101. color: transparent;
  102. display: none;
  103. }
  104. </style>