shop-detail.js 1.68 KB
import api from '@/api/api'
import {
  httpGet,
  httpPost
} from '@/api/fetch-api.js'

import ContactUsComp from '@/components/contact-us-comp/contact-us-comp.vue'

export default {
  data() {
    return {
      key: 'value',
      contactUsVisible: true,
      store: {},
      storeCollect: 0,
      page: 1,
      size: 10,
      total: 0,
      productList: [],
    }
  },
  components: {
    ContactUsComp
  },
  methods: {
    toProduct(item) {
      this.$router.push({
        path: "/product/detail",
        query: {
          c: item.productCode
        }
      })
    },
    onFavoriteHandler() {
      // this./
    },
    onContactUsHandler() {
      this.contactUsVisible = true;
    },
    // 店铺产品列表
    queryProductStore() {
      httpGet({
        url: api.productStore,
        data: {
          page: this.page,
          size: this.size,
          storeCode: this.$route.query.c
        }
      }).then((result) => {
        this.productList = result.list;
        this.total = result.total;
        // console.log("productList:", this.productList);
        console.log("productList item:", this.productList[0]);
      });
    },
    // 店铺详情
    queryStoreDetail() {
      httpGet({
        url: api.storeDetail,
        data: {
          storeCode: this.$route.query.c
        }
      }).then((result) => {
        this.store = result.store || {};
        this.storeCollect = result.storeCollect || 0;
        console.log("this.store:", this.store);
        console.log("this.storeCollect:", this.storeCollect);
      });
    },
    initData() {
      this.queryStoreDetail();
      this.queryProductStore();
    }
  },
  mounted() {},
  created() {
    this.initData();
  }
}