Compare commits

...

5 Commits

Author SHA1 Message Date
黄珑 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
7 changed files with 85 additions and 22 deletions

1
.gitignore vendored
View File

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

View File

@ -6,6 +6,7 @@ const UMI_APP_API_URL = isDev
: 'https://api.yoone.ca';
export default defineConfig({
hash: true,
antd: {},
access: {},
model: {},

View File

@ -1,3 +1,5 @@
import styles from '../../../style/order-list.css';
import InternationalPhoneInput from '@/components/InternationalPhoneInput';
import { HistoryOrder } from '@/pages/Statistics/Order';
import { ORDER_STATUS_ENUM } from '@/constants';
@ -84,6 +86,7 @@ const ListPage: React.FC = () => {
const actionRef = useRef<ActionType>();
const [activeKey, setActiveKey] = useState<string>('all');
const [count, setCount] = useState<any[]>([]);
const [activeLine, setActiveLine] = useState<number>(-1);
const tabs: TabsProps['items'] = useMemo(() => {
const total = count.reduce((acc, cur) => acc + Number(cur.count), 0);
const tabs = [
@ -265,7 +268,7 @@ const ListPage: React.FC = () => {
record.orderStatus,
) ? (
<>
<Shipping id={record.id as number} tableRef={actionRef} />
<Shipping id={record.id as number} tableRef={actionRef} setActiveLine={setActiveLine}/>
<Divider type="vertical" />
</>
) : (
@ -276,6 +279,7 @@ const ListPage: React.FC = () => {
record={record}
tableRef={actionRef}
orderId={record.id as number}
setActiveLine={setActiveLine}
/>
<Divider type="vertical" />
<Dropdown
@ -393,6 +397,9 @@ const ListPage: React.FC = () => {
scroll={{ x: 'max-content' }}
actionRef={actionRef}
rowKey="id"
rowClassName={(record) => {
return record.id === activeLine ? styles['selected-line-order-protable']: '';
}}
toolBarRender={() => [
<CreateOrder tableRef={actionRef} />,
<SyncForm tableRef={actionRef} />,
@ -480,7 +487,8 @@ const Detail: React.FC<{
tableRef: React.MutableRefObject<ActionType | undefined>;
orderId: number;
record: API.Order;
}> = ({ tableRef, orderId, record }) => {
setActiveLine: Function
}> = ({ tableRef, orderId, record, setActiveLine }) => {
const [visiable, setVisiable] = useState(false);
const { message } = App.useApp();
const ref = useRef<ActionType>();
@ -510,7 +518,10 @@ const Detail: React.FC<{
return (
<>
<Button key="detail" type="primary" onClick={() => setVisiable(true)}>
<Button key="detail" type="primary" onClick={() => {
setVisiable(true);
setActiveLine(record.id);
}}>
<FileDoneOutlined />
</Button>
@ -1049,7 +1060,8 @@ const Shipping: React.FC<{
tableRef?: React.MutableRefObject<ActionType | undefined>;
descRef?: React.MutableRefObject<ActionType | undefined>;
reShipping?: boolean;
}> = ({ id, tableRef, descRef, reShipping = false }) => {
setActiveLine: Function;
}> = ({ id, tableRef, descRef, reShipping = false, setActiveLine }) => {
const [options, setOptions] = useState<any[]>([]);
const formRef = useRef<ProFormInstance>();
@ -1071,7 +1083,11 @@ const Shipping: React.FC<{
},
}}
trigger={
<Button type="primary">
<Button type="primary"
onClick={() => {
setActiveLine(id);
}}
>
<CodeSandboxOutlined />
</Button>
@ -1787,11 +1803,30 @@ const Shipping: React.FC<{
const res =
await logisticscontrollerGetShipmentFee(
{
details,
...data
stockPointId: data.stockPointId,
sender: details.origin.contact_name,
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?.errMsg);
if (!res?.success) throw new Error(res?.message);
const fee = res.data;
setShipmentFee(fee);
details.origin.email_addresses = originEmail;
@ -1800,6 +1835,7 @@ const Shipping: React.FC<{
...details,
shipmentFee: fee
});
message.success('获取运费成功');
} catch (error) {
message.error(error?.message || '获取运费失败');
}
@ -1823,7 +1859,6 @@ const SalesChange: React.FC<{
detailRef?: React.MutableRefObject<ActionType | undefined>;
reShipping?: boolean;
}> = ({ id, detailRef }) => {
const [options, setOptions] = useState<any[]>([]);
const formRef = useRef<ProFormInstance>();
@ -1888,9 +1923,8 @@ const SalesChange: React.FC<{
>
<ProForm.Group>
<ProFormSelect
params={{ options }}
request={async ({ keyWords, options }) => {
if (!keyWords || keyWords.length < 2) return options;
params={{ }}
request={async ({ keyWords }) => {
try {
const { data } = await productcontrollerSearchproducts({
name: keyWords,
@ -1901,10 +1935,10 @@ const SalesChange: React.FC<{
label: `${item.name} - ${item.nameCn}`,
value: item?.sku,
};
}) || options
})
);
} catch (error) {
return options;
return [];
}
}}
name="sku"

View File

@ -52,12 +52,12 @@ const ListPage: React.FC = () => {
},
hideInTable: true,
},
{
title: '分类',
dataIndex: 'categoryName',
hideInSearch: true,
hideInTable: isSource,
},
// {
// title: '分类',
// dataIndex: 'categoryName',
// hideInSearch: true,
// hideInTable: isSource,
// },
{
title: '数量',
dataIndex: 'totalQuantity',

View File

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

View File

@ -23,7 +23,7 @@ export async function logisticscontrollerCreateshipment(
/** 此处后端没有提供注释 POST /logistics/getShipmentFee */
export async function logisticscontrollerGetShipmentFee(
body: API.ShipmentBookDTO,
body: API.ShipmentFeeBookDTO,
options?: { [key: string]: any },
) {
return request<API.BooleanRes>(`/logistics/getShipmentFee`, {

View File

@ -993,6 +993,32 @@ declare namespace API {
orderIds?: number[];
};
type ShipmentFeeBookDTO = {
// 发货点传id到后端解析
stockPointId: number;
sender: string;
startPhone: string;
startPostalCode: string;
pickupAddress: string;
// pickupWarehouse: number; // 此处用 stockPointId 到后端解析
shipperCountryCode: string;
receiver: string;
city: string;
province: string;
country: string;
postalCode: string;
deliveryAddress: string;
receiverPhone: string;
receiverEmail: string;
length: number;
width: number;
height: number;
dimensionUom: string;
weight: number;
weightUom: string;
};
type ShipmentSkuDTO = {
sales?: OrderSale[];
}