Commit 488cb180 authored by 李腾's avatar 李腾

feat: 完善消息提醒跳转

parent cd6b961e
...@@ -148,21 +148,35 @@ const Complex = props => { ...@@ -148,21 +148,35 @@ const Complex = props => {
setVisible(false); setVisible(false);
}; };
// 跳转到详情 //
const viewDetail = message => {
console.log(message);
const { orderNo } = message;
// 待发货
history.push({
pathname: '/orderManage/pendingDeliveryOrder',
query: { orderNo },
});
// 已发货 /**
// /orderManage/deliveryOrder * 跳转到详情
* type
* 1-待发货订单
* 2-超时发货
* 3-仅退款(未发货)申请单
* 4-仅退款申请单
* 5-退货退款申请单
* 6-退货入库待审核
*/
const viewDetail = message => {
const { orderNo, type } = message;
console.log(type);
// 售后 if ([1, 2].includes(type)) {
history.push({
pathname: '/orderManage/pendingDeliveryOrder',
query: { orderNo },
});
}
if ([3, 4, 5, 6].includes(type)) {
history.push({
pathname: '/afterSaleManage',
query: { orderNo },
});
}
close(); close();
}; };
......
...@@ -2,6 +2,8 @@ import React, { useState, useEffect } from 'react'; ...@@ -2,6 +2,8 @@ import React, { useState, useEffect } from 'react';
import { Badge, notification, Spin } from 'antd'; import { Badge, notification, Spin } from 'antd';
import { CloseOutlined } from '@ant-design/icons'; import { CloseOutlined } from '@ant-design/icons';
import classNames from 'classnames'; import classNames from 'classnames';
import { useHistory } from 'react-router-dom';
// import copy from 'copy-to-clipboard';
import { connect } from 'dva'; import { connect } from 'dva';
import { apiGetBussinessMsgList } from '@/services/messageReminder'; import { apiGetBussinessMsgList } from '@/services/messageReminder';
import Empty from '../Empty'; import Empty from '../Empty';
...@@ -21,7 +23,7 @@ const Horn = props => { ...@@ -21,7 +23,7 @@ const Horn = props => {
}; };
const Message = props => { const Message = props => {
const { toggle, animationClass, messageData, openComplex, onMark, loading } = props; const { toggle, animationClass, messageData, openComplex, onMark, loading, viewDetail } = props;
const ReminderItem = args => { const ReminderItem = args => {
const { item } = args; const { item } = args;
...@@ -44,7 +46,7 @@ const Message = props => { ...@@ -44,7 +46,7 @@ const Message = props => {
<span>{message.createdAt}</span> <span>{message.createdAt}</span>
</div> </div>
<div className={styles.notice}> <div className={styles.notice}>
<a>{message.title},请查看</a> <a onClick={() => viewDetail(message)}>{message.title},请查看</a>
</div> </div>
</div> </div>
); );
...@@ -94,6 +96,7 @@ const Message = props => { ...@@ -94,6 +96,7 @@ const Message = props => {
const Simple = props => { const Simple = props => {
const { dispatch, unReadCount, complexRef, unReadData } = props; const { dispatch, unReadCount, complexRef, unReadData } = props;
const history = useHistory();
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [count, setCount] = useState(0); const [count, setCount] = useState(0);
...@@ -137,6 +140,26 @@ const Simple = props => { ...@@ -137,6 +140,26 @@ const Simple = props => {
}); });
}; };
const viewDetail = message => {
const { orderNo, type } = message;
console.log(type);
if ([1, 2].includes(type)) {
history.push({
pathname: '/orderManage/pendingDeliveryOrder',
query: { orderNo },
});
}
if ([3, 4, 5, 6].includes(type)) {
history.push({
pathname: '/afterSaleManage',
query: { orderNo },
});
}
toggle();
};
// 打开消息提醒弹框 // 打开消息提醒弹框
const openComplex = () => { const openComplex = () => {
complexRef.current.open(); complexRef.current.open();
...@@ -192,6 +215,7 @@ const Simple = props => { ...@@ -192,6 +215,7 @@ const Simple = props => {
openComplex, openComplex,
onMark, onMark,
loading, loading,
viewDetail,
}; };
// 隐藏消息提醒 // 隐藏消息提醒
......
...@@ -55,18 +55,18 @@ const BasicLayout = props => { ...@@ -55,18 +55,18 @@ const BasicLayout = props => {
const messageReminderComplexRef = useRef(); const messageReminderComplexRef = useRef();
// const audioRef = useRef() // const audioRef = useRef()
const token = window.localStorage.getItem('token');
const channelId = 100001;
const socket = new Socket({
url: getSocketUrl({ token, channelId }),
});
socket.connection();
socket.event.on('open', () => {
console.log('连接成功3');
});
useEffect(() => { useEffect(() => {
const token = window.localStorage.getItem('token');
const channelId = 100001;
console.log('666666666666');
const socket = new Socket({
url: getSocketUrl({ token, channelId }),
});
socket.connection();
socket.event.on('open', () => {
console.log('连接成功3');
});
socket.event.on('message', msg => { socket.event.on('message', msg => {
// audioRef.current.click() // audioRef.current.click()
dispatch({ dispatch({
......
...@@ -6,6 +6,7 @@ import { AFTER_SALE_ORDER } from '@/../config/permission.config'; ...@@ -6,6 +6,7 @@ import { AFTER_SALE_ORDER } from '@/../config/permission.config';
import { connect } from 'dva'; import { connect } from 'dva';
import { FormSearch } from '@/components/FormSearch'; import { FormSearch } from '@/components/FormSearch';
import moment from 'moment'; import moment from 'moment';
import { useLocation } from 'react-router-dom';
import AuditModal from './components/auditModal'; import AuditModal from './components/auditModal';
import DetailTable from './components/detailTable'; import DetailTable from './components/detailTable';
import ProofsModal from './components/proofsModal'; import ProofsModal from './components/proofsModal';
...@@ -38,6 +39,9 @@ const { confirm } = Modal; ...@@ -38,6 +39,9 @@ const { confirm } = Modal;
const AfterSale = props => { const AfterSale = props => {
const { permissions } = props; const { permissions } = props;
const canEditable = permissions[AFTER_SALE_ORDER.EDITABLE]; const canEditable = permissions[AFTER_SALE_ORDER.EDITABLE];
const location = useLocation();
const pageQueryOrderNo = location.query?.orderNo || '';
const actionRef = useRef(); const actionRef = useRef();
const formRef = useRef(); const formRef = useRef();
const [tableParams, setTableParams] = useState({}); const [tableParams, setTableParams] = useState({});
...@@ -233,6 +237,7 @@ const AfterSale = props => { ...@@ -233,6 +237,7 @@ const AfterSale = props => {
form, form,
initialValues: { initialValues: {
afterTime, afterTime,
orderNo: pageQueryOrderNo,
}, },
formOptions: {}, formOptions: {},
...formConfig, ...formConfig,
...@@ -284,6 +289,7 @@ const AfterSale = props => { ...@@ -284,6 +289,7 @@ const AfterSale = props => {
const requestParams = { const requestParams = {
page, page,
size, size,
orderNo: pageQueryOrderNo,
...params, ...params,
startDate, startDate,
endDate, endDate,
......
...@@ -46,7 +46,7 @@ class Socket extends EventEmitter { ...@@ -46,7 +46,7 @@ class Socket extends EventEmitter {
console.log('主动触发关闭'); console.log('主动触发关闭');
this.socket.close(); this.socket.close();
} }
clearInterval(time); clearTimeout(time);
}, timeout); }, timeout);
} }
}; };
...@@ -86,7 +86,7 @@ class Socket extends EventEmitter { ...@@ -86,7 +86,7 @@ class Socket extends EventEmitter {
this.connection(); this.connection();
reconnect(); reconnect();
} }
}, 2000); }, 20000);
}; };
reconnect(); reconnect();
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment