Commit 5bb94b0e authored by XieZhiXiong's avatar XieZhiXiong

完善售后退货相关

parent ff1de435
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 09:54:04
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-08 14:31:40
* @LastEditTime: 2020-12-09 13:53:00
* @Description: 退货地址信息
*/
import React from 'react';
......@@ -134,30 +134,25 @@ const ReturnAddressInfo: React.FC<ReturnAddressInfo> = ({
onFieldValueChange$('deliveryType').subscribe(fieldState => {
const { name, value } = fieldState;
if (isEdit) {
linkage.show('deliveryAddress');
linkage.hide('deliveryAddressShow');
} else {
linkage.hide('deliveryAddress');
linkage.show('deliveryAddressShow');
}
switch (value) {
// 物流
case 1: {
if (isEdit) {
linkage.show('shippingAddress');
linkage.hide('pickupAddress');
} else {
linkage.hide('*(shippingAddress,pickupAddress)');
linkage.show('deliveryAddressShow');
}
linkage.hide('pickupAddress');
linkage.show('shippingAddress');
break;
};
// 自提
case 2: {
if (isEdit) {
linkage.hide('shippingAddress');
linkage.show('pickupAddress');
} else {
setFieldState('deliveryAddressShow', fieldState => {
fieldState.title = '退货自提地址'
});
linkage.hide('*(shippingAddress,pickupAddress)');
linkage.show('deliveryAddressShow');
}
linkage.hide('shippingAddress');
linkage.show('pickupAddress');
break;
};
// 无需物流
......
......@@ -47,7 +47,8 @@ export const schema: ISchema = {
message: '请选择退货收货地址',
},
],
},
},
// 展示用
shippingAddress: {
type: 'object',
title: '退货发货地址',
......@@ -55,7 +56,8 @@ export const schema: ISchema = {
'x-component-props': {
children: '{{Address}}',
},
},
},
// 展示用
pickupAddress: {
type: 'object',
title: '退货自提地址',
......@@ -64,6 +66,7 @@ export const schema: ISchema = {
children: '{{Address}}',
},
},
// 展示用
deliveryAddressShow: {
type: 'object',
title: '退货收货地址',
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-05 15:18:15
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-05 17:19:35
* @LastEditTime: 2020-12-09 11:35:12
* @Description: 退货收货统计、退货发货明细
*/
import React from 'react';
......@@ -133,7 +133,7 @@ const ReturnInfo: React.FC<ReturnInfoProps> = ({
const detailedColumns: EditableColumns[] = [
{
title: '批次号',
dataIndex: 'orderNo',
dataIndex: 'batch',
render: (text, record) => (
<EyePreview
url={``}
......@@ -144,37 +144,37 @@ const ReturnInfo: React.FC<ReturnInfoProps> = ({
},
{
title: '退货发货单号',
dataIndex: 'id',
dataIndex: 'deliveryNo',
align: 'center',
},
{
title: '发货时间',
dataIndex: 'productName',
dataIndex: 'deliveryTime',
align: 'center',
},
{
title: '物流单号',
dataIndex: 'category',
dataIndex: 'logisticsOrderNo',
align: 'center',
},
{
title: '物流公司',
dataIndex: 'brand',
dataIndex: 'logisticsName',
align: 'center',
},
{
title: '退货入库单号',
dataIndex: 'unit',
dataIndex: 'storageNo',
align: 'center',
},
{
title: '入库时间',
dataIndex: 'quantity',
dataIndex: 'storageTime',
align: 'center',
},
{
title: '内部状态',
dataIndex: 'price',
dataIndex: 'innerStatusName',
align: 'center',
},
];
......
......@@ -6,12 +6,14 @@
position: absolute;
top: 0;
right: 0;
display: flex;
align-items: center;
}
&-check {
padding: 4px 12px;
background: #606266;
border-radius: 0px 4px 0px 4px;
border-radius: 0px 4px 0px 0;
color: #ffffff;
cursor: pointer;
}
......@@ -19,7 +21,6 @@
&-return {
padding: 4px 12px;
background: #00B37A;
border-radius: 0px 4px 0px 4px;
color: #ffffff;
cursor: pointer;
}
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-05 18:02:18
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-08 18:30:16
* @LastEditTime: 2020-12-09 10:15:31
* @Description: 退款明细
*/
import React from 'react';
......@@ -14,6 +14,13 @@ import PolymericTable from '@/components/PolymericTable';
import StatusTag from '@/components/StatusTag';
import Stamp from '../Stamp';
import DescribeLine from '../DescribeLine';
import {
REFUND_INNER_STATUS_NO_REFUND,
REFUND_OUTER_STATUS_NO_REFUND,
REFUND_OUTER_STATUS_UNCONFIRMED_REFUND,
REFUND_OUTER_STATUS_NOT_RECEIVED,
REFUND_OUTER_STATUS_TAG_MAP,
} from '../../constants';
import styles from './index.less';
const { confirm } = Modal;
......@@ -27,11 +34,16 @@ interface ReturnDetailInfoProps {
* 退款事件
*/
onRefund?: (id: number) => Promise<any>;
/**
* 确认事件
*/
onConfirm?: (id: number) => Promise<any>;
};
const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
dataSource = [],
onRefund,
onConfirm,
}) => {
const columns: EditableColumns[] = [
......@@ -109,6 +121,19 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
});
}
};
const handleConfirm = id => {
if (onConfirm) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `是否确认退款已到账?`,
onOk() {
return onConfirm(id);
},
});
}
};
return (
<MellowCard title="退款明细">
......@@ -140,7 +165,7 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
<DescribeLine column={2}>
<DescribeLine.Item title="支付次数">1</DescribeLine.Item>
<DescribeLine.Item title="状态">
<StatusTag type="success" title={item.innerStatusName} />
<StatusTag type={REFUND_OUTER_STATUS_TAG_MAP[item.outerStatus]} title={item.outerStatusName} />
</DescribeLine.Item>
<DescribeLine.Item title="支付环节">{item.payNode}</DescribeLine.Item>
<DescribeLine.Item title="已支付金额(元)">{item.payAmount}</DescribeLine.Item>
......@@ -152,13 +177,30 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
</DescribeLine>
<div className={styles['deliver-item-actions']}>
<div
className={styles['deliver-item-return']}
onClick={() => handleRefund(item.refundId)}
>
退款
<RightOutlined />
</div>
{
item.outerStatus === REFUND_OUTER_STATUS_NO_REFUND &&
item.innerStatus === REFUND_INNER_STATUS_NO_REFUND && (
<div
className={styles['deliver-item-return']}
onClick={() => handleRefund(item.refundId)}
>
退款
</div>
)
}
{
(
item.outerStatus === REFUND_OUTER_STATUS_UNCONFIRMED_REFUND ||
item.outerStatus === REFUND_OUTER_STATUS_NOT_RECEIVED
) && (
<div
className={styles['deliver-item-return']}
onClick={() => handleConfirm(item.refundId)}
>
确认
</div>
)
}
<div
className={styles['deliver-item-check']}
>
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-05 17:36:45
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-07 18:19:57
* @LastEditTime: 2020-12-09 14:11:01
* @Description: 查看退货数量与退款金额 抽屉
*/
import React from 'react';
......@@ -56,16 +56,12 @@ export interface OrderInfo {
/**
* 列表索引
*/
index: number;
index?: number;
/**
* 订单号
*/
orderNo: string;
/**
* 订单id
*/
orderId: number;
/**
* 商品名称
*/
productName: string;
......@@ -97,6 +93,14 @@ export interface OrderInfo {
* 支付记录
*/
payList: PayListItem;
/**
* 退款数量
*/
returnCount?: number | string;
/**
* 退款理由
*/
returnReason?: string;
};
interface ReturnInfoDrawerProps {
......@@ -127,6 +131,8 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({
const handleSubmit = values => {
if (onSubmit) {
onSubmit(values);
} else {
onClose();
}
};
......
......@@ -155,11 +155,23 @@ const schema: ISchema = {
payWay: {
type: 'string',
title: '支付方式',
display: false,
'x-component': 'Text',
},
payWayTxt: {
type: 'string',
title: '支付方式',
'x-component': 'Text',
},
channel: {
type: 'string',
title: '支付渠道',
display: false,
'x-component': 'Text',
},
channelTxt: {
type: 'string',
title: '支付渠道',
'x-component': 'Text',
},
refundAmount: {
......@@ -169,7 +181,6 @@ const schema: ISchema = {
payTime: {
type: 'string',
title: '支付时间',
default: +new Date(),
'x-component': 'Text',
},
},
......@@ -196,7 +207,10 @@ const schema: ISchema = {
returnAmount: {
type: 'string',
title: '退款金额(元)',
'x-component': 'Text',
editable: false,
'x-component-props': {
addonBefore: '¥ '
},
},
returnReason: {
type: 'string',
......
.stamp {
padding: 16px;
padding: 25px 20px;
margin: 10px;
background: #FFFFFF;
box-shadow: 0px 4px 6px 0px rgba(23, 43, 77, 0.08), 0px 0px 1px 0px rgba(23, 43, 77, 0.12);
......
......@@ -236,4 +236,44 @@ export const RETURN_INNER_STATUS_BADGE_MAP = {
[RETURN_INNER_STATUS_REFUNDED_SUCCESS]: '#41CC9E',
[RETURN_INNER_STATUS_UNCONFIRMED_FINISHED]: '#6C9CEB',
[RETURN_INNER_STATUS_FINISHED]: '#41CC9E',
};
// 退款内部状态
/**
* 未退款
*/
export const REFUND_INNER_STATUS_NO_REFUND = 1;
/**
* 退款失败
*/
export const REFUND_INNER_STATUS_REFUND_FAILED = 2;
/**
* 退款成功
*/
export const REFUND_INNER_STATUS_REFUND_SUCCESS = 3;
// 退款外部状态
/**
* 未退款
*/
export const REFUND_OUTER_STATUS_NO_REFUND = 1;
/**
* 待确认退款
*/
export const REFUND_OUTER_STATUS_UNCONFIRMED_REFUND = 2;
/**
* 退款未到账
*/
export const REFUND_OUTER_STATUS_NOT_RECEIVED = 3;
/**
* 退款到账
*/
export const REFUND_OUTER_STATUS_RECEIVED = 4;
// 退款外部状态 StatusTag map
export const REFUND_OUTER_STATUS_TAG_MAP = {
[REFUND_OUTER_STATUS_NO_REFUND]: 'danger',
[REFUND_OUTER_STATUS_UNCONFIRMED_REFUND]: 'primary',
[REFUND_OUTER_STATUS_NOT_RECEIVED]: 'warning',
[REFUND_OUTER_STATUS_RECEIVED]: 'success',
};
\ No newline at end of file
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 10:13:18
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-19 17:21:11
* @LastEditTime: 2020-12-09 14:37:06
* @Description: 待提交换货申请单
*/
import React, { useState, useRef } from 'react';
......@@ -26,6 +26,10 @@ import { ColumnType } from 'antd/lib/table/interface';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { createFormActions } from '@formily/antd';
import { PublicApi } from '@/services/api';
import {
EXCHANGE_INNER_STATUS_UNCOMMITTED,
EXCHANGE_OUTER_STATUS_FAILED,
} from '@/constants';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import EyePreview from '@/components/EyePreview';
......@@ -125,25 +129,40 @@ const ExchangePrSubmit: React.FC = () => {
align: 'center',
render: (text, record) => (
<>
<Button
type="link"
onClick={() => handleSubmit(record)}
>
提交
</Button>
<Button
type="link"
onClick={() => history.push(`/memberCenter/afterService/exchangeApplication/exchangePrSubmit/edit?id=${record.replaceId}`)}
>
编辑
</Button>
<Button
type="link"
onClick={() => handleDelete(record)}
danger
>
删除
</Button>
{record.innerStatus === EXCHANGE_INNER_STATUS_UNCOMMITTED && (
<Button
type="link"
onClick={() => handleSubmit(record)}
>
提交
</Button>
)}
{record.innerStatus === EXCHANGE_INNER_STATUS_UNCOMMITTED && (
<Popconfirm
title="确定要删除吗?"
okText="是"
cancelText="否"
onConfirm={() => handleDelete(record)}
>
<Button
type="link"
danger
>
删除
</Button>
</Popconfirm>
)}
{(
record.innerStatus === EXCHANGE_INNER_STATUS_UNCOMMITTED ||
record.outerStatus === EXCHANGE_OUTER_STATUS_FAILED
) && (
<Button
type="link"
onClick={() => history.push(`/memberCenter/afterService/exchangeApplication/exchangePrSubmit/edit?id=${record.replaceId}`)}
>
编辑
</Button>
)}
</>
),
},
......
......@@ -122,7 +122,7 @@ const RepairPrSubmit: React.FC = () => {
align: 'center',
render: (text, record) => (
<>
{record.outerStatus === REPAIR_INNER_STATUS_UNCOMMITTED && (
{record.innerStatus === REPAIR_INNER_STATUS_UNCOMMITTED && (
<Button
type="link"
onClick={() => handleSubmit(record)}
......@@ -130,7 +130,7 @@ const RepairPrSubmit: React.FC = () => {
提交
</Button>
)}
{record.outerStatus === REPAIR_INNER_STATUS_UNCOMMITTED && (
{record.innerStatus === REPAIR_INNER_STATUS_UNCOMMITTED && (
<Popconfirm
title="确定要删除吗?"
okText="是"
......
......@@ -18,13 +18,19 @@ import {
GetAsReturnGoodsGetDetailByConsumerResponse,
GetAsReturnGoodsPageReturnedGoodsResponse,
} from '@/services/AfterServiceApi';
import { RETURN_OUTER_STATUS_FINISHED } from '@/constants';
import {
RETURN_OUTER_STATUS_FINISHED,
RETURN_OUTER_STATUS_TO_BE_REFUNDED,
RETURN_OUTER_STATUS_UNCONFIRMED_REFUNDED,
RETURN_OUTER_STATUS_NOT_RECEIVED,
RETURN_OUTER_STATUS_UNCONFIRMED_FINISHED,
} from '@/constants';
import { normalizeFiledata, FileData, findLastIndexFlowState } from '@/utils';
import AvatarWrap from '@/components/AvatarWrap';
import StatusTag from '@/components/StatusTag';
import EyePreview from '@/components/EyePreview';
import { EditableColumns } from '@/components/PolymericTable/interface';
import ReturnInfoDrawer from '../../../components/ReturnInfoDrawer';
import ReturnInfoDrawer, { OrderInfo } from '../../../components/ReturnInfoDrawer';
import { OuterHistoryData, InnerHistoryData } from '../../../components/FlowRecords';
import {
EXCHANGE_OUTER_STATUS_TAG_MAP,
......@@ -48,7 +54,7 @@ interface DetailInfoProps {
// 历史记录目标路径
target?: string;
// 头部右侧拓展
headExtra?: React.ReactNode;
headExtra?: (info: DetailInfo) => React.ReactNode;
};
interface DetailInfo extends GetAsReturnGoodsGetDetailByConsumerResponse {
fileList: FileData[];
......@@ -65,8 +71,26 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
const [returnGoodsLoading, setReturnGoodsLoading] = useState(false);
const [infoLoading, setInfoloading] = useState(false);
const [visibleOrderDetial, setVisibleReturnInfo] = useState<boolean>(false);
const [orderInfo, setOrderInfo] = useState<OrderInfo>(null);
const handleCheckOrderDetial = record => {
setOrderInfo({
orderNo: record.orderNo,
productName: record.productName,
category: record.category,
brand: record.brand,
unit: record.unit,
purchaseCount: record.purchaseCount,
purchasePrice: record.purchasePrice,
purchaseAmount: record.purchaseAmount,
returnCount: record.returnCount,
returnReason: record.returnReason,
payList: record.payList.map(item => ({
...item,
payWayTxt: item.payWayName,
channelTxt: item.channelName,
})),
});
setVisibleReturnInfo(true);
};
......@@ -266,6 +290,18 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
});
};
// 确认退款到账
const handleConfirm = (id): Promise<any> => {
return PublicApi.postAsReturnGoodsConfirmRefund({
refundId: id,
isReceipt: 1,
}).then(res => {
if (res.code === 1000) {
getDetailInfo();
}
});
};
return (
<Spin spinning={infoLoading}>
<PageHeaderWrapper
......@@ -287,7 +323,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
}
extra={(
<>
{headExtra}
{headExtra && headExtra(detailInfo)}
</>
)}
>
......@@ -355,18 +391,25 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
</Suspense>
</Col>
<Col span={24}>
<Suspense fallback={null}>
<ReturnDetailInfo
dataSource={[
{
id: 1,
orderNo: '123',
},
]}
/>
</Suspense>
</Col>
{/* 退款明细信息 */}
{
detailInfo && (
detailInfo.outerStatus === RETURN_OUTER_STATUS_TO_BE_REFUNDED ||
detailInfo.outerStatus === RETURN_OUTER_STATUS_UNCONFIRMED_REFUNDED ||
detailInfo.outerStatus === RETURN_OUTER_STATUS_NOT_RECEIVED ||
detailInfo.outerStatus === RETURN_OUTER_STATUS_UNCONFIRMED_FINISHED ||
detailInfo.outerStatus === RETURN_OUTER_STATUS_FINISHED
) && (
<Col span={24}>
<Suspense fallback={null}>
<ReturnDetailInfo
dataSource={detailInfo && detailInfo.refundList ? detailInfo.refundList : []}
onConfirm={handleConfirm}
/>
</Suspense>
</Col>
)
}
<Col span={24}>
<Row
......@@ -423,6 +466,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
<ReturnInfoDrawer
visible={visibleOrderDetial}
orderInfo={orderInfo}
onClose={() => setVisibleReturnInfo(false)}
/>
</PageHeaderWrapper>
......
import React, { useState } from 'react';
import { Button } from 'antd';
import { Button, Space, Modal } from 'antd';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { FormOutlined } from '@ant-design/icons';
import { SettingOutlined, RollbackOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from '../components/DetailInfo';
const { confirm } = Modal;
const ReturnPrConfirmBackVerify: React.FC = () => {
const { id } = usePageStatus();
const [submitLoading, setSubmitLoading] = useState(false);
const handleSubmit = () => {
const handleSubmit = (info) => {
if (!id) {
return;
}
setSubmitLoading(true);
PublicApi.postAsReturnGoodsConfirmAllReturnGoodsReceipt({
dataId: id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
if (
info &&
info.returnDeliveryGoodsList &&
info.returnDeliveryGoodsList.length
) {
// 未退货发货数量有大于 0 时
if (
info.returnDeliveryGoodsList.some(item => {
return item.detailList.some(good => good.count - good.deliveryCount > 0)
})
) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `您还有未退货发货的商品,是否确认全部退货发货都已完成?`,
onOk() {
return PublicApi.postAsReturnGoodsConfirmAllReturnGoodsReceipt({
dataId: id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
}
});
},
});
}
// 未退货发货数量全部小于或等于 0 时
if (
info.returnDeliveryGoodsList.every(item => {
return item.detailList.every(good => good.count - good.deliveryCount <= 0)
})
) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `是否确认全部退货发货单已收到回单?`,
onOk() {
return PublicApi.postAsReplaceGoodsConfirmAllReturnGoodsReceipt({
dataId: id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
}
});
},
});
}
}).finally(() => {
setSubmitLoading(false);
});
}
};
const handleDeliverAgain = (info) => {
if (
info &&
info.returnDeliveryGoodsList &&
info.returnDeliveryGoodsList.length
) {
// 未退货发货数量全部小于或等于 0 时
if (
info.returnDeliveryGoodsList.every(item => {
return item.detailList.every(good => good.count - good.deliveryCount <= 0)
})
) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `您商品都已退货发货,是否确认还需要继续退货发货?`,
onOk() {
return PublicApi.postAsReturnGoodsContinueReturnDeliveryGoods({
dataId: id,
});
},
});
}
// 未退货发货数量有大于 0 时
if (
info.returnDeliveryGoodsList.some(item => {
return item.detailList.some(good => good.count - good.deliveryCount > 0)
})
) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `是否继续退货发货?`,
onOk() {
return PublicApi.postAsReturnGoodsContinueReturnDeliveryGoods({
dataId: id,
});
},
});
}
}
};
return (
<>
<DetailInfo
id={id}
headExtra={(
<Button
type="primary"
icon={<FormOutlined />}
loading={submitLoading}
onClick={handleSubmit}
>
确认全部退货发货单已收到回单
</Button>
headExtra={detailInfo => (
<Space>
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleSubmit(detailInfo)}
>
确认全部退货发货单已收到回单
</Button>
<Button
type="default"
icon={<RollbackOutlined />}
onClick={() => handleDeliverAgain(detailInfo)}
>
继续退货发货
</Button>
</Space>
)}
/>
</>
......
......@@ -33,7 +33,7 @@ const ReturnPrConfirmFinishVerify: React.FC = () => {
<>
<DetailInfo
id={id}
headExtra={(
headExtra={() => (
<Button
type="primary"
icon={<FormOutlined />}
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 16:30:44
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-08 16:07:01
* @LastEditTime: 2020-12-09 15:32:03
* @Description: 待新增退货发货单
*/
import React, { useState, useRef } from 'react';
......@@ -135,7 +135,7 @@ const ReturnPrConfirmResult: React.FC = () => {
<Card>
<StandardTable
tableProps={{
rowKey: 'id',
rowKey: 'returnId',
}}
columns={columns}
currentRef={ref}
......
......@@ -30,12 +30,12 @@ const ReturnPrConfirmResultVerify: React.FC = () => {
<>
<DetailInfo
id={id}
headExtra={(
headExtra={() => (
<Button
type="primary"
icon={<FormOutlined />}
loading={submitLoading}
onClick={() => handleSubmit}
onClick={handleSubmit}
>
确认本单所有退款到账
</Button>
......
......@@ -36,7 +36,7 @@ const ReturnPrDeliverVerify: React.FC = () => {
<>
<DetailInfo
id={id}
headExtra={(
headExtra={() => (
<Button
type="default"
icon={<SettingOutlined />}
......
......@@ -47,6 +47,7 @@ interface DetailInfo {
outerStatusName?: string,
innerStatus?: number,
innerStatusName?: string,
deliveryType?: number,
}
const ReturnForm: React.FC<BillsFormProps> = ({
......@@ -201,6 +202,11 @@ const ReturnForm: React.FC<BillsFormProps> = ({
returnDeliveryGoodsList,
returnStatisticsList,
taskType,
consumerName,
outerRecordList,
outerTaskList,
returnBatch,
returnId,
...rest
} = res.data;
......@@ -303,6 +309,14 @@ const ReturnForm: React.FC<BillsFormProps> = ({
deliveryAddress = {},
proofFileList = [],
returnGoodsList = [],
outerStatus,
outerStatusName,
innerStatus,
innerStatusName,
applyNo,
applyTime,
refundList,
...rest
} = values;
......@@ -311,6 +325,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
setSubmitLoading(true);
const payload = {
...rest,
returnId: id || 0,
supplierMemberId: supplierMember[0].memberId,
supplierRoleId: supplierMember[0].roleId,
......@@ -353,22 +368,33 @@ const ReturnForm: React.FC<BillsFormProps> = ({
})),
returnGoodsList: returnGoodsList.map(({
id,
replaceCount,
brand,
unit,
extraData,
needReturnName,
isNeedReturn,
...rest
}) => ({
...rest,
brand: brand || '',
unit: unit || '',
orderRecordId: extraData.id,
returnReason: extraData.returnReason,
payList: extraData.payList,
payList: extraData.payList.map(item => {
const {
channelName,
payTime,
payWayName,
...payItemRest
} = item;
return {
...payItemRest,
payTime: +new Date(payTime),
};
}),
isNeedReturn: 1,
...rest,
})),
taskType: 18,
...rest,
};
PublicApi.postAsReturnGoodsSave(payload)
......@@ -559,7 +585,9 @@ const ReturnForm: React.FC<BillsFormProps> = ({
returnGoodsList: returnGoodsList.data.map(item => ({
...item,
extraData: {
returnReason: item.returnReason,
payList: item.payList || [],
id: item.orderRecordId || [],
},
})),
}}
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 10:13:18
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-08 13:54:58
* @LastEditTime: 2020-12-09 14:31:30
* @Description: 待提交退货申请单
*/
import React, { useState, useRef } from 'react';
......@@ -26,6 +26,10 @@ import { ColumnType } from 'antd/lib/table/interface';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { createFormActions } from '@formily/antd';
import { PublicApi } from '@/services/api';
import {
RETURN_INNER_STATUS_UNCOMMITTED,
RETURN_OUTER_STATUS_FAILED,
} from '@/constants';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import EyePreview from '@/components/EyePreview';
......@@ -130,25 +134,40 @@ const ReturnPrSubmit: React.FC = () => {
align: 'center',
render: (text, record) => (
<>
<Button
type="link"
onClick={() => handleSubmit(record)}
>
提交
</Button>
<Button
type="link"
onClick={() => history.push(`/memberCenter/afterService/returnApplication/returnPrSubmit/edit?id=${record.returnId}`)}
>
编辑
</Button>
<Button
type="link"
onClick={() => handleDelete(record)}
danger
>
删除
</Button>
{record.innerStatus === RETURN_INNER_STATUS_UNCOMMITTED && (
<Button
type="link"
onClick={() => handleSubmit(record)}
>
提交
</Button>
)}
{record.innerStatus === RETURN_INNER_STATUS_UNCOMMITTED && (
<Popconfirm
title="确定要删除吗?"
okText="是"
cancelText="否"
onConfirm={() => handleDelete(record)}
>
<Button
type="link"
danger
>
删除
</Button>
</Popconfirm>
)}
{(
record.innerStatus === RETURN_INNER_STATUS_UNCOMMITTED ||
record.outerStatus === RETURN_OUTER_STATUS_FAILED
) && (
<Button
type="link"
onClick={() => history.push(`/memberCenter/afterService/returnApplication/returnPrSubmit/edit?id=${record.returnId}`)}
>
编辑
</Button>
)}
</>
),
},
......
......@@ -9,9 +9,10 @@ import {
Col,
Badge,
Switch,
Tooltip,
message,
} from 'antd';
import { FormOutlined } from '@ant-design/icons';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
......@@ -19,7 +20,13 @@ import {
GetAsReturnGoodsGetDetailBySupplierResponse,
GetAsReturnGoodsPageReturnedGoodsResponse,
} from '@/services/AfterServiceApi';
import { RETURN_OUTER_STATUS_FINISHED } from '@/constants';
import {
RETURN_OUTER_STATUS_FINISHED,
RETURN_OUTER_STATUS_TO_BE_REFUNDED,
RETURN_OUTER_STATUS_UNCONFIRMED_REFUNDED,
RETURN_OUTER_STATUS_NOT_RECEIVED,
RETURN_OUTER_STATUS_UNCONFIRMED_FINISHED,
} from '@/constants';
import { normalizeFiledata, FileData, findLastIndexFlowState } from '@/utils';
import AvatarWrap from '@/components/AvatarWrap';
import StatusTag from '@/components/StatusTag';
......@@ -74,10 +81,24 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
};
const handleReturn = record => {
if (!isEdit) {
if (!isEdit || !id) {
return;
}
console.log('否后退货', record)
const msg = message.loading({
content: '正在更改',
duration: 0,
});
PublicApi.postAsReturnGoodsSetNeedReturnGoods({
returnId: +id,
returnGoodsId: record.detailId,
isNeed: record.isNeedReturn === 1 ? 0 : 1,
}).then(res => {
if (res.code === 1000) {
getReturnGoods();
}
}).finally(() => {
msg();
});
};
const productColumns: EditableColumns[] = [
......@@ -148,10 +169,25 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
align: 'center',
},
{
title: '是否退货',
title: (
<>
<span style={{ marginRight: 8 }}>是否需要退货</span>
<Tooltip title="如果商品因为缺陷原因,无法再退回加工后重新使用,可选择不需要退货,选择后,采购方无须退回不良品。">
<QuestionCircleOutlined />
</Tooltip>
</>
),
dataIndex: 'needReturnName',
align: 'center',
render: text => text,
render: (text, record) => (
<>
{!isEdit ? (
text
) : (
<Switch checked={record.isNeedReturn} onChange={() => handleReturn(record)} />
)}
</>
),
},
{
title: '操作',
......@@ -344,15 +380,26 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
/>
</Suspense>
</Col>
<Col span={24}>
<Suspense fallback={null}>
<ReturnDetailInfo
dataSource={detailInfo && detailInfo.refundList ? detailInfo.refundList : []}
onRefund={handleRefund}
/>
</Suspense>
</Col>
{/* 退款明细信息 */}
{
detailInfo && (
detailInfo.outerStatus === RETURN_OUTER_STATUS_TO_BE_REFUNDED ||
detailInfo.outerStatus === RETURN_OUTER_STATUS_UNCONFIRMED_REFUNDED ||
detailInfo.outerStatus === RETURN_OUTER_STATUS_NOT_RECEIVED ||
detailInfo.outerStatus === RETURN_OUTER_STATUS_UNCONFIRMED_FINISHED ||
detailInfo.outerStatus === RETURN_OUTER_STATUS_FINISHED
) && (
<Col span={24}>
<Suspense fallback={null}>
<ReturnDetailInfo
dataSource={detailInfo && detailInfo.refundList ? detailInfo.refundList : []}
onRefund={handleRefund}
/>
</Suspense>
</Col>
)
}
<Col span={24}>
<Row
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-04 17:22:07
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-08 18:34:46
* @LastEditTime: 2020-12-09 15:30:56
* @Description:
*/
import React, { useState } from 'react';
......
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