enterprise_shelves.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. import React, {Component} from 'react';
  2. import {
  3. Text,
  4. TextInput,
  5. TouchableOpacity,
  6. View,
  7. Image,
  8. KeyboardAvoidingView,
  9. ScrollView,
  10. Dimensions,
  11. PixelRatio,
  12. DeviceEventEmitter,
  13. } from 'react-native';
  14. import Spinner from 'react-native-loading-spinner-overlay';
  15. import loading_css from '../../source/css/loading_css';
  16. import login_css from '../login/login_css';
  17. import public_css from '../../source/css/public_css';
  18. import {Modal, Provider} from '@ant-design/react-native';
  19. import ImagePicker from 'react-native-image-crop-picker';
  20. import {ShowToast} from '../../components/rootToast/root_toast';
  21. import {RetrieveData} from '../../data/storage';
  22. import {GetDataPost} from '../../data/encryption';
  23. export default class enterprise_shelves extends Component {
  24. constructor(props) {
  25. super(props);
  26. this.props.navigation.dangerouslyGetParent().setOptions({
  27. tabBarVisible: false,
  28. });
  29. this.state = {
  30. listData: [],
  31. name: '',
  32. ent_tax_id: '',
  33. address: '',
  34. executive_name: '',
  35. phone: '',
  36. bank_name: '',
  37. bank_account: '',
  38. authorization: '',
  39. license: '',
  40. };
  41. }
  42. render() {
  43. return (
  44. <Provider>
  45. <KeyboardAvoidingView
  46. enabled
  47. style={{flex: 1, backgroundColor: '#ffffff'}}>
  48. <ScrollView>
  49. <View>
  50. <Spinner
  51. visible={this.state.spinner}
  52. textContent={'Loading...'}
  53. textStyle={loading_css.spinnerTextStyle}
  54. />
  55. <View style={login_css.inputView}>
  56. <View style={[public_css.view, public_css.lineTopBottom]}>
  57. <Text
  58. style={[
  59. public_css.text,
  60. {fontFamily: 'PingFang-SC-Regular', color: '#333333'},
  61. ]}>
  62. *纳税人名称:
  63. </Text>
  64. <TextInput
  65. style={public_css.textInputStyle}
  66. value={this.state.customer_name}
  67. placeholder="请输入纳税人名称"
  68. clearButtonMode="while-editing"
  69. secureTextEntry={false}
  70. onChangeText={(text) => {
  71. this.setState({
  72. name: text,
  73. });
  74. }}
  75. />
  76. </View>
  77. <View style={[public_css.view, public_css.lineTopBottom]}>
  78. <Text
  79. style={[
  80. public_css.text,
  81. {fontFamily: 'PingFang-SC-Regular', color: '#333333'},
  82. ]}>
  83. *税号:
  84. </Text>
  85. <TextInput
  86. style={public_css.textInputStyle}
  87. value={this.state.ent_tax_id}
  88. placeholder="请输入企业税号"
  89. clearButtonMode="while-editing"
  90. secureTextEntry={false}
  91. onChangeText={(text) => {
  92. this.setState({
  93. ent_tax_id: text,
  94. });
  95. }}
  96. />
  97. </View>
  98. <View style={[public_css.view, public_css.lineTopBottom]}>
  99. <Text style={public_css.text}>*营业地址:</Text>
  100. <TextInput
  101. style={public_css.textInputStyle}
  102. value={this.state.address}
  103. placeholder="请输入营业地址"
  104. clearButtonMode="while-editing"
  105. secureTextEntry={false}
  106. onChangeText={(text) => {
  107. this.setState({
  108. address: text,
  109. });
  110. }}
  111. />
  112. </View>
  113. <View style={[public_css.view, public_css.lineTopBottom]}>
  114. <Text style={public_css.text}>*主管姓名:</Text>
  115. <TextInput
  116. style={public_css.textInputStyle}
  117. value={this.state.executive_name}
  118. placeholder="请输入地址"
  119. clearButtonMode="while-editing"
  120. secureTextEntry={false}
  121. onChangeText={(text) => {
  122. this.setState({
  123. executive_name: text,
  124. });
  125. }}
  126. multiline={true}
  127. numberOfLines={2}
  128. textAlignVertical={'top'}
  129. />
  130. </View>
  131. <View style={[public_css.view, public_css.lineTopBottom]}>
  132. <Text style={public_css.text}>*联系电话:</Text>
  133. <TextInput
  134. style={public_css.textInputStyle}
  135. value={this.state.phone}
  136. placeholder="请输入银行账号"
  137. clearButtonMode="while-editing"
  138. secureTextEntry={false}
  139. onChangeText={(text) => {
  140. this.setState({
  141. phone: text,
  142. });
  143. }}
  144. multiline={true}
  145. numberOfLines={2}
  146. textAlignVertical={'top'}
  147. />
  148. </View>
  149. <View style={[public_css.view, public_css.lineTopBottom]}>
  150. <Text style={public_css.text}>银行名称:</Text>
  151. <TextInput
  152. style={public_css.textInputStyle}
  153. value={this.state.bank_name}
  154. placeholder="请输入备注"
  155. clearButtonMode="while-editing"
  156. secureTextEntry={false}
  157. onChangeText={(text) => {
  158. this.setState({
  159. bank_name: text,
  160. });
  161. }}
  162. />
  163. </View>
  164. <View style={[public_css.view, public_css.lineTopBottom]}>
  165. <Text style={public_css.text}>银行帐号:</Text>
  166. <TextInput
  167. style={public_css.textInputStyle}
  168. value={this.state.bank_account}
  169. placeholder="请输入备注"
  170. clearButtonMode="while-editing"
  171. secureTextEntry={false}
  172. onChangeText={(text) => {
  173. this.setState({
  174. bank_account: text,
  175. });
  176. }}
  177. />
  178. </View>
  179. <View style={[public_css.imageView]}>
  180. <Text style={public_css.text}>*营业执照:</Text>
  181. <View
  182. style={{
  183. height: 100,
  184. width: 100,
  185. borderWidth: 3 / PixelRatio.get(),
  186. borderColor: 'rgb(208,208,208)',
  187. justifyContent: 'center',
  188. alignItems: 'center',
  189. margin: 10,
  190. backgroundColor: '#e6e6e6',
  191. }}>
  192. <TouchableOpacity
  193. onPress={() => {
  194. this.selectHeadImage(1);
  195. }}>
  196. {this.state.license == '' ? (
  197. <Image
  198. source={require('../../source/img/add_image.png')}
  199. />
  200. ) : (
  201. <Image
  202. source={{uri: this.state.license}}
  203. style={{
  204. width: 100,
  205. height: 100,
  206. margin: 10,
  207. }}
  208. />
  209. )}
  210. </TouchableOpacity>
  211. </View>
  212. </View>
  213. <View style={[public_css.imageView]}>
  214. <Text style={public_css.text}>*授权书:</Text>
  215. <View
  216. style={{
  217. height: 100,
  218. width: 100,
  219. borderWidth: 3 / PixelRatio.get(),
  220. borderColor: 'rgb(208,208,208)',
  221. justifyContent: 'center',
  222. alignItems: 'center',
  223. margin: 10,
  224. backgroundColor: '#e6e6e6',
  225. }}>
  226. <TouchableOpacity
  227. onPress={() => {
  228. this.selectHeadImage(2);
  229. }}>
  230. {this.state.authorization == '' ? (
  231. <Image
  232. source={require('../../source/img/add_image.png')}
  233. />
  234. ) : (
  235. <Image
  236. source={{uri: this.state.authorization}}
  237. style={{
  238. width: 100,
  239. height: 100,
  240. margin: 10,
  241. }}
  242. />
  243. )}
  244. </TouchableOpacity>
  245. </View>
  246. </View>
  247. </View>
  248. </View>
  249. </ScrollView>
  250. <View style={public_css.bottomStaus}>
  251. <TouchableOpacity
  252. style={[public_css.statusBtn, public_css.statusLBtn]}
  253. onPress={() => {
  254. this.setState({
  255. name: '',
  256. ent_tax_id: '',
  257. address: '',
  258. executive_name: '',
  259. phone: '',
  260. bank_name: '',
  261. bank_account: '',
  262. authorization: '',
  263. license: '',
  264. });
  265. }}>
  266. <Image
  267. source={require('../../source/img/productImg/clear.png')}
  268. style={{width: 32, height: 32}}
  269. />
  270. <Text>全部清除</Text>
  271. </TouchableOpacity>
  272. <TouchableOpacity
  273. style={[public_css.statusBtn, public_css.statusRBtn]}
  274. onPress={() => this.submitData()}>
  275. <Image
  276. source={require('../../source/img/productImg/confirm.png')}
  277. style={{width: 32, height: 32}}
  278. />
  279. <Text style={{color: '#fff'}}>确定</Text>
  280. </TouchableOpacity>
  281. </View>
  282. </KeyboardAvoidingView>
  283. </Provider>
  284. );
  285. }
  286. //设置头像
  287. selectHeadImage = (type) => {
  288. Modal.operation([
  289. {text: '拍照', onPress: () => this.openCamera(type)},
  290. {text: '相册', onPress: () => this.openPicker(type)},
  291. ]);
  292. };
  293. //拍照选择头像
  294. openCamera = (type) => {
  295. ImagePicker.openCamera({
  296. width: 300,
  297. height: 400,
  298. cropping: true,
  299. }).then((image) => {
  300. if (type == 1) {
  301. this.setState({
  302. license: image.path,
  303. });
  304. }
  305. if (type == 2) {
  306. this.setState({
  307. authorization: image.path,
  308. });
  309. }
  310. });
  311. };
  312. //相册选择头像
  313. openPicker = (type) => {
  314. ImagePicker.openPicker({
  315. width: 300,
  316. height: 400,
  317. cropping: true,
  318. }).then((image) => {
  319. if (type == 1) {
  320. this.setState({
  321. license: image.path,
  322. });
  323. }
  324. if (type == 2) {
  325. this.setState({
  326. authorization: image.path,
  327. });
  328. }
  329. });
  330. };
  331. //企业上架
  332. submitData = async () => {
  333. let name = this.state.name;
  334. if (!name) {
  335. ShowToast('纳税人姓名不可以为空!');
  336. return;
  337. }
  338. let ent_tax_id = this.state.ent_tax_id;
  339. if (!ent_tax_id) {
  340. ShowToast('税号不可以为空!');
  341. return;
  342. }
  343. let address = this.state.address;
  344. if (!address) {
  345. ShowToast('营业地址不可以为空!');
  346. return;
  347. }
  348. let executive_name = this.state.executive_name;
  349. if (!executive_name) {
  350. ShowToast('主管姓名不可以为空!');
  351. return;
  352. }
  353. let phone = this.state.phone;
  354. if (!phone) {
  355. ShowToast('联系电话不可以为空!');
  356. return;
  357. }
  358. this.setLoadingStatus(true);
  359. let token = await RetrieveData('token');
  360. let account = await RetrieveData('account');
  361. if (token && account) {
  362. token = token.substring(1, token.length - 1);
  363. account = account.substring(1, account.length - 1);
  364. const url = 'https://app.taxbk.cn:9443/sys/entInfo/preInit';
  365. let response = await GetDataPost(
  366. url,
  367. token,
  368. {
  369. entTaxId: this.state.ent_tax_id,
  370. entName: this.state.name,
  371. entType: 1,
  372. entContactPerson: this.state.executive_name,
  373. entPhone: this.state.phone,
  374. reserveMrMobile: this.state.phone,
  375. reserveMrName: this.state.executive_name,
  376. reqChannel: 3,
  377. userMobile: account,
  378. },
  379. false,
  380. 1,
  381. );
  382. if (response) {
  383. if (response.code == 0) {
  384. ShowToast('上架成功!');
  385. this.setLoadingStatus(false);
  386. this.props.navigation.goBack();
  387. } else {
  388. ShowToast('上架失败!');
  389. this.setLoadingStatus(false);
  390. }
  391. } else {
  392. ShowToast(response.msg);
  393. this.setLoadingStatus(false);
  394. }
  395. }
  396. };
  397. }