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 electronics_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: 2,
};
}
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 = (
,
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: 2,
});
}
};
//传递方法到子组件
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: 2,
});
};
// 点击开始和结束时间显示时间选择器
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,
});
};
}