Commit dfe30212 authored by XieZhiXiong's avatar XieZhiXiong

对接售后退货中...

parent e7173bb3
......@@ -32,6 +32,10 @@
z-index: 5;
}
}
&.disabled {
cursor: not-allowed;
}
}
}
......
......@@ -27,6 +27,8 @@ interface AddressFormItemProps {
// 默认展示的条数
showCount?: number;
onChange: (id: string) => {};
// 禁用的
disabled?: boolean;
};
const AddressFormItem: React.FC<AddressFormItemProps> & { isFieldComponent: boolean } = ({
......@@ -34,6 +36,7 @@ const AddressFormItem: React.FC<AddressFormItemProps> & { isFieldComponent: bool
showCount = 3,
dataSource = [],
onChange,
disabled = false,
}) => {
const [showMore, setShowMore] = useState(false);
......@@ -54,7 +57,7 @@ const AddressFormItem: React.FC<AddressFormItemProps> & { isFieldComponent: bool
};
const handleSelectItem = record => {
if (onChange) {
if (onChange && !disabled) {
onChange(record);
}
};
......@@ -65,7 +68,8 @@ const AddressFormItem: React.FC<AddressFormItemProps> & { isFieldComponent: bool
{showDataSource.map(item => (
<li
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)}
key={item.id}
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-04 15:09:09
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-17 11:15:26
* @LastEditTime: 2020-11-17 15:22:46
* @Description: 维修商品抽屉组件
*/
import React, { useState, useEffect } from 'react';
......@@ -70,6 +70,8 @@ export interface OrderListRes {
interface GoodsDrawerProps {
// 选中值(子表格的值)
checked: number[];
// 抽屉标题
title?: string;
// 是否可见的
visible: boolean;
// 关闭事件
......@@ -235,7 +237,11 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
dataIndex: 'purchaseCount',
align: 'center',
},
{
title: '已维修数量',
dataIndex: 'repairCount',
align: 'center',
},
];
// 获取订单列表
......@@ -448,13 +454,14 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
loading,
} = this.state;
const {
title = '选择维修商品',
visible = false,
nestProps = {},
} = this.props;
return (
<Drawer
title="选择维修商品"
title={title}
width={1200}
onClose={this.handleClose}
afterVisibleChange={this.handleAfterVisibleChange}
......
......@@ -36,7 +36,7 @@ export const useBusinessEffects = (context, actions) => {
getFieldState,
setFieldState,
} = actions;
const linkage = useLinkageUtils();
// const linkage = useLinkageUtils();
// 校验维修数量
onFieldInputChange$('repairGoodsList.*.repairCount').subscribe(fieldState => {
......
import { ISchema } from '@formily/antd';
import Search from '@/components/NiceForm/components/Search';
import Submit from '@/components/NiceForm/components/Submit';
import {
} from '@/constants';
import { PATTERN_MAPS } from '@/constants/regExp';
import { UPLOAD_TYPE } from '@/constants';
import { PublicApi } from '@/services/api';
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 16:30:44
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-09 10:28:17
* @LastEditTime: 2020-11-17 17:20:43
* @Description: 待新增退货发货单
*/
import React, { useState, useRef } from 'react';
......@@ -87,12 +87,12 @@ const ReturnPrAddDeliver: React.FC = () => {
},
{
title: '退货批次',
dataIndex: 'batch',
dataIndex: 'returnBatch',
align: 'center',
},
{
title: '退货发货单号',
dataIndex: 'deliverNo',
dataIndex: 'returnDeliveryNo',
align: 'center',
render: text => <a>{text}</a>,
},
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 16:30:44
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-11 09:53:54
* @LastEditTime: 2020-11-17 17:22:07
* @Description: 待新增退货发货单
*/
import React, { useState, useRef } from 'react';
......@@ -73,12 +73,12 @@ const ReturnPrAddLogistics: React.FC = () => {
},
{
title: '退货批次',
dataIndex: 'batch',
dataIndex: 'returnBatch',
align: 'center',
},
{
title: '退货发货单号',
dataIndex: 'deliverNo',
dataIndex: 'returnDeliveryNo',
align: 'center',
render: text => <a>{text}</a>,
},
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 16:30:44
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-11 10:21:46
* @LastEditTime: 2020-11-17 17:24:12
* @Description: 待新增退货发货单
*/
import React, { useState, useRef } from 'react';
......@@ -76,12 +76,12 @@ const ReturnPrConfirmBack: React.FC = () => {
},
{
title: '退货批次',
dataIndex: 'batch',
dataIndex: 'returnBatch',
align: 'center',
},
{
title: '退货发货单号',
dataIndex: 'deliverNo',
dataIndex: 'returnDeliveryNo',
align: 'center',
render: text => <a>{text}</a>,
},
......
......@@ -16,7 +16,7 @@ const ReturnPrConfirmBackVerify: React.FC = () => {
}
setSubmitLoading(true);
PublicApi.postAsReturnGoodsConfirmAllReturnGoodsReceipt({
returnId: id,
dataId: id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
......
......@@ -16,7 +16,7 @@ const ReturnPrConfirmResultVerify: React.FC = () => {
}
setSubmitLoading(true);
PublicApi.postAsReturnGoodsConfirmAllRefund({
returnId: id,
dataId: id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 16:30:44
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-11 10:04:10
* @LastEditTime: 2020-11-17 17:23:01
* @Description: 待新增退货发货单
*/
import React, { useState, useRef } from 'react';
......@@ -76,12 +76,12 @@ const ReturnPrDeliver: React.FC = () => {
},
{
title: '退货批次',
dataIndex: 'batch',
dataIndex: 'returnBatch',
align: 'center',
},
{
title: '退货发货单号',
dataIndex: 'deliverNo',
dataIndex: 'returnDeliveryNo',
align: 'center',
render: text => <a>{text}</a>,
},
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-03 18:30:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-03 18:50:28
* @LastEditTime: 2020-11-17 16:13:43
* @Description: 联动逻辑相关
*/
import { Modal } from 'antd';
......@@ -39,4 +39,15 @@ export const useBusinessEffects = (context, actions) => {
} = actions;
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 { 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 { Radio, ArrayTable } from '@formily/antd-components';
import { history, Prompt } from 'umi';
......@@ -7,9 +8,11 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined, PlusOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { PublicApi } from '@/services/api';
import { PurchaseOrderInsideWorkStateTexts, ORDER_TYPE2 } from '@/constants';
import ReutrnEle from '@/components/ReturnEle';
import StatusTag from '@/components/StatusTag';
import NiceForm from '@/components/NiceForm';
import GoodsDrawer from '../GoodsDrawer';
import GoodsDrawer, { OrderListRes } from '../../../../components/GoodsDrawer';
import AddressFormItem from '../../../../components/AddressFormItem';
import ReturnInfoDrawer from '../../../../components/ReturnInfoDrawer';
import { addBillSchema } from './schema';
......@@ -36,14 +39,129 @@ const RepairForm: React.FC<BillsFormProps> = ({
const [submitLoading, setSubmitLoading] = useState(false);
const [visibleGoodsDrawer, setVisibleGoodsDrawer] = 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(() => {
}, []);
// 弹出单据明细
const handleAdd = () => {
// do something
const handleAddGoods = () => {
const supplierMemberValue = addSchemaAction.getFieldValue('supplierMember');
if (!supplierMemberValue || !supplierMemberValue.length) {
message.error('请先选择供应会员');
return;
}
setVisibleGoodsDrawer(true);
};
const TableAddButton = isEdit || !id ? (
......@@ -51,7 +169,7 @@ const RepairForm: React.FC<BillsFormProps> = ({
style={{ marginBottom: 16 }}
block
icon={<PlusOutlined />}
onClick={() => setVisibleGoodsDrawer(true)}
onClick={handleAddGoods}
type="dashed"
>
选择退货商品
......@@ -67,18 +185,13 @@ const RepairForm: React.FC<BillsFormProps> = ({
};
const handleRemoveItem = (index: number) => {
// do something
// const newSelectRow = [...productRowCtl.selectRow];
// const newSelectedRowKeys = [...productRowCtl.selectedRowKeys];
// const newValue = [...addSchemaAction.getFieldValue('invoicesDetailsRequests')];
// newSelectRow.splice(index, 1);
// newSelectedRowKeys.splice(index, 1);
// productRowCtl.setSelectRow(newSelectRow);
// productRowCtl.setSelectedRowKeys(newSelectedRowKeys);
// newValue.splice(index, 1);
// addSchemaAction.setFieldValue('invoicesDetailsRequests', newValue);
const newGoodsValue = [...goodsValue];
const newValue = [...addSchemaAction.getFieldValue('returnGoodsList')];
const deleted = newValue.splice(index, 1);
addSchemaAction.setFieldValue('returnGoodsList', newValue);
newGoodsValue.splice(newGoodsValue.findIndex(item => item === deleted[0].id), 1);
setGoodsValue(newGoodsValue);
};
// ArrayTable自定义渲染
......@@ -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 (
<Spin spinning={infoLoading}>
<PageHeaderWrapper
......@@ -120,10 +273,10 @@ const RepairForm: React.FC<BillsFormProps> = ({
backIcon={<ReutrnEle description="返回" />}
title={
!id ?
'新建单据' :
'新建退货申请单' :
isEdit ?
'编辑单据' :
'查看单据'
'编辑退货申请单' :
'查看退货申请单'
}
extra={
(isEdit || !id)
......@@ -146,6 +299,8 @@ const RepairForm: React.FC<BillsFormProps> = ({
initialValues={{}}
expressionScope={{
TableAddButton,
OuterStatus,
InnerStatus,
renderListTableRemove,
beforeUpload,
}}
......@@ -169,8 +324,16 @@ const RepairForm: React.FC<BillsFormProps> = ({
</Card>
<GoodsDrawer
title="选择退货商品"
visible={visibleGoodsDrawer}
fetchOrderList={getOrderList}
onClose={() => setVisibleGoodsDrawer(false)}
onConfirm={handleGoodsConfirm}
checked={goodsValue}
onChange={handleGoodsChange}
nestProps={{
NestColumns: [tableColumn, childTableColumn],
}}
/>
<ReturnInfoDrawer
......
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import Search from '@/components/NiceForm/components/Search';
import Submit from '@/components/NiceForm/components/Submit';
import DateSelect from '@/components/NiceForm/components/DateSelect';
import {
} from '@/constants';
import { PATTERN_MAPS } from '@/constants/regExp';
import { UPLOAD_TYPE } from '@/constants';
import { UPLOAD_TYPE, DELIVERY_TYPE_ENUM } from '@/constants';
import { PublicApi } from '@/services/api';
// 供应会员列表列
const supplierColumns = [
......@@ -19,55 +14,35 @@ const supplierColumns = [
},
{
title: '会员名称',
dataIndex: 'memberName',
dataIndex: 'name',
align: 'center',
},
{
title: '会员类型',
dataIndex: 'memberType',
dataIndex: 'memberTypeName',
align: 'center',
},
{
title: '会员角色',
dataIndex: 'memberRole',
dataIndex: 'roleName',
align: 'center',
},
{
title: '会员等级',
dataIndex: 'memberLevel',
dataIndex: 'levelTag',
align: 'center',
},
];
// 获取供应会员
const getSupplier = () => {
return Promise.resolve({
data: [
{
memberId: 1,
memberName: '会员1',
memberType: '企业会员',
memberRole: '青铜会员',
memberLevel: '会员等级',
},
{
memberId: 2,
memberName: '会员2',
memberType: '企业会员',
memberRole: '青铜会员',
memberLevel: '会员等级',
},
{
memberId: 3,
memberName: '会员3',
memberType: '企业会员',
memberRole: '青铜会员',
memberLevel: '会员等级',
},
],
total: 20,
});
const getSupplier = async (params) => {
const res = await PublicApi.getMemberManageUpperProviderPage({
...params,
})
if (res.code === 1000) {
return res.data;
}
return { totalCount: 0, data: [] };
};
const supplierSchema: ISchema = {
......@@ -77,7 +52,7 @@ const supplierSchema: ISchema = {
type: 'object',
'x-component': 'Mega-Layout',
properties: {
search: {
name: {
type: 'string',
'x-component': 'Search',
'x-mega-props': {},
......@@ -118,10 +93,15 @@ export const addBillSchema: ISchema = {
labelAlign: 'left',
},
properties: {
invoicesAbstract: {
applyAbstract: {
type: 'string',
title: '申请单摘要',
required: true,
'x-rules': [
{
required: true,
message: '请填写申请单摘要',
},
],
},
// 这是用 Mega-Layout 设置独立作用域,不然会被 Form 的布局影响到弹窗的布局
MEGA_LAYOUT1_1: {
......@@ -131,7 +111,7 @@ export const addBillSchema: ISchema = {
wrapperCol: 24,
},
properties: {
supplier: {
supplierMember: {
type: 'string',
title: '供应会员',
'x-component': 'CustomRelevance',
......@@ -139,7 +119,7 @@ export const addBillSchema: ISchema = {
title: '关联',
tip: '请选择对应单据',
modalProps: {
title: '标题',
title: '选择会员',
},
columns: supplierColumns,
fetchTableData: getSupplier,
......@@ -149,22 +129,16 @@ export const addBillSchema: ISchema = {
components: {
Search,
Submit,
DateSelect,
},
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'search',
FORM_FILTER_PATH,
);
},
inline: false,
}
},
tableProps: {
rowKey: 'memberId',
lableKey: 'memberName',
lableKey: 'name',
},
},
'x-mega-props': {
......@@ -183,8 +157,8 @@ export const addBillSchema: ISchema = {
type: 'string',
title: '申请单号',
'x-component': 'Text',
},
createdTime: {
},
applyTime: {
type: 'string',
title: '单据时间',
'x-component': 'Text',
......@@ -192,12 +166,18 @@ export const addBillSchema: ISchema = {
outerStatus: {
type: 'string',
title: '外部状态',
'x-component': 'Text',
'x-component': 'Children',
'x-component-props': {
children: '{{OuterStatus}}'
},
},
innerStatus: {
type: 'string',
title: '内部状态',
'x-component': 'Text',
'x-component': 'Children',
'x-component-props': {
children: '{{InnerStatus}}'
},
},
},
},
......@@ -225,7 +205,7 @@ export const addBillSchema: ISchema = {
children: '{{TableAddButton}}'
},
},
invoicesDetailsRequests: {
returnGoodsList: {
type: 'array',
'x-component': 'ArrayTable',
'x-component-props': {
......@@ -233,29 +213,29 @@ export const addBillSchema: ISchema = {
renderRemove: '{{renderListTableRemove}}',
operationsWidth: 100,
operations: {
title: '操作',
align: 'center',
},
},
},
default: [
'x-rules': [
{
itemNo: '123',
},
required: true,
message: '请选择维修商品',
},
],
items: {
type: 'object',
properties: {
itemNo: {
orderNo: {
type: 'string',
title: '订单号',
'x-component': 'Text',
},
itemNmae: {
productId: {
type: 'string',
title: 'ID',
title: '商品ID',
'x-component': 'Text',
},
specifications: {
productName: {
type: 'string',
title: '商品名称',
'x-component': 'Text',
......@@ -275,12 +255,12 @@ export const addBillSchema: ISchema = {
title: '单位',
'x-component': 'Text',
},
costPrice: {
purchaseCount: {
type: 'string',
title: '采购数量',
'x-component': 'Text',
},
costPrice2: {
purchasePrice: {
type: 'string',
title: '采购单价',
'x-component': 'Text',
......@@ -295,7 +275,7 @@ export const addBillSchema: ISchema = {
title: '已支付金额',
'x-component': 'Text',
},
costPrice5: {
returnCount: {
type: 'string',
title: '退货数量',
'x-component': 'Text',
......@@ -305,6 +285,21 @@ export const addBillSchema: ISchema = {
title: '退款金额',
'x-component': 'Text',
},
// 退货理由,不用于展示,只用于收集值
returnReason: {
type: 'string',
display: false,
},
// 不用于展示,只用于收集值
id: {
type: 'string',
display: false,
},
// 不用于展示,只用于收集值
orderId: {
type: 'string',
display: false,
},
},
}
},
......@@ -327,7 +322,7 @@ export const addBillSchema: ISchema = {
labelAlign: 'left',
},
properties: {
enclosure: {
proofFileList: {
title: '附件',
'x-component': 'Upload',
'x-component-props': {
......@@ -355,7 +350,7 @@ export const addBillSchema: ISchema = {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '维修地址',
tab: '退货收货地址',
},
properties: {
MEGA_LAYOUT3: {
......@@ -367,26 +362,15 @@ export const addBillSchema: ISchema = {
labelAlign: 'left',
},
properties: {
mode: {
deliveryType: {
title: '配送方式',
type: 'string',
enum: [
{
label: '物流',
value: '1',
},
{
label: '自提',
value: '2',
},
{
label: '无需配送',
value: '3',
},
],
default: 1,
enum: DELIVERY_TYPE_ENUM,
},
address: {
title: '维修地址',
// 退货收货地址
shippingAddress: {
title: '退货收货地址',
type: 'string',
'x-component': 'AddressFormItem',
'x-component-props': {
......@@ -397,23 +381,21 @@ export const addBillSchema: ISchema = {
phone: '18128131762',
fullAddress: '不告诉你1',
},
],
},
},
// 退货发货地址
deliveryAddress: {
title: '退货发货地址',
type: 'string',
'x-component': 'AddressFormItem',
'x-component-props': {
dataSource: [
{
id: 2,
receiverName: '收件人2',
phone: '18128131762',
fullAddress: '不告诉你2',
},
{
id: 3,
receiverName: '收件人2',
phone: '18128131762',
fullAddress: '不告诉你2',
},
{
id: 4,
receiverName: '收件人2',
id: 1,
receiverName: '收件人1',
phone: '18128131762',
fullAddress: '不告诉你2',
fullAddress: '不告诉你1',
},
],
},
......
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