From f733f061096401efefbc30c68abc7b9b1e3bb99c Mon Sep 17 00:00:00 2001 From: zhuotianyuan Date: Mon, 26 Jan 2026 17:40:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(api):=20=E6=B7=BB=E5=8A=A0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E5=92=8C=E7=AB=99?= =?UTF-8?q?=E7=82=B9=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加订单相关接口包括获取订单项列表和关联订单功能 新增站点管理的创建、禁用、获取、列表和更新接口 更新类型定义以支持新功能 --- src/pages/Order/List/index.tsx | 1 + src/servers/api/index.ts | 4 +- src/servers/api/order.ts | 44 +++++++++++++++ src/servers/api/site.ts | 75 ++++++++++++++++++++++++++ src/servers/api/typings.d.ts | 99 ++++++++++++++++++++++++++++++---- 5 files changed, 211 insertions(+), 12 deletions(-) diff --git a/src/pages/Order/List/index.tsx b/src/pages/Order/List/index.tsx index e74e151..57818b9 100644 --- a/src/pages/Order/List/index.tsx +++ b/src/pages/Order/List/index.tsx @@ -1947,6 +1947,7 @@ const [shipmentPlatforms, setShipmentPlatforms] = useState([ const res = await logisticscontrollerGetshipmentfee( { + shipmentPlatform: data.shipmentPlatform, stockPointId: data.stockPointId, sender: details.origin.contact_name, diff --git a/src/servers/api/index.ts b/src/servers/api/index.ts index 7e0131b..a377a94 100644 --- a/src/servers/api/index.ts +++ b/src/servers/api/index.ts @@ -1,7 +1,7 @@ // @ts-ignore /* eslint-disable */ -// API 更新时间: -// API 唯一标识: +// API 更新时间: +// API 唯一标识: import * as customer from './customer'; import * as logistics from './logistics'; import * as order from './order'; diff --git a/src/servers/api/order.ts b/src/servers/api/order.ts index 4d7d5a2..d386ddd 100644 --- a/src/servers/api/order.ts +++ b/src/servers/api/order.ts @@ -30,6 +30,20 @@ export async function ordercontrollerDelorder( }); } +/** 此处后端没有提供注释 GET /order/${param0}/related */ +export async function ordercontrollerGetrelatedbyorder( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.ordercontrollerGetrelatedbyorderParams, + options?: { [key: string]: any }, +) { + const { orderId: param0, ...queryParams } = params; + return request(`/order/${param0}/related`, { + method: 'GET', + params: { ...queryParams }, + ...(options || {}), + }); +} + /** 此处后端没有提供注释 POST /order/createNote */ export async function ordercontrollerCreatenote( body: API.CreateOrderNoteDTO, @@ -60,6 +74,36 @@ export async function ordercontrollerGetorderbynumber( }); } +/** 此处后端没有提供注释 GET /order/getOrderItemList */ +export async function ordercontrollerGetorderitemlist( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.ordercontrollerGetorderitemlistParams, + options?: { [key: string]: any }, +) { + return request('/order/getOrderItemList', { + method: 'GET', + params: { + ...params, + }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /order/getOrderItems */ +export async function ordercontrollerGetorderitems( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.ordercontrollerGetorderitemsParams, + options?: { [key: string]: any }, +) { + return request('/order/getOrderItems', { + method: 'GET', + params: { + ...params, + }, + ...(options || {}), + }); +} + /** 此处后端没有提供注释 GET /order/getOrders */ export async function ordercontrollerGetorders( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) diff --git a/src/servers/api/site.ts b/src/servers/api/site.ts index a234ee2..5dee931 100644 --- a/src/servers/api/site.ts +++ b/src/servers/api/site.ts @@ -9,3 +9,78 @@ export async function sitecontrollerAll(options?: { [key: string]: any }) { ...(options || {}), }); } + +/** 此处后端没有提供注释 POST /site/create */ +export async function sitecontrollerCreate( + body: API.CreateSiteDTO, + options?: { [key: string]: any }, +) { + return request('/site/create', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 PUT /site/disable/${param0} */ +export async function sitecontrollerDisable( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.sitecontrollerDisableParams, + body: API.DisableSiteDTO, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/site/disable/${param0}`, { + method: 'PUT', + headers: { + 'Content-Type': 'application/json', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /site/get/${param0} */ +export async function sitecontrollerGet( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.sitecontrollerGetParams, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/site/get/${param0}`, { + method: 'GET', + params: { ...queryParams }, + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 GET /site/list */ +export async function sitecontrollerList(options?: { [key: string]: any }) { + return request('/site/list', { + method: 'GET', + ...(options || {}), + }); +} + +/** 此处后端没有提供注释 PUT /site/update/${param0} */ +export async function sitecontrollerUpdate( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.sitecontrollerUpdateParams, + body: API.UpdateSiteDTO, + options?: { [key: string]: any }, +) { + const { id: param0, ...queryParams } = params; + return request(`/site/update/${param0}`, { + method: 'PUT', + headers: { + 'Content-Type': 'application/json', + }, + params: { ...queryParams }, + data: body, + ...(options || {}), + }); +} diff --git a/src/servers/api/typings.d.ts b/src/servers/api/typings.d.ts index 2a3357d..4e054e9 100644 --- a/src/servers/api/typings.d.ts +++ b/src/servers/api/typings.d.ts @@ -82,6 +82,8 @@ declare namespace API { items?: PurchaseOrderItem[]; }; + type CreateSiteDTO = {}; + type CreateStockPointDTO = { name?: string; location?: string; @@ -134,6 +136,8 @@ declare namespace API { SignatureRequirementEnum?: any; }; + type DisableSiteDTO = {}; + type Location = { name?: string; address?: Address; @@ -299,6 +303,32 @@ declare namespace API { orderId: number; }; + type ordercontrollerGetorderitemlistParams = { + /** 页码 */ + current?: number; + /** 每页大小 */ + pageSize?: number; + siteId?: string; + name?: string; + externalProductId?: string; + externalVariationId?: string; + startDate?: string; + endDate?: string; + }; + + type ordercontrollerGetorderitemsParams = { + isSource?: boolean; + exceptPackage?: boolean; + /** 页码 */ + current?: number; + /** 每页大小 */ + pageSize?: number; + siteId?: string; + name?: string; + startDate?: string; + endDate?: string; + }; + type ordercontrollerGetordersalesParams = { isSource?: boolean; exceptPackage?: boolean; @@ -338,6 +368,12 @@ declare namespace API { | 'return-approved' | 'return-cancelled'; payment_method?: string; + /** 仅订阅订单(父订阅订单或包含订阅商品) */ + isSubscriptionOnly?: boolean; + }; + + type ordercontrollerGetrelatedbyorderParams = { + orderId: number; }; type ordercontrollerRefundorderParams = { @@ -437,8 +473,17 @@ declare namespace API { subtotal_tax?: number; total?: number; total_tax?: number; + tax_class?: string; + taxes?: any; + meta_data?: any; sku?: string; + global_unique_id?: string; price?: number; + image?: Record; + parent_name?: string; + bundled_by?: string; + bundled_item_title?: string; + bundled_items?: any; /** 创建时间 */ createdAt: string; /** 更新时间 */ @@ -570,7 +615,7 @@ declare namespace API { startDate?: string; endDate?: string; keyword?: string; - siteId?: string; + siteId?: number; purchaseType?: 'all' | 'first_purchase' | 'repeat_purchase'; orderType?: 'all' | 'cpc' | 'non_cpc'; brand?: 'all' | 'zyn' | 'yoone' | 'zolt'; @@ -867,6 +912,21 @@ declare namespace API { | 'return-approved' | 'return-cancelled'; payment_method?: string; + /** 仅订阅订单(父订阅订单或包含订阅商品) */ + isSubscriptionOnly?: boolean; + }; + + type QueryOrderItemDTO = { + /** 页码 */ + current?: number; + /** 每页大小 */ + pageSize?: number; + siteId?: string; + name?: string; + externalProductId?: string; + externalVariationId?: string; + startDate?: string; + endDate?: string; }; type QueryOrderSalesDTO = { @@ -918,6 +978,8 @@ declare namespace API { isActive?: boolean; }; + type QuerySiteDTO = {}; + type QueryStockDTO = { /** 页码 */ current?: number; @@ -965,7 +1027,7 @@ declare namespace API { | 'pending-cancel'; /** 客户邮箱 */ customer_email?: string; - /** 关键字(订阅ID、邮箱等) */ + /** 关键字(订阅ID、邮箱等) */ keyword?: string; }; @@ -1047,12 +1109,14 @@ declare namespace API { details?: ShippingDetailsDTO; stockPointId?: number; orderIds?: number[]; + shipmentPlatform?: string; }; type ShipmentFeeBookDTO = { + shipmentPlatform?: string; stockPointId?: number; sender?: string; - startPhone?: string; + startPhone?: Record; startPostalCode?: string; pickupAddress?: string; shipperCountryCode?: string; @@ -1070,6 +1134,7 @@ declare namespace API { dimensionUom?: string; weight?: number; weightUom?: string; + address_id?: number; }; type ShippingAddress = { @@ -1111,17 +1176,29 @@ declare namespace API { /** 站点 ID */ id?: string; /** 站点 URL */ - wpApiUrl?: string; + apiUrl?: string; /** 站点 rest key */ consumerKey?: string; /** 站点 rest 秘钥 */ consumerSecret?: string; /** 站点名 */ siteName?: string; - /** 站点邮箱 */ - email?: string; - /** 站点邮箱密码 */ - emailPswd?: string; + /** 平台类型 */ + type?: 'woocommerce' | 'shopyy'; + /** SKU 前缀 */ + skuPrefix?: string; + }; + + type sitecontrollerDisableParams = { + id: string; + }; + + type sitecontrollerGetParams = { + id: string; + }; + + type sitecontrollerUpdateParams = { + id: string; }; type SkuItemDTO = { @@ -1345,7 +1422,7 @@ declare namespace API { billing_interval?: number; customer_id?: number; customer_email?: string; - /** 父订单/父订阅ID(如有) */ + /** 父订单/父订阅ID(如有) */ parent_id?: number; start_date?: string; trial_end?: string; @@ -1376,7 +1453,7 @@ declare namespace API { | 'pending-cancel'; /** 客户邮箱 */ customer_email?: string; - /** 关键字(订阅ID、邮箱等) */ + /** 关键字(订阅ID、邮箱等) */ keyword?: string; }; @@ -1446,6 +1523,8 @@ declare namespace API { items?: PurchaseOrderItem[]; }; + type UpdateSiteDTO = {}; + type UpdateStockDTO = { stockPointId?: number; productSku?: string;