import { Badge, Card, Descriptions, Divider, Table } from 'antd';
import React, { Component } from 'react';
import { Dispatch } from 'redux';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { connect } from 'dva';
import { BasicProfileDataType } from './data.d';
import styles from './style.less';
const progressColumns = [
{
title: '时间',
dataIndex: 'time',
key: 'time',
},
{
title: '当前进度',
dataIndex: 'rate',
key: 'rate',
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
render: (text: string) => {
if (text === 'success') {
return ;
}
return ;
},
},
{
title: '操作员ID',
dataIndex: 'operator',
key: 'operator',
},
{
title: '耗时',
dataIndex: 'cost',
key: 'cost',
},
];
interface BasicProps {
loading: boolean;
dispatch: Dispatch;
profileBasic: BasicProfileDataType;
}
interface BasicState {
visible: boolean;
}
@connect(
({
profileBasic,
loading,
}: {
profileBasic: BasicProfileDataType;
loading: {
effects: { [key: string]: boolean };
};
}) => ({
profileBasic,
loading: loading.effects['profileBasic/fetchBasic'],
}),
)
class Basic extends Component<
BasicProps,
BasicState
> {
componentDidMount() {
const { dispatch } = this.props;
dispatch({
type: 'profileBasic/fetchBasic',
});
}
render() {
const { profileBasic, loading } = this.props;
const { basicGoods, basicProgress } = profileBasic;
let goodsData: typeof basicGoods = [];
if (basicGoods.length) {
let num = 0;
let amount = 0;
basicGoods.forEach(item => {
num += Number(item.num);
amount += Number(item.amount);
});
goodsData = basicGoods.concat({
id: '总计',
num,
amount,
});
}
const renderContent = (value: any, row: any, index: any) => {
const obj: {
children: any;
props: { colSpan?: number };
} = {
children: value,
props: {},
};
if (index === basicGoods.length) {
obj.props.colSpan = 0;
}
return obj;
};
const goodsColumns = [
{
title: '商品编号',
dataIndex: 'id',
key: 'id',
render: (text: React.ReactNode, row: any, index: number) => {
if (index < basicGoods.length) {
return {text};
}
return {
children: 总计,
props: {
colSpan: 4,
},
};
},
},
{
title: '商品名称',
dataIndex: 'name',
key: 'name',
render: renderContent,
},
{
title: '商品条码',
dataIndex: 'barcode',
key: 'barcode',
render: renderContent,
},
{
title: '单价',
dataIndex: 'price',
key: 'price',
align: 'right' as 'left' | 'right' | 'center',
render: renderContent,
},
{
title: '数量(件)',
dataIndex: 'num',
key: 'num',
align: 'right' as 'left' | 'right' | 'center',
render: (text: React.ReactNode, row: any, index: number) => {
if (index < basicGoods.length) {
return text;
}
return {text};
},
},
{
title: '金额',
dataIndex: 'amount',
key: 'amount',
align: 'right' as 'left' | 'right' | 'center',
render: (text: React.ReactNode, row: any, index: number) => {
if (index < basicGoods.length) {
return text;
}
return {text};
},
},
];
return (
1000000000
已取货
1234123421
3214321432
付小小
18100000000
菜鸟仓储
浙江省杭州市西湖区万塘路18号
无
退货商品
退货进度
);
}
}
export default Basic;