Commit dfe30212 authored by XieZhiXiong's avatar XieZhiXiong

对接售后退货中...

parent e7173bb3
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
z-index: 5; z-index: 5;
} }
} }
&.disabled {
cursor: not-allowed;
}
} }
} }
......
...@@ -27,6 +27,8 @@ interface AddressFormItemProps { ...@@ -27,6 +27,8 @@ interface AddressFormItemProps {
// 默认展示的条数 // 默认展示的条数
showCount?: number; showCount?: number;
onChange: (id: string) => {}; onChange: (id: string) => {};
// 禁用的
disabled?: boolean;
}; };
const AddressFormItem: React.FC<AddressFormItemProps> & { isFieldComponent: boolean } = ({ const AddressFormItem: React.FC<AddressFormItemProps> & { isFieldComponent: boolean } = ({
...@@ -34,6 +36,7 @@ const AddressFormItem: React.FC<AddressFormItemProps> & { isFieldComponent: bool ...@@ -34,6 +36,7 @@ const AddressFormItem: React.FC<AddressFormItemProps> & { isFieldComponent: bool
showCount = 3, showCount = 3,
dataSource = [], dataSource = [],
onChange, onChange,
disabled = false,
}) => { }) => {
const [showMore, setShowMore] = useState(false); const [showMore, setShowMore] = useState(false);
...@@ -54,7 +57,7 @@ const AddressFormItem: React.FC<AddressFormItemProps> & { isFieldComponent: bool ...@@ -54,7 +57,7 @@ const AddressFormItem: React.FC<AddressFormItemProps> & { isFieldComponent: bool
}; };
const handleSelectItem = record => { const handleSelectItem = record => {
if (onChange) { if (onChange && !disabled) {
onChange(record); onChange(record);
} }
}; };
...@@ -65,7 +68,8 @@ const AddressFormItem: React.FC<AddressFormItemProps> & { isFieldComponent: bool ...@@ -65,7 +68,8 @@ const AddressFormItem: React.FC<AddressFormItemProps> & { isFieldComponent: bool
{showDataSource.map(item => ( {showDataSource.map(item => (
<li <li
className={classNames(styles['addressList-item'], { className={classNames(styles['addressList-item'], {
[styles.active]: item.id === (value && value.id), [styles.active]: item.id === (value && value.id),
[styles.disabled]: disabled,
})} })}
onClick={() => handleSelectItem(item)} onClick={() => handleSelectItem(item)}
key={item.id} key={item.id}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-04 15:09:09 * @Date: 2020-11-04 15:09:09
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-17 11:15:26 * @LastEditTime: 2020-11-17 15:22:46
* @Description: 维修商品抽屉组件 * @Description: 维修商品抽屉组件
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
...@@ -70,6 +70,8 @@ export interface OrderListRes { ...@@ -70,6 +70,8 @@ export interface OrderListRes {
interface GoodsDrawerProps { interface GoodsDrawerProps {
// 选中值(子表格的值) // 选中值(子表格的值)
checked: number[]; checked: number[];
// 抽屉标题
title?: string;
// 是否可见的 // 是否可见的
visible: boolean; visible: boolean;
// 关闭事件 // 关闭事件
...@@ -235,7 +237,11 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -235,7 +237,11 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
dataIndex: 'purchaseCount', dataIndex: 'purchaseCount',
align: 'center', align: 'center',
}, },
{
title: '已维修数量',
dataIndex: 'repairCount',
align: 'center',
},
]; ];
// 获取订单列表 // 获取订单列表
...@@ -448,13 +454,14 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -448,13 +454,14 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
loading, loading,
} = this.state; } = this.state;
const { const {
title = '选择维修商品',
visible = false, visible = false,
nestProps = {}, nestProps = {},
} = this.props; } = this.props;
return ( return (
<Drawer <Drawer
title="选择维修商品" title={title}
width={1200} width={1200}
onClose={this.handleClose} onClose={this.handleClose}
afterVisibleChange={this.handleAfterVisibleChange} afterVisibleChange={this.handleAfterVisibleChange}
......
...@@ -36,7 +36,7 @@ export const useBusinessEffects = (context, actions) => { ...@@ -36,7 +36,7 @@ export const useBusinessEffects = (context, actions) => {
getFieldState, getFieldState,
setFieldState, setFieldState,
} = actions; } = actions;
const linkage = useLinkageUtils(); // const linkage = useLinkageUtils();
// 校验维修数量 // 校验维修数量
onFieldInputChange$('repairGoodsList.*.repairCount').subscribe(fieldState => { onFieldInputChange$('repairGoodsList.*.repairCount').subscribe(fieldState => {
......
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import Search from '@/components/NiceForm/components/Search'; import Search from '@/components/NiceForm/components/Search';
import Submit from '@/components/NiceForm/components/Submit'; import Submit from '@/components/NiceForm/components/Submit';
import {
} from '@/constants';
import { PATTERN_MAPS } from '@/constants/regExp'; import { PATTERN_MAPS } from '@/constants/regExp';
import { UPLOAD_TYPE } from '@/constants'; import { UPLOAD_TYPE } from '@/constants';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-06 16:30:44 * @Date: 2020-11-06 16:30:44
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-09 10:28:17 * @LastEditTime: 2020-11-17 17:20:43
* @Description: 待新增退货发货单 * @Description: 待新增退货发货单
*/ */
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
...@@ -87,12 +87,12 @@ const ReturnPrAddDeliver: React.FC = () => { ...@@ -87,12 +87,12 @@ const ReturnPrAddDeliver: React.FC = () => {
}, },
{ {
title: '退货批次', title: '退货批次',
dataIndex: 'batch', dataIndex: 'returnBatch',
align: 'center', align: 'center',
}, },
{ {
title: '退货发货单号', title: '退货发货单号',
dataIndex: 'deliverNo', dataIndex: 'returnDeliveryNo',
align: 'center', align: 'center',
render: text => <a>{text}</a>, render: text => <a>{text}</a>,
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-06 16:30:44 * @Date: 2020-11-06 16:30:44
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-11 09:53:54 * @LastEditTime: 2020-11-17 17:22:07
* @Description: 待新增退货发货单 * @Description: 待新增退货发货单
*/ */
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
...@@ -73,12 +73,12 @@ const ReturnPrAddLogistics: React.FC = () => { ...@@ -73,12 +73,12 @@ const ReturnPrAddLogistics: React.FC = () => {
}, },
{ {
title: '退货批次', title: '退货批次',
dataIndex: 'batch', dataIndex: 'returnBatch',
align: 'center', align: 'center',
}, },
{ {
title: '退货发货单号', title: '退货发货单号',
dataIndex: 'deliverNo', dataIndex: 'returnDeliveryNo',
align: 'center', align: 'center',
render: text => <a>{text}</a>, render: text => <a>{text}</a>,
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-06 16:30:44 * @Date: 2020-11-06 16:30:44
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-11 10:21:46 * @LastEditTime: 2020-11-17 17:24:12
* @Description: 待新增退货发货单 * @Description: 待新增退货发货单
*/ */
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
...@@ -76,12 +76,12 @@ const ReturnPrConfirmBack: React.FC = () => { ...@@ -76,12 +76,12 @@ const ReturnPrConfirmBack: React.FC = () => {
}, },
{ {
title: '退货批次', title: '退货批次',
dataIndex: 'batch', dataIndex: 'returnBatch',
align: 'center', align: 'center',
}, },
{ {
title: '退货发货单号', title: '退货发货单号',
dataIndex: 'deliverNo', dataIndex: 'returnDeliveryNo',
align: 'center', align: 'center',
render: text => <a>{text}</a>, render: text => <a>{text}</a>,
}, },
......
...@@ -16,7 +16,7 @@ const ReturnPrConfirmBackVerify: React.FC = () => { ...@@ -16,7 +16,7 @@ const ReturnPrConfirmBackVerify: React.FC = () => {
} }
setSubmitLoading(true); setSubmitLoading(true);
PublicApi.postAsReturnGoodsConfirmAllReturnGoodsReceipt({ PublicApi.postAsReturnGoodsConfirmAllReturnGoodsReceipt({
returnId: id, dataId: id,
}).then(res => { }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
history.goBack(); history.goBack();
......
...@@ -16,7 +16,7 @@ const ReturnPrConfirmResultVerify: React.FC = () => { ...@@ -16,7 +16,7 @@ const ReturnPrConfirmResultVerify: React.FC = () => {
} }
setSubmitLoading(true); setSubmitLoading(true);
PublicApi.postAsReturnGoodsConfirmAllRefund({ PublicApi.postAsReturnGoodsConfirmAllRefund({
returnId: id, dataId: id,
}).then(res => { }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
history.goBack(); history.goBack();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-06 16:30:44 * @Date: 2020-11-06 16:30:44
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-11 10:04:10 * @LastEditTime: 2020-11-17 17:23:01
* @Description: 待新增退货发货单 * @Description: 待新增退货发货单
*/ */
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
...@@ -76,12 +76,12 @@ const ReturnPrDeliver: React.FC = () => { ...@@ -76,12 +76,12 @@ const ReturnPrDeliver: React.FC = () => {
}, },
{ {
title: '退货批次', title: '退货批次',
dataIndex: 'batch', dataIndex: 'returnBatch',
align: 'center', align: 'center',
}, },
{ {
title: '退货发货单号', title: '退货发货单号',
dataIndex: 'deliverNo', dataIndex: 'returnDeliveryNo',
align: 'center', align: 'center',
render: text => <a>{text}</a>, render: text => <a>{text}</a>,
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-03 18:30:47 * @Date: 2020-11-03 18:30:47
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-03 18:50:28 * @LastEditTime: 2020-11-17 16:13:43
* @Description: 联动逻辑相关 * @Description: 联动逻辑相关
*/ */
import { Modal } from 'antd'; import { Modal } from 'antd';
...@@ -39,4 +39,15 @@ export const useBusinessEffects = (context, actions) => { ...@@ -39,4 +39,15 @@ export const useBusinessEffects = (context, actions) => {
} = actions; } = actions;
const linkage = useLinkageUtils(); const linkage = useLinkageUtils();
// 联动配送方式
onFieldValueChange$('deliveryType').subscribe(fieldState => {
const { name, value } = fieldState;
// 如果选中 自提
if (value === 2) {
linkage.show('shippingAddress');
} else {
linkage.hide('shippingAddress');
}
});
} }
\ No newline at end of file
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Button, Card, Spin, message } from 'antd'; import { Button, Card, Spin, Badge, message } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import { DeleteOutlined } from '@ant-design/icons'; import { DeleteOutlined } from '@ant-design/icons';
import { Radio, ArrayTable } from '@formily/antd-components'; import { Radio, ArrayTable } from '@formily/antd-components';
import { history, Prompt } from 'umi'; import { history, Prompt } from 'umi';
...@@ -7,9 +8,11 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout'; ...@@ -7,9 +8,11 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined, PlusOutlined } from '@ant-design/icons'; import { SaveOutlined, PlusOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks } from '@formily/antd'; import { createFormActions, FormEffectHooks } from '@formily/antd';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { PurchaseOrderInsideWorkStateTexts, ORDER_TYPE2 } from '@/constants';
import ReutrnEle from '@/components/ReturnEle'; import ReutrnEle from '@/components/ReturnEle';
import StatusTag from '@/components/StatusTag';
import NiceForm from '@/components/NiceForm'; import NiceForm from '@/components/NiceForm';
import GoodsDrawer from '../GoodsDrawer'; import GoodsDrawer, { OrderListRes } from '../../../../components/GoodsDrawer';
import AddressFormItem from '../../../../components/AddressFormItem'; import AddressFormItem from '../../../../components/AddressFormItem';
import ReturnInfoDrawer from '../../../../components/ReturnInfoDrawer'; import ReturnInfoDrawer from '../../../../components/ReturnInfoDrawer';
import { addBillSchema } from './schema'; import { addBillSchema } from './schema';
...@@ -36,14 +39,129 @@ const RepairForm: React.FC<BillsFormProps> = ({ ...@@ -36,14 +39,129 @@ const RepairForm: React.FC<BillsFormProps> = ({
const [submitLoading, setSubmitLoading] = useState(false); const [submitLoading, setSubmitLoading] = useState(false);
const [visibleGoodsDrawer, setVisibleGoodsDrawer] = useState(false); const [visibleGoodsDrawer, setVisibleGoodsDrawer] = useState(false);
const [visibleReturnInfoDrawer, setVisibleReturnInfoDrawer] = useState(false); const [visibleReturnInfoDrawer, setVisibleReturnInfoDrawer] = useState(false);
const [goodsValue, setGoodsValue] = useState([]);
const tableColumn: ColumnType<any>[] = [
{
title: '订单号',
dataIndex: 'orderNo',
align: 'center',
},
{
title: '订单摘要',
dataIndex: 'orderThe',
align: 'center',
},
{
title: '供应会员',
dataIndex: 'supplyMembersName',
align: 'center',
},
{
title: '下单时间',
dataIndex: 'createTime',
align: 'center',
},
{
title: '订单状态',
dataIndex: 'externalState',
align: 'center',
render: text => PurchaseOrderInsideWorkStateTexts[text],
},
{
title: '订单类型',
dataIndex: 'type',
align: 'center',
render: text => ORDER_TYPE2[text],
},
];
const childTableColumn: ColumnType<any>[] = [
{
title: '商品ID',
dataIndex: 'productId',
align: 'center',
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
},
{
title: '订单数量',
dataIndex: 'purchaseCount',
align: 'center',
},
{
title: '单价',
dataIndex: 'price',
align: 'center',
},
{
title: '金额',
dataIndex: 'price',
align: 'center',
},
{
title: '已退货数量',
dataIndex: 'returnCount',
align: 'center',
},
// 缺
{
title: '已退款金额',
dataIndex: 'returnCount2',
align: 'center',
},
];
// 根据供应会员获取订单列表
const getOrderList = (params): Promise<OrderListRes> => {
const supplierMemberValue = addSchemaAction.getFieldValue('supplierMember');
return new Promise((resolve, reject) => {
PublicApi.getOrderOneBatchOrderList({
...params,
supplyMembersId: supplierMemberValue[0].memberId,
supplyMembersRoleId: supplierMemberValue[0].roleId,
}).then(res => {
if (res.code === 1000) {
resolve(res.data);
}
reject();
}).catch(() => {
reject();
});
});
};
useEffect(() => { useEffect(() => {
}, []); }, []);
// 弹出单据明细 const handleAddGoods = () => {
const handleAdd = () => { const supplierMemberValue = addSchemaAction.getFieldValue('supplierMember');
// do something
if (!supplierMemberValue || !supplierMemberValue.length) {
message.error('请先选择供应会员');
return;
}
setVisibleGoodsDrawer(true);
}; };
const TableAddButton = isEdit || !id ? ( const TableAddButton = isEdit || !id ? (
...@@ -51,7 +169,7 @@ const RepairForm: React.FC<BillsFormProps> = ({ ...@@ -51,7 +169,7 @@ const RepairForm: React.FC<BillsFormProps> = ({
style={{ marginBottom: 16 }} style={{ marginBottom: 16 }}
block block
icon={<PlusOutlined />} icon={<PlusOutlined />}
onClick={() => setVisibleGoodsDrawer(true)} onClick={handleAddGoods}
type="dashed" type="dashed"
> >
选择退货商品 选择退货商品
...@@ -67,18 +185,13 @@ const RepairForm: React.FC<BillsFormProps> = ({ ...@@ -67,18 +185,13 @@ const RepairForm: React.FC<BillsFormProps> = ({
}; };
const handleRemoveItem = (index: number) => { const handleRemoveItem = (index: number) => {
// do something const newGoodsValue = [...goodsValue];
// const newSelectRow = [...productRowCtl.selectRow]; const newValue = [...addSchemaAction.getFieldValue('returnGoodsList')];
// const newSelectedRowKeys = [...productRowCtl.selectedRowKeys];
// const newValue = [...addSchemaAction.getFieldValue('invoicesDetailsRequests')]; const deleted = newValue.splice(index, 1);
addSchemaAction.setFieldValue('returnGoodsList', newValue);
// newSelectRow.splice(index, 1); newGoodsValue.splice(newGoodsValue.findIndex(item => item === deleted[0].id), 1);
// newSelectedRowKeys.splice(index, 1); setGoodsValue(newGoodsValue);
// productRowCtl.setSelectRow(newSelectRow);
// productRowCtl.setSelectedRowKeys(newSelectedRowKeys);
// newValue.splice(index, 1);
// addSchemaAction.setFieldValue('invoicesDetailsRequests', newValue);
}; };
// ArrayTable自定义渲染 // ArrayTable自定义渲染
...@@ -110,6 +223,46 @@ const RepairForm: React.FC<BillsFormProps> = ({ ...@@ -110,6 +223,46 @@ const RepairForm: React.FC<BillsFormProps> = ({
} }
}; };
const handleGoodsConfirm = values => {
const preValues = addSchemaAction.getFieldValue('returnGoodsList');
const value = [];
values.forEach(item => {
const existing = preValues.find(val => val.id === item.id);
const atom =
existing ?
existing :
{
id: item.id,
orderId: item.orderId,
orderNo: item.orderNo,
productId: item.productId,
productName: item.productName,
category: item.category,
brand: item.unitName,
unit: item.costPrice,
purchaseCount: item.purchaseCount,
purchasePrice: 0, // 待补
returnCount: 0, // 待补
returnReason: '',
};
value.push(atom);
});
addSchemaAction.setFieldValue('returnGoodsList', value);
};
const handleGoodsChange = values => {
setGoodsValue(values);
};
const OuterStatus = (
<StatusTag type={'success'} title={'待提交'} />
);
const InnerStatus = (
<Badge color="#C0C4CC" text={'待提交审核'} />
);
return ( return (
<Spin spinning={infoLoading}> <Spin spinning={infoLoading}>
<PageHeaderWrapper <PageHeaderWrapper
...@@ -120,10 +273,10 @@ const RepairForm: React.FC<BillsFormProps> = ({ ...@@ -120,10 +273,10 @@ const RepairForm: React.FC<BillsFormProps> = ({
backIcon={<ReutrnEle description="返回" />} backIcon={<ReutrnEle description="返回" />}
title={ title={
!id ? !id ?
'新建单据' : '新建退货申请单' :
isEdit ? isEdit ?
'编辑单据' : '编辑退货申请单' :
'查看单据' '查看退货申请单'
} }
extra={ extra={
(isEdit || !id) (isEdit || !id)
...@@ -146,6 +299,8 @@ const RepairForm: React.FC<BillsFormProps> = ({ ...@@ -146,6 +299,8 @@ const RepairForm: React.FC<BillsFormProps> = ({
initialValues={{}} initialValues={{}}
expressionScope={{ expressionScope={{
TableAddButton, TableAddButton,
OuterStatus,
InnerStatus,
renderListTableRemove, renderListTableRemove,
beforeUpload, beforeUpload,
}} }}
...@@ -169,8 +324,16 @@ const RepairForm: React.FC<BillsFormProps> = ({ ...@@ -169,8 +324,16 @@ const RepairForm: React.FC<BillsFormProps> = ({
</Card> </Card>
<GoodsDrawer <GoodsDrawer
title="选择退货商品"
visible={visibleGoodsDrawer} visible={visibleGoodsDrawer}
fetchOrderList={getOrderList}
onClose={() => setVisibleGoodsDrawer(false)} onClose={() => setVisibleGoodsDrawer(false)}
onConfirm={handleGoodsConfirm}
checked={goodsValue}
onChange={handleGoodsChange}
nestProps={{
NestColumns: [tableColumn, childTableColumn],
}}
/> />
<ReturnInfoDrawer <ReturnInfoDrawer
......
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