You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shop-pc/plugins/api/cart.js

39 lines
994 B

3 years ago
/*
* @Author: ch
* @Date: 2022-05-04 18:24:03
* @LastEditors: ch
* @LastEditTime: 2022-05-07 10:29:08
3 years ago
* @Description: file content
*/
import {axiosTk} from "../axiosTk";
import { ToAsyncAwait } from "../utils";
import ENV from '../config/env';
const BASE_URL = `${ENV.base_url}/mall/product`;
3 years ago
/**
* 设置购物车数量
* @param {id,number} data
*/
export const ApiPutCartNum = (data) =>
ToAsyncAwait(axiosTk.put(`${BASE_URL}/shoppingCart/number`, data));
/**
* 往购物车中添加商品
* @param {prodcutId, productSkuId, number} data
*/
export const ApiPutAddCart = (data) =>
ToAsyncAwait(axiosTk.put(`${BASE_URL}/shoppingCart/increase`, data));
/**
* 删除购物车中的商品
* @param {idList} data
*/
export const ApiDeleteCartGoods = (data) =>
ToAsyncAwait(axiosTk.delete(`${BASE_URL}/shoppingCart?idList=${data.idList}`, data));
/**
* 获取购物车列表
*/
export const ApiGetCartList = () =>
ToAsyncAwait(axiosTk.get(`${BASE_URL}/shoppingCart`));