goods_cate.vue 2.9 KB

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