Compare commits
No commits in common. "cc1e7d96f23d7d448de0d83497c1611d8eab9eba" and "35c26c07c43ee28e5cd26b5a913e43cdbbdf3305" have entirely different histories.
cc1e7d96f2
...
35c26c07c4
|
|
@ -9,23 +9,23 @@ export const PRODUCT_STATUS_ENUM: ProSchemaValueEnumObj = {
|
||||||
},
|
},
|
||||||
draft: {
|
draft: {
|
||||||
text: '草稿',
|
text: '草稿',
|
||||||
status: 'draft',
|
status: 'default',
|
||||||
},
|
},
|
||||||
pending: {
|
pending: {
|
||||||
text: '待审核',
|
text: '待审核',
|
||||||
status: 'pending',
|
status: 'warning',
|
||||||
},
|
},
|
||||||
private: {
|
private: {
|
||||||
text: '私有',
|
text: '私有',
|
||||||
status: 'private',
|
status: 'warning',
|
||||||
},
|
},
|
||||||
trash: {
|
trash: {
|
||||||
text: '已删除',
|
text: '已删除',
|
||||||
status: 'error',
|
status: 'error',
|
||||||
},
|
},
|
||||||
'auto-draft': {
|
'auto-draft': {
|
||||||
text: '自动草稿',
|
text: '字段草稿',
|
||||||
status: 'auto-draft',
|
status: 'default',
|
||||||
},
|
},
|
||||||
future: {
|
future: {
|
||||||
text: '定时发布',
|
text: '定时发布',
|
||||||
|
|
@ -33,22 +33,7 @@ export const PRODUCT_STATUS_ENUM: ProSchemaValueEnumObj = {
|
||||||
},
|
},
|
||||||
inherit: {
|
inherit: {
|
||||||
text: '继承状态',
|
text: '继承状态',
|
||||||
status: 'inherit',
|
status: 'default',
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const PRODUCT_STOCK_STATUS_ENUM: ProSchemaValueEnumObj = {
|
|
||||||
instock: {
|
|
||||||
text: '上架',
|
|
||||||
status: 'instock',
|
|
||||||
},
|
|
||||||
outofstock: {
|
|
||||||
text: 'out of stock',
|
|
||||||
status: 'outofstock',
|
|
||||||
},
|
|
||||||
onbackorder: {
|
|
||||||
text: 'on back order',
|
|
||||||
status: 'onbackorder',
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { PRODUCT_STATUS_ENUM, PRODUCT_STOCK_STATUS_ENUM } from '@/constants';
|
import { PRODUCT_STATUS_ENUM } from '@/constants';
|
||||||
import {
|
import {
|
||||||
productcontrollerProductbysku,
|
productcontrollerProductbysku,
|
||||||
productcontrollerSearchproducts,
|
productcontrollerSearchproducts,
|
||||||
|
|
@ -10,7 +10,6 @@ import {
|
||||||
wpproductcontrollerSyncproducts,
|
wpproductcontrollerSyncproducts,
|
||||||
wpproductcontrollerUpdateproduct,
|
wpproductcontrollerUpdateproduct,
|
||||||
wpproductcontrollerUpdatevariation,
|
wpproductcontrollerUpdatevariation,
|
||||||
wpproductcontrollerUpdatewpproductstate,
|
|
||||||
} from '@/servers/api/wpProduct';
|
} from '@/servers/api/wpProduct';
|
||||||
import { EditOutlined } from '@ant-design/icons';
|
import { EditOutlined } from '@ant-design/icons';
|
||||||
import {
|
import {
|
||||||
|
|
@ -87,7 +86,6 @@ const List: React.FC = () => {
|
||||||
render: (_, record) => (
|
render: (_, record) => (
|
||||||
<>
|
<>
|
||||||
<UpdateForm tableRef={actionRef} values={record} />
|
<UpdateForm tableRef={actionRef} values={record} />
|
||||||
<UpdateStatus tableRef={actionRef} values={record} />
|
|
||||||
{record.type === 'simple' && record.sku ? (
|
{record.type === 'simple' && record.sku ? (
|
||||||
<>
|
<>
|
||||||
<Divider type="vertical" />
|
<Divider type="vertical" />
|
||||||
|
|
@ -234,69 +232,6 @@ const SyncForm: React.FC<{
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const UpdateStatus: React.FC<{
|
|
||||||
tableRef: React.MutableRefObject<ActionType | undefined>;
|
|
||||||
values: API.WpProductDTO;
|
|
||||||
}> = ({ tableRef, values: initialValues }) => {
|
|
||||||
const { message } = App.useApp();
|
|
||||||
return (
|
|
||||||
<DrawerForm<API.UpdateProductDTO>
|
|
||||||
title="修改产品上下架状态"
|
|
||||||
initialValues={initialValues}
|
|
||||||
trigger={
|
|
||||||
<Button type="primary">
|
|
||||||
<EditOutlined />
|
|
||||||
上下架
|
|
||||||
</Button>
|
|
||||||
}
|
|
||||||
autoFocusFirstInput
|
|
||||||
drawerProps={{
|
|
||||||
destroyOnHidden: true,
|
|
||||||
}}
|
|
||||||
onFinish={async (values) => {
|
|
||||||
console.log('values', values);
|
|
||||||
const { status, stock_status } = values;
|
|
||||||
try {
|
|
||||||
const { success, message: errMsg } =
|
|
||||||
await wpproductcontrollerUpdatewpproductstate(
|
|
||||||
{
|
|
||||||
id: initialValues.id,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
status,
|
|
||||||
stock_status
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (!success) {
|
|
||||||
throw new Error(errMsg);
|
|
||||||
}
|
|
||||||
message.success('提交成功');
|
|
||||||
tableRef.current?.reload();
|
|
||||||
return true;
|
|
||||||
} catch (error: any) {
|
|
||||||
message.error(error.message);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ProForm.Group>
|
|
||||||
<ProFormSelect
|
|
||||||
label="状态"
|
|
||||||
width="lg"
|
|
||||||
name="status"
|
|
||||||
valueEnum={PRODUCT_STATUS_ENUM}
|
|
||||||
/>
|
|
||||||
<ProFormSelect
|
|
||||||
label="上下架状态"
|
|
||||||
width="lg"
|
|
||||||
name="stock_status"
|
|
||||||
valueEnum={PRODUCT_STOCK_STATUS_ENUM}
|
|
||||||
/>
|
|
||||||
</ProForm.Group>
|
|
||||||
</DrawerForm>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const UpdateForm: React.FC<{
|
const UpdateForm: React.FC<{
|
||||||
tableRef: React.MutableRefObject<ActionType | undefined>;
|
tableRef: React.MutableRefObject<ActionType | undefined>;
|
||||||
values: API.WpProductDTO;
|
values: API.WpProductDTO;
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,6 @@ declare namespace API {
|
||||||
|
|
||||||
type ordercontrollerGetordersalesParams = {
|
type ordercontrollerGetordersalesParams = {
|
||||||
isSource?: boolean;
|
isSource?: boolean;
|
||||||
exceptPackage?: boolean;
|
|
||||||
/** 页码 */
|
/** 页码 */
|
||||||
current?: number;
|
current?: number;
|
||||||
/** 每页大小 */
|
/** 每页大小 */
|
||||||
|
|
@ -502,7 +501,7 @@ declare namespace API {
|
||||||
/** sku */
|
/** sku */
|
||||||
sku?: string;
|
sku?: string;
|
||||||
quantity?: number;
|
quantity?: number;
|
||||||
isPackage?: boolean;
|
exceptPackage?: boolean;
|
||||||
isYoone?: boolean;
|
isYoone?: boolean;
|
||||||
isZex?: boolean;
|
isZex?: boolean;
|
||||||
size?: number;
|
size?: number;
|
||||||
|
|
@ -523,7 +522,7 @@ declare namespace API {
|
||||||
/** sku */
|
/** sku */
|
||||||
sku?: string;
|
sku?: string;
|
||||||
quantity?: number;
|
quantity?: number;
|
||||||
isPackage?: boolean;
|
exceptPackage?: boolean;
|
||||||
isYoone?: boolean;
|
isYoone?: boolean;
|
||||||
isZex?: boolean;
|
isZex?: boolean;
|
||||||
size?: number;
|
size?: number;
|
||||||
|
|
@ -857,7 +856,6 @@ declare namespace API {
|
||||||
|
|
||||||
type QueryOrderSalesDTO = {
|
type QueryOrderSalesDTO = {
|
||||||
isSource?: boolean;
|
isSource?: boolean;
|
||||||
exceptPackage?: boolean;
|
|
||||||
/** 页码 */
|
/** 页码 */
|
||||||
current?: number;
|
current?: number;
|
||||||
/** 每页大小 */
|
/** 每页大小 */
|
||||||
|
|
@ -1449,10 +1447,6 @@ declare namespace API {
|
||||||
siteId: string;
|
siteId: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type wpproductcontrollerUpdatewpproductstateParams = {
|
|
||||||
id: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
type WpProductDTO = {
|
type WpProductDTO = {
|
||||||
/** ID */
|
/** ID */
|
||||||
id: number;
|
id: number;
|
||||||
|
|
@ -1474,8 +1468,6 @@ declare namespace API {
|
||||||
| 'auto-draft'
|
| 'auto-draft'
|
||||||
| 'future'
|
| 'future'
|
||||||
| 'inherit';
|
| 'inherit';
|
||||||
/** 上下架状态 */
|
|
||||||
stockStatus?: 'instock' | 'outofstock' | 'onbackorder';
|
|
||||||
/** 常规价格 */
|
/** 常规价格 */
|
||||||
regular_price?: number;
|
regular_price?: number;
|
||||||
/** 销售价格 */
|
/** 销售价格 */
|
||||||
|
|
|
||||||
|
|
@ -98,22 +98,3 @@ export async function wpproductcontrollerSyncproducts(
|
||||||
...(options || {}),
|
...(options || {}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 POST /wp_product/updateState/${param0} */
|
|
||||||
export async function wpproductcontrollerUpdatewpproductstate(
|
|
||||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
|
||||||
params: API.wpproductcontrollerUpdatewpproductstateParams,
|
|
||||||
body: Record<string, any>,
|
|
||||||
options?: { [key: string]: any },
|
|
||||||
) {
|
|
||||||
const { id: param0, ...queryParams } = params;
|
|
||||||
return request<API.BooleanRes>(`/wp_product/updateState/${param0}`, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'text/plain',
|
|
||||||
},
|
|
||||||
params: { ...queryParams },
|
|
||||||
data: body,
|
|
||||||
...(options || {}),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue