wujingjing
2024-08-12 65b112afeed88e66d6bfd9f30f817674290d7780
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import http from '@/utils/http'
 
/**
 * @description [商品详情加入购物车] 以及 [购物车更新商品数量]
 * @param { Object } param { goodsId:商品 ID, count: 购买数量, blessing: 祝福语 }
 * @returns Promise
 */
export const reqAddCart = ({ goodsId, count, ...data }) => {
  return http.get(`/cart/addToCart/${goodsId}/${count}`, data)
}
 
/**
 * @description 获取购物车列表数据
 * @returns Promise
 */
export const reqCartList = () => {
  return http.get('/cart/getCartList')
}
 
/**
 * @description 更新商品的选中状态
 * @param {*} goodsId 商品的 ID
 * @param {*} isChecked 商品的勾选状态,0 说明需要取消勾选,1 需要勾选
 * @returns Promise
 */
export const reqUpdateChecked = (goodsId, isChecked) => {
  return http.get(`/cart/checkCart/${goodsId}/${isChecked}`)
}
 
/**
 * @description 实现全选和全不选功能
 * @param {*} isChecked 全选与全不选状态,0 就是取消全选,1 进行全选
 * @returns Promise
 */
export const reqCheckAllStatus = (isChecked) => {
  return http.get(`/cart/checkAllCart/${isChecked}`)
}
 
/**
 * @description 删除购物车商品
 * @param {*} goodsId 商品的 ID
 * @returns Promise
 */
export const reqDelCartGoods = (goodsId) => {
  return http.get(`/cart/delete/${goodsId}`)
}