product.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import request from '../utils/request.js'
  2. class product extends request {
  3. // static errorHandel(res) {
  4. // console.log(res);
  5. // }
  6. static async getProductList(productType=1,page = 1, pageSize = 10,type=1,storeId=0) {
  7. const res = await this.getRequest(`${this.BASE_URL}Product/index?productTypeId=${productType}&page=${page}&pageSize=${pageSize}&type=${type}&storeId=${storeId}`)
  8. return res.data;
  9. }
  10. static async getProductById(id,shopId) {
  11. const res = await this.getRequest(`${this.BASE_URL}Product/read?id=${id}&storeId=${shopId}`)
  12. return res.data;
  13. }
  14. static async getProductTypeList(page = 1, pageSize = 10,type=1,storeId=0) {
  15. const res = await this.getRequest(`${this.BASE_URL}Product/typeList?page=${page}&pageSize=${pageSize}&type=${type}&storeId=${storeId}`)
  16. return res.data;
  17. }
  18. static async getCart(data) {
  19. const res= await this.postRequest(`${this.BASE_URL}Order/getCart`,data)
  20. return res.data
  21. }
  22. static async updateCart(data) {
  23. const res = await this.postRequest(`${this.BASE_URL}Order/updateCart`,data)
  24. return res.data
  25. }
  26. }
  27. export default product