import React, {Component} from 'react'; import { View, Image, TouchableHighlight, Text, StyleSheet, TextInput, TouchableOpacity, Dimensions, ScrollView, KeyboardAvoidingView, DeviceEventEmitter, } from 'react-native'; import login_css from '../login/login_css'; import public_css from '../../source/css/public_css'; import loading_css from '../../source/css/loading_css'; import Spinner from 'react-native-loading-spinner-overlay'; import {GetDataPost} from '../../data/encryption'; import {ShowToast} from '../../components/rootToast/root_toast'; import {RetrieveData, StorageData} from '../../data/storage'; export default class enterprise_edit extends Component { constructor(props) { super(props); this.props.navigation.dangerouslyGetParent().setOptions({ tabBarVisible: false, }); this.ent = this.props.route.params.enterprise; this.state = { entName: this.ent.entName, entTaxId: this.ent.entTaxId, entAddress: this.ent.entAddress, entContactPerson: this.ent.entContactPerson, entPhone: this.ent.entPhone, bankAccountName: this.ent.bankAccountName, bankAccountNumber: this.ent.bankAccountNumber, payees: this.ent.payees, reviewers: this.ent.reviewers, req_channel: '', spinner: false, }; } render() { return ( 企业名称: *企业税号: { this.setState({ entTaxId: text, }); }} /> 公司地址: { this.setState({ entAddress: text, }); }} /> 企业联系人: { this.setState({ entContactPerson: text, }); }} /> 企业电话: { this.setState({ entPhone: text, }); }} /> 企业银行户名: { this.setState({ bankAccountName: text, }); }} /> *企业银行账号: { this.setState({ bankAccountNumber: text, }); }} /> *收款人: { this.props.navigation.navigate('enterprise_user', { type: 1, data: this, }); }}> 审核者: { this.props.navigation.navigate('enterprise_user', { type: 2, data: this, }); }}> { this.setState({ entName: this.ent.entName, entTaxId: this.ent.entTaxId, entAddress: this.ent.entAddress, entContactPerson: this.ent.entContactPerson, entPhone: this.ent.entPhone, bankAccountName: this.ent.bankAccountName, bankAccountNumber: this.ent.bankAccountNumber, payees: this.ent.payees, reviewers: this.ent.reviewers, }); }}> 全部清除 this.submitData()}> 确定添加 ); } //提交数据 submitData = async () => { let number = this.state.bankAccountNumber; if (!number) { ShowToast('企业银行帐号不可以为空!'); return; } let payees = this.state.payees; if (!payees) { ShowToast('收款人不可以为空!'); return; } let entTaxId = this.state.entTaxId; if (!entTaxId) { ShowToast('客户税号不可以为空!'); return; } this.setLoadingStatus(true); let token = await RetrieveData('token'); let account = await RetrieveData('account'); if (token && account) { token = token.substring(1, token.length - 1); account = account.substring(1, account.length - 1); const url = '/sys/entInfo/updateBriefInfo'; let response = await GetDataPost( url, token, { entTaxId: this.state.entTaxId, entAddress: this.state.entAddress, entContactPerson: this.state.entContactPerson, entPhone: this.state.entPhone, bankAccountName: this.state.bankAccountName, bankAccountNumber: this.state.bankAccountNumber, payees: this.state.payees, reviewers: this.state.reviewers, reqChannel: 3, userMobile: account, }, false, 1, ); if (response) { if (response.code == 0) { ShowToast('编辑成功!'); this.setLoadingStatus(false); this.props.navigation.goBack(); DeviceEventEmitter.emit('企业信息刷新', ''); } else { ShowToast('编辑失败!'); this.setLoadingStatus(false); } } else { ShowToast(response.msg); this.setLoadingStatus(false); } } }; //设置loading层是否显示 setLoadingStatus(isLoading) { this.setState({ spinner: isLoading, }); } //加载页面时显示数据 componentDidMount(): void { // this.getCompanyData(); } setPayees = data => { this.setState({ payees: data, }); }; setReviewers = data => { this.setState({ reviewers: data, }); }; }