diff --git a/src/components/OrderProfile.jsx b/src/components/OrderProfile.jsx index 49eb5de..d23cfa2 100644 --- a/src/components/OrderProfile.jsx +++ b/src/components/OrderProfile.jsx @@ -4,6 +4,8 @@ import { useEffect, useState } from 'react' import { App, Flex, Select, Tooltip, Divider, Typography, Skeleton, Checkbox } from 'antd' import { useOrderStore, fetchSetRemindStateAction, OrderLabelDefaultOptions, OrderStatusDefaultOptions, remindStatusOptions } from '@/stores/OrderStore' import { copy, isEmpty } from '@/utils/commons' +import { useShallow } from 'zustand/react/shallow' +import useConversationStore from '@/stores/ConversationStore' const OrderProfile = ({ coliSN, ...props }) => { const { notification, message } = App.useApp() @@ -21,11 +23,14 @@ const OrderProfile = ({ coliSN, ...props }) => { s.appendOrderComment, ]) + const currentOrder = useConversationStore(useShallow(state => state.currentConversation?.coli_sn || "")) + const orderId = coliSN || currentOrder + const [orderRemindState, setOrderRemindState] = useState(orderDetail.remindstate) useEffect(() => { - if (coliSN) { + if (orderId) { setLoading(true) - fetchOrderDetail(coliSN) + fetchOrderDetail(orderId) .finally(() => setLoading(false)) .catch((reason) => { notification.error({ @@ -37,7 +42,7 @@ const OrderProfile = ({ coliSN, ...props }) => { }) } return () => {} - }, [coliSN]) + }, [orderId]) const handleSetRemindState = async (checkedValue) => { const state = checkedValue.filter((v) => v !== orderRemindState) diff --git a/src/main.jsx b/src/main.jsx index 5cd3f3e..f457424 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -17,7 +17,7 @@ import MobileConversation from '@/views/mobile/Conversation' import MobileChat from '@/views/mobile/Chat' import CallCenter from '@/views/CallCenter' import MobileSecondHeader from '@/views/mobile/SecondHeaderWrapper' -import CustomerProfile from '@/views/Conversations/Online/order/CustomerProfile' +import OrderProfile from '@/components/OrderProfile' import SnippetList from '@/views/accounts/SnippetList' import GeneratePayment from '@/views/accounts/GeneratePayment' @@ -64,7 +64,7 @@ const router = createBrowserRouter([ { element: , children: [ - { path: 'm/order', element: }, + { path: 'm/order', element: }, { path: 'callcenter/call', element: }, { path: 'callcenter/call/:phonenumber', element: }, ], diff --git a/src/views/Conversations/Online/order/CustomerProfile.jsx b/src/views/Conversations/Online/order/CustomerProfile.jsx index 32fd9f3..2287fa1 100644 --- a/src/views/Conversations/Online/order/CustomerProfile.jsx +++ b/src/views/Conversations/Online/order/CustomerProfile.jsx @@ -18,6 +18,7 @@ import { postEditConversationItemColiAction } from "@/actions/ConversationAction import useStyleStore from '@/stores/StyleStore'; import SupplierEmailDrawer from "../Components/EmailListDrawer"; +// @Deprecated 作废,试用 OrderProfile 代替 const CustomerProfile = ({ disabled }) => { const navigate = useNavigate(); const { notification, message } = App.useApp();