import React, { Component } from "react"; import { withRouter } from 'dva/router'; import { connect } from "dva"; import TabInfo from './TabInfo'; import Invoicedrawer from './Invoicedrawer'; import ReadDrawer from './ReadDrawer'; import styles from './detail.less'; import { gup } from '../../../utils/utils'; import $modal from '../../../utils/modal'; import { getBizInvoiceMakeInfo, getBizInvoiceInfo, // systemComVaseInfoGet, confirmBizInvoiceInfo, updateBizInvoiceTax } from '../../../services/api'; import { Alert, Breadcrumb, Button, notification } from "antd"; @connect(state => ({ global: state.global })) @withRouter export default class Messages extends Component { constructor(props, context) { super(props, context); this.state = { forceUpdate: false, pageParm: { pageSize: '10', pageNumber: '1' }, comBizInvoiceId: gup('comBizInvoiceId'), info: null, //上部分表格信息内容 makeInfo: null, //开票信息(查看抽屉内容) tableInit: false, confirmStatus: true, //我方是否已确认 invoiceVisible: false, //设置发票 invoicedrawerBtnDisable: false, //设置发票确定按钮的disable subFun: null, readDrawerVisibale: false, //查看发票 }; } componentDidMount() { // test_api({"trackid":"1","videostate":0}); this._initPageInfo(); } _initPageInfo = async () => { const { comBizInvoiceId } = this.state; // 获取开票信息(查看抽屉内容) const makeInfoRes = await getBizInvoiceMakeInfo({ comBizInvoiceId }); const makeInfo = makeInfoRes.data || null; // (1,纸质普票,2纸质专票,3电子发票) if (makeInfo) { let type = ''; switch (makeInfo.bizInvoiceMakeType + '') { case '1': type = '纸质普票'; break; case '2': type = '纸质专票'; break; case '3': type = '电子发票'; } let makeStatusStr = ''; switch (makeInfo.makeStatus) { case '0': makeStatusStr = '未开票'; break; case '1': makeStatusStr = '已开票'; break; case '2': makeStatusStr = '开票中'; } makeInfo.bizInvoiceMakeTypeStr = type; makeInfo.makeStatusStr = makeStatusStr; } // 获取发票详情信息 const InvoiceInfo = await getBizInvoiceInfo({ comBizInvoiceId }); // 通过id和状态来区分我方开票状态 const { bizInvoiceType, // drawerComId, // receiverComId, drawerConfirm, receiverConfirm } = InvoiceInfo.data; this.setState({ info: InvoiceInfo.data, makeInfo }); // let { comId } = this.props.global.companyInfo; // // 获取到公司id // if (!comId) { // const comInfo = await systemComVaseInfoGet({}); // comId = comInfo.data.comId; // } // // 我方是否已经确认 false为未确认 true为已确认 let confirmStatus = true; // switch (comId) { // // 我方为开票方 // case drawerComId: // if (drawerConfirm == '1') { // confirmStatus = true; // } // break; // // 我方为收票方 // case receiverComId: // if (receiverConfirm == '1') { // confirmStatus = true; // } // } switch (bizInvoiceType) { //1我方开, 2我方收 // 我方为开票方 case '1': confirmStatus = drawerConfirm == '1'; break; case '2': confirmStatus = receiverConfirm == '1'; } this.setState({ confirmStatus }); } _closeInvoice = () => { this.setState({ invoiceVisible: false }); } render() { const { info, makeInfo } = this.state; return (
{ this.props.history.goBack() }}>业务开票 开票明细 1、系统汇总交易月份内发生的企业收入或支出的所有业务数据;
2、开票方确认发票数据后,收票方才能确认;双方确认即表示已核对对账数据及开票数据;
3、重新计算税额:若您调整了企业税额,可对未确认的开票明细重新计算税额。
} type="warning" showIcon style={{ marginBottom: '15px' }} /> { this.state.info &&
交易月份 {info.bizMonths} 类型 { info.bizInvoiceType == 1 ? 我方应开 : 我方应收 } 开票方确认 { info.drawerConfirm == 0 ? 未确认 : 已确认 } 收票方确认 { info.receiverConfirm == 0 ? 未确认 : 已确认 }
购方名称 {info.receiver} 税号 {info.receiverTFN} 商品名称 {info.product}
商品数量 {info.counts} 单位 {info.spec} 单价(元) {Number(info.atSingleAmount).toFixed(6)} 金额(元) {Number(info.atAmount).toFixed(2)}
税率 {info.taxRate + '%'} 税额(元) {Number(info.taxAmount).toFixed(2)} 价税合计(元) {Number(info.sumAmount).toFixed(2)} { makeInfo && makeInfo.bizInvoiceMakeTypeStr && '发票类型' } { makeInfo && makeInfo.bizInvoiceMakeTypeStr &&
{ `${makeInfo.bizInvoiceMakeTypeStr}(${makeInfo.makeStatusStr})` } { this.setState({ readDrawerVisibale: true }); }}> 开票信息
}
}
{/* 我方未确认的时候才能点击 */} { // 我方应收的时候不展示计算税额的按钮 this.state.info && this.state.info.bizInvoiceType == 1 && }
{ this.setState({ subFun: fun }) }} > { this.setState({ readDrawerVisibale: false }); }} /> ); } }