feat: 添加产品工具, 重构产品 #31

Closed
zksu wants to merge 37 commits from (deleted):main into main
13 changed files with 844 additions and 158 deletions
Showing only changes of commit 2e9c7fafce - Show all commits

View File

@ -310,6 +310,11 @@ export default defineConfig({
changeOrigin: true,
pathRewrite: { '^/api': '' },
},
'/site-api': {
target: UMI_APP_API_URL,
changeOrigin: true,
pathRewrite: { '^/site-api': '/site-api' },
},
},
npmClient: 'pnpm',
});

View File

@ -102,12 +102,33 @@ const AttributePage: React.FC = () => {
// 删除字典项
const handleDeleteDictItem = async (itemId: number) => {
try {
const success = await request(`/dict/item/${itemId}`, { method: 'DELETE' });
if (success) {
message.success('删除成功');
actionRef.current?.reload(); // 刷新 ProTable
} else {
const res = await request(`/dict/item/${itemId}`, { method: 'DELETE' });
const isOk =
typeof res === 'boolean'
? res
: res && res.code === 0
? res.data === true || res.data === null
: false;
if (!isOk) {
message.error('删除失败');
return;
}
if (selectedDict?.id) {
const list = await request('/dict/items', {
params: {
dictId: selectedDict.id,
},
});
const exists = Array.isArray(list) && list.some((it: any) => it.id === itemId);
if (exists) {
message.error('删除失败');
} else {
message.success('删除成功');
actionRef.current?.reload();
}
} else {
message.success('删除成功');
actionRef.current?.reload();
}
} catch (error) {
message.error('删除失败');

View File

@ -2,8 +2,10 @@ import {
productcontrollerGetcategoriesall,
productcontrollerGetcategoryattributes,
productcontrollerGetproductcomponents,
productcontrollerGetproductsiteskus,
productcontrollerUpdateproduct,
} from '@/servers/api/product';
import { sitecontrollerAll } from '@/servers/api/site';
import { stockcontrollerGetstocks as getStocks } from '@/servers/api/stock';
import {
ActionType,
@ -33,6 +35,8 @@ const EditForm: React.FC<{
const [stockStatus, setStockStatus] = useState<
'in-stock' | 'out-of-stock' | null
>(null);
const [siteSkuEntries, setSiteSkuEntries] = useState<any[]>([]);
const [sites, setSites] = useState<any[]>([]);
const [categories, setCategories] = useState<any[]>([]);
const [activeAttributes, setActiveAttributes] = useState<any[]>([]);
@ -41,6 +45,10 @@ const EditForm: React.FC<{
productcontrollerGetcategoriesall().then((res: any) => {
setCategories(res?.data || []);
});
// 获取站点列表用于站点SKU选择
sitecontrollerAll().then((res: any) => {
setSites(res?.data || []);
});
}, []);
useEffect(() => {
@ -86,6 +94,9 @@ const EditForm: React.FC<{
const { data: componentsData } =
await productcontrollerGetproductcomponents({ id: record.id });
setComponents(componentsData || []);
// 获取站点SKU详细信息
const { data: siteSkusData } = await productcontrollerGetproductsiteskus({ id: record.id });
setSiteSkuEntries(siteSkusData || []);
})();
}, [record]);
@ -106,9 +117,10 @@ const EditForm: React.FC<{
components: components,
type: type,
categoryId: (record as any).categoryId || (record as any).category?.id,
siteSkus: (record as any).siteSkus?.map((s: any) => s.code) || [],
// 初始化站点SKU列表为对象形式
siteSkus: siteSkuEntries && siteSkuEntries.length ? siteSkuEntries : [],
};
}, [record, components, type]);
}, [record, components, type, siteSkuEntries]);
return (
<DrawerForm<any>
@ -211,13 +223,41 @@ const EditForm: React.FC<{
</Tag>
)}
</ProForm.Group>
<ProFormSelect
<ProFormList
name="siteSkus"
label="站点 SKU 列表"
width="md"
mode="tags"
placeholder="输入站点 SKU,回车添加"
/>
label="站点SKU"
creatorButtonProps={{ position: 'bottom', creatorButtonText: '新增站点SKU' }}
itemRender={({ listDom, action }) => (
<div style={{ marginBottom: 8, display: 'flex', flexDirection: 'row', alignItems: 'end' }}>
{listDom}
{action}
</div>
)}
>
<ProForm.Group>
<ProFormSelect
name="siteId"
label="站点"
width="md"
options={sites.map((site) => ({ label: site.name, value: site.id }))}
placeholder="请选择站点"
rules={[{ required: true, message: '请选择站点' }]}
/>
<ProFormText
name="code"
label="站点SKU"
width="md"
placeholder="请输入站点SKU"
rules={[{ required: true, message: '请输入站点SKU' }]}
/>
<ProFormText
name="quantity"
label="数量"
width="md"
placeholder="请输入数量"
/>
</ProForm.Group>
</ProFormList>
<ProForm.Group>
<ProFormText

View File

