From 349091f54dab47b15ca81613f02765490a2ce7d0 Mon Sep 17 00:00:00 2001 From: p-honggang.li <p-honggang.li@pcitc.com> Date: 星期四, 11 九月 2025 10:50:36 +0800 Subject: [PATCH] 修改买家中心卖家中心产品类型等条件查询问题 --- src/api/cartApi.ts | 29 +++++++++++++++++++---------- 1 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/api/cartApi.ts b/src/api/cartApi.ts index 2d46ee8..55e853c 100644 --- a/src/api/cartApi.ts +++ b/src/api/cartApi.ts @@ -5,7 +5,7 @@ const cartApi = { // 娣诲姞鍟嗗搧鍒拌喘鐗╄溅 - addToCart(data: any, userId: number, unitId: number): ApiPromise { + addToCart(data: any, userId: string, unitId: string): ApiPromise { return createAxios({ url: `${baseUrl}/add`, method: 'post', @@ -15,25 +15,34 @@ }, // 浠庤喘鐗╄溅绉婚櫎鍟嗗搧 - removeFromCart(userId: number, unitId: number, pricingId: number): 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: number, unitId: number, 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 }, // 鑾峰彇璐墿杞︿俊鎭� - getCartInfo(userId: number, unitId: number): ApiPromise { + getCartInfo(userId: string, unitId: string): ApiPromise { return createAxios({ url: `${baseUrl}/info`, method: 'get', @@ -42,20 +51,20 @@ }, // 鑾峰彇璐墿杞﹀晢鍝佸垪琛� - getCartItems(userId: number, unitId: number): 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: number, unitId: number): 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