Commit 1544d920 authored by XieZhiXiong's avatar XieZhiXiong

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

parent 9aaef04b
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-08-05 14:54:18
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-06 10:41:38
* @LastEditTime: 2021-08-07 16:36:14
* @Description:
*/
import React from 'react';
......@@ -16,6 +16,7 @@ const AddressRadioGroupFormilyItem = connect()((props) => {
onChange,
addressType,
isDefault,
disabled,
...rest
} = props;
return (
......@@ -23,6 +24,7 @@ const AddressRadioGroupFormilyItem = connect()((props) => {
<AddressRadioGroup
addressType={addressType}
isDefault={isDefault}
disabled={disabled}
value={value}
onChange={onChange}
{...rest}
......
......@@ -45,6 +45,10 @@ interface IProps {
* 是否默认选择 默认地址,是的话会触发 onChange value为默认地址,默认为false
*/
isDefaultAddress?: boolean,
/**
* 是否禁用
*/
disabled: boolean,
}
export type SubmitValuesType = {
......@@ -100,6 +104,7 @@ const AddressSelect: React.FC<IProps> = (props) => {
value,
onChange,
isDefaultAddress = false,
disabled = false,
} = props;
const [list, setList] = useState<AddressValueType[]>([]);
const [internalValue, setInternalValue] = useState<AddressValueType>();
......@@ -295,10 +300,12 @@ const AddressSelect: React.FC<IProps> = (props) => {
options={options}
value={value?.id}
onChange={handleSelectChange}
disabled={disabled}
/>
<Button
onClick={() => handleVisibleDrawer(true)}
className={styles['address-select-action']}
disabled={disabled}
>
管理
</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 @@
* @Author: XieZhiXiong
* @Date: 2020-11-04 15:09:09
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-26 13:52:41
* @LastEditTime: 2021-08-07 14:51:11
* @Description: 维修商品抽屉组件
*/
import React from 'react';
......@@ -75,9 +75,9 @@ interface GoodsDrawerProps {
*/
searchable?: boolean;
/**
* 流程类型:1.订单交易流程 2.售后换货流程 3.售后退货流程 4.售后维修流程
* 流程类型:2.售后换货流程 3.售后退货流程 4.售后维修流程
*/
afterType: 1 | 2 | 3 | 4;
afterType: 2 | 3 | 4;
/**
* 订单类型
*/
......@@ -98,7 +98,6 @@ interface GoodsDrawerState {
selectedRowKeys: number[];
childSelectedRowKeys: number[];
loading: boolean;
currentProcessEnum: number;
};
// 跟 选中的子节点 找到 父级选中的 keys
......@@ -115,8 +114,8 @@ function transformParentKeys(data: any[], childCheckedKeys: string[]) {
};
// 这里循环遍历 判断 选中的子表格的keys中 是否包含 当前子项,如果有先 push 到父节点的 checkeds
if (item.productDateilss && item.productDateilss.length) {
item.productDateilss.forEach(childItem => {
if (item.products && item.products.length) {
item.products.forEach(childItem => {
if (childCheckedKeys.find(key => key === childItem.id)) {
atom.checkeds.push(childItem.id);
}
......@@ -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);
}
});
......@@ -159,7 +158,6 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
selectedRowKeys: [],
childSelectedRowKeys: [],
loading: false,
currentProcessEnum: 0,
};
};
......@@ -170,11 +168,11 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
const { page, size, searchVal } = this.state;
const { fetchOrderList, afterType, orderType } = this.props;
const isMateriel = (
orderType === ORDER_TYPE_INQUIRY_CONTRACT
|| orderType === ORDER_TYPE_BIDDING_CONTRACT
|| orderType === ORDER_TYPE_TENDER_CONTRACT
);
// const isMateriel = (
// orderType === ORDER_TYPE_INQUIRY_CONTRACT
// || orderType === ORDER_TYPE_BIDDING_CONTRACT
// || orderType === ORDER_TYPE_TENDER_CONTRACT
// );
if (!fetchOrderList) {
return;
......@@ -187,103 +185,38 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
...searchVal,
});
if (orderListRes) {
let processEnumRes = { data: [], code: 0 };
// 售后退货、换货才涉及售后工作流相关
// 这里分两种状况,一种是普通的订单、而是合同订单
// 普通订单根据订单商品,请求商品的售后流程枚举组装数据
// 合同订单根据订单的合同id,请求合同的售后流程枚举组装数据
if (afterType === 2 || afterType === 3) {
// 获取对应订单列表的售后工作流类型
const payload = [];
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);
const { data, ...rest } = orderListRes;
const newData: { [key: string]: any }[] = data.map((item) => ({
...item,
products: item.products.map(({ productId, ...rest }) => ({
id: productId,
...rest,
quantity: +rest.quantity,
purchasePrice: +rest.purchasePrice,
taxRate: +!!rest.taxRate,
taxInclusive: rest.taxInclusive || +!!rest.taxRate,
orderNo: item.orderNo,
orderId: item.orderId,
payInfoList: item.payInfoList,
orderType: item.orderType,
contractId: item.contractId,
contractNo: item.contractNo,
})),
}));
newData.forEach((item) => {
item.products.forEach((product) => {
// 防止重复添加数据
if (!this.flattened.find(flat => flat.id === product.id)) {
this.flattened.push(product);
}
});
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,
payInfoList: item.payInfoList,
orderType: item.type,
contractId: item.contractId,
contractNo: item.contractNo,
});
}
});
}
});
this.setState({
dataSource: orderListRes,
dataSource: {
data: newData,
...rest,
},
});
}
this.setState({ loading: false });
......@@ -389,7 +322,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
} = this.state;
let childArr: any = [...childSelectedRowKeys];
// 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,取消选中
if (selected) {
// 第二步,父Table选中,子Table全选中(全部整合到一起,然后去重)
......@@ -421,7 +354,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
let setChildArr: any = [];
  // 将改变的父Table下的子Table下的 id 都添加到setChildArr中
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:取消全选
......@@ -494,8 +427,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
? 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;
}, 0)
: 0,
taxInclusive: product.taxInclusive || +!!product.taxRate,
: product.amount,
});
}
});
......@@ -616,8 +548,8 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
NestColumns={[]}
className="common_tb"
rowClassName={(_, index) => (index % 2) === 0 && 'tb_bg'}
rowKey="id"
childrenDataKey="productDateilss"
rowKey="orderId"
childrenDataKey="products"
dataSource={dataSource.data}
loading={loading}
childRowSelection={{
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-09-29 10:03:06
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-11 10:58:36
* @LastEditTime: 2021-08-06 15:36:30
* @Description:
*/
import { ISchema } from '@formily/antd';
......@@ -45,14 +45,14 @@ export const listSearchSchema: ISchema = {
columns: 6,
},
properties: {
orderThe: {
digest: {
type: 'string',
'x-component-props': {
placeholder: '订单摘要',
allowClear: true,
},
},
'[startCreateTime, endCreateTime]': {
'[startDate, endDate]': {
type: 'string',
default: '',
'x-component': 'dateSelect',
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-02-20 17:10:14
* @LastEditTime: 2021-08-07 19:36:18
* @Description:
*/
import React, { useState } from 'react';
......@@ -64,10 +64,10 @@ const ExchangePrReceivedVerify: React.FC = () => {
<ManualDeliveryModal
key="2"
value={{
deliveryAddressTxt: manualReturnGoodsAddress.deliveryAddress,
deliveryTime: manualReturnGoodsAddress.deliveryTime,
logisticsOrderNo: manualReturnGoodsAddress.logisticsOrderNo,
logisticsNameTxt: manualReturnGoodsAddress.logisticsName,
deliveryAddressTxt: manualReturnGoodsAddress?.deliveryAddress,
deliveryTime: manualReturnGoodsAddress?.deliveryTime,
logisticsOrderNo: manualReturnGoodsAddress?.logisticsOrderNo,
logisticsNameTxt: manualReturnGoodsAddress?.logisticsName,
}}
visible={modalVisible}
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 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 16:30:44
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-08 10:13:21
* @LastEditTime: 2021-08-07 20:41:31
* @Description: 待新增退货发货单
*/
import React, { useState, useRef } from 'react';
......@@ -148,7 +148,7 @@ const ReturnPrDeliver: React.FC = () => {
<Card>
<StandardTable
tableProps={{
rowKey: 'id',
rowKey: 'returnId',
}}
columns={columns}
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 { Button } from 'antd';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { SettingOutlined } from '@ant-design/icons';
import moment from 'moment';
import { usePageStatus } from '@/hooks/usePageStatus';
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';
const ReturnPrDeliverVerify: React.FC = () => {
const { id } = usePageStatus();
const [modalVisible, setModalVisible] = useState(false);
const [visible, setVisible] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const handleSubmit = values => {
const handleSubmit = (values: ValuesType) => {
if (!id) {
return;
}
const {
productList,
returnDeliverAddress,
deliveryTime,
logisticsNameTxt,
logisticsOrderNo,
} = values;
setSubmitLoading(true);
PublicApi.postAsReturnGoodsManualReturnDeliveryGoods({
dataId: id,
...values,
returnId: +id,
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 => {
if (res.code === 1000) {
history.goBack();
handleVisibleDrawer(false);
setTimeout(() => {
history.goBack();
}, 800);
}
}).finally(() => {
setSubmitLoading(false);
});
};
const handleVisible = flag => {
setModalVisible(!!flag);
const handleVisibleDrawer = flag => {
setVisible(!!flag);
};
return (
......@@ -44,24 +69,26 @@ const ReturnPrDeliverVerify: React.FC = () => {
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleVisible(true)}
onClick={() => handleVisibleDrawer(true)}
>
手工退货发货
退货发货
</Button>
)}
<ReturnDeliverDrawer
value={{
productList: info?.goodsDetailList,
}}
visible={visible}
onClose={() => handleVisibleDrawer(false)}
onSubmit={handleSubmit}
submitLoading={submitLoading}
/>
</>
)}
target="/memberCenter/afterService/returnApplication/returnPrDeliver"
isEditRefundDeliver
/>
<ManualDeliveryModal
value={{}}
visible={modalVisible}
confirmLoading={submitLoading}
onSubmit={handleSubmit}
onVisible={handleVisible}
/>
</>
);
};
......
......@@ -9,7 +9,7 @@ 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 { GetAsReturnGoodsPageReturnedGoodsResponseDetail } from '@/services/AfterServiceApi';
import { GetAsReturnGoodsGetDetailByConsumerResponse } from '@/services/AfterServiceV2Api';
import { normalizeFiledata, FileData } from '@/utils';
import { PurchaseOrderOutWorkStateTexts, ORDER_TYPE2 } from '@/constants/order';
import {
......@@ -93,7 +93,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
const [detailInfo, setDetailInfo] = useState<DetailInfo>({
applyTime: moment().format('YYYY-MM-DD HH:mm:ss'),
});
const [returnGoodsList, setReturnGoodsList] = useState<GetAsReturnGoodsPageReturnedGoodsResponseDetail[]>([]);
const [returnGoodsList, setReturnGoodsList] = useState<GetAsReturnGoodsGetDetailByConsumerResponse['goodsDetailList']>([]);
const [unsaved, setUnsaved] = useState(false);
const [infoLoading, setInfoLoading] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
......@@ -105,15 +105,15 @@ const ReturnForm: React.FC<BillsFormProps> = ({
const isMateriel = (
orderTypeValue === ORDER_TYPE_INQUIRY_CONTRACT
|| orderTypeValue === ORDER_TYPE_BIDDING_CONTRACT
|| orderTypeValue === ORDER_TYPE_TENDER_CONTRACT
|| orderTypeValue === ORDER_TYPE_BIDDING_CONTRACT
|| orderTypeValue === ORDER_TYPE_TENDER_CONTRACT
);
const tableColumn: ColumnType<any>[] = [
{
title: '订单号',
dataIndex: 'orderNo',
align: 'center',
dataIndex: 'orderNo',
align: 'center',
render: (text) => (
<a
href={`/memberCenter/afterService/returnApplication/returnPrSubmit/orderDetail?orderNo=${text}`}
......@@ -125,31 +125,28 @@ const ReturnForm: React.FC<BillsFormProps> = ({
},
{
title: '订单摘要',
dataIndex: 'orderThe',
dataIndex: 'digest',
align: 'center',
},
{
title: '供应会员',
dataIndex: 'supplyMembersName',
dataIndex: 'vendorMemberName',
align: 'center',
},
{
title: '下单时间',
dataIndex: 'createTime',
align: 'center',
render: text => moment(text).format('YYYY-MM-DD HH:mm:ss'),
},
{
title: '订单状态',
dataIndex: 'externalState',
dataIndex: 'outerStatusName',
align: 'center',
render: text => PurchaseOrderOutWorkStateTexts[text],
},
{
title: '订单类型',
dataIndex: 'type',
align: 'center',
render: text => ORDER_TYPE2[text],
dataIndex: 'orderTypeName',
align: 'center',
},
isMateriel ? {
title: '合同编号',
......@@ -178,7 +175,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
},
!isMateriel ? {
title: '商品名称',
dataIndex: 'productName',
dataIndex: 'name',
align: 'center',
} : {
title: '物料名称、规格',
......@@ -203,7 +200,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
},
{
title: '订单数量',
dataIndex: 'purchaseCount',
dataIndex: 'quantity',
align: 'center',
},
{
......@@ -214,7 +211,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
},
{
title: '金额',
dataIndex: 'money',
dataIndex: 'amount',
align: 'center',
render: (text) => ${text}`,
},
......@@ -225,7 +222,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
},
{
title: '已退款金额',
dataIndex: 'refundAmount',
dataIndex: 'returnAmount',
align: 'center',
},
];
......@@ -233,14 +230,24 @@ const ReturnForm: React.FC<BillsFormProps> = ({
// 根据供应会员获取订单列表
const getOrderList = (params): Promise<OrderListRes> => {
const supplierMemberValue = addSchemaAction.getFieldValue('supplierMember');
const { startDate = null, endDate = null } = params;
const payload = { ...params };
if (startDate) {
payload.startDate = moment(+startDate).format('YYYY-MM-DD');
}
if (endDate) {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
return new Promise((resolve, reject) => {
PublicApi.getOrderAfterSalesOrderList({
orderNo: detailInfo.orderNo,
...params,
supplyMembersId: supplierMemberValue[0].memberId,
supplyMembersRoleId: supplierMemberValue[0].roleId,
type: orderTypeValue,
PublicApi.getOrderCommonAfterSalePage({
...payload,
orderNo: detailInfo.orderNo,
vendorMemberId: supplierMemberValue[0].memberId,
vendorRoleId: supplierMemberValue[0].roleId,
orderType: orderTypeValue,
afterSalesType: 3, // 退货
}).then(res => {
if (res.code === 1000) {
resolve(res.data);
......@@ -276,7 +283,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
manualReturnGoodsAddress,
returnDeliveryGoodsList,
returnStatisticsList,
taskType,
taskTypeKey,
consumerName,
outerRecordList,
outerTaskList,
......@@ -301,14 +308,14 @@ const ReturnForm: React.FC<BillsFormProps> = ({
fullAddress: returnGoodsAddress.sendAddress,
id: returnGoodsAddress.sendId,
phone: returnGoodsAddress.sendUserTel,
receiverName: returnGoodsAddress.sendUserName,
name: returnGoodsAddress.sendUserName,
} : undefined,
// 自提
pickupAddress: returnGoodsAddress.deliveryType === 2 ? {
fullAddress: returnGoodsAddress.sendAddress,
id: returnGoodsAddress.sendId,
phone: returnGoodsAddress.sendUserTel,
receiverName: returnGoodsAddress.sendUserName,
name: returnGoodsAddress.sendUserName,
} : undefined,
deliveryType: returnGoodsAddress.deliveryType,
supplierMember:
......@@ -333,10 +340,10 @@ const ReturnForm: React.FC<BillsFormProps> = ({
returnReason: item.returnReason,
payList: (item.payList || []).map(({ payId, ...rest }) => ({ ...rest, id: payId })),
id: item.orderRecordId,
taskType,
taskTypeKey,
},
associated: !item.materielId ? '' : `${item.productId}/${item.productName}/${item.category}/${item.brand}`,
materielNameAndType: `${item.materielName || ''}${item.materielType ? '/' + item.materielType : ''}`,
associated: !item.associatedProductId ? '' : `${item.productId}/${item.productName}/${item.associatedCategory}/${item.associatedBrand}`,
materielNameAndType: `${item.associatedProductName || ''}${item.associatedType ? '/' + item.associatedType : ''}`,
})));
setGoodsValue(goodsDetailList.map(item => item.orderRecordId));
}
......@@ -469,9 +476,9 @@ const ReturnForm: React.FC<BillsFormProps> = ({
,
sendUserName:
deliveryType === 1 ?
shippingAddress.shipperName :
shippingAddress.name :
deliveryType === 2 ?
pickupAddress.shipperName :
pickupAddress.name :
''
,
sendUserTel:
......@@ -502,29 +509,32 @@ const ReturnForm: React.FC<BillsFormProps> = ({
isNeedReturn,
associated,
materielNameAndType,
returnCount,
refundAmount,
...rest
}) => ({
...rest,
brand: brand || '',
unit: unit || '',
orderRecordId: extraData.id,
returnReason: extraData.returnReason,
...rest,
brand: brand || '',
unit: unit || '',
orderRecordId: extraData.id,
returnReason: extraData.returnReason,
returnCount: +returnCount,
payList: extraData.payList.map(item => {
const {
channelName,
payTime,
payWayName,
id,
...payItemRest
channelName,
payTime,
payWayName,
id,
...payItemRest
} = item;
return {
...payItemRest,
payTime: +new Date(payTime),
...payItemRest,
payTime: +new Date(payTime),
payId: id,
};
}),
})),
taskType: returnGoodsList[0].extraData.taskType,
taskTypeKey: returnGoodsList[0].extraData.taskTypeKey,
};
PublicApi.postAsReturnGoodsSave(payload)
......@@ -584,6 +594,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
};
const handleGoodsConfirm = values => {
console.log('values', values)
const preValues = addSchemaAction.getFieldValue('returnGoodsList');
const value = [];
......@@ -592,14 +603,14 @@ const ReturnForm: React.FC<BillsFormProps> = ({
id: item.id,
orderId: item.orderId,
orderNo: item.orderNo,
productId: item.productId,
productName: item.productName,
productId: item.productNo,
productName: item.name,
category: item.category,
brand: item.brand,
unit: item.unit,
purchasePrice: item.price,
purchaseCount: item.purchaseCount,
purchaseAmount: +(item.price * item.purchaseCount).toFixed(2),
purchaseCount: item.quantity,
purchaseAmount: +(item.price * item.quantity).toFixed(2),
payAmount: item.payAmount,
returnCount: '',
refundAmount: '',
......@@ -607,22 +618,21 @@ const ReturnForm: React.FC<BillsFormProps> = ({
id: item.id,
returnReason: '',
payList: item.payList,
taskType: item.processEnum,
remaining: item.purchaseCount - (item.returnCount || 0), // 可退货数量
taskTypeKey: item.processKey,
remaining: item.quantity - (item.returnCount || 0), // 可退货数量
},
isHasTax: item.taxInclusive,
taxRate: item.taxRate,
contractId: item.contractId,
contractNo: item.contractNo,
associated: !isMateriel ? '' : `${item.productId}/${item.productName}/${item.category}/${item.brand}`,
materielId: item.materialId,
materielNo: item.materialCode,
materielNameAndType: `${item.materialName || ''}${item.materialType ? '/' + item.materialType : ''}`,
materielName: item.materialName,
materielType: item.materialType,
materielCategory: item.materialCategory,
materielBrand: item.materialBrand,
materielUnit: item.materialUnit,
associated: !isMateriel ? '' : `${item.productNo}/${item.name}/${item.category}/${item.brand}`,
associatedProductId: item.materialId || '',
associatedProductName: `${item.materialName || ''}${item.materialType ? '/' + item.materialType : ''}`,
materielName: item.materialName || '',
associatedType: item.materialType || '',
associatedCategory: item.materialCategory || '',
associatedBrand: item.materialBrand || '',
associatedUnit: item.materialUnit || '',
};
value.push(atom);
});
......
......@@ -159,7 +159,6 @@ export const addSchema = (orderType: number): ISchema => {
effects: ($, actions) => {
},
inline: false,
}
},
tableProps: {
......@@ -497,12 +496,12 @@ export const addSchema = (orderType: number): ISchema => {
},
// 退货自提地址
pickupAddress: {
title: '退货自提地址',
type: 'string',
visible: false,
'x-component': 'AddressFormItem',
title: '退货自提地址',
type: 'string',
visible: false,
'x-component': 'CustomAddressSelect',
'x-component-props': {
dataSource: [],
isDefaultAddress: true,
},
'x-rules': [
{
......
......@@ -2,84 +2,20 @@
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-07 18:06:03
* @LastEditTime: 2021-08-07 19:51:22
* @Description:
*/
import React, { useState } from 'react';
import { Button } from 'antd';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { SettingOutlined } from '@ant-design/icons';
import React from 'react';
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';
const ReturnPrReceivedVerify: React.FC = () => {
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 (
<>
<DetailInfo
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"
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