Commit bb308619 authored by XieZhiXiong's avatar XieZhiXiong

feat: 新增退货入库单相关

parent 3555a3d1
......@@ -160,6 +160,14 @@ const route: RouterChild = {
name: 'returnPrAddWarehousing',
component: '@/pages/afterService/returnManage/returnPrAddWarehousing/index',
},
// 待新增退货入库单-新增
{
path: '/memberCenter/afterService/returnManage/returnPrAddWarehousing/add',
name: 'returnAddDeliverBill',
component: '@/pages/afterService/returnManage/returnPrAddWarehousing/addWarehouseBill',
hideInMenu: true,
noMargin: true,
},
// 待新增退货入库单-详情
{
path: '/memberCenter/afterService/returnManage/returnPrAddWarehousing/detail',
......
/*
* @Author: XieZhiXiong
* @Date: 2021-08-13 18:19:27
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-13 18:34:10
* @Description: 新增退货入库单
*/
import React, { useState } from 'react';
import { FormEffectHooks } from '@formily/antd';
import { history, Prompt } from 'umi';
import moment from 'moment';
import { DOC_TYPE_RETURN_RECEIPT } 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 ReturnAddWarehouseBill = () => {
const { applyId } = usePageStatus();
const [unsaved, setUnsaved] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const fetchRelatedInfo = (): Promise<RelatedInfoDataType> => {
return new Promise((resolve, reject) => {
PublicApi.getAsReturnGoodsGetDetailBySupplier({
returnId: applyId,
}).then((res) => {
if (res.code === 1000) {
resolve({
relatedNo: res.data.applyNo,
memberName: res.data.consumerName,
address: `${res.data.returnGoodsAddress?.sendUserName || ''} / ${res.data.returnGoodsAddress?.sendUserTel || ''} ${res.data.returnGoodsAddress?.sendAddress || ''}`,
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.returnCount,
})),
});
}
reject();
}).catch((err) => {
reject(err);
});
});
};
const handleSubmit = (values: BillSubmitValuesType) => {
PublicApi.postAsReturnGoodsAddReturnGoodsStorage({
returnId: applyId,
storageTime: values.createTime ? moment(values.createTime).valueOf() : 0,
orderAbstract: values.digest,
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_RETURN_RECEIPT}
fetchRelatedInfo={fetchRelatedInfo}
submitLoading={submitLoading}
onSubmit={handleSubmit}
customEffects={() => {
onFormInputChange$().subscribe(() => {
if (!unsaved) {
setUnsaved(true);
}
});
}}
/>
<Prompt when={unsaved} message="您还有未保存的内容,是否确定要离开?" />
</>
);
};
export default ReturnAddWarehouseBill;
......@@ -2,13 +2,12 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 16:30:44
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-08 17:19:58
* @LastEditTime: 2021-08-13 18:54:51
* @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 {
RETURN_INNER_STATUS_NOT_ADDED_RETURN_STORAGE,
RETURN_INNER_STATUS_UNREVIEWED_RETURN_STORAGE,
} from '@/constants/afterService';
import {
DOC_TYPE_RETURN_RECEIPT,
DEPENDENT_DOC_RETURN,
} from '@/constants/commodity';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import EyePreview from '@/components/EyePreview';
......@@ -145,7 +140,7 @@ const ReturnPrAddWarehousing: React.FC = () => {
type="link"
onClick={
() =>
history.push(`/memberCenter/tranactionAbility/stockSellStorage/bills/add?relevanceInvoicesId=${record.returnId}&invoicesTypeId=${DOC_TYPE_RETURN_RECEIPT}&relevanceInvoices=${DEPENDENT_DOC_RETURN}`)
history.push(`/memberCenter/afterService/returnManage/returnPrAddWarehousing/add?applyId=${record.returnId}`)
}
>
新增
......
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