From 7256ceb5d234c40eb22d1fef4079a76e30c6278d Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Wed, 21 Feb 2024 09:21:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=8A=E5=A4=A9=E8=AE=B0=E5=BD=95=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=A1=BE=E9=97=AE=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/OrderStore.js | 7 ++++--- src/views/AuthApp.jsx | 6 +++++- src/views/ChatHistory.jsx | 23 +++++++++++++++++++++++ 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/stores/OrderStore.js b/src/stores/OrderStore.js index f5ee79a..a8963a0 100644 --- a/src/stores/OrderStore.js +++ b/src/stores/OrderStore.js @@ -15,10 +15,11 @@ const useOrderStore = create((set, get) => ({ fetchOrderDetail: async (colisn) => { const json = await fetchJSON(`${API_HOST}/getorderinfo`, { colisn }) if (json.errcode === 0 && json.result.length > 0) { + const orderResult = json.result[0] set(() => ({ - orderDetail: json.result[0], - customerDetail: json.result[0].contact[0], - lastQuotation: json.result[0].quotes.length > 0 ? json.result[0].quotes[0] : {}, + orderDetail: orderResult, + customerDetail: orderResult.contact.length > 0 ? orderResult.contact[0] : {}, + lastQuotation: orderResult.quotes.length > 0 ? orderResult.quotes[0] : {}, })) } }, diff --git a/src/views/AuthApp.jsx b/src/views/AuthApp.jsx index 6c91331..1bffdea 100644 --- a/src/views/AuthApp.jsx +++ b/src/views/AuthApp.jsx @@ -103,7 +103,11 @@ function AuthApp() { trigger={['click']} > e.preventDefault()} style={{ color: colorPrimary }}> - {loginUser.username.substring(1)}{loginUser.username} + {loginUser.username.substring(1)}{loginUser.username} diff --git a/src/views/ChatHistory.jsx b/src/views/ChatHistory.jsx index 250616d..96dd59d 100644 --- a/src/views/ChatHistory.jsx +++ b/src/views/ChatHistory.jsx @@ -67,6 +67,29 @@ const SearchForm = memo(function ({ onSubmit }) { ]} /> + +