/*
* 公司发票
* */

import React, { Component } from 'react';
import { Input, Form, Select, Modal, Button, DatePicker, Table, message, Tooltip, Card, Row, Col } from 'antd';
import { Util, dayFormat } from 'tools/index';
import { $http } from 'containers/config/https';
import '../style/index.less';
import moment from 'moment';

class ShowPrintCompantModal extends Component {

    constructor(props) {
        super(props);
        var date = new Date();
        var userData = JSON.parse(sessionStorage.getItem('userData'));
        this.state = {
        }
    }

    closeModal(name) {
        let { onHide } = this.props;
        onHide && onHide();
        this.cleanInput();
    }

    //清空输入框
    cleanInput() {
        this.setState({
            customerBankAccountNr: undefined,
            customerName: undefined,
            customerTaxNr: undefined,
            customerAddressTel: undefined,
        })
    }
    //提交
    onSubmit() {
        let { onSubmit } = this.props;
        if (Util.isEmpty(this.state.customerName)) {
            message.error('公司名称不能为空！')
            return
        }
        var params = {
            customerBankAccountNr: this.state.customerBankAccountNr,
            customerName: this.state.customerName,
            customerTaxNr: this.state.customerTaxNr,
            customerAddressTel: this.state.customerAddressTel,
        }
        onSubmit && onSubmit(params);
    }

    render() {

        return <div>
            <Modal
                title={'打印公司发票'}
                maskClosable={false}
                visible={this.props.isShow}
                onCancel={this.closeModal.bind(this)}
                onOk={this.onSubmit.bind(this)}
            >
                <div style={{ textAlign: 'right',paddingRight:40 }}>
                    <div><span style={{ color: '#f5222d', fontFamily: 'SimSun', marginLeft: '10%' }}>*</span>
                    公司名称：<Input placeholder='请输入公司名称' style={{ width: 270 }} onChange={Util.commonInputChange.bind(this, 'customerName')}
                            value={this.state.customerName} />
                    </div>
                    <div style={{marginTop:10}}>
                        税号：<Input placeholder='请输入税号' style={{ width: 270 }} onChange={Util.commonInputChange.bind(this, 'customerTaxNr')}
                            value={this.state.customerTaxNr} />
                    </div>
                    <div style={{marginTop:10}}>
                        公司地址及电话：<Input placeholder='请输入公司地址及电话' style={{ width: 270 }} onChange={Util.commonInputChange.bind(this, 'customerAddressTel')}
                            value={this.state.customerAddressTel} />
                    </div>
                    <div style={{marginTop:10}}>
                        开户行卡号：<Input placeholder='请输入开户行卡号' style={{ width: 270 }} onChange={Util.commonInputChange.bind(this, 'customerBankAccountNr')}
                            value={this.state.customerBankAccountNr} />
                    </div>
                </div>
            </Modal></div>
    }
}

export default Form.create()(ShowPrintCompantModal);