From 6e4fc488a73016b8f8d60266f743c58e834b2551 Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Tue, 20 Feb 2024 14:25:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=AE=A2=E5=8D=95=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E8=8E=B7=E5=8F=96=E5=92=8C=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/OrderStore.js | 14 ++++-- .../Components/CustomerProfile.jsx | 45 +++++++++---------- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/src/stores/OrderStore.js b/src/stores/OrderStore.js index 6240d48..fd8c83f 100644 --- a/src/stores/OrderStore.js +++ b/src/stores/OrderStore.js @@ -6,14 +6,20 @@ const API_HOST = 'https://p9axztuwd7x8a7.mycht.cn/whatsapp_callback'; const useOrderStore = create((set, get) => ({ - orderDetail: { - order_no: '' - }, + orderDetail: {}, + + customerDetail: {}, + + lastQuotation: {}, fetchOrderDetail: async (colisn) => { const json = await fetchJSON(`${API_HOST}/getorderinfo`, { colisn }) if (json.errcode === 0 && json.result.length > 0) { - set(state => ({ orderDetail: 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] : {}, + })) } } })) diff --git a/src/views/Conversations/Components/CustomerProfile.jsx b/src/views/Conversations/Components/CustomerProfile.jsx index 193ee68..69ac45c 100644 --- a/src/views/Conversations/Components/CustomerProfile.jsx +++ b/src/views/Conversations/Components/CustomerProfile.jsx @@ -2,7 +2,7 @@ import { useEffect } from 'react' import { useLocation, useParams } from 'react-router-dom' import { Card, Flex, Select, Typography, Radio, Button, Table } from 'antd' import { useAuthContext } from '@/stores/AuthContext.js' -import { UserOutlined, EditOutlined, EllipsisOutlined, SmileOutlined, SyncOutlined, PhoneOutlined, MailOutlined, WhatsAppOutlined, SmileTwoTone } from '@ant-design/icons' +import { UserOutlined, LinkOutlined, EllipsisOutlined, SmileOutlined, SyncOutlined, PhoneOutlined, MailOutlined, WhatsAppOutlined, SmileTwoTone } from '@ant-design/icons' import CreatePayment from './CreatePayment' import QuotesHistory from './QuotesHistory' @@ -10,16 +10,12 @@ import useOrderStore from '@/stores/OrderStore' const CustomerProfile = (() => { let { state } = useLocation() - console.info(state) const { order_sn: order_sn } = useParams() - console.log('invoke customer profile+++++++++++++++++++++++++++++++++++++++++++++', order_sn) - const { orderDetail, fetchOrderDetail } = useOrderStore() + const { orderDetail, customerDetail, lastQuotation, fetchOrderDetail } = useOrderStore() const { loginUser: currentUser } = useAuthContext() useEffect(() => { fetchOrderDetail(order_sn) - console.info('CustomerProfile.useEffect') - console.info(orderDetail) }, []) return ( @@ -33,11 +29,12 @@ const CustomerProfile = (() => { width: '100%' }} variant='borderless' - defaultValue='240003' + defaultValue={orderDetail.tags} options={[ - { value: '240003', label: '重点' }, - { value: '240002', label: '次重点' }, - { value: '240001', label: '一般' } + { value: 0, label: '未设置' }, + { value: 240003, label: '重点' }, + { value: 240002, label: '次重点' }, + { value: 240001, label: '一般' } ]} />,