增加未报价显示;从订单号进入会话

dev/mobile
Jimmy 2 years ago
parent 95b0bab03e
commit 11d4b39c53

@ -19,61 +19,43 @@ function AuthApp() {
const loginUser = useAuthStore(state => state.loginUser)
const href = useHref()
useEffect(() => {
if (loginUser.userId > 0) {
useConversationStore.getState().connectWebsocket(loginUser.userId)
useConversationStore.getState().fetchInitialData(loginUser.userId) // userIdStr
}
return () => {
useConversationStore.getState().disconnectWebsocket();
}
}, [])
useEffect(() => {
// /p...
if ((loginUser.userId === -1) && (href.indexOf('/p/') === -1)) {
navigate('/p/dingding/qrcode');
navigate('/p/dingding/qrcode')
}
}, [href])
const totalNotify = useConversationStore((state) => state.totalNotify);
useEffect(() => {
if (loginUser.userId > 0) {
useConversationStore.getState().connectWebsocket(loginUser.userId);
useConversationStore.getState().fetchInitialData(loginUser.userId); // userIdStr
useConversationStore.getState().connectWebsocket(loginUser.userId)
useConversationStore.getState().fetchInitialData(loginUser.userId) // userIdStr
}
return () => {
useConversationStore.getState().disconnectWebsocket();
useConversationStore.getState().disconnectWebsocket()
}
}, [])
useEffect(() => {
Notification.requestPermission();
return () => {};
Notification.requestPermission()
return () => {}
}, [])
let defaultPath = '/order/follow'
if (href !== '/') {
const splitPath = href.split('/')
if (splitPath.length > 2) {
defaultPath = '/' + splitPath[1] + '/' + splitPath[2]
}
}
const {
token: { colorBgContainer },
} = theme.useToken()
/**
* 标签页标题闪烁
*/
const [isTitleVisible, setIsTitleVisible] = useState(true);
useEffect(() => {
let interval;
if (totalNotify > 0) {
interval = setInterval(() => {
document.title = isTitleVisible ? `🔔🔥💬【${totalNotify}条新消息】` : '______________';
setIsTitleVisible(!isTitleVisible);
}, 500);
} else {
document.title = '聊天式销售平台';
}
return () => clearInterval(interval);
}, [totalNotify, isTitleVisible]);
return (
<ConfigProvider
theme={{

@ -1,10 +1,10 @@
import { LinkOutlined, MailOutlined, PhoneOutlined, UserOutlined, WhatsAppOutlined } from '@ant-design/icons'
import { App, Card, Flex, Select, Typography, Empty, Button } from 'antd'
import { App, Button, Card, Empty, Flex, Select, Typography } from 'antd'
import { useEffect } from 'react'
import { useParams } from 'react-router-dom'
import useOrderStore from '@/stores/OrderStore'
import { Conditional } from '@/components/Conditional'
import useConversationStore from '@/stores/ConversationStore'
import useOrderStore from '@/stores/OrderStore'
import QuotesHistory from './QuotesHistory'
const CustomerProfile = (() => {
@ -77,10 +77,17 @@ const CustomerProfile = (() => {
</Card>
<Flex vertical={true} className='p-2 '>
<Typography.Text strong>最新报价</Typography.Text>
<p className='m-0 py-2 line-clamp-2 '><a target='_blank' href={lastQuotation.letterurl}><LinkOutlined />&nbsp;{lastQuotation.lettertitle}</a></p>
<Flex justify={'space-between'} >
<QuotesHistory dataSource={quotationList} />
</Flex>
<Conditional
condition={quotationList.length > 0}
whenFalse={<Empty description={<span>暂无报价</span>}></Empty>}
whenTrue={
<>
<p className='m-0 py-2 line-clamp-2 '><a target='_blank' href={lastQuotation.letterurl}><LinkOutlined />&nbsp;{lastQuotation.lettertitle}</a></p>
<Flex justify={'space-between'} >
<QuotesHistory dataSource={quotationList} />
</Flex>
</>
}/>
</Flex>
<p className='p-2 shadow-inner overflow-auto m-0 break-words whitespace-pre-wrap' dangerouslySetInnerHTML={{__html: orderDetail.order_detail}}></p>
</div>
@ -88,11 +95,7 @@ const CustomerProfile = (() => {
} else {
return (
<Empty
description={
<span>
暂无相关订单
</span>
}
description={<span>暂无相关订单</span>}
>
<Button type='primary' onClick={() => {
notification.info({
@ -106,4 +109,5 @@ const CustomerProfile = (() => {
)
}
})
export default CustomerProfile

@ -16,36 +16,12 @@ const { Title } = Typography
function DesktopApp() {
const navigate = useNavigate()
const { colorPrimary, borderRadius } = useThemeContext()
const loginUser = useAuthStore(state => state.loginUser)
const href = useHref()
useEffect(() => {
// /p...
if ((loginUser.userId === -1) && (href.indexOf('/p/') === -1)) {
navigate('/p/dingding/qrcode');
}
}, [href])
const totalNotify = useConversationStore((state) => state.totalNotify);
useEffect(() => {
if (loginUser.userId > 0) {
useConversationStore.getState().connectWebsocket(loginUser.userId);
useConversationStore.getState().fetchInitialData(loginUser.userId); // userIdStr
}
return () => {
useConversationStore.getState().disconnectWebsocket();
}
}, [])
useEffect(() => {
Notification.requestPermission();
return () => {};
}, [])
const totalNotify = useConversationStore((state) => state.totalNotify)
let defaultPath = '/order/follow'

@ -1,16 +1,23 @@
import { Conditional } from '@/components/Conditional'
import useAuthStore from '@/stores/AuthStore'
import useFormStore from '@/stores/FormStore'
import useOrderStore from '@/stores/OrderStore'
import { copy, isNotEmpty } from '@/utils/commons'
import { InfoCircleTwoTone, MailTwoTone, MessageTwoTone, PhoneTwoTone, WhatsAppOutlined } from '@ant-design/icons'
import {
App, Badge, Button, DatePicker, Tabs, Flex, Form, Input, Empty,
Radio, Row, Col, Select, Space, Switch, Table, Tag, Tooltip
App, Badge, Button,
Col,
DatePicker,
Empty,
Flex, Form, Input,
Radio, Row,
Select, Space, Switch, Table,
Tabs,
Tag, Tooltip
} from 'antd'
import { InfoCircleTwoTone, MessageTwoTone, PhoneTwoTone, MailTwoTone, WhatsAppOutlined } from '@ant-design/icons'
import dayjs from 'dayjs'
import { memo, useCallback, useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import dayjs from 'dayjs'
import { Conditional } from '@/components/Conditional'
import useOrderStore from '@/stores/OrderStore'
import useAuthStore from '@/stores/AuthStore'
import { copy, isNotEmpty } from '@/utils/commons'
import useFormStore from '@/stores/FormStore';
import { useShallow } from 'zustand/react/shallow'
const { RangePicker } = DatePicker
@ -155,11 +162,21 @@ function OrderGroupTable({ formValues }) {
title: '订单号',
dataIndex: 'COLI_ID',
width: 222,
render: (text, record) => {
if (record.COLI_LineGrade === 240003) return <Space>{text}<Tag color='red'>重点</Tag></Space>
else if (record.COLI_LineGrade === 240002) return <Space>{text}<Tag color='green'>次重点</Tag></Space>
else if (record.COLI_LineGrade === 240001) return <Space>{text}<Tag color='blue'>一般</Tag></Space>
else return <Space>{text}</Space>
render: (text, record) => {
let tagIcon = ''
if (record.COLI_LineGrade === 240003) tagIcon = <Tag color='red'>重点</Tag>
else if (record.COLI_LineGrade === 240002) tagIcon = <Tag color='green'>次重点</Tag>
else if (record.COLI_LineGrade === 240001) tagIcon = <Tag color='blue'>一般</Tag>
return (
<Space>
<Link to={`/order/chat/${record.COLI_SN}`} state={record}>
{text}
</Link>
{tagIcon}
</Space>
)
}
},
{
@ -171,9 +188,7 @@ function OrderGroupTable({ formValues }) {
return (
<Space>
{isNotEmpty(record.coli_guest_WhatsApp) && <WhatsAppOutlined className={['pl-1', record.last_received_time ? 'text-whatsapp' : 'text-neutral-500']} />}
<Link to={`/order/chat/${record.COLI_SN}`} state={record} title={record.coli_guest_WhatsApp}>
{text + regularText}
</Link>
{text + regularText}
<Badge
count={record.unread_msg}
style={{
@ -181,7 +196,7 @@ function OrderGroupTable({ formValues }) {
}}
/>
</Space>
);
)
}
},
{
@ -269,9 +284,9 @@ function OrderGroupTable({ formValues }) {
function groupByParam(array, param) {
return array.reduce((result, item) => {
(result[item[param]] = result[item[param]] || []).push(item);
return result;
}, {});
(result[item[param]] = result[item[param]] || []).push(item)
return result
}, {})
}
const deptMap = new Map([
@ -335,8 +350,8 @@ function OrderGroupTable({ formValues }) {
function OrderFollow() {
const [formValues, setFormValues] = useFormStore(useShallow((state) => [state.orderFollowForm, state.setOrderFollowForm]));
const [advanceChecked, toggleAdvance] = useFormStore(useShallow((state) => [state.orderFollowAdvanceChecked, state.setOrderFollowAdvanceChecked]));
const [formValues, setFormValues] = useFormStore(useShallow((state) => [state.orderFollowForm, state.setOrderFollowForm]))
const [advanceChecked, toggleAdvance] = useFormStore(useShallow((state) => [state.orderFollowAdvanceChecked, state.setOrderFollowAdvanceChecked]))
const handleSubmit = useCallback((values) => {
setFormValues({ ...values, type: 'advance' })

@ -16,7 +16,7 @@ function QRCode() {
useEffect(() => {
if (loginUser.userId > 0) {
navigate('/');
navigate('/')
}
}, [href])

@ -1,20 +1,20 @@
import { memo, useCallback, useEffect, useRef, useState, forwardRef } from 'react';
import { App, Avatar, List, Layout, Input, DatePicker, Button, Spin } from 'antd';
import { ChatItem, MessageBox } from 'react-chat-elements';
import { fetchConversationsList, fetchMessages, MESSAGE_PAGE_SIZE } from '@/actions/ConversationActions';
import { isEmpty } from '@/utils/utils';
import useFormStore from '@/stores/FormStore';
import { useShallow } from 'zustand/react/shallow';
import { memo, useCallback, useEffect, useRef, useState, forwardRef } from 'react'
import { App, Avatar, List, Layout, Input, DatePicker, Button, Spin } from 'antd'
import { ChatItem, MessageBox } from 'react-chat-elements'
import { fetchConversationsList, fetchMessages, MESSAGE_PAGE_SIZE } from '@/actions/ConversationActions'
import { isEmpty } from '@/utils/utils'
import useFormStore from '@/stores/FormStore'
import { useShallow } from 'zustand/react/shallow'
import { RightOutlined } from '@ant-design/icons'
import { fetchSalesAgent, fetchCustomerList } from '@/actions/CommonActions';
import SearchInput from '@/components/SearchInput';
import { fetchSalesAgent, fetchCustomerList } from '@/actions/CommonActions'
import SearchInput from '@/components/SearchInput'
const { Sider, Content, Header, Footer } = Layout;
const { Sider, Content, Header, Footer } = Layout
const { TextArea } = Input
const { RangePicker } = DatePicker;
const { RangePicker } = DatePicker
const data = [
{
@ -62,7 +62,7 @@ function Chat() {
})
}}>发送</Button>
</>
);
)
}
export default Chat

@ -1,21 +1,21 @@
import { memo, useCallback, useEffect, useRef, useState, forwardRef } from 'react';
import { Avatar, List, Button, Input, Layout, Select, DatePicker, Form, Spin } from 'antd';
import { ChatItem, MessageBox } from 'react-chat-elements';
import { fetchConversationsList, fetchMessages, MESSAGE_PAGE_SIZE } from '@/actions/ConversationActions';
import { isEmpty } from '@/utils/utils';
import useFormStore from '@/stores/FormStore';
import { memo, useCallback, useEffect, useRef, useState, forwardRef } from 'react'
import { Avatar, List, Button, Input, Layout, Select, DatePicker, Form, Spin } from 'antd'
import { ChatItem, MessageBox } from 'react-chat-elements'
import { fetchConversationsList, fetchMessages, MESSAGE_PAGE_SIZE } from '@/actions/ConversationActions'
import { isEmpty } from '@/utils/utils'
import useFormStore from '@/stores/FormStore'
import { useShallow } from 'zustand/react/shallow'
import { useNavigate, useHref } from 'react-router-dom'
import { RightOutlined } from '@ant-design/icons'
import { fetchSalesAgent, fetchCustomerList } from '@/actions/CommonActions';
import SearchInput from '@/components/SearchInput';
import { fetchSalesAgent, fetchCustomerList } from '@/actions/CommonActions'
import SearchInput from '@/components/SearchInput'
const { Sider, Content, Header, Footer } = Layout;
const { Search } = Input;
const { RangePicker } = DatePicker;
const { Sider, Content, Header, Footer } = Layout
const { Search } = Input
const { RangePicker } = DatePicker
const data = [
{
@ -84,7 +84,7 @@ function Login() {
)}
/>
</>
);
)
}
export default Login

Loading…
Cancel
Save