import React,{Component} from "react";
import {message, Modal, Table} from "antd";
import $ from "jquery/src/ajax";

class ReminderLog extends Component{
    constructor(props) {
        super(props);
        this.state={
            dataSource:[],
            columns:[],
        }
        this.loadData = this.loadData.bind(this);
    }

    componentDidMount() {
        this.loadData();
    }

    loadData() {
        this.setState({
            loading: true,
        });
        $.ajax({
            method: "get",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + "/api/admin/company/selectPaymentList",
            data: {},
            success: function (data) {
                if(data.error.length === 0){
                    this.setState({
                        columns: [],
                    });
                }else{
                    message.warning(data.error[0].message);
                }
            }.bind(this),
        }).always(
            function () {
                this.setState({
                    loading: false,
                });
            }.bind(this)
        );
    }

    render() {
        return (
            this.props.visible ? <Modal
                title='提醒日志'
                className='payRecordComponent'
                width={800}
                maskClosable={false}
                footer={null}
                visible={this.props.visible}
                onCancel={this.props.onCancel}
            >
                <Table
                    columns={this.state.columns}
                    dataSource={this.state.dataSource}
                    pagination={false}
                    bordered
                    size="small"
                />
            </Modal> : null
        );
    }
}

export default ReminderLog;
