change_address.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import React, {Component} from 'react';
  2. import {
  3. View,
  4. Text,
  5. TextInput,
  6. TouchableOpacity,
  7. Image,
  8. PixelRatio,
  9. } from 'react-native';
  10. import {ShowToast} from '../../components/rootToast/root_toast';
  11. import {GetDataPost} from '../../data/encryption';
  12. import {RetrieveData} from '../../data/storage';
  13. import public_css from '../../source/css/public_css';
  14. export default class change_nick_name extends Component {
  15. constructor(props) {
  16. super(props);
  17. this.state = {
  18. address: this.props.route.params.data.state.address,
  19. };
  20. }
  21. render() {
  22. return (
  23. <View style={public_css.body}>
  24. <View style={{flex: 1}}>
  25. <TextInput
  26. style={{
  27. fontSize: 16,
  28. marginTop: 5,
  29. height: 40,
  30. borderBottomWidth: PixelRatio.get(),
  31. borderColor: 'rgb(208,208,208)',
  32. }}
  33. placeholder="请输入客户名称"
  34. clearButtonMode="while-editing"
  35. secureTextEntry={false}
  36. autoFocus={true}
  37. value={this.state.address}
  38. onChangeText={text => {
  39. this.setState({
  40. address: text,
  41. });
  42. }}
  43. />
  44. </View>
  45. <View style={[public_css.bottomStaus]}>
  46. <TouchableOpacity
  47. style={[public_css.statusBtn, public_css.statusRBtn]}
  48. onPress={() => this.submitData()}>
  49. <Image
  50. source={require('../../source/img/productImg/confirm.png')}
  51. style={{width: 32, height: 32}}
  52. />
  53. <Text style={{color: '#fff'}}>确认</Text>
  54. </TouchableOpacity>
  55. </View>
  56. </View>
  57. );
  58. }
  59. //提交开票信息
  60. submitData = async () => {
  61. let account = await RetrieveData('account');
  62. let token = await RetrieveData('token');
  63. if (token && account) {
  64. account = account.substring(1, account.length - 1);
  65. token = token.substring(1, token.length - 1);
  66. const url = 'https://app.taxbk.cn:9443/auth/comm/user/personalInfo/save';
  67. let response = await GetDataPost(
  68. url,
  69. token,
  70. {
  71. mobile: account,
  72. address: this.state.address,
  73. reqChannel: 3,
  74. ip: '',
  75. },
  76. false,
  77. 1,
  78. );
  79. if (response) {
  80. if (response.code == 0) {
  81. ShowToast('修改成功!');
  82. await this.props.route.params.data.getUserInformation();
  83. this.props.navigation.goBack();
  84. }
  85. } else {
  86. ShowToast('服务器故障!');
  87. }
  88. }
  89. };
  90. }