diff --git a/src/pages/Order/List/index.tsx b/src/pages/Order/List/index.tsx index 25d2204..3ae3da8 100644 --- a/src/pages/Order/List/index.tsx +++ b/src/pages/Order/List/index.tsx @@ -275,9 +275,9 @@ const ListPage: React.FC = () => { {(record as any)?.fulfillments?.map((item: any) => { if (!item) return; return ( -
- {item.tracking_provider} - {item.tracking_number} +
+ 物流供应商: {item.shipping_provider} + 物流单号: {item.tracking_number}
); })} diff --git a/src/pages/Product/List/EditForm.tsx b/src/pages/Product/List/EditForm.tsx index dea6ade..4b2a454 100644 --- a/src/pages/Product/List/EditForm.tsx +++ b/src/pages/Product/List/EditForm.tsx @@ -3,6 +3,7 @@ import { productcontrollerGetcategoriesall, productcontrollerGetcategoryattributes, productcontrollerGetproductcomponents, + productcontrollerGetproductlist, productcontrollerGetproductsiteskus, productcontrollerUpdateproduct, } from '@/servers/api/product'; @@ -315,17 +316,17 @@ const EditForm: React.FC<{ { const params = keyWords - ? { sku: keyWords, name: keyWords } - : { pageSize: 9999 }; - const { data } = await getStocks(params as any); + ? { where: {sku: keyWords, name: keyWords, type: 'single'} } + : { 'per_page': 9999 , where: {type: 'single'} }; + const { data } = await productcontrollerGetproductlist(params); if (!data || !data.items) { return []; } diff --git a/src/pages/Product/List/SyncToSiteModal/index.tsx b/src/pages/Product/List/SyncToSiteModal/index.tsx index 81eb1cd..0f74a9f 100644 --- a/src/pages/Product/List/SyncToSiteModal/index.tsx +++ b/src/pages/Product/List/SyncToSiteModal/index.tsx @@ -95,14 +95,15 @@ const SyncToSiteModal: React.FC = ({ } }} onFinish={async (values) => { + console.log(`values`,values) if (!values.siteId) return false; try { const siteSkusMap = values.siteSkus || {}; const data = products.map((product) => ({ productId: product.id, - siteSku: siteSkusMap[product.id] || `${values.siteId}_${product.sku}`, + siteSku: siteSkusMap[product.id] || `${values.siteId}-${product.sku}`, })); - + console.log(`data`,data) const result = await productcontrollerBatchsynctosite({ siteId: values.siteId, data, @@ -130,7 +131,7 @@ const SyncToSiteModal: React.FC = ({
原始SKU: {row.sku || '-'}
- 商品SKU:{' '} + 已有商品SKU:{' '} {row.siteSkus && row.siteSkus.length > 0 ? row.siteSkus.map((siteSku: string, idx: number) => ( diff --git a/src/pages/Product/List/components/ProductComponentList.tsx b/src/pages/Product/List/components/ProductComponentList.tsx new file mode 100644 index 0000000..621bcb6 --- /dev/null +++ b/src/pages/Product/List/components/ProductComponentList.tsx @@ -0,0 +1,53 @@ +import React from "react"; +import { ProTable, ProColumns } from "@ant-design/pro-components"; + +interface ProductComponentListProps { + record: API.Product; + columns: ProColumns[]; + dataSource?: API.Product[]; +} + +const ProductComponentList: React.FC = ({ record, columns, dataSource }) => { + if (record.type !== "bundle" || !record.components || record.components.length === 0) { + return null; + } + + const componentSkus = record.components.map(component => component.sku); + + const includedProducts = []; + + if (dataSource) { + includedProducts = dataSource + .filter(product => product.type === "single" && componentSkus.includes(product.sku)); + } + + if (includedProducts.length === 0) { + return ( +
+ 未找到包含的单品信息 +
+ ); + } + + const componentColumns = columns.filter(col => + [200~cd ../api"option", "siteSkus", "category", "type"].includes(col.dataIndex as string) + ); + + return ( +
+ +
+ ); +}; + +export default ProductComponentList; diff --git a/src/pages/Product/List/index.tsx b/src/pages/Product/List/index.tsx index 799017f..71a184b 100644 --- a/src/pages/Product/List/index.tsx +++ b/src/pages/Product/List/index.tsx @@ -67,16 +67,7 @@ const AttributesCell: React.FC<{ record: any }> = ({ record }) => { ); }; -const ComponentsCell: React.FC<{ productId: number }> = ({ productId }) => { - const [components, setComponents] = React.useState([]); - React.useEffect(() => { - (async () => { - const { data = [] } = await productcontrollerGetproductcomponents({ - id: productId, - }); - setComponents(data || []); - })(); - }, [productId]); +const ComponentsCell: React.FC<{ components?: any[] }> = ({ components }) => { return (
{components && components.length ? ( @@ -163,7 +154,28 @@ const BatchEditModal: React.FC<{ ); }; +const ProductList = ({ filter, columns }: { filter: { skus: string[] },columns: any[] }) => { + return ( + { + const { data, success } = await productcontrollerGetproductlist({ + where: filter + }); + if (!success) return []; + return data || []; + }} + columns={columns} + pagination={false} + rowKey="id" + bordered + size="small" + scroll={{ x: "max-content" }} + headerTitle={null} + toolBarRender={false} + /> + ); +}; const List: React.FC = () => { const actionRef = useRef(); @@ -282,7 +294,7 @@ const List: React.FC = () => { title: '构成', dataIndex: 'components', hideInSearch: true, - render: (_, record) => , + render: (_, record) => , }, { @@ -509,15 +521,16 @@ const List: React.FC = () => { }} columns={columns} // expandable={{ - // expandedRowRender: (record) => ( - // - // ), + // expandedRowRender: (record) => { + // return component.sku) || [], + // }} + // columns={columns} + // > + // } + // , // rowExpandable: (record) => - // !!(record.siteSkus && record.siteSkus.length > 0), + // !!(record.type==='bundle'), // }} editable={{ type: 'single', @@ -553,4 +566,5 @@ const List: React.FC = () => { ); }; + export default List; diff --git a/src/servers/api/product.ts b/src/servers/api/product.ts index 4234c67..d23b585 100644 --- a/src/servers/api/product.ts +++ b/src/servers/api/product.ts @@ -588,10 +588,6 @@ export async function productcontrollerGetproductlist( method: 'GET', params: { ...params, - where: undefined, - ...params['where'], - orderBy: undefined, - ...params['orderBy'], }, ...(options || {}), }); diff --git a/src/servers/api/siteApi.ts b/src/servers/api/siteApi.ts index 1884c2a..9f2de0e 100644 --- a/src/servers/api/siteApi.ts +++ b/src/servers/api/siteApi.ts @@ -15,10 +15,6 @@ export async function siteapicontrollerGetcustomers( method: 'GET', params: { ...queryParams, - where: undefined, - ...queryParams['where'], - orderBy: undefined, - ...queryParams['orderBy'], }, ...(options || {}), }, @@ -74,10 +70,6 @@ export async function siteapicontrollerExportcustomers( method: 'GET', params: { ...queryParams, - where: undefined, - ...queryParams['where'], - orderBy: undefined, - ...queryParams['orderBy'], }, ...(options || {}), }); @@ -127,10 +119,6 @@ export async function siteapicontrollerGetmedia( method: 'GET', params: { ...queryParams, - where: undefined, - ...queryParams['where'], - orderBy: undefined, - ...queryParams['orderBy'], }, ...(options || {}), }); @@ -210,10 +198,6 @@ export async function siteapicontrollerExportmedia( method: 'GET', params: { ...queryParams, - where: undefined, - ...queryParams['where'], - orderBy: undefined, - ...queryParams['orderBy'], }, ...(options || {}), }); @@ -230,10 +214,6 @@ export async function siteapicontrollerGetorders( method: 'GET', params: { ...queryParams, - where: undefined, - ...queryParams['where'], - orderBy: undefined, - ...queryParams['orderBy'], }, ...(options || {}), }); @@ -313,10 +293,6 @@ export async function siteapicontrollerExportorders( method: 'GET', params: { ...queryParams, - where: undefined, - ...queryParams['where'], - orderBy: undefined, - ...queryParams['orderBy'], }, ...(options || {}), }); @@ -354,10 +330,6 @@ export async function siteapicontrollerGetproducts( method: 'GET', params: { ...queryParams, - where: undefined, - ...queryParams['where'], - orderBy: undefined, - ...queryParams['orderBy'], }, ...(options || {}), }, @@ -438,10 +410,6 @@ export async function siteapicontrollerExportproducts( method: 'GET', params: { ...queryParams, - where: undefined, - ...queryParams['where'], - orderBy: undefined, - ...queryParams['orderBy'], }, ...(options || {}), }); @@ -458,10 +426,6 @@ export async function siteapicontrollerExportproductsspecial( method: 'GET', params: { ...queryParams, - where: undefined, - ...queryParams['where'], - orderBy: undefined, - ...queryParams['orderBy'], }, ...(options || {}), }); @@ -540,10 +504,6 @@ export async function siteapicontrollerGetreviews( method: 'GET', params: { ...queryParams, - where: undefined, - ...queryParams['where'], - orderBy: undefined, - ...queryParams['orderBy'], }, ...(options || {}), }, @@ -582,10 +542,6 @@ export async function siteapicontrollerGetsubscriptions( method: 'GET', params: { ...queryParams, - where: undefined, - ...queryParams['where'], - orderBy: undefined, - ...queryParams['orderBy'], }, ...(options || {}), }, @@ -603,10 +559,6 @@ export async function siteapicontrollerExportsubscriptions( method: 'GET', params: { ...queryParams, - where: undefined, - ...queryParams['where'], - orderBy: undefined, - ...queryParams['orderBy'], }, ...(options || {}), }); @@ -623,10 +575,6 @@ export async function siteapicontrollerGetwebhooks( method: 'GET', params: { ...queryParams, - where: undefined, - ...queryParams['where'], - orderBy: undefined, - ...queryParams['orderBy'], }, ...(options || {}), }); @@ -720,10 +668,6 @@ export async function siteapicontrollerGetcustomerorders( method: 'GET', params: { ...queryParams, - where: undefined, - ...queryParams['where'], - orderBy: undefined, - ...queryParams['orderBy'], }, ...(options || {}), }, diff --git a/src/servers/api/typings.d.ts b/src/servers/api/typings.d.ts index fa7b3b7..7255e7e 100644 --- a/src/servers/api/typings.d.ts +++ b/src/servers/api/typings.d.ts @@ -1189,9 +1189,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; }; type productcontrollerGetproductsiteskusParams = { @@ -1717,9 +1717,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; siteId: number; }; @@ -1735,9 +1735,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; siteId: number; }; @@ -1753,9 +1753,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; siteId: number; }; @@ -1771,9 +1771,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; siteId: number; }; @@ -1789,9 +1789,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; siteId: number; }; @@ -1807,9 +1807,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; siteId: number; }; @@ -1830,9 +1830,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; customerId: number; siteId: number; }; @@ -1854,9 +1854,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; siteId: number; }; @@ -1876,9 +1876,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; siteId: number; }; @@ -1904,9 +1904,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; siteId: number; }; @@ -1932,9 +1932,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; siteId: number; }; @@ -1950,9 +1950,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; siteId: number; }; @@ -1968,9 +1968,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; siteId: number; }; @@ -1991,9 +1991,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; siteId: number; }; @@ -2942,9 +2942,9 @@ declare namespace API { /** 搜索关键词 */ search?: string; /** 过滤条件对象 */ - where?: Record; + where?: any; /** 排序对象,例如 { "sku": "desc" } */ - orderBy?: Record; + orderBy?: any; }; type UnifiedShippingLineDTO = {