wait_invoice_list.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871
  1. import React, {Component} from 'react';
  2. import {
  3. View,
  4. TouchableOpacity,
  5. Text,
  6. TextInput,
  7. ScrollView,
  8. SafeAreaView,
  9. RefreshControl,
  10. FlatList,
  11. DeviceEventEmitter,
  12. Alert,
  13. ActivityIndicator,
  14. } from 'react-native';
  15. import {
  16. Drawer,
  17. List,
  18. Picker,
  19. Provider,
  20. SwipeAction,
  21. Tabs,
  22. WhiteSpace,
  23. WingBlank,
  24. } from '@ant-design/react-native';
  25. import DateTimePicker from '@react-native-community/datetimepicker';
  26. import public_css from '../../source/css/public_css';
  27. import {GetDateString} from '../../utils/date';
  28. import {RetrieveData} from '../../data/storage';
  29. import {RequestNetwork} from '../../data/encryption';
  30. import {ToastShow} from '../../components/toast/toast';
  31. import {CleanAll} from '../../components/abnormalMessage/abnormal_message';
  32. import wait_invoice_css from './wait_invoice_css';
  33. let pageNo = 1; //当前第几页
  34. let totalPage = 5; //总的页数
  35. export default class wait_invoice_list extends Component {
  36. constructor(props) {
  37. super(props);
  38. this.props.navigation.dangerouslyGetParent().setOptions({
  39. tabBarVisible: false,
  40. });
  41. this.state = {
  42. isShowSearch: false,
  43. visible1: false,
  44. tab: 0,
  45. clickNum: 0,
  46. beginDateTime: undefined,
  47. endDateTime: undefined,
  48. customerName: '',
  49. customerPhone: '',
  50. invoiceCode: '',
  51. invoiceNumber: '',
  52. beginDate: new Date(),
  53. beginDateText: '开始时间',
  54. endDate: new Date(),
  55. endDateText: '结束时间',
  56. beginDateShow: false,
  57. endDateShow: false,
  58. invoiceCategory: 1,
  59. statusList: [
  60. {
  61. value: 2,
  62. label: '待提交',
  63. },
  64. {
  65. value: 3,
  66. label: '已提交',
  67. },
  68. {
  69. value: 4,
  70. label: '开票成功',
  71. },
  72. {
  73. value: 5,
  74. label: '开票失败',
  75. },
  76. ],
  77. customerMobile: '',
  78. belongEntTaxId: '',
  79. entName: '',
  80. createTimeEnd: undefined,
  81. createTimeBegin: undefined,
  82. listData: [],
  83. status: 2,
  84. showFoot: 0, // 控制foot, 0:隐藏footer 1:已加载完成,没有更多数据 2 :显示加载中
  85. isLoading: false,
  86. };
  87. }
  88. render() {
  89. let draw = (
  90. <SafeAreaView style={public_css.body}>
  91. <ScrollView>
  92. <View>
  93. <View style={{margin: 10}}>
  94. <Text
  95. style={{color: '#414141', fontSize: 16, fontWeight: 'bold'}}>
  96. 时间区间
  97. </Text>
  98. </View>
  99. <View
  100. style={{
  101. flexDirection: 'row',
  102. justifyContent: 'center',
  103. alignItems: 'center',
  104. }}>
  105. <TouchableOpacity
  106. style={{
  107. backgroundColor: '#F5F5F5',
  108. width: 120,
  109. height: 40,
  110. borderRadius: 99,
  111. alignItems: 'center',
  112. justifyContent: 'center',
  113. }}
  114. onPress={() => {
  115. this.isShowDateSelect(1);
  116. }}>
  117. <View>
  118. <Text
  119. style={{
  120. color: '#D7D7D7',
  121. fontWeight: 'bold',
  122. fontSize: 16,
  123. }}>
  124. {this.state.beginDateText}
  125. </Text>
  126. </View>
  127. </TouchableOpacity>
  128. <View>
  129. <Text style={{color: '#8C8C8C'}}>—</Text>
  130. </View>
  131. <TouchableOpacity
  132. style={{
  133. backgroundColor: '#F5F5F5',
  134. width: 120,
  135. height: 40,
  136. borderRadius: 99,
  137. alignItems: 'center',
  138. justifyContent: 'center',
  139. }}
  140. onPress={() => {
  141. this.isShowDateSelect(2);
  142. }}>
  143. <View>
  144. <Text
  145. style={{
  146. color: '#D7D7D7',
  147. fontWeight: 'bold',
  148. fontSize: 16,
  149. }}>
  150. {this.state.endDateText}
  151. </Text>
  152. </View>
  153. </TouchableOpacity>
  154. </View>
  155. {this.state.beginDateShow === true ? (
  156. <DateTimePicker
  157. testID="dateTimePicker"
  158. value={this.state.beginDate}
  159. mode={'date'}
  160. is24Hour={true}
  161. display="default"
  162. placeholder="起始时间"
  163. dateFormat="yyyy-MM-dd"
  164. onChange={(event, date) => {
  165. this.beginDateChange(event, date);
  166. }}
  167. />
  168. ) : (
  169. <View />
  170. )}
  171. {this.state.endDateShow === true ? (
  172. <DateTimePicker
  173. testID="dateTimePicker"
  174. value={this.state.endDate}
  175. mode={'date'}
  176. is24Hour={true}
  177. display="default"
  178. placeholder="起始时间"
  179. dateFormat="yyyy-MM-dd"
  180. onChange={(event, date) => {
  181. this.endDateChange(event, date);
  182. }}
  183. />
  184. ) : (
  185. <View />
  186. )}
  187. </View>
  188. <Picker
  189. value={[this.state.status]}
  190. data={this.state.statusList}
  191. cols={1}
  192. onChange={(select) => this.statusChange(select)}>
  193. <List.Item arrow="horizontal" onPress={this.onPress}>
  194. 状态:
  195. </List.Item>
  196. </Picker>
  197. <View>
  198. <View>
  199. <Text
  200. style={{
  201. fontWeight: 'bold',
  202. color: '#414141',
  203. fontSize: 16,
  204. margin: 10,
  205. }}>
  206. 客户名称:
  207. </Text>
  208. </View>
  209. <View
  210. style={{
  211. justifyContent: 'center',
  212. alignItems: 'center',
  213. }}>
  214. <TextInput
  215. style={{
  216. paddingVertical: 0,
  217. width: 260,
  218. height: 35,
  219. borderRadius: 99,
  220. backgroundColor: '#F5F5F5',
  221. }}
  222. placeholder={'请输入要查询的客户名称'}
  223. clearButtonMode={'while-editing'}
  224. value={this.state.customerName}
  225. onChangeText={(value) => {
  226. this.setState({
  227. customerName: value,
  228. });
  229. }}
  230. />
  231. </View>
  232. </View>
  233. <View>
  234. <View>
  235. <Text
  236. style={{
  237. fontWeight: 'bold',
  238. color: '#414141',
  239. fontSize: 16,
  240. margin: 10,
  241. }}>
  242. 客户手机号:
  243. </Text>
  244. </View>
  245. <View
  246. style={{
  247. justifyContent: 'center',
  248. alignItems: 'center',
  249. }}>
  250. <TextInput
  251. style={{
  252. paddingVertical: 0,
  253. width: 260,
  254. height: 35,
  255. borderRadius: 99,
  256. backgroundColor: '#F5F5F5',
  257. }}
  258. placeholder={'请输入要查询的客户手机号'}
  259. clearButtonMode={'while-editing'}
  260. value={this.state.customerPhone}
  261. onChangeText={(value) => {
  262. this.setState({
  263. customerPhone: value,
  264. });
  265. }}
  266. />
  267. </View>
  268. </View>
  269. </ScrollView>
  270. <View style={public_css.bottomStatus}>
  271. <View
  272. style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
  273. <TouchableOpacity
  274. style={{
  275. borderWidth: 1,
  276. borderRadius: 30,
  277. borderColor: '#8B8B8B',
  278. width: 120,
  279. height: 40,
  280. justifyContent: 'center',
  281. alignItems: 'center',
  282. }}
  283. onPress={() => {
  284. this.setEmptyData();
  285. }}>
  286. <Text style={{color: '#262626'}}>重置</Text>
  287. </TouchableOpacity>
  288. </View>
  289. <View
  290. style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
  291. <TouchableOpacity
  292. style={{
  293. borderWidth: 1,
  294. borderRadius: 30,
  295. borderColor: '#2A67FE',
  296. backgroundColor: '#2A67FE',
  297. width: 120,
  298. height: 40,
  299. justifyContent: 'center',
  300. alignItems: 'center',
  301. }}
  302. onPress={() => this.getSearchData()}>
  303. <Text style={{color: '#FFFFFF'}}>查询</Text>
  304. </TouchableOpacity>
  305. </View>
  306. </View>
  307. <WhiteSpace />
  308. </SafeAreaView>
  309. );
  310. return (
  311. <View style={{flex: 1}}>
  312. <Provider>
  313. <Drawer
  314. sidebar={draw}
  315. position="right"
  316. open={false}
  317. drawerRef={(el) => (this.drawer = el)}
  318. onOpenChange={(open) => this.openStatus(open)}
  319. drawerBackgroundColor="#ccc"
  320. drawerWidth={300}>
  321. <FlatList
  322. data={this.state.listData}
  323. renderItem={(item) => this.renderItem(item)}
  324. refreshControl={
  325. <RefreshControl
  326. title={'加载中...'}
  327. colors={['#B7B7B7']} //此颜色无效
  328. tintColor={'#B7B7B7'}
  329. titleColor={'#B7B7B7'} //只有ios有效
  330. refreshing={this.state.isLoading}
  331. onRefresh={() => {
  332. this.initData();
  333. }}
  334. />
  335. }
  336. ListFooterComponent={this._renderFooter.bind(this)}
  337. onEndReached={this._onEndReached.bind(this)}
  338. onEndReachedThreshold={0.1}
  339. />
  340. </Drawer>
  341. </Provider>
  342. </View>
  343. );
  344. }
  345. componentDidMount() {
  346. this.getWaitInvoiceList();
  347. }
  348. //判断是否点击了查询
  349. shouldComponentUpdate(
  350. nextProps: Readonly<P>,
  351. nextState: Readonly<S>,
  352. nextContext: any,
  353. ): boolean {
  354. if (nextProps.route.params !== undefined) {
  355. if (nextProps.route.params.isShow) {
  356. if (this.state.clickNum === 0) {
  357. this.setState({
  358. isShowSearch: true,
  359. clickNum: this.state.clickNum++,
  360. });
  361. this.drawer.openDrawer();
  362. this.props.navigation.setParams({
  363. isShow: false,
  364. });
  365. }
  366. }
  367. }
  368. return true;
  369. }
  370. //查询菜单开关状态
  371. openStatus = (open) => {
  372. if (open) {
  373. } else {
  374. // this.props.children.setClickNum();
  375. }
  376. };
  377. // 点击开始和结束时间显示时间选择器
  378. isShowDateSelect = (dateStatus) => {
  379. // 开始时间和结束时间选择器显示 1:开始时间 2:结束时间
  380. if (dateStatus === 1) {
  381. this.setState({
  382. beginDateShow: true,
  383. });
  384. } else {
  385. this.setState({
  386. endDateShow: true,
  387. });
  388. }
  389. };
  390. // 获取开始时间
  391. beginDateChange = (event, date) => {
  392. let dateText = GetDateString(date);
  393. this.setState({
  394. beginDate: date,
  395. beginDateShow: false,
  396. beginDateText: dateText,
  397. });
  398. };
  399. //获取结束时间
  400. endDateChange = (event, date) => {
  401. let dateText = GetDateString(date);
  402. this.setState({
  403. endDate: date,
  404. endDateShow: false,
  405. endDateText: dateText,
  406. });
  407. };
  408. // 重置
  409. setEmptyData = () => {
  410. this.drawer.closeDrawer();
  411. this.initData();
  412. };
  413. // 查询
  414. getSearchData = () => {
  415. this.drawer.closeDrawer();
  416. this.setState({
  417. listData: [],
  418. isLoading: false,
  419. showFoot: 0,
  420. });
  421. pageNo = 1;
  422. this.getWaitInvoiceList();
  423. };
  424. //数据初始化
  425. initData = () => {
  426. this.setState({
  427. listData: [],
  428. isLoading: false,
  429. showFoot: 0,
  430. beginDate: new Date(),
  431. beginDateText: '开始时间',
  432. endDate: new Date(),
  433. endDateText: '结束时间',
  434. beginDateShow: false,
  435. endDateShow: false,
  436. customerName: '',
  437. customerPhone: '',
  438. status: 2,
  439. });
  440. pageNo = 1;
  441. this.getWaitInvoiceList();
  442. };
  443. //获取抬头列表数据
  444. getWaitInvoiceList = async () => {
  445. let beginTime = '';
  446. let endTime = '';
  447. if (this.state.beginDateText !== undefined) {
  448. if (this.state.beginDateText !== '开始时间') {
  449. beginTime = this.state.beginDateText + ' 00:00:00';
  450. }
  451. }
  452. if (this.state.endDateText !== undefined) {
  453. if (this.state.endDateText !== '结束时间') {
  454. endTime = this.state.endDateText + ' 23:59:59';
  455. }
  456. }
  457. console.log('岑氏');
  458. console.log(beginTime);
  459. console.log(endTime);
  460. let account = await RetrieveData('account');
  461. let token = await RetrieveData('token');
  462. let company = JSON.parse(await RetrieveData('company'));
  463. if (token && account) {
  464. const url = '/sys/fapiao/todo/findPage';
  465. let res = await RequestNetwork(
  466. url,
  467. token,
  468. {
  469. mobile: account,
  470. reqChannel: 3,
  471. pageNum: pageNo,
  472. pageSize: 10,
  473. createTimeEnd: endTime,
  474. createTimeBegin: beginTime,
  475. customerName: this.state.customerName,
  476. customerMobile: this.state.customerPhone,
  477. belongEntTaxId: company.entTaxId,
  478. status: this.state.status,
  479. },
  480. false,
  481. 2,
  482. );
  483. if (res) {
  484. if (res.code === 0) {
  485. if (res.data.pages > 0) {
  486. totalPage = res.data.pages;
  487. this.setList(res.data.records);
  488. } else {
  489. totalPage = res.data.pages;
  490. this.setState({
  491. listData: [],
  492. showFoot: 1,
  493. });
  494. }
  495. } else {
  496. await this.abnormalMessage(res);
  497. }
  498. }
  499. }
  500. };
  501. //设置抬头列表
  502. setList = (data) => {
  503. let listDatas = data.map((_, i) => ({
  504. key: data[i].recordId,
  505. customerName: data[i].customerName,
  506. customerEntTaxId: data[i].customerEntTaxId,
  507. address: data[i].address,
  508. contactPhone: data[i].contactPhone,
  509. bankName: data[i].bankName,
  510. bankAccountNo: data[i].bankAccountNo,
  511. customerEmail: data[i].customerEmail,
  512. customerMobile: data[i].customerMobile,
  513. remark: data[i].remark,
  514. belongEntTaxId: data[i].belongEntTaxId,
  515. entName: data[i].entName,
  516. createTime: data[i].createTime,
  517. totalAmountTaxes: data[i].totalAmountTaxes,
  518. invoiceCategory: data[i].invoiceCategory,
  519. interactType: data[i].interactType,
  520. interactTypeDetail: data[i].interactTypeDetail,
  521. customerType: data[i].customerType,
  522. status: data[i].status,
  523. }));
  524. let list = this.state.listData.concat(listDatas);
  525. this.setState({
  526. listData: list,
  527. showFoot: 0,
  528. });
  529. };
  530. //删除发票抬头信息
  531. deleteData = async (data) => {
  532. let company = JSON.parse(await RetrieveData('company'));
  533. let account = await RetrieveData('account');
  534. let token = await RetrieveData('token');
  535. if (account && token) {
  536. const url = '/sys/fapiao/todo/delete';
  537. let res = await RequestNetwork(
  538. url,
  539. token,
  540. {
  541. mobile: account,
  542. reqChannel: 3,
  543. delList: [
  544. {
  545. recordId: data.item.key,
  546. belongEntTaxId: company.entTaxId,
  547. status: 2,
  548. },
  549. ],
  550. },
  551. false,
  552. 1,
  553. );
  554. if (res) {
  555. if (res.code === 0) {
  556. ToastShow(1, '删除成功!');
  557. await this.cleanData();
  558. } else {
  559. ToastShow(1, res.msg);
  560. }
  561. }
  562. }
  563. };
  564. // 提交开票
  565. submitInvoice = async (data) => {
  566. let account = await RetrieveData('account');
  567. let token = await RetrieveData('token');
  568. if (token && account) {
  569. const url = '/sys/fapiao/todo/findCmdParam';
  570. let res = await RequestNetwork(
  571. url,
  572. token,
  573. {
  574. recordId: data.item.key,
  575. },
  576. false,
  577. 2,
  578. );
  579. if (res) {
  580. if (res.code === 0) {
  581. res.data.cmdParamObject.REQUEST_COMMON_FPKJ.TTLX =
  582. data.item.customerType;
  583. res.data.cmdParamObject.REQUEST_COMMON_FPKJ.SPF_MC =
  584. data.item.customerName;
  585. res.data.cmdParamObject.REQUEST_COMMON_FPKJ.SPF_NSRSBH =
  586. data.item.customerEntTaxId;
  587. res.data.cmdParamObject.REQUEST_COMMON_FPKJ.SPF_DZ =
  588. data.item.address;
  589. res.data.cmdParamObject.REQUEST_COMMON_FPKJ.SPF_DH =
  590. data.item.contactPhone;
  591. res.data.cmdParamObject.REQUEST_COMMON_FPKJ.SPF_KHHMC =
  592. data.item.bankName;
  593. res.data.cmdParamObject.REQUEST_COMMON_FPKJ.SPF_YHZH =
  594. data.item.bankAccountNo;
  595. const url = '/sys/fapiao/todo/commit';
  596. let response = await RequestNetwork(
  597. url,
  598. token,
  599. {
  600. mobile: account,
  601. reqChannel: 3,
  602. interactType: data.item.interactType,
  603. interactTypeDetail: data.item.interactTypeDetail,
  604. cmdParam: res.data.cmdParamObject,
  605. todoRecordId: data.item.key,
  606. },
  607. false,
  608. 1,
  609. );
  610. if (response) {
  611. if (response.code === 0) {
  612. DeviceEventEmitter.emit('updateStatistics');
  613. ToastShow(1, '开票成功!');
  614. await this.cleanData();
  615. } else {
  616. ToastShow(1, response.msg);
  617. }
  618. }
  619. } else {
  620. ToastShow(1, res.msg);
  621. }
  622. }
  623. }
  624. };
  625. //加载列表list数据
  626. renderItem = (data) => (
  627. <SwipeAction autoClose style={{backgroundColor: 'transparent'}}>
  628. <List.Item style={{backgroundColor: '#F7F7F7'}}>
  629. <View style={{backgroundColor: '#ffffff'}}>
  630. <View
  631. style={{
  632. marginLeft: 10,
  633. marginTop: 10,
  634. marginBottom: 10,
  635. flexDirection: 'row',
  636. }}>
  637. <View style={{flex: 1}}>
  638. <View style={{flex: 1}}>
  639. <Text
  640. style={{fontWeight: 'bold', fontSize: 16, color: '#050505'}}
  641. ellipsizeMode={'tail'}
  642. numberOfLines={1}>
  643. 发票抬头:{data.item.customerName}
  644. </Text>
  645. </View>
  646. <View style={{flex: 1, marginTop: 10, marginBottom: 10}}>
  647. <Text style={{color: '#898989'}}>
  648. 税号:{data.item.customerEntTaxId}
  649. </Text>
  650. </View>
  651. <View style={{flex: 1}}>
  652. {data.item.invoiceCategory === 1 ? (
  653. <View style={wait_invoice_css.listBlueStatus}>
  654. <Text style={{color: '#2A67FE'}}>增值税普通电子发票</Text>
  655. </View>
  656. ) : data.item.invoiceCategory === 2 ? (
  657. <View style={wait_invoice_css.listBlueStatus}>
  658. <Text style={{color: '#2A67FE'}}>增值税电子专用发票</Text>
  659. </View>
  660. ) : data.item.invoiceCategory === 3 ? (
  661. <View style={wait_invoice_css.listBlueStatus}>
  662. <Text style={{color: '#2A67FE'}}>增值税普通纸质发票</Text>
  663. </View>
  664. ) : data.item.invoiceCategory === 4 ? (
  665. <View style={wait_invoice_css.listBlueStatus}>
  666. <Text style={{color: '#2A67FE'}}>增值税专用纸质发票</Text>
  667. </View>
  668. ) : (
  669. <Text />
  670. )}
  671. </View>
  672. </View>
  673. <View style={{width: 80}}>
  674. <View style={{alignItems: 'flex-end'}}>
  675. {data.item.status === 2 ? (
  676. <View style={wait_invoice_css.listBlueHead}>
  677. <Text style={{color: '#ffffff'}}>待提交</Text>
  678. </View>
  679. ) : data.item.status === 3 ? (
  680. <View style={wait_invoice_css.listBlueHead}>
  681. <Text style={{color: '#ffffff'}}>已提交</Text>
  682. </View>
  683. ) : data.item.status === 4 ? (
  684. <View style={wait_invoice_css.listBlueHead}>
  685. <Text style={{color: '#ffffff'}}>开票成功</Text>
  686. </View>
  687. ) : data.item.status === 5 ? (
  688. <View style={wait_invoice_css.listRedHead}>
  689. <Text style={{color: '#ffffff'}}>开票失败</Text>
  690. </View>
  691. ) : (
  692. <View />
  693. )}
  694. </View>
  695. <View style={{flex: 1}}>
  696. <Text style={{fontWeight: 'bold', fontSize: 18, marginTop: 10}}>
  697. ¥{data.item.totalAmountTaxes}
  698. </Text>
  699. </View>
  700. </View>
  701. </View>
  702. <WingBlank>
  703. <View style={{borderTopWidth: 1, borderColor: '#D9D9D9'}} />
  704. </WingBlank>
  705. <View style={{flexDirection: 'row', margin: 10}}>
  706. <View style={{flex: 1, justifyContent: 'center'}}>
  707. <Text>{data.item.createTime}</Text>
  708. </View>
  709. <View style={{flex: 1}}>
  710. {data.item.status === 2 ? (
  711. <View style={{flexDirection: 'row'}}>
  712. <TouchableOpacity
  713. style={{
  714. flex: 1,
  715. borderWidth: 1,
  716. justifyContent: 'center',
  717. alignItems: 'center',
  718. borderColor: '#CCCCCC',
  719. borderRadius: 30,
  720. height: 30,
  721. }}
  722. onPress={() => {
  723. this.deleteData(data);
  724. }}>
  725. <Text style={{color: '#666666'}}>删除</Text>
  726. </TouchableOpacity>
  727. <TouchableOpacity
  728. style={{
  729. flex: 1,
  730. borderWidth: 1,
  731. justifyContent: 'center',
  732. alignItems: 'center',
  733. borderColor: '#2A67FE',
  734. borderRadius: 30,
  735. height: 30,
  736. marginLeft: 5,
  737. }}
  738. onPress={() => {
  739. this.submitInvoice(data);
  740. }}>
  741. <Text style={{color: '#2A67FE'}}>点击开票</Text>
  742. </TouchableOpacity>
  743. </View>
  744. ) : (
  745. <View />
  746. )}
  747. </View>
  748. </View>
  749. </View>
  750. </List.Item>
  751. </SwipeAction>
  752. );
  753. //上拉加载
  754. _onEndReached() {
  755. if (this.state.showFoot === 0) {
  756. if (pageNo >= totalPage) {
  757. this.setState({showFoot: 1});
  758. return;
  759. } else {
  760. pageNo++;
  761. this.setState({showFoot: 2});
  762. //获取数据
  763. this.getWaitInvoiceList();
  764. }
  765. }
  766. }
  767. //列表尾部显示
  768. _renderFooter = () => {
  769. if (this.state.showFoot === 1) {
  770. return (
  771. <View
  772. style={{
  773. height: 30,
  774. alignItems: 'center',
  775. justifyContent: 'flex-start',
  776. }}>
  777. <Text
  778. style={{
  779. color: '#999999',
  780. fontSize: 14,
  781. marginTop: 5,
  782. marginBottom: 5,
  783. }}>
  784. 没有更多数据了
  785. </Text>
  786. </View>
  787. );
  788. } else if (this.state.showFoot === 2) {
  789. return (
  790. <View style={wait_invoice_css.footer}>
  791. <ActivityIndicator />
  792. <Text>正在加载更多数据...</Text>
  793. </View>
  794. );
  795. } else if (this.state.showFoot === 0) {
  796. return (
  797. <View style={wait_invoice_css.footer}>
  798. <Text />
  799. </View>
  800. );
  801. }
  802. };
  803. //获取查询待开发票状态
  804. statusChange = (select) => {
  805. let status = '';
  806. if (select.length > 0) {
  807. status = select[0];
  808. }
  809. this.setState({
  810. status: status,
  811. });
  812. };
  813. // 处理网络请求数据
  814. abnormalMessage = async (jason) => {
  815. if (jason.code === 401) {
  816. await Alert.alert(
  817. '登录失效',
  818. '登录状态已失效,请重新登录!',
  819. [
  820. {
  821. text: '确定',
  822. onPress: () => {
  823. CleanAll();
  824. this.props.navigation.popToTop();
  825. },
  826. },
  827. ],
  828. {cancelable: false},
  829. );
  830. }
  831. if (jason.code === 403) {
  832. Alert.alert(
  833. '权限',
  834. '暂无权限操作此模块!',
  835. [
  836. {
  837. text: '确定',
  838. onPress: () => {
  839. this.props.navigation.goBack();
  840. },
  841. },
  842. ],
  843. {cancelable: false},
  844. );
  845. }
  846. if (jason.code !== 401 && jason.code !== 403) {
  847. ToastShow(1, jason.msg);
  848. }
  849. };
  850. }