import React, {Component} from 'react'; import { View, TouchableOpacity, Text, TextInput, ScrollView, SafeAreaView, } from 'react-native'; import { Drawer, List, Picker, Provider, Tabs, WhiteSpace } from "@ant-design/react-native"; import DateTimePicker from '@react-native-community/datetimepicker'; import Invoice_inquiry_ongoing from './invoice_inquiry_ongoing'; import Invoice_inquiry_completed from './invoice_inquiry_completed'; import Invoice_inquiry_all from './invoice_inquiry_all'; import public_css from '../../../source/css/public_css'; import invoice_inquiry_css from './invoice_inquiry_css'; import {GetDateString} from '../../../utils/date'; export default class paper_major_invoice extends Component { constructor(props) { super(props); this.props.navigation.dangerouslyGetParent().setOptions({ tabBarVisible: false, }); this.state = { isShowSearch: false, visible1: false, tab: 0, clickNum: 0, invoiceStatus: null, beginDateTime: undefined, endDateTime: undefined, customerName: '', customerEntTaxId: '', invoiceCode: '', invoiceNumber: '', beginDate: new Date(), beginDateText: '开始时间', endDate: new Date(), endDateText: '结束时间', beginDateShow: false, endDateShow: false, invoiceCategory: 4, }; } render() { const tabs = [{title: '全部'}, {title: '开票中'}, {title: '开票成功'}]; const seasons = [ [ { label: '全部', value: null, }, { label: '正数开具成功', value: 3, }, { label: '负数开具成功', value: 4, }, { label: '正数已作废', value: 5, }, { label: '负数已作废', value: 6, }, { label: '空白作废', value: 7, }, ], ]; let draw = ( this.invoiceStatusChange(select)} cascade={false}> 发票状态: 时间区间 { this.isShowDateSelect(1); }}> {this.state.beginDateText} { this.isShowDateSelect(2); }}> {this.state.endDateText} {this.state.beginDateShow === true ? ( { this.beginDateChange(event, date); }} /> ) : ( )} {this.state.endDateShow === true ? ( { this.endDateChange(event, date); }} /> ) : ( )} 客户名称: { this.setState({ customerName: value, }); }} /> 客户企业税号: { this.setState({ customerEntTaxId: value, }); }} /> 发票代码: { this.setState({ invoiceCode: value, }); }} /> 发票号码: { console.log(value); this.setState({ invoiceNumber: value, }); }} /> { this.searchDataEmpty(); }}> 重置 this.submitData()}> 查询 ); return ( (this.drawer = el)} onOpenChange={(open) => this.openStatus(open)} drawerBackgroundColor="#ccc" drawerWidth={300}> this.onChanges(i, l)} page={0}> ); } //判断是否点击了查询 shouldComponentUpdate( nextProps: Readonly

, nextState: Readonly, nextContext: any, ): boolean { if (nextProps.route.params !== undefined) { if (nextProps.route.params.isShow) { if (this.state.clickNum === 0) { this.setState({ isShowSearch: true, clickNum: this.state.clickNum++, }); this.drawer.openDrawer(); this.props.navigation.setParams({ isShow: false, }); } } } return true; } //tab变化事件 onChanges = (i, l) => { if (this.state.tab !== l) { this.setState({ tab: l, clickNum: 0, invoiceStatus: null, beginDate: new Date(), beginDateText: '开始时间', endDate: new Date(), endDateText: '结束时间', beginDateShow: false, endDateShow: false, customerName: '', customerEntTaxId: '', invoiceCode: '', invoiceNumber: '', invoiceCategory: 4, }); } }; //传递方法到子组件 getOnGoingRef = (ref) => { this.goingChild = ref; }; //传递方法到子组件 getCompletedRef = (ref) => { this.completedChild = ref; }; //传递方法到子组件 getAllRef = (ref) => { this.allChild = ref; }; //查询菜单开关状态 openStatus = (open) => { if (open) { } else { // this.props.children.setClickNum(); } }; // 发票状态选择 invoiceStatusChange = (data) => { let status = ''; if (data.length > 0) { status = data[0]; } this.setState({ invoiceStatus: status, }); }; //查询 submitData = () => { let tab = this.state.tab; if (tab === 0) { this.drawer.closeDrawer(); this.allChild.initData(); } if (tab === 1) { this.drawer.closeDrawer(); this.goingChild.initData(); } if (tab === 2) { this.drawer.closeDrawer(); this.completedChild.initData(); } }; //清空查询数据 searchDataEmpty = () => { this.setState({ invoiceStatus: null, beginDate: new Date(), beginDateText: '开始时间', endDate: new Date(), endDateText: '结束时间', beginDateShow: false, endDateShow: false, customerName: '', customerEntTaxId: '', invoiceCode: '', invoiceNumber: '', invoiceCategory: 4, }); }; // 点击开始和结束时间显示时间选择器 isShowDateSelect = (dateStatus) => { // 开始时间和结束时间选择器显示 1:开始时间 2:结束时间 if (dateStatus === 1) { this.setState({ beginDateShow: true, }); } else { this.setState({ endDateShow: true, }); } }; // 获取开始时间 beginDateChange = (event, date) => { let dateText = GetDateString(date); this.setState({ beginDate: date, beginDateShow: false, beginDateText: dateText, }); }; //获取结束时间 endDateChange = (event, date) => { let dateText = GetDateString(date); this.setState({ endDate: date, endDateShow: false, endDateText: dateText, }); }; }