import { get, post, put, del } from '../utils/request' import type { CartItem } from '../types' /** 获取购物车列表 */ export const getCartList = () => get('/api/cart') /** 添加商品到购物车 */ export const addToCart = (data: { productId: number; specDataId: number; quantity: number }) => post('/api/cart', data as unknown as Record) /** 更新购物车项 */ export const updateCartItem = (id: number, data: { quantity: number }) => put(`/api/cart/${id}`, data as unknown as Record) /** 删除购物车项 */ export const deleteCartItem = (id: number) => del(`/api/cart/${id}`)