Commit ccefd1c9 authored by 李腾's avatar 李腾

feat: 完善售后查看多物流功能

parent 8ce355f9
import React, { useState, forwardRef, useImperativeHandle, useEffect } from 'react'; import React, { useState, forwardRef, useImperativeHandle, useEffect } from 'react';
import { Modal, Timeline, notification, Spin } from 'antd'; import { Modal, Timeline, notification, Spin } from 'antd';
import { getLogisticsRecord } from '../services'; import { getLogisticsRecord, apiDeliveriesTraceList } from '../services';
import styles from '../index.less';
const LogisticsRecordModal = (props, ref) => { const LogisticsRecordModal = (props, ref) => {
// const { } = props; // const { } = props;
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const [result, setResult] = useState({});
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [dataList, setDataList] = useState([]);
const getRecordList = async orderNo => { const getRecordList = async orderNo => {
const tempObj = { const tempObj = {
...@@ -15,19 +16,14 @@ const LogisticsRecordModal = (props, ref) => { ...@@ -15,19 +16,14 @@ const LogisticsRecordModal = (props, ref) => {
key: Date.now(), key: Date.now(),
}; };
setLoading(true); setLoading(true);
const res = await getLogisticsRecord({ orderNo }); const res = await apiDeliveriesTraceList({ orderNo });
setLoading(false); setLoading(false);
if (!res) { if (!res) {
notification.info({ message: '暂无物流信息' }); notification.info({ message: '暂无物流信息' });
return; return;
} }
const { logisticsName, logisticsBillNo, logisticsList = [] } = res.data;
tempObj.expressCompanyName = logisticsName; setDataList(res.data);
tempObj.deliveryNo = logisticsBillNo;
logisticsList.forEach(v => {
tempObj.detailList = [...tempObj.detailList, ...v.detailList];
});
setResult(tempObj);
}; };
const open = orderNo => { const open = orderNo => {
...@@ -36,7 +32,9 @@ const LogisticsRecordModal = (props, ref) => { ...@@ -36,7 +32,9 @@ const LogisticsRecordModal = (props, ref) => {
}; };
const onCancel = () => { const onCancel = () => {
setVisible(false); setVisible(false);
setResult([]); setTimeout(() => {
setDataList([]);
}, 1000);
}; };
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
open, open,
...@@ -59,15 +57,30 @@ const LogisticsRecordModal = (props, ref) => { ...@@ -59,15 +57,30 @@ const LogisticsRecordModal = (props, ref) => {
return ( return (
<Modal {...modalProps}> <Modal {...modalProps}>
<Spin spinning={loading}> <Spin spinning={loading}>
{result.detailList?.length ? ( {dataList.length ? (
dataList.map((dataItem, dataIndex) => (
<div className={styles['logistics-record']}>
<div className={styles['logistics-record__topbar']}>包裹{dataIndex + 1}</div>
<div className={styles['logistics-record__head']}>
<span className={styles.name}>物流公司:{dataItem.expressCompanyName}</span>
<span className={styles.no}>物流单号:{dataItem.expressNo}</span>
</div>
{dataItem.traceList.map(traceItem => (
<Timeline> <Timeline>
{result?.detailList?.map((item, index) => ( {traceItem?.detailList.length ? (
traceItem?.detailList?.map((item, index) => (
<Timeline.Item color={index > 0 ? 'gray' : 'blue'} key={index.toString()}> <Timeline.Item color={index > 0 ? 'gray' : 'blue'} key={index.toString()}>
<p>{item.desc}</p> <p>{item.desc}</p>
<p>{item.logisticsTime}</p> <p>{item.time}</p>
</Timeline.Item> </Timeline.Item>
))} ))
) : (
<div style={emptyStyle}>暂无物流信息</div>
)}
</Timeline> </Timeline>
))}
</div>
))
) : ( ) : (
<div style={emptyStyle}>暂无物流信息</div> <div style={emptyStyle}>暂无物流信息</div>
)} )}
......
...@@ -16,6 +16,7 @@ import RejectModal from './components/rejectModal'; ...@@ -16,6 +16,7 @@ import RejectModal from './components/rejectModal';
import LogisticsCom from '../orderManage/pendingDeliveryOrder/components/LogisticsCom'; import LogisticsCom from '../orderManage/pendingDeliveryOrder/components/LogisticsCom';
import CancelAuditModal from './components/CancelAuditModal'; import CancelAuditModal from './components/CancelAuditModal';
import CancelDetailTable from './components/CancelDetailTable'; import CancelDetailTable from './components/CancelDetailTable';
import LogisticsRecordModal from './components/LogisticsRecordModal';
import { getColumns, getFormConfig, TAB_MAPPING_DATA } from './data.js'; import { getColumns, getFormConfig, TAB_MAPPING_DATA } from './data.js';
import { getDetail } from '@/pages/afterSale/appeal/services'; import { getDetail } from '@/pages/afterSale/appeal/services';
...@@ -44,6 +45,7 @@ const AfterSale = props => { ...@@ -44,6 +45,7 @@ const AfterSale = props => {
const actionRef = useRef(); const actionRef = useRef();
const formRef = useRef(); const formRef = useRef();
const logisticsRecordModalRef = useRef();
const [tableParams, setTableParams] = useState({}); const [tableParams, setTableParams] = useState({});
const [currentTab, setCurrentTab] = useState(''); const [currentTab, setCurrentTab] = useState('');
// const [appealDetailModal, setAppealDetailModal] = useState(false); // const [appealDetailModal, setAppealDetailModal] = useState(false);
...@@ -132,25 +134,26 @@ const AfterSale = props => { ...@@ -132,25 +134,26 @@ const AfterSale = props => {
}; };
// 查看物流 // 查看物流
const handleCom = async ({ expressCompanyCode, deliveryNo }) => { const handleCom = async ({ orderNo }) => {
const tempObj = { logisticsRecordModalRef.current.open(orderNo);
detailList: [], // const tempObj = {
key: Date.now(), // detailList: [],
}; // key: Date.now(),
const data = await trackInfo({ expressCompanyCode, logisticsNo: deliveryNo }); // };
if (!data) { // const data = await trackInfo({ expressCompanyCode, logisticsNo: deliveryNo });
notification.info({ message: '暂无物流信息' }); // if (!data) {
return; // notification.info({ message: '暂无物流信息' });
} // return;
tempObj.expressCompanyName = data.logisticsName; // }
tempObj.deliveryNo = data.logisticsBillNo; // tempObj.expressCompanyName = data.logisticsName;
if (data.logisticsList?.length) { // tempObj.deliveryNo = data.logisticsBillNo;
data.logisticsList.forEach(v => { // if (data.logisticsList?.length) {
tempObj.detailList = [...tempObj.detailList, ...v.detailList]; // data.logisticsList.forEach(v => {
}); // tempObj.detailList = [...tempObj.detailList, ...v.detailList];
} // });
setLogisticsComModalVisible(true); // }
setLogisticsComList(tempObj); // setLogisticsComModalVisible(true);
// setLogisticsComList(tempObj);
}; };
// 物流拦截 // 物流拦截
...@@ -439,6 +442,8 @@ const AfterSale = props => { ...@@ -439,6 +442,8 @@ const AfterSale = props => {
onCancel={closeModal} onCancel={closeModal}
dataSource={cancelDetailInfo} dataSource={cancelDetailInfo}
/> />
<LogisticsRecordModal ref={logisticsRecordModalRef} />
</PageHeaderWrapper> </PageHeaderWrapper>
); );
}; };
......
...@@ -59,3 +59,24 @@ ...@@ -59,3 +59,24 @@
} }
} }
} }
.logistics-record {
&__topbar {
margin-bottom: 15px;
padding-left: 10px;
color: #000;
font-weight: bold;
font-size: 16px;
border-left: 10px solid #2391fe;
}
&__head {
padding-bottom: 25px;
color: #000;
font-weight: 500;
font-size: 14px;
line-height: 1;
.no {
margin-left: 20px;
}
}
}
...@@ -131,6 +131,21 @@ export async function getLogisticsRecord(params) { ...@@ -131,6 +131,21 @@ export async function getLogisticsRecord(params) {
}); });
} }
/**
* 多物流发货-查询物流轨迹
* @see http://yapi.quantgroups.com/project/389/interface/api/46120
*/
export function apiDeliveriesTraceList(data) {
return request.post('/api/merchants/deliveries/trace/list', {
data: stringify(data),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
prefix: kdspApi,
});
}
// 查询售后待办数量 // 查询售后待办数量
export function getAfterPendingNum(data) { export function getAfterPendingNum(data) {
return request.post('/api/kdsp/op/afs/getPendingNum', { return request.post('/api/kdsp/op/afs/getPendingNum', {
......
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