home_page.js 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073
  1. import React, {Component} from 'react';
  2. import {
  3. Image,
  4. StyleSheet,
  5. Dimensions,
  6. ImageBackground,
  7. TouchableOpacity,
  8. ScrollView,
  9. Text,
  10. View,
  11. DeviceEventEmitter,
  12. SafeAreaView,
  13. Alert,
  14. } from 'react-native';
  15. import {RequestNetwork} from '../../data/encryption';
  16. import {IndividualStorageData, RetrieveData} from '../../data/storage';
  17. import LinearGradient from 'react-native-linear-gradient';
  18. import Swiper from 'react-native-swiper';
  19. import public_css from '../../source/css/public_css';
  20. import {noticeIcon, homeArrow} from '../../source/icon/icon';
  21. import {SvgXml} from 'react-native-svg';
  22. import {CleanAll} from '../../components/abnormalMessage/abnormal_message';
  23. import {ToastShow} from '../../components/toast/toast';
  24. import {WhiteSpace, WingBlank, Carousel} from '@ant-design/react-native';
  25. import { GetMonthDate } from "../../utils/date";
  26. export default class home_page extends Component {
  27. constructor(props) {
  28. super(props);
  29. this.state = {
  30. pageNo: 1,
  31. name: '',
  32. info: '',
  33. totalAmt: 0.0,
  34. totalTaxes: 0.0,
  35. sumNum: 0.0,
  36. authority: '',
  37. landingStatus: 0, //登录状态,0:表示未登录,1:表示已登录
  38. curCompany: '首页',
  39. fontStatus: '更多',
  40. monthTotal: 0.0,
  41. monthTotalTaxes: 0.0,
  42. list: [1, 2, 3],
  43. statisticsData: {},
  44. activityList: [],
  45. invoiceNumber: 0,
  46. };
  47. }
  48. render() {
  49. return (
  50. <SafeAreaView style={public_css.body}>
  51. <ScrollView style={styles.homePageBak}>
  52. <View style={styles.banner_box}>
  53. <Swiper
  54. style={styles.wrapper}
  55. height={170}
  56. horizontal={true}
  57. index={0}
  58. autoplay
  59. autoplayTimeout={4}>
  60. {/*{this.state.list.map((item, index) => {*/}
  61. {/* return (*/}
  62. {/* <View style={styles.carousel}>*/}
  63. {/* <Image*/}
  64. {/* key={index}*/}
  65. {/* style={{height: 170}}*/}
  66. {/* resizeMode={'contain'}*/}
  67. {/* source={require('../../source/img/homeImg/homeImg1.png')}*/}
  68. {/* />*/}
  69. {/* </View>*/}
  70. {/* );*/}
  71. {/*})}*/}
  72. <View style={styles.carousel}>
  73. <Image
  74. style={styles.banner_img}
  75. resizeMode="cover"
  76. source={require('../../source/img/homeImg/homeImg1.png')}
  77. />
  78. </View>
  79. <View style={styles.carousel}>
  80. <Image
  81. style={styles.banner_img}
  82. resizeMode="cover"
  83. source={require('../../source/img/homeImg/homeImg2.png')}
  84. />
  85. </View>
  86. <TouchableOpacity
  87. style={styles.carousel}
  88. onPress={() => {
  89. this.props.navigation.navigate('loan');
  90. }}>
  91. <Image
  92. style={styles.banner_img}
  93. resizeMode="cover"
  94. source={require('../../source/img/homeImg/homeImg3.png')}
  95. />
  96. </TouchableOpacity>
  97. </Swiper>
  98. </View>
  99. <View style={styles.taxItemBak}>
  100. {this.state.landingStatus === 1 ? (
  101. <TouchableOpacity
  102. style={styles.tapBtnBakCol}
  103. onPress={() => {
  104. this.getLandingStatus(1);
  105. }}>
  106. <Image
  107. source={require('../../source/img/homeImg/taxManagement.png')}
  108. style={styles.tapBtnImg}
  109. />
  110. <Text style={styles.tapBtnTips}>手工开票</Text>
  111. </TouchableOpacity>
  112. ) : (
  113. <TouchableOpacity
  114. style={styles.tapBtnBakCol}
  115. onPress={() => {
  116. this.getLandingStatus(1);
  117. }}>
  118. <Image
  119. source={require('../../source/img/homeImg/taxManagement.png')}
  120. style={styles.tapBtnImg}
  121. />
  122. <Text style={styles.tapBtnTips}>手工开票</Text>
  123. </TouchableOpacity>
  124. )}
  125. {this.state.landingStatus === 1 ? (
  126. <TouchableOpacity
  127. style={styles.tapBtnBakCol}
  128. onPress={() => {
  129. this.getLandingStatus(2);
  130. }}>
  131. <Image
  132. source={require('../../source/img/homeImg/saoma.png')}
  133. style={styles.tapBtnImg}
  134. />
  135. <Text style={styles.tapBtnTips}>扫码开票</Text>
  136. </TouchableOpacity>
  137. ) : (
  138. <TouchableOpacity
  139. style={styles.tapBtnBakCol}
  140. onPress={() => {
  141. this.getLandingStatus(2);
  142. }}>
  143. <Image
  144. source={require('../../source/img/homeImg/saoma.png')}
  145. style={styles.tapBtnImg}
  146. />
  147. <Text style={styles.tapBtnTips}>扫码开票</Text>
  148. </TouchableOpacity>
  149. )}
  150. {this.state.landingStatus === 1 ? (
  151. <TouchableOpacity
  152. style={styles.tapBtnBakCol}
  153. onPress={() => {
  154. this.getLandingStatus(3);
  155. }}>
  156. <Image
  157. source={require('../../source/img/homeImg/goufanginvoice.png')}
  158. style={styles.tapBtnImg}
  159. />
  160. <Text style={styles.tapBtnTips}>购方开票</Text>
  161. </TouchableOpacity>
  162. ) : (
  163. <TouchableOpacity
  164. style={styles.tapBtnBakCol}
  165. onPress={() => {
  166. this.getLandingStatus(3);
  167. }}>
  168. <Image
  169. source={require('../../source/img/homeImg/goufanginvoice.png')}
  170. style={styles.tapBtnImg}
  171. />
  172. <Text style={styles.tapBtnTips}>购方开票</Text>
  173. </TouchableOpacity>
  174. )}
  175. {this.state.landingStatus === 1 ? (
  176. <TouchableOpacity
  177. style={styles.tapBtnBakCol}
  178. onPress={() => {
  179. this.getLandingStatus(4);
  180. }}>
  181. <Image
  182. source={require('../../source/img/homeImg/daikaitaitou.png')}
  183. style={styles.tapBtnImg}
  184. />
  185. <Text style={styles.tapBtnTips}>待开抬头</Text>
  186. </TouchableOpacity>
  187. ) : (
  188. <TouchableOpacity
  189. style={styles.tapBtnBakCol}
  190. onPress={() => {
  191. this.getLandingStatus(4);
  192. }}>
  193. <Image
  194. source={require('../../source/img/homeImg/daikaitaitou.png')}
  195. style={styles.tapBtnImg}
  196. />
  197. <Text style={styles.tapBtnTips}>待开抬头</Text>
  198. </TouchableOpacity>
  199. )}
  200. {this.state.landingStatus === 1 ? (
  201. <TouchableOpacity
  202. style={styles.tapBtnBakCol}
  203. onPress={() => {
  204. this.getLandingStatus(5);
  205. }}>
  206. <Image
  207. source={require('../../source/img/homeImg/daikaiinvoice.png')}
  208. style={styles.tapBtnImg}
  209. />
  210. <Text style={styles.tapBtnTips}>待开发票</Text>
  211. </TouchableOpacity>
  212. ) : (
  213. <TouchableOpacity
  214. style={styles.tapBtnBakCol}
  215. onPress={() => {
  216. this.getLandingStatus(5);
  217. }}>
  218. <Image
  219. source={require('../../source/img/homeImg/daikaiinvoice.png')}
  220. style={styles.tapBtnImg}
  221. />
  222. <Text style={styles.tapBtnTips}>待开发票</Text>
  223. </TouchableOpacity>
  224. )}
  225. {this.state.landingStatus === 1 ? (
  226. <TouchableOpacity
  227. style={styles.tapBtnBakCol}
  228. onPress={() => {
  229. this.getLandingStatus(6);
  230. }}>
  231. <Image
  232. source={require('../../source/img/homeImg/invoicelinggou.png')}
  233. style={styles.tapBtnImg}
  234. />
  235. <Text style={styles.tapBtnTips}>发票领购</Text>
  236. </TouchableOpacity>
  237. ) : (
  238. <TouchableOpacity
  239. style={styles.tapBtnBakCol}
  240. onPress={() => {
  241. this.getLandingStatus(6);
  242. }}>
  243. <Image
  244. source={require('../../source/img/homeImg/invoicelinggou.png')}
  245. style={styles.tapBtnImg}
  246. />
  247. <Text style={styles.tapBtnTips}>发票领购</Text>
  248. </TouchableOpacity>
  249. )}
  250. {this.state.landingStatus === 1 ? (
  251. <TouchableOpacity
  252. style={styles.tapBtnBakCol}
  253. onPress={() => {
  254. this.getLandingStatus(7);
  255. }}>
  256. <Image
  257. source={require('../../source/img/homeImg/invoicefenfa.png')}
  258. style={styles.tapBtnImg}
  259. />
  260. <Text style={styles.tapBtnTips}>发票分发</Text>
  261. </TouchableOpacity>
  262. ) : (
  263. <TouchableOpacity
  264. style={styles.tapBtnBakCol}
  265. onPress={() => {
  266. this.getLandingStatus(7);
  267. }}>
  268. <Image
  269. source={require('../../source/img/homeImg/invoicefenfa.png')}
  270. style={styles.tapBtnImg}
  271. />
  272. <Text style={styles.tapBtnTips}>发票分发</Text>
  273. </TouchableOpacity>
  274. )}
  275. {this.state.landingStatus === 1 ? (
  276. <TouchableOpacity
  277. style={styles.tapBtnBakCol}
  278. onPress={() => {
  279. this.getLandingStatus(8);
  280. }}>
  281. <Image
  282. source={require('../../source/img/homeImg/invoiceSearch.png')}
  283. style={styles.tapBtnImg}
  284. />
  285. <Text style={styles.tapBtnTips}>发票查询</Text>
  286. </TouchableOpacity>
  287. ) : (
  288. <TouchableOpacity
  289. style={styles.tapBtnBakCol}
  290. onPress={() => {
  291. this.getLandingStatus(8);
  292. }}>
  293. <Image
  294. source={require('../../source/img/homeImg/invoiceSearch.png')}
  295. style={styles.tapBtnImg}
  296. />
  297. <Text style={styles.tapBtnTips}>发票查询</Text>
  298. </TouchableOpacity>
  299. )}
  300. </View>
  301. <View style={{height: 10, backgroundColor: '#F7F7F7'}} />
  302. <Carousel
  303. style={styles.wrapper1}
  304. selectedIndex={2}
  305. autoplay
  306. infinite
  307. // afterChange={this.onHorizontalSelectedIndexChange}
  308. >
  309. {this.state.activityList.map((item) => {
  310. return (
  311. <TouchableOpacity
  312. key={item.campaignId}
  313. style={styles.carousel1}
  314. onPress={() => {
  315. this.props.navigation.navigate('activity', {
  316. data: {
  317. title: item.campaignName,
  318. desc: item.campaignDesc,
  319. number: item.campaignId,
  320. url: item.detailUrl,
  321. },
  322. });
  323. }}>
  324. <Image
  325. style={styles.banner_img}
  326. source={{uri: item.bannerImgUrl}}
  327. resizeMode="cover"
  328. />
  329. </TouchableOpacity>
  330. );
  331. })}
  332. </Carousel>
  333. <View style={styles.yxTopicBak}>
  334. <View style={styles.yxTopicTop}>
  335. <View style={styles.userOnlineLeft}>
  336. {/*<Image*/}
  337. {/* source={require('../../source/img/homeImg/service.png')}*/}
  338. {/* style={{width: 18, height: 18}}*/}
  339. {/*/>*/}
  340. <Text
  341. style={{
  342. fontSize: 16,
  343. color: 'rgba(51, 51, 51, 1)',
  344. fontWeight: 'bold',
  345. }}>
  346. 本月概览
  347. </Text>
  348. </View>
  349. <TouchableOpacity
  350. style={styles.userOnlineRight}
  351. onPress={() => {
  352. this.props.navigation.navigate('home_amount_statistics');
  353. }}>
  354. <Text style={{color: 'rgba(153, 153, 153, 1)', marginRight: 5}}>
  355. 查看更多
  356. </Text>
  357. <Image
  358. source={require('../../source/img/homeImg/go.png')}
  359. style={{marginTop: 3, width: 12, height: 12}}
  360. />
  361. </TouchableOpacity>
  362. </View>
  363. <View style={styles.yxTopicBottom}>
  364. {/*<TouchableOpacity*/}
  365. {/* style={[styles.yxTopicItem, styles.yxTopicItem_1]}>*/}
  366. {/* <Text style={styles.yxTopicItemTextA}>开票总数</Text>*/}
  367. {/* /!*<Text style={styles.yxTopicItemTextB}>剩余发票数量</Text>*!/*/}
  368. {/* <Text style={styles.yxTopicItemTextC}>*/}
  369. {/* {this.state.statisticsInfo.monthTotal}*/}
  370. {/* </Text>*/}
  371. {/*</TouchableOpacity>*/}
  372. <LinearGradient
  373. colors={['#F56B6C', '#FA8384']}
  374. style={styles.yxTopicItem}
  375. start={{x: 0.25, y: 0.25}}
  376. end={{x: 0.7, y: 0.7}}>
  377. <TouchableOpacity style={styles.yc_inner}>
  378. <Text style={styles.yxTopicItemTextA}>开票总数</Text>
  379. <Text style={styles.yxTopicItemTextC}>{this.state.invoiceNumber}</Text>
  380. </TouchableOpacity>
  381. </LinearGradient>
  382. <LinearGradient
  383. colors={['#F59B6B', '#F7CA8D']}
  384. style={styles.yxTopicItem}
  385. start={{x: 0.25, y: 0.25}}
  386. end={{x: 0.7, y: 0.7}}>
  387. <TouchableOpacity style={styles.yc_inner}>
  388. <Text style={styles.yxTopicItemTextA}>开票总额</Text>
  389. <Text style={styles.yxTopicItemTextC}>
  390. {this.state.monthTotal}
  391. </Text>
  392. </TouchableOpacity>
  393. </LinearGradient>
  394. <LinearGradient
  395. style={styles.yxTopicItem}
  396. colors={['#3BC0D0', '#58DBE8']}
  397. start={{x: 0.25, y: 0.25}}
  398. end={{x: 0.7, y: 0.7}}>
  399. <TouchableOpacity style={styles.yc_inner}>
  400. <Text style={styles.yxTopicItemTextA}>税额</Text>
  401. <Text style={styles.yxTopicItemTextC}>
  402. {this.state.monthTotalTaxes}
  403. </Text>
  404. </TouchableOpacity>
  405. </LinearGradient>
  406. </View>
  407. </View>
  408. <View style={{backgroundColor: '#FCFCFE'}}>
  409. <Text style={styles.main_title}>未税金额</Text>
  410. <View style={styles.line_des}>
  411. <View style={styles.line_item}>
  412. <Image
  413. style={{width: 20, height: 20}}
  414. source={require('../../source/img/homeImg/leiji.png')}
  415. />
  416. <Text style={styles.font_item}>累计成功开票未税金额(元)</Text>
  417. </View>
  418. <Text style={styles.font_item_right}>
  419. {this.state.statisticsData.monthTotal}
  420. </Text>
  421. </View>
  422. <View style={styles.line_des}>
  423. <View style={styles.line_item}>
  424. <Image
  425. style={{width: 20, height: 20}}
  426. source={require('../../source/img/homeImg/zhuan.png')}
  427. />
  428. <Text style={styles.font_item}>专票开票未税金额(元)</Text>
  429. </View>
  430. <Text style={styles.font_item_right}>
  431. {this.state.statisticsData.monthZhuanpiaoTotal}
  432. </Text>
  433. </View>
  434. <View style={styles.line_des}>
  435. <View style={styles.line_item}>
  436. <Image
  437. style={{width: 20, height: 20}}
  438. source={require('../../source/img/homeImg/leijicheng.png')}
  439. />
  440. <Text style={styles.font_item}>普票开票未税金额(元)</Text>
  441. </View>
  442. <Text style={styles.font_item_right}>
  443. {this.state.statisticsData.monthPupiaoTotal}
  444. </Text>
  445. </View>
  446. <Text style={styles.main_title}>累计税额</Text>
  447. <View style={styles.line_des}>
  448. <View style={styles.line_item}>
  449. <Image
  450. style={{width: 20, height: 20}}
  451. source={require('../../source/img/homeImg/leiji.png')}
  452. />
  453. <Text style={styles.font_item}>累计开票税额(元)</Text>
  454. </View>
  455. <Text style={styles.font_item_right}>
  456. {this.state.statisticsData.monthTotalTaxes}
  457. </Text>
  458. </View>
  459. <View style={styles.line_des}>
  460. <View style={styles.line_item}>
  461. <Image
  462. style={{width: 20, height: 20}}
  463. source={require('../../source/img/homeImg/zhuan.png')}
  464. />
  465. <Text style={styles.font_item}>专票开票税额(元)</Text>
  466. </View>
  467. <Text style={styles.font_item_right}>
  468. {this.state.statisticsData.monthZhuanpiaoTotalTaxes}
  469. </Text>
  470. </View>
  471. <View style={styles.line_des}>
  472. <View style={styles.line_item}>
  473. <Image
  474. style={{width: 20, height: 20}}
  475. source={require('../../source/img/homeImg/leijicheng.png')}
  476. />
  477. <Text style={styles.font_item}>普票开票税额(元)</Text>
  478. </View>
  479. <Text style={styles.font_item_right}>
  480. {this.state.statisticsData.monthPupiaoTotalTaxes}
  481. </Text>
  482. </View>
  483. <WhiteSpace />
  484. </View>
  485. {/*<View style={styles.xpPushBak}>*/}
  486. {/* <View style={styles.xpPushTop}>*/}
  487. {/* <View style={styles.userOnlineLeft}>*/}
  488. {/* <Image*/}
  489. {/* source={require('../../source/img/homeImg/recommend.png')}*/}
  490. {/* style={{width: 18, height: 18}}*/}
  491. {/* />*/}
  492. {/* <Text*/}
  493. {/* style={{*/}
  494. {/* marginLeft: 10,*/}
  495. {/* fontSize: 16,*/}
  496. {/* color: 'rgba(51, 51, 51, 1)',*/}
  497. {/* }}>*/}
  498. {/* 新品推荐*/}
  499. {/* </Text>*/}
  500. {/* </View>*/}
  501. {/* <TouchableOpacity style={styles.userOnlineRight}>*/}
  502. {/* <Text style={{color: 'rgba(153, 153, 153, 1)', marginRight: 5}}>*/}
  503. {/* 查看全部*/}
  504. {/* </Text>*/}
  505. {/* <Image*/}
  506. {/* source={require('../../source/img/homeImg/go.png')}*/}
  507. {/* style={{marginTop: 3, width: 12, height: 12}}*/}
  508. {/* />*/}
  509. {/* </TouchableOpacity>*/}
  510. {/* </View>*/}
  511. {/* <View style={styles.xpPushBottom}>*/}
  512. {/* <View style={styles.xpPushItem}>*/}
  513. {/* <TouchableOpacity*/}
  514. {/* onPress={() => {*/}
  515. {/* this.props.navigation.navigate('recommend_home');*/}
  516. {/* }}>*/}
  517. {/* <Image*/}
  518. {/* style={{*/}
  519. {/* height: '100%',*/}
  520. {/* width: '100%',*/}
  521. {/* borderRadius: 10,*/}
  522. {/* resizeMode: 'stretch',*/}
  523. {/* }}*/}
  524. {/* source={require('../../source/img/homeImg/activity.png')}*/}
  525. {/* />*/}
  526. {/* </TouchableOpacity>*/}
  527. {/* </View>*/}
  528. {/* </View>*/}
  529. {/*</View>*/}
  530. </ScrollView>
  531. </SafeAreaView>
  532. );
  533. }
  534. // render加载完后调用
  535. async componentDidMount() {
  536. await this.getAuthority();
  537. await this.getCompanyInfo();
  538. await this.getInvoiceStatistics();
  539. await this.getLoanList();
  540. await this.getInvoiceNumber();
  541. // 收到监听
  542. this.listener = DeviceEventEmitter.addListener(
  543. 'updateCompany',
  544. (message) => {
  545. // 收到监听后想做的事情 // 监听
  546. this.getCompanyInfo();
  547. this.getInvoiceStatistics();
  548. this.getInvoiceNumber();
  549. //this.getKPStatsMonth();
  550. },
  551. );
  552. this.listenerStatistics = DeviceEventEmitter.addListener(
  553. 'updateStatistics',
  554. (message) => {
  555. // 收到监听后想做的事情 // 监听
  556. this.getInvoiceStatistics();
  557. this.getInvoiceNumber();
  558. },
  559. );
  560. }
  561. componentWillUnmount() {
  562. // 移除监听
  563. if (this.listener) {
  564. this.listener.remove();
  565. }
  566. if (this.listenerStatistics) {
  567. this.listenerStatistics.remove();
  568. }
  569. this.setState = (state, callback) => {
  570. return;
  571. };
  572. }
  573. //首页数据获取
  574. getKPStatsMonth = async (curEntId) => {
  575. const token = await RetrieveData('token');
  576. const account = await RetrieveData('account');
  577. //const curEntId =await RetrieveData('defaultEnt');
  578. if (token && account) {
  579. const url = '/sys/invoice_info/getKPStatsMonth';
  580. let response = await RequestNetwork(
  581. url,
  582. token,
  583. {
  584. entTaxId: curEntId,
  585. },
  586. false,
  587. 2,
  588. );
  589. if (response.code != 0) {
  590. //console.log(response);
  591. this.setState({
  592. sumNum: 0.0,
  593. totalAmt: 0.0,
  594. totalTaxes: 0.0,
  595. });
  596. } else {
  597. this.setState({
  598. sumNum: response.data.cnt,
  599. totalAmt: response.data.totalAmt,
  600. totalTaxes: response.data.totalTaxes,
  601. });
  602. }
  603. }
  604. };
  605. // 获取当前默认绑定企业
  606. getCompanyInfo = async () => {
  607. let company = await RetrieveData('company');
  608. if (company) {
  609. company = JSON.parse(company);
  610. }
  611. this.props.navigation.setOptions({
  612. headerTitleAlign: 'left',
  613. headerTitle: (props) => {
  614. return (
  615. <View
  616. style={{
  617. flexDirection: 'row',
  618. justifyContent: 'space-between',
  619. alignItems: 'center',
  620. }}>
  621. <View style={{flex: 1}}>
  622. <TouchableOpacity
  623. style={{
  624. flexDirection: 'row',
  625. alignItems: 'center',
  626. justifyContent: 'flex-start',
  627. }}
  628. onPress={async () => {
  629. if (company) {
  630. this.props.navigation.navigate('enterprise_list', {
  631. getCompanyInfo: () => {
  632. this.getCompanyInfo();
  633. },
  634. });
  635. } else {
  636. await this.getLandingStatus(-1);
  637. }
  638. }}>
  639. <Text
  640. ellipsizeMode={'tail'}
  641. numberOfLines={1}
  642. style={{
  643. color: '#000000',
  644. fontSize: 20,
  645. fontWeight: '600',
  646. }}>
  647. {company ? company.entName : '未登录'}
  648. </Text>
  649. <SvgXml height={12} xml={homeArrow()} />
  650. {/*<View>*/}
  651. {/* */}
  652. {/*</View>*/}
  653. {/*<View>*/}
  654. {/* */}
  655. {/*</View>*/}
  656. </TouchableOpacity>
  657. </View>
  658. <View
  659. style={{
  660. width: 50,
  661. height: 27,
  662. alignItems: 'center',
  663. justifyContent: 'center',
  664. }}>
  665. <TouchableOpacity
  666. onPress={async () => {
  667. this.props.navigation.navigate('notice');
  668. }}>
  669. <SvgXml height={22} xml={noticeIcon()} />
  670. </TouchableOpacity>
  671. </View>
  672. </View>
  673. );
  674. },
  675. headerStyle: {backgroundColor: '#ffffff', borderWidth: 0},
  676. });
  677. await this.getInvoiceStatistics();
  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('invoice');
  688. }
  689. if (type === 2) {
  690. this.props.navigation.navigate('invoice_qrcode');
  691. }
  692. if (type === 3) {
  693. this.props.navigation.navigate('buyer_invoice');
  694. }
  695. if (type === 4) {
  696. this.props.navigation.navigate('invoice_head_list');
  697. }
  698. if (type === 5) {
  699. this.props.navigation.navigate('wait_invoice_list');
  700. }
  701. if (type === 6) {
  702. this.props.navigation.navigate('application_info');
  703. }
  704. if (type === 7) {
  705. this.props.navigation.navigate('invoice_distribution');
  706. }
  707. if (type === 8) {
  708. this.props.navigation.navigate('electronics_ordinary_invoice');
  709. }
  710. } else {
  711. this.setState({
  712. landingStatus: 0,
  713. });
  714. this.props.navigation.navigate('login', {
  715. refresh: (type) => {
  716. this.refresh(type);
  717. },
  718. });
  719. }
  720. };
  721. refresh = async (type) => {
  722. await this.getCompanyInfo();
  723. DeviceEventEmitter.emit('updateLoginInfo', type);
  724. };
  725. //获取权限信息
  726. getAuthority = async () => {
  727. const authority = await RetrieveData('authority');
  728. if (authority) {
  729. this.setState({
  730. authority: authority,
  731. landingStatus: 1,
  732. });
  733. }
  734. };
  735. //获取首页统计数据
  736. getInvoiceStatistics = async () => {
  737. let company = await RetrieveData('company');
  738. if (company) {
  739. company = JSON.parse(company);
  740. }
  741. const token = await RetrieveData('token');
  742. if (token && company) {
  743. const url = '/sys/stat/toInvoice';
  744. let response = await RequestNetwork(
  745. url,
  746. token,
  747. {
  748. entTaxId: company.entTaxId,
  749. },
  750. false,
  751. 2,
  752. );
  753. if (response) {
  754. if (response.code === 0) {
  755. this.setState({
  756. monthTotal: response.data.monthTotal,
  757. monthTotalTaxes: response.data.monthTotalTaxes,
  758. statisticsData: response.data,
  759. });
  760. } else {
  761. await this.abnormalMessage(response);
  762. }
  763. }
  764. }
  765. };
  766. //获取发票数量统计
  767. getInvoiceNumber = async () => {
  768. let company = await RetrieveData('company');
  769. if (company) {
  770. company = JSON.parse(company);
  771. }
  772. const token = await RetrieveData('token');
  773. const account = await RetrieveData('account');
  774. if (token && company) {
  775. let date = GetMonthDate();
  776. const url = '/sys/invoiceExt/reports';
  777. let response = await RequestNetwork(
  778. url,
  779. token,
  780. {
  781. entTaxId: company.entTaxId,
  782. deviceType: company.defaultDeviceInfo.deviceType,
  783. taxDiscId: company.defaultDeviceInfo.taxDiscId,
  784. mobile: account,
  785. invoiceDateBegin: date.startDateTime,
  786. invoiceDateEnd: date.endDateTime,
  787. reqChannel: 3,
  788. },
  789. false,
  790. 2,
  791. );
  792. if (response) {
  793. if (response.code === 0) {
  794. this.setState({
  795. invoiceNumber: response.data.totalFapiaoCnt,
  796. });
  797. }
  798. }
  799. }
  800. };
  801. // 处理网络请求数据
  802. abnormalMessage = async (jason) => {
  803. if (jason.code === 401) {
  804. await Alert.alert(
  805. '登录失效',
  806. '登录状态已失效,请重新登录!',
  807. [
  808. {
  809. text: '确定',
  810. onPress: () => {
  811. CleanAll();
  812. this.props.navigation.popToTop();
  813. },
  814. },
  815. ],
  816. {cancelable: false},
  817. );
  818. }
  819. if (jason.code === 403) {
  820. Alert.alert(
  821. '权限',
  822. '暂无权限操作此模块!',
  823. [
  824. {
  825. text: '确定',
  826. onPress: () => {
  827. this.props.navigation.goBack();
  828. },
  829. },
  830. ],
  831. {cancelable: false},
  832. );
  833. }
  834. if (jason.code !== 401 && jason.code !== 403) {
  835. ToastShow(1, jason.msg);
  836. }
  837. };
  838. //获取数据
  839. getLoanList = async () => {
  840. const url = '/marketing/campaign/findPage';
  841. let response = await RequestNetwork(
  842. url,
  843. null,
  844. {
  845. campaignName: '',
  846. valid: true,
  847. pageNum: 1,
  848. pageSize: 5,
  849. },
  850. false,
  851. 2,
  852. );
  853. if (response) {
  854. if (response.code === 0) {
  855. let list = [];
  856. response.data.records.map((item) => {
  857. if (item.campaignId !== '4efc6f48fed8ce0457fc4abaf3470a82') {
  858. list = list.concat(item);
  859. }
  860. });
  861. this.setState({
  862. activityList: list,
  863. });
  864. }
  865. }
  866. };
  867. }
  868. const windowWidth = Dimensions.get('window').width;
  869. const styles = StyleSheet.create({
  870. homePageBak: {
  871. flexDirection: 'column',
  872. },
  873. taxItemBak: {
  874. display: 'flex',
  875. flexDirection: 'row',
  876. flexWrap: 'wrap',
  877. paddingTop: 15,
  878. backgroundColor: '#FFFFFF',
  879. },
  880. tapBtnBakCol: {
  881. display: 'flex',
  882. flexDirection: 'column',
  883. width: windowWidth / 4,
  884. height: 80,
  885. alignItems: 'center',
  886. justifyContent: 'center',
  887. marginBottom: 15,
  888. },
  889. tapBtnImg: {
  890. width: 53,
  891. height: 53,
  892. },
  893. tapBtnTips: {
  894. color: '#000',
  895. },
  896. userOnlineLeft: {
  897. flex: 1,
  898. flexDirection: 'row'
  899. },
  900. userOnlineRight: {
  901. flex: 1,
  902. marginRight: 10,
  903. flexDirection: 'row',
  904. justifyContent: 'flex-end',
  905. },
  906. yxTopicBak: {
  907. marginTop: 20,
  908. // height: 200,
  909. backgroundColor: '#fff',
  910. flexDirection: 'column',
  911. },
  912. yxTopicTop: {
  913. height: 45,
  914. flexDirection: 'row',
  915. alignItems: 'center',
  916. paddingLeft: 10,
  917. paddingRight: 10,
  918. },
  919. yxTopicBottom: {
  920. display: 'flex',
  921. flexDirection: 'row',
  922. flexWrap: 'wrap',
  923. paddingBottom: 15,
  924. },
  925. yxTopicItem: {
  926. width: (windowWidth - 60) / 3,
  927. height: 70,
  928. borderRadius: 5,
  929. marginLeft: 10,
  930. marginRight: 10,
  931. },
  932. yc_inner: {
  933. width: '100%',
  934. height: '100%',
  935. display: 'flex',
  936. flexDirection: 'column',
  937. borderRadius: 5,
  938. justifyContent: 'center',
  939. paddingLeft: 12,
  940. },
  941. yxTopicItemTextA: {
  942. color: '#FFFFFF',
  943. fontWeight: '600',
  944. fontSize: 12,
  945. },
  946. yxTopicItemTextB: {
  947. color: '#FFFFFF',
  948. fontSize: 16,
  949. marginTop: 5,
  950. },
  951. yxTopicItemTextC: {
  952. color: '#FFFFFF',
  953. fontSize: 16,
  954. marginTop: 5,
  955. },
  956. xpPushBak: {
  957. height: 292,
  958. marginTop: 20,
  959. backgroundColor: '#fff',
  960. flexDirection: 'column',
  961. },
  962. xpPushTop: {
  963. height: 45,
  964. flexDirection: 'row',
  965. borderBottomWidth: 1,
  966. borderBottomColor: '#E0EEEE',
  967. alignItems: 'center',
  968. marginLeft: 10,
  969. marginRight: 10,
  970. },
  971. xpPushBottom: {},
  972. xpPushItem: {
  973. height: 148,
  974. marginTop: 20,
  975. marginRight: 24,
  976. marginLeft: 24,
  977. borderRadius: 10,
  978. },
  979. containerHorizontal: {
  980. flexGrow: 1,
  981. alignItems: 'center',
  982. justifyContent: 'center',
  983. height: 150,
  984. },
  985. containerVertical: {
  986. flexGrow: 1,
  987. alignItems: 'center',
  988. justifyContent: 'center',
  989. height: 150,
  990. },
  991. text: {
  992. color: '#fff',
  993. fontSize: 36,
  994. },
  995. // zj
  996. wrapper: {
  997. height: 170,
  998. },
  999. wrapper1: {
  1000. height: 140,
  1001. marginTop: 15,
  1002. },
  1003. carousel: {
  1004. width: '100%',
  1005. height: 170,
  1006. backgroundColor: '#fff',
  1007. paddingLeft: 12,
  1008. paddingRight: 12,
  1009. overflow: 'hidden',
  1010. },
  1011. carousel1: {
  1012. width: '100%',
  1013. height: '100%',
  1014. backgroundColor: '#fff',
  1015. paddingLeft: 12,
  1016. paddingRight: 12,
  1017. overflow: 'hidden',
  1018. },
  1019. banner_box: {
  1020. paddingTop: 15,
  1021. },
  1022. banner_img: {
  1023. height: '100%',
  1024. width: '100%',
  1025. borderRadius: 14,
  1026. },
  1027. line_des: {
  1028. flexDirection: 'row',
  1029. alignItems: 'center',
  1030. justifyContent: 'space-between',
  1031. height: 55,
  1032. backgroundColor: '#ffffff',
  1033. paddingLeft: 20,
  1034. paddingRight: 20,
  1035. },
  1036. line_item: {
  1037. display: 'flex',
  1038. flexDirection: 'row',
  1039. alignItems: 'center',
  1040. },
  1041. font_item: {
  1042. color: '#3B3B3B',
  1043. fontSize: 12,
  1044. fontWeight: 'bold',
  1045. marginLeft: 12,
  1046. },
  1047. font_item_right: {
  1048. color: '#2A67FE',
  1049. fontSize: 14,
  1050. fontWeight: 'bold',
  1051. },
  1052. main_title: {
  1053. paddingLeft: 12,
  1054. fontWeight: 'bold',
  1055. color: '#464646',
  1056. fontSize: 16,
  1057. },
  1058. });