diff --git a/src/views/Conversations/Online/Components/ChatListItem.jsx b/src/views/Conversations/Online/Components/ChatListItem.jsx
index f86dd7b..959cdf1 100644
--- a/src/views/Conversations/Online/Components/ChatListItem.jsx
+++ b/src/views/Conversations/Online/Components/ChatListItem.jsx
@@ -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 */}
- setContextMenuOpen(false)} />} placement='bottom' trigger={['click']}>
- {/* */}
-
- >
- ),
- key: 'remark',
- },
+ { label: '编辑联系人', key: 'edit0' },
+ // {
+ // label: (
+ // <>
+ // {/* todo: refresh list */}
+ // setContextMenuOpen(false)} />} placement='bottom' trigger={['click']}>
+ // {/* */}
+ //
+ // >
+ // ),
+ // 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={
@@ -279,7 +281,9 @@ const ChatListItem = (({mobile, item, refreshConversationList,setListUpdateFlag,
{/*
*/}
{/*
*/}
{/* todo: last message ⤴⤵↗️↖️↘✔️ */}
-
{item.coli_id}
+ {/*
{item.coli_id} */}
+
最后一条消息
+ {/*
最后一条消息 */}
{[
{ label: '已付款', key: 'p1' },
@@ -289,7 +293,7 @@ const ChatListItem = (({mobile, item, refreshConversationList,setListUpdateFlag,
{tag.label}
))}
- 附加备注
+ {/* 附加备注 */}
}
diff --git a/src/views/Conversations/Online/ConversationsList.jsx b/src/views/Conversations/Online/ConversationsList.jsx
index 9ca6588..8f8d146 100644
--- a/src/views/Conversations/Online/ConversationsList.jsx
+++ b/src/views/Conversations/Online/ConversationsList.jsx
@@ -185,6 +185,7 @@ const Conversations = ({ mobile }) => {
}
const [newChatModalVisible, setNewChatModalVisible] = useState(false);
+ const [editingChat, setEditingChat] = useState({});
// const closedVisible = closedConversationsList.length > 0;
const toggleClosedConversationsList = () => {
@@ -295,95 +296,12 @@ const Conversations = ({ mobile }) => {
) : null}
{dataSource.map((item) => (
-
- // ({ ...t, style: { color: stringToColour(t.label) } })),
- // { label: (<>
- // }>
- //
- //
- // >), key: 'new_tags' },
- // ] }, // selection
- // { label: '编辑联系人', key: 'remark' },
- // { type: 'divider' },
- // { label: '隐藏会话', key: 'close', danger: true },
- // ],
- // onClick: ({ key, domEvent }) => {
- // domEvent.stopPropagation();
- // switch (key) {
- // case 'close':
- // setContextMenuOpen(false);
- // return handleConversationItemClose(item);
- // case 'unread':
- // setContextMenuOpen(false);
- // return handleConversationItemUnread(item);
-
- // default:
- // setContextMenuOpen(false);
- // return;
- // }
- // },
- // }}
- // trigger={['contextMenu']}>
- //
- //
{/* {filterTags.map((tag) => {tag.label})} */}
- //
- // {item.coli_id}
- //
- // {[
- // { label: '已付款', key: 'p1' },
- // { label: '地接', key: 'p2' },
- // ]?.map((tag) => (
- //
- // {tag.label}
- //
- // ))}
- //
- //
- // }
- // date={item.last_received_time || item.last_send_time}
- // unread={item.unread_msg_count > 99 ? 0 : item.unread_msg_count}
- // // className={[
- // // String(item.sn) === String(currentConversation.sn) ? '__active text-primary bg-whatsapp-bg' : '',
- // // String(item.sn) === String(tabSelectedConversation?.sn) ? ' bg-neutral-200' : '',
- // // ].join(' ')}
- // statusText={}
- // statusColor={'#fff'}
- // onClick={() => onSwitchConversation(item)}
- // customStatusComponents={[
- // ...(item.unread_msg_count > 99 ? [() => ] : []),
- // // () => 💎💴❤👑💼🤝💤💔💨✅🕳❓❔❇✳❎🚫❌🎈🎊🎁📜,
- // ]}
- // />
- //
- //
+
))}
{dataSource.length === 0 && }
setNewChatModalVisible(false)}
onCancel={() => setNewChatModalVisible(false)}
diff --git a/src/views/Conversations/Online/ConversationsNewItem.jsx b/src/views/Conversations/Online/ConversationsNewItem.jsx
index 2157a65..383aec8 100644
--- a/src/views/Conversations/Online/ConversationsNewItem.jsx
+++ b/src/views/Conversations/Online/ConversationsNewItem.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react';
import { Form, Input, Modal } from 'antd';
-import { isEmpty, pick } from '@/utils/commons';
+import { isEmpty, isNotEmpty, pick } from '@/utils/commons';
import useConversationStore from '@/stores/ConversationStore';
import { phoneNumberToWAID } from '@/channel/whatsappUtils';
import { useConversationNewItem } from '@/hooks/useConversation';
@@ -30,18 +30,31 @@ export const ConversationItemForm = ({ initialValues, onFormInstanceReady }) =>
}
};
return (
-
+
+
+ {/* )} */}
+
+
+
-
+
- {/* hidden */}
-
+
+
+
+ {/*
+ */}
+
+
{initialValues.is_current_order && (
<>
@@ -58,11 +71,6 @@ export const ConversationItemForm = ({ initialValues, onFormInstanceReady }) =>
>
)}
- {!initialValues.is_current_order && (
-
-
-
- )}
{/* 如果会话已存在, 将直接切换
*/}
);
@@ -73,16 +81,30 @@ export const ConversationItemForm = ({ initialValues, onFormInstanceReady }) =>
* * 消息记录中的号码点击: 不自动关联
* * 消息记录中的联系人卡片点击: 不自动关联
*/
-export const ConversationItemFormModal = ({ open, onCreate, onCancel, initialValues, }) => {
+export const ConversationItemFormModal = ({ open, onCreate, onCancel, initialValues: _initialValues, }) => {
const [formInstance, setFormInstance] = useState();
const [newItemLoading, setNewItemLoading] = useState(false);
const { newConversation } = useConversationNewItem();
+ const [initialValues, setInitialValues] = useState({});
+ useEffect(() => {
+ setInitialValues({
+ ..._initialValues,
+ phone_number: _initialValues?.whatsapp_phone_number || _initialValues?.phone_number || '',
+ wa_id: _initialValues?.whatsapp_phone_number || _initialValues?.wa_id || '',
+ name: _initialValues?.whatsapp_name || _initialValues?.name || '',
+ is_new: _initialValues?.is_new ?? true,
+ });
+
+ return () => {};
+ }, [_initialValues])
+
+
return (
{
size={"small"}
onClick={() => {
setNewChatModalVisible(true);
- setNewChatFormValues(prev => ({ ...prev, phone_number: customerDetail.whatsapp_phone_number, is_current_order: true }));
+ setNewChatFormValues(prev => ({ ...prev, phone_number: customerDetail.whatsapp_phone_number, name: customerDetail.name, is_current_order: true }));
}}>
{customerDetail.whatsapp_phone_number}