Commit 1544d920 authored by XieZhiXiong's avatar XieZhiXiong

feat: 完成普通订单售后退货简单流程

parent 9aaef04b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-08-05 14:54:18 * @Date: 2021-08-05 14:54:18
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-06 10:41:38 * @LastEditTime: 2021-08-07 16:36:14
* @Description: * @Description:
*/ */
import React from 'react'; import React from 'react';
...@@ -16,6 +16,7 @@ const AddressRadioGroupFormilyItem = connect()((props) => { ...@@ -16,6 +16,7 @@ const AddressRadioGroupFormilyItem = connect()((props) => {
onChange, onChange,
addressType, addressType,
isDefault, isDefault,
disabled,
...rest ...rest
} = props; } = props;
return ( return (
...@@ -23,6 +24,7 @@ const AddressRadioGroupFormilyItem = connect()((props) => { ...@@ -23,6 +24,7 @@ const AddressRadioGroupFormilyItem = connect()((props) => {
<AddressRadioGroup <AddressRadioGroup
addressType={addressType} addressType={addressType}
isDefault={isDefault} isDefault={isDefault}
disabled={disabled}
value={value} value={value}
onChange={onChange} onChange={onChange}
{...rest} {...rest}
......
...@@ -45,6 +45,10 @@ interface IProps { ...@@ -45,6 +45,10 @@ interface IProps {
* 是否默认选择 默认地址,是的话会触发 onChange value为默认地址,默认为false * 是否默认选择 默认地址,是的话会触发 onChange value为默认地址,默认为false
*/ */
isDefaultAddress?: boolean, isDefaultAddress?: boolean,
/**
* 是否禁用
*/
disabled: boolean,
} }
export type SubmitValuesType = { export type SubmitValuesType = {
...@@ -100,6 +104,7 @@ const AddressSelect: React.FC<IProps> = (props) => { ...@@ -100,6 +104,7 @@ const AddressSelect: React.FC<IProps> = (props) => {
value, value,
onChange, onChange,
isDefaultAddress = false, isDefaultAddress = false,
disabled = false,
} = props; } = props;
const [list, setList] = useState<AddressValueType[]>([]); const [list, setList] = useState<AddressValueType[]>([]);
const [internalValue, setInternalValue] = useState<AddressValueType>(); const [internalValue, setInternalValue] = useState<AddressValueType>();
...@@ -295,10 +300,12 @@ const AddressSelect: React.FC<IProps> = (props) => { ...@@ -295,10 +300,12 @@ const AddressSelect: React.FC<IProps> = (props) => {
options={options} options={options}
value={value?.id} value={value?.id}
onChange={handleSelectChange} onChange={handleSelectChange}
disabled={disabled}
/> />
<Button <Button
onClick={() => handleVisibleDrawer(true)} onClick={() => handleVisibleDrawer(true)}
className={styles['address-select-action']} className={styles['address-select-action']}
disabled={disabled}
> >
管理 管理
</Button> </Button>
......
/*
* @Author: XieZhiXiong
* @Date: 2021-08-06 18:37:01
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-06 18:37:02
* @Description: 公共columns
*/
...@@ -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: 2021-07-26 13:52:41 * @LastEditTime: 2021-08-07 14:51:11
* @Description: 维修商品抽屉组件 * @Description: 维修商品抽屉组件
*/ */
import React from 'react'; import React from 'react';
...@@ -75,9 +75,9 @@ interface GoodsDrawerProps { ...@@ -75,9 +75,9 @@ interface GoodsDrawerProps {
*/ */
searchable?: boolean; searchable?: boolean;
/** /**
* 流程类型:1.订单交易流程 2.售后换货流程 3.售后退货流程 4.售后维修流程 * 流程类型:2.售后换货流程 3.售后退货流程 4.售后维修流程
*/ */
afterType: 1 | 2 | 3 | 4; afterType: 2 | 3 | 4;
/** /**
* 订单类型 * 订单类型
*/ */
...@@ -98,7 +98,6 @@ interface GoodsDrawerState { ...@@ -98,7 +98,6 @@ interface GoodsDrawerState {
selectedRowKeys: number[]; selectedRowKeys: number[];
childSelectedRowKeys: number[]; childSelectedRowKeys: number[];
loading: boolean; loading: boolean;
currentProcessEnum: number;
}; };
// 跟 选中的子节点 找到 父级选中的 keys // 跟 选中的子节点 找到 父级选中的 keys
...@@ -115,8 +114,8 @@ function transformParentKeys(data: any[], childCheckedKeys: string[]) { ...@@ -115,8 +114,8 @@ function transformParentKeys(data: any[], childCheckedKeys: string[]) {
}; };
// 这里循环遍历 判断 选中的子表格的keys中 是否包含 当前子项,如果有先 push 到父节点的 checkeds // 这里循环遍历 判断 选中的子表格的keys中 是否包含 当前子项,如果有先 push 到父节点的 checkeds
if (item.productDateilss && item.productDateilss.length) { if (item.products && item.products.length) {
item.productDateilss.forEach(childItem => { item.products.forEach(childItem => {
if (childCheckedKeys.find(key => key === childItem.id)) { if (childCheckedKeys.find(key => key === childItem.id)) {
atom.checkeds.push(childItem.id); atom.checkeds.push(childItem.id);
} }
...@@ -124,7 +123,7 @@ function transformParentKeys(data: any[], childCheckedKeys: string[]) { ...@@ -124,7 +123,7 @@ function transformParentKeys(data: any[], childCheckedKeys: string[]) {
} }
// 判断两者长度 一样 就表示父节点时候选中的 // 判断两者长度 一样 就表示父节点时候选中的
if (atom.checkeds.length === (atom.productDateilss && atom.productDateilss.length)) { if (atom.checkeds.length === (atom.products && atom.products.length)) {
ret.push(atom.id); ret.push(atom.id);
} }
}); });
...@@ -159,7 +158,6 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -159,7 +158,6 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
selectedRowKeys: [], selectedRowKeys: [],
childSelectedRowKeys: [], childSelectedRowKeys: [],
loading: false, loading: false,
currentProcessEnum: 0,
}; };
}; };
...@@ -170,11 +168,11 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -170,11 +168,11 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
const { page, size, searchVal } = this.state; const { page, size, searchVal } = this.state;
const { fetchOrderList, afterType, orderType } = this.props; const { fetchOrderList, afterType, orderType } = this.props;
const isMateriel = ( // const isMateriel = (
orderType === ORDER_TYPE_INQUIRY_CONTRACT // orderType === ORDER_TYPE_INQUIRY_CONTRACT
|| orderType === ORDER_TYPE_BIDDING_CONTRACT // || orderType === ORDER_TYPE_BIDDING_CONTRACT
|| orderType === ORDER_TYPE_TENDER_CONTRACT // || orderType === ORDER_TYPE_TENDER_CONTRACT
); // );
if (!fetchOrderList) { if (!fetchOrderList) {
return; return;
...@@ -187,103 +185,38 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -187,103 +185,38 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
...searchVal, ...searchVal,
}); });
if (orderListRes) { if (orderListRes) {
let processEnumRes = { data: [], code: 0 }; const { data, ...rest } = orderListRes;
const newData: { [key: string]: any }[] = data.map((item) => ({
// 售后退货、换货才涉及售后工作流相关 ...item,
// 这里分两种状况,一种是普通的订单、而是合同订单 products: item.products.map(({ productId, ...rest }) => ({
// 普通订单根据订单商品,请求商品的售后流程枚举组装数据 id: productId,
// 合同订单根据订单的合同id,请求合同的售后流程枚举组装数据 ...rest,
if (afterType === 2 || afterType === 3) { quantity: +rest.quantity,
// 获取对应订单列表的售后工作流类型 purchasePrice: +rest.purchasePrice,
const payload = []; taxRate: +!!rest.taxRate,
taxInclusive: rest.taxInclusive || +!!rest.taxRate,
orderListRes.data.forEach(item => {
if (!isMateriel && item.productDateilss) {
item.productDateilss.forEach(product => {
const atom = {
productId: product.productId,
memberId: product.memberId,
memberRoleId: product.memberRoleId,
shopId: item.shopId,
type: afterType, // 流程类型
};
payload.push(atom);
});
}
if (isMateriel) {
const atom = {
contractId: item.contractId,
memberId: item.memberId,
memberRoleId: item.memberRoleId,
type: afterType, // 流程类型
};
payload.push(atom);
}
});
if (!payload.length) {
this.setState({
dataSource: orderListRes,
loading: false,
});
return;
}
processEnumRes = (
!isMateriel
? await PublicApi.postOrderGetProcessEnum({
list: payload,
}, {
ctlType: 'none',
})
: await PublicApi.postManageRuleGetProcessEnums({
processEnumRequests: payload,
}, {
ctlType: 'none',
})
);
if (processEnumRes.code !== 1000) {
this.setState({
loading: false,
});
return;
}
}
// const mockMap = {
// 1: 18,
// 2: 25,
// };
// 组装数据
let i = 0;
orderListRes.data.forEach((item, j) => {
if (item.productDateilss) {
item.productDateilss.forEach(product => {
if (!isMateriel) {
product.processEnum = processEnumRes.data[i] ? processEnumRes.data[i].processEnum : undefined;
} else {
product.processEnum = processEnumRes.data[j] ? processEnumRes.data[j].processEnum : undefined;
}
// product.processEnum = mockMap[Math.floor(Math.random()*2 + 1)];
i++;
// 防止重复添加数据
if (!this.flattened.find(flat => flat.id === product.id)) {
this.flattened.push({
...product,
orderNo: item.orderNo, orderNo: item.orderNo,
orderId: item.orderId,
payInfoList: item.payInfoList, payInfoList: item.payInfoList,
orderType: item.type, orderType: item.orderType,
contractId: item.contractId, contractId: item.contractId,
contractNo: item.contractNo, contractNo: item.contractNo,
}); })),
}));
newData.forEach((item) => {
item.products.forEach((product) => {
// 防止重复添加数据
if (!this.flattened.find(flat => flat.id === product.id)) {
this.flattened.push(product);
} }
}); });
}
}); });
this.setState({ this.setState({
dataSource: orderListRes, dataSource: {
data: newData,
...rest,
},
}); });
} }
this.setState({ loading: false }); this.setState({ loading: false });
...@@ -389,7 +322,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -389,7 +322,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
} = this.state; } = this.state;
let childArr: any = [...childSelectedRowKeys]; let childArr: any = [...childSelectedRowKeys];
// setChildArr:选择父Table下的所有子选项 // setChildArr:选择父Table下的所有子选项
let setChildArr = data.find((d: any) => d.id === record.id).productDateilss.map((item: any) => item.id); let setChildArr = data.find((d: any) => d.id === record.id).products.map((item: any) => item.id);
// 第一步 判断selected true:选中,false,取消选中 // 第一步 判断selected true:选中,false,取消选中
if (selected) { if (selected) {
// 第二步,父Table选中,子Table全选中(全部整合到一起,然后去重) // 第二步,父Table选中,子Table全选中(全部整合到一起,然后去重)
...@@ -421,7 +354,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -421,7 +354,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
let setChildArr: any = []; let setChildArr: any = [];
  // 将改变的父Table下的子Table下的 id 都添加到setChildArr中   // 将改变的父Table下的子Table下的 id 都添加到setChildArr中
data.forEach((item: any) => { data.forEach((item: any) => {
setChildArr = [...setChildArr, ...(item.productDateilss || []).map((item: any) => item.id)]; setChildArr = [...setChildArr, ...(item.products || []).map((item: any) => item.id)];
}); });
// 第一步判断 selected true:全选,false:取消全选 // 第一步判断 selected true:全选,false:取消全选
...@@ -494,8 +427,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -494,8 +427,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
? product.payInfoList.reduce((prev, now) => { ? product.payInfoList.reduce((prev, now) => {
return now.externalState === PayOutWorkState.CONFIRM_ACCOUNT ? +(new BigNumber(+product.purchaseCount).multipliedBy(product.price).multipliedBy(new BigNumber(now.payRatio).dividedBy(100))).toFixed(2) + prev : prev; return now.externalState === PayOutWorkState.CONFIRM_ACCOUNT ? +(new BigNumber(+product.purchaseCount).multipliedBy(product.price).multipliedBy(new BigNumber(now.payRatio).dividedBy(100))).toFixed(2) + prev : prev;
}, 0) }, 0)
: 0, : product.amount,
taxInclusive: product.taxInclusive || +!!product.taxRate,
}); });
} }
}); });
...@@ -616,8 +548,8 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> { ...@@ -616,8 +548,8 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
NestColumns={[]} NestColumns={[]}
className="common_tb" className="common_tb"
rowClassName={(_, index) => (index % 2) === 0 && 'tb_bg'} rowClassName={(_, index) => (index % 2) === 0 && 'tb_bg'}
rowKey="id" rowKey="orderId"
childrenDataKey="productDateilss" childrenDataKey="products"
dataSource={dataSource.data} dataSource={dataSource.data}
loading={loading} loading={loading}
childRowSelection={{ childRowSelection={{
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-09-29 10:03:06 * @Date: 2020-09-29 10:03:06
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-11 10:58:36 * @LastEditTime: 2021-08-06 15:36:30
* @Description: * @Description:
*/ */
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
...@@ -45,14 +45,14 @@ export const listSearchSchema: ISchema = { ...@@ -45,14 +45,14 @@ export const listSearchSchema: ISchema = {
columns: 6, columns: 6,
}, },
properties: { properties: {
orderThe: { digest: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
placeholder: '订单摘要', placeholder: '订单摘要',
allowClear: true, allowClear: true,
}, },
}, },
'[startCreateTime, endCreateTime]': { '[startDate, endDate]': {
type: 'string', type: 'string',
default: '', default: '',
'x-component': 'dateSelect', 'x-component': 'dateSelect',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34 * @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-02-20 17:10:14 * @LastEditTime: 2021-08-07 19:36:18
* @Description: * @Description:
*/ */
import React, { useState } from 'react'; import React, { useState } from 'react';
...@@ -64,10 +64,10 @@ const ExchangePrReceivedVerify: React.FC = () => { ...@@ -64,10 +64,10 @@ const ExchangePrReceivedVerify: React.FC = () => {
<ManualDeliveryModal <ManualDeliveryModal
key="2" key="2"
value={{ value={{
deliveryAddressTxt: manualReturnGoodsAddress.deliveryAddress, deliveryAddressTxt: manualReturnGoodsAddress?.deliveryAddress,
deliveryTime: manualReturnGoodsAddress.deliveryTime, deliveryTime: manualReturnGoodsAddress?.deliveryTime,
logisticsOrderNo: manualReturnGoodsAddress.logisticsOrderNo, logisticsOrderNo: manualReturnGoodsAddress?.logisticsOrderNo,
logisticsNameTxt: manualReturnGoodsAddress.logisticsName, logisticsNameTxt: manualReturnGoodsAddress?.logisticsName,
}} }}
visible={modalVisible} visible={modalVisible}
confirmLoading={submitLoading} confirmLoading={submitLoading}
......
/*
* @Author: XieZhiXiong
* @Date: 2021-08-07 15:11:54
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-07 20:14:24
* @Description: 退货发货处理抽屉
*/
import React from 'react';
import {
Drawer,
Button,
} from 'antd';
import {
createAsyncFormActions,
FormEffectHooks,
} from '@formily/antd';
import { ArrayTable } from '@formily/antd-components';
import { PublicApi } from '@/services/api';
import {
GetAsReturnGoodsPageReturnedGoodsResponseDetail,
} from '@/services/AfterServiceV2Api';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import NiceForm from '@/components/NiceForm';
import { AddressValueType } from '@/components/AddressSelect/components/AddressRadioGroup';
import { schema } from './schema';
const formActions = createAsyncFormActions();
const {
onFieldValueChange$,
onFieldInputChange$,
} = FormEffectHooks;
export type ValuesType = {
/**
* 发货时间
*/
deliveryTime: string,
/**
* 物流公司
*/
logisticsName: number,
/**
* 物流公司名称
*/
logisticsNameTxt: string,
/**
* 物流单号
*/
logisticsOrderNo: string,
/**
* 产品列表
*/
productList: {
/**
* 商品id
*/
productId: string,
/**
* 退货数量
*/
count: string,
/**
* 退货数量
*/
returnCount: string,
/**
* 已发货数量
*/
deliveryCount: string,
}[],
/**
* 退货发货地址
*/
returnDeliverAddress: AddressValueType,
}
interface IProps {
/**
* 是否可见
*/
visible: boolean,
/**
* 值
*/
value: {
/**
* 商品列表
*/
productList: GetAsReturnGoodsPageReturnedGoodsResponseDetail[],
},
/**
* Form 确认事件
*/
onSubmit: (values: ValuesType) => void,
/**
* 抽屉关闭事件
*/
onClose: () => void,
/**
* 确认按钮 loading
*/
submitLoading: boolean,
}
const ReturnDeliverDrawer: React.FC<IProps> = (props) => {
const {
visible,
value,
onSubmit,
onClose,
submitLoading,
} = props;
// 获取物流公司
const fetchLogisticsCompany = (): Promise<any[]> => {
return new Promise((resolve, reject) => {
PublicApi.getLogisticsSelectListCompany({
cooperateType: '2', // 1-平台物流服务商,2-商户合作物流公司
}).then(res => {
if (res.code === 1000) {
const options =
res.data ?
res.data.map(item => ({
label: item.name,
value: item.id,
})) :
[];
resolve(options);
}
reject();
}).catch(() => {
reject();
});
});
};
const handleClose = () => {
if (onClose) {
onClose();
}
};
const handleSubmit = (values: ValuesType) => {
if (onSubmit) {
const { productList, ...rest } = values;
onSubmit({
...rest,
productList: productList.filter((item) => +item.deliveryCount < +item.returnCount),
});
}
};
return (
<Drawer
title="退货发货处理"
width={1100}
onClose={handleClose}
visible={visible}
footer={
<div
style={{
textAlign: 'right',
}}
>
<Button onClick={handleClose} style={{ marginRight: 16 }}>
取 消
</Button>
<Button
onClick={() => formActions.submit()}
type="primary"
loading={submitLoading}
>
确 定
</Button>
</div>
}
>
<NiceForm
previewPlaceholder="' '"
initialValues={value}
components={{
ArrayTable,
}}
effects={($, { setFieldValue }) => {
useAsyncSelect('logisticsName', fetchLogisticsCompany, ['label', 'value']);
onFieldInputChange$('logisticsName').subscribe(state => {
const { originAsyncData, value } = state;
const current = originAsyncData.find(item => item.value === value);
if (current) {
setFieldValue('logisticsNameTxt', current.label);
}
});
}}
actions={formActions}
schema={schema}
onSubmit={values => handleSubmit(values)}
/>
</Drawer>
);
};
export default ReturnDeliverDrawer;
/*
* @Author: XieZhiXiong
* @Date: 2021-08-07 15:14:04
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-07 19:50:34
* @Description:
*/
import { ISchema } from '@formily/antd';
import moment from 'moment';
export const schema: ISchema = {
type: 'object',
properties: {
productList: {
type: 'array',
'x-component': 'ArrayTable',
'x-component-props': {
renderAddition: () => null,
renderRemove: () => null,
renderMoveDown: () => null,
renderMoveUp: () => null,
operationsWidth: 1,
},
items: {
type: 'object',
properties: {
orderNo: {
type: 'string',
title: '订单号',
editable: false,
},
productId: {
type: 'string',
title: '商品ID',
editable: false,
},
productName: {
type: 'string',
title: '商品名称',
editable: false,
},
category: {
type: 'string',
title: '品类',
editable: false,
},
brand: {
type: 'string',
title: '品牌',
editable: false,
},
unit: {
type: 'string',
title: '单位',
editable: false,
},
returnCount: {
type: 'string',
title: '退货数量',
editable: false,
},
deliveryCount: {
type: 'string',
title: '已退货发货',
editable: false,
},
noDeliveryCount: {
type: 'string',
title: '未退货发货',
editable: false,
},
receiveCount: {
type: 'string',
title: '已退货收货',
editable: false,
},
subCount: {
type: 'string',
title: '差异数量',
editable: false,
},
count: {
type: 'string',
title: '退货发货数量',
'x-rules': [
{
required: true,
message: '请输入退货发货数量',
},
],
},
},
}
},
MEGA_LAYOUT: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 2,
labelCol: 6,
wrapperCol: 18,
labelAlign: 'left',
},
properties: {
returnDeliverAddress: {
type: 'string',
title: '退货发货地址',
'x-component': 'CustomAddressSelect',
required: true,
'x-component-props': {},
},
deliveryTime: {
type: 'date',
title: '退货发货时间',
'x-component-props': {
format: 'YYYY-MM-DD HH:mm:ss',
showTime: true,
},
required: true,
default: moment().format('YYYY-MM-DD HH:mm:ss'),
},
logisticsOrderNo: {
type: 'string',
title: '物流单号',
required: true,
'x-component-props': {
maxLength: 11,
},
},
logisticsName: {
type: 'string',
title: '物流公司',
required: true,
enum: [],
'x-component-props': {
},
},
// 收集值用
logisticsNameTxt: {
title: '物流公司',
type: 'string',
display: false,
},
},
},
},
};
\ No newline at end of file
...@@ -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: 2021-01-08 10:13:21 * @LastEditTime: 2021-08-07 20:41:31
* @Description: 待新增退货发货单 * @Description: 待新增退货发货单
*/ */
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
...@@ -148,7 +148,7 @@ const ReturnPrDeliver: React.FC = () => { ...@@ -148,7 +148,7 @@ const ReturnPrDeliver: React.FC = () => {
<Card> <Card>
<StandardTable <StandardTable
tableProps={{ tableProps={{
rowKey: 'id', rowKey: 'returnId',
}} }}
columns={columns} columns={columns}
currentRef={ref} currentRef={ref}
......
/*
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-07 19:20:26
* @Description: 退货发货
*/
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Button } from 'antd'; import { Button } from 'antd';
import { history } from 'umi'; import { history } from 'umi';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { SettingOutlined } from '@ant-design/icons'; import { SettingOutlined } from '@ant-design/icons';
import moment from 'moment';
import { usePageStatus } from '@/hooks/usePageStatus'; import { usePageStatus } from '@/hooks/usePageStatus';
import { RETURN_GOODS_MANUAL_DELIVERY, RETURN_GOODS_MANUAL_DELIVERY_CONTRACT } from '../../constants'; import { RETURN_GOODS_MANUAL_DELIVERY, RETURN_GOODS_MANUAL_DELIVERY_CONTRACT } from '../../constants';
import ManualDeliveryModal from '../../components/ManualDeliveryModal'; import ReturnDeliverDrawer, { ValuesType } from './components/ReturnDeliverDrawer';
import DetailInfo from '../components/DetailInfo'; import DetailInfo from '../components/DetailInfo';
const ReturnPrDeliverVerify: React.FC = () => { const ReturnPrDeliverVerify: React.FC = () => {
const { id } = usePageStatus(); const { id } = usePageStatus();
const [modalVisible, setModalVisible] = useState(false); const [visible, setVisible] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false); const [submitLoading, setSubmitLoading] = useState(false);
const handleSubmit = values => { const handleSubmit = (values: ValuesType) => {
if (!id) { if (!id) {
return; return;
} }
const {
productList,
returnDeliverAddress,
deliveryTime,
logisticsNameTxt,
logisticsOrderNo,
} = values;
setSubmitLoading(true); setSubmitLoading(true);
PublicApi.postAsReturnGoodsManualReturnDeliveryGoods({ PublicApi.postAsReturnGoodsManualReturnDeliveryGoods({
dataId: id, returnId: +id,
...values, deliveryAddress: `${returnDeliverAddress.fullAddress} ${returnDeliverAddress.name}/${returnDeliverAddress.phone}`,
productList: productList.map((item) => ({
productId: item.productId,
returnCount: +item.count,
})),
deliveryTime: moment(deliveryTime).valueOf(),
logisticsName: logisticsNameTxt,
logisticsOrderNo,
}).then(res => { }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
handleVisibleDrawer(false);
setTimeout(() => {
history.goBack(); history.goBack();
}, 800);
} }
}).finally(() => { }).finally(() => {
setSubmitLoading(false); setSubmitLoading(false);
}); });
}; };
const handleVisible = flag => { const handleVisibleDrawer = flag => {
setModalVisible(!!flag); setVisible(!!flag);
}; };
return ( return (
...@@ -44,24 +69,26 @@ const ReturnPrDeliverVerify: React.FC = () => { ...@@ -44,24 +69,26 @@ const ReturnPrDeliverVerify: React.FC = () => {
<Button <Button
type="default" type="default"
icon={<SettingOutlined />} icon={<SettingOutlined />}
onClick={() => handleVisible(true)} onClick={() => handleVisibleDrawer(true)}
> >
手工退货发货 退货发货
</Button> </Button>
)} )}
<ReturnDeliverDrawer
value={{
productList: info?.goodsDetailList,
}}
visible={visible}
onClose={() => handleVisibleDrawer(false)}
onSubmit={handleSubmit}
submitLoading={submitLoading}
/>
</> </>
)} )}
target="/memberCenter/afterService/returnApplication/returnPrDeliver" target="/memberCenter/afterService/returnApplication/returnPrDeliver"
isEditRefundDeliver isEditRefundDeliver
/> />
<ManualDeliveryModal
value={{}}
visible={modalVisible}
confirmLoading={submitLoading}
onSubmit={handleSubmit}
onVisible={handleVisible}
/>
</> </>
); );
}; };
......
...@@ -159,7 +159,6 @@ export const addSchema = (orderType: number): ISchema => { ...@@ -159,7 +159,6 @@ export const addSchema = (orderType: number): ISchema => {
effects: ($, actions) => { effects: ($, actions) => {
}, },
inline: false,
} }
}, },
tableProps: { tableProps: {
...@@ -500,9 +499,9 @@ export const addSchema = (orderType: number): ISchema => { ...@@ -500,9 +499,9 @@ export const addSchema = (orderType: number): ISchema => {
title: '退货自提地址', title: '退货自提地址',
type: 'string', type: 'string',
visible: false, visible: false,
'x-component': 'AddressFormItem', 'x-component': 'CustomAddressSelect',
'x-component-props': { 'x-component-props': {
dataSource: [], isDefaultAddress: true,
}, },
'x-rules': [ 'x-rules': [
{ {
......
...@@ -2,84 +2,20 @@ ...@@ -2,84 +2,20 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34 * @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-07 18:06:03 * @LastEditTime: 2021-08-07 19:51:22
* @Description: * @Description:
*/ */
import React, { useState } from 'react'; import React from 'react';
import { Button } from 'antd';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { SettingOutlined } from '@ant-design/icons';
import { usePageStatus } from '@/hooks/usePageStatus'; import { usePageStatus } from '@/hooks/usePageStatus';
import { RETURN_GOODS_MANUAL_DELIVERY, RETURN_GOODS_MANUAL_DELIVERY_CONTRACT } from '../../constants';
import ManualDeliveryModal from '../../components/ManualDeliveryModal';
import DetailInfo from '../components/DetailInfo'; import DetailInfo from '../components/DetailInfo';
const ReturnPrReceivedVerify: React.FC = () => { const ReturnPrReceivedVerify: React.FC = () => {
const { id } = usePageStatus(); const { id } = usePageStatus();
const [modalVisible, setModalVisible] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const handleSubmit = values => {
if (!id) {
return;
}
setSubmitLoading(true);
PublicApi.postAsReturnGoodsConfirmManualReturnReceiveGoods({
dataId: +id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
}
}).finally(() => {
setSubmitLoading(false);
});
};
const handleVisible = flag => {
setModalVisible(!!flag);
};
return ( return (
<> <>
<DetailInfo <DetailInfo
id={id} id={id}
headExtra={info => {
const detailed = info || {};
// @ts-ignore
const { manualReturnGoodsAddress = {} } = detailed;
return (
<>
{(info && (info.taskType === RETURN_GOODS_MANUAL_DELIVERY || info.taskType === RETURN_GOODS_MANUAL_DELIVERY_CONTRACT)) && (
<>
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleVisible(true)}
>
手工确认退货收货
</Button>
<ManualDeliveryModal
key="2"
value={{
deliveryAddressTxt: manualReturnGoodsAddress.deliveryAddress,
deliveryTime: manualReturnGoodsAddress.deliveryTime,
logisticsOrderNo: manualReturnGoodsAddress.logisticsOrderNo,
logisticsNameTxt: manualReturnGoodsAddress.logisticsName,
}}
visible={modalVisible}
confirmLoading={submitLoading}
onSubmit={handleSubmit}
onVisible={handleVisible}
isEdit={false}
/>
</>
)}
</>
)
}}
target="/memberCenter/afterService/returnManage/returnPrReceived" target="/memberCenter/afterService/returnManage/returnPrReceived"
isEditRefundDeliver isEditRefundDeliver
/> />
......
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