tax_page.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. import React, {Component} from 'react';
  2. import {
  3. Image,
  4. Text,
  5. View,
  6. TouchableOpacity,
  7. StyleSheet,
  8. ScrollView,
  9. SafeAreaView,
  10. DeviceEventEmitter,
  11. } from 'react-native';
  12. import {WingBlank, WhiteSpace} from '@ant-design/react-native';
  13. import public_css from '../../source/css/public_css';
  14. import {RetrieveData} from '../../data/storage';
  15. export default class tax_page extends Component {
  16. constructor(props) {
  17. super(props);
  18. this.state = {
  19. authority: '',
  20. landingStatus: 0, //登录状态,0:表示未登录,1:表示已登录
  21. };
  22. }
  23. render() {
  24. return (
  25. <SafeAreaView style={public_css.body}>
  26. <ScrollView style={{backgroundColor: '#F2F1F7'}}>
  27. <WhiteSpace />
  28. <WingBlank>
  29. <View style={{backgroundColor: '#ffffff'}}>
  30. <View
  31. style={{
  32. height: 30,
  33. justifyContent: 'center',
  34. marginLeft: 10,
  35. marginTop: 5,
  36. }}>
  37. <Text style={{color: '#464646', fontWeight: 'bold', fontSize: 16}}>
  38. 发票类查询
  39. </Text>
  40. </View>
  41. <View style={{flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center'}}>
  42. {this.state.landingStatus == 1 ? (
  43. <View style={{margin: 10}}>
  44. <TouchableOpacity
  45. style={styles.tapBtnBakCol}
  46. onPress={() => {
  47. this.getLandingStatus(1);
  48. }}>
  49. <Image
  50. source={require('../../source/img/tax/paperInvoice.png')}
  51. style={styles.tapBtnImg}
  52. />
  53. <Text style={styles.tapBtnTips}>纸质普票查询</Text>
  54. </TouchableOpacity>
  55. </View>
  56. ) : (
  57. <View style={{margin: 10}}>
  58. <TouchableOpacity
  59. style={styles.tapBtnBakCol}
  60. onPress={() => {
  61. this.getLandingStatus(1);
  62. }}>
  63. <Image
  64. source={require('../../source/img/tax/paperInvoice.png')}
  65. style={styles.tapBtnImg}
  66. />
  67. <Text style={styles.tapBtnTips}>纸质普票查询</Text>
  68. </TouchableOpacity>
  69. </View>
  70. )}
  71. {this.state.landingStatus == 1 ? (
  72. <View style={{margin: 10}}>
  73. <TouchableOpacity
  74. style={styles.tapBtnBakCol}
  75. onPress={() => {
  76. this.getLandingStatus(2);
  77. }}>
  78. <Image
  79. source={require('../../source/img/tax/paperz.png')}
  80. style={styles.tapBtnImg}
  81. />
  82. <Text style={styles.tapBtnTips}>纸质专票查询</Text>
  83. </TouchableOpacity>
  84. </View>
  85. ) : (
  86. <View style={{margin: 10}}>
  87. <TouchableOpacity
  88. style={styles.tapBtnBakCol}
  89. onPress={() => {
  90. this.getLandingStatus(2);
  91. }}>
  92. <Image
  93. source={require('../../source/img/tax/paperz.png')}
  94. style={styles.tapBtnImg}
  95. />
  96. <Text style={styles.tapBtnTips}>纸质专票查询</Text>
  97. </TouchableOpacity>
  98. </View>
  99. )}
  100. {this.state.landingStatus == 1 ? (
  101. <View style={{margin: 10}}>
  102. <TouchableOpacity
  103. style={styles.tapBtnBakCol}
  104. onPress={() => {
  105. this.getLandingStatus(3);
  106. }}>
  107. <Image
  108. source={require('../../source/img/tax/dianp.png')}
  109. style={styles.tapBtnImg}
  110. />
  111. <Text style={styles.tapBtnTips}>电子普票查询</Text>
  112. </TouchableOpacity>
  113. </View>
  114. ) : (
  115. <View style={{margin: 10}}>
  116. <TouchableOpacity
  117. style={styles.tapBtnBakCol}
  118. onPress={() => {
  119. this.getLandingStatus(3);
  120. }}>
  121. <Image
  122. source={require('../../source/img/tax/dianp.png')}
  123. style={styles.tapBtnImg}
  124. />
  125. <Text style={styles.tapBtnTips}>电子普票查询</Text>
  126. </TouchableOpacity>
  127. </View>
  128. )}
  129. {this.state.landingStatus == 1 ? (
  130. <View style={{margin: 10}}>
  131. <TouchableOpacity
  132. style={styles.tapBtnBakCol}
  133. onPress={() => {
  134. this.getLandingStatus(4);
  135. }}>
  136. <Image
  137. source={require('../../source/img/tax/invoiceSearch.png')}
  138. style={styles.tapBtnImg}
  139. />
  140. <Text style={styles.tapBtnTips}>电子专票查询</Text>
  141. </TouchableOpacity>
  142. </View>
  143. ) : (
  144. <View style={{margin: 10}}>
  145. <TouchableOpacity
  146. style={styles.tapBtnBakCol}
  147. onPress={() => {
  148. this.getLandingStatus(4);
  149. }}>
  150. <Image
  151. source={require('../../source/img/tax/invoiceSearch.png')}
  152. style={styles.tapBtnImg}
  153. />
  154. <Text style={styles.tapBtnTips}>电子专票查询</Text>
  155. </TouchableOpacity>
  156. </View>
  157. )}
  158. {this.state.landingStatus == 1 ? (
  159. <View style={{margin: 10}}>
  160. <TouchableOpacity
  161. style={styles.tapBtnBakCol}
  162. onPress={() => {
  163. this.getLandingStatus(5);
  164. }}>
  165. <Image
  166. source={require('../../source/img/tax/invoicestock.png')}
  167. style={styles.tapBtnImg}
  168. />
  169. <Text style={styles.tapBtnTips}>发票库存查询</Text>
  170. </TouchableOpacity>
  171. </View>
  172. ) : (
  173. <View style={{margin: 10}}>
  174. <TouchableOpacity
  175. style={styles.tapBtnBakCol}
  176. onPress={() => {
  177. this.getLandingStatus(5);
  178. }}>
  179. <Image
  180. source={require('../../source/img/tax/invoicestock.png')}
  181. style={styles.tapBtnImg}
  182. />
  183. <Text style={styles.tapBtnTips}>发票库存查询</Text>
  184. </TouchableOpacity>
  185. </View>
  186. )}
  187. </View>
  188. </View>
  189. </WingBlank>
  190. <WhiteSpace />
  191. <WhiteSpace />
  192. <WingBlank>
  193. <View style={{backgroundColor: '#ffffff'}}>
  194. <View
  195. style={{
  196. height: 30,
  197. justifyContent: 'center',
  198. marginLeft: 10,
  199. marginTop: 5,
  200. }}>
  201. <Text style={{color: '#464646', fontWeight: 'bold', fontSize: 16}}>
  202. 税盘监控管理信息
  203. </Text>
  204. </View>
  205. <View style={{flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center'}}>
  206. {this.state.landingStatus == 1 ? (
  207. <View style={{margin: 10}}>
  208. <TouchableOpacity
  209. style={styles.tapBtnBakCol}
  210. onPress={() => {
  211. this.getLandingStatus(6);
  212. }}>
  213. <Image
  214. source={require('../../source/img/tax/zhizhip.png')}
  215. style={styles.tapBtnImg}
  216. />
  217. <Text style={styles.tapBtnTips}>纸质普票查询</Text>
  218. </TouchableOpacity>
  219. </View>
  220. ) : (
  221. <View style={{margin: 10}}>
  222. <TouchableOpacity
  223. style={styles.tapBtnBakCol}
  224. onPress={() => {
  225. this.getLandingStatus(6);
  226. }}>
  227. <Image
  228. source={require('../../source/img/tax/zhizhip.png')}
  229. style={styles.tapBtnImg}
  230. />
  231. <Text style={styles.tapBtnTips}>纸质普票查询</Text>
  232. </TouchableOpacity>
  233. </View>
  234. )}
  235. {this.state.landingStatus == 1 ? (
  236. <View style={{margin: 10}}>
  237. <TouchableOpacity
  238. style={styles.tapBtnBakCol}
  239. onPress={() => {
  240. this.getLandingStatus(7);
  241. }}>
  242. <Image
  243. source={require('../../source/img/tax/paperz.png')}
  244. style={styles.tapBtnImg}
  245. />
  246. <Text style={styles.tapBtnTips}>纸质专票查询</Text>
  247. </TouchableOpacity>
  248. </View>
  249. ) : (
  250. <View style={{margin: 10}}>
  251. <TouchableOpacity
  252. style={styles.tapBtnBakCol}
  253. onPress={() => {
  254. this.getLandingStatus(7);
  255. }}>
  256. <Image
  257. source={require('../../source/img/tax/paperz.png')}
  258. style={styles.tapBtnImg}
  259. />
  260. <Text style={styles.tapBtnTips}>纸质专票查询</Text>
  261. </TouchableOpacity>
  262. </View>
  263. )}
  264. {this.state.landingStatus == 1 ? (
  265. <View style={{margin: 10}}>
  266. <TouchableOpacity
  267. style={styles.tapBtnBakCol}
  268. onPress={() => {
  269. this.getLandingStatus(8);
  270. }}>
  271. <Image
  272. source={require('../../source/img/tax/dianzip.png')}
  273. style={styles.tapBtnImg}
  274. />
  275. <Text style={styles.tapBtnTips}>电子普票查询</Text>
  276. </TouchableOpacity>
  277. </View>
  278. ) : (
  279. <View style={{margin: 10}}>
  280. <TouchableOpacity
  281. style={styles.tapBtnBakCol}
  282. onPress={() => {
  283. this.getLandingStatus(8);
  284. }}>
  285. <Image
  286. source={require('../../source/img/tax/dianzip.png')}
  287. style={styles.tapBtnImg}
  288. />
  289. <Text style={styles.tapBtnTips}>电子普票查询</Text>
  290. </TouchableOpacity>
  291. </View>
  292. )}
  293. {this.state.landingStatus == 1 ? (
  294. <View style={{margin: 10}}>
  295. <TouchableOpacity
  296. style={styles.tapBtnBakCol}
  297. onPress={() => {
  298. this.getLandingStatus(9);
  299. }}>
  300. <Image
  301. source={require('../../source/img/tax/dianz.png')}
  302. style={styles.tapBtnImg}
  303. />
  304. <Text style={styles.tapBtnTips}>电子专票查询</Text>
  305. </TouchableOpacity>
  306. </View>
  307. ) : (
  308. <View style={{margin: 10}}>
  309. <TouchableOpacity
  310. style={styles.tapBtnBakCol}
  311. onPress={() => {
  312. this.getLandingStatus(9);
  313. }}>
  314. <Image
  315. source={require('../../source/img/tax/dianz.png')}
  316. style={styles.tapBtnImg}
  317. />
  318. <Text style={styles.tapBtnTips}>电子专票查询</Text>
  319. </TouchableOpacity>
  320. </View>
  321. )}
  322. </View>
  323. </View>
  324. </WingBlank>
  325. <WhiteSpace />
  326. </ScrollView>
  327. </SafeAreaView>
  328. );
  329. }
  330. //加载数据
  331. componentDidMount() {
  332. this.getAuthority();
  333. }
  334. //判断是否登录
  335. getLandingStatus = async (type) => {
  336. const account = await RetrieveData('account');
  337. if (account) {
  338. if (type === 1) {
  339. this.props.navigation.navigate('paper_ordinary_invoice');
  340. }
  341. if (type === 2) {
  342. this.props.navigation.navigate('paper_major_invoice');
  343. }
  344. if (type === 3) {
  345. this.props.navigation.navigate('electronics_ordinary_invoice');
  346. }
  347. if (type === 4) {
  348. this.props.navigation.navigate('electronics_major_invoice');
  349. }
  350. if (type === 5) {
  351. this.props.navigation.navigate('invoice_stock');
  352. }
  353. if (type === 6) {
  354. this.props.navigation.navigate('invoice_monitor', {type: 3});
  355. }
  356. if (type === 7) {
  357. this.props.navigation.navigate('invoice_monitor', {type: 4});
  358. }
  359. if (type === 8) {
  360. this.props.navigation.navigate('invoice_monitor', {type: 1});
  361. }
  362. if (type === 9) {
  363. this.props.navigation.navigate('invoice_monitor', {type: 2});
  364. }
  365. } else {
  366. this.props.navigation.navigate('login', {
  367. refresh: (type) => {
  368. this.refresh(type);
  369. },
  370. });
  371. }
  372. };
  373. refresh = async (type) => {
  374. DeviceEventEmitter.emit('updateLoginInfo', type);
  375. DeviceEventEmitter.emit('updateCompany', null);
  376. };
  377. //获取权限信息
  378. getAuthority = async () => {
  379. const authority = await RetrieveData('authority');
  380. if (authority) {
  381. this.setState({
  382. authority: authority,
  383. landingStatus: 1,
  384. });
  385. }
  386. };
  387. }
  388. const styles = StyleSheet.create({
  389. tapBtnBakCol: {
  390. flexDirection: 'column',
  391. alignItems: 'center',
  392. },
  393. tapBtnImg: {
  394. width: 49,
  395. height: 49,
  396. },
  397. tapBtnTips: {
  398. marginTop: 10,
  399. color: '#757374',
  400. },
  401. });