|
|
|
@ -1,19 +1,15 @@
|
|
|
|
|
import React, { useEffect, useState, useRef } from 'react';
|
|
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
|
|
import { useParams, useNavigate, useLocation } from 'react-router-dom';
|
|
|
|
|
import { Dropdown, Input, Button, Empty, Tooltip, Tag, Select, Divider, Radio, Popover, theme, Form } from 'antd';
|
|
|
|
|
import { PlusOutlined, WhatsAppOutlined, LoadingOutlined, HistoryOutlined, FireOutlined,AudioTwoTone, FilterOutlined, TagsOutlined, TagsTwoTone, FilterTwoTone, MailOutlined, CloseOutlined, CloseCircleOutlined } from '@ant-design/icons';
|
|
|
|
|
import { fetchConversationsList, fetchOrderConversationsList, fetchConversationItemClose, fetchConversationsSearch, postNewConversationItem, fetchConversationItemUnread, fetchConversationItemTop, UNREAD_MARK, postConversationTags, deleteConversationTags } from '@/actions/ConversationActions';
|
|
|
|
|
import { Dropdown, Input, Button, Tag, Popover, Form } from 'antd';
|
|
|
|
|
import { CloseCircleOutlined } from '@ant-design/icons';
|
|
|
|
|
import { fetchConversationItemClose, fetchConversationsSearch, fetchConversationItemUnread, fetchConversationItemTop, postConversationTags, deleteConversationTags } from '@/actions/ConversationActions';
|
|
|
|
|
import { ChatItem } from 'react-chat-elements';
|
|
|
|
|
// import ConversationsNewItem from './ConversationsNewItem';
|
|
|
|
|
import { isEmpty, olog, stringToColour } from '@/utils/commons';
|
|
|
|
|
import { isEmpty, stringToColour } from '@/utils/commons';
|
|
|
|
|
import useConversationStore from '@/stores/ConversationStore';
|
|
|
|
|
import useAuthStore from '@/stores/AuthStore';
|
|
|
|
|
import { useVisibilityState } from '@/hooks/useVisibilityState';
|
|
|
|
|
import { OrderLabelDefaultOptions, OrderStatusDefaultOptions, RemindStateDefaultOptions } from '@/stores/OrderStore'
|
|
|
|
|
import ChannelLogo from './ChannelLogo';
|
|
|
|
|
import { DeliverIcon, ReadIcon, SentIcon, WABIcon } from '@/components/Icons';
|
|
|
|
|
const { Option, OptGroup } = Select;
|
|
|
|
|
const { useToken } = theme;
|
|
|
|
|
import { DeliverIcon, ReadIcon, SentIcon } from '@/components/Icons';
|
|
|
|
|
|
|
|
|
|
const TagColorStyle = (tag) => {
|
|
|
|
|
const color = stringToColour(tag);
|
|
|
|
@ -95,7 +91,7 @@ const EditChatMemoForm = ({onSubmit,...props}) => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ChatListItem = (({mobile, item, refreshConversationList,setListUpdateFlag,onSwitchConversation,tabSelectedConversation, ...props}) => {
|
|
|
|
|
const ChatListItem = (({mobile, item, refreshConversationList,setListUpdateFlag,onSwitchConversation,tabSelectedConversation, setNewChatModalVisible,setEditingChat,...props}) => {
|
|
|
|
|
const routerReplace = mobile === undefined ? true : false; // : true;
|
|
|
|
|
const routePrefix = mobile === undefined ? `/order/chat` : `/m/chat`;
|
|
|
|
|
const { state: orderRow } = useLocation();
|
|
|
|
@ -170,6 +166,7 @@ const ChatListItem = (({mobile, item, refreshConversationList,setListUpdateFlag,
|
|
|
|
|
key={item.sn}
|
|
|
|
|
destroyPopupOnHide
|
|
|
|
|
trigger={['contextMenu']}
|
|
|
|
|
overlayClassName='z-[998]'
|
|
|
|
|
open={contextMenuOpen}
|
|
|
|
|
onOpenChange={handleContextMenuOpenChange}
|
|
|
|
|
menu={{
|
|
|
|
@ -205,19 +202,20 @@ const ChatListItem = (({mobile, item, refreshConversationList,setListUpdateFlag,
|
|
|
|
|
console.log(']]]', key);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: (
|
|
|
|
|
<>
|
|
|
|
|
{/* todo: refresh list */}
|
|
|
|
|
<Popover overlayClassNam1e='w-80' content={<EditChatMemoForm onSubmit={() => setContextMenuOpen(false)} />} placement='bottom' trigger={['click']}>
|
|
|
|
|
{/* <Button type='text' size='small' className='m-1'> */}
|
|
|
|
|
编辑联系人
|
|
|
|
|
{/* </Button> */}
|
|
|
|
|
</Popover>
|
|
|
|
|
</>
|
|
|
|
|
),
|
|
|
|
|
key: 'remark',
|
|
|
|
|
},
|
|
|
|
|
{ label: '编辑联系人', key: 'edit0' },
|
|
|
|
|
// {
|
|
|
|
|
// label: (
|
|
|
|
|
// <>
|
|
|
|
|
// {/* todo: refresh list */}
|
|
|
|
|
// <Popover overlayClassNam1e='w-80' content={<EditChatMemoForm onSubmit={() => setContextMenuOpen(false)} />} placement='bottom' trigger={['click']}>
|
|
|
|
|
// {/* <Button type='text' size='small' className='m-1'> */}
|
|
|
|
|
// 编辑联系人
|
|
|
|
|
// {/* </Button> */}
|
|
|
|
|
// </Popover>
|
|
|
|
|
// </>
|
|
|
|
|
// ),
|
|
|
|
|
// key: 'remark',
|
|
|
|
|
// },
|
|
|
|
|
{ type: 'divider' },
|
|
|
|
|
{ label: '隐藏会话', key: 'close', danger: true },
|
|
|
|
|
],
|
|
|
|
@ -241,12 +239,16 @@ const ChatListItem = (({mobile, item, refreshConversationList,setListUpdateFlag,
|
|
|
|
|
case 'unread':
|
|
|
|
|
setContextMenuOpen(false);
|
|
|
|
|
return handleConversationItemUnread(item);
|
|
|
|
|
case 'remark':
|
|
|
|
|
setOpenTags([]);
|
|
|
|
|
return;
|
|
|
|
|
// case 'remark':
|
|
|
|
|
// setOpenTags([]);
|
|
|
|
|
// return;
|
|
|
|
|
case 'close':
|
|
|
|
|
setContextMenuOpen(false);
|
|
|
|
|
return handleConversationItemClose(item);
|
|
|
|
|
case 'edit0':
|
|
|
|
|
setOpenTags([]);
|
|
|
|
|
setEditingChat({...item, is_new: false});
|
|
|
|
|
return setNewChatModalVisible(true);
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
// setContextMenuOpen(false);
|
|
|
|
@ -271,7 +273,7 @@ const ChatListItem = (({mobile, item, refreshConversationList,setListUpdateFlag,
|
|
|
|
|
id={item.sn}
|
|
|
|
|
letterItem={{ id: item.whatsapp_name || item.whatsapp_phone_number, letter: (item.whatsapp_name || item.whatsapp_phone_number).slice(0, 5) }}
|
|
|
|
|
alt={item.whatsapp_name}
|
|
|
|
|
title={item.whatsapp_name || item.whatsapp_phone_number}
|
|
|
|
|
title={'备注 / 名称' || item.whatsapp_name || item.whatsapp_phone_number}
|
|
|
|
|
// subtitle={item.coli_id}
|
|
|
|
|
subtitle={
|
|
|
|
|
<div>
|
|
|
|
@ -279,7 +281,9 @@ const ChatListItem = (({mobile, item, refreshConversationList,setListUpdateFlag,
|
|
|
|
|
{/* <DeliverIcon /> */}
|
|
|
|
|
{/* <SentIcon /> */}
|
|
|
|
|
{/* todo: last message ⤴⤵↗️↖️↘✔️ */}
|
|
|
|
|
<span>{item.coli_id}</span>
|
|
|
|
|
{/* <span>{item.coli_id}</span> */}
|
|
|
|
|
<span><ReadIcon />最后一条消息</span>
|
|
|
|
|
{/* <span>最后一条消息</span> */}
|
|
|
|
|
<div className='text-sm'>
|
|
|
|
|
{[
|
|
|
|
|
{ label: '已付款', key: 'p1' },
|
|
|
|
@ -289,7 +293,7 @@ const ChatListItem = (({mobile, item, refreshConversationList,setListUpdateFlag,
|
|
|
|
|
{tag.label}
|
|
|
|
|
</Tag>
|
|
|
|
|
))}
|
|
|
|
|
<span title={'附加备注'}>附加备注</span>
|
|
|
|
|
{/* <span title={'附加备注'}>附加备注</span> */}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|