forked from yoone/WEB
1
0
Fork 0

Compare commits

...

34 Commits

Author SHA1 Message Date
黄珑 35c26c07c4 销售统计增加了筛选内容 2025-09-12 12:27:40 +00:00
cll 5e7bd8647e fix: 物流打印label 2025-09-03 10:53:07 +08:00
cll 23a40af797 fix: bug 2025-09-02 14:34:14 +08:00
cll 0da1459e3f fix:接口参数调整 2025-09-02 14:32:11 +08:00
cll c0f05bc6fe fix:订单来源排序 2025-09-01 16:38:44 +08:00
cll 46202d602e fix: 接口参数调整 2025-09-01 14:41:55 +08:00
cll ac948ac0f4 fix: track查询更换后产品 2025-09-01 11:52:27 +08:00
黄珑 c41f0e668e 增加了permission对左侧菜单显示的控制 2025-08-28 18:19:28 +08:00
黄珑 b432b3af17 补充: 高亮样式文件 2025-08-25 16:03:00 +08:00
黄珑 c77020f3d6 Fix: 换货sku初始值显示异常 2025-08-25 16:00:57 +08:00
黄珑 e19b6c3656 订单页,查看详情和创建运单增加高亮 2025-08-25 16:00:57 +08:00
黄珑 68a7b02d21 Fix: 获取运费增加正确提示 2025-08-25 01:41:06 +00:00
cll d54782f742 fix:销售统计 2025-08-23 11:47:10 +08:00
cll c815ab3396 fix:hash build 2025-08-23 09:23:25 +08:00
黄珑 fb79163721 Feature: 增加换货功能 2025-08-21 16:21:37 +08:00
黄珑 b9449c3a8a Fix: Fix shipment fee error 2025-08-16 11:36:51 +08:00
黄珑 2cc36e065b Fix: 仓库管理页显示网站名称 2025-08-13 18:07:58 +08:00
黄珑 1c0ee37b72 Fix: bug fix 2025-08-13 17:51:27 +08:00
黄珑 3c4a53b4bb 创建运单时增加订单号 2025-08-13 16:45:58 +08:00
黄珑 b6ba23864a Feature update shipment
物流管理增加订单号
取消运单响应
取消物流二次确认
追踪物流状态
取消运单检测物流检测
2025-08-13 12:27:12 +08:00
黄珑 081b87df7b 取消订单响应,取消物流二次确认 2025-08-11 15:13:27 +08:00
黄珑 00ee8d8656 物流管理:增加订单号,完善搜索功能 2025-08-11 13:57:58 +08:00
黄珑 0356c77bad Fix: 增加删除运单按钮 2025-08-09 19:47:48 +08:00
cll cb596ada87 Merge branch 'dev/cll-fix' 2025-08-08 20:47:21 +08:00
cll 95617d1c28 fix: bug 2025-08-08 20:46:58 +08:00
cll 45fb186ed3 Merge branch 'dev/cll-fix' 2025-08-08 20:24:45 +08:00
cll 94962c4835 fix: 订单列表-历史订单 2025-08-08 20:24:08 +08:00
longbot 644fb1775f Merge pull request 'Fix: bug fix' (#3) from longbot/WEB:Feature-add-shipment into main
Reviewed-on: yoone/WEB#3
2025-08-08 11:33:54 +00:00
黄珑 4da8fbfdc8 Fix: bug fix 2025-08-08 19:24:15 +08:00
yoone d609e563ff Merge pull request 'Fix bug' (#2) from longbot/WEB:Feature-add-shipment into main
Reviewed-on: yoone/WEB#2
2025-08-07 12:20:55 +00:00
黄珑 df374c4b35 Fix bug 2025-08-07 20:19:11 +08:00
yoone 7e6de57924 Merge pull request 'Feature-add-shipment' (#1) from longbot/WEB:Feature-add-shipment into main
Reviewed-on: yoone/WEB#1
2025-08-07 08:36:52 +00:00
黄珑 703e2c87cb Fix bug 2025-08-06 19:27:48 +08:00
黄珑 cb7a27530a Feature: add shipment 2025-08-06 10:59:14 +08:00
21 changed files with 820 additions and 405 deletions

1
.gitignore vendored
View File

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

View File

@ -6,6 +6,7 @@ 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: {},
@ -25,7 +26,7 @@ export default defineConfig({
{ {
name: '组织架构', name: '组织架构',
path: '/organiza', path: '/organiza',
access: 'canSeeSuper', access: 'canSeeOrganiza',
routes: [ routes: [
{ {
name: '用户管理', name: '用户管理',
@ -37,6 +38,7 @@ export default defineConfig({
{ {
name: '商品管理', name: '商品管理',
path: '/product', path: '/product',
access: 'canSeeProduct',
routes: [ routes: [
{ {
name: '商品分类', name: '商品分类',
@ -68,6 +70,7 @@ export default defineConfig({
{ {
name: '库存管理', name: '库存管理',
path: '/stock', path: '/stock',
access: 'canSeeStock',
routes: [ routes: [
{ {
name: '库存列表', name: '库存列表',
@ -99,7 +102,7 @@ export default defineConfig({
{ {
name: '订单管理', name: '订单管理',
path: '/order', path: '/order',
access: 'canSeeAdmin', access: 'canSeeOrder',
routes: [ routes: [
{ {
name: '订单列表', name: '订单列表',
@ -116,6 +119,7 @@ export default defineConfig({
{ {
name: '客户管理', name: '客户管理',
path: '/customer', path: '/customer',
access: 'canSeeCustomer',
routes: [ routes: [
{ {
name: '客户列表', name: '客户列表',
@ -124,54 +128,52 @@ export default defineConfig({
}, },
], ],
}, },
// { {
// name: '物流管理', name: '物流管理',
// path: '/logistics', path: '/logistics',
// routes: [ access: 'canSeeLogistics',
// { routes: [
// name: '服务商', {
// path: '/logistics/services', name: '服务商',
// component: './Logistics/Services', path: '/logistics/services',
// }, component: './Logistics/Services',
// { },
// name: '地址管理', {
// path: '/logistics/address', name: '地址管理',
// component: './Logistics/Address', path: '/logistics/address',
// }, component: './Logistics/Address',
// { },
// name: '物流列表', {
// path: '/logistics/list', name: '物流列表',
// component: './Logistics/List', path: '/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,6 +26,7 @@
"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,9 +1,22 @@
export default (initialState: any) => { export default (initialState: any) => {
const canSeeSuper = initialState?.user?.isSuper; const isSuper = initialState?.user?.isSuper ?? false;
const canSeeAdmin = const isAdmin = initialState?.user?.Admin ?? false;
initialState?.user?.isSuper || initialState?.user?.isAdmin; const canSeeOrganiza = (isSuper || isAdmin) || (initialState?.user?.permissions?.includes('organiza') ?? false);
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 {
canSeeSuper, canSeeOrganiza,
canSeeAdmin, canSeeProduct,
canSeeStock,
canSeeOrder,
canSeeCustomer,
canSeeLogistics,
canSeeStatistics,
}; };
}; };

View File

@ -23,7 +23,6 @@ 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,21 +1,27 @@
import { logisticscontrollerGetlist } from '@/servers/api/logistics'; import { logisticscontrollerGetlist, logisticscontrollerGetshipmentlabel,
logisticscontrollerDeleteshipment,
logisticscontrollerUpdateshipmentstate
} from '@/servers/api/logistics';
import { stockcontrollerGetallstockpoints } from '@/servers/api/stock'; import { stockcontrollerGetallstockpoints } from '@/servers/api/stock';
import { formatShipmentState } from '@/utils/format'; import { formatUniuniShipmentState } 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 } from 'antd'; import { App, Button, Divider, Popconfirm } 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>[] = [
{ {
@ -26,7 +32,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();
@ -36,17 +42,34 @@ 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: 'primary_tracking_number', dataIndex: 'return_tracking_number',
render(_, record) { render(_, record) {
return ( return (
<> <>
{record.primary_tracking_number} {record.return_tracking_number}
<CopyOutlined <CopyOutlined
onClick={async () => { onClick={async () => {
try { try {
await navigator.clipboard.writeText(record.tracking_url); await navigator.clipboard.writeText(record.return_tracking_number);
message.success('复制成功!'); message.success('复制成功!');
} catch (err) { } catch (err) {
message.error('复制失败!'); message.error('复制失败!');
@ -62,7 +85,7 @@ const ListPage: React.FC = () => {
dataIndex: 'state', dataIndex: 'state',
hideInSearch: true, hideInSearch: true,
render(_, record) { render(_, record) {
return formatShipmentState(record.state); return formatUniuniShipmentState(record.state);
}, },
}, },
{ {
@ -76,20 +99,62 @@ 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);
}} }}
> >
Label
</Button> </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,11 +1,16 @@
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,
@ -19,6 +24,7 @@ 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';
@ -58,10 +64,12 @@ import {
Button, Button,
Card, Card,
Col, Col,
Descriptions,
Divider, Divider,
Drawer, Drawer,
Dropdown, Dropdown,
Empty, Empty,
message,
Popconfirm, Popconfirm,
Radio, Radio,
Row, Row,
@ -69,13 +77,16 @@ 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 = [
@ -257,7 +268,7 @@ const ListPage: React.FC = () => {
record.orderStatus, record.orderStatus,
) ? ( ) ? (
<> <>
<Shipping id={record.id as number} tableRef={actionRef} /> <Shipping id={record.id as number} tableRef={actionRef} setActiveLine={setActiveLine}/>
<Divider type="vertical" /> <Divider type="vertical" />
</> </>
) : ( ) : (
@ -268,6 +279,7 @@ 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
@ -307,6 +319,14 @@ 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} />,
@ -377,6 +397,9 @@ 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} />,
@ -464,7 +487,8 @@ const Detail: React.FC<{
tableRef: React.MutableRefObject<ActionType | undefined>; tableRef: React.MutableRefObject<ActionType | undefined>;
orderId: number; orderId: number;
record: API.Order; record: API.Order;
}> = ({ tableRef, orderId, record }) => { setActiveLine: Function
}> = ({ 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>();
@ -475,6 +499,7 @@ 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);
@ -494,7 +519,10 @@ const Detail: React.FC<{
return ( return (
<> <>
<Button key="detail" type="primary" onClick={() => setVisiable(true)}> <Button key="detail" type="primary" onClick={() => {
setVisiable(true);
setActiveLine(record.id);
}}>
<FileDoneOutlined /> <FileDoneOutlined />
</Button> </Button>
@ -847,6 +875,18 @@ 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}
@ -877,6 +917,7 @@ 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="暂无物流信息" />;
} }
@ -1020,14 +1061,15 @@ 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;
}> = ({ id, tableRef, descRef, reShipping = false }) => { setActiveLine: Function;
}> = ({ 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
@ -1042,7 +1084,11 @@ const Shipping: React.FC<{
}, },
}} }}
trigger={ trigger={
<Button type="primary"> <Button type="primary"
onClick={() => {
setActiveLine(id);
}}
>
<CodeSandboxOutlined /> <CodeSandboxOutlined />
</Button> </Button>
@ -1076,7 +1122,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: {
@ -1118,11 +1164,11 @@ const Shipping: React.FC<{
{ {
measurements: { measurements: {
weight: { weight: {
unit: 'lb', unit: 'LBS',
value: 1, value: 1,
}, },
cuboid: { cuboid: {
unit: 'in', unit: 'IN',
l: 6, l: 6,
w: 4, w: 4,
h: 4, h: 4,
@ -1133,9 +1179,10 @@ const Shipping: React.FC<{
], ],
}, },
}, },
}; };
}} }}
onFinish={async ({ customer_note, notes, items, details, ...data }) => { onFinish={async ({ customer_note, notes, items, details, externalOrderId, ...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 =
@ -1144,11 +1191,10 @@ 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 } = const { success, message: errMsg, ...resShipment } =
await logisticscontrollerCreateshipment( await logisticscontrollerCreateshipment(
{ orderId: id }, { orderId: id },
{ {
service_type: serviceType,
details, details,
...data, ...data,
}, },
@ -1161,7 +1207,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,
@ -1170,6 +1216,12 @@ 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 || '创建失败');
@ -1182,6 +1234,11 @@ 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="后台备注"
@ -1213,7 +1270,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"
@ -1230,7 +1287,7 @@ const Shipping: React.FC<{
return []; return [];
}} }}
/> />
</Col> </Col> */}
</Row> </Row>
<Row gutter={16}> <Row gutter={16}>
<Col span={12}> <Col span={12}>
@ -1549,6 +1606,8 @@ 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={[
@ -1652,11 +1711,8 @@ const Shipping: React.FC<{
label="单位" label="单位"
name={['measurements', 'cuboid', 'unit']} name={['measurements', 'cuboid', 'unit']}
valueEnum={{ valueEnum={{
mm: '毫米', CM: '厘米',
cm: '厘米', IN: '英寸',
m: '米',
in: '英寸',
ft: '英尺',
}} }}
placeholder="请输入单位" placeholder="请输入单位"
rules={[{ required: true, message: '请输入单位' }]} rules={[{ required: true, message: '请输入单位' }]}
@ -1672,7 +1728,8 @@ const Shipping: React.FC<{
<ProFormSelect <ProFormSelect
label="单位" label="单位"
name={['measurements', 'weight', 'unit']} name={['measurements', 'weight', 'unit']}
valueEnum={{ kg: '千克', lb: '磅', g: '克', oz: '盎司' }} valueEnum={{ KGS: '千克', LBS: '磅' }}
// valueEnum={{ KGS: '千克', LBS: '磅', OZS: '盎司' }}
placeholder="请输入单位" placeholder="请输入单位"
rules={[{ required: true, message: '请输入单位' }]} rules={[{ required: true, message: '请输入单位' }]}
/> />
@ -1712,7 +1769,8 @@ const Shipping: React.FC<{
<ProFormSelect <ProFormSelect
label="单位" label="单位"
name={['weight', 'unit']} name={['weight', 'unit']}
valueEnum={{ kg: '千克', lb: '磅', g: '克', oz: '盎司' }} valueEnum={{ kg: '千克', lb: '磅' }}
// valueEnum={{ kg: '千克', lb: '磅', oz: '盎司' }}
placeholder="请输入单位" placeholder="请输入单位"
rules={[{ required: true, message: '请输入单位' }]} rules={[{ required: true, message: '请输入单位' }]}
/> />
@ -1732,63 +1790,185 @@ const Shipping: React.FC<{
<Button <Button
loading={ratesLoading} loading={ratesLoading}
onClick={async () => { onClick={async () => {
await formRef?.current?.validateFields(['details']); try {
setRatesLoading(true); const { customer_note, notes, items, details, externalOrderId, ...data } = formRef.current?.getFieldsValue();
setRates([]); const originEmail = details.origin.email_addresses;
const details = formRef?.current?.getFieldFormatValue?.('details'); const destinationEmail = details.destination.email_addresses;
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 =
details.destination.email_addresses.split(','); details.destination.email_addresses.split(',');
details.destination.phone_number.number = details.destination.phone_number.number =
details.destination.phone_number.phone; details.destination.phone_number.phone;
details.origin.phone_number.number = details.origin.phone_number.number = details.origin.phone_number.phone;
details.origin.phone_number.phone; const res =
try { await logisticscontrollerGetshipmentfee(
const { {
success, stockPointId: data.stockPointId,
message: errMsg,
data,
} = await logisticscontrollerGetratelist(details);
if (!success) throw new Error(errMsg); sender: details.origin.contact_name,
setRates(data || []); startPhone: details.origin.phone_number,
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>
<ProFormRadio.Group <ProFormText
label="选择运费" readonly
name="service_id" name={["details", "shipmentFee"]}
rules={[{ required: true, message: '请选择运费' }]}
fieldProps={{ fieldProps={{
onChange: (e) => { value: (shipmentFee / 100.0).toFixed(2)
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 }) => {

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) const uniqueArr = arr.filter((item, index) => arr.indexOf(item) === index).sort((a,b)=> a.localeCompare(b))
const series = [ const series = [
{ {
name: '新客户', name: '新客户',

View File

@ -35,6 +35,12 @@ const ListPage: React.FC = () => {
], ],
}, },
}, },
{
title: '排除套装',
dataIndex: 'exceptPackage',
valueType: 'switch',
hideInTable: true,
},
{ {
title: '产品名称', title: '产品名称',
dataIndex: 'name', dataIndex: 'name',
@ -52,12 +58,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,6 +525,7 @@ 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 {
logisticscontrollerGetlistbytrackingid, logisticscontrollerGetorderlist,
logisticscontrollerGettrackingnumber, logisticscontrollerGetlistbyorderid
} 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 logisticscontrollerGettrackingnumber({ number: keyWords }); await logisticscontrollerGetorderlist({ number: keyWords });
return trackList?.map((v) => { return trackList?.map((v) => {
return { return {
label: v.siteName + ' ' + v.externalOrderId, label: v.siteName + ' ' + v.externalOrderId,
@ -27,9 +27,16 @@ const TrackPage: React.FC = () => {
}} }}
fieldProps={{ fieldProps={{
prefix: '订单号', prefix: '订单号',
onChange(value: string) { async onChange(value: string) {
setId(value); setId(value);
setData({})
const { data } = await logisticscontrollerGetlistbyorderid({
id,
});
setData(data);
}, },
placeholder: '请输入订单号',
allowClear: false, allowClear: false,
suffixIcon: ( suffixIcon: (
<SearchOutlined <SearchOutlined
@ -37,8 +44,8 @@ const TrackPage: React.FC = () => {
if (!id) { if (!id) {
return; return;
} }
const { data } = await logisticscontrollerGetlistbytrackingid({ const { data } = await logisticscontrollerGetlistbyorderid({
shipment_id: id, id,
}); });
setData(data); setData(data);
}} }}
@ -46,22 +53,32 @@ const TrackPage: React.FC = () => {
), ),
}} }}
/> />
{
data?.item ?
<div> <div>
{data.map((item) => (
<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.constitution.map((v) => ( {item.name} * {item.quantity}
</div>
))}
</div>
</div> : <></>
}
{
data?.saleItem ?
<div> <div>
{v.name} * {v.quantity * item.quantity} <div>
</div> <h4></h4>
))} {data?.saleItem?.map((item) => (
</div> <div style={{ paddingLeft: 20, color: 'blue' }}>
{item.name} * {item.quantity}
</div> </div>
))} ))}
</div> </div>
</div> : <></>
}
</PageContainer> </PageContainer>
); );
}; };

View File

@ -36,6 +36,20 @@ 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默认没有生成对象)
@ -50,13 +64,28 @@ export async function logisticscontrollerDelshippingaddress(
}); });
} }
/** 此处后端没有提供注释 POST /logistics/getListByTrackingId */ /** 此处后端没有提供注释 POST /logistics/getListByOrderId */
export async function logisticscontrollerGetlistbytrackingid( export async function logisticscontrollerGetlistbyorderid(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象) // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.logisticscontrollerGetlistbytrackingidParams, params: API.logisticscontrollerGetlistbyorderidParams,
options?: { [key: string]: any }, options?: { [key: string]: any },
) { ) {
return request<any>('/logistics/getListByTrackingId', { return request<any>('/logistics/getListByOrderId', {
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,
@ -105,6 +134,35 @@ 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;
@ -118,21 +176,6 @@ 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;
@ -200,3 +243,17 @@ 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,3 +208,22 @@ 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,11 +141,6 @@ declare namespace API {
email_addresses?: any; email_addresses?: any;
}; };
type LoginDTO = {
username?: string;
password?: string;
};
type LoginRes = { type LoginRes = {
/** 状态码 */ /** 状态码 */
code?: number; code?: number;
@ -168,16 +163,24 @@ declare namespace API {
orderId: number; orderId: number;
}; };
type logisticscontrollerDeleteshipmentParams = {
id: number;
};
type logisticscontrollerDelshipmentParams = { type logisticscontrollerDelshipmentParams = {
id: string; id: number;
}; };
type logisticscontrollerDelshippingaddressParams = { type logisticscontrollerDelshippingaddressParams = {
id: number; id: number;
}; };
type logisticscontrollerGetlistbytrackingidParams = { type logisticscontrollerGetlistbyorderidParams = {
shipment_id?: string; id?: number;
};
type logisticscontrollerGetorderlistParams = {
number?: string;
}; };
type logisticscontrollerGetservicelistParams = { type logisticscontrollerGetservicelistParams = {
@ -189,8 +192,12 @@ declare namespace API {
isActive?: boolean; isActive?: boolean;
}; };
type logisticscontrollerGettrackingnumberParams = { type logisticscontrollerGetshipmentlabelParams = {
number?: string; shipmentId: number;
};
type logisticscontrollerUpdateshipmentstateParams = {
shipmentId: number;
}; };
type logisticscontrollerUpdateshippingaddressParams = { type logisticscontrollerUpdateshippingaddressParams = {
@ -213,6 +220,7 @@ 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;
@ -337,12 +345,17 @@ 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;
@ -386,7 +399,6 @@ declare namespace API {
items?: OrderItem[]; items?: OrderItem[];
sales?: OrderSale[]; sales?: OrderSale[];
refundItems?: OrderRefundItem[]; refundItems?: OrderRefundItem[];
trackings?: Tracking[];
notes?: OrderNote[]; notes?: OrderNote[];
}; };
@ -489,7 +501,11 @@ declare namespace API {
/** sku */ /** sku */
sku?: string; sku?: string;
quantity?: number; quantity?: number;
isPackage?: boolean; exceptPackage?: boolean;
isYoone?: boolean;
isZex?: boolean;
size?: number;
isYooneNew?: boolean;
/** 创建时间 */ /** 创建时间 */
createdAt?: string; createdAt?: string;
/** 更新时间 */ /** 更新时间 */
@ -506,7 +522,11 @@ declare namespace API {
/** sku */ /** sku */
sku?: string; sku?: string;
quantity?: number; quantity?: number;
isPackage?: boolean; exceptPackage?: boolean;
isYoone?: boolean;
isZex?: boolean;
size?: number;
isYooneNew?: boolean;
/** 创建时间 */ /** 创建时间 */
createdAt?: string; createdAt?: string;
/** 更新时间 */ /** 更新时间 */
@ -984,26 +1004,32 @@ 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 ShipmentItem = { type ShipmentFeeBookDTO = {
id?: number; stockPointId?: number;
shipment_id?: string; sender?: string;
productId?: number; startPhone?: string;
name?: string; startPostalCode?: string;
/** sku */ pickupAddress?: string;
sku?: string; shipperCountryCode?: string;
quantity?: number; receiver?: string;
/** 创建时间 */ city?: string;
createdAt: string; province?: string;
/** 更新时间 */ country?: string;
updatedAt: string; postalCode?: string;
deliveryAddress?: string;
receiverPhone?: string;
receiverEmail?: string;
length?: number;
width?: number;
height?: number;
dimensionUom?: string;
weight?: number;
weightUom?: string;
}; };
type ShippingAddress = { type ShippingAddress = {
@ -1032,6 +1058,7 @@ 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;
@ -1270,27 +1297,6 @@ 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;
@ -1469,7 +1475,7 @@ declare namespace API {
/** 是否促销中 */ /** 是否促销中 */
on_sale?: boolean; on_sale?: boolean;
/** 产品类型 */ /** 产品类型 */
type?: 'simple' | 'variable'; type?: 'simple' | 'variable' | 'woosb';
/** 创建时间 */ /** 创建时间 */
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: API.LoginDTO, body: Record<string, any>,
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': 'application/json', 'Content-Type': 'text/plain',
}, },
data: body, data: body,
...(options || {}), ...(options || {}),

3
src/style/order-list.css Normal file
View File

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

View File

View File

View File

@ -59,3 +59,47 @@ 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,6 +6,7 @@ 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,