goods_cate.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. uni.$emit('uploadFooter')
  49. getCategoryVersion().then(res => {
  50. if (!uni.getStorageSync('CAT_VERSION') || res.data.version != uni.getStorageSync(
  51. 'CAT_VERSION')) {
  52. this.isNew = !this.isNew
  53. uni.setStorageSync('CAT_VERSION', res.data.version)
  54. } else {
  55. // this.isNew = false
  56. }
  57. this.classStyle();
  58. })
  59. },
  60. jumpIndex() {
  61. // uni.reLaunch({
  62. // url: '/pages/index/index'
  63. // })
  64. },
  65. classStyle() {
  66. colorChange('category').then(res => {
  67. let status = res.data.status;
  68. this.category = status
  69. uni.setStorageSync('is_diy', res.data.is_diy)
  70. this.status = res.data.status
  71. this.$nextTick(e => {
  72. if (this.status == 2 || this.status == 3) {
  73. uni.hideTabBar();
  74. } else if (this.status == 1) {
  75. this.$refs.classOne.is_diy = res.data.is_diy
  76. this.$refs.classOne.getNav();
  77. }
  78. if (status == 2) {
  79. if (this.isLogin) {
  80. this.$refs.classTwo.getCartNum();
  81. this.$refs.classTwo.getCartList(1);
  82. }
  83. this.$refs.classTwo.getAllCategory()
  84. }
  85. if (status == 3) {
  86. if (this.isLogin) {
  87. this.$refs.classThree.getCartNum();
  88. this.$refs.classThree.getCartList(1);
  89. }
  90. this.$refs.classThree.getAllCategory()
  91. }
  92. if (status == 2 || status == 3) {
  93. uni.hideTabBar()
  94. } else {
  95. if (!this.is_diy) {
  96. uni.hideTabBar()
  97. } else {}
  98. this.$refs.classOne.getNav();
  99. }
  100. })
  101. })
  102. }
  103. },
  104. onReachBottom: function() {
  105. if (this.category == 2) {
  106. this.$refs.classTwo.productslist();
  107. }
  108. if (this.category == 3) {
  109. this.$refs.classThree.productslist();
  110. }
  111. }
  112. }
  113. </script>
  114. <style scoped lang="scss">
  115. /deep/.mask {
  116. z-index: 99;
  117. }
  118. </style>