import React, {Component} from 'react';
import {
View,
TouchableOpacity,
Image,
Text,
SafeAreaView,
FlatList,
ActivityIndicator,
Alert,
RefreshControl,
} from 'react-native';
import {
DatePicker,
Drawer,
List,
Provider,
WingBlank,
SwipeAction,
Picker,
WhiteSpace,
} from '@ant-design/react-native';
import public_css from '../../source/css/public_css';
import {RetrieveData} from '../../data/storage';
import {RequestNetwork} from '../../data/encryption';
import {GetMonthDate, GetDateString} from '../../utils/date';
import {ToastShow} from '../../components/toast/toast';
import {InvoiceType, ApplicationStatus} from '../../utils/config';
import {CleanAll} from '../../components/abnormalMessage/abnormal_message';
import Spinner from 'react-native-loading-spinner-overlay';
import loading_css from '../../source/css/loading_css';
export default class application_info extends Component {
constructor(props) {
super(props);
this.props.navigation.dangerouslyGetParent().setOptions({
tabBarVisible: false,
});
this.state = {
isShowSearch: false,
beginDate: '',
endDate: '',
beginDateString: '',
endDateString: '',
invoiceList: [],
isRefreshing: false,
pageNum: 1, //当前页码
pageSize: 10, //每页数量
totalPage: 10, //总页数
showFoot: 0,
monthDate: {},
invoiceTypeList: InvoiceType(),
invoiceType: '1',
applicationStatusList: ApplicationStatus(),
applicationStatus: '0',
spinner: false,
isNextPage: false, // 是否有下一页
isPreviousPage: false, // 是否有上一页
};
}
render() {
let draw = (
,
nextState: Readonly,
nextContext: any,
): boolean {
if (nextProps.route.params != undefined) {
if (nextProps.route.params.isShow) {
this.setState({
isShowSearch: true,
});
this.drawer.openDrawer();
this.props.navigation.setParams({
isShow: false,
});
}
}
return true;
}
// 获取发票申领列表
getApplicationList = async () => {
const company = JSON.parse(await RetrieveData('company'));
const token = await RetrieveData('token');
const account = await RetrieveData('account');
if (token && account) {
const url = '/sys/invoicePurchase/statusInfos';
let response = await RequestNetwork(
url,
token,
{
entTaxId: company.entTaxId,
deviceType: company.defaultDeviceInfo.deviceType,
taxDiscId: company.defaultDeviceInfo.taxDiscId,
invoiceCategory: this.state.invoiceType,
applyDateBegin: this.state.beginDateString,
applyDateEnd: this.state.endDateString,
handleStatus: this.state.applicationStatus,
pageNum: this.state.pageNum,
pageSize: this.state.pageSize,
mobile: account,
},
false,
2,
);
if (response) {
if (response.code === 0) {
this.setState({
isNextPage: response.data.hasNext,
isPreviousPage: response.data.hasPrv,
});
this.setLoadingStatus(false);
if (response.data.statusInfoVOs.length > 0) {
this.setState({
isRefreshing: false,
totalPage: response.data.statusInfoVOs.length,
});
this.setList(response.data.statusInfoVOs);
} else {
this.setState({
showFoot: 0,
isRefreshing: false,
});
}
} else {
this.setLoadingStatus(false);
await this.abnormalMessage(response);
}
}
}
};
//设置抬头列表
setList = (data) => {
let listData = data.map((_, i) => ({
key: data[i].applySerialNumber,
invoiceKindCode: data[i].invoiceKindCode,
invoiceKindName: data[i].invoiceKindName,
invoiceCateCode: data[i].invoiceCateCode,
invoiceCateName: data[i].invoiceCateName,
applyNum: data[i].applyNum,
applyDate: data[i].applyDate,
handleStatus: data[i].handleStatus,
handleInformation: data[i].handleInformation,
resultEnterFlag: data[i].resultEnterFlag,
details: data[i].details,
}));
let list = this.state.invoiceList.concat(listData);
let showFoot = 0;
if (this.state.isNextPage) {
showFoot = 2;
}
this.setState({
invoiceList: list,
showFoot: showFoot,
});
};
//查询菜单开关状态
openStatus = (open) => {
if (open) {
} else {
// this.props.children.setClickNum();
}
};
//获取查询开始时间
beginTimeChange = (time) => {
let date = GetDateString(time);
this.setState({
beginDate: time,
beginDateString: date,
});
};
//获取查询结束时间
endTimeChange = (time) => {
let date = GetDateString(time);
this.setState({
endDate: time,
endDateString: date,
});
};
//获取查询发票类型
invoiceTypeChange = (select) => {
let invoiceType = '';
if (select.length > 0) {
invoiceType = select[0];
}
this.setState({
invoiceType: invoiceType,
});
};
//获取查询发票类型
applicationStatusChange = (select) => {
let applicationStatus = '';
if (select.length > 0) {
applicationStatus = select[0];
}
this.setState({
applicationStatus: applicationStatus,
});
};
//查询
searchData = async () => {
this.setState({
isShowSearch: false,
invoiceList: [],
showFoot: 0,
isNextPage: false,
isPreviousPage: false,
});
this.setLoadingStatus(true);
await this.getApplicationList();
};
//清空查询数据
searchDataEmpty = async () => {
let date = GetMonthDate();
this.setState({
monthDate: date,
beginDate: date.startDate,
endDate: date.endDate,
beginDateString: date.startDateString,
endDateString: date.endDateString,
invoiceType: '1',
applicationStatus: '0',
invoiceList: [],
showFoot: 0,
isNextPage: false,
isPreviousPage: false,
pageNum: 1,
});
await this.getApplicationList();
};
// 加载list项
renderItem = (data) => (