BillingView.js 4.47 KB
/**
 * Created by DEV005 on 2017/11/13.
 */

/**
 * Created by tdzl2003 on 12/18/16.
 */
import React, {Component} from "react";
import {
    Image,
    ListView,
    NativeModules,
    StyleSheet,
    Text,
    TextInput,
    TouchableOpacity,
    View,
    Platform,
    RefreshControl,
    ActivityIndicator,
    ScrollView,
    Dimensions,
    Modal,
} from "react-native";

import { observable, useStrict, action } from 'mobx';
import { observer } from 'mobx-react';
import Orientation from 'react-native-orientation';
import {xnToast,getHeaderHeight,getHeaderPadding,getFooterBottom,xnBorderWidth} from "../utils/utils";
import AppService from "../service/AppService";




export default class BillingView extends Component {

    static navigationOptions = ({ navigation, screenProps })=>({

        header:null
    });

    constructor(props) {
        super(props);
        this.state = {
            legalentityName:"",
            creditCode:"",
            bankAccountName:"",
            bankAccountNumber:"",
            legalentityAddress:"",
            phoneNumber:"",
        };
    }
    componentDidMount(){
        let  _this=this;
        //设置头部


        Orientation.addOrientationListener(v=>console.log(v))
        const initial  = Orientation.getInitialOrientation();

        Orientation.lockToLandscapeLeft();

        if (initial === 'PORTRAIT') {
            // Orientation.lockToLandscapeLeft()

        } else {
            // do something else
        }

        let item=_this.props.navigation.state.params.item;

        _this.setState({
            legalentityName:item.legalentityName,
            creditCode:item.creditCode,
            bankAccountName:item.bankAccountName,
            bankAccountNumber:item.bankAccountNumber,
            legalentityAddress:item.legalentityAddress,
            phoneNumber:item.phoneNumber,
        })

    };

    componentWillUnmount() {
        Orientation.lockToPortrait();
    };

    _goBack=()=> {
        this.props.navigation.goBack();
    }

    read=(data)=> {
        let _this=this;
        NativeModules.system.readText(data).then((result) => {} ).catch((error) => {
            console.log(error)
        });
    }
    render() {
        return (
            <View style={styles.body}>
                <View   style={styles.layout} >
                    <TouchableOpacity  onPress={()=>{this.read(this.state.legalentityName)}}><Text style={styles.title}>{this.state.legalentityName}</Text></TouchableOpacity>
                    <TouchableOpacity  onPress={()=>{this.read(this.state.creditCode+"")}}><Text style={styles.infoCode}>{this.state.creditCode}</Text></TouchableOpacity>
                    <Text style={styles.info}>账户名称:{this.state.bankAccountName}</Text>
                    <Text style={styles.info}>银行账号:{this.state.bankAccountNumber}</Text>
                    <Text style={styles.info}>单位地址:{this.state.legalentityAddress}</Text>
                    <Text style={styles.info}>电话号码:{this.state.phoneNumber}</Text>
                </View >
                <View style={styles.operating}>
                    <TouchableOpacity style={styles.operatingBtn} onPress={()=>{this._goBack  ()}}>
                        <Image style={styles.operatingImg}  source={require('../img/billingBack.png')}  resizeMode="contain"/>
                    </TouchableOpacity>
                    <TouchableOpacity style={styles.operatingBtn} onPress={()=>{this.read(this.state.legalentityName+","+this.state.creditCode)}}>
                        <Image style={styles.operatingImg}  source={require('../img/read.png')}  resizeMode="contain"/>
                    </TouchableOpacity>
                </View>
            </View>
        );
    }

}

const styles = StyleSheet.create({

    body:{
        flex:1,
        flexDirection:"column",
        backgroundColor:"#333",
        justifyContent:"center",
        alignItems:"center",
    },
    layout:{
        paddingLeft:50,
        paddingRight:50,
    },
    title:{
        fontSize:40,
        color:"#fff"
    },
    infoCode:{
        fontSize:30,
        color:"#fff",
        paddingTop:5,
        paddingBottom:10,
    },
    info:{
        fontSize:16,
        color:"#fff"
    },
    operating:{
        position:"absolute",
        right:40,
        bottom:40,
        // width:100,
        flexDirection:"row",

    },
    operatingBtn:{
        width:50,
        height:50,
        marginLeft:30,
    },
    operatingImg:{
        width:50,
        height:50,
    }



});