@ -6,6 +6,7 @@ import {
productcontrollerGetproductcomponents,
productcontrollerGetproductlist,
productcontrollerUpdatenamecn,
productcontrollerBindproductsiteskus,
} from '@/servers/api/product';
import { sitecontrollerAll } from '@/servers/api/site';
import {
@ -13,6 +14,7 @@ import {
wpproductcontrollerGetwpproducts,
wpproductcontrollerSynctoproduct,
} from '@/servers/api/wpProduct';
import { siteapicontrollerGetproducts } from '@/servers/api/siteApi';
import { ActionType, ModalForm, PageContainer, ProColumns, ProFormSelect, ProFormText, ProTable } from '@ant-design/pro-components';
import { request } from '@umijs/max';
import { App, Button, Modal, Popconfirm, Tag, Upload } from 'antd';
@ -167,10 +169,12 @@ const SyncToSiteModal: React.FC<{
visible: boolean;
onClose: () => void;
productIds: number[];
productRows: API.Product[];
onSuccess: () => void;
}> = ({ visible, onClose, productIds, onSuccess }) => {
}> = ({ visible, onClose, productIds, productRows, onSuccess }) => {
const { message } = App.useApp();
const [sites, setSites] = useState<any[]>([]);
const formRef = useRef<any>();
useEffect(() => {
if (visible) {
@ -186,6 +190,22 @@ const SyncToSiteModal: React.FC<{
open={visible}
onOpenChange={(open) => !open && onClose()}
modalProps={{ destroyOnClose: true }}
formRef={formRef}
onValuesChange={(changedValues) => {
if ('siteId' in changedValues && changedValues.siteId) {
const siteId = changedValues.siteId;
const site = sites.find((s: any) => s.id === siteId) || {};
const prefix = site.skuPrefix || '';
const map: Record<string, any> = {};
productRows.forEach((p) => {
map[p.id] = {
code: `${prefix}${p.sku || ''}`,
quantity: undefined,
};
});
formRef.current?.setFieldsValue({ productSiteSkus: map });
}
}}
onFinish={async (values) => {
if (!values.siteId) return false;
try {
@ -193,6 +213,16 @@ const SyncToSiteModal: React.FC<{
{ siteId: values.siteId },
{ productIds }
);
const map = values.productSiteSkus || {};
for (const currentProductId of productIds) {
const entry = map?.[currentProductId];
if (entry && entry.code) {
await productcontrollerBindproductsiteskus(
{ id: currentProductId },
{ siteSkus: [{ siteId: values.siteId, code: entry.code, quantity: entry.quantity }] }
);
}
}
message.success('同步任务已提交');
onSuccess();
return true;
@ -208,6 +238,21 @@ const SyncToSiteModal: React.FC<{
options={sites.map((site) => ({ label: site.name, value: site.id }))}
rules={[{ required: true, message: '请选择站点' }]}
/>
{productRows.map((row) => (
<div key={row.id} style={{ display: 'flex', gap: 12, alignItems: 'flex-end' }}>
<div style={{ minWidth: 220 }}>SKU: {row.sku || '-'}</div>
<ProFormText
name={['productSiteSkus', row.id, 'code']}
label={`商品 ${row.id} 站点SKU`}
placeholder="请输入站点SKU"
/>
<ProFormText
name={['productSiteSkus', row.id, 'quantity']}
label="数量"
placeholder="请输入数量"
/>
</div>
))}
</ModalForm>
);
};
@ -237,37 +282,46 @@ const WpProductInfo: React.FC<{ skus: string[]; record: API.Product; parentTable
</Button>,
]}
request={async () => {
// 判断是否存在站点SKU列表
if (!skus || skus.length === 0) return { data: [] };
const { data } = await wpproductcontrollerGetwpproducts(
{
skus,
pageSize: 100,
current: 1,
},
{
paramsSerializer: (params: any) => {
const searchParams = new URLSearchParams();
Object.keys(params).forEach((key) => {
const value = params[key];
if (Array.isArray(value)) {
value.forEach((v) => searchParams.append(key, v));
} else if (value !== undefined && value !== null) {
searchParams.append(key, value);
}
try {
// 获取所有站点列表用于遍历查询
const { data: siteResponse } = await sitecontrollerAll();
const siteList = siteResponse || [];
// 聚合所有站点的产品数据
const aggregatedProducts: any[] = [];
// 遍历每一个站点
for (const siteItem of siteList) {
// 遍历每一个SKU在当前站点进行搜索
for (const skuCode of skus) {
// 直接调用站点API根据搜索关键字获取产品列表
const { data: productPage } = await siteapicontrollerGetproducts({
siteId: siteItem.id,
per_page: 100,
search: skuCode,
});
return searchParams.toString();
},
},
);
return {
data: data?.items || [],
success: true,
};
const siteProducts = productPage?.items || [];
// 将站点信息附加到产品数据中便于展示
siteProducts.forEach((p: any) => {
aggregatedProducts.push({
...p,
siteId: siteItem.id,
siteName: siteItem.name,
});
});
}
}
return { data: aggregatedProducts, success: true };
} catch (error: any) {
// 请求失败进行错误提示
message.error(error?.message || '获取站点产品失败');
return { data: [], success: false };
}
}}
columns={[
{
title: '站点',
dataIndex: ['site', 'name'],
dataIndex: 'siteName',
},
{
title: 'SKU',
@ -699,6 +753,7 @@ const List: React.FC = () => {
visible={syncModalVisible}
onClose={() => setSyncModalVisible(false)}
productIds={syncProductIds}
productRows={selectedRows}
onSuccess={() => {
setSyncModalVisible(false);
setSelectedRows([]);

View File

@ -296,7 +296,45 @@ const PermutationPage: React.FC = () => {
}}
scroll={{ x: 'max-content' }}
search={false}
toolBarRender={false}
toolBarRender={() => [
<Button key="export" onClick={() => {
const exportColumns = columns.filter((c: any) => c.key !== 'action');
const headers = exportColumns.map((c: any) => String(c.title ?? ''));
const escapeCsv = (val: any) => {
const s = val === undefined || val === null ? '' : String(val);
if (/[",\n]/.test(s)) {
return '"' + s.replace(/"/g, '""') + '"';
}
return s;
};
const rows: string[][] = permutations.map((record: any) => {
return exportColumns.map((c: any) => {
if (c.key === 'sku') {
const key = generateKeyFromPermutation(record);
const product = existingProducts.get(key);
const value = product?.sku || '';
return escapeCsv(value);
}
const valueItem = c.dataIndex ? record[c.dataIndex] : undefined;
const value = valueItem?.name || '';
return escapeCsv(value);
});
});
const csvContent = [headers, ...rows].map(row => row.join(',')).join('\n');
const blob = new Blob(['\ufeff' + csvContent], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
const categoryName = categories.find(c => c.id === categoryId)?.name || 'Export';
link.href = url;
link.download = categoryName + '-permutations.csv';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
}}>
CSV
</Button>
]}
/>
)}
</ProCard>

View File

@ -1,6 +1,6 @@
import { ActionType, DrawerForm, ModalForm, PageContainer, ProColumns, ProFormText, ProFormTextArea, ProTable } from '@ant-design/pro-components';
import { request, useParams } from '@umijs/max';
import { App, Avatar, Button, Popconfirm, Space, Tag } from 'antd';
import { App, Avatar, Button, Modal, Popconfirm, Space, Tag } from 'antd';
import React, { useRef, useState } from 'react';
import { DeleteFilled, EditOutlined, PlusOutlined, UserOutlined } from '@ant-design/icons';
@ -62,6 +62,8 @@ const CustomerPage: React.FC = () => {
const [editing, setEditing] = useState<any>(null);
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
const actionRef = useRef<ActionType>();
const [ordersVisible, setOrdersVisible] = useState<boolean>(false);
const [ordersCustomer, setOrdersCustomer] = useState<any>(null);
const handleDelete = async (id: number) => {
if (!siteId) return;
@ -90,9 +92,25 @@ const CustomerPage: React.FC = () => {
return <Avatar src={avatarUrl} icon={<UserOutlined />} size="large" />;
},
},
{
title: '姓名',
dataIndex: 'name',
hideInTable: true,
},
{
title: 'ID',
dataIndex: 'id',
hideInSearch: true,
width: 120,
copyable: true,
render: (_, record) => {
return record?.id ?? '-';
}
},
{
title: '姓名',
dataIndex: 'username',
hideInSearch: true,
render: (_, record) => {
// DTO中有first_name和last_name字段username可能从raw数据中获取
const username = record.username || record.raw?.username || 'N/A';
@ -126,6 +144,18 @@ const CustomerPage: React.FC = () => {
return <Tag color="blue">{role}</Tag>;
},
},
{
title: '订单数',
dataIndex: 'orders',
sorter: true,
hideInSearch: true,
},
{
title: '总花费',
dataIndex: 'total_spend',
sorter: true,
hideInSearch: true,
},
{
title: '账单地址',
dataIndex: 'billing',
@ -143,6 +173,23 @@ const CustomerPage: React.FC = () => {
);
},
},
{
title: '收货地址',
dataIndex: 'shipping',
hideInSearch: true,
render: (_, record) => {
const { shipping } = record;
if (!shipping) return '-';
return (
<div style={{ fontSize: 12 }}>
<div>{shipping.address_1} {shipping.address_2}</div>
<div>{shipping.city}, {shipping.state}, {shipping.postcode}</div>
<div>{shipping.country}</div>
<div>{shipping.phone}</div>
</div>
);
},
},
{
title: '注册时间',
dataIndex: 'date_created',
@ -153,12 +200,16 @@ const CustomerPage: React.FC = () => {
title: '操作',
valueType: 'option',
width: 120,
fixed:"right",
render: (_, record) => (
<Space>
<Button type="link" title="编辑" icon={<EditOutlined />} onClick={() => setEditing(record)} />
<Popconfirm title="确定删除?" onConfirm={() => handleDelete(record.id)}>
<Button type="link" danger title="删除" icon={<DeleteFilled />} />
</Popconfirm>
<Button type="link" title="查询订单" onClick={() => { setOrdersCustomer(record); setOrdersVisible(true); }}>
</Button>
</Space>
),
},
@ -175,17 +226,36 @@ const CustomerPage: React.FC = () => {
<ProTable
rowKey="id"
columns={columns}
search={false}
options={false}
search={{ labelWidth: 'auto' }}
options={{ reload: true }}
actionRef={actionRef}
scroll={{ x: 'max-content' }}
rowSelection={{
selectedRowKeys,
onChange: setSelectedRowKeys,
}}
request={async (params) => {
request={async (params, sort, filter) => {
if (!siteId) return { data: [], total: 0, success: true };
const { current, pageSize, name, email, ...rest } = params || {};
const where = { ...rest, ...(filter || {}) };
if (email) {
(where as any).email = email;
}
let orderObj: Record<string, 'asc' | 'desc'> | undefined = undefined;
if (sort && typeof sort === 'object') {
const [field, dir] = Object.entries(sort)[0] || [];
if (field && dir) {
orderObj = { [field]: dir === 'descend' ? 'desc' : 'asc' };
}
}
const response = await request(`/site-api/${siteId}/customers`, {
params: { page: params.current, per_page: params.pageSize },
params: {
page: current,
page_size: pageSize,
where,
...(orderObj ? { order: orderObj } : {}),
...((name || email) ? { search: name || email } : {}),
},
});
if (!response.success) {
@ -198,9 +268,21 @@ const CustomerPage: React.FC = () => {
}
const data = response.data;
let items = (data?.items || []) as any[];
if (sort && typeof sort === 'object') {
const [field, dir] = Object.entries(sort)[0] || [];
if (field === 'orders' || field === 'total_spend') {
const isDesc = dir === 'descend';
items = items.slice().sort((a, b) => {
const av = Number(a?.[field] ?? 0);
const bv = Number(b?.[field] ?? 0);
return isDesc ? bv - av : av - bv;
});
}
}
return {
total: data?.total || 0,
data: data?.items || [],
data: items,
success: true,
};
}}
@ -236,7 +318,8 @@ const CustomerPage: React.FC = () => {
title="批量导出"
onClick={async () => {
if (!siteId) return;
const res = await request(`/site-api/${siteId}/customers/export`, { params: {} });
const idsParam = selectedRowKeys.length ? (selectedRowKeys as any[]).join(',') : undefined;
const res = await request(`/site-api/${siteId}/customers/export`, { params: { ids: idsParam } });
if (res?.success && res?.data?.csv) {
const blob = new Blob([res.data.csv], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
@ -315,6 +398,47 @@ const CustomerPage: React.FC = () => {
<ProFormText name="username" label="用户名" />
<ProFormText name="phone" label="电话" />
</DrawerForm>
<Modal
open={ordersVisible}
onCancel={() => { setOrdersVisible(false); setOrdersCustomer(null); }}
footer={null}
width={1000}
title="客户订单"
destroyOnClose
>
<ProTable
rowKey="id"
search={false}
pagination={{ pageSize: 20 }}
columns={[
{ title: '订单ID', dataIndex: 'id' },
{ title: '订单号', dataIndex: 'number' },
{ title: '状态', dataIndex: 'status' },
{ title: '币种', dataIndex: 'currency' },
{ title: '金额', dataIndex: 'total' },
{ title: '创建时间', dataIndex: 'date_created', valueType: 'dateTime' },
]}
request={async (params) => {
if (!siteId || !ordersCustomer?.id) return { data: [], total: 0, success: true };
const res = await request(`/site-api/${siteId}/customers/${ordersCustomer.id}/orders`, {
params: {
page: params.current,
page_size: params.pageSize,
},
});
if (!res?.success) {
message.error(res?.message || '获取订单失败');
return { data: [], total: 0, success: false };
}
const data = res.data || {};
return {
data: data.items || [],
total: data.total || 0,
success: true,
};
}}
/>
</Modal>
</PageContainer>
);
};

View File

@ -209,28 +209,41 @@ const LogisticsPage: React.FC = () => {
<Button onClick={handleBatchPrint} type="primary">
</Button>
<Button
danger
type="primary"
onClick={async () => {
<Popconfirm
title="确定批量删除选中项吗?"
okText="确定"
cancelText="取消"
onConfirm={async () => {
// 条件判断 如果当前未选择任何行则直接返回
if (!selectedRows || selectedRows.length === 0) return;
try {
// 进入批量删除处理流程
setIsLoading(true);
let ok = 0;
let successCount = 0;
for (const row of selectedRows) {
const { success } = await logisticscontrollerDeleteshipment({ id: row.id });
if (success) ok++;
// 逐条删除 每次调用服务端删除接口
const { success } = await logisticscontrollerDeleteshipment({ id: row.id });
// 条件判断 累计成功次数
if (success) successCount++;
}
message.success(`成功删除 ${ok}`);
// 删除完成后提示成功条数
message.success(`成功删除 ${successCount}`);
// 结束加载状态
setIsLoading(false);
// 刷新表格数据
actionRef.current?.reload();
// 清空选择列表
setSelectedRows([]);
} catch (e) {
// 异常处理 结束加载状态
setIsLoading(false);
}
}}
>
</Button>
<Button danger type="primary">
</Button>
</Popconfirm>
</Space>
);
}}

View File

@ -54,6 +54,16 @@ const MediaPage: React.FC = () => {
};
const columns: ProColumns<any>[] = [
{
title: 'ID',
dataIndex: 'id',
hideInSearch: true,
width: 120,
copyable: true,
render: (_, record) => {
return record?.id ?? '-';
}
},
{
title: '展示',
dataIndex: 'source_url',
@ -136,13 +146,22 @@ const MediaPage: React.FC = () => {
actionRef={actionRef}
columns={columns}
rowSelection={{ selectedRowKeys, onChange: setSelectedRowKeys }}
request={async (params) => {
scroll={{ x: 'max-content' }}
request={async (params, sort) => {
if (!siteId) return { data: [], total: 0 };
const { current, pageSize } = params || {};
let orderObj: Record<string, 'asc' | 'desc'> | undefined = undefined;
if (sort && typeof sort === 'object') {
const [field, dir] = Object.entries(sort)[0] || [];
if (field && dir) {
orderObj = { [field]: dir === 'descend' ? 'desc' : 'asc' };
}
}
const response = await request(`/site-api/${siteId}/media`, {
params: {
page: params.current,
per_page: params.pageSize,
page: current,
page_size: pageSize,
...(orderObj ? { order: orderObj } : {}),
},
});
@ -164,7 +183,7 @@ const MediaPage: React.FC = () => {
};
}}
search={false}
options={false}
options={{ reload: true }}
toolBarRender={() => [
<ModalForm
title="上传媒体"
@ -219,7 +238,8 @@ const MediaPage: React.FC = () => {
title="批量导出"
onClick={async () => {
if (!siteId) return;
const res = await request(`/site-api/${siteId}/media/export`, { params: {} });
const idsParam = selectedRowKeys.length ? (selectedRowKeys as any[]).join(',') : undefined;
const res = await request(`/site-api/${siteId}/media/export`, { params: { ids: idsParam } });
if (res?.success && res?.data?.csv) {
const blob = new Blob([res.data.csv], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
@ -233,23 +253,35 @@ const MediaPage: React.FC = () => {
}
}}
/>,
<Button
title="批量删除"
danger
icon={<DeleteOutlined />}
<Popconfirm
title="确定批量删除选中项吗?"
okText="确定"
cancelText="取消"
disabled={!selectedRowKeys.length}
onClick={async () => {
onConfirm={async () => {
// 条件判断 如果站点編號不存在則直接返回
if (!siteId) return;
const res = await request(`/site-api/${siteId}/media/batch`, { method: 'POST', data: { delete: selectedRowKeys } });
if (res.success) {
// 发起批量删除请求
const response = await request(`/site-api/${siteId}/media/batch`, { method: 'POST', data: { delete: selectedRowKeys } });
// 条件判断 根据接口返回结果进行提示
if (response.success) {
message.success('批量删除成功');
} else {
message.warning(res.message || '部分删除失败');
message.warning(response.message || '部分删除失败');
}
// 清空已选择的行鍵值
setSelectedRowKeys([]);
// 刷新列表数据
actionRef.current?.reload();
}}
/>
>
<Button
title="批量删除"
danger
icon={<DeleteOutlined />}
disabled={!selectedRowKeys.length}
/>
</Popconfirm>
]}
/>

View File

@ -6,7 +6,7 @@ import {
} from '@/servers/api/order';
import { formatShipmentState, formatSource } from '@/utils/format';
import {
DownOutlined,
EllipsisOutlined,
} from '@ant-design/icons';
import {
ActionType,
@ -46,6 +46,7 @@ const OrdersPage: React.FC = () => {
}, [siteId]);
const tabs: TabsProps['items'] = useMemo(() => {
// 统计全部数量,依赖状态统计数组
const total = count.reduce((acc, cur) => acc + Number(cur.count), 0);
const tabs = [
{ key: 'pending', label: '待确认' },
@ -56,10 +57,12 @@ const OrdersPage: React.FC = () => {
{ key: 'failed', label: '失败' },
{ key: 'after_sale_pending', label: '售后处理中' },
{ key: 'pending_reshipment', label: '待补发' },
// 退款相关状态
{ key: 'refund_requested', label: '已申请退款' },
{ key: 'refund_approved', label: '退款' },
{ key: 'refund_cancelled', label: '已完成' },
{ key: 'refund_approved', label: '退款申请已通过' },
{ key: 'refund_cancelled', label: '已取消退款' },
].map((v) => {
// 根据状态键匹配统计数量
const number = count.find((el) => el.status === v.key)?.count || '0';
return {
label: `${v.label}(${number})`,
@ -176,10 +179,7 @@ const OrdersPage: React.FC = () => {
],
}}
>
<a onClick={(e) => e.preventDefault()}>
<Button type="link" icon={<DownOutlined />}>
</Button>
</a>
<Button type="text" icon={<EllipsisOutlined />} />
</Dropdown>
<Popconfirm
title="确定删除订单?"
@ -256,7 +256,8 @@ const OrdersPage: React.FC = () => {
<Button
onClick={async () => {
if (!siteId) return;
const res = await request(`/site-api/${siteId}/orders/export`, { params: {} });
const idsParam = selectedRowKeys.length ? (selectedRowKeys as any[]).join(',') : undefined;
const res = await request(`/site-api/${siteId}/orders/export`, { params: { ids: idsParam } });
if (res?.success && res?.data?.csv) {
const blob = new Blob([res.data.csv], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
@ -293,28 +294,39 @@ const OrdersPage: React.FC = () => {
</ModalForm>
]}
request={async ({ date, ...param }: any) => {
if (param.status === 'all') {
delete param.status;
request={async (params, sort, filter) => {
const p: any = params || {};
const current = p.current;
const pageSize = p.pageSize;
const date = p.date;
const status = p.status;
const { current: _c, pageSize: _ps, date: _d, status: _s, ...rest } = p;
const where: Record<string, any> = { ...(filter || {}), ...rest };
if (status && status !== 'all') {
where.status = status;
}
if (date) {
const [startDate, endDate] = date;
param.startDate = `${startDate} 00:00:00`;
param.endDate = `${endDate} 23:59:59`;
// 将日期范围转为后端筛选参数
where.startDate = `${startDate} 00:00:00`;
where.endDate = `${endDate} 23:59:59`;
}
let orderObj: Record<string, 'asc' | 'desc'> | undefined = undefined;
if (sort && typeof sort === 'object') {
const [field, dir] = Object.entries(sort)[0] || [];
if (field && dir) {
orderObj = { [field]: dir === 'descend' ? 'desc' : 'asc' };
}
}
// Inject siteId
// if (siteId) {
// param.siteId = Number(siteId);
// }
const response = await request(`/site-api/${siteId}/orders`, {
params: {
...param,
page: param.current,
per_page: param.pageSize,
page: current,
page_size: pageSize,
where,
...(orderObj ? { order: orderObj } : {}),
}
});
if (!response.success) {
message.error(response.message || '获取订单列表失败');
return {
@ -324,21 +336,64 @@ const OrdersPage: React.FC = () => {
}
const { data } = response;
// Assuming data has items and count (if backend returns count for tabs)
// My unified API currently returns items, total, etc.
// It DOES NOT return 'count' for tabs (order counts by status).
// The frontend relies on `data.count` to populate tabs.
// If I don't provide it, tabs will show 0.
// I should update backend to return counts or just accept 0 for now.
// The user asked to "get all data via site api".
// WC API has `/reports/orders/totals`? Or I have to count manually?
// WC `orders` endpoint doesn't return counts by status.
// So I might lose this feature or need to implement it in backend `getOrders` by making parallel requests or using a report endpoint.
// For now I'll just set count to empty or basic.
// I'll set setCount([]) to avoid crash.
// 计算顶部状态数量,通过按状态并发查询站点接口
if (siteId) {
try {
// 定义需要统计的状态键集合
const statusKeys: string[] = [
'pending',
'processing',
'completed',
'cancelled',
'refunded',
'failed',
// 站点接口不支持的扩展状态,默认统计为0
'after_sale_pending',
'pending_reshipment',
'refund_requested',
'refund_approved',
'refund_cancelled',
];
// 构造基础筛选参数,移除当前状态避免重复过滤
const { status: _status, ...baseWhere } = where;
// 并发请求各状态的总数,对站点接口不支持的状态使用0
const results = await Promise.all(
statusKeys.map(async key => {
// 将前端退款状态映射为站点接口可能识别的原始状态
const mapToRawStatus: Record<string, string> = {
refund_requested: 'return-requested',
refund_approved: 'return-approved',
refund_cancelled: 'return-cancelled',
};
const rawStatus = mapToRawStatus[key] || key;
// 对扩展状态直接返回0,减少不必要的请求
const unsupported = ['after_sale_pending', 'pending_reshipment'];
if (unsupported.includes(key)) {
return { status: key, count: 0 };
}
try {
const res = await request(`/site-api/${siteId}/orders`, {
params: {
page: 1,
page_size: 1,
where: { ...baseWhere, status: rawStatus },
},
});
const totalCount = Number(res?.data?.total || 0);
return { status: key, count: totalCount };
} catch (err) {
// 请求失败时该状态数量记为0
return { status: key, count: 0 };
}
})
);
setCount(results);
} catch (e) {
// 统计失败时不影响列表展示
}
}
if (data) {
// setCount(data?.count || []); // My API doesn't return count yet.
return {
total: data?.total || 0,
data: data?.items || [],

View File

@ -1,4 +1,4 @@
import { PRODUCT_STATUS_ENUM } from '@/constants';
import { PRODUCT_STATUS_ENUM, PRODUCT_STOCK_STATUS_ENUM } from '@/constants';
import { request } from '@umijs/max';
import { useParams } from '@umijs/max';
import {
@ -87,6 +87,16 @@ const ProductsPage: React.FC = () => {
}, []);
const columns: ProColumns<any>[] = [
{
title: 'ID',
dataIndex: 'id',
hideInSearch: true,
width: 120,
copyable: true,
render: (_, record) => {
return record?.id ?? '-';
}
},
{
title: 'sku',
dataIndex: 'sku',
@ -106,6 +116,12 @@ const ProductsPage: React.FC = () => {
title: '产品类型',
dataIndex: 'type',
},
{
title: '库存状态',
dataIndex: 'stock_status',
valueType: 'select',
valueEnum: PRODUCT_STOCK_STATUS_ENUM,
},
{
title: '库存',
dataIndex: 'stock_quantity',
@ -192,12 +208,22 @@ const ProductsPage: React.FC = () => {
setSelectedRows(rows);
},
}}
request={async (params) => {
request={async (params, sort, filter) => {
const { current, pageSize, ...rest } = params || {};
const where = { ...rest, ...(filter || {}) };
let orderObj: Record<string, 'asc' | 'desc'> | undefined = undefined;
if (sort && typeof sort === 'object') {
const [field, dir] = Object.entries(sort)[0] || [];
if (field && dir) {
orderObj = { [field]: dir === 'descend' ? 'desc' : 'asc' };
}
}
const response = await request(`/site-api/${siteId}/products`, {
params: {
...params,
page: params.current,
per_page: params.pageSize,
page: current,
page_size: pageSize,
where,
...(orderObj ? { order: orderObj } : {}),
}
});
@ -227,7 +253,6 @@ const ProductsPage: React.FC = () => {
selectedRowKeys={selectedRowKeys}
setSelectedRowKeys={setSelectedRowKeys}
selectedRows={selectedRows}
config={config}
siteId={siteId}
/>,
<BatchDeleteProducts
@ -238,7 +263,8 @@ const ProductsPage: React.FC = () => {
/>,
<ImportCsv tableRef={actionRef} siteId={siteId} />,
<Button onClick={async () => {
const res = await request(`/site-api/${siteId}/products/export`);
const idsParam = selectedRowKeys.length ? (selectedRowKeys as any[]).join(',') : undefined;
const res = await request(`/site-api/${siteId}/products/export`, { params: { ids: idsParam } });
if (res?.success && res?.data?.csv) {
const blob = new Blob([res.data.csv], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
@ -255,6 +281,15 @@ const ProductsPage: React.FC = () => {
expandedRowRender: (record) => {
const productExternalId = record.externalProductId || record.external_product_id || record.id;
const innerColumns: ProColumns<any>[] = [
{
title: 'ID',
dataIndex: 'id',
hideInSearch: true,
width: 120,
render: (_, row) => {
return row?.id ?? '-';
}
},
{ title: '变体名', dataIndex: 'name' },
{ title: 'sku', dataIndex: 'sku' },
{ title: '常规价格', dataIndex: 'regular_price', hideInSearch: true },

View File

@ -127,13 +127,23 @@ const SubscriptionsPage: React.FC = () => {
* ;
* data.items data.list
*/
request={async (params) => {
request={async (params, sort, filter) => {
if (!siteId) return { data: [], success: true };
const { current, pageSize, ...rest } = params || {};
const where = { ...rest, ...(filter || {}) };
let orderObj: Record<string, 'asc' | 'desc'> | undefined = undefined;
if (sort && typeof sort === 'object') {
const [field, dir] = Object.entries(sort)[0] || [];
if (field && dir) {
orderObj = { [field]: dir === 'descend' ? 'desc' : 'asc' };
}
}
const response = await request(`/site-api/${siteId}/subscriptions`, {
params: {
...params,
page: params.current,
per_page: params.pageSize,
page: current,
page_size: pageSize,
where,
...(orderObj ? { order: orderObj } : {}),
}
});
@ -163,7 +173,8 @@ const SubscriptionsPage: React.FC = () => {
title="批量导出"
onClick={async () => {
if (!siteId) return;
const res = await request(`/site-api/${siteId}/subscriptions/export`, { params: {} });
const idsParam = selectedRowKeys.length ? (selectedRowKeys as any[]).join(',') : undefined;
const res = await request(`/site-api/${siteId}/subscriptions/export`, { params: { ids: idsParam } });
if (res?.success && res?.data?.csv) {
const blob = new Blob([res.data.csv], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
@ -177,8 +188,23 @@ const SubscriptionsPage: React.FC = () => {
}
}}
/>,
<Button title="批量删除" danger icon={<DeleteFilled />} onClick={() => message.info('订阅删除未实现')} />
]}n />
<Popconfirm
title="确定批量删除选中项吗?"
okText="确定"
cancelText="取消"
onConfirm={() => {
// 条件判断 如果当前未选择任何行则直接返回
if (!selectedRowKeys || selectedRowKeys.length === 0) {
message.warning('请选择要删除的订阅');
return;
}
// 暂未实现批量删除接口 进行用户提示
message.info('订阅删除未实现');
}}
>
<Button title="批量删除" danger icon={<DeleteFilled />} />
</Popconfirm>
]} />
<Drawer
open={drawerOpen}
title={drawerTitle}

View File

@ -15,6 +15,10 @@ export async function siteapicontrollerGetcustomers(
method: 'GET',
params: {
...queryParams,
where: undefined,
...queryParams['where'],
order: undefined,
...queryParams['order'],
},
...(options || {}),
},
@ -70,6 +74,10 @@ export async function siteapicontrollerExportcustomers(
method: 'GET',
params: {
...queryParams,
where: undefined,
...queryParams['where'],
order: undefined,
...queryParams['order'],
},
...(options || {}),
});
@ -105,6 +113,10 @@ export async function siteapicontrollerGetmedia(
method: 'GET',
params: {
...queryParams,
where: undefined,
...queryParams['where'],
order: undefined,
...queryParams['order'],
},
...(options || {}),
});
@ -140,6 +152,10 @@ export async function siteapicontrollerExportmedia(
method: 'GET',
params: {
...queryParams,
where: undefined,
...queryParams['where'],
order: undefined,
...queryParams['order'],
},
...(options || {}),
});
@ -156,6 +172,10 @@ export async function siteapicontrollerGetorders(
method: 'GET',
params: {
...queryParams,
where: undefined,
...queryParams['where'],
order: undefined,
...queryParams['order'],
},
...(options || {}),
});
@ -210,6 +230,10 @@ export async function siteapicontrollerExportorders(
method: 'GET',
params: {
...queryParams,
where: undefined,
...queryParams['where'],
order: undefined,
...queryParams['order'],
},
...(options || {}),
});
@ -247,6 +271,10 @@ export async function siteapicontrollerGetproducts(
method: 'GET',
params: {
...queryParams,
where: undefined,
...queryParams['where'],
order: undefined,
...queryParams['order'],
},
...(options || {}),
},
@ -302,6 +330,10 @@ export async function siteapicontrollerExportproducts(
method: 'GET',
params: {
...queryParams,
where: undefined,
...queryParams['where'],
order: undefined,
...queryParams['order'],
},
...(options || {}),
});
@ -318,6 +350,10 @@ export async function siteapicontrollerExportproductsspecial(
method: 'GET',
params: {
...queryParams,
where: undefined,
...queryParams['where'],
order: undefined,
...queryParams['order'],
},
...(options || {}),
});
@ -377,6 +413,10 @@ export async function siteapicontrollerGetsubscriptions(
method: 'GET',
params: {
...queryParams,
where: undefined,
...queryParams['where'],
order: undefined,
...queryParams['order'],
},
...(options || {}),
},
@ -394,6 +434,10 @@ export async function siteapicontrollerExportsubscriptions(
method: 'GET',
params: {
...queryParams,
where: undefined,
...queryParams['where'],
order: undefined,
...queryParams['order'],
},
...(options || {}),
});
@ -455,6 +499,29 @@ export async function siteapicontrollerDeletecustomer(
);
}
/** 此处后端没有提供注释 GET /site-api/${param1}/customers/${param0}/orders */
export async function siteapicontrollerGetcustomerorders(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.siteapicontrollerGetcustomerordersParams,
options?: { [key: string]: any },
) {
const { customerId: param0, siteId: param1, ...queryParams } = params;
return request<API.UnifiedOrderPaginationDTO>(
`/site-api/${param1}/customers/${param0}/orders`,
{
method: 'GET',
params: {
...queryParams,
where: undefined,
...queryParams['where'],
order: undefined,
...queryParams['order'],
},
...(options || {}),
},
);
}
/** 此处后端没有提供注释 PUT /site-api/${param1}/media/${param0} */
export async function siteapicontrollerUpdatemedia(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)

View File

@ -1463,14 +1463,24 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 搜索关键词 */
search?: string;
/** 状态 */
status?: string;
/** 排序字段 */
/** 客户ID,用于筛选订单 */
customer_id?: number;
/** 过滤条件对象 */
where?: Record<string, any>;
/** 排序对象,例如 { "sku": "desc" } */
order?: Record<string, any>;
/** 排序字段(兼容旧入参) */
orderby?: string;
/** 排序方式 */
order?: string;
/** 排序方式(兼容旧入参) */
orderDir?: string;
/** 选中ID列表,逗号分隔 */
ids?: string;
siteId: number;
};
@ -1479,14 +1489,24 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 搜索关键词 */
search?: string;
/** 状态 */
status?: string;
/** 排序字段 */
/** 客户ID,用于筛选订单 */
customer_id?: number;
/** 过滤条件对象 */
where?: Record<string, any>;
/** 排序对象,例如 { "sku": "desc" } */
order?: Record<string, any>;
/** 排序字段(兼容旧入参) */
orderby?: string;
/** 排序方式 */
order?: string;
/** 排序方式(兼容旧入参) */
orderDir?: string;
/** 选中ID列表,逗号分隔 */
ids?: string;
siteId: number;
};
@ -1495,14 +1515,24 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 搜索关键词 */
search?: string;
/** 状态 */
status?: string;
/** 排序字段 */
/** 客户ID,用于筛选订单 */
customer_id?: number;
/** 过滤条件对象 */
where?: Record<string, any>;
/** 排序对象,例如 { "sku": "desc" } */
order?: Record<string, any>;
/** 排序字段(兼容旧入参) */
orderby?: string;
/** 排序方式 */
order?: string;
/** 排序方式(兼容旧入参) */
orderDir?: string;
/** 选中ID列表,逗号分隔 */
ids?: string;
siteId: number;
};
@ -1511,14 +1541,24 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 搜索关键词 */
search?: string;
/** 状态 */
status?: string;
/** 排序字段 */
/** 客户ID,用于筛选订单 */
customer_id?: number;
/** 过滤条件对象 */
where?: Record<string, any>;
/** 排序对象,例如 { "sku": "desc" } */
order?: Record<string, any>;
/** 排序字段(兼容旧入参) */
orderby?: string;
/** 排序方式 */
order?: string;
/** 排序方式(兼容旧入参) */
orderDir?: string;
/** 选中ID列表,逗号分隔 */
ids?: string;
siteId: number;
};
@ -1527,14 +1567,24 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 搜索关键词 */
search?: string;
/** 状态 */
status?: string;
/** 排序字段 */
/** 客户ID,用于筛选订单 */
customer_id?: number;
/** 过滤条件对象 */
where?: Record<string, any>;
/** 排序对象,例如 { "sku": "desc" } */
order?: Record<string, any>;
/** 排序字段(兼容旧入参) */
orderby?: string;
/** 排序方式 */
order?: string;
/** 排序方式(兼容旧入参) */
orderDir?: string;
/** 选中ID列表,逗号分隔 */
ids?: string;
siteId: number;
};
@ -1543,14 +1593,51 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 搜索关键词 */
search?: string;
/** 状态 */
status?: string;
/** 排序字段 */
/** 客户ID,用于筛选订单 */
customer_id?: number;
/** 过滤条件对象 */
where?: Record<string, any>;
/** 排序对象,例如 { "sku": "desc" } */
order?: Record<string, any>;
/** 排序字段(兼容旧入参) */
orderby?: string;
/** 排序方式 */
order?: string;
/** 排序方式(兼容旧入参) */
orderDir?: string;
/** 选中ID列表,逗号分隔 */
ids?: string;
siteId: number;
};
type siteapicontrollerGetcustomerordersParams = {
/** 页码 */
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 搜索关键词 */
search?: string;
/** 状态 */
status?: string;
/** 客户ID,用于筛选订单 */
customer_id?: number;
/** 过滤条件对象 */
where?: Record<string, any>;
/** 排序对象,例如 { "sku": "desc" } */
order?: Record<string, any>;
/** 排序字段(兼容旧入参) */
orderby?: string;
/** 排序方式(兼容旧入参) */
orderDir?: string;
/** 选中ID列表,逗号分隔 */
ids?: string;
customerId: number;
siteId: number;
};
@ -1564,14 +1651,24 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 搜索关键词 */
search?: string;
/** 状态 */
status?: string;
/** 排序字段 */
/** 客户ID,用于筛选订单 */
customer_id?: number;
/** 过滤条件对象 */
where?: Record<string, any>;
/** 排序对象,例如 { "sku": "desc" } */
order?: Record<string, any>;
/** 排序字段(兼容旧入参) */
orderby?: string;
/** 排序方式 */
order?: string;
/** 排序方式(兼容旧入参) */
orderDir?: string;
/** 选中ID列表,逗号分隔 */
ids?: string;
siteId: number;
};
@ -1580,14 +1677,24 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 搜索关键词 */
search?: string;
/** 状态 */
status?: string;
/** 排序字段 */
/** 客户ID,用于筛选订单 */
customer_id?: number;
/** 过滤条件对象 */
where?: Record<string, any>;
/** 排序对象,例如 { "sku": "desc" } */
order?: Record<string, any>;
/** 排序字段(兼容旧入参) */
orderby?: string;
/** 排序方式 */
order?: string;
/** 排序方式(兼容旧入参) */
orderDir?: string;
/** 选中ID列表,逗号分隔 */
ids?: string;
siteId: number;
};
@ -1606,14 +1713,24 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 搜索关键词 */
search?: string;
/** 状态 */
status?: string;
/** 排序字段 */
/** 客户ID,用于筛选订单 */
customer_id?: number;
/** 过滤条件对象 */
where?: Record<string, any>;
/** 排序对象,例如 { "sku": "desc" } */
order?: Record<string, any>;
/** 排序字段(兼容旧入参) */
orderby?: string;
/** 排序方式 */
order?: string;
/** 排序方式(兼容旧入参) */
orderDir?: string;
/** 选中ID列表,逗号分隔 */
ids?: string;
siteId: number;
};
@ -1627,14 +1744,24 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 搜索关键词 */
search?: string;
/** 状态 */
status?: string;
/** 排序字段 */
/** 客户ID,用于筛选订单 */
customer_id?: number;
/** 过滤条件对象 */
where?: Record<string, any>;
/** 排序对象,例如 { "sku": "desc" } */
order?: Record<string, any>;
/** 排序字段(兼容旧入参) */
orderby?: string;
/** 排序方式 */
order?: string;
/** 排序方式(兼容旧入参) */
orderDir?: string;
/** 选中ID列表,逗号分隔 */
ids?: string;
siteId: number;
};
@ -1643,14 +1770,24 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 搜索关键词 */
search?: string;
/** 状态 */
status?: string;
/** 排序字段 */
/** 客户ID,用于筛选订单 */
customer_id?: number;
/** 过滤条件对象 */
where?: Record<string, any>;
/** 排序对象,例如 { "sku": "desc" } */
order?: Record<string, any>;
/** 排序字段(兼容旧入参) */
orderby?: string;
/** 排序方式 */
order?: string;
/** 排序方式(兼容旧入参) */
orderDir?: string;
/** 选中ID列表,逗号分隔 */
ids?: string;
siteId: number;
};
@ -2055,8 +2192,18 @@ declare namespace API {
type UnifiedCustomerDTO = {
/** 客户ID */
id?: Record<string, any>;
/** 头像URL */
avatar?: string;
/** 邮箱 */
email?: string;
/** 订单总数 */
orders?: number;
/** 总花费 */
total_spend?: number;
/** 创建时间 */
date_created?: string;
/** 更新时间 */
date_modified?: string;
/** 名 */
first_name?: string;
/** 姓 */
@ -2084,6 +2231,8 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 总页数 */
totalPages?: number;
};
@ -2112,6 +2261,8 @@ declare namespace API {
source_url?: string;
/** 创建时间 */
date_created?: string;
/** 更新时间 */
date_modified?: string;
};
type UnifiedMediaPaginationDTO = {
@ -2123,6 +2274,8 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 总页数 */
totalPages?: number;
};
@ -2160,6 +2313,8 @@ declare namespace API {
payment_method?: string;
/** 创建时间 */
date_created?: string;
/** 更新时间 */
date_modified?: string;
/** 原始数据 */
raw?: any;
};
@ -2173,6 +2328,8 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 总页数 */
totalPages?: number;
};
@ -2223,6 +2380,8 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 总页数 */
totalPages?: number;
};
@ -2232,14 +2391,24 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 搜索关键词 */
search?: string;
/** 状态 */
status?: string;
/** 排序字段 */
/** 客户ID,用于筛选订单 */
customer_id?: number;
/** 过滤条件对象 */
where?: Record<string, any>;
/** 排序对象,例如 { "sku": "desc" } */
order?: Record<string, any>;
/** 排序字段(兼容旧入参) */
orderby?: string;
/** 排序方式 */
order?: string;
/** 排序方式(兼容旧入参) */
orderDir?: string;
/** 选中ID列表,逗号分隔 */
ids?: string;
};
type UnifiedSubscriptionDTO = {
@ -2253,6 +2422,10 @@ declare namespace API {
billing_period?: string;
/** 计费间隔 */
billing_interval?: number;
/** 创建时间 */
date_created?: string;
/** 更新时间 */
date_modified?: string;
/** 开始时间 */
start_date?: string;
/** 下次支付时间 */
@ -2272,6 +2445,8 @@ declare namespace API {
page?: number;
/** 每页数量 */
per_page?: number;
/** 每页数量别名 */
page_size?: number;
/** 总页数 */
totalPages?: number;
};