From e9d7bd1e8f3af5b206a107fca52a729a5d50d3f1 Mon Sep 17 00:00:00 2001 From: LiaoYijun Date: Tue, 10 Jun 2025 14:46:05 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=A0=B9=E6=8D=AE=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E8=AF=BB=E5=8F=96=E5=AE=A2=E4=BA=BA=E3=80=81=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E4=BF=A1=E6=81=AF=EF=BC=9B=E5=8E=BB=E9=99=A4=E6=8A=A5?= =?UTF-8?q?=E4=BB=B7=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/OrderProfile.jsx | 72 ++++++++---- src/stores/OrderStore.js | 8 +- src/views/orders/components/MailBox.jsx | 140 +++++++++++++----------- 3 files changed, 129 insertions(+), 91 deletions(-) diff --git a/src/components/OrderProfile.jsx b/src/components/OrderProfile.jsx index 87aef9b..5db5b7a 100644 --- a/src/components/OrderProfile.jsx +++ b/src/components/OrderProfile.jsx @@ -26,20 +26,47 @@ const OrderProfile = ({coliSN, ...props}) => { orderLabelOptions.unshift({ value: 0, label: "未设置", disabled: true }); const orderStatusOptions = copy(OrderStatusDefaultOptions); + const [ + orderDetail, customerDetail, lastQuotation, quotationList, fetchOrderDetail, setOrderPropValue, appendOrderComment, fetchOtherEmail, otherEmailList, fetchHistoryOrder + ] = useOrderStore(s => [ + s.orderDetail, s.customerDetail, s.lastQuotation, s.quotationList, s.fetchOrderDetail, s.setOrderPropValue, s.appendOrderComment, s.fetchOtherEmail, s.otherEmailList, s.fetchHistoryOrder + ]) + + useEffect(() => { + if (coliSN) { + // setLoading(true); + fetchOrderDetail(coliSN) + .then(result => { + console.info(result) + }) + // .finally(() => setLoading(false)) + // .catch(reason => { + // notification.error({ + // message: "查询出错", + // description: reason.message, + // placement: "top", + // duration: 60, + // }); + // }); + } + return () => {} + }, [coliSN]); + + const regularText = () => { + if (orderDetail.buytime > 0) return "(R" + orderDetail.buytime + ")" + } + - const [openOrder, setOpenOrder] = useState(false) return ( <> - LSS250501006 - - + {orderDetail.order_no} - Jorgina(R1) + {customerDetail.name + regularText()} @@ -48,34 +75,40 @@ const OrderProfile = ({coliSN, ...props}) => { - Jorgina@gmail.com + {customerDetail.email} 出发日期:2025-09-18,已下计划 + + + 特殊要求 + - 特殊要求: - 在华城市 桂林 对酒店和房型要求 5-star + {orderDetail.customer_request} + + 外联备注 + - 外联备注: - 泰国马来水灯节 + {orderDetail.wl_memo} 订单状态 + { variant="underlined" onSelect={value => { }} - value={1} + value={orderDetail.states} options={orderStatusOptions} /> + @@ -114,12 +147,7 @@ const OrderProfile = ({coliSN, ...props}) => { -

+

附加信息 @@ -129,7 +157,7 @@ const OrderProfile = ({coliSN, ...props}) => { 泰国马来水灯节 - + ) } diff --git a/src/stores/OrderStore.js b/src/stores/OrderStore.js index 5db191f..09f66dd 100644 --- a/src/stores/OrderStore.js +++ b/src/stores/OrderStore.js @@ -65,14 +65,14 @@ export const useOrderStore = create(devtools((set, get) => ({ set(() => ({ orderDetail: {...orderResult, coli_sn: colisn }, customerDetail: orderResult.contact.length > 0 ? orderResult.contact[0] : {}, - lastQuotation: orderResult.quotes.length > 0 ? orderResult.quotes[0] : {}, - quotationList: orderResult.quotes, + // lastQuotation: orderResult.quotes.length > 0 ? orderResult.quotes[0] : {}, + // quotationList: orderResult.quotes, })) return { orderDetail: {...orderResult, coli_sn: colisn }, customerDetail: orderResult.contact.length > 0 ? orderResult.contact[0] : {}, - lastQuotation: orderResult.quotes.length > 0 ? orderResult.quotes[0] : {}, - quotationList: orderResult.quotes, + // lastQuotation: orderResult.quotes.length > 0 ? orderResult.quotes[0] : {}, + // quotationList: orderResult.quotes, } } else { throw new Error(json?.errmsg + ': ' + json.errcode) diff --git a/src/views/orders/components/MailBox.jsx b/src/views/orders/components/MailBox.jsx index 0726341..716ab1b 100644 --- a/src/views/orders/components/MailBox.jsx +++ b/src/views/orders/components/MailBox.jsx @@ -1,17 +1,16 @@ -import { useCallback, useEffect, useState } from 'react' -import { ReloadOutlined, ReadOutlined, CheckSquareOutlined, StarOutlined, RightOutlined, LeftOutlined, ExpandOutlined, AppstoreOutlined } from '@ant-design/icons' -import { Flex, Button, Tooltip, List, Form, Row, Col, Drawer, Dropdown, Input, Checkbox, DatePicker, Switch, Breadcrumb } from 'antd' +import { useEffect, useState } from 'react' +import { ReloadOutlined, ReadOutlined, CheckSquareOutlined, RightOutlined, LeftOutlined, ExpandOutlined } from '@ant-design/icons' +import { Flex, Button, Tooltip, List, Form, Row, Col, Dropdown, Input, Checkbox, DatePicker, Switch, Breadcrumb, Skeleton } from 'antd' import dayjs from 'dayjs' -import { useEmailList } from '@/hooks/useEmail'; -import { isEmpty } from '@/utils/commons'; +import { useEmailList } from '@/hooks/useEmail' +import { isEmpty } from '@/utils/commons' import { MailboxDirIcon } from './MailboxDirIcon' -import { endWith } from 'rxjs'; const { RangePicker } = DatePicker -const PAGE_SIZE = 50; // 每页显示条数 +const PAGE_SIZE = 50 // 每页显示条数 -const MailBox = ({ mailboxDir, onMailItemClick, ...props}) => { +const MailBox = ({ mailboxDir, onMailItemClick, ...props }) => { const DATE_RANGE_PRESETS = [ { label: '本周', @@ -40,77 +39,80 @@ const MailBox = ({ mailboxDir, onMailItemClick, ...props}) => { ] const [form] = Form.useForm() + const { mailList, isLoading, error } = useEmailList(mailboxDir) const { mailList, loading, error, refresh } = useEmailList(mailboxDir); - const [pagination, setPagination] = useState({ + const [pagination, setPagination] = useState({ current: 1, pageSize: PAGE_SIZE, total: 0, - pagedList: [] - }); + pagedList: [], + }) useEffect(() => { if (mailList) { - const total = mailList.length; - const pageCount = Math.ceil(total / PAGE_SIZE); + const total = mailList.length + const pageCount = Math.ceil(total / PAGE_SIZE) - setPagination(prev => ({ + setPagination((prev) => ({ ...prev, total, pageCount, current: 1, // 重置到第一页 - pagedList: getPagedData(mailList, 1) - })); + pagedList: getPagedData(mailList, 1), + })) } - }, [mailList]); + }, [mailList]) const getPagedData = (data, currentPage) => { - const startIndex = (currentPage - 1) * PAGE_SIZE; - const endIndex = Math.min(startIndex + PAGE_SIZE, data.length); - return data.slice(startIndex, endIndex); - }; + const startIndex = (currentPage - 1) * PAGE_SIZE + const endIndex = Math.min(startIndex + PAGE_SIZE, data.length) + return data.slice(startIndex, endIndex) + } const prePage = () => { if (pagination.current > 1) { - const newCurrent = pagination.current - 1; - setPagination(prev => ({ + const newCurrent = pagination.current - 1 + setPagination((prev) => ({ ...prev, current: newCurrent, - pagedList: getPagedData(mailList, newCurrent) - })); + pagedList: getPagedData(mailList, newCurrent), + })) } - }; + } const nextPage = () => { if (pagination.current < Math.ceil(pagination.total / PAGE_SIZE)) { - const newCurrent = pagination.current + 1; - setPagination(prev => ({ + const newCurrent = pagination.current + 1 + setPagination((prev) => ({ ...prev, current: newCurrent, - pagedList: getPagedData(mailList, newCurrent) - })); + pagedList: getPagedData(mailList, newCurrent), + })) } - }; - - console.info('props.breadcrumb: ', props.breadcrumb) - console.info('props.mailboxDir: ', mailboxDir) + } const mailItemRender = (item) => { const isOrderNode = mailboxDir.COLI_SN > 0 - const orderNumber = (isEmpty(item.MAI_COLI_ID) || isOrderNode) ? '' : (item.MAI_COLI_ID + ' - ') - const countryName = isEmpty(item.CountryCN) ? '' : ('[' + (item.CountryCN === null ? 'USA' : item.CountryCN) + '] ') + const orderNumber = isEmpty(item.MAI_COLI_ID) || isOrderNode ? '' : item.MAI_COLI_ID + ' - ' + const countryName = isEmpty(item.CountryCN) ? '' : '[' + item.CountryCN + '] ' const mailStateClass = item.MOI_ReadState === 0 ? 'font-bold' : '' return ( -
  • { - console.info('item: ', item) - onMailItemClick(item) - }}> +
  • -
    +
    { + console.info('item: ', item) + onMailItemClick(item) + }}> -
    {orderNumber}{item.MAI_Subject}
    +
    + {orderNumber} + {item.MAI_Subject} +
    {countryName + item.SenderReceiver + ' ' + item.SRDate}
    @@ -187,10 +189,9 @@ const MailBox = ({ mailboxDir, onMailItemClick, ...props}) => { }} placeholder={`邮件主题`} /> - - } - unCheckedChildren={} defaultChecked={false} /> - + + } unCheckedChildren={} defaultChecked={false} /> +
    {
    - + - { + + { return { title: ( <> - + {bc.title} ), } })} - /> - - - {((pagination.current - 1) * PAGE_SIZE + 1)}-{Math.min(pagination.current * PAGE_SIZE, pagination.total)} of {pagination.total} - - - + /> + + + {(pagination.current - 1) * PAGE_SIZE + 1}-{Math.min(pagination.current * PAGE_SIZE, pagination.total)} of {pagination.total} + + + + - - } itemLayout='vertical' pagination={false} dataSource={pagination.pagedList} renderItem={mailItemRender} /> +
    )