Commit 62bb59a7 authored by GuanHua's avatar GuanHua
parents 34b51b0b e3792e11
......@@ -6,8 +6,9 @@ import { CaretRightOutlined, CaretDownOutlined } from '@ant-design/icons'
export interface NestTableProps extends TableProps<any> {
/**
* 扁平化的递归嵌套类型, 后面一项永远为前一项的直系子集
* column 可以是函数,此时可以根据业务返回不同的 column
*/
NestColumns: ColumnsType<any>[],
NestColumns: (ColumnsType<any> | ((record?) => ColumnsType<any>))[],
// 指定获得的子集数据类型
childrenDataKey: string,
childPagination?: false | TablePaginationConfig,
......@@ -28,7 +29,7 @@ const NestTable: React.FC<NestTableProps> = (props) => {
const childRenderTable = useCallback((record) => {
return <Table
columns={childColumns}
columns={typeof childColumns !== 'function' ? childColumns : childColumns(record)}
size="middle"
dataSource={record[childrenDataKey] || []}
rowClassName={(_, index) => (index % 2) === 0 && "tb_bg"}
......@@ -40,7 +41,7 @@ const NestTable: React.FC<NestTableProps> = (props) => {
return (
<Table
columns={parentColumns}
columns={parentColumns as ColumnsType<any>}
dataSource={dataSource}
expandable={{
expandedRowRender: childRenderTable,
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-04 15:09:09
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-02-09 17:02:36
* @LastEditTime: 2021-02-19 15:03:36
* @Description: 维修商品抽屉组件
*/
import React, { useState, useEffect } from 'react';
......@@ -13,7 +13,13 @@ import BigNumber from 'bignumber.js';
import { ColumnType } from 'antd/lib/table/interface';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { PurchaseOrderOutWorkStateTexts, ORDER_TYPE2, PAYWAY, PAY_CHANNEL, PayOutWorkState } from '@/constants';
import {
PurchaseOrderOutWorkStateTexts,
ORDER_TYPE2,
PAYWAY,
PAY_CHANNEL,
PayOutWorkState,
} from '@/constants';
import NiceForm from '@/components/NiceForm';
import NestTable from '@/components/NestTable';
import { goodItem, OrderListParams, OrderListRes } from './interface';
......@@ -23,24 +29,40 @@ import { PublicApi } from '@/services/api';
const formActions = createFormActions();
const PAGE_SIZE = 10;
const PAGE_SIZE = 16;
interface GoodsDrawerProps {
// 选中值(子表格的值)
/**
* 选中值(子表格的值)
*/
checked: number[];
// 抽屉标题
/**
* 抽屉标题
*/
title?: string;
// 是否可见的
/**
* 是否可见的
*/
visible: boolean;
// 关闭事件
/**
* 关闭事件
*/
onClose: () => void;
// 确定事件
/**
* 确定事件
*/
onConfirm: (values: goodItem[]) => void;
// 选项改变事件
/**
* 选项改变事件
*/
onChange: (value: number[]) => void;
// 获取订单列表数据
/**
* 获取订单列表数据
*/
fetchOrderList: (params: any) => Promise<OrderListRes>;
// NestTableProps
/**
* NestTableProps
*/
nestProps?: {
[key: string]: any,
};
......@@ -48,11 +70,10 @@ interface GoodsDrawerProps {
* 是否展示检索框
*/
searchable?: boolean;
/**
* 流程类型:1.订单交易流程 2.售后换货流程 3.售后退货流程 4.售后维修流程
*/
type: 1 | 2 | 3 | 4,
afterType: 1 | 2 | 3 | 4,
};
interface GoodsDrawerState {
......@@ -213,7 +234,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
// 获取订单列表
getOrderList = async () => {
const { page, size, searchVal } = this.state;
const { fetchOrderList, type } = this.props;
const { fetchOrderList, afterType } = this.props;
if (!fetchOrderList) {
return;
......@@ -229,7 +250,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
let processEnumRes = { data: [], code: 0 };
// 售后退货、换货才涉及工作流相关
if (type === 2 || type === 3) {
if (afterType === 2 || afterType === 3) {
// 获取对应订单列表的工作流类型
const payload = [];
......@@ -241,7 +262,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
memberId: product.memberId,
memberRoleId: product.memberRoleId,
shopId: item.shopId,
type, // 流程类型
type: afterType, // 流程类型
};
payload.push(atom);
});
......@@ -286,6 +307,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
...product,
orderNo: item.orderNo,
payInfoList: item.payInfoList,
orderType: item.type,
});
}
});
......@@ -540,7 +562,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
// 过滤工作流不同的 商品
filterProductByProcessEnum = (data) => {
// 售后退货、换货才涉及工作流相关
if (this.props.type !== 2 && this.props.type !== 3) {
if (this.props.afterType !== 2 && this.props.afterType !== 3) {
return data;
}
const first = data.length ? data[0] : null;
......@@ -548,9 +570,10 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
if (!first) {
return [];
}
const filtered = data.filter(item => item.processEnum === first.processEnum);
// 过滤工作流不同的的商品,并且 订单类型不同的订单
const filtered = data.filter(item => item.processEnum === first.processEnum && item.orderType === first.orderType);
if (filtered.length !== data.length) {
message.warning('已过滤掉售后工作流不同的商品');
message.warning('已过滤掉 售后工作流不同 / 订单类型不同的 商品');
}
return filtered;
};
......
......@@ -12,7 +12,12 @@ import { createFormActions, FormEffectHooks } from '@formily/antd';
import { PublicApi } from '@/services/api';
import { GetAsReplaceGoodsPageReturnedGoodsResponseDetail } from '@/services/AfterServiceApi';
import { normalizeFiledata, FileData, isJSONStr } from '@/utils';
import { PurchaseOrderOutWorkStateTexts, ORDER_TYPE2 } from '@/constants';
import {
PurchaseOrderOutWorkStateTexts,
ORDER_TYPE2,
ORDER_TYPE2_POINTS,
ORDER_TYPE2_CHANNEL_POINTS,
} from '@/constants';
import ReutrnEle from '@/components/ReturnEle';
import StatusTag from '@/components/StatusTag';
import NiceForm from '@/components/NiceForm';
......@@ -131,54 +136,57 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
},
];
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: 'amount',
align: 'center',
render: (_, record) => (record.purchaseCount * record.price).toFixed(2),
},
{
title: '已换货数量',
dataIndex: 'replaceCount',
align: 'center',
},
];
const childTableColumn = (record): ColumnType<any>[] => {
const isPointsOrder = record.type === ORDER_TYPE2_POINTS || record.type === ORDER_TYPE2_CHANNEL_POINTS;
return [
{
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: !isPointsOrder ? '订单数量' : '兑换数量',
dataIndex: 'purchaseCount',
align: 'center',
},
{
title: !isPointsOrder ? '单价' : '所需积分',
dataIndex: 'price',
align: 'center',
},
{
title: !isPointsOrder ? '采购金额' : '所需积分小计',
dataIndex: 'amount',
align: 'center',
render: (_, record) => (record.purchaseCount * record.price).toFixed(2),
},
{
title: '已换货数量',
dataIndex: 'replaceCount',
align: 'center',
},
];
};
// 根据供应会员获取订单列表
const getOrderList = (params): Promise<OrderListRes> => {
......@@ -230,6 +238,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
outerTaskList,
replaceBatch,
replaceId,
orderType,
...rest
} = res.data;
......@@ -280,6 +289,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
remaining: item.purchaseCount || 0, // 已换货数量,这里取 采购数量判断即可
id: item.orderRecordId,
taskType,
orderType,
},
})),
...rest,
......@@ -299,6 +309,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
setInfoLoading(true);
PublicApi.getOrderProcurementOrderDetails({
id: `${orderId}`,
orderNo: '',
})
.then(res => {
if (res.code === 1000) {
......@@ -450,6 +461,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
...rest,
})),
taskType: replaceGoodsList[0].extraData.taskType,
orderType: replaceGoodsList[0].extraData.orderType,
};
PublicApi.postAsReplaceGoodsSave(payload)
......@@ -519,6 +531,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
remaining: item.purchaseCount - (item.replaceCount || 0), // 可换货数量
id: item.id,
taskType: item.processEnum,
orderType: item.orderType,
},
};
value.push(atom);
......@@ -621,7 +634,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
<GoodsDrawer
title="选择换货商品"
type={2}
afterType={2}
visible={visibleGoodsDrawer}
fetchOrderList={getOrderList}
onClose={() => setVisibleGoodsDrawer(false)}
......
......@@ -460,7 +460,7 @@ const RepairForm: React.FC<BillsFormProps> = ({
</Card>
<GoodsDrawer
type={4}
afterType={4}
visible={visibleDrawer}
fetchOrderList={getOrderList}
onClose={() => setVisibleDrawer(false)}
......
......@@ -48,6 +48,9 @@ const ReturnAddressInfo = React.lazy(() => import('../../../components/ReturnAdd
const Score = React.lazy(() => import('../../../components/Score'));
const FlowRecords = React.lazy(() => import('../../../components/FlowRecords'));
export interface DetailInfoData extends GetAsReturnGoodsGetDetailByConsumerResponse {
fileList: FileData[];
};
interface DetailInfoProps {
/**
* 记录id
......@@ -64,10 +67,7 @@ interface DetailInfoProps {
/**
* 头部右侧拓展
*/
headExtra?: (info: DetailInfo) => React.ReactNode;
};
interface DetailInfo extends GetAsReturnGoodsGetDetailByConsumerResponse {
fileList: FileData[];
headExtra?: (info: DetailInfoData) => React.ReactNode;
};
const DetailInfo: React.FC<DetailInfoProps> = ({
......@@ -76,7 +76,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
target,
headExtra = null,
}) => {
const [detailInfo, setDetailInfo] = useState<DetailInfo>(null);
const [detailInfo, setDetailInfo] = useState<DetailInfoData>(null);
const [returnGoodsList, setReturnGoodsList] = useState<GetAsReturnGoodsPageReturnedGoodsResponse>({ data: [], totalCount: 0 });
const [returnGoodsLoading, setReturnGoodsLoading] = useState(false);
const [infoLoading, setInfoloading] = useState(false);
......
import React, { useState } from 'react';
import { Button } from 'antd';
/*
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-02-19 11:21:59
* @Description:
*/
import React from 'react';
import { Button, Modal } from 'antd';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { FormOutlined } from '@ant-design/icons';
import { FormOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from '../components/DetailInfo';
import { REFUND_OUTER_STATUS_RECEIVED } from '../../constants';
import DetailInfo, { DetailInfoData } from '../components/DetailInfo';
const { confirm } = Modal;
const ReturnPrConfirmResultVerify: React.FC = () => {
const { id } = usePageStatus();
const [submitLoading, setSubmitLoading] = useState(false);
const handleSubmit = values => {
if (!id) {
return;
}
setSubmitLoading(true);
PublicApi.postAsReturnGoodsConfirmAllRefund({
dataId: id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
}
}).finally(() => {
setSubmitLoading(false);
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `是否本单所有退款确认到账?`,
onOk() {
return PublicApi.postAsReturnGoodsConfirmAllRefund({
dataId: id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
}
});
},
});
};
......@@ -30,16 +43,24 @@ const ReturnPrConfirmResultVerify: React.FC = () => {
<>
<DetailInfo
id={id}
headExtra={() => (
<Button
type="primary"
icon={<FormOutlined />}
loading={submitLoading}
onClick={handleSubmit}
>
确认本单所有退款到账
</Button>
)}
headExtra={(info: DetailInfoData) => {
const { refundList = [] } = info || {};
// 是否全部已退款,只有当退款明细中所有退款金额大于0的记录的状态都为确认退款到账时本按钮才可点击
const isAllRefunded = refundList.every((item) => item.detailList.every((detail) => detail.refundAmount > 0 && detail.outerStatus === REFUND_OUTER_STATUS_RECEIVED));
return [
isAllRefunded ? (
<Button
type="primary"
icon={<FormOutlined />}
onClick={handleSubmit}
key="confirmAllRefunded"
>
确认本单所有退款到账
</Button>
) : null,
]
}}
target="/memberCenter/afterService/returnApplication/returnPrConfirmResult"
isEdit
/>
......
......@@ -681,7 +681,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
<GoodsDrawer
title="选择退货商品"
type={3}
afterType={3}
visible={visibleGoodsDrawer}
fetchOrderList={getOrderList}
onClose={() => setVisibleGoodsDrawer(false)}
......
......@@ -67,6 +67,7 @@ const AddBrand: React.FC<{}> = () => {
const [formValues, setFormValues] = useState<any>({})
const [banSomeField, setBanSomeField] = useState<boolean>(false)
const [isDisabledSave, setIsDisabledSave] = useState<boolean>(false)
const [isDisabledCheck, setDisabledCheck] = useState<boolean>(false)
useEffect(()=>{
const { id } = history.location.query
......@@ -153,7 +154,9 @@ const AddBrand: React.FC<{}> = () => {
}
const handleApplyCheck = () => {
setDisabledCheck(true)
PublicApi.postProductBrandApplyCheckBrand({id: responseId}).then(res=>{
setDisabledCheck(false)
setCurrentStep(1)
setTimeout(() => {
history.goBack()
......@@ -183,7 +186,7 @@ const AddBrand: React.FC<{}> = () => {
backIcon={<ReutrnEle description="返回"/>}
title={history.location.query?.id?'修改品牌':'新建品牌'}
extra={[
<Button key="2" disabled={isEnableCheck} onClick={handleApplyCheck}>直接提交审核</Button>,
<Button key="2" disabled={isEnableCheck} onClick={handleApplyCheck} disabled={isDisabledCheck}>直接提交审核</Button>,
<Button icon={<SaveOutlined />} key="1" type="primary" onClick={handleSave} disabled={isDisabledSave}>
保存
</Button>,
......
......@@ -233,7 +233,7 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
}
})
// FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(state => {
// searchCustomerCategoryOptionEffect(actions, 'customerCategoryId')
// searchCustomerCategoryOptionEffect(schemaAction, actions, 'customerCategoryId')
// })
actions.setFieldState('brandId', state => {
state.props['x-component-props'].queryParams = {
......
......@@ -356,11 +356,18 @@ export const useOrderUpdateChangeOther = (ctx: ISchemaFormActions | ISchemaFormA
}
// 高级筛选schema中用于输入搜索商品品类的Effect
export const searchCustomerCategoryOptionEffect = (context: any, fieldName: string) => {
context.getFieldState(fieldName, state => {
PublicApi.getProductCustomerGetCustomerCategoryTree().then(res => {
context.setFieldState(fieldName, state => {
/**
* @param ctx 外部表单action
* @param mctx 模态框表单action
* @param fieldName 字段名称
*/
export const searchCustomerCategoryOptionEffect = (ctx: any, mctx: any, fieldName: string) => {
let params: any = {}
params['memberId'] = ctx.getFieldValue('supplyMembersId')
params['memberRoleId'] = ctx.getFieldValue('supplyMembersRoleId')
mctx.getFieldState(fieldName, state => {
PublicApi.getProductSelectGetMemberCategory(params).then(res => {
mctx.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data
})
})
......
......@@ -194,7 +194,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}, [])
const handleSubmit = async (value) => {
console.log(value, 'value', addSchemaAction.getFieldValue("orderProductRequests"))
let _orderProductRequests = JSON.parse(JSON.stringify(value.orderProductRequests))
let processEnum = value['processEnum']
let usingElectronicContracts = value['usingElectronicContracts']
......
......@@ -131,9 +131,12 @@ const basicInfo: ISchema = {
orderThe: {
type: 'string',
title: '订单摘要',
required: true,
"x-rules": [
{
required: true,
message: '请输入订单摘要'
},
{
limitByte: true,
maxByte: 60
}
......
import React, { useRef } from 'react'
import { Button } from 'antd'
import { baseOrderListColumns } from '../../constant'
import { history } from 'umi'
import { PublicApi } from '@/services/api'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import { PurchaseOrderInsideWorkState, SaleOrderInsideWorkState } from '@/constants'
// 业务hooks
export const useSelfTable = () => {
const ref = useRef<any>({})
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({customKey: 'id'})
const handleSubmit = async (record) => {
if (record.interiorState === PurchaseOrderInsideWorkState.FILLING_ORDER) {
history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyFileOrder/detail?id=${record.id}`)
}
}
const secondColumns: any[] = baseOrderListColumns.concat([
{
title: '操作',
align: 'center',
dataIndex: 'ctl',
key: 'ctl',
render: (text, record) => <>
{
record.interiorState === PurchaseOrderInsideWorkState.FILLING_ORDER &&
<Button type='link' onClick={() => handleSubmit(record)}>归档</Button>
}
</>
}
])
return {
columns: secondColumns,
ref,
rowSelection,
rowSelectionCtl
}
}
import React, { useRef } from 'react'
import { Button } from 'antd'
import { baseOrderListColumns } from '../../constant'
import { history } from 'umi'
import { PublicApi } from '@/services/api'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import { PurchaseOrderInsideWorkState, SaleOrderInsideWorkState } from '@/constants'
// 业务hooks
export const useSelfTable = () => {
const ref = useRef<any>({})
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({customKey: 'id'})
const handleSubmit = async (record) => {
if (record.interiorState === PurchaseOrderInsideWorkState.FILLING_ORDER) {
history.push(`/memberCenter/tranactionAbility/purchaseOrder/readyFileOrder/detail?id=${record.id}`)
}
}
const secondColumns: any[] = baseOrderListColumns.concat([
{
title: '操作',
align: 'center',
dataIndex: 'ctl',
key: 'ctl',
render: (text, record) => <>
{
record.interiorState === PurchaseOrderInsideWorkState.FILLING_ORDER &&
<Button type='link' onClick={() => handleSubmit(record)}>归档</Button>
}
</>
}
])
return {
columns: secondColumns,
ref,
rowSelection,
rowSelectionCtl
}
}
......@@ -62,7 +62,7 @@ export const useSelfTable = () => {
key: 'sumPrice',
render: (t, r) => r.type === 7 || r.type === 8 ? t : '¥' + t
},
{ title: '已货批次', align: 'center', dataIndex: 'shipmentBatch', key: 'shipmentBatch', render: text => text ? `第${text}次` : '' },
{ title: '已货批次', align: 'center', dataIndex: 'shipmentBatch', key: 'shipmentBatch', render: text => text ? `第${text}次` : '' },
// @todo 收货单号跳转
{
title: '入库单号',
......
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