Commit fac0ecd9 authored by XieZhiXiong's avatar XieZhiXiong

feat: 添加代客退货申请

parent 9507af71
......@@ -252,6 +252,13 @@ const route: RouterChild = {
hideInMenu: true,
noMargin: true,
},
// 代客退货申请
{
path: '/memberCenter/afterService/returnManage/returnValetApply/index',
name: 'returnValetApply',
component: '@/pages/afterService/returnManage/returnValetApply/index',
noMargin: true,
},
]
};
......
......@@ -632,6 +632,7 @@ export default {
'menu.afterService.returnManage.verifyReturnPrReceived': '确认退货收货',
'menu.afterService.returnManage.returnPrReturn': '待退款',
'menu.afterService.returnManage.verifyReturnPrReturn': '确认退款',
'menu.afterService.returnManage.returnValetApply': '代客退货申请',
'menu.afterService.returnManage.orderPreview': '查看订单',
'menu.afterService.repairApplication': '维修申请',
......
......@@ -469,6 +469,7 @@ export const addSchema = (orderType: number): ISchema => {
'x-component': 'CustomAddressSelect',
'x-component-props': {
isDefaultAddress: true,
echo: true,
},
'x-rules': [
{
......@@ -485,6 +486,7 @@ export const addSchema = (orderType: number): ISchema => {
'x-component': 'CustomAddressSelect',
'x-component-props': {
isDefaultAddress: true,
echo: true,
},
'x-rules': [
{
......
/*
* @Author: XieZhiXiong
* @Date: 2021-12-02 19:00:53
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-12-02 19:53:36
* @Description:
*/
import { useBusinessEffects } from './useBusinessEffects';
import { getLogisticsSelectListShipperAddress } from '@/services/LogisticsV2Api';
export const createEffects = (context, actions) => {
const { setFieldState } = actions;
useBusinessEffects(context, actions);
// 获取发货地址
getLogisticsSelectListShipperAddress().then(res => {
if (res.code === 1000) {
setFieldState('*(shippingAddress,pickupAddress)', state => {
state.props['x-component-props'].dataSource = res.data;
});
}
}).catch((err) => {
console.warn(err);
});
};
\ No newline at end of file
/*
* @Author: XieZhiXiong
* @Date: 2021-12-02 19:01:00
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-12-02 19:01:01
* @Description:
*/
import { FormEffectHooks } from '@formily/antd';
import { useLinkageUtils } from '@/utils/formEffectUtils';
const {
onFieldInputChange$,
onFieldValueChange$,
} = FormEffectHooks;
export const useBusinessEffects = (context, actions) => {
const {
getFieldValue,
setFieldValue,
} = actions;
const linkage = useLinkageUtils();
// 联动配送方式
onFieldValueChange$('deliveryType').subscribe(fieldState => {
const { name, value } = fieldState;
switch (value) {
// 物流
case 1: {
linkage.show('shippingAddress');
linkage.hide('pickupAddress');
break;
};
// 自提
case 2: {
linkage.hide('shippingAddress');
linkage.show('pickupAddress');
break;
};
// 无需物流
case 3: {
linkage.hide('*(shippingAddress,pickupAddress)');
break;
};
default:
break
};
});
// 供应会员、售后订单类型联动 单据明细
onFieldInputChange$('*(supplierMember,orderType)').subscribe(fieldState => {
const replaceGoodsListValue = getFieldValue('returnGoodsList');
if (replaceGoodsListValue && replaceGoodsListValue.length) {
setFieldValue('returnGoodsList', []);
}
});
}
\ No newline at end of file
/*
* @Author: XieZhiXiong
* @Date: 2021-12-02 19:00:25
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-12-02 20:08:48
* @Description: 代客退货申请
*/
import React, { useState, useMemo } from 'react';
import { Button, Card, Spin, Badge, message, Upload } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import { ArrayTable } from '@formily/antd-components';
import { history, Prompt } from 'umi';
import moment from 'moment';
import { findLastIndex, debounce } from 'lodash';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined, PlusOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import BigNumber from 'bignumber.js';
import { getOrderCommonAgentAfterSalePage } from '@/services/OrderNewV2Api';
import { postAsReturnGoodsAgentSave } from '@/services/AfterServiceV2Api';
import { getMemberManageOrderAgentMembers, GetMemberManageOrderAgentMembersResponse } from '@/services/MemberV2Api';
import { FileData } from '@/utils';
import { getAuth } from '@/utils/auth';
import ReutrnEle from '@/components/ReturnEle';
import StatusTag from '@/components/StatusTag';
import NiceForm from '@/components/NiceForm';
import GoodsDrawer from '../../components/GoodsDrawer';
import { OrderListRes } from '../../components/GoodsDrawer/interface';
import AddressFormItem from '../../components/AddressFormItem';
import ReturnInfoDrawer, { ReturnApplyInfo } from '../../components/ReturnInfoDrawer';
import { addSchema } from './schema';
import { createEffects } from './effects';
import {
RETURN_OUTER_STATUS_TAG_MAP,
RETURN_INNER_STATUS_BADGE_MAP,
} from '../../constants';
import { isMaterialOrder } from '../../utils';
const addSchemaAction = createFormActions();
const {
onFormInputChange$,
onFieldInputChange$,
onFormInit$,
} = FormEffectHooks;
interface BillsFormProps {}
type ReturnGoodsListItemType = {
/**
* 订单号
*/
orderNo: string,
/**
* 商品id
*/
productId: string,
/**
* 商品名称
*/
productName: string,
/**
* 品类
*/
category: string,
/**
* 品牌
*/
brand: string,
/**
* 单位
*/
unit: string,
/**
* 采购数量
*/
purchaseCount: number,
/**
* 物料编号
*/
associatedProductId: string,
/**
* 物料名称、规格
*/
associatedProductName: string,
/**
* 物料品类
*/
associatedCategory: string,
/**
* 物料品牌
*/
associatedBrand: string,
/**
* 物料单位
*/
associatedUnit: string,
/**
* 关联报价商品ID、名称、规格、品类、品牌
*/
associated: string,
/**
* 采购单价
*/
purchasePrice: number,
/**
* 采购金额
*/
purchaseAmount: number,
/**
* 已支付金额
*/
payAmount: number,
/**
* 退货数量
*/
returnCount: number,
/**
* 退款金额
*/
refundAmount: number,
/**
* 额外的数据
*/
extraData: { [key: string]: any },
}
interface DetailInfo {
applyTime: string;
proofFileList?: FileData[];
deliveryAddress?: { [key: string]: any };
shippingAddress?: { [key: string]: any };
pickupAddress?: { [key: string]: any };
supplierMember?: {},
outerStatus?: number,
outerStatusName?: string,
innerStatus?: number,
innerStatusName?: string,
deliveryType?: number,
/**
* 订单编号
*/
orderNo?: string,
/**
* 订单类型
*/
orderType?: number,
/**
* 商品数据
*/
returnGoodsList?: ReturnGoodsListItemType[],
}
interface OrderNoProps {
value: any,
name: string,
}
const OrderNo = (props: OrderNoProps) => {
const { value, name } = props;
const extraData = addSchemaAction.getFieldValue(FormPath.transform(name, /\d/, $1 => {
return `returnGoodsList.${$1}.extraData`;
}));
return (
<a
href={`/memberCenter/afterService/returnApplication/returnPrSubmit/orderDetail?id=${extraData?.orderId}`}
target="_blank"
>
{value}
</a>
)
};
OrderNo.isFieldComponent = true;
const ReturnValetApply: React.FC<BillsFormProps> = () => {
const [detailInfo] = useState<DetailInfo>({
applyTime: moment().format('YYYY-MM-DD HH:mm:ss'),
});
const [unsaved, setUnsaved] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const [applyInfo, setApplyInfo] = useState<ReturnApplyInfo>(null);
const [visibleGoodsDrawer, setVisibleGoodsDrawer] = useState(false);
const [visibleReturnInfoDrawer, setVisibleReturnInfoDrawer] = useState(false);
const [goodsValue, setGoodsValue] = useState([]);
const [orderTypeValue, setOrderTypeValue] = useState(0);
const isMateriel = isMaterialOrder(orderTypeValue);
const tableColumn: ColumnType<any>[] = [
{
title: '订单号',
dataIndex: 'orderNo',
render: (text, record) => (
<a
href={`/memberCenter/afterService/returnApplication/returnPrSubmit/orderDetail?id=${record.orderId}`}
target="_blank"
        >
{text}
</a>
),
},
{
title: '订单摘要',
dataIndex: 'digest',
ellipsis: true,
},
{
title: '供应会员',
dataIndex: 'vendorMemberName',
},
{
title: '下单时间',
dataIndex: 'createTime',
},
{
title: '订单状态',
dataIndex: 'outerStatusName',
},
{
title: '订单类型',
dataIndex: 'orderTypeName',
},
isMateriel ? {
title: '合同编号',
dataIndex: 'contractNo',
render: (text, record) => (
<a
href={`/memberCenter/contract/manage/QueryList/QueryListdetails?contractId=${record.contractId}`}
target="_blank"
        >
{text}
</a>
),
} : null,
].filter(Boolean) as ColumnType<any>[];
const childTableColumn: ColumnType<any>[] = [
!isMateriel ? {
title: '商品ID',
dataIndex: 'productNo',
} : {
title: '物料编号',
dataIndex: 'productNo',
},
!isMateriel ? {
title: '商品名称',
dataIndex: 'name',
ellipsis: true,
} : {
title: '物料名称、规格',
dataIndex: 'name',
render: (text, record) => `${text}/${record.quotedSpec}`,
},
{
title: '品类',
dataIndex: 'category',
},
{
title: '品牌',
dataIndex: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
},
{
title: '订单数量',
dataIndex: 'quantity',
},
{
title: '单价',
dataIndex: 'price',
render: (text) => ${text}`,
},
{
title: '金额',
dataIndex: 'amount',
render: (text) => ${text}`,
},
{
title: '已退货数量',
dataIndex: 'returnCount',
},
{
title: '已退款金额',
dataIndex: 'returnAmount',
},
];
// 根据采购会员获取订单列表
const getOrderList = (params): Promise<OrderListRes> => {
const purchaserValue = addSchemaAction.getFieldValue('purchaser');
const purchaserOriginData: GetMemberManageOrderAgentMembersResponse = addSchemaAction.getFieldState('purchaser', (fieldState) => fieldState.originData);
const current = purchaserOriginData.find((item) => item.id === purchaserValue);
if (!current) {
return Promise.reject();
}
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) => {
getOrderCommonAgentAfterSalePage({
...payload,
buyerMemberId: current.memberId,
buyerRoleId: current.roleId,
orderType: orderTypeValue,
afterSalesType: 2, // 退货
orderNo: detailInfo.orderNo ? detailInfo.orderNo : params.orderNo || undefined,
}).then(res => {
if (res.code === 1000) {
resolve(res.data);
}
reject();
}).catch(() => {
reject();
});
});
};
const handleAddGoods = () => {
const supplierMemberVal = addSchemaAction.getFieldValue('supplierMember');
const orderTypeVal = addSchemaAction.getFieldValue('orderType');
if (!supplierMemberVal || !supplierMemberVal.length) {
message.error('请先选择供应会员');
return;
}
if (!orderTypeVal) {
message.error('请先选择售后订单类型');
return;
}
setVisibleGoodsDrawer(true);
};
const TableAddButton = (
<Button
icon={<PlusOutlined />}
onClick={handleAddGoods}
type="dashed"
block
>
{!isMateriel ? '选择退货商品' : '选择退货物料'}
</Button>
);
const handleSubmit = values => {
const {
purchaser,
supplierMember,
deliveryType,
shippingAddress = {},
pickupAddress = {},
deliveryAddress = {},
proofFileList = [],
returnGoodsList = [],
outerStatus,
outerStatusName,
innerStatus,
innerStatusName,
applyNo,
applyTime,
refundList,
...rest
} = values;
setSubmitLoading(true);
const purchaserOriginData: GetMemberManageOrderAgentMembersResponse = addSchemaAction.getFieldState('purchaser', (fieldState) => fieldState.originData);
const current = purchaserOriginData.find((item) => item.id === purchaser);
const userInfo = getAuth();
const payload = {
...rest,
memberId: current.memberId,
memberRoleId: current.roleId,
company: current.name,
supplierMemberId: userInfo.memberId,
supplierRoleId: userInfo.memberRoleId,
supplierMemberName: userInfo.company,
// 配送方式为 1 = 物流 选择 发货地址
returnGoodsAddress: {
deliveryType,
sendAddress:
deliveryType === 1 ?
shippingAddress.fullAddress :
deliveryType === 2 ?
pickupAddress.fullAddress :
''
,
sendUserName:
deliveryType === 1 ?
shippingAddress.name :
deliveryType === 2 ?
pickupAddress.name :
''
,
sendUserTel:
deliveryType === 1 ?
shippingAddress.phone :
deliveryType === 2 ?
pickupAddress.phone :
''
,
sendId:
deliveryType === 1 ?
shippingAddress.id :
deliveryType === 2 ?
pickupAddress.id :
''
,
},
proofFileList: proofFileList.filter(item => item.status === 'done').map(item => ({
fileName: item.name,
filePath: item.url,
})),
returnGoodsList: returnGoodsList.map(({
id,
brand,
unit,
extraData,
needReturnName,
isNeedReturn,
associated,
returnCount,
refundAmount,
shopId,
shopLogo,
shopName,
...rest
}) => ({
...rest,
brand: brand || '',
unit: unit || '',
orderRecordId: extraData.id,
returnReason: extraData.returnReason,
returnCount: +returnCount,
payList: extraData.payList.map(item => {
const {
channelName,
payTime,
payWayName,
...payItemRest
} = item;
return {
...payItemRest,
payTime: +new Date(payTime),
};
}),
})),
taskTypeKey: returnGoodsList[0].extraData.taskTypeKey,
shopId: returnGoodsList[0].shopId,
shopLogo: returnGoodsList[0].shopLogo,
shopName: returnGoodsList[0].shopName,
};
postAsReturnGoodsAgentSave(payload)
.then(res => {
if (res.code === 1000) {
setUnsaved(false);
setTimeout(() => {
history.goBack();
}, 800);
} else {
setSubmitLoading(false);
}
})
.catch(() => {
setSubmitLoading(false);
});
};
const handleRemoveItem = (index: number) => {
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自定义渲染
const renderListTableRemove = (index: number) => (
<>
<a
onClick={() => handleEditReturnGood(index)}
style={{
marginRight: 20,
}}
>
编辑
</a>
<a
onClick={() => handleRemoveItem(index)}
style={{
color: '#ff4d4f',
}}
>
删除
</a>
</>
);
const beforeUpload = file => {
if (file.size / 1024 / 1024 > 20) {
message.warning('图片大小超过20M');
return Upload.LIST_IGNORE;
}
return Promise.resolve();
};
const handleGoodsConfirm = values => {
const preValues = addSchemaAction.getFieldValue('returnGoodsList');
const value = [];
values.forEach(item => {
const atom = {
id: item.id,
orderId: item.orderId,
orderNo: item.orderNo,
productId: item.productNo,
productName: item.name,
category: item.category,
brand: item.brand,
unit: item.unit,
purchasePrice: item.price,
purchaseCount: item.quantity,
purchaseAmount: +(item.price * item.quantity).toFixed(2),
payAmount: item.paidAmount,
type: item.type,
returnCount: '',
refundAmount: undefined,
extraData: {
id: item.id,
returnReason: '',
taskTypeKey: item.processKey,
remaining: new BigNumber(item.quantity).minus(item.returnCount || 0).toFixed(3), // 可退货数量
orderId: item.orderId,
},
isHasTax: item.tax,
taxRate: item.taxRate,
contractId: item.contractId,
contractNo: item.contractNo,
associated: !isMateriel ? '' : `${item.quotedProductNo}/${item.quotedName}/${item.quotedSpec || ' '}/${item.quotedCategory}/${item.quotedBrand}`,
associatedProductId: item.quotedProductNo || '',
associatedProductName: `${item.quotedName || ''}`,
associatedType: `${item.quotedSpec || ''}`,
associatedCategory: item.quotedCategory || '',
associatedBrand: item.quotedBrand || '',
associatedUnit: item.unit || '',
skuId: item.skuId,
skuPic: item.skuPic,
shopId: item.shopId,
shopLogo: item.shopLogo,
shopName: item.shopName,
};
value.push(atom);
});
// 先过滤掉 value 中没有,preValues 中有的数据
const concated = [...value, ...preValues.filter(item => value.find(val => val.extraData.id === item.extraData.id))];
const newData = concated.filter((item, index) => findLastIndex(concated, val => val.extraData.id === item.extraData.id) === index);
if (preValues.length) {
newData.reverse();
}
addSchemaAction.setFieldValue('returnGoodsList', newData);
};
const handleGoodsChange = values => {
setGoodsValue(values);
};
const handleEditReturnGood = index => {
const { getFieldValue } = addSchemaAction;
const returnGoodsListValue = getFieldValue('returnGoodsList');
const item = returnGoodsListValue[index];
const { extraData, ...rest } = item;
setApplyInfo({
index,
...rest,
payList: extraData.payList,
remaining: extraData.remaining,
returnReason: extraData.returnReason,
orderType: orderTypeValue,
});
setVisibleReturnInfoDrawer(true);
};
const handleReturnInfoSubmit = values => {
const { getFieldValue, setFieldValue, setFieldState } = addSchemaAction;
const { index } = applyInfo;
const newData = [...getFieldValue('returnGoodsList')];
newData.splice(index, 1, {
...newData[index],
returnCount: values.returnCount,
refundAmount: values.refundAmount,
extraData: {
...newData[index].extraData,
returnReason: values.returnReason,
payList: values.payList,
},
});
setFieldValue('returnGoodsList', newData);
addSchemaAction.clearErrors(`returnGoodsList.${index}.returnCount`);
addSchemaAction.clearErrors(`returnGoodsList.${index}.refundAmount`);
setVisibleReturnInfoDrawer(false);
};
// 采购商搜索
const handlePurchaserSearch = debounce((value: string) => {
if (!value) {
addSchemaAction.setFieldState('purchaser', (fieldState) => {
fieldState.props.enum = [];
});
return;
}
getMemberManageOrderAgentMembers({
name: value,
}).then((res) => {
if (res.code === 1000) {
addSchemaAction.setFieldState('purchaser', (fieldState) => {
fieldState.props.enum = res.data.map((item) => ({
label: `${item.name}/${item.memberTypeName}/${item.roleName}`,
value: item.id,
}));
fieldState.originData = res.data;
});
}
});
}, 300);
const OuterStatus = (
<StatusTag type={RETURN_OUTER_STATUS_TAG_MAP[detailInfo?.outerStatus]} title={detailInfo?.outerStatusName} />
);
const InnerStatus = (
<Badge color={RETURN_INNER_STATUS_BADGE_MAP[detailInfo?.innerStatus]} text={detailInfo?.innerStatusName} />
);
const schemaValue = useMemo(() => addSchema(orderTypeValue), [orderTypeValue]);
return (
<Spin spinning={false}>
<PageHeaderWrapper
style={{
padding: 24,
}}
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title="代客退货申请"
extra={[
<Button
key="1"
type="primary"
icon={<SaveOutlined />}
loading={submitLoading}
onClick={() => addSchemaAction.submit()}
>
保存
</Button>,
]}
>
<Card>
<NiceForm
value={detailInfo}
previewPlaceholder=" "
expressionScope={{
TableAddButton,
OuterStatus,
InnerStatus,
renderListTableRemove,
beforeUpload,
handlePurchaserSearch,
}}
components={{
ArrayTable,
AddressFormItem,
OrderNo,
}}
effects={($, actions) => {
const { setFieldState } = actions;
createEffects($, actions)
onFormInputChange$().subscribe(() => {
if (!unsaved) {
setUnsaved(true);
}
});
onFormInit$().subscribe(() => {
setFieldState('*(applyNo,outerStatus,innerStatus)', field => {
field.visible = false;
});
});
onFieldInputChange$('orderType').subscribe(fieldState => {
setOrderTypeValue(fieldState.value);
});
}}
onSubmit={handleSubmit}
actions={addSchemaAction}
schema={schemaValue}
/>
</Card>
<GoodsDrawer
title={!isMateriel ? '选择退货商品' : '选择退货物料'}
afterType={3}
visible={visibleGoodsDrawer}
fetchOrderList={getOrderList}
onClose={() => setVisibleGoodsDrawer(false)}
onConfirm={handleGoodsConfirm}
checked={goodsValue}
onChange={handleGoodsChange}
nestProps={{
NestColumns: [tableColumn, childTableColumn],
}}
orderType={orderTypeValue}
/>
<ReturnInfoDrawer
visible={visibleReturnInfoDrawer}
applyInfo={applyInfo}
onClose={() => setVisibleReturnInfoDrawer(false)}
onSubmit={handleReturnInfoSubmit}
isEdit
/>
<Prompt when={unsaved} message="您还有未保存的内容,是否确定要离开?" />
</PageHeaderWrapper>
</Spin>
);
};
export default ReturnValetApply;
/*
* @Author: XieZhiXiong
* @Date: 2021-12-02 19:01:08
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-12-02 19:01:08
* @Description:
*/
import { ISchema } from '@formily/antd';
import { UPLOAD_TYPE } from '@/constants';
import { DELIVERY_TYPE_ENUM } from '@/constants/afterService';
import { GlobalConfig } from '@/global/config';
import {
ORDER_TYPE_TENDER_CONTRACT,
ORDER_TYPE_POINTS,
ORDER_TYPE_CHANNEL_POINTS,
} from '@/constants/order';
import { getAuth } from '@/utils/auth';
import { isMaterialOrder } from '../../utils';
// 过滤积分订单,渠道积分订单
const orderTypeArr = GlobalConfig.web.orderType.map((item) => ({
label: item.platformWayName,
value: item.id,
})).filter((item) => (item.value !== ORDER_TYPE_POINTS && item.value !== ORDER_TYPE_CHANNEL_POINTS));
const userInfo = getAuth();
export const addSchema = (orderType: number): ISchema => {
const isMateriel = isMaterialOrder(orderType);
return {
type: 'object',
properties: {
REPOSIT_TABS: {
type: 'object',
'x-component': 'tab',
'x-component-props': {
type: 'card',
},
properties: {
'tab-1': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '基本信息',
},
properties: {
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 12,
labelAlign: 'left',
},
properties: {
applyAbstract: {
type: 'string',
title: '申请单摘要',
'x-rules': [
{
required: true,
message: '请填写申请单摘要',
},
{
limitByte: true, // 自定义校验规则
maxByte: 60,
}
],
},
purchaser: {
type: 'string',
title: '采购会员',
enum: [],
'x-component-props': {
showSearch: true,
defaultActiveFirstOption: false,
showArrow: false,
filterOption: false,
onSearch: '{{handlePurchaserSearch}}'
},
required: true,
},
supplierMember: {
type: 'string',
title: '供应会员',
default: userInfo.company,
editable: false,
},
orderType: {
type: 'string',
title: '售后订单类型',
enum: orderTypeArr,
'x-component-props': {
placeholder: '请选择',
},
required: true,
},
applyNo: {
type: 'string',
title: '申请单号',
'x-component': 'Text',
},
applyTime: {
type: 'string',
title: '单据时间',
'x-component': 'Text',
},
outerStatus: {
type: 'string',
title: '外部状态',
'x-component': 'Children',
'x-component-props': {
children: '{{OuterStatus}}'
},
},
innerStatus: {
type: 'string',
title: '内部状态',
'x-component': 'Children',
'x-component-props': {
children: '{{InnerStatus}}'
},
},
},
},
},
},
'tab-2': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '单据明细',
},
properties: {
MEGA_LAYOUT2: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
addBtn: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{TableAddButton}}',
},
},
returnGoodsList: {
type: 'array',
'x-component': 'ArrayTable',
'x-component-props': {
renderAddition: () => null,
renderRemove: '{{renderListTableRemove}}',
renderMoveDown: () => null,
renderMoveUp: () => null,
operationsWidth: 100,
operations: {
align: 'center',
},
},
'x-rules': [
{
required: true,
message: !isMateriel ? '请选择退货商品' : '请选择退货物料',
},
],
items: {
type: 'object',
properties: {
...(
!isMateriel
? ({
orderNo: {
type: 'string',
title: '订单号',
'x-component': 'OrderNo',
},
productId: {
type: 'string',
title: '商品ID',
'x-component': 'Text',
},
productName: {
type: 'string',
title: '商品名称',
'x-component': 'Text',
},
category: {
type: 'string',
title: '品类',
'x-component': 'Text',
},
brand: {
type: 'string',
title: '品牌',
'x-component': 'Text',
},
unit: {
type: 'string',
title: '单位',
'x-component': 'Text',
},
})
: ({
orderNo: {
type: 'string',
title: '订单号',
'x-component': 'OrderNo',
},
productId: {
type: 'string',
title: '物料编号',
'x-component': 'Text',
},
productName: {
type: 'string',
title: '物料名称、规格',
'x-component': 'Text',
},
category: {
type: 'string',
title: '品类',
'x-component': 'Text',
},
brand: {
type: 'string',
title: '品牌',
'x-component': 'Text',
},
associatedUnit: {
type: 'string',
title: '单位',
'x-component': 'Text',
},
associated: {
type: 'string',
title: orderType !== ORDER_TYPE_TENDER_CONTRACT ? '关联报价商品ID、名称、规格、品类、品牌' : '关联投标商品ID、名称、规格、品类、品牌',
'x-component': 'Text',
},
})
),
purchaseCount: {
type: 'string',
title: '采购数量',
'x-component': 'Text',
},
purchasePrice: {
type: 'string',
title: '采购单价',
'x-component': 'Text',
},
purchaseAmount: {
type: 'string',
title: '采购金额',
'x-component': 'Text',
},
...(
!isMateriel
? ({
payAmount: {
type: 'string',
title: '已支付金额',
'x-component': 'Text',
},
})
: ({})
),
returnCount: {
type: 'string',
title: '退货数量',
'x-component': 'Text',
'x-rules': [
{
required: true,
message: '请输入退货数量',
},
],
},
refundAmount: {
type: 'string',
title: '退款金额',
'x-component': 'Text',
'x-rules': [
{
required: true,
message: '请输入退款金额',
},
],
},
// 其他数据,不用于展示,只用于收集值
extraData: {
type: 'string',
display: false,
},
},
}
},
},
},
},
},
'tab-3': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '相关附件',
},
properties: {
MEGA_LAYOUT3: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
labelAlign: 'left',
},
properties: {
proofFileList: {
title: '附件',
'x-component': 'FixUpload',
'x-component-props': {
action: '/api/file/file/upload/prefix',
data: {
fileType: UPLOAD_TYPE,
prefix: '',
},
beforeUpload: '{{beforeUpload}}',
accept: '.xls, .xlsx, .doc, .docx, .wps, .pdf, .jpg, .png, .jpeg',
},
'x-rules': [
{
required: false,
message: '请上传附件',
},
],
description: '一次上传一个文件,每个附件大小不能超过20M',
},
},
},
},
},
'tab-4': {
type: 'object',
'x-component': 'tabpane',
'x-component-props': {
tab: '退货收货地址',
},
properties: {
MEGA_LAYOUT4: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 12,
labelAlign: 'left',
},
properties: {
deliveryType: {
title: '配送方式',
type: 'string',
enum: DELIVERY_TYPE_ENUM,
'x-component-props': {
placeholder: '请选择',
},
'x-rules': [
{
required: true,
message: '请选择配送方式',
},
],
},
// 退货发货地址
shippingAddress: {
title: '退货发货地址',
type: 'string',
visible: false,
'x-component': 'CustomAddressSelect',
'x-component-props': {
isDefaultAddress: true,
},
'x-rules': [
{
required: true,
message: '请选择退货发货地址',
},
],
},
// 退货自提地址
pickupAddress: {
title: '退货自提地址',
type: 'string',
visible: false,
'x-component': 'CustomAddressSelect',
'x-component-props': {
isDefaultAddress: true,
},
'x-rules': [
{
required: true,
message: '请选择退货自提地址',
},
],
},
},
},
},
},
},
},
},
};
};
\ No newline at end of file
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