123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <template>
- <!-- 商品分类 -->
- <view :style="colorStyle">
- <!-- 商品分类的三种样式布局 -->
- <goodsCate1 v-show="category==1" ref="classOne" :isFooter="isFooter"></goodsCate1>
- <goodsCate2 v-show="category==2" ref="classTwo" :isFooter="isFooter"></goodsCate2>
- <goodsCate3 v-show="category==3" ref="classThree" :isFooter="isFooter"></goodsCate3>
- <pageFooter @newDataStatus="newDataStatus"></pageFooter>
- </view>
- </template>
- <script>
- import colors from "@/mixins/color";
- import goodsCate1 from './goods_cate1';
- import goodsCate2 from './goods_cate2';
- import goodsCate3 from './goods_cate3';
- import pageFooter from '@/components/pageFooter/index.vue'
- import {
- colorChange
- } from '@/api/api.js';
- import {
- mapGetters
- } from 'vuex';
- export default {
- computed: mapGetters(['isLogin', 'uid']),
- components: {
- goodsCate1,
- goodsCate2,
- goodsCate3,
- pageFooter
- },
- mixins: [colors],
- data() {
- return {
- category:'',
- isFooter:false
- }
- },
- onLoad(options) {
- this.classStyle();
- },
- onUnload(){
- uni.$off('newAttrNum')
- },
- onReady() {
- },
- onShow() {
- console.log(this.category,'this.category')
- if(this.category==2){
- this.$refs.classTwo.getNoCart();
- this.$refs.classTwo.getCartList(1);
- }else if(this.category==3){
- this.$refs.classThree.getNoCart();
- this.$refs.classThree.getCartList(1);
- }
- // if(uni.getStorageSync('form_type_cart')){
- // this.classStyle();
- // }
- },
- methods: {
- newDataStatus(val){
- this.isFooter = val;
- },
- otherFun(object){
- if(!!object){
- if(this.category==2){
- this.$refs.classTwo.updateFun(object);
- }
- if(this.category==3){
- this.$refs.classThree.updateFun(object);
- }
- }
- },
- classStyle(){
-
- colorChange('category').then(res=>{
- let status = res.data.status;
- this.category = status;
- console.log(this.category,'this.category')
- if(status==1){
- this.$refs.classOne.getAllCategory();
- }
- if(status==2){
- if(this.isLogin){
- this.$refs.classTwo.getCartList(1);
- }
- this.$refs.classTwo.getAllCategory();
- this.$refs.classTwo.getMarTop();
- }
- if(status==3){
- if(this.isLogin){
- this.$refs.classThree.getCartList(1);
- }
- this.$refs.classThree.getAllCategory();
- this.$refs.classThree.getMarTop();
- }
- })
- }
- },
- onReachBottom: function() {
- if(this.category==2){
- this.$refs.classTwo.productslist();
- }
- if(this.category==3){
- this.$refs.classThree.productslist();
- }
- }
- }
- </script>
- <style scoped lang="scss">
- /deep/.goodCate .uni-badge-left-margin .uni-badge--error{
- background-color: #fff !important;
- color: var(--view-theme);
- border-color: var(--view-theme);
- z-index: 8;
- }
- /deep/.goodCate .footer .cartIcon .uni-badge-left-margin .uni-badge--error{
- right: 0 !important;
- top: 10px !important;
- }
- /deep/.mask{
- z-index: 99;
- }
- </style>
|