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

37 lines
945 B

/*
* @Author: ch
* @Date: 2022-05-04 18:24:03
* @LastEditors: ch
* @LastEditTime: 2022-05-04 22:41:25
* @Description: file content
*/
import {axiosTk} from "../axiosTk";
import { ToAsyncAwait } from "../utils";
const BASE_URL = '/mall/product';
/**
* 设置购物车数量
* @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`));