123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539 |
- import React, {Component} from 'react';
- import {
- View,
- Image,
- Text,
- TouchableOpacity,
- SafeAreaView,
- ScrollView,
- Alert,
- DeviceEventEmitter,
- } from 'react-native';
- import {WingBlank, WhiteSpace, Modal} from '@ant-design/react-native';
- import {
- ClearAll,
- IndividualStorageData,
- RetrieveData,
- } from '../../../data/storage';
- import {
- RequestNetwork,
- UploadImage,
- GetNetworkUrl,
- } from '../../../data/encryption';
- import public_css from '../../../source/css/public_css';
- import {ToastShow} from '../../../components/toast/toast';
- import {rightArrowIcon} from '../../../source/icon/icon';
- import {SvgXml} from 'react-native-svg';
- import {GetMonthDate} from '../../../utils/date';
- // import ImagePicker from 'react-native-image-crop-picker';
- export default class invoice_info extends Component {
- constructor(props) {
- super(props);
- this.props.navigation.dangerouslyGetParent().setOptions({
- tabBarVisible: false,
- });
- this.state = {
- userName: '',
- invoiceReqFlowNo: '',
- invoiceStatus: false,
- invoiceType: '',
- invoiceCategory: 3,
- buyerName: '',
- buyerEntTaxId: '',
- invoiceTotalPrice: '',
- invoiceTotalPriceTax: '',
- invoiceTotalTax: '',
- sellerEntName: '',
- sellerEntTaxId: '',
- drawer: '',
- payee: '',
- checker: '',
- invoiceCode: '',
- invoiceNo: '',
- invoiceDate: '',
- invalidStatus: true,
- };
- }
- render() {
- return (
- <SafeAreaView style={public_css.body}>
- <ScrollView>
- <View style={{alignItems: 'center', marginTop: 10}}>
- <Image source={require('../../../source/img/tax/invoiceBack.png')} />
- {this.state.invoiceCategory === 3 ? (
- <Text
- style={{
- position: 'absolute',
- top: 30,
- color: '#9A4411',
- fontSize: 25,
- }}>
- 增值税普通纸质发票
- </Text>
- ) : this.state.invoiceCategory === 4 ? (
- <Text
- style={{
- position: 'absolute',
- top: 30,
- color: '#9A4411',
- fontSize: 25,
- }}>
- 增值税专用纸质发票
- </Text>
- ) : (
- <Text />
- )}
- </View>
- {this.state.invoiceStatus ? (
- <View style={{alignItems: 'center', marginTop: 10}}>
- <Text style={{color: '#A0A0A0'}}>开票成功</Text>
- </View>
- ) : (
- <View />
- )}
- <WingBlank>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- borderBottomWidth: 0.5,
- height: 50,
- }}>
- <View style={{width: 90}}>
- <Text
- style={{textAlign: 'right', color: '#9A4411', fontSize: 16}}>
- 价税合计:
- </Text>
- </View>
- <View>
- <Text style={{color: '#0C0C0C', fontSize: 16}}>
- ¥{this.state.invoiceTotalPriceTax}
- </Text>
- </View>
- </View>
- </WingBlank>
- <WingBlank>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- marginTop: 10,
- }}>
- <View style={{width: 90}}>
- <Text
- style={{textAlign: 'right', color: '#9A4411', fontSize: 16}}>
- 购方名称:
- </Text>
- </View>
- <View>
- <Text style={{color: '#0C0C0C', fontSize: 16}}>
- {this.state.buyerName}
- </Text>
- </View>
- </View>
- </WingBlank>
- <WingBlank>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- marginTop: 10,
- }}>
- <View style={{width: 90}}>
- <Text
- style={{textAlign: 'right', color: '#9A4411', fontSize: 16}}>
- 企业税号:
- </Text>
- </View>
- <View>
- <Text style={{color: '#0C0C0C', fontSize: 16}}>
- {this.state.buyerEntTaxId}
- </Text>
- </View>
- </View>
- </WingBlank>
- <WingBlank>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- marginTop: 10,
- }}>
- <View style={{width: 90}}>
- <Text
- style={{textAlign: 'right', color: '#9A4411', fontSize: 16}}>
- 合计金额:
- </Text>
- </View>
- <View>
- <Text style={{color: '#0C0C0C', fontSize: 16}}>
- ¥{this.state.invoiceTotalPrice}
- </Text>
- </View>
- </View>
- </WingBlank>
- <WingBlank>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- marginTop: 10,
- }}>
- <View style={{width: 90}}>
- <Text
- style={{textAlign: 'right', color: '#9A4411', fontSize: 16}}>
- 合计税额:
- </Text>
- </View>
- <View>
- <Text style={{color: '#0C0C0C', fontSize: 16}}>
- ¥{this.state.invoiceTotalTax}
- </Text>
- </View>
- </View>
- </WingBlank>
- <WingBlank>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- marginTop: 10,
- }}>
- <View style={{width: 90}}>
- <Text
- style={{textAlign: 'right', color: '#9A4411', fontSize: 16}}>
- 客户名称:
- </Text>
- </View>
- <View>
- <Text style={{color: '#0C0C0C', fontSize: 16}}>
- {this.state.sellerEntName}
- </Text>
- </View>
- </View>
- </WingBlank>
- <WingBlank>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- marginTop: 10,
- }}>
- <View style={{width: 90}}>
- <Text
- style={{textAlign: 'right', color: '#9A4411', fontSize: 16}}>
- 客户税号:
- </Text>
- </View>
- <View>
- <Text style={{color: '#0C0C0C', fontSize: 16}}>
- {this.state.sellerEntTaxId}
- </Text>
- </View>
- </View>
- </WingBlank>
- <WingBlank>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- marginTop: 10,
- }}>
- <View style={{width: 90}}>
- <Text
- style={{textAlign: 'right', color: '#9A4411', fontSize: 16}}>
- 开票人:
- </Text>
- </View>
- <View>
- <Text style={{color: '#0C0C0C', fontSize: 16}}>
- {this.state.drawer}
- </Text>
- </View>
- </View>
- </WingBlank>
- <WingBlank>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- marginTop: 10,
- }}>
- <View style={{width: 90}}>
- <Text
- style={{textAlign: 'right', color: '#9A4411', fontSize: 16}}>
- 收款人:
- </Text>
- </View>
- <View>
- <Text style={{color: '#0C0C0C', fontSize: 16}}>
- {this.state.payee}
- </Text>
- </View>
- </View>
- </WingBlank>
- <WingBlank>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- marginTop: 10,
- }}>
- <View style={{width: 90}}>
- <Text
- style={{textAlign: 'right', color: '#9A4411', fontSize: 16}}>
- 审核人:
- </Text>
- </View>
- <View>
- <Text style={{color: '#0C0C0C', fontSize: 16}}>
- {this.state.checker}
- </Text>
- </View>
- </View>
- </WingBlank>
- <WingBlank>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- marginTop: 10,
- }}>
- <View style={{width: 90}}>
- <Text
- style={{textAlign: 'right', color: '#9A4411', fontSize: 16}}>
- 发票代码:
- </Text>
- </View>
- <View>
- <Text style={{color: '#0C0C0C', fontSize: 16}}>
- {this.state.invoiceCode}
- </Text>
- </View>
- </View>
- </WingBlank>
- <WingBlank>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- marginTop: 10,
- }}>
- <View style={{width: 90}}>
- <Text
- style={{textAlign: 'right', color: '#9A4411', fontSize: 16}}>
- 发票号码:
- </Text>
- </View>
- <View>
- <Text style={{color: '#0C0C0C', fontSize: 16}}>
- {this.state.invoiceNo}
- </Text>
- </View>
- </View>
- </WingBlank>
- <WingBlank>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- marginTop: 10,
- }}>
- <View style={{width: 90}}>
- <Text
- style={{textAlign: 'right', color: '#9A4411', fontSize: 16}}>
- 开票日期:
- </Text>
- </View>
- <View>
- <Text style={{color: '#0C0C0C', fontSize: 16}}>
- {this.state.invoiceDate}
- </Text>
- </View>
- </View>
- </WingBlank>
- </ScrollView>
- <View style={{height: 50, flexDirection: 'row', alignItems: 'center'}}>
- <View
- style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
- <TouchableOpacity
- style={{
- alignItems: 'center',
- justifyContent: 'center',
- height: 40,
- width: 160,
- borderWidth: 1,
- borderRadius: 8,
- borderColor: '#FE2A53',
- }}
- onPress={() => {
- this.invoiceHongChong();
- }}>
- <Text style={{color: '#FE2A53'}}>发票红冲</Text>
- </TouchableOpacity>
- </View>
- <View
- style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
- {this.state.invalidStatus ? (
- <TouchableOpacity
- style={{
- alignItems: 'center',
- justifyContent: 'center',
- height: 40,
- width: 160,
- backgroundColor: '#F06969',
- borderRadius: 8,
- }}
- onPress={() => {
- this.invoiceInvalid();
- }}>
- <Text style={{color: '#FFFFFF'}}>发票作废</Text>
- </TouchableOpacity>
- ) : (
- <View />
- )}
- </View>
- </View>
- </SafeAreaView>
- );
- }
- //加载信息
- componentDidMount(): void {
- let data = this.props.route.params.data;
- this.setState({
- invoiceReqFlowNo: data.invoiceReqFlowNo,
- invoiceType: data.invoiceType,
- invoiceCategory: data.invoiceCategory,
- });
- this.invoiceInvalidStatus(data.invoiceDate);
- this.getInvoiceData(data.invoiceNumber, data.invoiceCode, data.invoiceType);
- }
- // 获取发票信息
- getInvoiceData = async (invoiceNumber, invoiceCode, invoiceType) => {
- let company = JSON.parse(await RetrieveData('company'));
- let account = await RetrieveData('account');
- let token = await RetrieveData('token');
- if (token && account) {
- const url = '/sys/invoiceExt/getResultData';
- let response = await RequestNetwork(
- url,
- token,
- {
- entTaxId: company.entTaxId,
- invoiceType: invoiceType,
- invoiceNumber: invoiceNumber,
- invoiceCode: invoiceCode,
- },
- false,
- 2,
- );
- if (response) {
- if (response.code === 0) {
- this.setState({
- invoiceStatus: response.data.invoiceStatus,
- buyerName: response.data.invoiceData.buyerName,
- buyerEntTaxId: response.data.invoiceData.buyerEntTaxId,
- invoiceTotalPrice: response.data.invoiceData.invoiceTotalPrice,
- invoiceTotalPriceTax:
- response.data.invoiceData.invoiceTotalPriceTax,
- invoiceTotalTax: response.data.invoiceData.invoiceTotalTax,
- sellerEntName: response.data.invoiceData.sellerEntName,
- sellerEntTaxId: response.data.invoiceData.sellerEntTaxId,
- drawer: response.data.invoiceData.drawer,
- payee: response.data.invoiceData.payee,
- checker: response.data.invoiceData.checker,
- invoiceCode: response.data.invoiceData.invoiceCode,
- invoiceNo: response.data.invoiceData.invoiceNo,
- invoiceDate: response.data.invoiceData.invoiceDate,
- });
- } else {
- ToastShow(1, response.msg);
- }
- }
- }
- };
- //发票红冲
- invoiceHongChong = async () => {
- let account = await RetrieveData('account');
- let token = await RetrieveData('token');
- if (token && account) {
- const url = '/sys/invoice/quickyHongchong';
- let response = await RequestNetwork(
- url,
- token,
- {
- oriInvoiceReqFlowNo: this.state.oriInvoiceReqFlowNo,
- mobile: account,
- reqChannel: 3,
- },
- false,
- 1,
- );
- if (response) {
- if (response.code === 0) {
- ToastShow(1, '红冲成功!');
- } else {
- ToastShow(1, response.msg);
- }
- }
- }
- };
- // 发票作废
- invoiceInvalid = async () => {
- let userName = await RetrieveData('userName');
- let company = JSON.parse(await RetrieveData('company'));
- let account = await RetrieveData('account');
- let token = await RetrieveData('token');
- if (token && account) {
- const url = '/sys/invoiceExt/invalid';
- let response = await RequestNetwork(
- url,
- token,
- {
- entTaxId: company.entTaxId,
- deviceType: company.defaultDeviceInfo.deviceType,
- taxDiscId: company.defaultDeviceInfo.taxDiscId,
- invoiceInvalidType: this.state.invoiceType,
- invoiceCategory: this.state.invoiceCategory,
- invoiceCode: this.state.invoiceCode,
- invoiceNumber: this.state.invoiceNo,
- invalidOper: userName,
- mobile: account,
- reqChannel: 3,
- },
- false,
- 1,
- );
- if (response) {
- if (response.code === 0) {
- ToastShow(1, '作废成功!');
- } else {
- ToastShow(1, response.msg);
- }
- }
- }
- };
- // 判断发票作废按钮状态
- invoiceInvalidStatus = (invoiceDate) => {
- let date = GetMonthDate();
- if (
- invoiceDate >= date.startDateString &&
- invoiceDate <= date.endDateString
- ) {
- this.setState({
- invalidStatus: true,
- });
- } else {
- this.setState({
- invalidStatus: false,
- });
- }
- };
- }
|