Commit b3b3aa22 authored by XieZhiXiong's avatar XieZhiXiong

feat: 新增查看退货发货单详情相关

parent 3c4ab0a7
......@@ -94,6 +94,14 @@ const route: RouterChild = {
hideInMenu: true,
noMargin: true,
},
// 待新增退货发货单-退货发货单详情
{
path: '/memberCenter/afterService/returnApplication/returnPrAddDeliver/deliverDetail',
name: 'returnDeliverBillDetail',
component: '@/pages/afterService/returnApplication/returnPrAddDeliver/deliverBillDetail',
hideInMenu: true,
noMargin: true,
},
// 待新增退货发货单-订单详情
{
path: '/memberCenter/afterService/returnApplication/returnPrAddDeliver/orderDetail',
......
......@@ -592,6 +592,7 @@ export default {
'menu.afterService.returnApplication.editReturnPrSubmit': '编辑退货申请单',
'menu.afterService.returnApplication.returnPrAddDeliver': '待新增退货发货单',
'menu.afterService.returnApplication.returnAddDeliverBill': '新增退货发货单',
'menu.afterService.returnApplication.returnDeliverBillDetail': '查看退货发货单',
'menu.afterService.returnApplication.returnPrAddLogistics': '待新增物流单',
'menu.afterService.returnApplication.returnPrDeliver': '待退货发货',
'menu.afterService.returnApplication.verifyReturnPrDeliver': '退货发货',
......
/*
* @Author: XieZhiXiong
* @Date: 2021-08-16 11:47:55
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-16 14:36:15
* @Description: 退货发货单详情
*/
import React from 'react';
import { DOC_TYPE_RETURN_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 DeliverBillDetail = () => {
const { id } = usePageStatus();
const fetchRelatedInfo = (): Promise<RelatedInfoDataType> => {
return new Promise((resolve, reject) => {
PublicApi.getAsReturnGoodsGetReturnDeliveryGoodsDetail({
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.returnCount,
})),
});
}
reject();
}).catch((err) => {
reject(err);
});
});
};
return (
<>
<BillsFormPage
billType={DOC_TYPE_RETURN_INVOICE}
fetchRelatedInfo={fetchRelatedInfo}
editable={false}
/>
</>
);
};
export default DeliverBillDetail;
......@@ -107,13 +107,13 @@ const ReturnPrAddDeliver: React.FC = () => {
title: '退货发货单号',
dataIndex: 'returnDeliveryNo',
align: 'center',
// render: (text, record) => (
// <Link
// to={`/memberCenter/tranactionAbility/stockSellStorage/bills/detail?id=${record.returnDeliveryId}`}
// >
// {text}
// </Link>
// ),
render: (text, record) => (
<Link
to={`/memberCenter/afterService/returnApplication/returnPrAddDeliver/deliverDetail?id=${record.returnDeliveryId}`}
>
{text}
</Link>
),
},
{
title: '外部状态',
......
......@@ -2,10 +2,15 @@
* @Author: XieZhiXiong
* @Date: 2021-08-04 14:42:57
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-04 17:59:35
* @LastEditTime: 2021-08-16 14:47:41
* @Description:
*/
import { FormPath, FormEffectHooks } from '@formily/antd';
import {
FormEffectHooks,
IFormExtendsEffectSelector,
ISchemaFormActions,
ISchemaFormAsyncActions,
} from '@formily/antd';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { PublicApi } from '@/services/api';
import { useBusinessEffects } from './useBusinessEffects';
......@@ -42,11 +47,15 @@ const fetchInventory = (): Promise<any[]> => {
});
};
export const createEffects = (context, actions) => {
const { setFieldState } = actions;
export const createEffects = (context: IFormExtendsEffectSelector, actions: ISchemaFormActions | ISchemaFormAsyncActions) => {
const editable = actions.getFormState((formState) => formState.editable)
useBusinessEffects(context, actions);
useAsyncSelect('billType', fetchInvoicesType, ['name', 'id']);
useAsyncSelect('inventoryId', fetchInventory, ['name', 'id']);
useAsyncSelect('billType', fetchInvoicesType, ['name', 'id']);
// 不可编辑状态不请求
if (editable) {
useAsyncSelect('inventoryId', fetchInventory, ['name', 'id']);
}
};
\ No newline at end of file
......@@ -5,7 +5,7 @@
* @LastEditTime: 2021-08-12 17:08:09
* @Description:
*/
import { FormEffectHooks, FormPath, IFormActions } from '@formily/antd';
import { FormEffectHooks, FormPath, ISchemaFormActions, ISchemaFormAsyncActions, } from '@formily/antd';
import { useLinkageUtils } from '@/utils/formEffectUtils';
const {
......@@ -13,7 +13,7 @@ const {
onFieldValueChange$,
} = FormEffectHooks;
export const useBusinessEffects = (context, actions: IFormActions) => {
export const useBusinessEffects = (context, actions: ISchemaFormActions | ISchemaFormAsyncActions) => {
const { getFieldValue, setFieldState, setFieldValue, getFieldState } = actions;
const linkage = useLinkageUtils();
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-08-04 11:33:33
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-12 17:52:48
* @LastEditTime: 2021-08-16 14:52:30
* @Description: 单据表单组件,提供基础的表单内容,单据明细相关由外部传入控制
*/
import React, { useEffect, useState } from 'react';
......@@ -95,7 +95,6 @@ const BillsFormPage: React.FC<IProps> = (props: IProps) => {
if (fetchRelatedInfo) {
setRelatedLoading(true);
fetchRelatedInfo().then((res) => {
console.log('res', res)
if (res) {
setRelatedInfo({
...res,
......@@ -134,13 +133,17 @@ const BillsFormPage: React.FC<IProps> = (props: IProps) => {
title={`${editable ? '新增' : '查看'}${TITLE_MAP[billType]}`}
anchors={anchorsArr}
extra={(
<Button
type="primary"
loading={!!submitLoading}
onClick={() => formActions.submit()}
>
保存
</Button>
<>
{editable ? (
<Button
type="primary"
loading={!!submitLoading}
onClick={() => formActions.submit()}
>
保存
</Button>
) : null}
</>
)}
>
<NiceForm
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-08-12 16:39:50
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-12 17:49:41
* @LastEditTime: 2021-08-16 14:33:28
* @Description:
*/
export type BillDetailsItemType = {
......@@ -72,6 +72,22 @@ export type RelatedInfoDataType = {
* 单据明细数据
*/
billDetails: BillDetailsItemType[],
/**
* 仓库id
*/
inventoryId?: number | string,
/**
* 对应仓库名称
*/
inventoryRole?: string,
/**
* 单据摘要
*/
digest?: string,
/**
* 单据时间
*/
createTime?: string,
}
export type RelatedInfoType = Omit<RelatedInfoDataType, 'billDetails'> & {
......
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