forked from yoone/WEB
feat(订单): 添加发货平台选择功能并优化表单验证
- 在发货表单中新增发货平台选择器 - 将公司名称字段改为非必填 - 添加控制台日志用于调试 - 优化地址选择器的数据处理逻辑
This commit is contained in:
parent
3690fd00f7
commit
1d9838f72e
|
|
@ -77,6 +77,7 @@ import {
|
|||
} from 'antd';
|
||||
import React, { useMemo, useRef, useState } from 'react';
|
||||
import RelatedOrders from '../../Subscription/Orders/RelatedOrders';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const ListPage: React.FC = () => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
|
|
@ -1267,7 +1268,10 @@ const Shipping: React.FC<{
|
|||
const [rates, setRates] = useState<API.RateDTO[]>([]);
|
||||
const [ratesLoading, setRatesLoading] = useState(false);
|
||||
const { message } = App.useApp();
|
||||
|
||||
const [shipmentPlatforms, setShipmentPlatforms] = useState([
|
||||
{ label: 'uniuni', value: 'uniuni' },
|
||||
{ label: 'tms.freightwaves', value: 'freightwaves' },
|
||||
]);
|
||||
return (
|
||||
<ModalForm
|
||||
formRef={formRef}
|
||||
|
|
@ -1296,6 +1300,7 @@ const Shipping: React.FC<{
|
|||
await ordercontrollerGetorderdetail({
|
||||
orderId: id,
|
||||
});
|
||||
console.log('success data',success,data)
|
||||
if (!success || !data) return {};
|
||||
data.sales = data.sales?.reduce(
|
||||
(acc: API.OrderSale[], cur: API.OrderSale) => {
|
||||
|
|
@ -1318,7 +1323,8 @@ const Shipping: React.FC<{
|
|||
if (reShipping) data.sales = [{}];
|
||||
let shipmentInfo = localStorage.getItem('shipmentInfo');
|
||||
if (shipmentInfo) shipmentInfo = JSON.parse(shipmentInfo);
|
||||
return {
|
||||
const a = {
|
||||
shipmentPlatform: 'uniuni',
|
||||
...data,
|
||||
// payment_method_id: shipmentInfo?.payment_method_id,
|
||||
stockPointId: shipmentInfo?.stockPointId,
|
||||
|
|
@ -1378,6 +1384,8 @@ const Shipping: React.FC<{
|
|||
},
|
||||
},
|
||||
};
|
||||
console.log('data',a)
|
||||
return a
|
||||
}}
|
||||
onFinish={async ({
|
||||
customer_note,
|
||||
|
|
@ -1441,7 +1449,18 @@ const Shipping: React.FC<{
|
|||
}
|
||||
}}
|
||||
>
|
||||
<ProFormText label="订单号" readonly name={'externalOrderId'} />
|
||||
<Row gutter={16}>
|
||||
<Col span={8}>
|
||||
<ProFormSelect
|
||||
name="shipmentPlatform"
|
||||
label="发货平台"
|
||||
options={shipmentPlatforms}
|
||||
placeholder="请选择发货平台"
|
||||
rules={[{ required: true, message: '请选择一个选项' }]}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
<ProFormText label="订单号" readonly name='externalOrderId' />
|
||||
<ProFormText label="客户备注" readonly name="customer_note" />
|
||||
<ProFormList
|
||||
label="后台备注"
|
||||
|
|
@ -1573,16 +1592,20 @@ const Shipping: React.FC<{
|
|||
title="发货信息"
|
||||
extra={
|
||||
<AddressPicker
|
||||
onChange={({
|
||||
address,
|
||||
phone_number,
|
||||
phone_number_extension,
|
||||
stockPointId,
|
||||
}) => {
|
||||
onChange={(row) => {
|
||||
console.log(row);
|
||||
const {
|
||||
address,
|
||||
phone_number,
|
||||
phone_number_extension,
|
||||
stockPointId,
|
||||
} = row;
|
||||
formRef?.current?.setFieldsValue({
|
||||
stockPointId,
|
||||
// address_id: row.id,
|
||||
details: {
|
||||
origin: {
|
||||
|
||||
address,
|
||||
phone_number: {
|
||||
phone: phone_number,
|
||||
|
|
@ -1595,6 +1618,11 @@ const Shipping: React.FC<{
|
|||
/>
|
||||
}
|
||||
>
|
||||
{/* <ProFormText
|
||||
label="address_id"
|
||||
name={'address_id'}
|
||||
rules={[{ required: true, message: '请输入ID' }]}
|
||||
/> */}
|
||||
<ProFormSelect
|
||||
name="stockPointId"
|
||||
width="md"
|
||||
|
|
@ -1687,7 +1715,7 @@ const Shipping: React.FC<{
|
|||
<ProFormText
|
||||
label="公司名称"
|
||||
name={['details', 'destination', 'name']}
|
||||
rules={[{ required: true, message: '请输入公司名称' }]}
|
||||
rules={[{ message: '请输入公司名称' }]}
|
||||
/>
|
||||
<ProFormItem
|
||||
name={['details', 'destination', 'address', 'country']}
|
||||
|
|
@ -2017,6 +2045,7 @@ const Shipping: React.FC<{
|
|||
details.origin.phone_number.number =
|
||||
details.origin.phone_number.phone;
|
||||
const res = await logisticscontrollerGetshipmentfee({
|
||||
shipmentPlatform: data.shipmentPlatform,
|
||||
stockPointId: data.stockPointId,
|
||||
|
||||
sender: details.origin.contact_name,
|
||||
|
|
@ -2343,7 +2372,7 @@ const CreateOrder: React.FC<{
|
|||
<ProFormText
|
||||
label="公司名称"
|
||||
name={['billing', 'company']}
|
||||
rules={[{ required: true, message: '请输入公司名称' }]}
|
||||
rules={[{ message: '请输入公司名称' }]}
|
||||
/>
|
||||
<ProFormItem
|
||||
name={['billing', 'country']}
|
||||
|
|
@ -2429,6 +2458,11 @@ const AddressPicker: React.FC<{
|
|||
value: item.id,
|
||||
}));
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'id',
|
||||
dataIndex: ['id'],
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '地区',
|
||||
|
|
|
|||
Loading…
Reference in New Issue