diff --git a/src/components/OrderProfile.jsx b/src/components/OrderProfile.jsx index 87aef9b..b6eb710 100644 --- a/src/components/OrderProfile.jsx +++ b/src/components/OrderProfile.jsx @@ -15,31 +15,61 @@ import { useCallback, useEffect, useState } from 'react' import { Flex,Select,Tooltip, Button, Space, Divider, Typography, - Input, Radio,Drawer,Checkbox, + Input, Radio,Skeleton ,Checkbox, } from 'antd' import { InboxIcon, MailCheckIcon, MailUnreadIcon, SendPlaneFillIcon } from '@/components/Icons' import { useOrderStore, OrderLabelDefaultOptions, OrderStatusDefaultOptions, remindStatusOptions, fetchSetRemindStateAction, remindStatusOptionsMapped } from "@/stores/OrderStore"; import { copy, isEmpty } from "@/utils/commons"; const OrderProfile = ({coliSN, ...props}) => { + const [loading, setLoading] = useState(false); const orderLabelOptions = copy(OrderLabelDefaultOptions); 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 + ")" + return '' + } + - const [openOrder, setOpenOrder] = useState(false) return ( <> + - LSS250501006 - - + {orderDetail.order_no} - Jorgina(R1) + {customerDetail.name + regularText()} @@ -48,34 +78,29 @@ const OrderProfile = ({coliSN, ...props}) => { - Jorgina@gmail.com + {customerDetail.email} 出发日期:2025-09-18,已下计划 - - 特殊要求: - 在华城市 桂林 对酒店和房型要求 5-star - - - 外联备注: - 泰国马来水灯节 - - + + + 订单状态 + { variant="underlined" onSelect={value => { }} - value={1} + value={orderDetail.states} options={orderStatusOptions} /> + - 催信 - + 表单信息 -

+

+ + + 特殊要求 + + + {orderDetail.customer_request} + + + 外联备注 + + + {orderDetail.wl_memo} + + 附加信息 @@ -129,7 +162,8 @@ 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..8690d5c 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: '本周', @@ -42,75 +41,77 @@ const MailBox = ({ mailboxDir, onMailItemClick, ...props}) => { 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 +188,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} /> +
    )