From bd125eecd57d2f4e559c6170d20157591300fe3d Mon Sep 17 00:00:00 2001 From: p-honggang.li <p-honggang.li@pcitc.com> Date: 星期四, 04 九月 2025 20:57:44 +0800 Subject: [PATCH] 修改购物车等BUG --- src/api/cartApi.ts | 25 +++++++++++++++++-------- 1 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/api/cartApi.ts b/src/api/cartApi.ts index 20cf968..55e853c 100644 --- a/src/api/cartApi.ts +++ b/src/api/cartApi.ts @@ -15,20 +15,29 @@ }, // 浠庤喘鐗╄溅绉婚櫎鍟嗗搧 - removeFromCart(userId: string, unitId: string, pricingId: string): ApiPromise { + removeFromCart(userId: string, unitId: string, productId:string, pricingId: string): ApiPromise { return createAxios({ url: `${baseUrl}/remove`, method: 'delete', - params: { userId, unitId, pricingId } + params: { userId, unitId, productId,pricingId } }) as ApiPromise }, // 鏇存柊璐墿杞﹀晢鍝佹暟閲� - updateCartItem(userId: string, unitId: string, pricingId: number, quantity: number): ApiPromise { + updateCartItem(userId: string, unitId: string,productId: string, pricingId: number, quantity: number): ApiPromise { return createAxios({ url: `${baseUrl}/update`, method: 'put', - params: { userId, unitId, pricingId, quantity } + params: { userId, unitId, productId,pricingId, quantity } + }) as ApiPromise + }, + + // 鏇存柊璐墿杞﹀勾闄� + updateCartItemDuration(userId: string, unitId: string,productId: string, pricingId: number, duration: number): ApiPromise { + return createAxios({ + url: `${baseUrl}/update/duration`, + method: 'put', + params: { userId, unitId, productId,pricingId, duration } }) as ApiPromise }, @@ -42,20 +51,20 @@ }, // 鑾峰彇璐墿杞﹀晢鍝佸垪琛� - getCartItems(userId: string, unitId: string): ApiPromise { + getCartItems(userId: string, unitId: string,productId: string): ApiPromise { return createAxios({ url: `${baseUrl}/items`, method: 'get', - params: { userId, unitId } + params: { userId, unitId, productId } }) as ApiPromise }, // 娓呯┖璐墿杞� - clearCart(userId: string, unitId: string): ApiPromise { + clearCart(userId: string, unitId: string, productId: string): ApiPromise { return createAxios({ url: `${baseUrl}/clear`, method: 'delete', - params: { userId, unitId } + params: { userId, unitId, productId } }) as ApiPromise } } -- Gitblit v1.8.0