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

feat: 完善消息提醒跳转

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