loan_apply.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. import React, {Component} from 'react';
  2. import {
  3. View,
  4. Text,
  5. SafeAreaView,
  6. ScrollView,
  7. Image,
  8. Dimensions,
  9. TouchableOpacity,
  10. TextInput, DeviceEventEmitter,
  11. } from "react-native";
  12. import public_css from '../../../source/css/public_css';
  13. import { RequestNetwork } from "../../../data/encryption";
  14. import { StorageData } from "../../../data/storage";
  15. import { ToastShow } from "../../../components/toast/toast";
  16. import Spinner from 'react-native-loading-spinner-overlay';
  17. import loading_css from "../../../source/css/loading_css";
  18. export default class loan_apply extends Component {
  19. constructor(props) {
  20. super(props);
  21. this.props.navigation.dangerouslyGetParent().setOptions({
  22. tabBarVisible: false,
  23. });
  24. this.state = {
  25. companyName: '',
  26. contacts: '',
  27. phone: '',
  28. quota: '',
  29. spinner: false,
  30. initData: 'loading',
  31. };
  32. }
  33. render() {
  34. return (
  35. <SafeAreaView style={public_css.body}>
  36. <Spinner
  37. visible={this.state.spinner}
  38. textContent={this.state.initData}
  39. textStyle={loading_css.spinnerTextStyle}
  40. />
  41. <ScrollView>
  42. <View style={{alignItems: 'center'}}>
  43. <View>
  44. <Image
  45. style={{width: Dimensions.get('window').width, height: 600}}
  46. resizeMode={'stretch'}
  47. source={require('../../../source/img/homeImg/loan_apply.png')}
  48. />
  49. </View>
  50. <View
  51. style={{
  52. position: 'absolute',
  53. top: 100,
  54. }}>
  55. <Text
  56. style={{color: '#EB2B2D', fontWeight: 'bold', fontSize: 25}}>
  57. 填写申请信息
  58. </Text>
  59. </View>
  60. <View style={{position: 'absolute', top: 150}}>
  61. <View
  62. style={{
  63. flexDirection: 'row',
  64. alignItems: 'center',
  65. backgroundColor: '#EEE9E9',
  66. }}>
  67. <Text
  68. style={{
  69. color: '#693434',
  70. fontWeight: 'bold',
  71. fontSize: 16,
  72. marginLeft: 10,
  73. }}>
  74. 企业名称:
  75. </Text>
  76. <TextInput
  77. style={{height: 40, width: 200}}
  78. value={this.state.companyName}
  79. onChangeText={(text) => {
  80. this.setState({companyName: text});
  81. }}
  82. />
  83. </View>
  84. <View
  85. style={{
  86. flexDirection: 'row',
  87. alignItems: 'center',
  88. backgroundColor: '#EEE9E9',
  89. marginTop: 20,
  90. }}>
  91. <Text
  92. style={{
  93. color: '#693434',
  94. fontWeight: 'bold',
  95. fontSize: 16,
  96. marginLeft: 10,
  97. }}>
  98. 联系人:
  99. </Text>
  100. <TextInput
  101. style={{height: 40, width: 200}}
  102. value={this.state.contacts}
  103. onChangeText={(text) => {
  104. this.setState({contacts: text});
  105. }}
  106. />
  107. </View>
  108. <View
  109. style={{
  110. flexDirection: 'row',
  111. alignItems: 'center',
  112. backgroundColor: '#EEE9E9',
  113. marginTop: 20,
  114. }}>
  115. <Text
  116. style={{
  117. color: '#693434',
  118. fontWeight: 'bold',
  119. fontSize: 16,
  120. marginLeft: 10,
  121. }}>
  122. 联系电话:
  123. </Text>
  124. <TextInput
  125. style={{height: 40, width: 200}}
  126. value={this.state.phone}
  127. onChangeText={(text) => {
  128. this.setState({phone: text});
  129. }}
  130. />
  131. </View>
  132. <View
  133. style={{
  134. flexDirection: 'row',
  135. alignItems: 'center',
  136. backgroundColor: '#EEE9E9',
  137. marginTop: 20,
  138. }}>
  139. <Text
  140. style={{
  141. color: '#693434',
  142. fontWeight: 'bold',
  143. fontSize: 16,
  144. marginLeft: 10,
  145. }}>
  146. 意向额度:
  147. </Text>
  148. <TextInput
  149. style={{height: 40, width: 200}}
  150. value={this.state.quota}
  151. onChangeText={(text) => {
  152. this.setState({quota: text});
  153. }}
  154. />
  155. </View>
  156. </View>
  157. <View style={{position: 'absolute', top: 400, width: 300}}>
  158. <Text style={{color: '#89898B'}}>
  159. 小提示:提交申请后,工作人员会在第一时间与您取得联系,请保持手机畅通!
  160. </Text>
  161. </View>
  162. <View
  163. style={{
  164. position: 'relative',
  165. top: -120,
  166. }}>
  167. <TouchableOpacity
  168. style={{
  169. height: 40,
  170. width: 180,
  171. backgroundColor: '#FFE95F',
  172. justifyContent: 'center',
  173. alignItems: 'center',
  174. borderRadius: 64,
  175. elevation: 20, // 适配android的
  176. shadowOffset: {width: 0, height: 0},
  177. shadowColor: 'black',
  178. shadowOpacity: 0.15,
  179. shadowRadius: 5,
  180. }} onPress={() => this.submitData()}>
  181. <Text
  182. style={{color: '#CD0014', fontSize: 16, fontWeight: 'bold'}}>
  183. 立即申请
  184. </Text>
  185. </TouchableOpacity>
  186. </View>
  187. <View style={{position: 'relative', top: -70}}>
  188. <Text style={{color: '#FBC85B'}}>
  189. *本产品最终解释权归昆明官渡农村合作银行所有
  190. </Text>
  191. </View>
  192. </View>
  193. </ScrollView>
  194. </SafeAreaView>
  195. );
  196. }
  197. //提交申请信息
  198. submitData = async () => {
  199. this.setLoadingStatus(true);
  200. const url = '/marketing/recommended/save';
  201. let token = null;
  202. let response = await RequestNetwork(
  203. url,
  204. token,
  205. {
  206. contactName: this.state.contacts,
  207. contactPhone: this.state.phone,
  208. entName: this.state.companyName,
  209. campaignId: '4efc6f48fed8ce0457fc4abaf3470a82',
  210. reqChannel: 3,
  211. by1: this.state.quota,
  212. },
  213. false,
  214. 1,
  215. );
  216. if (response) {
  217. if (response.code === 0) {
  218. this.setLoadingStatus(false);
  219. ToastShow(1, '申请成功!');
  220. this.props.navigation.goBack();
  221. } else {
  222. this.setLoadingStatus(false);
  223. ToastShow(1, response.msg);
  224. }
  225. }
  226. };
  227. //是否显示Loading层
  228. setLoadingStatus(isLoading) {
  229. this.setState({
  230. spinner: isLoading,
  231. });
  232. }
  233. }