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

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

@ -21,12 +21,18 @@ const { Sider, Content, Header, Footer } = Layout;
*
*/
const ChatWindow = (() => {
const { order_id } = useParams();
const { order_sn } = useParams();
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;
console.log(order_id, currentUser);
console.log(order_sn, currentUser);
useEffect(() => {
getCustomerProfile(order_sn);
return () => {};
}, [order_sn]);
return (
<Spin spinning={false} tip={'正在连接...'} >

@ -33,10 +33,7 @@ const CustomerProfile = (({ customer }) => {
const { quotes, contact, last_contact, ...order } = orderInfo;
return (
<div className=' divide-x-0 divide-y divide-dotted divide-slate-400/[.24]'>
<Flex vertical>
</Flex>
<div className=' divide-x-0 divide-y divide-slate-300 divide-dotted'>
<Card className='p-2'
bordered={false}
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'} />}
/>
<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'>
<Typography.Text strong>{contact?.name}</Typography.Text>
<Typography.Text ><PhoneOutlined className=' pr-1' />{contact?.phone}</Typography.Text>
<Typography.Text ><MailOutlined className=' pr-1' />{contact?.email}</Typography.Text>
<Typography.Text strong>{contact?.[0]?.name}</Typography.Text>
<Typography.Text ><PhoneOutlined className=' pr-1' />{contact?.[0]?.phone}</Typography.Text>
<Typography.Text ><MailOutlined className=' pr-1' />{contact?.[0]?.email}</Typography.Text>
{/* <div>{order?.order_no}</div> */}
{/* <div>
{order?.location} <span>{order?.local_datetime}</span>
@ -61,13 +58,13 @@ const CustomerProfile = (({ customer }) => {
</Card>
<Flex vertical={true} className='p-2 '>
<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'} >
<CreatePayment />
<QuotesHistory />
</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 '>
<div>沟通记录</div>
<Table size={'small'} columns={[{ title: '进程', dataIndex: 'title' }, { title: '状态', dataIndex: 'title2' },]} />

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

@ -1,7 +1,11 @@
import { createContext, useContext, useEffect, useState } from 'react';
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 handleOpenChange = (newOpen) => {
setOpen(newOpen);
@ -18,20 +22,18 @@ const CreatePayment = ((props) => {
<List
className='w-96 h-4/6 overflow-y-auto text-slate-900'
itemLayout='horizontal'
dataSource={[
{ key: 1, title: 'XXX' },
{ key: 11, title: 'ZZZZ' },
]}
dataSource={quotes}
renderItem={(item, index) => (
<List.Item className=''>
<List.Item className='' key={item.letterid} >
<List.Item.Meta
className=' text-neutral-800'
title={item.title}
title={item.lettertitle}
description={
<Flex justify='space-between'>
<Button onClick={onSend} size={'small'} type='link' key={'send'}>
详细报价
</Button>
<span>{item.letterdate}</span>
<Flex gap={8}>
<Popconfirm title='删除报价信' description='确认要删除报价信吗?' onConfirm={() => {}} onCancel={onSend} okText='Yes' cancelText='No'>
<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 { Link } from 'react-router-dom';
import {
Badge, Divider, Table, Button, Input,
Space, Tag, Radio, Select, Flex, Form, Switch, DatePicker, App
@ -114,7 +115,8 @@ function OrderList({ formValues }) {
if (record.buytime > 0) regularText = '(R' + record.buytime + ')'
return (
<Space size='middle'>
<a>{text + regularText}</a>
{/* <a>{text + regularText}</a> */}
<Link to={'/order/chat/' + record.COLI_SN}>{text + regularText}</Link>
<Badge
count={record.unread_msg}
style={{
@ -157,7 +159,7 @@ function OrderList({ formValues }) {
]
const { notification } = App.useApp()
const [orderData, setOrderData] = useState([])
const [loading, setLoading] = useState(false)
const [loading, setLoading] = useState(false)
const { loginUser } = useAuthContext()
useEffect(() => {

Loading…
Cancel
Save