forked from yoone/WEB
1
0
Fork 0

Compare commits

..

No commits in common. "35c26c07c43ee28e5cd26b5a913e43cdbbdf3305" and "c06cb33e89693b84f3e477d732db397d39df193d" have entirely different histories.

21 changed files with 405 additions and 820 deletions

1
.gitignore vendored
View File

@ -13,4 +13,3 @@
.swc .swc
/package-lock.json /package-lock.json
/yarn.lock /yarn.lock
*.yaml

View File

@ -6,7 +6,6 @@ const UMI_APP_API_URL = isDev
: 'https://api.yoone.ca'; : 'https://api.yoone.ca';
export default defineConfig({ export default defineConfig({
hash: true,
antd: {}, antd: {},
access: {}, access: {},
model: {}, model: {},
@ -26,7 +25,7 @@ export default defineConfig({
{ {
name: '组织架构', name: '组织架构',
path: '/organiza', path: '/organiza',
access: 'canSeeOrganiza', access: 'canSeeSuper',
routes: [ routes: [
{ {
name: '用户管理', name: '用户管理',
@ -38,7 +37,6 @@ export default defineConfig({
{ {
name: '商品管理', name: '商品管理',
path: '/product', path: '/product',
access: 'canSeeProduct',
routes: [ routes: [
{ {
name: '商品分类', name: '商品分类',
@ -70,7 +68,6 @@ export default defineConfig({
{ {
name: '库存管理', name: '库存管理',
path: '/stock', path: '/stock',
access: 'canSeeStock',
routes: [ routes: [
{ {
name: '库存列表', name: '库存列表',
@ -102,7 +99,7 @@ export default defineConfig({
{ {
name: '订单管理', name: '订单管理',
path: '/order', path: '/order',
access: 'canSeeOrder', access: 'canSeeAdmin',
routes: [ routes: [
{ {
name: '订单列表', name: '订单列表',
@ -119,7 +116,6 @@ export default defineConfig({
{ {
name: '客户管理', name: '客户管理',
path: '/customer', path: '/customer',
access: 'canSeeCustomer',
routes: [ routes: [
{ {
name: '客户列表', name: '客户列表',
@ -128,52 +124,54 @@ export default defineConfig({
}, },
], ],
}, },
{ // {
name: '物流管理', // name: '物流管理',
path: '/logistics', // path: '/logistics',
access: 'canSeeLogistics', // routes: [
routes: [ // {
{ // name: '服务商',
name: '服务商', // path: '/logistics/services',
path: '/logistics/services', // component: './Logistics/Services',
component: './Logistics/Services', // },
}, // {
{ // name: '地址管理',
name: '地址管理', // path: '/logistics/address',
path: '/logistics/address', // component: './Logistics/Address',
component: './Logistics/Address', // },
}, // {
{ // name: '物流列表',
name: '物流列表', // path: '/logistics/list',
path: '/logistics/list', // component: './Logistics/List',
component: './Logistics/List', // },
}, // ],
], // },
},
{ {
name: '数据统计', name: '数据统计',
path: '/statistics', path: '/statistics',
access: 'canSeeStatistics',
routes: [ routes: [
{ {
name: '销售统计', name: '销售统计',
path: '/statistics/sales', path: '/statistics/sales',
component: './Statistics/Sales', component: './Statistics/Sales',
access: 'canSeeSuper',
}, },
{ {
name: '订单统计', name: '订单统计',
path: '/statistics/order', path: '/statistics/order',
component: './Statistics/Order', component: './Statistics/Order',
access: 'canSeeSuper',
}, },
{ {
name: '订单来源', name: '订单来源',
path: '/statistics/orderSource', path: '/statistics/orderSource',
component: './Statistics/OrderSource', component: './Statistics/OrderSource',
access: 'canSeeSuper',
}, },
{ {
name: '客户统计', name: '客户统计',
path: '/statistics/customer', path: '/statistics/customer',
component: './Statistics/Customer', component: './Statistics/Customer',
access: 'canSeeSuper',
}, },
{ {
name: '库存预测', name: '库存预测',

View File

@ -26,7 +26,6 @@
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"print-js": "^1.6.0", "print-js": "^1.6.0",
"react-phone-input-2": "^2.15.1", "react-phone-input-2": "^2.15.1",
"react-toastify": "^11.0.5",
"xlsx": "^0.18.5" "xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,22 +1,9 @@
export default (initialState: any) => { export default (initialState: any) => {
const isSuper = initialState?.user?.isSuper ?? false; const canSeeSuper = initialState?.user?.isSuper;
const isAdmin = initialState?.user?.Admin ?? false; const canSeeAdmin =
const canSeeOrganiza = (isSuper || isAdmin) || (initialState?.user?.permissions?.includes('organiza') ?? false); initialState?.user?.isSuper || initialState?.user?.isAdmin;
const canSeeProduct = (isSuper || isAdmin) || (initialState?.user?.permissions?.includes('product') ?? false);
const canSeeStock = (isSuper || isAdmin) || (initialState?.user?.permissions?.includes('stock') ?? false);
const canSeeOrder = (isSuper || isAdmin) ||
((initialState?.user?.permissions?.includes('order') ?? false) || (initialState?.user?.permissions?.includes('order-10-days') ?? false));
const canSeeCustomer = (isSuper || isAdmin) || (initialState?.user?.permissions?.includes('customer') ?? false);
const canSeeLogistics = (isSuper || isAdmin) || (initialState?.user?.permissions?.includes('logistics') ?? false);
const canSeeStatistics = (isSuper || isAdmin) || (initialState?.user?.permissions?.includes('statistics') ?? false);
return { return {
canSeeOrganiza, canSeeSuper,
canSeeProduct, canSeeAdmin,
canSeeStock,
canSeeOrder,
canSeeCustomer,
canSeeLogistics,
canSeeStatistics,
}; };
}; };

View File

@ -23,6 +23,7 @@ const Page = () => {
try { try {
const { data, success, code, message: msg } = await usercontrollerLogin({...values, deviceId}); const { data, success, code, message: msg } = await usercontrollerLogin({...values, deviceId});
if (success) { if (success) {
message.success('登录成功'); message.success('登录成功');
localStorage.setItem('token', data?.token as string); localStorage.setItem('token', data?.token as string);
const { data: user } = await usercontrollerGetuser(); const { data: user } = await usercontrollerGetuser();

View File

@ -1,27 +1,21 @@
import { logisticscontrollerGetlist, logisticscontrollerGetshipmentlabel, import { logisticscontrollerGetlist } from '@/servers/api/logistics';
logisticscontrollerDeleteshipment,
logisticscontrollerUpdateshipmentstate
} from '@/servers/api/logistics';
import { stockcontrollerGetallstockpoints } from '@/servers/api/stock'; import { stockcontrollerGetallstockpoints } from '@/servers/api/stock';
import { formatUniuniShipmentState } from '@/utils/format'; import { formatShipmentState } from '@/utils/format';
import { printPDF } from '@/utils/util'; import { printPDF } from '@/utils/util';
import { CopyOutlined } from '@ant-design/icons'; import { CopyOutlined } from '@ant-design/icons';
import { ToastContainer, toast } from 'react-toastify';
import { import {
ActionType, ActionType,
PageContainer, PageContainer,
ProColumns, ProColumns,
ProTable, ProTable,
} from '@ant-design/pro-components'; } from '@ant-design/pro-components';
import { App, Button, Divider, Popconfirm } from 'antd'; import { App, Button } from 'antd';
import { useRef, useState } from 'react'; import { useRef, useState } from 'react';
import { sitecontrollerAll } from '@/servers/api/site';
const ListPage: React.FC = () => { const ListPage: React.FC = () => {
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
const { message } = App.useApp(); const { message } = App.useApp();
const [selectedRows, setSelectedRows] = useState([]); const [selectedRows, setSelectedRows] = useState([]);
const [isLoading, setIsLoading] = useState(false);
const columns: ProColumns<API.Service>[] = [ const columns: ProColumns<API.Service>[] = [
{ {
@ -32,7 +26,7 @@ const ListPage: React.FC = () => {
{ {
title: '仓库', title: '仓库',
dataIndex: 'stockPointId', dataIndex: 'stockPointId',
// hideInTable: true, hideInTable: true,
valueType: 'select', valueType: 'select',
request: async () => { request: async () => {
const { data = [] } = await stockcontrollerGetallstockpoints(); const { data = [] } = await stockcontrollerGetallstockpoints();
@ -42,34 +36,17 @@ const ListPage: React.FC = () => {
})); }));
}, },
}, },
{
title: '网站',
dataIndex: 'siteId',
valueType: 'select',
hideInSearch: true,
request: async () => {
const { data = [] } = await sitecontrollerAll();
return data.map((item) => ({
label: item.siteName,
value: item.id,
}));
},
},
{
title: '订单号',
dataIndex: 'externalOrderId',
},
{ {
title: '快递单号', title: '快递单号',
dataIndex: 'return_tracking_number', dataIndex: 'primary_tracking_number',
render(_, record) { render(_, record) {
return ( return (
<> <>
{record.return_tracking_number} {record.primary_tracking_number}
<CopyOutlined <CopyOutlined
onClick={async () => { onClick={async () => {
try { try {
await navigator.clipboard.writeText(record.return_tracking_number); await navigator.clipboard.writeText(record.tracking_url);
message.success('复制成功!'); message.success('复制成功!');
} catch (err) { } catch (err) {
message.error('复制失败!'); message.error('复制失败!');
@ -85,7 +62,7 @@ const ListPage: React.FC = () => {
dataIndex: 'state', dataIndex: 'state',
hideInSearch: true, hideInSearch: true,
render(_, record) { render(_, record) {
return formatUniuniShipmentState(record.state); return formatShipmentState(record.state);
}, },
}, },
{ {
@ -99,62 +76,20 @@ const ListPage: React.FC = () => {
dataIndex: 'operation', dataIndex: 'operation',
hideInSearch: true, hideInSearch: true,
render(_, record) { render(_, record) {
if (!record?.labels?.length) return null;
return ( return (
<> <Button
<Button type="primary"
type="primary" onClick={() => {
disabled={isLoading} // printPDF([record.labels[record.labels.length - 1].url])
onClick={async () => { window.open(
setIsLoading(true); record.labels[record.labels.length - 1].url,
const { data } = await logisticscontrollerGetshipmentlabel({shipmentId:record.id}); '_blank',
const content = data.content; );
printPDF([content]); }}
setIsLoading(false); >
}}
> </Button>
Label
</Button>
<Divider type="vertical" />
<Button
type="primary"
disabled={isLoading}
onClick={async () => {
setIsLoading(true);
const res = await logisticscontrollerUpdateshipmentstate({shipmentId:record.id});
console.log('res', res);
setIsLoading(false);
}}
>
</Button>
<Divider type="vertical" />
<Popconfirm
disabled={isLoading}
title="删除"
description="确认删除?"
onConfirm={async () => {
try {
setIsLoading(true);
const { success, message: errMsg } =
await logisticscontrollerDeleteshipment({id:record.id});
if (!success) {
throw new Error(errMsg);
}
setIsLoading(false);
actionRef.current?.reload();
} catch (error: any) {
setIsLoading(false);
message.error(error.message);
}
}}
>
<Button type="primary" danger>
</Button>
</Popconfirm>
<ToastContainer />
</>
); );
}, },
}, },

View File

@ -68,23 +68,23 @@ const ListPage: React.FC = () => {
actionRef={actionRef} actionRef={actionRef}
rowKey="id" rowKey="id"
toolBarRender={() => [ toolBarRender={() => [
// <Button <Button
// key="syncSite" key="syncSite"
// type="primary" type="primary"
// onClick={async () => { onClick={async () => {
// try { try {
// const { success } = await logisticscontrollerSyncservices(); const { success } = await logisticscontrollerSyncservices();
// if (!success) { if (!success) {
// throw new Error('同步失败'); throw new Error('同步失败');
// } }
// actionRef.current?.reload(); actionRef.current?.reload();
// } catch (e: any) { } catch (e: any) {
// message.error(e?.message || '同步失败'); message.error(e?.message || '同步失败');
// } }
// }} }}
// > >
// 同步服务商
// </Button>, </Button>,
]} ]}
request={async (values) => { request={async (values) => {
console.log(values); console.log(values);

View File

@ -1,16 +1,11 @@
import styles from '../../../style/order-list.css';
import InternationalPhoneInput from '@/components/InternationalPhoneInput'; import InternationalPhoneInput from '@/components/InternationalPhoneInput';
import { HistoryOrder } from '@/pages/Statistics/Order';
import { ORDER_STATUS_ENUM } from '@/constants'; import { ORDER_STATUS_ENUM } from '@/constants';
import { import {
logisticscontrollerCreateshipment, logisticscontrollerCreateshipment,
logisticscontrollerGetshipmentfee,
logisticscontrollerDelshipment, logisticscontrollerDelshipment,
logisticscontrollerGetpaymentmethods, logisticscontrollerGetpaymentmethods,
logisticscontrollerGetratelist, logisticscontrollerGetratelist,
logisticscontrollerGetshippingaddresslist, logisticscontrollerGetshippingaddresslist,
// logisticscontrollerGetshipmentlabel,
} from '@/servers/api/logistics'; } from '@/servers/api/logistics';
import { import {
ordercontrollerCancelorder, ordercontrollerCancelorder,
@ -24,7 +19,6 @@ import {
ordercontrollerRefundorder, ordercontrollerRefundorder,
ordercontrollerSyncorder, ordercontrollerSyncorder,
ordercontrollerSyncorderbyid, ordercontrollerSyncorderbyid,
ordercontrollerUpdateorderitems,
} from '@/servers/api/order'; } from '@/servers/api/order';
import { productcontrollerSearchproducts } from '@/servers/api/product'; import { productcontrollerSearchproducts } from '@/servers/api/product';
import { sitecontrollerAll } from '@/servers/api/site'; import { sitecontrollerAll } from '@/servers/api/site';
@ -64,12 +58,10 @@ import {
Button, Button,
Card, Card,
Col, Col,
Descriptions,
Divider, Divider,
Drawer, Drawer,
Dropdown, Dropdown,
Empty, Empty,
message,
Popconfirm, Popconfirm,
Radio, Radio,
Row, Row,
@ -77,16 +69,13 @@ import {
Tabs, Tabs,
TabsProps, TabsProps,
} from 'antd'; } from 'antd';
import Item from 'antd/es/list/Item';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import React, { useMemo, useRef, useState } from 'react'; import React, { useMemo, useRef, useState } from 'react';
import { printPDF } from '@/utils/util';
const ListPage: React.FC = () => { const ListPage: React.FC = () => {
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
const [activeKey, setActiveKey] = useState<string>('all'); const [activeKey, setActiveKey] = useState<string>('all');
const [count, setCount] = useState<any[]>([]); const [count, setCount] = useState<any[]>([]);
const [activeLine, setActiveLine] = useState<number>(-1);
const tabs: TabsProps['items'] = useMemo(() => { const tabs: TabsProps['items'] = useMemo(() => {
const total = count.reduce((acc, cur) => acc + Number(cur.count), 0); const total = count.reduce((acc, cur) => acc + Number(cur.count), 0);
const tabs = [ const tabs = [
@ -268,7 +257,7 @@ const ListPage: React.FC = () => {
record.orderStatus, record.orderStatus,
) ? ( ) ? (
<> <>
<Shipping id={record.id as number} tableRef={actionRef} setActiveLine={setActiveLine}/> <Shipping id={record.id as number} tableRef={actionRef} />
<Divider type="vertical" /> <Divider type="vertical" />
</> </>
) : ( ) : (
@ -279,7 +268,6 @@ const ListPage: React.FC = () => {
record={record} record={record}
tableRef={actionRef} tableRef={actionRef}
orderId={record.id as number} orderId={record.id as number}
setActiveLine={setActiveLine}
/> />
<Divider type="vertical" /> <Divider type="vertical" />
<Dropdown <Dropdown
@ -319,14 +307,6 @@ const ListPage: React.FC = () => {
: 'block', : 'block',
}, },
}, },
{
key: 'history',
label:
<HistoryOrder
email={record.customer_email}
tableRef={actionRef}
/>,
},
{ {
key: 'note', key: 'note',
label: <OrderNote id={record.id as number} />, label: <OrderNote id={record.id as number} />,
@ -397,9 +377,6 @@ const ListPage: React.FC = () => {
scroll={{ x: 'max-content' }} scroll={{ x: 'max-content' }}
actionRef={actionRef} actionRef={actionRef}
rowKey="id" rowKey="id"
rowClassName={(record) => {
return record.id === activeLine ? styles['selected-line-order-protable']: '';
}}
toolBarRender={() => [ toolBarRender={() => [
<CreateOrder tableRef={actionRef} />, <CreateOrder tableRef={actionRef} />,
<SyncForm tableRef={actionRef} />, <SyncForm tableRef={actionRef} />,
@ -487,8 +464,7 @@ const Detail: React.FC<{
tableRef: React.MutableRefObject<ActionType | undefined>; tableRef: React.MutableRefObject<ActionType | undefined>;
orderId: number; orderId: number;
record: API.Order; record: API.Order;
setActiveLine: Function }> = ({ tableRef, orderId, record }) => {
}> = ({ tableRef, orderId, record, setActiveLine }) => {
const [visiable, setVisiable] = useState(false); const [visiable, setVisiable] = useState(false);
const { message } = App.useApp(); const { message } = App.useApp();
const ref = useRef<ActionType>(); const ref = useRef<ActionType>();
@ -499,7 +475,6 @@ const Detail: React.FC<{
orderId, orderId,
}); });
if (!success || !data) return { data: {} }; if (!success || !data) return { data: {} };
// 合并订单中相同的sku只显示一次记录总数
data.sales = data.sales?.reduce( data.sales = data.sales?.reduce(
(acc: API.OrderSale[], cur: API.OrderSale) => { (acc: API.OrderSale[], cur: API.OrderSale) => {
let idx = acc.findIndex((v: any) => v.productId === cur.productId); let idx = acc.findIndex((v: any) => v.productId === cur.productId);
@ -519,10 +494,7 @@ const Detail: React.FC<{
return ( return (
<> <>
<Button key="detail" type="primary" onClick={() => { <Button key="detail" type="primary" onClick={() => setVisiable(true)}>
setVisiable(true);
setActiveLine(record.id);
}}>
<FileDoneOutlined /> <FileDoneOutlined />
</Button> </Button>
@ -539,29 +511,29 @@ const Detail: React.FC<{
) )
? [] ? []
: [ : [
<Divider type="vertical" />, <Divider type="vertical" />,
<Button <Button
type="primary" type="primary"
onClick={async () => { onClick={async () => {
try { try {
const { success, message: errMsg } = const { success, message: errMsg } =
await ordercontrollerSyncorderbyid({ await ordercontrollerSyncorderbyid({
siteId: record.siteId as string, siteId: record.siteId as string,
orderId: record.externalOrderId as string, orderId: record.externalOrderId as string,
}); });
if (!success) { if (!success) {
throw new Error(errMsg); throw new Error(errMsg);
}
message.success('同步成功');
tableRef.current?.reload();
} catch (error) {
message.error(error?.message || '同步失败');
} }
message.success('同步成功'); }}
tableRef.current?.reload(); >
} catch (error) {
message.error(error?.message || '同步失败'); </Button>,
} ]),
}}
>
</Button>,
]),
// ...(['processing', 'pending_reshipment'].includes(record.orderStatus) // ...(['processing', 'pending_reshipment'].includes(record.orderStatus)
// ? [ // ? [
// <Divider type="vertical" />, // <Divider type="vertical" />,
@ -580,136 +552,136 @@ const Detail: React.FC<{
'pending_refund', 'pending_refund',
].includes(record.orderStatus) ].includes(record.orderStatus)
? [ ? [
<Divider type="vertical" />, <Divider type="vertical" />,
<Popconfirm <Popconfirm
title="转至售后" title="转至售后"
description="确认转至售后?" description="确认转至售后?"
onConfirm={async () => { onConfirm={async () => {
try { try {
const { success, message: errMsg } = const { success, message: errMsg } =
await ordercontrollerChangestatus( await ordercontrollerChangestatus(
{ {
id: record.id, id: record.id,
}, },
{ {
status: 'after_sale_pending', status: 'after_sale_pending',
}, },
); );
if (!success) { if (!success) {
throw new Error(errMsg); throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
} }
tableRef.current?.reload(); }}
} catch (error: any) { >
message.error(error.message); <Button type="primary" ghost>
}
}} </Button>
> </Popconfirm>,
<Button type="primary" ghost> ]
</Button>
</Popconfirm>,
]
: []), : []),
...(record.orderStatus === 'after_sale_pending' ...(record.orderStatus === 'after_sale_pending'
? [ ? [
<Divider type="vertical" />, <Divider type="vertical" />,
<Popconfirm <Popconfirm
title="转至取消" title="转至取消"
description="确认转至取消?" description="确认转至取消?"
onConfirm={async () => { onConfirm={async () => {
try { try {
const { success, message: errMsg } = const { success, message: errMsg } =
await ordercontrollerCancelorder({ await ordercontrollerCancelorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至退款"
description="确认转至退款?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerRefundorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
退
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至完成"
description="确认转至完成?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerCompletedorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至待补发"
description="确认转至待补发?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerChangestatus(
{
id: record.id, id: record.id,
}, });
{ if (!success) {
status: 'pending_reshipment', throw new Error(errMsg);
}, }
); tableRef.current?.reload();
if (!success) { } catch (error: any) {
throw new Error(errMsg); message.error(error.message);
} }
tableRef.current?.reload(); }}
} catch (error: any) { >
message.error(error.message); <Button type="primary" ghost>
}
}} </Button>
> </Popconfirm>,
<Button type="primary" ghost> <Divider type="vertical" />,
<Popconfirm
</Button> title="转至退款"
</Popconfirm>, description="确认转至退款?"
] onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerRefundorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
退
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至完成"
description="确认转至完成?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerCompletedorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至待补发"
description="确认转至待补发?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerChangestatus(
{
id: record.id,
},
{
status: 'pending_reshipment',
},
);
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
]
: []), : []),
]} ]}
> >
@ -875,18 +847,6 @@ const Detail: React.FC<{
); );
}} }}
/> />
<ProDescriptions.Item
label="换货"
span={3}
render={(_, record) => {
return (
<SalesChange
detailRef={ref}
id={record.id as number}
/>
)
}}
/>
<ProDescriptions.Item <ProDescriptions.Item
label="备注" label="备注"
span={3} span={3}
@ -917,7 +877,6 @@ const Detail: React.FC<{
label="物流信息" label="物流信息"
span={3} span={3}
render={(_, record) => { render={(_, record) => {
console.log('record', record);
if (!record.shipment || record.shipment.length === 0) { if (!record.shipment || record.shipment.length === 0) {
return <Empty description="暂无物流信息" />; return <Empty description="暂无物流信息" />;
} }
@ -953,31 +912,31 @@ const Detail: React.FC<{
} }
actions={ actions={
v.state === 'waiting-for-scheduling' || v.state === 'waiting-for-scheduling' ||
v.state === 'waiting-for-transit' v.state === 'waiting-for-transit'
? [ ? [
<Popconfirm <Popconfirm
title="取消运单" title="取消运单"
description="确认取消运单?" description="确认取消运单?"
onConfirm={async () => { onConfirm={async () => {
try { try {
const { success, message: errMsg } = const { success, message: errMsg } =
await logisticscontrollerDelshipment({ await logisticscontrollerDelshipment({
id: v.id, id: v.id,
}); });
if (!success) { if (!success) {
throw new Error(errMsg); throw new Error(errMsg);
}
tableRef.current?.reload();
initRequest();
} catch (error: any) {
message.error(error.message);
} }
tableRef.current?.reload(); }}
initRequest(); >
} catch (error: any) { <DeleteFilled />
message.error(error.message);
} </Popconfirm>,
}} ]
>
<DeleteFilled />
</Popconfirm>,
]
: [] : []
} }
> >
@ -1061,15 +1020,14 @@ const Shipping: React.FC<{
tableRef?: React.MutableRefObject<ActionType | undefined>; tableRef?: React.MutableRefObject<ActionType | undefined>;
descRef?: React.MutableRefObject<ActionType | undefined>; descRef?: React.MutableRefObject<ActionType | undefined>;
reShipping?: boolean; reShipping?: boolean;
setActiveLine: Function; }> = ({ id, tableRef, descRef, reShipping = false }) => {
}> = ({ id, tableRef, descRef, reShipping = false, setActiveLine }) => {
const [options, setOptions] = useState<any[]>([]); const [options, setOptions] = useState<any[]>([]);
const formRef = useRef<ProFormInstance>(); const formRef = useRef<ProFormInstance>();
const [shipmentFee, setShipmentFee] = useState<number>(0);
const [rates, setRates] = useState<API.RateDTO[]>([]); const [rates, setRates] = useState<API.RateDTO[]>([]);
const [ratesLoading, setRatesLoading] = useState(false); const [ratesLoading, setRatesLoading] = useState(false);
const { message } = App.useApp(); const { message } = App.useApp();
const [serviceType, setServiceType] = useState('');
return ( return (
<ModalForm <ModalForm
@ -1084,11 +1042,7 @@ const Shipping: React.FC<{
}, },
}} }}
trigger={ trigger={
<Button type="primary" <Button type="primary">
onClick={() => {
setActiveLine(id);
}}
>
<CodeSandboxOutlined /> <CodeSandboxOutlined />
</Button> </Button>
@ -1122,7 +1076,7 @@ const Shipping: React.FC<{
if (shipmentInfo) shipmentInfo = JSON.parse(shipmentInfo); if (shipmentInfo) shipmentInfo = JSON.parse(shipmentInfo);
return { return {
...data, ...data,
// payment_method_id: shipmentInfo?.payment_method_id, payment_method_id: shipmentInfo?.payment_method_id,
stockPointId: shipmentInfo?.stockPointId, stockPointId: shipmentInfo?.stockPointId,
details: { details: {
destination: { destination: {
@ -1164,11 +1118,11 @@ const Shipping: React.FC<{
{ {
measurements: { measurements: {
weight: { weight: {
unit: 'LBS', unit: 'lb',
value: 1, value: 1,
}, },
cuboid: { cuboid: {
unit: 'IN', unit: 'in',
l: 6, l: 6,
w: 4, w: 4,
h: 4, h: 4,
@ -1179,10 +1133,9 @@ const Shipping: React.FC<{
], ],
}, },
}, },
}; };
}} }}
onFinish={async ({ customer_note, notes, items, details, externalOrderId, ...data }) => { onFinish={async ({ customer_note, notes, items, details, ...data }) => {
details.origin.email_addresses = details.origin.email_addresses =
details.origin.email_addresses.split(','); details.origin.email_addresses.split(',');
details.destination.email_addresses = details.destination.email_addresses =
@ -1191,10 +1144,11 @@ const Shipping: React.FC<{
details.destination.phone_number.phone; details.destination.phone_number.phone;
details.origin.phone_number.number = details.origin.phone_number.phone; details.origin.phone_number.number = details.origin.phone_number.phone;
try { try {
const { success, message: errMsg, ...resShipment } = const { success, message: errMsg } =
await logisticscontrollerCreateshipment( await logisticscontrollerCreateshipment(
{ orderId: id }, { orderId: id },
{ {
service_type: serviceType,
details, details,
...data, ...data,
}, },
@ -1207,7 +1161,7 @@ const Shipping: React.FC<{
localStorage.setItem( localStorage.setItem(
'shipmentInfo', 'shipmentInfo',
JSON.stringify({ JSON.stringify({
// payment_method_id: data.payment_method_id, payment_method_id: data.payment_method_id,
stockPointId: data.stockPointId, stockPointId: data.stockPointId,
region: details.origin.address.region, region: details.origin.address.region,
city: details.origin.address.city, city: details.origin.address.city,
@ -1216,12 +1170,6 @@ const Shipping: React.FC<{
phone_number: details.origin.phone_number, phone_number: details.origin.phone_number,
}), }),
); );
// todo, 直接打印label
// const { resLabel } = await logisticscontrollerGetShipmentLabel(resShipment.data.shipmentId);
// console.log('res', resShipment.data.shipmentId, resLabel);
// const labelContent = resLabel.content;
// printPDF([labelContent]);
return true; return true;
} catch (error) { } catch (error) {
message.error(error?.message || '创建失败'); message.error(error?.message || '创建失败');
@ -1234,11 +1182,6 @@ const Shipping: React.FC<{
} }
}} }}
> >
<ProFormText
label="订单号"
readonly
name={"externalOrderId"}
/>
<ProFormText label="客户备注" readonly name="customer_note" /> <ProFormText label="客户备注" readonly name="customer_note" />
<ProFormList <ProFormList
label="后台备注" label="后台备注"
@ -1270,7 +1213,7 @@ const Shipping: React.FC<{
}} }}
/> />
</Col> </Col>
{/* <Col span={12}> <Col span={12}>
<ProFormSelect <ProFormSelect
label="付款方式" label="付款方式"
name="payment_method_id" name="payment_method_id"
@ -1287,7 +1230,7 @@ const Shipping: React.FC<{
return []; return [];
}} }}
/> />
</Col> */} </Col>
</Row> </Row>
<Row gutter={16}> <Row gutter={16}>
<Col span={12}> <Col span={12}>
@ -1330,7 +1273,7 @@ const Shipping: React.FC<{
return ( return (
data?.map((item) => { data?.map((item) => {
return { return {
label: `${item.name} - ${item.nameCn}`, label: `${item.name} - ${item.nameCn}`,
value: item?.sku, value: item?.sku,
}; };
}) || options }) || options
@ -1606,8 +1549,6 @@ const Shipping: React.FC<{
if (packaging_type === 'package') { if (packaging_type === 'package') {
return ( return (
<ProFormList <ProFormList
min={1}
max={1}
label="纸箱尺寸" label="纸箱尺寸"
name={['details', 'packaging_properties', 'packages']} name={['details', 'packaging_properties', 'packages']}
rules={[ rules={[
@ -1711,8 +1652,11 @@ const Shipping: React.FC<{
label="单位" label="单位"
name={['measurements', 'cuboid', 'unit']} name={['measurements', 'cuboid', 'unit']}
valueEnum={{ valueEnum={{
CM: '厘米', mm: '毫米',
IN: '英寸', cm: '厘米',
m: '米',
in: '英寸',
ft: '英尺',
}} }}
placeholder="请输入单位" placeholder="请输入单位"
rules={[{ required: true, message: '请输入单位' }]} rules={[{ required: true, message: '请输入单位' }]}
@ -1728,8 +1672,7 @@ const Shipping: React.FC<{
<ProFormSelect <ProFormSelect
label="单位" label="单位"
name={['measurements', 'weight', 'unit']} name={['measurements', 'weight', 'unit']}
valueEnum={{ KGS: '千克', LBS: '磅' }} valueEnum={{ kg: '千克', lb: '磅', g: '克', oz: '盎司' }}
// valueEnum={{ KGS: '千克', LBS: '磅', OZS: '盎司' }}
placeholder="请输入单位" placeholder="请输入单位"
rules={[{ required: true, message: '请输入单位' }]} rules={[{ required: true, message: '请输入单位' }]}
/> />
@ -1738,7 +1681,7 @@ const Shipping: React.FC<{
name="description" name="description"
placeholder="请输入描述" placeholder="请输入描述"
width="lg" width="lg"
// rules={[{ required: true, message: '请输入描述' }]} // rules={[{ required: true, message: '请输入描述' }]}
/> />
</ProForm.Group> </ProForm.Group>
</ProFormList> </ProFormList>
@ -1769,8 +1712,7 @@ const Shipping: React.FC<{
<ProFormSelect <ProFormSelect
label="单位" label="单位"
name={['weight', 'unit']} name={['weight', 'unit']}
valueEnum={{ kg: '千克', lb: '磅' }} valueEnum={{ kg: '千克', lb: '磅', g: '克', oz: '盎司' }}
// valueEnum={{ kg: '千克', lb: '磅', oz: '盎司' }}
placeholder="请输入单位" placeholder="请输入单位"
rules={[{ required: true, message: '请输入单位' }]} rules={[{ required: true, message: '请输入单位' }]}
/> />
@ -1790,185 +1732,63 @@ const Shipping: React.FC<{
<Button <Button
loading={ratesLoading} loading={ratesLoading}
onClick={async () => { onClick={async () => {
await formRef?.current?.validateFields(['details']);
setRatesLoading(true);
setRates([]);
const details = formRef?.current?.getFieldFormatValue?.('details');
details.origin.email_addresses =
details.origin.email_addresses.split(',');
details.destination.email_addresses =
details.destination.email_addresses.split(',');
details.destination.phone_number.number =
details.destination.phone_number.phone;
details.origin.phone_number.number =
details.origin.phone_number.phone;
try { try {
const { customer_note, notes, items, details, externalOrderId, ...data } = formRef.current?.getFieldsValue(); const {
const originEmail = details.origin.email_addresses; success,
const destinationEmail = details.destination.email_addresses; message: errMsg,
details.origin.email_addresses = data,
details.origin.email_addresses.split(','); } = await logisticscontrollerGetratelist(details);
details.destination.email_addresses =
details.destination.email_addresses.split(',');
details.destination.phone_number.number =
details.destination.phone_number.phone;
details.origin.phone_number.number = details.origin.phone_number.phone;
const res =
await logisticscontrollerGetshipmentfee(
{
stockPointId: data.stockPointId,
sender: details.origin.contact_name, if (!success) throw new Error(errMsg);
startPhone: details.origin.phone_number, setRates(data || []);
startPostalCode: details.origin.address.postal_code.replace(/\s/g, ''),
pickupAddress: details.origin.address.address_line_1,
shipperCountryCode: details.origin.address.country,
receiver: details.destination.contact_name,
city: details.destination.address.city,
province: details.destination.address.region,
country: details.destination.address.country,
postalCode: details.destination.address.postal_code.replace(/\s/g, ''),
deliveryAddress: details.destination.address.address_line_1,
receiverPhone: details.destination.phone_number.number,
receiverEmail: details.destination.email_addresses,
length: details.packaging_properties.packages[0].measurements.cuboid.l,
width: details.packaging_properties.packages[0].measurements.cuboid.w,
height: details.packaging_properties.packages[0].measurements.cuboid.h,
dimensionUom: details.packaging_properties.packages[0].measurements.cuboid.unit,
weight: details.packaging_properties.packages[0].measurements.weight.value,
weightUom: details.packaging_properties.packages[0].measurements.weight.unit,
},
);
if (!res?.success) throw new Error(res?.message);
const fee = res.data;
setShipmentFee(fee);
details.origin.email_addresses = originEmail;
details.destination.email_addresses = destinationEmail;
formRef.current?.setFieldValue("details", {
...details,
shipmentFee: fee
});
message.success('获取运费成功');
} catch (error) { } catch (error) {
message.error(error?.message || '获取运费失败'); message.error(error?.message || '获取运费失败');
} }
setRatesLoading(false);
}} }}
> >
</Button> </Button>
<ProFormText <ProFormRadio.Group
readonly label="选择运费"
name={["details", "shipmentFee"]} name="service_id"
rules={[{ required: true, message: '请选择运费' }]}
fieldProps={{ fieldProps={{
value: (shipmentFee / 100.0).toFixed(2) onChange: (e) => {
console.log(e.target.value);
const type = rates.find(
(v) => v.service_id === e.target.value,
)?.type;
setServiceType(type);
},
}} }}
options={rates
?.sort((a, b) => Number(a?.total?.value) - Number(b?.total?.value))
?.map((rate) => {
return {
label: `${rate.carrier_name} ${rate.service_name} : ${
rate?.total?.value / 100
}${rate?.total?.currency}(${rate.transit_time_days})`,
value: rate.service_id,
};
})}
/> />
</ModalForm> </ModalForm>
); );
}; };
const SalesChange: React.FC<{
id: number;
detailRef?: React.MutableRefObject<ActionType | undefined>;
reShipping?: boolean;
}> = ({ id, detailRef }) => {
const formRef = useRef<ProFormInstance>();
return (
<ModalForm
formRef={formRef}
title="换货"
size="large"
width="80vw"
modalProps={{
destroyOnHidden: true,
styles: {
body: { maxHeight: '65vh', overflowY: 'auto', overflowX: 'hidden' },
},
}}
trigger={
<Button type="primary">
<CodeSandboxOutlined />
</Button>
}
request={async () => {
const { data, success }: API.OrderDetailRes =
await ordercontrollerGetorderdetail({
orderId: id,
});
if (!success || !data) return {};
data.sales = data.sales?.reduce((acc: API.OrderSale[], cur: API.OrderSale) => {
let idx = acc.findIndex((v: any) => v.productId === cur.productId);
if (idx === -1) {
acc.push(cur);
} else {
acc[idx].quantity += cur.quantity;
}
return acc;
},
[],
);
// setOptions(
// data.sales?.map((item) => ({
// label: item.name,
// value: item.sku,
// })) || [],
// );
return { ...data };
}}
onFinish={async (formData: any) => {
const { sales } = formData;
const res = await ordercontrollerUpdateorderitems({orderId:id}, sales);
if (!res.success) {
message.error(`更新货物信息失败: ${res.message}`);
return false;
}
message.success('更新成功')
detailRef?.current?.reload();
return true;
}}
>
<ProFormList
label="换货产品"
name="sales"
>
<ProForm.Group>
<ProFormSelect
params={{ }}
request={async ({ keyWords }) => {
try {
const { data } = await productcontrollerSearchproducts({
name: keyWords,
});
return (
data?.map((item) => {
return {
label: `${item.name} - ${item.nameCn}`,
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>
</ModalForm>
);
}
const CreateOrder: React.FC<{ const CreateOrder: React.FC<{
tableRef?: React.MutableRefObject<ActionType | undefined>; tableRef?: React.MutableRefObject<ActionType | undefined>;
}> = ({ tableRef }) => { }> = ({ tableRef }) => {
@ -2032,7 +1852,7 @@ const CreateOrder: React.FC<{
return ( return (
data?.map((item) => { data?.map((item) => {
return { return {
label: `${item.name} - ${item.nameCn}`, label: `${item.name} - ${item.nameCn}`,
value: item?.sku, value: item?.sku,
}; };
}) || options }) || options

View File

@ -23,7 +23,7 @@ const ListPage: React.FC = () => {
if(!data.inactiveRes) return {} if(!data.inactiveRes) return {}
const xAxisData = data?.inactiveRes?.map(v=> v.order_month)?.sort(_=>-1) const xAxisData = data?.inactiveRes?.map(v=> v.order_month)?.sort(_=>-1)
const arr = data?.res?.map(v=>v.first_order_month_group) const arr = data?.res?.map(v=>v.first_order_month_group)
const uniqueArr = arr.filter((item, index) => arr.indexOf(item) === index).sort((a,b)=> a.localeCompare(b)) const uniqueArr = arr.filter((item, index) => arr.indexOf(item) === index)
const series = [ const series = [
{ {
name: '新客户', name: '新客户',

View File

@ -35,12 +35,6 @@ const ListPage: React.FC = () => {
], ],
}, },
}, },
{
title: '排除套装',
dataIndex: 'exceptPackage',
valueType: 'switch',
hideInTable: true,
},
{ {
title: '产品名称', title: '产品名称',
dataIndex: 'name', dataIndex: 'name',
@ -58,12 +52,12 @@ const ListPage: React.FC = () => {
}, },
hideInTable: true, hideInTable: true,
}, },
// { {
// title: '分类', title: '分类',
// dataIndex: 'categoryName', dataIndex: 'categoryName',
// hideInSearch: true, hideInSearch: true,
// hideInTable: isSource, hideInTable: isSource,
// }, },
{ {
title: '数量', title: '数量',
dataIndex: 'totalQuantity', dataIndex: 'totalQuantity',

View File

@ -525,7 +525,6 @@ const DetailForm: React.FC<{
id: number; id: number;
}; };
}> = ({ tableRef, values }) => { }> = ({ tableRef, values }) => {
const detailsActionRef = useRef<ActionType>();
const { message } = App.useApp(); const { message } = App.useApp();
const [form] = Form.useForm(); const [form] = Form.useForm();
const initialValues = { const initialValues = {

View File

@ -1,6 +1,6 @@
import { import {
logisticscontrollerGetorderlist, logisticscontrollerGetlistbytrackingid,
logisticscontrollerGetlistbyorderid logisticscontrollerGettrackingnumber,
} from '@/servers/api/logistics'; } from '@/servers/api/logistics';
import { SearchOutlined } from '@ant-design/icons'; import { SearchOutlined } from '@ant-design/icons';
import { PageContainer, ProFormSelect } from '@ant-design/pro-components'; import { PageContainer, ProFormSelect } from '@ant-design/pro-components';
@ -8,7 +8,7 @@ import { useState } from 'react';
const TrackPage: React.FC = () => { const TrackPage: React.FC = () => {
const [id, setId] = useState<string>(); const [id, setId] = useState<string>();
const [data, setData] = useState({}); const [data, setData] = useState([]);
return ( return (
<PageContainer> <PageContainer>
<ProFormSelect <ProFormSelect
@ -17,7 +17,7 @@ const TrackPage: React.FC = () => {
request={async ({ keyWords }) => { request={async ({ keyWords }) => {
if (!keyWords || keyWords.length < 3) return []; if (!keyWords || keyWords.length < 3) return [];
const { data: trackList } = const { data: trackList } =
await logisticscontrollerGetorderlist({ number: keyWords }); await logisticscontrollerGettrackingnumber({ number: keyWords });
return trackList?.map((v) => { return trackList?.map((v) => {
return { return {
label: v.siteName + ' ' + v.externalOrderId, label: v.siteName + ' ' + v.externalOrderId,
@ -27,16 +27,9 @@ const TrackPage: React.FC = () => {
}} }}
fieldProps={{ fieldProps={{
prefix: '订单号', prefix: '订单号',
async onChange(value: string) { onChange(value: string) {
setId(value); setId(value);
setData({})
const { data } = await logisticscontrollerGetlistbyorderid({
id,
});
setData(data);
}, },
placeholder: '请输入订单号',
allowClear: false, allowClear: false,
suffixIcon: ( suffixIcon: (
<SearchOutlined <SearchOutlined
@ -44,8 +37,8 @@ const TrackPage: React.FC = () => {
if (!id) { if (!id) {
return; return;
} }
const { data } = await logisticscontrollerGetlistbyorderid({ const { data } = await logisticscontrollerGetlistbytrackingid({
id, shipment_id: id,
}); });
setData(data); setData(data);
}} }}
@ -53,32 +46,22 @@ const TrackPage: React.FC = () => {
), ),
}} }}
/> />
{ <div>
data?.item ? {data.map((item) => (
<div> <div>
<div> <h4>
<h4></h4> {item.name} * {item.quantity}
{data?.item?.map((item) => ( </h4>
<div style={{ paddingLeft: 20, color: 'blue' }}> <div style={{ paddingLeft: 20, color: 'blue' }}>
{item.name} * {item.quantity} {item.constitution.map((v) => (
<div>
{v.name} * {v.quantity * item.quantity}
</div> </div>
))} ))}
</div> </div>
</div> : <></> </div>
} ))}
{ </div>
data?.saleItem ?
<div>
<div>
<h4></h4>
{data?.saleItem?.map((item) => (
<div style={{ paddingLeft: 20, color: 'blue' }}>
{item.name} * {item.quantity}
</div>
))}
</div>
</div> : <></>
}
</PageContainer> </PageContainer>
); );
}; };

View File

@ -36,20 +36,6 @@ export async function logisticscontrollerCreateshippingaddress(
}); });
} }
/** 此处后端没有提供注释 POST /logistics/deleteShipment/${param0} */
export async function logisticscontrollerDeleteshipment(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.logisticscontrollerDeleteshipmentParams,
options?: { [key: string]: any },
) {
const { id: param0, ...queryParams } = params;
return request<API.BooleanRes>(`/logistics/deleteShipment/${param0}`, {
method: 'POST',
params: { ...queryParams },
...(options || {}),
});
}
/** 此处后端没有提供注释 DELETE /logistics/delShippingAddress/${param0} */ /** 此处后端没有提供注释 DELETE /logistics/delShippingAddress/${param0} */
export async function logisticscontrollerDelshippingaddress( export async function logisticscontrollerDelshippingaddress(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象) // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
@ -64,28 +50,13 @@ export async function logisticscontrollerDelshippingaddress(
}); });
} }
/** 此处后端没有提供注释 POST /logistics/getListByOrderId */ /** 此处后端没有提供注释 POST /logistics/getListByTrackingId */
export async function logisticscontrollerGetlistbyorderid( export async function logisticscontrollerGetlistbytrackingid(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象) // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.logisticscontrollerGetlistbyorderidParams, params: API.logisticscontrollerGetlistbytrackingidParams,
options?: { [key: string]: any }, options?: { [key: string]: any },
) { ) {
return request<any>('/logistics/getListByOrderId', { return request<any>('/logistics/getListByTrackingId', {
method: 'POST',
params: {
...params,
},
...(options || {}),
});
}
/** 此处后端没有提供注释 POST /logistics/getOrderList */
export async function logisticscontrollerGetorderlist(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.logisticscontrollerGetorderlistParams,
options?: { [key: string]: any },
) {
return request<any>('/logistics/getOrderList', {
method: 'POST', method: 'POST',
params: { params: {
...params, ...params,
@ -134,35 +105,6 @@ export async function logisticscontrollerGetservicelist(
}); });
} }
/** 此处后端没有提供注释 POST /logistics/getShipmentFee */
export async function logisticscontrollerGetshipmentfee(
body: API.ShipmentFeeBookDTO,
options?: { [key: string]: any },
) {
return request<API.BooleanRes>('/logistics/getShipmentFee', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** 此处后端没有提供注释 POST /logistics/getShipmentLabel/${param0} */
export async function logisticscontrollerGetshipmentlabel(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.logisticscontrollerGetshipmentlabelParams,
options?: { [key: string]: any },
) {
const { shipmentId: param0, ...queryParams } = params;
return request<API.BooleanRes>(`/logistics/getShipmentLabel/${param0}`, {
method: 'POST',
params: { ...queryParams },
...(options || {}),
});
}
/** 此处后端没有提供注释 GET /logistics/getShippingAddressList */ /** 此处后端没有提供注释 GET /logistics/getShippingAddressList */
export async function logisticscontrollerGetshippingaddresslist(options?: { export async function logisticscontrollerGetshippingaddresslist(options?: {
[key: string]: any; [key: string]: any;
@ -176,6 +118,21 @@ export async function logisticscontrollerGetshippingaddresslist(options?: {
); );
} }
/** 此处后端没有提供注释 POST /logistics/getTrackingNumber */
export async function logisticscontrollerGettrackingnumber(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.logisticscontrollerGettrackingnumberParams,
options?: { [key: string]: any },
) {
return request<any>('/logistics/getTrackingNumber', {
method: 'POST',
params: {
...params,
},
...(options || {}),
});
}
/** 此处后端没有提供注释 GET /logistics/list */ /** 此处后端没有提供注释 GET /logistics/list */
export async function logisticscontrollerGetlist(options?: { export async function logisticscontrollerGetlist(options?: {
[key: string]: any; [key: string]: any;
@ -243,17 +200,3 @@ export async function logisticscontrollerUpdateshippingaddress(
...(options || {}), ...(options || {}),
}); });
} }
/** 此处后端没有提供注释 POST /logistics/updateState/${param0} */
export async function logisticscontrollerUpdateshipmentstate(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.logisticscontrollerUpdateshipmentstateParams,
options?: { [key: string]: any },
) {
const { shipmentId: param0, ...queryParams } = params;
return request<any>(`/logistics/updateState/${param0}`, {
method: 'POST',
params: { ...queryParams },
...(options || {}),
});
}

View File

@ -208,22 +208,3 @@ export async function ordercontrollerSyncorderbyid(
...(options || {}), ...(options || {}),
}); });
} }
/** 此处后端没有提供注释 POST /order/updateOrderItems/${param0} */
export async function ordercontrollerUpdateorderitems(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.ordercontrollerUpdateorderitemsParams,
body: Record<string, any>,
options?: { [key: string]: any },
) {
const { orderId: param0, ...queryParams } = params;
return request<API.BooleanRes>(`/order/updateOrderItems/${param0}`, {
method: 'POST',
headers: {
'Content-Type': 'text/plain',
},
params: { ...queryParams },
data: body,
...(options || {}),
});
}

View File

@ -141,6 +141,11 @@ declare namespace API {
email_addresses?: any; email_addresses?: any;
}; };
type LoginDTO = {
username?: string;
password?: string;
};
type LoginRes = { type LoginRes = {
/** 状态码 */ /** 状态码 */
code?: number; code?: number;
@ -163,24 +168,16 @@ declare namespace API {
orderId: number; orderId: number;
}; };
type logisticscontrollerDeleteshipmentParams = {
id: number;
};
type logisticscontrollerDelshipmentParams = { type logisticscontrollerDelshipmentParams = {
id: number; id: string;
}; };
type logisticscontrollerDelshippingaddressParams = { type logisticscontrollerDelshippingaddressParams = {
id: number; id: number;
}; };
type logisticscontrollerGetlistbyorderidParams = { type logisticscontrollerGetlistbytrackingidParams = {
id?: number; shipment_id?: string;
};
type logisticscontrollerGetorderlistParams = {
number?: string;
}; };
type logisticscontrollerGetservicelistParams = { type logisticscontrollerGetservicelistParams = {
@ -192,12 +189,8 @@ declare namespace API {
isActive?: boolean; isActive?: boolean;
}; };
type logisticscontrollerGetshipmentlabelParams = { type logisticscontrollerGettrackingnumberParams = {
shipmentId: number; number?: string;
};
type logisticscontrollerUpdateshipmentstateParams = {
shipmentId: number;
}; };
type logisticscontrollerUpdateshippingaddressParams = { type logisticscontrollerUpdateshippingaddressParams = {
@ -220,7 +213,6 @@ declare namespace API {
externalOrderId?: string; externalOrderId?: string;
status?: any; status?: any;
orderStatus?: any; orderStatus?: any;
shipmentId?: number;
currency?: string; currency?: string;
currency_symbol?: string; currency_symbol?: string;
prices_include_tax?: boolean; prices_include_tax?: boolean;
@ -345,17 +337,12 @@ declare namespace API {
siteId: string; siteId: string;
}; };
type ordercontrollerUpdateorderitemsParams = {
orderId: number;
};
type OrderDetail = { type OrderDetail = {
id?: number; id?: number;
siteId?: string; siteId?: string;
externalOrderId?: string; externalOrderId?: string;
status?: any; status?: any;
orderStatus?: any; orderStatus?: any;
shipmentId?: number;
currency?: string; currency?: string;
currency_symbol?: string; currency_symbol?: string;
prices_include_tax?: boolean; prices_include_tax?: boolean;
@ -399,6 +386,7 @@ declare namespace API {
items?: OrderItem[]; items?: OrderItem[];
sales?: OrderSale[]; sales?: OrderSale[];
refundItems?: OrderRefundItem[]; refundItems?: OrderRefundItem[];
trackings?: Tracking[];
notes?: OrderNote[]; notes?: OrderNote[];
}; };
@ -501,11 +489,7 @@ declare namespace API {
/** sku */ /** sku */
sku?: string; sku?: string;
quantity?: number; quantity?: number;
exceptPackage?: boolean; isPackage?: boolean;
isYoone?: boolean;
isZex?: boolean;
size?: number;
isYooneNew?: boolean;
/** 创建时间 */ /** 创建时间 */
createdAt?: string; createdAt?: string;
/** 更新时间 */ /** 更新时间 */
@ -522,11 +506,7 @@ declare namespace API {
/** sku */ /** sku */
sku?: string; sku?: string;
quantity?: number; quantity?: number;
exceptPackage?: boolean; isPackage?: boolean;
isYoone?: boolean;
isZex?: boolean;
size?: number;
isYooneNew?: boolean;
/** 创建时间 */ /** 创建时间 */
createdAt?: string; createdAt?: string;
/** 更新时间 */ /** 更新时间 */
@ -1004,32 +984,26 @@ declare namespace API {
type ShipmentBookDTO = { type ShipmentBookDTO = {
sales?: OrderSale[]; sales?: OrderSale[];
payment_method_id?: string;
service_id?: string;
service_type?: string;
details?: ShippingDetailsDTO; details?: ShippingDetailsDTO;
stockPointId?: number; stockPointId?: number;
orderIds?: number[]; orderIds?: number[];
}; };
type ShipmentFeeBookDTO = { type ShipmentItem = {
stockPointId?: number; id?: number;
sender?: string; shipment_id?: string;
startPhone?: string; productId?: number;
startPostalCode?: string; name?: string;
pickupAddress?: string; /** sku */
shipperCountryCode?: string; sku?: string;
receiver?: string; quantity?: number;
city?: string; /** 创建时间 */
province?: string; createdAt: string;
country?: string; /** 更新时间 */
postalCode?: string; updatedAt: string;
deliveryAddress?: string;
receiverPhone?: string;
receiverEmail?: string;
length?: number;
width?: number;
height?: number;
dimensionUom?: string;
weight?: number;
weightUom?: string;
}; };
type ShippingAddress = { type ShippingAddress = {
@ -1058,7 +1032,6 @@ declare namespace API {
}; };
type ShippingDetailsDTO = { type ShippingDetailsDTO = {
shipmentFee?: number;
origin?: Location; origin?: Location;
destination?: Destination; destination?: Destination;
expected_ship_date?: Date; expected_ship_date?: Date;
@ -1297,6 +1270,27 @@ declare namespace API {
minute?: string; minute?: string;
}; };
type Tracking = {
id?: string;
tracking_provider?: string;
unique_id?: string;
transaction_number?: string;
primary_tracking_number?: string;
tracking_numbers?: string[];
tracking_url?: string;
return_tracking_number?: string;
bol_number?: string;
pickup_confirmation_number?: string;
customs_invoice_url?: string;
rate?: Record<string, any>;
labels?: any;
/** 创建时间 */
createdAt: string;
/** 更新时间 */
updatedAt: string;
products?: ShipmentItem[];
};
type UpdateCategoryDTO = { type UpdateCategoryDTO = {
/** 分类名称 */ /** 分类名称 */
name?: string; name?: string;
@ -1475,7 +1469,7 @@ declare namespace API {
/** 是否促销中 */ /** 是否促销中 */
on_sale?: boolean; on_sale?: boolean;
/** 产品类型 */ /** 产品类型 */
type?: 'simple' | 'variable' | 'woosb'; type?: 'simple' | 'variable';
/** 创建时间 */ /** 创建时间 */
createdAt: string; createdAt: string;
/** 更新时间 */ /** 更新时间 */

View File

@ -37,13 +37,13 @@ export async function usercontrollerListusers(options?: {
/** 此处后端没有提供注释 POST /user/login */ /** 此处后端没有提供注释 POST /user/login */
export async function usercontrollerLogin( export async function usercontrollerLogin(
body: Record<string, any>, body: API.LoginDTO,
options?: { [key: string]: any }, options?: { [key: string]: any },
) { ) {
return request<API.LoginRes>('/user/login', { return request<API.LoginRes>('/user/login', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'text/plain', 'Content-Type': 'application/json',
}, },
data: body, data: body,
...(options || {}), ...(options || {}),

View File

@ -1,3 +0,0 @@
.selected-line-order-protable {
background-color: #add8e6;
}

View File

@ -59,47 +59,3 @@ export function formatShipmentState(state: string) {
return ''; return '';
} }
} }
export function formatUniuniShipmentState(state: string) {
const UNIUNI_STATUS_ENUM = {
'190': 'ORDER_RECEIVED',
'192': 'CUSTOM_HOLD',
'195': 'GATEWAY_TRANSIT_OUT',
'198': 'CUSTOM_RELEASE_DIRECT',
'199': 'GATEWAY_TRANSIT',
'200': 'PARCEL_SCANNED',
'202': 'IN_TRANSIT',
'203': 'DELIVERED',
'204': 'TRANSSHIPMENT',
'206': 'WRONG_ADDRESS_FROM_TRANSIT',
'207': 'PARCEL_LOST',
'209': 'OTHER_EXCEPTION',
'211': 'RETURN_OFFICE_FROM_TRANSIT',
'212': 'WRONG_ADDRESS_FROM_RECEIVE',
'213': 'STORAGE_30_DAYS_FROM_OFFICE',
'214': 'STORAGE_30_DAYS_AFTER_SCAN',
'215': 'PARCEL_ABANDONED',
'216': 'SELF_PICK_UP',
'217': 'TRANSSHIPMENT_COMPLETE',
'218': 'SCANNED_PARCEL_MISSING',
'219': 'WRONG_ROUTE_PARCEL',
'220': 'SECOND_DELIVERY',
'221': 'RETURNED_PARCEL_SCANNED',
'222': 'REJECTED_PARCEL_FROM_TRANSIT',
'223': 'CHANGED_ORDER_RESENT',
'224': 'RESENT_ORDER_VOIDED',
'225': 'FORWARDED_3RDPARTY',
'226': 'STORAGE_3RDPARTY_SERVICE_POINT',
'228': 'SECOND_DELIVERED',
'229': 'DROP_OFF_SERVICE_POINTS',
'230': 'RETURN TO SENDER WAREHOUSE',
'231': 'FAILED_DELIVERY_RETRY1',
'232': 'FAILED_DELIVERY_RETRY2',
'255': 'Gateway_To_Gateway_Transit'
}
if (state in UNIUNI_STATUS_ENUM) {
return UNIUNI_STATUS_ENUM[state];
} else {
return '未知状态';
}
}

View File

@ -6,7 +6,6 @@ export async function printPDF(urls: string[]) {
function next() { function next() {
if (index >= urls.length) return; if (index >= urls.length) return;
printJS({ printJS({
base64: true,
printable: urls[index], printable: urls[index],
type: 'pdf', type: 'pdf',
showModal: true, showModal: true,