goods_cate.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <!-- 商品分类 -->
  3. <view :style="colorStyle">
  4. <!-- 商品分类的三种样式布局 -->
  5. <goodsCate1 v-show="category==1" ref="classOne" :isFooter="isFooter"></goodsCate1>
  6. <goodsCate2 v-show="category==2" ref="classTwo" :isFooter="isFooter"></goodsCate2>
  7. <goodsCate3 v-show="category==3" ref="classThree" :isFooter="isFooter"></goodsCate3>
  8. <pageFooter @newDataStatus="newDataStatus"></pageFooter>
  9. </view>
  10. </template>
  11. <script>
  12. import colors from "@/mixins/color";
  13. import goodsCate1 from './goods_cate1';
  14. import goodsCate2 from './goods_cate2';
  15. import goodsCate3 from './goods_cate3';
  16. import pageFooter from '@/components/pageFooter/index.vue'
  17. import {
  18. colorChange
  19. } from '@/api/api.js';
  20. import {
  21. mapGetters
  22. } from 'vuex';
  23. export default {
  24. computed: mapGetters(['isLogin', 'uid']),
  25. components: {
  26. goodsCate1,
  27. goodsCate2,
  28. goodsCate3,
  29. pageFooter
  30. },
  31. mixins: [colors],
  32. data() {
  33. return {
  34. category:'',
  35. isFooter:false
  36. }
  37. },
  38. onLoad(options) {
  39. if(!uni.getStorageSync('form_type_cart')){
  40. this.classStyle();
  41. }
  42. },
  43. onReady() {
  44. },
  45. onShow() {
  46. if(uni.getStorageSync('form_type_cart')){
  47. this.classStyle();
  48. }
  49. },
  50. methods: {
  51. newDataStatus(val){
  52. this.isFooter = val;
  53. },
  54. otherFun(object){
  55. if(!!object){
  56. if(this.category==2){
  57. this.$refs.classTwo.updateFun(object);
  58. }
  59. if(this.category==3){
  60. this.$refs.classThree.updateFun(object);
  61. }
  62. }
  63. },
  64. classStyle(){
  65. colorChange('category').then(res=>{
  66. let status = res.data.status;
  67. this.category = status;
  68. if(status==1){
  69. this.$refs.classOne.getAllCategory();
  70. }
  71. if(status==2){
  72. if(this.isLogin){
  73. this.$refs.classTwo.getCartList(1);
  74. }
  75. this.$refs.classTwo.getAllCategory();
  76. this.$refs.classTwo.getMarTop();
  77. }
  78. if(status==3){
  79. if(this.isLogin){
  80. this.$refs.classThree.getCartList(1);
  81. }
  82. this.$refs.classThree.getAllCategory();
  83. this.$refs.classThree.getMarTop();
  84. }
  85. })
  86. }
  87. },
  88. onReachBottom: function() {
  89. if(this.category==2){
  90. this.$refs.classTwo.productslist();
  91. }
  92. if(this.category==3){
  93. this.$refs.classThree.productslist();
  94. }
  95. }
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. /deep/.mask{
  100. z-index: 99;
  101. }
  102. </style>