import React, {Component} from 'react'; import { Image, Text, View, TouchableOpacity, StyleSheet, ScrollView, DeviceEventEmitter, } from 'react-native'; import public_css from '../../source/css/public_css'; import {RetrieveData} from '../../data/storage'; export default class tax_page extends Component { constructor(props) { super(props); this.state = { authority: '', landingStatus: 0, //登录状态,0:表示未登录,1:表示已登录 }; } render() { return ( 开票服务 {this.state.landingStatus == 1 ? ( this.state.authority.includes('sys:invoice:add') ? ( { this.getLandingStatus(1); }}> 开票 ) : ( ) ) : ( { this.getLandingStatus(1); }}> 开票 )} {this.state.landingStatus == 1 ? ( this.state.authority.includes('sys:invoice:view') ? ( { this.getLandingStatus(2); }}> 发票查询 ) : ( ) ) : ( { this.getLandingStatus(2); }}> 发票查询 )} {this.state.landingStatus == 1 ? ( this.state.authority.includes('sys:hongchong:view') ? ( { this.getLandingStatus(3); }}> 发票红冲 ) : ( ) ) : ( { this.getLandingStatus(3); }}> 发票红冲 )} {this.state.landingStatus == 1 ? ( this.state.authority.includes('sys:invoice:claims') ? ( { this.getLandingStatus(4); }}> 发票申领 ) : ( ) ) : ( { this.getLandingStatus(4); }}> 发票申领 )} {this.state.landingStatus == 1 ? ( this.state.authority.includes('sys:invoice:add') ? ( { this.getLandingStatus(5); }}> 扫码开票 ) : ( ) ) : ( { this.getLandingStatus(5); }}> 扫码开票 )} {this.state.landingStatus == 1 ? ( this.state.authority.includes('sys:taitou:view') ? ( { this.getLandingStatus(6); }}> 待开抬头开票 ) : ( ) ) : ( { this.getLandingStatus(6); }}> 待开抬头开票 )} {this.state.landingStatus == 1 ? ( this.state.authority.includes('sys:taitou:view') ? ( { this.getLandingStatus(7); }}> 购方开票 ) : ( ) ) : ( { this.getLandingStatus(7); }}> 购方开票 )} 客户服务 {this.state.landingStatus == 1 ? ( this.state.authority.includes('sys:customer:view') ? ( { this.getLandingStatus(8); }}> 客户信息 ) : ( ) ) : ( { this.getLandingStatus(8); }}> 客户信息 )} 企业信息 {this.state.landingStatus == 1 ? ( this.state.authority.includes('sys:customer:view') ? ( { this.getLandingStatus(30); }}> 企业信息 ) : ( ) ) : ( { this.getLandingStatus(30); }}> 企业信息 )} ); } //加载数据 componentDidMount() { this.getAuthority(); } //判断是否登录 getLandingStatus = async type => { const account = await RetrieveData('account'); if (account) { if (type == 1) { this.props.navigation.navigate('invoice_product_list'); } if (type == 2) { this.props.navigation.navigate('invoice_inquiry'); } if (type == 3) { this.props.navigation.navigate('invoice_inquiry_red_rush'); } if (type == 4) { this.props.navigation.navigate('invoice_application'); } if (type == 5) { this.props.navigation.navigate('sweep_code_invoice'); } if (type == 6) { this.props.navigation.navigate('invoice_head'); } if (type == 7) { this.props.navigation.navigate('invoice_qrcode_product_list'); } if (type == 8) { this.props.navigation.navigate('customer_information'); } if (type == 30) { this.props.navigation.navigate('enterprise_information'); } } else { this.props.navigation.navigate('login_head'); } }; //获取权限信息 getAuthority = async () => { const authority = await RetrieveData('authority'); if (authority) { this.setState({ authority: authority, landingStatus: 1, }); } }; } const styles = StyleSheet.create({ tapBtnBakCol: { flexDirection: 'column', alignItems: 'center', }, tapBtnImg: { width: 53, height: 53, }, tapBtnTips: { marginTop: 10, color: '#000', }, });