From f3c904be81a161852670588861ede0df733386ee Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Mon, 25 Nov 2024 14:39:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E9=82=AE=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/OrderStore.js | 20 +++++++- .../Online/order/CustomerProfile.jsx | 51 ++++++++++++++++--- 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/src/stores/OrderStore.js b/src/stores/OrderStore.js index 223acb6..45f3e4e 100644 --- a/src/stores/OrderStore.js +++ b/src/stores/OrderStore.js @@ -1,7 +1,7 @@ import { create } from 'zustand' import { devtools } from 'zustand/middleware' import { fetchJSON, postForm } from '@/utils/request' -import { API_HOST } from '@/config' +import { API_HOST, EMAIL_HOST } from '@/config' import { isNotEmpty, prepareUrl } from '@/utils/commons' export const useOrderStore = create(devtools((set, get) => ({ @@ -11,6 +11,7 @@ export const useOrderStore = create(devtools((set, get) => ({ customerDetail: {}, lastQuotation: {}, quotationList: [], + otherEmailList: [], drawerOpen: false, openDrawer: () => { @@ -115,6 +116,23 @@ export const useOrderStore = create(devtools((set, get) => ({ }) }, + fetchOtherEmail: (coli_sn) => { + return fetchJSON(`${EMAIL_HOST}/email_supplier`, { coli_sn }) + .then(json => { + if (json.errcode === 0 && json.result?.MailInfo.length > 0) { + console.info(json.result) + + set(() => ({ + otherEmailList: json.result.MailInfo, + })) + return json.result?.MailInfo + } else { + throw new Error(json?.errmsg + ': ' + json.errcode) + } + }) + + }, + setOrderPropValue: async (colisn, propName, value) => { if (propName === 'orderlabel') { diff --git a/src/views/Conversations/Online/order/CustomerProfile.jsx b/src/views/Conversations/Online/order/CustomerProfile.jsx index 9eeb23a..80b6f55 100644 --- a/src/views/Conversations/Online/order/CustomerProfile.jsx +++ b/src/views/Conversations/Online/order/CustomerProfile.jsx @@ -17,12 +17,17 @@ const CustomerProfile = () => { const { notification, message } = App.useApp(); const [loading, setLoading] = useState(false); const [isModalOpen, setIsModalOpen] = useState(false); + const [currentOrderNumber, setOrderNumber] = useState(false); const orderCommentRef = useRef(null); const currentOrder = useConversationStore(state => state.currentConversation?.coli_sn || ""); const currentConversationID = useConversationStore(state => state.currentConversation?.sn || ""); const [updateCurrentConversation] = useConversationStore(state => [state.updateCurrentConversation]); const loginUser = useAuthStore(state => state.loginUser); - const { orderDetail, customerDetail, lastQuotation, quotationList, fetchOrderDetail, setOrderPropValue, appendOrderComment } = useOrderStore(); + const [ + orderDetail, customerDetail, lastQuotation, quotationList, fetchOrderDetail, setOrderPropValue, appendOrderComment, fetchOtherEmail, otherEmailList + ] = useOrderStore(s => [ + s.orderDetail, s.customerDetail, s.lastQuotation, s.quotationList, s.fetchOrderDetail, s.setOrderPropValue, s.appendOrderComment, s.fetchOtherEmail, s.otherEmailList + ]); const navigate = useNavigate(); const orderLabelOptions = copy(OrderLabelDefaultOptions); @@ -34,6 +39,9 @@ const CustomerProfile = () => { if (currentOrder) { setLoading(true); fetchOrderDetail(currentOrder) + .then(result => { + setOrderNumber(result.orderDetail.order_no) + }) .finally(() => setLoading(false)) .catch(reason => { notification.error({ @@ -43,6 +51,21 @@ const CustomerProfile = () => { duration: 60, }); }); + + + fetchOtherEmail('1118878')//currentOrder) + .then(result => { + console.info(result) + }) + .finally(() => setLoading(false)) + .catch(reason => { + notification.error({ + message: "查询出错", + description: reason.message, + placement: "top", + duration: 60, + }); + }); } }, [currentOrder]); @@ -58,6 +81,10 @@ const CustomerProfile = () => { setNewChatModalVisible(false); }; + const renderOtherEmailList = () => { + + } + if (currentOrder) { return (
@@ -65,7 +92,17 @@ const CustomerProfile = () => { } actions={[