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-app/common/api/cart.js

38 lines
950 B

/*
* @Author: ch
* @Date: 2022-04-06 10:14:03
* @LastEditors: ch
* @LastEditTime: 2022-04-07 09:58:43
* @Description: file content
*/
import {ToAsyncAwait, MsbRequestTk} from '@/common/utils';
const BASE_URL = '/mall/product';
/**
* 设置购物车数量
* @param {id,number} data
*/
export const ApiPutCartNum = (data) =>
ToAsyncAwait(MsbRequestTk.put(`${BASE_URL}/shoppingCart/number`, data));
/**
* 往购物车中添加商品
* @param {prodcutId, productSkuId, number} data
*/
export const ApiPutAddCart = (data) =>
ToAsyncAwait(MsbRequestTk.put(`${BASE_URL}/shoppingCart/increase`, data));
/**
* 删除购物车中的商品
* @param {idList} data
*/
export const ApiDeleteCartGoods = (data) =>
ToAsyncAwait(MsbRequestTk.delete(`${BASE_URL}/shoppingCart?idList=${data.idList}`, data));
/**
* 获取购物车列表
*/
export const ApiGetCartList = () =>
ToAsyncAwait(MsbRequestTk.get(`${BASE_URL}/shoppingCart`));