Commit f56395f6 authored by XieZhiXiong's avatar XieZhiXiong

feat: 新增换货发货单相关

parent c9d0425a
......@@ -236,6 +236,22 @@ const route: RouterChild = {
hideInMenu: true,
noMargin: true,
},
// 待新增退货发货单-新增
{
path: '/memberCenter/afterService/exchangeManage/exchangePrAddDeliver/add',
name: 'exchangeAddDeliverBill',
component: '@/pages/afterService/exchangeManage/exchangePrAddDeliver/addDeliverBill',
hideInMenu: true,
noMargin: true,
},
// 待新增退货发货单-退货发货单详情
{
path: '/memberCenter/afterService/exchangeManage/exchangePrAddDeliver/deliverDetail',
name: 'exchangeDeliverBillDetail',
component: '@/pages/afterService/exchangeManage/exchangePrAddDeliver/deliverBillDetail',
hideInMenu: true,
noMargin: true,
},
// 待新增换货发货单-订单详情
{
path: '/memberCenter/afterService/exchangeManage/exchangePrAddDeliver/orderDetail',
......
......@@ -580,6 +580,8 @@ export default {
'menu.afterService.exchangeManage.exchangePrReceived': '待退货收货',
'menu.afterService.exchangeManage.verifyExchangePrReceived': '退货收货',
'menu.afterService.exchangeManage.exchangePrAddDeliver': '待新增换货发货单',
'menu.afterService.exchangeManage.exchangeAddDeliverBill': '新增换货发货单',
'menu.afterService.exchangeManage.exchangeDeliverBillDetail': '查看换货发货单',
'menu.afterService.exchangeManage.exchangePrAddLogistics': '待新增物流单',
'menu.afterService.exchangeManage.exchangePrDeliver': '待换货发货',
'menu.afterService.exchangeManage.verifyExchangePrDeliver': '换货发货',
......
/*
* @Author: XieZhiXiong
* @Date: 2021-08-20 15:14:42
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-20 15:20:22
* @Description: 新增换货发货单
*/
import React, { useState } from 'react';
import { FormEffectHooks } from '@formily/antd';
import { history, Prompt } from 'umi';
import moment from 'moment';
import { DOC_TYPE_EXCHANGE_INVOICE } from '@/constants/commodity';
import BillsFormPage, { RelatedInfoDataType, BillSubmitValuesType } from '@/pages/transaction/stockSellStorage/bills/components/BillsFormPage';
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
const {
onFormInputChange$,
} = FormEffectHooks;
const ExchangeAddDeliverBill = () => {
const { applyId } = usePageStatus();
const [unsaved, setUnsaved] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const fetchRelatedInfo = (): Promise<RelatedInfoDataType> => {
return new Promise((resolve, reject) => {
PublicApi.getAsReplaceGoodsGetDetailBySupplier({
replaceId: applyId,
}).then((res) => {
if (res.code === 1000) {
resolve({
relatedNo: res.data.applyNo,
memberName: res.data.supplierName,
address: `${res.data.returnGoodsAddress?.receiveUserName || ''} / ${res.data.returnGoodsAddress?.receiveUserTel || ''} ${res.data.returnGoodsAddress?.receiveAddress || ''}`,
logisticsType: res.data.returnGoodsAddress?.deliveryType,
billDetails: res.data.goodsDetailList.map((item) => ({
orderNo: item.orderNo,
productId: item.productId,
productName: item.productName,
category: item.category,
brand: item.brand,
unit: item.category,
price: item.purchasePrice,
relatedCount: item.replaceCount,
count: item.receiveCount,
})),
});
}
reject();
}).catch((err) => {
reject(err);
});
});
};
const handleSubmit = (values: BillSubmitValuesType) => {
PublicApi.postAsReplaceGoodsAddReplaceDeliveryGoods({
replaceId: applyId,
deliveryTime: values.createTime ? moment(values.createTime).valueOf() : 0,
orderAbstract: values.digest,
remark: values.remark,
inventoryName: values.inventoryName,
inventoryRole: values.inventoryRole,
detailList: values.billDetails.map((item) => ({
orderNo: item.orderNo,
productId: item.productId,
productName: item.productName,
category: item.category,
brand: item.brand,
unit: item.unit,
count: item.count,
})),
}).then((res) => {
if (res.code === 1000) {
setUnsaved(false);
setTimeout(() => {
history.goBack();
}, 800);
} else {
setSubmitLoading(false);
}
});
};
return (
<>
<BillsFormPage
billType={DOC_TYPE_EXCHANGE_INVOICE}
fetchRelatedInfo={fetchRelatedInfo}
submitLoading={submitLoading}
onSubmit={handleSubmit}
customEffects={() => {
onFormInputChange$().subscribe(() => {
if (!unsaved) {
setUnsaved(true);
}
});
}}
/>
<Prompt when={unsaved} message="您还有未保存的内容,是否确定要离开?" />
</>
);
};
export default ExchangeAddDeliverBill;
/*
* @Author: XieZhiXiong
* @Date: 2021-08-20 15:14:49
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-20 15:17:47
* @Description: 换货发货单详情
*/
import React from 'react';
import { DOC_TYPE_EXCHANGE_INVOICE } from '@/constants/commodity';
import BillsFormPage, { RelatedInfoDataType } from '@/pages/transaction/stockSellStorage/bills/components/BillsFormPage';
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import moment from 'moment';
const ExchangeDeliverBillDetail = () => {
const { id } = usePageStatus();
const fetchRelatedInfo = (): Promise<RelatedInfoDataType> => {
return new Promise((resolve, reject) => {
PublicApi.getAsReplaceGoodsGetReturnDeliveryGoodsDetail({
returnDeliveryId: id,
}).then((res) => {
if (res.code === 1000) {
resolve({
relatedNo: res.data.applyNo,
memberName: res.data.memberName,
address: `${res.data.userName || ''} / ${res.data.tel || ''} ${res.data.address || ''}`,
logisticsType: res.data.deliveryType,
inventoryId: res.data.inventoryName,
inventoryRole: res.data.inventoryRole,
digest: res.data.orderAbstract,
createTime: res.data.orderTime ? moment(res.data.orderTime).format('YYYY-MM-DD HH:mm:ss') : '',
billDetails: res.data.goodsDetailDeliveryList.map((item) => ({
orderNo: item.orderNo,
productId: item.productId,
productName: item.productName,
category: item.category,
brand: item.brand,
unit: item.category,
price: item.purchasePrice,
relatedCount: item.replaceCount,
count: item.replaceDeliveryCount,
})),
remark: res.data.remark,
});
}
reject();
}).catch((err) => {
reject(err);
});
});
};
return (
<>
<BillsFormPage
billType={DOC_TYPE_EXCHANGE_INVOICE}
fetchRelatedInfo={fetchRelatedInfo}
editable={false}
/>
</>
);
};
export default ExchangeDeliverBillDetail;
......@@ -2,13 +2,12 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 16:30:44
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-19 14:53:19
* @LastEditTime: 2021-08-20 15:39:47
* @Description: 待新增换货发货单
*/
import React, { useState, useRef } from 'react';
import { Card, Badge, Progress, Button, Modal } from 'antd';
import { Card, Badge, Button, Modal } from 'antd';
import {
ClockCircleOutlined,
ExclamationCircleOutlined,
} from '@ant-design/icons';
import { history, Link } from 'umi';
......@@ -22,10 +21,6 @@ import {
EXCHANGE_INNER_STATUS_NOT_ADDED_REPLACE_DELIVERY,
EXCHANGE_INNER_STATUS_UNREVIEWED_REPLACE_DELIVERY,
} from '@/constants/afterService';
import {
DOC_TYPE_EXCHANGE_INVOICE,
DEPENDENT_DOC_EXCHANGE,
} from '@/constants/commodity';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import EyePreview from '@/components/EyePreview';
......@@ -109,7 +104,7 @@ const ExchangePrAddDeliver: React.FC = () => {
align: 'center',
render: (text, record) => (
<Link
to={`/memberCenter/tranactionAbility/stockSellStorage/bills/detail?id=${record.replaceDeliveryId}`}
to={`/memberCenter/afterService/exchangeManage/exchangePrAddDeliver/deliverDetail?id=${record.returnDeliveryId}`}
>
{text}
</Link>
......@@ -140,7 +135,7 @@ const ExchangePrAddDeliver: React.FC = () => {
type="link"
onClick={
() =>
history.push(`/memberCenter/tranactionAbility/stockSellStorage/bills/add?relevanceInvoicesId=${record.replaceId}&invoicesTypeId=${DOC_TYPE_EXCHANGE_INVOICE}&relevanceInvoices=${DEPENDENT_DOC_EXCHANGE}`)
history.push(`/memberCenter/afterService/exchangeManage/exchangePrAddDeliver/add?applyId=${record.replaceId}`)
}
>
新增
......
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