import React, { Component } from "react"; import { connect } from "dva"; import { withRouter } from 'dva/router'; import { setCompanyInvoiceTaxrate, getCompanyVnvoiceInfo } from '../../../services/api'; import $modal from '../../../utils/modal'; import { InvoiceTaxRate } from '../../../utils/regs'; import { Tabs, Alert, Input, Button, Form, notification } from "antd"; const { TabPane } = Tabs; @Form.create() @connect(state => ({ profile: state.profile })) @withRouter export default class Messages extends Component { constructor(props, context) { super(props, context); this.state = { invoiceInfo: null }; } componentDidMount() { getCompanyVnvoiceInfo({}).then(res => { this.setState({ invoiceInfo: res.data }); }); } _submitTaxRate = (e) => { e.preventDefault(); this.props.form.validateFields((err, values) => { if(err) return; setCompanyInvoiceTaxrate(values).then(res => { if(res.data == '0') { $modal( '企业还未设置发票信息,请访问企业信息页面进行完善', '', [{ text: '去完善', type: 'primary', onPress: () => { this.props.history.push('/enterprise/company'); } }] ); }else { notification.info({ message: res.msg }); } }).catch(err => { notification.info({ message: err.msg }); }); }); } render() { const { getFieldDecorator } = this.props.form; return (