import React, {Component} from 'react'; import { Text, TextInput, TouchableOpacity, View, Image, KeyboardAvoidingView, ScrollView, Dimensions, PixelRatio, DeviceEventEmitter, } from 'react-native'; import Spinner from 'react-native-loading-spinner-overlay'; import loading_css from '../../source/css/loading_css'; import login_css from '../login/login_css'; import public_css from '../../source/css/public_css'; import {Modal, Provider} from '@ant-design/react-native'; import ImagePicker from 'react-native-image-crop-picker'; import {ShowToast} from '../../components/rootToast/root_toast'; import {RetrieveData} from '../../data/storage'; import {GetDataPost} from '../../data/encryption'; export default class enterprise_shelves extends Component { constructor(props) { super(props); this.props.navigation.dangerouslyGetParent().setOptions({ tabBarVisible: false, }); this.state = { listData: [], name: '', ent_tax_id: '', address: '', executive_name: '', phone: '', bank_name: '', bank_account: '', authorization: '', license: '', }; } render() { return ( *纳税人名称: { this.setState({ name: text, }); }} /> *税号: { this.setState({ ent_tax_id: text, }); }} /> *营业地址: { this.setState({ address: text, }); }} /> *主管姓名: { this.setState({ executive_name: text, }); }} multiline={true} numberOfLines={2} textAlignVertical={'top'} /> *联系电话: { this.setState({ phone: text, }); }} multiline={true} numberOfLines={2} textAlignVertical={'top'} /> 银行名称: { this.setState({ bank_name: text, }); }} /> 银行帐号: { this.setState({ bank_account: text, }); }} /> *营业执照: { this.selectHeadImage(1); }}> {this.state.license == '' ? ( ) : ( )} *授权书: { this.selectHeadImage(2); }}> {this.state.authorization == '' ? ( ) : ( )} { this.setState({ name: '', ent_tax_id: '', address: '', executive_name: '', phone: '', bank_name: '', bank_account: '', authorization: '', license: '', }); }}> 全部清除 this.submitData()}> 确定 ); } //设置头像 selectHeadImage = (type) => { Modal.operation([ {text: '拍照', onPress: () => this.openCamera(type)}, {text: '相册', onPress: () => this.openPicker(type)}, ]); }; //拍照选择头像 openCamera = (type) => { ImagePicker.openCamera({ width: 300, height: 400, cropping: true, }).then((image) => { if (type == 1) { this.setState({ license: image.path, }); } if (type == 2) { this.setState({ authorization: image.path, }); } }); }; //相册选择头像 openPicker = (type) => { ImagePicker.openPicker({ width: 300, height: 400, cropping: true, }).then((image) => { if (type == 1) { this.setState({ license: image.path, }); } if (type == 2) { this.setState({ authorization: image.path, }); } }); }; //企业上架 submitData = async () => { let name = this.state.name; if (!name) { ShowToast('纳税人姓名不可以为空!'); return; } let ent_tax_id = this.state.ent_tax_id; if (!ent_tax_id) { ShowToast('税号不可以为空!'); return; } let address = this.state.address; if (!address) { ShowToast('营业地址不可以为空!'); return; } let executive_name = this.state.executive_name; if (!executive_name) { ShowToast('主管姓名不可以为空!'); return; } let phone = this.state.phone; if (!phone) { 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 = 'https://app.taxbk.cn:9443/sys/entInfo/preInit'; let response = await GetDataPost( url, token, { entTaxId: this.state.ent_tax_id, entName: this.state.name, entType: 1, entContactPerson: this.state.executive_name, entPhone: this.state.phone, reserveMrMobile: this.state.phone, reserveMrName: this.state.executive_name, reqChannel: 3, userMobile: account, }, false, 1, ); if (response) { if (response.code == 0) { ShowToast('上架成功!'); this.setLoadingStatus(false); this.props.navigation.goBack(); } else { ShowToast('上架失败!'); this.setLoadingStatus(false); } } else { ShowToast(response.msg); this.setLoadingStatus(false); } } }; }