home_amount_statistics.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. import React, {Component} from 'react';
  2. import {
  3. View,
  4. Image,
  5. Text,
  6. SafeAreaView,
  7. ScrollView,
  8. } from 'react-native';
  9. import {Tabs, WingBlank, WhiteSpace} from '@ant-design/react-native';
  10. import public_css from '../../source/css/public_css';
  11. import {RetrieveData} from '../../data/storage';
  12. import {RequestNetwork} from '../../data/encryption';
  13. export default class home_amount_statistics extends Component {
  14. constructor(props) {
  15. super(props);
  16. this.props.navigation.dangerouslyGetParent().setOptions({
  17. tabBarVisible: false,
  18. });
  19. this.state = {
  20. tab: 0,
  21. clickNum: 0,
  22. statisticsData: {},
  23. nowDate: '',
  24. };
  25. }
  26. render() {
  27. const tabs = [{title: '本月'}, {title: '本季'}];
  28. return (
  29. <SafeAreaView style={public_css.body}>
  30. <View style={{height: 200, backgroundColor: '#2A67FE'}}>
  31. <View
  32. style={{flex: 2, justifyContent: 'center', alignItems: 'center'}}>
  33. <Text style={{color: '#ffffff', fontWeight: 'bold', fontSize: 18}}>
  34. {this.state.nowDate}
  35. </Text>
  36. {/*<Text style={{color: '#ffffff', fontWeight: 'bold', fontSize: 14}}>*/}
  37. {/* 本月开票总数*/}
  38. {/*</Text>*/}
  39. {/*<Text style={{color: '#ffffff', fontWeight: 'bold', fontSize: 30}}>*/}
  40. {/* 235*/}
  41. {/*</Text>*/}
  42. </View>
  43. <View style={{flex: 1, flexDirection: 'row'}}>
  44. <View
  45. style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
  46. <View style={{alignItems: 'center'}}>
  47. <Text
  48. style={{color: '#ffffff', fontWeight: 'bold', fontSize: 16}}>
  49. 开票总额(元)
  50. </Text>
  51. <Text
  52. style={{color: '#ffffff', fontWeight: 'bold', fontSize: 20}}>
  53. {this.state.statisticsData.monthTotal}
  54. </Text>
  55. </View>
  56. </View>
  57. <View
  58. style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
  59. <View style={{alignItems: 'center'}}>
  60. <Text
  61. style={{color: '#ffffff', fontWeight: 'bold', fontSize: 16}}>
  62. 税额(元)
  63. </Text>
  64. <Text
  65. style={{color: '#ffffff', fontWeight: 'bold', fontSize: 20}}>
  66. {this.state.statisticsData.monthTotalTaxes}
  67. </Text>
  68. </View>
  69. </View>
  70. </View>
  71. </View>
  72. <Tabs tabs={tabs} onChange={(i, l) => this.onChanges(i, l)} page={0}>
  73. <ScrollView>
  74. <View style={{backgroundColor: '#FCFCFE'}}>
  75. <View
  76. style={{
  77. flexDirection: 'row',
  78. margin: 10,
  79. height: 20,
  80. alignItems: 'center',
  81. }}>
  82. <View
  83. style={{borderWidth: 1.5, height: 15, borderColor: '#2A67FE'}}
  84. />
  85. <View style={{marginLeft: 10}}>
  86. <Text
  87. style={{
  88. fontWeight: 'bold',
  89. color: '#464646',
  90. fontSize: 15,
  91. }}>
  92. 未税金额
  93. </Text>
  94. </View>
  95. </View>
  96. <WhiteSpace />
  97. <WingBlank>
  98. <View
  99. style={{
  100. flexDirection: 'row',
  101. alignItems: 'center',
  102. justifyContent: 'space-between',
  103. height: 50,
  104. backgroundColor: '#ffffff',
  105. }}>
  106. <View style={{flexDirection: 'row'}}>
  107. <Image
  108. style={{marginLeft: 10, width: 20, height: 20}}
  109. source={require('../../source/img/homeImg/leiji.png')}
  110. />
  111. <Text style={{marginLeft: 5}}>
  112. 累计成功开票未税金额(元)
  113. </Text>
  114. </View>
  115. <View>
  116. <Text style={{marginRight: 10}}>{this.state.statisticsData.monthTotal}</Text>
  117. </View>
  118. </View>
  119. </WingBlank>
  120. <WhiteSpace />
  121. <WhiteSpace />
  122. <WingBlank>
  123. <View
  124. style={{
  125. flexDirection: 'row',
  126. alignItems: 'center',
  127. justifyContent: 'space-between',
  128. height: 50,
  129. backgroundColor: '#ffffff',
  130. }}>
  131. <View style={{flexDirection: 'row'}}>
  132. <Image
  133. style={{marginLeft: 10, width: 20, height: 20}}
  134. source={require('../../source/img/homeImg/zhuan.png')}
  135. />
  136. <Text style={{marginLeft: 5}}>专票开票未税金额(元)</Text>
  137. </View>
  138. <View>
  139. <Text style={{marginRight: 10}}>{this.state.statisticsData.monthZhuanpiaoTotal}</Text>
  140. </View>
  141. </View>
  142. </WingBlank>
  143. <WhiteSpace />
  144. <WhiteSpace />
  145. <WingBlank>
  146. <View
  147. style={{
  148. flexDirection: 'row',
  149. alignItems: 'center',
  150. justifyContent: 'space-between',
  151. height: 50,
  152. backgroundColor: '#ffffff',
  153. }}>
  154. <View style={{flexDirection: 'row'}}>
  155. <Image
  156. style={{marginLeft: 10, width: 20, height: 20}}
  157. source={require('../../source/img/homeImg/leijicheng.png')}
  158. />
  159. <Text style={{marginLeft: 5}}>普票开票未税金额(元)</Text>
  160. </View>
  161. <View>
  162. <Text style={{marginRight: 10}}>{this.state.statisticsData.monthPupiaoTotal}</Text>
  163. </View>
  164. </View>
  165. </WingBlank>
  166. <WhiteSpace />
  167. <View
  168. style={{
  169. flexDirection: 'row',
  170. margin: 10,
  171. height: 20,
  172. alignItems: 'center',
  173. }}>
  174. <View
  175. style={{borderWidth: 1.5, height: 15, borderColor: '#2A67FE'}}
  176. />
  177. <View style={{marginLeft: 10}}>
  178. <Text
  179. style={{
  180. fontWeight: 'bold',
  181. color: '#464646',
  182. fontSize: 15,
  183. }}>
  184. 累计税额
  185. </Text>
  186. </View>
  187. </View>
  188. <WhiteSpace />
  189. <WingBlank>
  190. <View
  191. style={{
  192. flexDirection: 'row',
  193. alignItems: 'center',
  194. justifyContent: 'space-between',
  195. height: 50,
  196. backgroundColor: '#ffffff',
  197. }}>
  198. <View style={{flexDirection: 'row'}}>
  199. <Image
  200. style={{marginLeft: 10, width: 20, height: 20}}
  201. source={require('../../source/img/homeImg/leiji.png')}
  202. />
  203. <Text style={{marginLeft: 5}}>累计开票税额(元)</Text>
  204. </View>
  205. <View>
  206. <Text style={{marginRight: 10}}>{this.state.statisticsData.monthTotalTaxes}</Text>
  207. </View>
  208. </View>
  209. </WingBlank>
  210. <WhiteSpace />
  211. <WhiteSpace />
  212. <WingBlank>
  213. <View
  214. style={{
  215. flexDirection: 'row',
  216. alignItems: 'center',
  217. justifyContent: 'space-between',
  218. height: 50,
  219. backgroundColor: '#ffffff',
  220. }}>
  221. <View style={{flexDirection: 'row'}}>
  222. <Image
  223. style={{marginLeft: 10, width: 20, height: 20}}
  224. source={require('../../source/img/homeImg/zhuan.png')}
  225. />
  226. <Text style={{marginLeft: 5}}>专票开票税额(元)</Text>
  227. </View>
  228. <View>
  229. <Text style={{marginRight: 10}}>{this.state.statisticsData.monthZhuanpiaoTotalTaxes}</Text>
  230. </View>
  231. </View>
  232. </WingBlank>
  233. <WhiteSpace />
  234. <WhiteSpace />
  235. <WingBlank>
  236. <View
  237. style={{
  238. flexDirection: 'row',
  239. alignItems: 'center',
  240. justifyContent: 'space-between',
  241. height: 50,
  242. backgroundColor: '#ffffff',
  243. }}>
  244. <View style={{flexDirection: 'row'}}>
  245. <Image
  246. style={{marginLeft: 10, width: 20, height: 20}}
  247. source={require('../../source/img/homeImg/leijicheng.png')}
  248. />
  249. <Text style={{marginLeft: 5}}>普票开票税额(元)</Text>
  250. </View>
  251. <View>
  252. <Text style={{marginRight: 10}}>{this.state.statisticsData.monthPupiaoTotalTaxes}</Text>
  253. </View>
  254. </View>
  255. </WingBlank>
  256. <WhiteSpace />
  257. </View>
  258. </ScrollView>
  259. <ScrollView>
  260. <View style={{backgroundColor: '#FCFCFE'}}>
  261. <View
  262. style={{
  263. flexDirection: 'row',
  264. margin: 10,
  265. height: 20,
  266. alignItems: 'center',
  267. }}>
  268. <View
  269. style={{borderWidth: 1.5, height: 15, borderColor: '#2A67FE'}}
  270. />
  271. <View style={{marginLeft: 10}}>
  272. <Text
  273. style={{
  274. fontWeight: 'bold',
  275. color: '#464646',
  276. fontSize: 15,
  277. }}>
  278. 未税金额
  279. </Text>
  280. </View>
  281. </View>
  282. <WhiteSpace />
  283. <WingBlank>
  284. <View
  285. style={{
  286. flexDirection: 'row',
  287. alignItems: 'center',
  288. justifyContent: 'space-between',
  289. height: 50,
  290. backgroundColor: '#ffffff',
  291. }}>
  292. <View style={{flexDirection: 'row'}}>
  293. <Image
  294. style={{marginLeft: 10, width: 20, height: 20}}
  295. source={require('../../source/img/homeImg/leiji.png')}
  296. />
  297. <Text style={{marginLeft: 5}}>
  298. 累计成功开票未税金额(元)
  299. </Text>
  300. </View>
  301. <View>
  302. <Text style={{marginRight: 10}}>{this.state.statisticsData.quarterTotal}</Text>
  303. </View>
  304. </View>
  305. </WingBlank>
  306. <WhiteSpace />
  307. <WhiteSpace />
  308. <WingBlank>
  309. <View
  310. style={{
  311. flexDirection: 'row',
  312. alignItems: 'center',
  313. justifyContent: 'space-between',
  314. height: 50,
  315. backgroundColor: '#ffffff',
  316. }}>
  317. <View style={{flexDirection: 'row'}}>
  318. <Image
  319. style={{marginLeft: 10, width: 20, height: 20}}
  320. source={require('../../source/img/homeImg/zhuan.png')}
  321. />
  322. <Text style={{marginLeft: 5}}>专票开票未税金额(元)</Text>
  323. </View>
  324. <View>
  325. <Text style={{marginRight: 10}}>{this.state.statisticsData.quarterZhuanpiaoTotal}</Text>
  326. </View>
  327. </View>
  328. </WingBlank>
  329. <WhiteSpace />
  330. <WhiteSpace />
  331. <WingBlank>
  332. <View
  333. style={{
  334. flexDirection: 'row',
  335. alignItems: 'center',
  336. justifyContent: 'space-between',
  337. height: 50,
  338. backgroundColor: '#ffffff',
  339. }}>
  340. <View style={{flexDirection: 'row'}}>
  341. <Image
  342. style={{marginLeft: 10, width: 20, height: 20}}
  343. source={require('../../source/img/homeImg/leijicheng.png')}
  344. />
  345. <Text style={{marginLeft: 5}}>普票开票未税金额(元)</Text>
  346. </View>
  347. <View>
  348. <Text style={{marginRight: 10}}>{this.state.statisticsData.quarterPupiaoTotal}</Text>
  349. </View>
  350. </View>
  351. </WingBlank>
  352. <WhiteSpace />
  353. <View
  354. style={{
  355. flexDirection: 'row',
  356. margin: 10,
  357. height: 20,
  358. alignItems: 'center',
  359. }}>
  360. <View
  361. style={{borderWidth: 1.5, height: 15, borderColor: '#2A67FE'}}
  362. />
  363. <View style={{marginLeft: 10}}>
  364. <Text
  365. style={{
  366. fontWeight: 'bold',
  367. color: '#464646',
  368. fontSize: 15,
  369. }}>
  370. 累计税额
  371. </Text>
  372. </View>
  373. </View>
  374. <WhiteSpace />
  375. <WingBlank>
  376. <View
  377. style={{
  378. flexDirection: 'row',
  379. alignItems: 'center',
  380. justifyContent: 'space-between',
  381. height: 50,
  382. backgroundColor: '#ffffff',
  383. }}>
  384. <View style={{flexDirection: 'row'}}>
  385. <Image
  386. style={{marginLeft: 10, width: 20, height: 20}}
  387. source={require('../../source/img/homeImg/leiji.png')}
  388. />
  389. <Text style={{marginLeft: 5}}>累计开票税额(元)</Text>
  390. </View>
  391. <View>
  392. <Text style={{marginRight: 10}}>{this.state.statisticsData.quarterTotalTaxes}</Text>
  393. </View>
  394. </View>
  395. </WingBlank>
  396. <WhiteSpace />
  397. <WhiteSpace />
  398. <WingBlank>
  399. <View
  400. style={{
  401. flexDirection: 'row',
  402. alignItems: 'center',
  403. justifyContent: 'space-between',
  404. height: 50,
  405. backgroundColor: '#ffffff',
  406. }}>
  407. <View style={{flexDirection: 'row'}}>
  408. <Image
  409. style={{marginLeft: 10, width: 20, height: 20}}
  410. source={require('../../source/img/homeImg/zhuan.png')}
  411. />
  412. <Text style={{marginLeft: 5}}>专票开票税额(元)</Text>
  413. </View>
  414. <View>
  415. <Text style={{marginRight: 10}}>{this.state.statisticsData.quarterZhuanpiaoTotalTaxes}</Text>
  416. </View>
  417. </View>
  418. </WingBlank>
  419. <WhiteSpace />
  420. <WhiteSpace />
  421. <WingBlank>
  422. <View
  423. style={{
  424. flexDirection: 'row',
  425. alignItems: 'center',
  426. justifyContent: 'space-between',
  427. height: 50,
  428. backgroundColor: '#ffffff',
  429. }}>
  430. <View style={{flexDirection: 'row'}}>
  431. <Image
  432. style={{marginLeft: 10, width: 20, height: 20}}
  433. source={require('../../source/img/homeImg/leijicheng.png')}
  434. />
  435. <Text style={{marginLeft: 5}}>普票开票税额(元)</Text>
  436. </View>
  437. <View>
  438. <Text style={{marginRight: 10}}>{this.state.statisticsData.quarterPupiaoTotalTaxes}</Text>
  439. </View>
  440. </View>
  441. </WingBlank>
  442. <WhiteSpace />
  443. </View>
  444. </ScrollView>
  445. </Tabs>
  446. </SafeAreaView>
  447. );
  448. }
  449. componentDidMount() {
  450. this.getNowDate();
  451. this.getInvoiceStatistics();
  452. }
  453. //获取统计数据
  454. getInvoiceStatistics = async () => {
  455. const company = JSON.parse(await RetrieveData('company'));
  456. const token = await RetrieveData('token');
  457. if (token && company) {
  458. const url = '/sys/stat/toInvoice';
  459. let response = await RequestNetwork(
  460. url,
  461. token,
  462. {
  463. entTaxId: company.entTaxId,
  464. },
  465. false,
  466. 2,
  467. );
  468. if (response) {
  469. console.log(response);
  470. if (response.code === 0) {
  471. this.setState({
  472. statisticsData: response.data,
  473. });
  474. } else {
  475. // await this.abnormalMessage(response);
  476. }
  477. }
  478. }
  479. };
  480. // 获取当前年月
  481. getNowDate = () => {
  482. let now = new Date(); //当前日期
  483. let nowMonth = now.getMonth(); //当前月
  484. let nowYear = now.getFullYear(); //当前年
  485. let monthStartDate = new Date(nowYear, nowMonth, 1);
  486. let yy = monthStartDate.getFullYear();
  487. let mm =
  488. monthStartDate.getMonth() + 1 < 10
  489. ? '0' + (monthStartDate.getMonth() + 1)
  490. : monthStartDate.getMonth() + 1;
  491. this.setState({
  492. nowDate: yy + '年' + mm + '月',
  493. });
  494. };
  495. //tab变化事件
  496. onChanges = (i, l) => {
  497. this.getInvoiceStatistics();
  498. };
  499. }