2025-10-24

购物车
This commit is contained in:
2025-10-23 17:25:39 +08:00
parent 0e2dbdb9db
commit 19e4c8bf08
7 changed files with 302 additions and 51 deletions

View File

@@ -9,11 +9,16 @@ export const mallAPI = {
getCategory: () => http.get(baseUrl + '/api/category'),
getMallDetail: (id) => http.get(baseUrl + '/api/products/' + id),
getRecommended: (id) => http.get(baseUrl + `/api/products/${id}/recommended`), // 推荐商品
addCart: (data) => http.post(baseUrl +"/api/cart/add", data), // 添加购物车
createOrder: (data) => http.post(baseUrl + `/api/orders/create-from-cart`,data), // 创建订单
createOrder: (data) => http.post(baseUrl + `/api/orders/create-from-cart`, data), // 创建订单
getOrder: (orderId) => http.get(baseUrl + `/api/orders/pending-payment/${orderId}`), // 获取订单
payment: (data) => http.post(baseUrl + "/api/orders/confirm-payment", data), // 支付订单
getCouponList: (uid) => http.get(baseUrl + `/api/coupon/user/${uid}`)
getCouponList: (uid) => http.get(baseUrl + `/api/coupon/user/${uid}`), // 获取优惠券列表
// 购物车
getCartList: () => http.get(baseUrl + "/api/cart"), // 获取购物车列表
addCart: (data) => http.post(baseUrl + "/api/cart/add", data), // 添加购物车
editCartQuantity: (item) => http.put(baseUrl + `/api/cart/${item.id}`, {quantity: item.quantity}), // 修改数量
deleteCart: (id) => http.delete(baseUrl + `/api/cart/${id}`), // 删除
}
export default {