oak-pay-business/src/components/accountOper/pure/List.pc.tsx

38 lines
1.4 KiB
TypeScript

import { EntityDict } from "@project/oak-app-domain";
import { Avatar, List } from 'antd';
import dayjs from 'dayjs';
import { ToYuan, ThousandCont } from "oak-domain/lib/utils/money";
export default function Render(props: {
accountOpers: EntityDict['accountOper']['OpSchema'][];
t: (k: string) => string;
}) {
const { accountOpers, t } = props;
return (
<List
itemLayout="horizontal"
dataSource={accountOpers}
renderItem={(item, index) => {
const { $$createAt$$, type, totalPlus, availPlus } = item;
const plus = ToYuan(totalPlus || availPlus);
const sign = plus > 0 ? '+' : '';
const d = dayjs($$createAt$$ as number);
return (
<List.Item key={index}>
<List.Item.Meta
avatar={<Avatar>{t(`accountOper:v.type.${type}`).at(0)}</Avatar>}
title={t(`accountOper:v.type.${type}`)}
description={d.format('M月D日 HH时mm分')}
/>
<div style={{
fontSize: 'x-large',
color: sign ? 'gold' : 'rosybrown'
}}>
{sign}{ThousandCont(plus, 2)}
</div>
</List.Item>
);
}}
/>
)
}