home_page.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774
  1. import React, {Component} from 'react';
  2. import {
  3. Image,
  4. TouchableOpacity,
  5. ScrollView,
  6. Text,
  7. View,
  8. DeviceEventEmitter,
  9. } from 'react-native';
  10. import NetInfo from '@react-native-community/netinfo';
  11. import {GetDataPost} from '../../data/encryption';
  12. import {IndividualStorageData, RetrieveData} from '../../data/storage';
  13. import {ShowToast} from '../../components/rootToast/root_toast';
  14. import Swiper from 'react-native-swiper';
  15. import {NoticeBar, WhiteSpace} from '@ant-design/react-native';
  16. import home_css from './home_css';
  17. import moment from 'moment';
  18. export default class home_page extends Component {
  19. constructor(props) {
  20. super(props);
  21. this.state = {
  22. name: '',
  23. info: '',
  24. totalAmt: 0.0,
  25. totalTaxes: 0.0,
  26. sumNum: 0.0,
  27. authority: '',
  28. landingStatus: 0, //登陆状态,0:表示未登陆,1:表示已登陆
  29. curCompany: '首页',
  30. userType: 2,
  31. online: 0, //网络链接,0:表示网络链接失败,1:表示网络链接正常
  32. onlineEntNum: 0, //在线企业数
  33. allEntNum: 0, //所有企业数
  34. serverNum: 0, //服务器数量
  35. shelvesEntNum: 0, //月新增上架企业数
  36. invoicedQuantity: 0, //月累计开票数量
  37. invoicedAmount: 0.0, //月累计开票金额
  38. onlineServiceProviderNum: 0, //服务商在线数量
  39. allServiceProviderNum: 0, //服务商总数
  40. serverOnlineEntNum: 0, //在线企业数
  41. serverAllEntNum: 0, //所有企业数
  42. onlinePersonnelNum: 0, //在线人员数量
  43. allRegisterPersonnelNum: 0, //总注册人数
  44. };
  45. this.fetchDefaultEnt();
  46. }
  47. render() {
  48. return (
  49. <View>
  50. <ScrollView style={home_css.homePageBak}>
  51. <View style={home_css.topImgBak}>
  52. <Swiper style={home_css.wrapper} showsButtons={false} autoplay={true}>
  53. <View style={home_css.slide1}>
  54. <Text style={home_css.text}>Hello Swiper</Text>
  55. </View>
  56. <View style={home_css.slide2}>
  57. <Text style={home_css.text}>Beautiful</Text>
  58. </View>
  59. <View style={home_css.slide3}>
  60. <Text style={home_css.text}>And simple</Text>
  61. </View>
  62. </Swiper>
  63. </View>
  64. <View>
  65. <NoticeBar
  66. onPress={() => alert('click')}
  67. marqueeProps={{loop: true, style: {fontSize: 12, color: 'red'}}}>
  68. Notice: The arrival time of incomes and transfers of Yu 'E Bao
  69. will be delayed during National Day.
  70. </NoticeBar>
  71. </View>
  72. <View style={home_css.taxItemBak}>
  73. <View style={home_css.tapBtnBak}>
  74. {this.state.landingStatus === 1 ? (
  75. this.state.authority.includes('sys:entInfo:preInit') ? (
  76. <TouchableOpacity
  77. style={home_css.tapBtnBakCol}
  78. onPress={() => {
  79. this.getLandingStatus(1);
  80. }}>
  81. <Image
  82. source={require('../../source/img/homeImg/taxManagement.png')}
  83. style={home_css.tapBtnImg}
  84. />
  85. <Text style={home_css.tapBtnTips}>企业上架</Text>
  86. </TouchableOpacity>
  87. ) : (
  88. <TouchableOpacity />
  89. )
  90. ) : (
  91. <TouchableOpacity
  92. style={home_css.tapBtnBakCol}
  93. onPress={() => {
  94. this.getLandingStatus(1);
  95. }}>
  96. <Image
  97. source={require('../../source/img/homeImg/taxManagement.png')}
  98. style={home_css.tapBtnImg}
  99. />
  100. <Text style={home_css.tapBtnTips}>企业上架</Text>
  101. </TouchableOpacity>
  102. )}
  103. {this.state.landingStatus === 1 ? (
  104. <TouchableOpacity
  105. style={home_css.tapBtnBakCol}
  106. onPress={() => {
  107. this.getLandingStatus(2);
  108. }}>
  109. <Image
  110. source={require('../../source/img/homeImg/productManagement.png')}
  111. style={home_css.tapBtnImg}
  112. />
  113. <Text style={home_css.tapBtnTips}>人员管理</Text>
  114. </TouchableOpacity>
  115. ) : (
  116. <TouchableOpacity
  117. style={home_css.tapBtnBakCol}
  118. onPress={() => {
  119. this.getLandingStatus(2);
  120. }}>
  121. <Image
  122. source={require('../../source/img/homeImg/productManagement.png')}
  123. style={home_css.tapBtnImg}
  124. />
  125. <Text style={home_css.tapBtnTips}>人员管理</Text>
  126. </TouchableOpacity>
  127. )}
  128. {this.state.landingStatus === 1 ? (
  129. <TouchableOpacity
  130. style={home_css.tapBtnBakCol}
  131. onPress={() => {
  132. this.getLandingStatus(3);
  133. }}>
  134. <Image
  135. source={require('../../source/img/homeImg/userManagement.png')}
  136. style={home_css.tapBtnImg}
  137. />
  138. <Text style={home_css.tapBtnTips}>操作审计</Text>
  139. </TouchableOpacity>
  140. ) : (
  141. <TouchableOpacity
  142. style={home_css.tapBtnBakCol}
  143. onPress={() => {
  144. this.getLandingStatus(3);
  145. }}>
  146. <Image
  147. source={require('../../source/img/homeImg/userManagement.png')}
  148. style={home_css.tapBtnImg}
  149. />
  150. <Text style={home_css.tapBtnTips}>操作审计</Text>
  151. </TouchableOpacity>
  152. )}
  153. {this.state.landingStatus === 1 ? (
  154. this.state.authority.includes('sys:entInfo:pageByMachineId') ? (
  155. <TouchableOpacity
  156. style={home_css.tapBtnBakCol}
  157. onPress={() => {
  158. this.getLandingStatus(4);
  159. }}>
  160. <Image
  161. source={require('../../source/img/homeImg/userManagement.png')}
  162. style={home_css.tapBtnImg}
  163. />
  164. <Text style={home_css.tapBtnTips}>企业列表</Text>
  165. </TouchableOpacity>
  166. ) : (
  167. <TouchableOpacity />
  168. )
  169. ) : (
  170. <TouchableOpacity
  171. style={home_css.tapBtnBakCol}
  172. onPress={() => {
  173. this.getLandingStatus(4);
  174. }}>
  175. <Image
  176. source={require('../../source/img/homeImg/userManagement.png')}
  177. style={home_css.tapBtnImg}
  178. />
  179. <Text style={home_css.tapBtnTips}>企业列表</Text>
  180. </TouchableOpacity>
  181. )}
  182. {this.state.landingStatus === 1 ? (
  183. this.state.authority.includes('sys:invoice:view') ? (
  184. <TouchableOpacity
  185. style={home_css.tapBtnBakCol}
  186. onPress={() => {
  187. this.getLandingStatus(6);
  188. }}>
  189. <Image
  190. source={require('../../source/img/homeImg/userManagement.png')}
  191. style={home_css.tapBtnImg}
  192. />
  193. <Text style={home_css.tapBtnTips}>开票列表</Text>
  194. </TouchableOpacity>
  195. ) : (
  196. <TouchableOpacity />
  197. )
  198. ) : (
  199. <TouchableOpacity
  200. style={home_css.tapBtnBakCol}
  201. onPress={() => {
  202. this.getLandingStatus(6);
  203. }}>
  204. <Image
  205. source={require('../../source/img/homeImg/userManagement.png')}
  206. style={home_css.tapBtnImg}
  207. />
  208. <Text style={home_css.tapBtnTips}>开票列表</Text>
  209. </TouchableOpacity>
  210. )}
  211. {this.state.landingStatus === 1 ? (
  212. this.state.authority.includes('sys:hongchong:view') ? (
  213. <TouchableOpacity
  214. style={home_css.tapBtnBakCol}
  215. onPress={() => {
  216. this.getLandingStatus(8);
  217. }}>
  218. <Image
  219. source={require('../../source/img/homeImg/userManagement.png')}
  220. style={home_css.tapBtnImg}
  221. />
  222. <Text style={home_css.tapBtnTips}>红冲列表</Text>
  223. </TouchableOpacity>
  224. ) : (
  225. <TouchableOpacity />
  226. )
  227. ) : (
  228. <TouchableOpacity
  229. style={home_css.tapBtnBakCol}
  230. onPress={() => {
  231. this.getLandingStatus(8);
  232. }}>
  233. <Image
  234. source={require('../../source/img/homeImg/userManagement.png')}
  235. style={home_css.tapBtnImg}
  236. />
  237. <Text style={home_css.tapBtnTips}>红冲列表</Text>
  238. </TouchableOpacity>
  239. )}
  240. {this.state.landingStatus === 1 ? (
  241. this.state.authority.includes('isp:machineInfo:view') ? (
  242. <TouchableOpacity
  243. style={home_css.tapBtnBakCol}
  244. onPress={() => {
  245. this.getLandingStatus(5);
  246. }}>
  247. <Image
  248. source={require('../../source/img/homeImg/userManagement.png')}
  249. style={home_css.tapBtnImg}
  250. />
  251. <Text style={home_css.tapBtnTips}>服务器列表</Text>
  252. </TouchableOpacity>
  253. ) : (
  254. <TouchableOpacity />
  255. )
  256. ) : (
  257. <TouchableOpacity
  258. style={home_css.tapBtnBakCol}
  259. onPress={() => {
  260. this.getLandingStatus(5);
  261. }}>
  262. <Image
  263. source={require('../../source/img/homeImg/userManagement.png')}
  264. style={home_css.tapBtnImg}
  265. />
  266. <Text style={home_css.tapBtnTips}>服务器列表</Text>
  267. </TouchableOpacity>
  268. )}
  269. {this.state.landingStatus === 1 ? (
  270. this.state.authority.includes('isp:info:list:view') ? (
  271. <TouchableOpacity
  272. style={home_css.tapBtnBakCol}
  273. onPress={() => {
  274. this.getLandingStatus(7);
  275. }}>
  276. <Image
  277. source={require('../../source/img/homeImg/userManagement.png')}
  278. style={home_css.tapBtnImg}
  279. />
  280. <Text style={home_css.tapBtnTips}>服务商列表</Text>
  281. </TouchableOpacity>
  282. ) : (
  283. <TouchableOpacity />
  284. )
  285. ) : (
  286. <TouchableOpacity
  287. style={home_css.tapBtnBakCol}
  288. onPress={() => {
  289. this.getLandingStatus(7);
  290. }}>
  291. <Image
  292. source={require('../../source/img/homeImg/userManagement.png')}
  293. style={home_css.tapBtnImg}
  294. />
  295. <Text style={home_css.tapBtnTips}>服务商列表</Text>
  296. </TouchableOpacity>
  297. )}
  298. {/*<TouchableOpacity*/}
  299. {/* style={home_css.tapBtnBakCol}*/}
  300. {/* onPress={() => {*/}
  301. {/* this.getLandingStatus(15);*/}
  302. {/* }}>*/}
  303. {/* <Image*/}
  304. {/* source={require('../../source/img/homeImg/userManagement.png')}*/}
  305. {/* style={home_css.tapBtnImg}*/}
  306. {/* />*/}
  307. {/* <Text style={home_css.tapBtnTips}>测试</Text>*/}
  308. {/*</TouchableOpacity>*/}
  309. </View>
  310. </View>
  311. {this.state.userType == 2 ? (
  312. <View>
  313. <View style={home_css.yxTopicBak}>
  314. <View style={home_css.yxTopicBottom}>
  315. <TouchableOpacity style={[home_css.yxTopicItem]}>
  316. <Text style={home_css.yxTopicItemTextC}>
  317. {this.state.onlineEntNum}
  318. </Text>
  319. <Text style={home_css.yxTopicItemTextA}>在线企业数</Text>
  320. </TouchableOpacity>
  321. </View>
  322. <View style={home_css.statisticsView} />
  323. <View style={home_css.yxTopicBottom}>
  324. <TouchableOpacity style={[home_css.yxTopicItem]}>
  325. <Text style={home_css.yxTopicItemTextC}>
  326. {this.state.allEntNum}
  327. </Text>
  328. <Text style={home_css.yxTopicItemTextA}>所有企业数</Text>
  329. </TouchableOpacity>
  330. </View>
  331. </View>
  332. <View style={home_css.yxTopicBak}>
  333. <View style={home_css.yxTopicBottom}>
  334. <TouchableOpacity style={[home_css.yxTopicItem]}>
  335. <Text style={home_css.yxTopicItemTextC}>
  336. {this.state.serverNum}
  337. </Text>
  338. <Text style={home_css.yxTopicItemTextA}>服务器数量</Text>
  339. </TouchableOpacity>
  340. </View>
  341. <View style={home_css.statisticsView} />
  342. <View style={home_css.yxTopicBottom}>
  343. <TouchableOpacity style={[home_css.yxTopicItem]}>
  344. <Text style={home_css.yxTopicItemTextC}>
  345. {this.state.shelvesEntNum}
  346. </Text>
  347. <Text style={home_css.yxTopicItemTextA}>
  348. 月新增上架企业数
  349. </Text>
  350. </TouchableOpacity>
  351. </View>
  352. </View>
  353. <View style={home_css.yxTopicBak}>
  354. <View style={home_css.yxTopicBottom}>
  355. <TouchableOpacity style={[home_css.yxTopicItem]}>
  356. <Text style={home_css.yxTopicItemTextC}>
  357. {this.state.invoicedQuantity}
  358. </Text>
  359. <Text style={home_css.yxTopicItemTextA}>
  360. 月累计开票数量
  361. </Text>
  362. </TouchableOpacity>
  363. </View>
  364. <View style={home_css.statisticsView} />
  365. <View style={home_css.yxTopicBottom}>
  366. <TouchableOpacity style={[home_css.yxTopicItem]}>
  367. <Text style={home_css.yxTopicItemTextC}>
  368. {this.state.invoicedAmount}
  369. </Text>
  370. <Text style={home_css.yxTopicItemTextA}>
  371. 月累计开票金额
  372. </Text>
  373. </TouchableOpacity>
  374. </View>
  375. </View>
  376. </View>
  377. ) : (
  378. <View />
  379. )}
  380. {this.state.userType == 3 ? (
  381. <View>
  382. <View style={home_css.yxTopicBak}>
  383. <View style={home_css.yxTopicBottom}>
  384. <TouchableOpacity style={[home_css.yxTopicItem]}>
  385. <Text style={home_css.yxTopicItemTextC}>
  386. {this.state.onlineServiceProviderNum}
  387. </Text>
  388. <Text style={home_css.yxTopicItemTextA}>
  389. 服务商在线数量
  390. </Text>
  391. </TouchableOpacity>
  392. </View>
  393. <View style={home_css.statisticsView} />
  394. <View style={home_css.yxTopicBottom}>
  395. <TouchableOpacity style={[home_css.yxTopicItem]}>
  396. <Text style={home_css.yxTopicItemTextC}>
  397. {this.state.allServiceProviderNum}
  398. </Text>
  399. <Text style={home_css.yxTopicItemTextA}>服务商总数</Text>
  400. </TouchableOpacity>
  401. </View>
  402. </View>
  403. <View style={home_css.yxTopicBak}>
  404. <View style={home_css.yxTopicBottom}>
  405. <TouchableOpacity style={[home_css.yxTopicItem]}>
  406. <Text style={home_css.yxTopicItemTextC}>
  407. {this.state.serverOnlineEntNum}
  408. </Text>
  409. <Text style={home_css.yxTopicItemTextA}>企业在线数量</Text>
  410. </TouchableOpacity>
  411. </View>
  412. <View style={home_css.statisticsView} />
  413. <View style={home_css.yxTopicBottom}>
  414. <TouchableOpacity style={[home_css.yxTopicItem]}>
  415. <Text style={home_css.yxTopicItemTextC}>
  416. {this.state.serverAllEntNum}
  417. </Text>
  418. <Text style={home_css.yxTopicItemTextA}>企业总数</Text>
  419. </TouchableOpacity>
  420. </View>
  421. </View>
  422. <View style={home_css.yxTopicBak}>
  423. <View style={home_css.yxTopicBottom}>
  424. <TouchableOpacity style={[home_css.yxTopicItem]}>
  425. <Text style={home_css.yxTopicItemTextC}>
  426. {this.state.onlinePersonnelNum}
  427. </Text>
  428. <Text style={home_css.yxTopicItemTextA}>在线人员数量</Text>
  429. </TouchableOpacity>
  430. </View>
  431. <View style={home_css.statisticsView} />
  432. <View style={home_css.yxTopicBottom}>
  433. <TouchableOpacity style={[home_css.yxTopicItem]}>
  434. <Text style={home_css.yxTopicItemTextC}>
  435. {this.state.allRegisterPersonnelNum}
  436. </Text>
  437. <Text style={home_css.yxTopicItemTextA}>总注册人数</Text>
  438. </TouchableOpacity>
  439. </View>
  440. </View>
  441. </View>
  442. ) : (
  443. <View />
  444. )}
  445. <View style={home_css.yxTopicBak}>
  446. {this.state.online == 1 ? (
  447. <View style={home_css.yxTopicBottom}>
  448. <TouchableOpacity
  449. style={{
  450. width: 140,
  451. height: 50,
  452. margin: 10,
  453. justifyContent: 'center',
  454. alignItems: 'center',
  455. }}>
  456. <View
  457. style={{
  458. flexDirection: 'row',
  459. justifyContent: 'space-between',
  460. alignItems: 'center',
  461. }}>
  462. <Text
  463. style={[home_css.yxTopicItemTextA, {marginRight: 10}]}>
  464. 网络
  465. </Text>
  466. <Text style={{color: '#72C040'}}>已连接</Text>
  467. <Image
  468. source={require('../../source/img/online/success.png')}
  469. style={{
  470. width: 30,
  471. height: 30,
  472. margin: 5,
  473. borderRadius: 50,
  474. }}
  475. />
  476. </View>
  477. </TouchableOpacity>
  478. </View>
  479. ) : (
  480. <View style={home_css.yxTopicBottom}>
  481. <TouchableOpacity
  482. style={{
  483. width: 140,
  484. height: 50,
  485. margin: 10,
  486. justifyContent: 'center',
  487. alignItems: 'center',
  488. }}>
  489. <View
  490. style={{
  491. flexDirection: 'row',
  492. justifyContent: 'space-between',
  493. alignItems: 'center',
  494. }}>
  495. <Text
  496. style={[home_css.yxTopicItemTextA, {marginRight: 10}]}>
  497. 网络
  498. </Text>
  499. <Text style={{color: '#D75054'}}>未连接</Text>
  500. <Image
  501. source={require('../../source/img/online/fail.png')}
  502. style={{
  503. width: 30,
  504. height: 30,
  505. margin: 5,
  506. borderRadius: 50,
  507. }}
  508. />
  509. </View>
  510. </TouchableOpacity>
  511. </View>
  512. )}
  513. <View style={home_css.statisticsView} />
  514. <View style={home_css.yxTopicBottom}>
  515. <TouchableOpacity
  516. style={{
  517. width: 140,
  518. height: 50,
  519. margin: 10,
  520. justifyContent: 'center',
  521. alignItems: 'center',
  522. }}>
  523. <View
  524. style={{
  525. flexDirection: 'row',
  526. justifyContent: 'space-between',
  527. alignItems: 'center',
  528. }}>
  529. <Text style={[home_css.yxTopicItemTextA, {marginRight: 10}]}>
  530. 税控
  531. </Text>
  532. <Text style={{color: '#D75054'}}>未连接</Text>
  533. <Image
  534. source={require('../../source/img/online/fail.png')}
  535. style={{
  536. width: 30,
  537. height: 30,
  538. margin: 5,
  539. borderRadius: 50,
  540. }}
  541. />
  542. </View>
  543. </TouchableOpacity>
  544. </View>
  545. </View>
  546. </ScrollView>
  547. </View>
  548. );
  549. }
  550. componentDidMount() {
  551. console.disableYellowBox = true;
  552. NetInfo.fetch().done((status) => {
  553. if (status.type != 'none') {
  554. this.setState({
  555. online: 1,
  556. });
  557. }
  558. });
  559. this.setLoginType();
  560. this.getAuthority();
  561. this.getHomeData();
  562. // 收到监听
  563. this.listener = DeviceEventEmitter.addListener(
  564. 'updateCurMon',
  565. (message) => {
  566. // 收到监听后想做的事情 // 监听
  567. this.fetchDefaultEnt();
  568. },
  569. );
  570. }
  571. componentWillUnmount() {
  572. // 移除监听
  573. if (this.listener) {
  574. this.listener.remove();
  575. }
  576. this.setState = (state, callback) => {
  577. return;
  578. };
  579. }
  580. //根据登陆帐号获取帐号类型
  581. setLoginType = async () => {
  582. let userType = await RetrieveData('usertype');
  583. userType = userType.substring(1, userType.length - 1);
  584. this.setState({
  585. userType: userType,
  586. });
  587. };
  588. //获取当前默认绑定企业
  589. fetchDefaultEnt = async () => {
  590. //const defaultFirm =await RetrieveData('defaultEnt');
  591. //console.log( "default ent:" + JSON.stringify(defaultFirm));
  592. //console.log( "default ent:");
  593. const res = await RetrieveData('token');
  594. const account = await RetrieveData('account');
  595. if (res && account) {
  596. let token = res.substring(1, res.length - 1);
  597. let mobile = account.substring(1, account.length - 1);
  598. const url = 'https://app.taxbk.cn:9443/auth/comm/user/findDefaultChoose';
  599. let response = await GetDataPost(
  600. url,
  601. token,
  602. {
  603. mobile: mobile,
  604. },
  605. false,
  606. 2,
  607. );
  608. if (response.code != 0) {
  609. ShowToast(response.msg);
  610. } else {
  611. this.setState({curCompany: response.data.entName});
  612. //console.log("当前默认绑定企业: "+JSON.stringify(response.data));
  613. await IndividualStorageData(
  614. 'defaultEnt',
  615. JSON.stringify(response.data),
  616. );
  617. // await this.getKPStatsMonth(response.data.entTaxId);
  618. this.props.navigation.setOptions({
  619. headerTitleAlign: 'center',
  620. headerTitle: (props) => {
  621. return (
  622. <View
  623. style={{
  624. flexDirection: 'row',
  625. justifyContent: 'center',
  626. alignItems: 'center',
  627. }}>
  628. <Text style={{color: '#fff', fontSize: 16, fontWeight: '700'}}>
  629. {this.state.curCompany ? this.state.curCompany : '首页'}
  630. </Text>
  631. <TouchableOpacity
  632. onPress={async () => {
  633. const res = await RetrieveData('token');
  634. const account = await RetrieveData('account');
  635. if (res && account) {
  636. this.props.navigation.navigate('enterprise_list');
  637. } else {
  638. ShowToast('请先登录');
  639. }
  640. }}>
  641. {/*<Image*/}
  642. {/* source={require('../../source/img/homeImg/change.png')}*/}
  643. {/* style={{marginLeft: 5, width: 14, height: 14}}*/}
  644. {/*/>*/}
  645. </TouchableOpacity>
  646. </View>
  647. );
  648. },
  649. headerStyle: {backgroundColor: '#00A2FE', borderWidth: 0},
  650. });
  651. }
  652. } else {
  653. this.setState({
  654. sumNum: 0.0,
  655. totalAmt: 0.0,
  656. totalTaxes: 0.0,
  657. curCompany: '首页',
  658. });
  659. this.props.navigation.setOptions({
  660. headerTitle: (props) => {
  661. //console.log("==="+ this.state.curCompany);
  662. return (
  663. <View
  664. style={{
  665. flexDirection: 'row',
  666. justifyContent: 'center',
  667. alignItems: 'flex-end',
  668. }}>
  669. <Text style={{color: '#fff', fontSize: 20, fontWeight: '600'}}>
  670. {this.state.curCompany ? this.state.curCompany : '首页'}
  671. </Text>
  672. </View>
  673. );
  674. },
  675. headerTintColor: '#fff',
  676. });
  677. }
  678. };
  679. //判断是否登陆
  680. getLandingStatus = async (type) => {
  681. const account = await RetrieveData('account');
  682. if (account) {
  683. this.setState({
  684. landingStatus: 1,
  685. });
  686. if (type == 1) {
  687. this.props.navigation.navigate('enterprise_shelves');
  688. }
  689. if (type == 2) {
  690. this.props.navigation.navigate('personnel_list');
  691. }
  692. if (type == 3) {
  693. this.props.navigation.navigate('operation_audit_list');
  694. }
  695. if (type == 4) {
  696. this.props.navigation.navigate('enterprise_information');
  697. }
  698. if (type == 5) {
  699. this.props.navigation.navigate('server_list');
  700. }
  701. if (type == 6) {
  702. this.props.navigation.navigate('invoice_inquiry');
  703. }
  704. if (type == 7) {
  705. this.props.navigation.navigate('service_provider_list');
  706. }
  707. if (type == 8) {
  708. this.props.navigation.navigate('invoice_inquiry_red_rush');
  709. }
  710. if (type == 15) {
  711. this.props.navigation.navigate('Test');
  712. }
  713. } else {
  714. this.setState({
  715. landingStatus: 0,
  716. });
  717. this.props.navigation.navigate('login_head');
  718. }
  719. };
  720. //获取权限信息
  721. getAuthority = async () => {
  722. const authority = await RetrieveData('authority');
  723. if (authority) {
  724. this.setState({
  725. authority: authority,
  726. landingStatus: 1,
  727. });
  728. }
  729. };
  730. //获取首页数据
  731. getHomeData = async () => {
  732. let account = await RetrieveData('account');
  733. let token = await RetrieveData('token');
  734. if (token && account) {
  735. account = account.substring(1, account.length - 1);
  736. token = token.substring(1, token.length - 1);
  737. const url = 'https://app.taxbk.cn:9443/sys/stat/home';
  738. GetDataPost(
  739. url,
  740. token,
  741. {
  742. mobile: account,
  743. },
  744. false,
  745. 2,
  746. ).then((res) => {
  747. this.setState({
  748. onlineEntNum: res.data.onlineEntCnt,
  749. allEntNum: res.data.entCnt,
  750. shelvesEntNum: res.data.newInitEntCnt,
  751. invoicedAmount: res.data.monthInvoiceAmt,
  752. serverNum: res.data.machineCnt,
  753. invoicedQuantity: res.data.monthInvoiceCnt,
  754. serverOnlineEntNum: res.data.onlineEntCnt,
  755. serverAllEntNum: res.data.entCnt,
  756. allRegisterPersonnelNum: res.data.userCnt,
  757. allServiceProviderNum: res.data.ispCnt,
  758. onlinePersonnelNum: res.data.onlineUserCnt,
  759. onlineServiceProviderNum: res.data.onlineIspCnt,
  760. });
  761. });
  762. }
  763. };
  764. }