tax_page.js 14 KB

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