import React from "react"; import { Statistic, Button, message, Icon, Tooltip, Divider } from "antd"; import { withRouter, RouteComponentProps } from "react-router-dom"; import MainLayout from "@/layout"; import { AccountDetail } from "@/api/service/AccountService"; import { getOpenRechargeURL, getOpenWithdrawURL } from "@/shared/common/utils"; import { HTTP_STATUS } from "@/shared/common/constants"; import { OrderState } from "@/api/service/OrderService"; import Api from "@/api"; import "./index.scss"; type P = RouteComponentProps & {}; type S = { accountDetail: AccountDetail; }; // 订单中心 class Home extends React.Component
{
state = {
accountDetail: null
};
componentDidMount() {
this.getAccountDetail();
}
getAccountDetail = async () => {
const res = await Api.account.detail();
if (HTTP_STATUS.SUCCESSS === res.code) {
this.setState({
accountDetail: res.data
});
} else {
message.error(res.message);
}
};
//充值
handleRecharge = () => {
window.open(getOpenRechargeURL());
};
handleWithdraw = () => {
window.open(getOpenWithdrawURL());
};
goOrderPage = (state: OrderState) => {
console.log({ state });
this.props.history.push({
pathname: "/order",
state: {
orderState: state
}
});
};
render() {
const { accountDetail } = this.state;
return (