import React, {Component} from 'react'; import { View, Image, Text, SafeAreaView, ScrollView, } from 'react-native'; import {Tabs, WingBlank, WhiteSpace} from '@ant-design/react-native'; import public_css from '../../source/css/public_css'; import {RetrieveData} from '../../data/storage'; import {RequestNetwork} from '../../data/encryption'; export default class home_amount_statistics extends Component { constructor(props) { super(props); this.props.navigation.dangerouslyGetParent().setOptions({ tabBarVisible: false, }); this.state = { tab: 0, clickNum: 0, statisticsData: {}, nowDate: '', }; } render() { const tabs = [{title: '本月'}, {title: '本季'}]; return ( {this.state.nowDate} {/**/} {/* 本月开票总数*/} {/**/} {/**/} {/* 235*/} {/**/} 开票总额(元) {this.state.statisticsData.monthTotal} 税额(元) {this.state.statisticsData.monthTotalTaxes} this.onChanges(i, l)} page={0}> 未税金额 累计成功开票未税金额(元) {this.state.statisticsData.monthTotal} 专票开票未税金额(元) {this.state.statisticsData.monthZhuanpiaoTotal} 普票开票未税金额(元) {this.state.statisticsData.monthPupiaoTotal} 累计税额 累计开票税额(元) {this.state.statisticsData.monthTotalTaxes} 专票开票税额(元) {this.state.statisticsData.monthZhuanpiaoTotalTaxes} 普票开票税额(元) {this.state.statisticsData.monthPupiaoTotalTaxes} 未税金额 累计成功开票未税金额(元) {this.state.statisticsData.quarterTotal} 专票开票未税金额(元) {this.state.statisticsData.quarterZhuanpiaoTotal} 普票开票未税金额(元) {this.state.statisticsData.quarterPupiaoTotal} 累计税额 累计开票税额(元) {this.state.statisticsData.quarterTotalTaxes} 专票开票税额(元) {this.state.statisticsData.quarterZhuanpiaoTotalTaxes} 普票开票税额(元) {this.state.statisticsData.quarterPupiaoTotalTaxes} ); } componentDidMount() { this.getNowDate(); this.getInvoiceStatistics(); } //获取统计数据 getInvoiceStatistics = async () => { const company = JSON.parse(await RetrieveData('company')); const token = await RetrieveData('token'); if (token && company) { const url = '/sys/stat/toInvoice'; let response = await RequestNetwork( url, token, { entTaxId: company.entTaxId, }, false, 2, ); if (response) { console.log(response); if (response.code === 0) { this.setState({ statisticsData: response.data, }); } else { // await this.abnormalMessage(response); } } } }; // 获取当前年月 getNowDate = () => { let now = new Date(); //当前日期 let nowMonth = now.getMonth(); //当前月 let nowYear = now.getFullYear(); //当前年 let monthStartDate = new Date(nowYear, nowMonth, 1); let yy = monthStartDate.getFullYear(); let mm = monthStartDate.getMonth() + 1 < 10 ? '0' + (monthStartDate.getMonth() + 1) : monthStartDate.getMonth() + 1; this.setState({ nowDate: yy + '年' + mm + '月', }); }; //tab变化事件 onChanges = (i, l) => { this.getInvoiceStatistics(); }; }