import * as React from "react"; import { Button, Statistic, Divider, Table, message, Icon, Tooltip } from "antd"; import ContentView from "@/layout/ContentView"; import Query from "./query"; import { AccountDetail } from "@/api/service/AccountService"; import { defaultAccountDetail } from "../index"; import { HTTP_STATUS } from "@/shared/common/constants"; import { getOpenRechargeURL, getOpenWithdrawURL } from "@/shared/common/utils"; import MainLayout from "@/layout"; import { PaginationProps } from "antd/lib/pagination"; import { TradeTypeText } from "@/shared/common/constants"; import { TradeType } from "@/api/service/AccountService"; import moment from "moment"; import Api from "@/api"; import "../css/profile.scss"; type P = {}; type S = { entity: AccountDetail; dataSource: any[]; queryParams: object; pagination: PaginationProps; }; const Init_Page = { pageIndex: 1, pageSize: 10 }; class AccountProfile extends React.Component
{
state = {
entity: defaultAccountDetail,
dataSource: [],
queryParams: {},
pagination: {}
};
componentDidMount() {
this.initData();
}
initData = () => {
this.getList({ ...Init_Page });
this.getAccountDetail();
};
getAccountDetail = async () => {
const res = await Api.account.detail();
if (HTTP_STATUS.SUCCESSS === res.code) {
this.setState({
entity: res.data
});
} else {
message.error(res.message);
}
};
getList = async params => {
const res = await Api.account.queryDealStatement(params);
if (HTTP_STATUS.SUCCESSS === res.code) {
this.setState({
dataSource: res.data.data || []
});
} else {
message.error(res.message);
}
};
//充值
handleRecharge = () => {
window.open(getOpenRechargeURL());
};
handleWithdraw = () => {
window.open(getOpenWithdrawURL());
};
onSubmit = values => {
this.getList(Object.assign({}, values, Init_Page));
};
getTableProps = () => {
const { dataSource, pagination } = this.state;
const columns = [
{
title: "交易流水号",
dataIndex: "trxNo",
key: "trxNo"
},
{
title: "收入",
dataIndex: "income",
key: "income",
render: text => (
{text ? text : "--"}
)
},
{
title: "支出",
dataIndex: "expense",
key: "expense",
render: text => (
{text ? text : "--"}
)
},
{
title: "账户总金额",
dataIndex: "balance",
key: "balance"
},
{
title: "交易类型",
dataIndex: "tradeType",
key: "tradeType",
render: text => TradeTypeText[text]
},
{
title: "备注",
dataIndex: "remark",
key: "remark"
},
{
title: "交易时间",
dataIndex: "tradeTime",
key: "tradeTime",
render: time =>
time ? moment(time).format("YYYY-MM-DD hh:mm:ss") : "--"
}
];
return {
dataSource,
columns,
pagination
};
};
render() {
const { entity } = this.state;
return (
账户概况
收支明细