zksu
/
WEB
forked from yoone/WEB
1
0
Fork 0

20251013-zty-换货功能前台代码

This commit is contained in:
zhuotianyuan 2025-10-13 16:52:17 +08:00
parent 7c5e4917dd
commit e5794c3d25
1 changed files with 69 additions and 8 deletions

View File

@ -27,6 +27,7 @@ import {
ordercontrollerUpdateorderitems, ordercontrollerUpdateorderitems,
} from '@/servers/api/order'; } from '@/servers/api/order';
import { productcontrollerSearchproducts } from '@/servers/api/product'; import { productcontrollerSearchproducts } from '@/servers/api/product';
import { wpproductcontrollerSearchproducts } from '@/servers/api/wpProduct';
import { sitecontrollerAll } from '@/servers/api/site'; import { sitecontrollerAll } from '@/servers/api/site';
import { stockcontrollerGetallstockpoints } from '@/servers/api/stock'; import { stockcontrollerGetallstockpoints } from '@/servers/api/stock';
import { formatShipmentState, formatSource } from '@/utils/format'; import { formatShipmentState, formatSource } from '@/utils/format';
@ -222,6 +223,11 @@ const ListPage: React.FC = () => {
title: '联系电话', title: '联系电话',
dataIndex: 'billing_phone', dataIndex: 'billing_phone',
render: (_, record) => record.shipping?.phone || record.billing?.phone, render: (_, record) => record.shipping?.phone || record.billing?.phone,
},
{
title: '换货次数',
dataIndex: 'exchange_frequency',
hideInSearch: true,
}, },
{ {
title: '州', title: '州',
@ -1980,6 +1986,8 @@ const SalesChange: React.FC<{
}, },
[], [],
); );
// setOptions( // setOptions(
// data.sales?.map((item) => ({ // data.sales?.map((item) => ({
// label: item.name, // label: item.name,
@ -1989,8 +1997,9 @@ const SalesChange: React.FC<{
return { ...data}; return { ...data};
}} }}
onFinish={async (formData: any) => { onFinish={async (formData: any) => {
const { sales } = formData; const { sales,items } = formData;
const res = await ordercontrollerUpdateorderitems({orderId:id}, sales); const data ={sales,items }
const res = await ordercontrollerUpdateorderitems({orderId:id}, data);
if (!res.success) { if (!res.success) {
message.error(`更新货物信息失败: ${res.message}`); message.error(`更新货物信息失败: ${res.message}`);
return false; return false;
@ -2000,11 +2009,63 @@ const SalesChange: React.FC<{
return true; return true;
}} }}
> >
<ProFormList
label="换货订单"
name="items"
>
<ProForm.Group>
<ProFormSelect
params={{ }}
request={async ({ keyWords }) => {
try {
const { data } = await wpproductcontrollerSearchproducts({
name: keyWords,
});
return (
data?.map((item) => {
return {
label: `${item.name}`,
value: item?.sku,
};
})
);
} catch (error) {
return [];
}
}}
name="sku"
label="订单"
placeholder="请选择订单"
tooltip="至少输入3个字符"
fieldProps={{
showSearch: true,
filterOption: false,
}}
debounceTime={300} // 防抖,减少请求频率
rules={[{ required: true, message: '请选择订单' }]}
/>
<ProFormDigit
name="quantity"
colProps={{ span: 12 }}
label="订单数量"
placeholder="请输入数量"
rules={[{ required: true, message: '请输入数量' }]}
fieldProps={{
precision: 0,
}}
/>
</ProForm.Group>
</ProFormList>
<ProFormList <ProFormList
label="换货产品" label="换货产品"
name="sales" name="sales"
> >
<ProForm.Group> <ProForm.Group>
<ProFormSelect <ProFormSelect
params={{ }} params={{ }}
request={async ({ keyWords }) => { request={async ({ keyWords }) => {