订单进入会话页面, 获取订单信息

dev/chat
Lei OT 1 year ago
parent 6c6989accd
commit d2ef99cd9e

@ -21,12 +21,18 @@ const { Sider, Content, Header, Footer } = Layout;
* *
*/ */
const ChatWindow = (() => { const ChatWindow = (() => {
const { order_id } = useParams(); const { order_sn } = useParams();
const { loginUser: currentUser } = useAuthContext(); const { loginUser: currentUser } = useAuthContext();
const { errors, sendMessage, currentConversation, customerOrderProfile: orderInfo } = useConversationContext(); const { errors, sendMessage, currentConversation, customerOrderProfile: orderInfo, getCustomerProfile } = useConversationContext();
const { quotes, contact, last_contact, ...order } = orderInfo; const { quotes, contact, last_contact, ...order } = orderInfo;
console.log(order_id, currentUser); console.log(order_sn, currentUser);
useEffect(() => {
getCustomerProfile(order_sn);
return () => {};
}, [order_sn]);
return ( return (
<Spin spinning={false} tip={'正在连接...'} > <Spin spinning={false} tip={'正在连接...'} >

@ -33,10 +33,7 @@ const CustomerProfile = (({ customer }) => {
const { quotes, contact, last_contact, ...order } = orderInfo; const { quotes, contact, last_contact, ...order } = orderInfo;
return ( return (
<div className=' divide-x-0 divide-y divide-dotted divide-slate-400/[.24]'> <div className=' divide-x-0 divide-y divide-slate-300 divide-dotted'>
<Flex vertical>
</Flex>
<Card className='p-2' <Card className='p-2'
bordered={false} bordered={false}
title={order?.order_no} title={order?.order_no}
@ -46,11 +43,11 @@ const CustomerProfile = (({ customer }) => {
description={<Radio.Group size={'small'} options={orderStatus} value={'pending'} onChange={({ target: { value } }) => {}} optionType='button' buttonStyle={'solid'} />} description={<Radio.Group size={'small'} options={orderStatus} value={'pending'} onChange={({ target: { value } }) => {}} optionType='button' buttonStyle={'solid'} />}
/> />
<Flex gap={10}> <Flex gap={10}>
<Avatar src={`https://api.dicebear.com/7.x/avataaars/svg?seed=${contact?.name}`} /> {/* <Avatar src={`https://api.dicebear.com/7.x/avataaars/svg?seed=${contact?.name}`} /> */}
<Flex vertical={true} justify='space-between'> <Flex vertical={true} justify='space-between'>
<Typography.Text strong>{contact?.name}</Typography.Text> <Typography.Text strong>{contact?.[0]?.name}</Typography.Text>
<Typography.Text ><PhoneOutlined className=' pr-1' />{contact?.phone}</Typography.Text> <Typography.Text ><PhoneOutlined className=' pr-1' />{contact?.[0]?.phone}</Typography.Text>
<Typography.Text ><MailOutlined className=' pr-1' />{contact?.email}</Typography.Text> <Typography.Text ><MailOutlined className=' pr-1' />{contact?.[0]?.email}</Typography.Text>
{/* <div>{order?.order_no}</div> */} {/* <div>{order?.order_no}</div> */}
{/* <div> {/* <div>
{order?.location} <span>{order?.local_datetime}</span> {order?.location} <span>{order?.local_datetime}</span>
@ -61,13 +58,13 @@ const CustomerProfile = (({ customer }) => {
</Card> </Card>
<Flex vertical={true} className='p-2 '> <Flex vertical={true} className='p-2 '>
<div>最新报价</div> <div>最新报价</div>
<p className='m-0 py-2 '>{quotes?.[0]?.name}</p> <p className='m-0 py-2 line-clamp-2 '>{quotes?.[0]?.lettertitle}</p>
<Flex justify={'space-between'} > <Flex justify={'space-between'} >
<CreatePayment /> <CreatePayment />
<QuotesHistory /> <QuotesHistory />
</Flex> </Flex>
</Flex> </Flex>
<p className='p-2 overflow-auto h-32 '>{order?.order_detail}</p> <pre className='p-2 overflow-auto h-32' dangerouslySetInnerHTML={{__html: order?.order_detail}}></pre>
<Flex vertical={true} className='p-2 '> <Flex vertical={true} className='p-2 '>
<div>沟通记录</div> <div>沟通记录</div>
<Table size={'small'} columns={[{ title: '进程', dataIndex: 'title' }, { title: '状态', dataIndex: 'title2' },]} /> <Table size={'small'} columns={[{ title: '进程', dataIndex: 'title' }, { title: '状态', dataIndex: 'title2' },]} />

@ -9,7 +9,7 @@ import { v4 as uuid } from "uuid";
const InputBox = (({ onSend }) => { const InputBox = (({ onSend }) => {
const { currentConversation, templates } = useConversationContext(); const { currentConversation, templates } = useConversationContext();
const [textContent, setTextContent] = useState(''); const [textContent, setTextContent] = useState('');
console.log('ttt', uuid()); // console.log('ttt', uuid());
const handleSendText = () => { const handleSendText = () => {
// console.log(textContent); // console.log(textContent);

@ -1,7 +1,11 @@
import { createContext, useContext, useEffect, useState } from 'react'; import { createContext, useContext, useEffect, useState } from 'react';
import { Popover, Flex, Button, List, Popconfirm } from 'antd'; import { Popover, Flex, Button, List, Popconfirm } from 'antd';
import { useConversationContext } from '@/stores/Conversations/ConversationContext';
const QuotesHistory = ((props) => {
const { customerOrderProfile: orderInfo } = useConversationContext();
const { quotes, ...order } = orderInfo;
const CreatePayment = ((props) => {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const handleOpenChange = (newOpen) => { const handleOpenChange = (newOpen) => {
setOpen(newOpen); setOpen(newOpen);
@ -18,20 +22,18 @@ const CreatePayment = ((props) => {
<List <List
className='w-96 h-4/6 overflow-y-auto text-slate-900' className='w-96 h-4/6 overflow-y-auto text-slate-900'
itemLayout='horizontal' itemLayout='horizontal'
dataSource={[ dataSource={quotes}
{ key: 1, title: 'XXX' },
{ key: 11, title: 'ZZZZ' },
]}
renderItem={(item, index) => ( renderItem={(item, index) => (
<List.Item className=''> <List.Item className='' key={item.letterid} >
<List.Item.Meta <List.Item.Meta
className=' text-neutral-800' className=' text-neutral-800'
title={item.title} title={item.lettertitle}
description={ description={
<Flex justify='space-between'> <Flex justify='space-between'>
<Button onClick={onSend} size={'small'} type='link' key={'send'}> <Button onClick={onSend} size={'small'} type='link' key={'send'}>
详细报价 详细报价
</Button> </Button>
<span>{item.letterdate}</span>
<Flex gap={8}> <Flex gap={8}>
<Popconfirm title='删除报价信' description='确认要删除报价信吗?' onConfirm={() => {}} onCancel={onSend} okText='Yes' cancelText='No'> <Popconfirm title='删除报价信' description='确认要删除报价信吗?' onConfirm={() => {}} onCancel={onSend} okText='Yes' cancelText='No'>
<Button size={'small'} type='link' danger key={'send'}> <Button size={'small'} type='link' danger key={'send'}>
@ -59,4 +61,4 @@ const CreatePayment = ((props) => {
</> </>
); );
}); });
export default CreatePayment; export default QuotesHistory;

@ -1,4 +1,5 @@
import { memo, useCallback, useEffect, useState } from 'react' import { memo, useCallback, useEffect, useState } from 'react'
import { Link } from 'react-router-dom';
import { import {
Badge, Divider, Table, Button, Input, Badge, Divider, Table, Button, Input,
Space, Tag, Radio, Select, Flex, Form, Switch, DatePicker, App Space, Tag, Radio, Select, Flex, Form, Switch, DatePicker, App
@ -114,7 +115,8 @@ function OrderList({ formValues }) {
if (record.buytime > 0) regularText = '(R' + record.buytime + ')' if (record.buytime > 0) regularText = '(R' + record.buytime + ')'
return ( return (
<Space size='middle'> <Space size='middle'>
<a>{text + regularText}</a> {/* <a>{text + regularText}</a> */}
<Link to={'/order/chat/' + record.COLI_SN}>{text + regularText}</Link>
<Badge <Badge
count={record.unread_msg} count={record.unread_msg}
style={{ style={{
@ -157,7 +159,7 @@ function OrderList({ formValues }) {
] ]
const { notification } = App.useApp() const { notification } = App.useApp()
const [orderData, setOrderData] = useState([]) const [orderData, setOrderData] = useState([])
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const { loginUser } = useAuthContext() const { loginUser } = useAuthContext()
useEffect(() => { useEffect(() => {

Loading…
Cancel
Save