import requests from "@/utils/request"


// get请求方式并携带一个参数 根据id获取商品详情
export const getdetaillist = (skuId) => requests({
	url: `/api/item/${skuId}`,
	method: "get"
})

// /api/cart/addToCart/{ skuId }/{ skuNum } 添加购物车 (更新某一个产品的个数)

// skuNum
// 商品数量
// 正数代表增加
// 负数代表减少

export const addToCart = (skuId, skuNum) => requests({
	url: `/api/cart/addToCart/${skuId}/${skuNum}`,
	method: "post"
})

// 获取购物车列表的接口
export const getShopcartlist = () => requests.get("/api/cart/cartList")
// export const getShopcartlist=()=>requests({
// 	url:"/api/cart/cartList",
// 	method: "get"
// })

// 根据商品id删除购物车对应的商品
export const deleteshopcartlist = (skuId) => requests.delete(`/api/cart/deleteCart/${skuId}`)

// export const deleteshopcartlist2=(skuId)=>requests({url:`/api/cart/deleteCart/${skuId}`,method:'delete'})


// 8. 切换商品选中状态checked
export const changeshopcartchecked=(skuID,isChecked)=>requests.get(`/api/cart/checkCart/${skuID}/${isChecked}`)