wait_invoice.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812
  1. import React, {Component} from 'react';
  2. import {
  3. View,
  4. Text,
  5. TouchableOpacity,
  6. StyleSheet,
  7. Dimensions,
  8. FlatList,
  9. PixelRatio,
  10. DeviceEventEmitter,
  11. Image,
  12. TextInput,
  13. SafeAreaView,
  14. ScrollView,
  15. } from 'react-native';
  16. import {
  17. List,
  18. SwipeAction,
  19. Radio,
  20. Picker,
  21. Provider,
  22. InputItem,
  23. WhiteSpace,
  24. WingBlank,
  25. } from '@ant-design/react-native';
  26. import public_css from '../../source/css/public_css';
  27. import { NumberTwoDecimal, RoundingData } from "../../source/inspect/inspect";
  28. import wait_invoice_css from './wait_invoice_css';
  29. import {SvgXml} from 'react-native-svg';
  30. import {ToastShow} from '../../components/toast/toast';
  31. import {
  32. downArrowIcon,
  33. plusIcon,
  34. enterpriseIcon,
  35. upArrowIcon,
  36. } from '../../source/icon/icon';
  37. import {RetrieveData} from '../../data/storage';
  38. import {RequestNetwork} from '../../data/encryption';
  39. export default class wait_invoice extends Component {
  40. constructor(props) {
  41. super(props);
  42. this.props.navigation.dangerouslyGetParent().setOptions({
  43. tabBarVisible: false,
  44. });
  45. this.state = {
  46. listData: [],
  47. productNumberTotal: 0,
  48. amountTotal: 0.0,
  49. taxRateTotal: 0.0,
  50. productAmountTotal: 0.0,
  51. companyTypes: [
  52. {
  53. label: '个人',
  54. value: '1',
  55. },
  56. {
  57. label: '企业',
  58. value: '2',
  59. },
  60. ],
  61. companyType: '1',
  62. invoiceTypes: [
  63. {
  64. label: '增值税普通电子发票',
  65. value: '1',
  66. },
  67. {
  68. label: '增值税电子专用发票',
  69. value: '2',
  70. },
  71. ],
  72. invoiceType: '1',
  73. product_name: '',
  74. customerName: '',
  75. taxNumber: '',
  76. contactNumber: '',
  77. address: '',
  78. bank: '',
  79. bankAccount: '',
  80. payee: '',
  81. reviewer: '',
  82. drawer: '',
  83. remark: '',
  84. hideStatusText: '更多',
  85. hideStatus: false,
  86. email: '',
  87. };
  88. }
  89. render() {
  90. return (
  91. <Provider>
  92. <SafeAreaView style={public_css.body}>
  93. <ScrollView>
  94. <View>
  95. <Picker
  96. data={this.state.companyTypes}
  97. cols={1}
  98. value={this.state.companyType}
  99. onChange={(value) => {
  100. this.setState({
  101. companyType: value,
  102. });
  103. }}>
  104. <List.Item arrow="horizontal" onPress={this.onPress}>
  105. 客户抬头类型:
  106. </List.Item>
  107. </Picker>
  108. <Picker
  109. data={this.state.invoiceTypes}
  110. cols={1}
  111. value={this.state.invoiceType}
  112. onChange={(value) => {
  113. this.setState({
  114. invoiceType: value,
  115. });
  116. }}>
  117. <List.Item arrow="horizontal" onPress={this.onPress}>
  118. 发票类型:
  119. </List.Item>
  120. </Picker>
  121. <List>
  122. <View style={[public_css.view, {position: 'relative'}]}>
  123. <View style={[public_css.view, {flex: 1}]}>
  124. <Text style={public_css.text}>
  125. <Text style={{color: 'red'}}>*</Text>企业名称:
  126. </Text>
  127. <TextInput
  128. style={public_css.textInputStyle}
  129. placeholder="请输入客户名称"
  130. clearButtonMode="while-editing"
  131. secureTextEntry={false}
  132. onChangeText={(text) => {
  133. // this.searchCustomer(text);
  134. this.setState({
  135. customerName: text,
  136. });
  137. }}
  138. value={this.state.customerName}
  139. // onBlur={() => {
  140. // this.searchCustomerName();
  141. // }}
  142. />
  143. </View>
  144. <View style={{}}>
  145. <TouchableOpacity
  146. onPress={() =>
  147. this.props.navigation.navigate(
  148. 'invoice_select_customer',
  149. {
  150. customer: this,
  151. selectCustomer: (data) => {
  152. this.selectCustomer(data);
  153. },
  154. },
  155. )
  156. }
  157. style={{width: 30, alignItems: 'center'}}>
  158. <Text style={public_css.arrow}>{'>'}</Text>
  159. </TouchableOpacity>
  160. </View>
  161. </View>
  162. <View style={[public_css.view, public_css.lineTopBottom]}>
  163. <Text style={public_css.text}>
  164. <Text style={{color: 'red'}}>*</Text>企业税号:
  165. </Text>
  166. <TextInput
  167. style={public_css.textInputStyle}
  168. placeholder="请输入客户企业税号"
  169. clearButtonMode="while-editing"
  170. secureTextEntry={false}
  171. onChangeText={(text) => {
  172. this.setState({
  173. taxNumber: text,
  174. });
  175. }}
  176. value={this.state.taxNumber}
  177. />
  178. </View>
  179. {this.state.hideStatus === true ? (
  180. <View style={[public_css.view, public_css.lineTopBottom]}>
  181. <Text style={public_css.text}> 地址:</Text>
  182. <TextInput
  183. style={public_css.textInputStyle}
  184. placeholder="请输入地址"
  185. clearButtonMode="while-editing"
  186. secureTextEntry={false}
  187. onChangeText={(text) => {
  188. this.setState({
  189. address: text,
  190. });
  191. }}
  192. value={this.state.address}
  193. />
  194. </View>
  195. ) : (
  196. <View />
  197. )}
  198. {this.state.hideStatus === true ? (
  199. <View style={[public_css.view, public_css.lineTopBottom]}>
  200. <Text style={public_css.text}> 联系电话:</Text>
  201. <TextInput
  202. style={public_css.textInputStyle}
  203. placeholder="请输入联系电话"
  204. clearButtonMode="while-editing"
  205. secureTextEntry={false}
  206. onChangeText={(text) => {
  207. this.setState({
  208. contactNumber: text,
  209. });
  210. }}
  211. value={this.state.contactNumber}
  212. />
  213. </View>
  214. ) : (
  215. <View />
  216. )}
  217. {this.state.hideStatus === true ? (
  218. <View style={[public_css.view, public_css.lineTopBottom]}>
  219. <Text style={public_css.text}> 开户银行:</Text>
  220. <TextInput
  221. style={public_css.textInputStyle}
  222. placeholder="请输入开户银行"
  223. clearButtonMode="while-editing"
  224. secureTextEntry={false}
  225. onChangeText={(text) => {
  226. this.setState({
  227. bank: text,
  228. });
  229. }}
  230. value={this.state.bank}
  231. />
  232. </View>
  233. ) : (
  234. <View />
  235. )}
  236. {this.state.hideStatus === true ? (
  237. <View style={[public_css.view, public_css.lineTopBottom]}>
  238. <Text style={public_css.text}> 银行账号:</Text>
  239. <TextInput
  240. style={public_css.textInputStyle}
  241. placeholder="请输入银行账号"
  242. clearButtonMode="while-editing"
  243. secureTextEntry={false}
  244. onChangeText={(text) => {
  245. this.setState({
  246. bankAccount: text,
  247. });
  248. }}
  249. value={this.state.bankAccount}
  250. />
  251. </View>
  252. ) : (
  253. <View />
  254. )}
  255. <View
  256. style={[
  257. public_css.view,
  258. public_css.lineTopBottom,
  259. {alignItems: 'center'},
  260. ]}>
  261. <Text style={public_css.text}>
  262. <Text style={{color: 'red'}}>*</Text>收款人:
  263. </Text>
  264. <TextInput
  265. style={public_css.textInputStyle}
  266. placeholder="请输入收款人"
  267. clearButtonMode="while-editing"
  268. secureTextEntry={false}
  269. value={this.state.payee}
  270. editable={false}
  271. />
  272. <View style={{marginRight: 20}}>
  273. <TouchableOpacity
  274. onPress={() => {
  275. this.props.navigation.navigate('select_user', {
  276. type: 1,
  277. getUserInfo: (type, name) => {
  278. this.getUserInfo(type, name);
  279. },
  280. });
  281. }}>
  282. <Image
  283. source={require('../../source/img/productImg/addIcon.png')}
  284. style={{height: 16, width: 16}}
  285. />
  286. </TouchableOpacity>
  287. </View>
  288. </View>
  289. <View
  290. style={[
  291. public_css.view,
  292. public_css.lineTopBottom,
  293. {alignItems: 'center'},
  294. ]}>
  295. <Text style={public_css.text}>
  296. <Text style={{color: 'red'}}>*</Text>审核人:
  297. </Text>
  298. <TextInput
  299. style={public_css.textInputStyle}
  300. placeholder="请输入审核人"
  301. clearButtonMode="while-editing"
  302. secureTextEntry={false}
  303. value={this.state.reviewer}
  304. editable={false}
  305. />
  306. <View style={{marginRight: 20}}>
  307. <TouchableOpacity
  308. onPress={() => {
  309. this.props.navigation.navigate('select_user', {
  310. type: 2,
  311. getUserInfo: (type, name) => {
  312. this.getUserInfo(type, name);
  313. },
  314. });
  315. }}>
  316. <Image
  317. source={require('../../source/img/productImg/addIcon.png')}
  318. style={{height: 16, width: 16}}
  319. />
  320. </TouchableOpacity>
  321. </View>
  322. </View>
  323. <View
  324. style={[
  325. public_css.view,
  326. public_css.lineTopBottom,
  327. {alignItems: 'center'},
  328. ]}>
  329. <Text style={public_css.text}>
  330. <Text style={{color: 'red'}}>*</Text>开票人:
  331. </Text>
  332. <TextInput
  333. style={public_css.textInputStyle}
  334. placeholder="请输入开票人"
  335. clearButtonMode="while-editing"
  336. secureTextEntry={false}
  337. value={this.state.drawer}
  338. editable={false}
  339. />
  340. <View style={{marginRight: 20}}>
  341. <TouchableOpacity
  342. onPress={() => {
  343. this.props.navigation.navigate('select_user', {
  344. type: 3,
  345. getUserInfo: (type, name) => {
  346. this.getUserInfo(type, name);
  347. },
  348. });
  349. }}>
  350. <Image
  351. source={require('../../source/img/productImg/addIcon.png')}
  352. style={{height: 16, width: 16}}
  353. />
  354. </TouchableOpacity>
  355. </View>
  356. </View>
  357. {this.state.hideStatus === true ? (
  358. <View style={[public_css.view, public_css.lineTopBottom]}>
  359. <Text style={public_css.text}> 备注:</Text>
  360. <TextInput
  361. style={public_css.textInputStyle}
  362. placeholder="请输入备注信息"
  363. clearButtonMode="while-editing"
  364. secureTextEntry={false}
  365. onChangeText={(text) => {
  366. this.setState({
  367. remark: text,
  368. });
  369. }}
  370. />
  371. </View>
  372. ) : (
  373. <View />
  374. )}
  375. <View
  376. style={[
  377. public_css.view,
  378. public_css.lineTopBottom,
  379. {alignItems: 'center'},
  380. ]}>
  381. <Text style={public_css.text}>
  382. <Text style={{color: 'red'}}>*</Text>邮箱:
  383. </Text>
  384. <TextInput
  385. style={public_css.textInputStyle}
  386. placeholder="请输入邮箱"
  387. clearButtonMode="while-editing"
  388. secureTextEntry={false}
  389. value={this.state.email}
  390. onChangeText={(text) => {
  391. this.setState({
  392. email: text,
  393. });
  394. }}
  395. />
  396. </View>
  397. <View style={[public_css.view, {justifyContent: 'center'}]}>
  398. <TouchableOpacity
  399. style={{
  400. width: 120,
  401. height: 30,
  402. backgroundColor: '#F8F8F8',
  403. opacity: 1,
  404. borderRadius: 99,
  405. flexDirection: 'row',
  406. justifyContent: 'center',
  407. alignItems: 'center',
  408. }}
  409. onPress={() => this.hideChange()}>
  410. <View style={{flexDirection: 'row', alignItems: 'center'}}>
  411. <Text style={{color: '#B6B6BA', fontSize: 16}}>
  412. {this.state.hideStatusText}
  413. </Text>
  414. <SvgXml xml={downArrowIcon()} />
  415. </View>
  416. </TouchableOpacity>
  417. </View>
  418. </List>
  419. <View style={wait_invoice_css.list_view}>
  420. <Text style={wait_invoice_css.list_title_text}>名称</Text>
  421. <Text style={wait_invoice_css.list_title_text}>单价</Text>
  422. {/*<Text style={wait_invoice_css.list_title_text}>数量</Text>*/}
  423. <Text style={wait_invoice_css.list_title_text}>税率(%)</Text>
  424. <Text style={wait_invoice_css.list_title_text}>税额</Text>
  425. </View>
  426. <FlatList
  427. data={this.state.listData}
  428. renderItem={(item) => this.renderItem(item)}
  429. />
  430. <View>
  431. <WhiteSpace />
  432. <WingBlank>
  433. <TouchableOpacity
  434. style={{
  435. // width: Dimensions.get('window').width,
  436. height: 52,
  437. flexDirection: 'row',
  438. justifyContent: 'center',
  439. alignItems: 'center',
  440. border: 2,
  441. borderStyle: 'dotted',
  442. borderColor: '#2A67FE',
  443. borderWidth: 2,
  444. borderRadius: 8,
  445. opacity: 1,
  446. }}
  447. onPress={() => {
  448. this.props.navigation.navigate('invoice_product_list');
  449. }}>
  450. <SvgXml xml={plusIcon()} />
  451. <Text style={{}}>添加商品信息</Text>
  452. </TouchableOpacity>
  453. </WingBlank>
  454. <WhiteSpace />
  455. </View>
  456. </View>
  457. </ScrollView>
  458. <View>
  459. <View
  460. style={{
  461. flexDirection: 'row',
  462. justifyContent: 'space-around',
  463. alignItems: 'center',
  464. width: Dimensions.get('window').width,
  465. }}>
  466. <Text>共{this.state.productNumberTotal}个产品</Text>
  467. <Text>
  468. 开票金额:
  469. {RoundingData(parseFloat(this.state.amountTotal)).replace(
  470. /(\d)(?=(\d{3})+(?:\.\d+)?$)/g,
  471. '$1,',
  472. )}
  473. </Text>
  474. <Text>
  475. 税额:{RoundingData(parseFloat(this.state.taxRateTotal))}
  476. </Text>
  477. </View>
  478. <View style={[public_css.bottomStatus]}>
  479. <TouchableOpacity
  480. style={[public_css.statusBtn, public_css.statusRBtn]}
  481. onPress={() => this.submitData()}>
  482. <Image
  483. source={require('../../source/img/productImg/confirm.png')}
  484. style={{width: 32, height: 32}}
  485. />
  486. <Text style={{color: '#fff'}}>提交</Text>
  487. </TouchableOpacity>
  488. </View>
  489. </View>
  490. </SafeAreaView>
  491. </Provider>
  492. );
  493. }
  494. async componentDidMount(): void {
  495. console.log(this.props.route.params);
  496. let company = JSON.parse(await RetrieveData('company'));
  497. let userName = await RetrieveData('userName');
  498. let payee = '';
  499. let reviewer = '';
  500. if (company.payees.length > 0) {
  501. payee = company.payees.split(',')[0];
  502. }
  503. if (company.reviewers.length > 0) {
  504. reviewer = company.reviewers.split(',')[0];
  505. }
  506. this.setState({
  507. company: company,
  508. payee: payee,
  509. reviewer: reviewer,
  510. drawer: userName,
  511. });
  512. //收到监听
  513. this.listener = DeviceEventEmitter.addListener('productInfo', (data) => {
  514. //收到监听后想做的事情
  515. this.setList(data);
  516. });
  517. }
  518. componentWillUnmount() {
  519. //移除监听
  520. if (this.listener) {
  521. this.listener.remove();
  522. }
  523. }
  524. // 获取收款人、审核人、开票人信息
  525. getUserInfo = (type, name) => {
  526. if (type === 1) {
  527. this.setState({
  528. payee: name,
  529. });
  530. }
  531. if (type === 2) {
  532. this.setState({
  533. reviewer: name,
  534. });
  535. }
  536. if (type === 3) {
  537. this.setState({
  538. drawer: name,
  539. });
  540. }
  541. };
  542. selectProduct = () => {
  543. this.setState({
  544. productVisible: !this.state.productVisible,
  545. });
  546. };
  547. // 开票企业类型选择
  548. companyTypeChange = (value) => {
  549. this.setState({
  550. companyType: value,
  551. });
  552. };
  553. //提交开票信息
  554. submitData = async () => {
  555. if (this.state.customerName === '') {
  556. ToastShow(1, '企业名称不能为空!');
  557. return;
  558. }
  559. if (this.state.taxNumber === '') {
  560. ToastShow(1, '企业税号不能为空!');
  561. return;
  562. }
  563. if (this.state.payee === '') {
  564. ToastShow(1, '收款人不能为空!');
  565. return;
  566. }
  567. if (this.state.reviewer === '') {
  568. ToastShow(1, '审核人不能为空!');
  569. return;
  570. }
  571. if (this.state.drawer === '') {
  572. ToastShow(1, '开票人不能为空!');
  573. return;
  574. }
  575. if (this.state.email === '') {
  576. ToastShow(1, '邮箱地址不能为空!');
  577. return;
  578. }
  579. if (this.state.listData <= 0) {
  580. ToastShow(1, '商品信息不能为空!');
  581. return;
  582. }
  583. const account = await RetrieveData('account');
  584. let token = await RetrieveData('token');
  585. if (token) {
  586. const url = '/sys/invoice/save';
  587. let response = await RequestNetwork(
  588. url,
  589. token,
  590. {
  591. interactType: 1,
  592. interactTypeDetail: this.state.email,
  593. invoiceWay: 1,
  594. invoiceCategory: 1,
  595. cmdParam: {
  596. REQUEST_COMMON_FPKJ: {
  597. SBLX: this.state.company.defaultDeviceInfo.deviceType, //设备类型
  598. SBBH: this.state.company.defaultDeviceInfo.taxDiscId, //设备编号
  599. KPLX: 0, //开票类型 0-蓝字发票;1-红字发票
  600. FPZL: this.state.invoiceType, //发票种类 1.增值税普通电子发票 2.增值税电子专用发票 3.增值税普通纸质发票 4 增值税专用纸质发票
  601. TTLX: this.state.companyType, //收票客户抬头类型 1:个人 2:企业
  602. KPF_NSRSBH: this.state.company.entTaxId, //开票方纳税人识别号
  603. KPF_MC: this.state.company.entName, //开票方名称
  604. KPF_DZ: this.state.company.entAddress, //开票方地址
  605. KPF_DH: this.state.company.entPhone, //开票方电话
  606. KPF_YHZH: this.state.company.bankAccountNumber, //开票方银行账号
  607. KPF_KHHMC: this.state.company.bankName, //开票方开户行名称
  608. SPF_NSRSBH: this.state.taxNumber, //收票方纳税人识别号
  609. SPF_MC: this.state.customerName, //收票方名称
  610. SPF_DH: this.state.contactNumber, //收票方电话
  611. SPF_DZ: this.state.address, //收票方地址
  612. SPF_YHZH: this.state.bank, //收票方银行账号
  613. SPF_KHHMC: this.state.bank, //收票方开户行名称
  614. KPR: this.state.drawer, //开票人
  615. SKR: this.state.payee, //收款人
  616. FHR: this.state.reviewer, //复核人
  617. YFP_DM: '', //原发票代码
  618. YFP_HM: '', //原发票号码
  619. JSHJ: NumberTwoDecimal(parseFloat(this.state.amountTotal)), //价税合计
  620. HJJE: NumberTwoDecimal(parseFloat(this.state.productAmountTotal)), //合计金额
  621. HJSE: NumberTwoDecimal(this.state.taxRateTotal), //合计税额
  622. BZ: this.state.remark, //备注
  623. HYLX: 0, //发票行性质 0 正常行、1 折扣行、2 被折扣行
  624. TSPZ: '00', //特殊票种标识 “00”不是 “01”农产品销售“02”农产品收购“06”抵扣通行费“07”其它通行费“08”成品油销售说明:如果非特殊票种此节点可以没有。
  625. COMMON_FPKJ_XMXXS: {
  626. COMMON_FPKJ_XMXX: this.state.listData,
  627. }, // 产品列表
  628. },
  629. },
  630. mobile: account,
  631. reqChannel: 3,
  632. },
  633. false,
  634. 1,
  635. );
  636. if (response) {
  637. if (response.code == 0) {
  638. ToastShow(1, '开票成功!');
  639. }
  640. } else {
  641. ToastShow(1, response.msg);
  642. }
  643. }
  644. };
  645. //加载list列表
  646. setList = (data) => {
  647. console.log(data);
  648. let numberTotal =
  649. parseInt(this.state.productNumberTotal) + parseInt(data.XMSL);
  650. let taxRateTotal =
  651. parseFloat(this.state.taxRateTotal) + parseFloat(data.SE);
  652. let amountTotal =
  653. parseFloat(this.state.amountTotal) + parseFloat(data.amount);
  654. let productAmountTotal = parseFloat(this.state.productAmountTotal) + parseFloat(data.XMJE)
  655. let list = this.state.listData.concat(data);
  656. this.setState({
  657. listData: list,
  658. amountTotal: amountTotal,
  659. taxRateTotal: taxRateTotal,
  660. productNumberTotal: numberTotal,
  661. productAmountTotal: productAmountTotal,
  662. });
  663. };
  664. //加载items
  665. renderItem = (data) => (
  666. <SwipeAction
  667. autoClose
  668. style={{backgroundColor: 'transparent'}}
  669. right={this.right(data)}>
  670. <List.Item>
  671. <View style={{flexDirection: 'row', justifyContent: 'space-around'}}>
  672. <View style={{width: 70, alignItems: 'center'}}>
  673. <Text>{data.item.XMMC} </Text>
  674. </View>
  675. <View
  676. style={{width: 70, alignItems: 'center'}}>
  677. <Text>{data.item.price}</Text>
  678. </View>
  679. {/*<View>*/}
  680. {/* <Text>{data.item.XMSL} </Text>*/}
  681. {/*</View>*/}
  682. <View style={{width: 70, alignItems: 'center'}}>
  683. <Text>{data.item.SL * 100}</Text>
  684. </View>
  685. <View style={{width: 70, alignItems: 'center'}}>
  686. <Text>{data.item.taxAmount}</Text>
  687. </View>
  688. </View>
  689. </List.Item>
  690. </SwipeAction>
  691. );
  692. //左滑删除
  693. right = (data) => [
  694. {
  695. text: '删除',
  696. onPress: () => {
  697. this.deleteData(data.item);
  698. },
  699. style: {backgroundColor: 'red', color: 'white'},
  700. },
  701. ];
  702. //删除产品信息
  703. deleteData = (data) => {
  704. let listData = this.state.listData;
  705. let numberTotal =
  706. parseInt(this.state.productNumberTotal) - parseInt(data.XMSL);
  707. let taxRateTotal =
  708. parseFloat(this.state.taxRateTotal) - parseFloat(data.SE);
  709. let amountTotal =
  710. parseFloat(this.state.amountTotal) - parseFloat(data.amount);
  711. let productAmountTotal =
  712. parseFloat(this.state.productAmountTotal) - parseFloat(data.XMJE);
  713. const prevIndex = listData.findIndex((item) => item.key === data.SPBM);
  714. listData.splice(prevIndex, 1);
  715. this.setState({
  716. listData: listData,
  717. amountTotal: amountTotal,
  718. taxRateTotal: taxRateTotal,
  719. productNumberTotal: numberTotal,
  720. productAmountTotal: productAmountTotal,
  721. });
  722. };
  723. // 字段隐藏切换
  724. hideChange = () => {
  725. this.setState({
  726. hideStatus: !this.state.hideStatus,
  727. hideStatusText: '收起',
  728. });
  729. };
  730. // 获取选择企业信息
  731. selectCustomer = (data) => {
  732. this.setState({
  733. customerName: data.customerName,
  734. taxNumber: data.entTaxId,
  735. contactNumber: data.contactPhone,
  736. address: data.address,
  737. bank: data.bankName,
  738. bankAccount: data.bankAccount,
  739. });
  740. };
  741. }
  742. const styles = StyleSheet.create({
  743. buttonView: {
  744. alignItems: 'center',
  745. backgroundColor: '#ffffff',
  746. },
  747. //通用按钮样式
  748. button: {
  749. marginTop: 5,
  750. width: Dimensions.get('window').width * 0.8,
  751. height: 34,
  752. borderRadius: 10,
  753. backgroundColor: '#1874CD',
  754. justifyContent: 'center',
  755. alignItems: 'center',
  756. },
  757. //通用按钮样式
  758. buttonText: {
  759. textAlign: 'center',
  760. color: 'white',
  761. },
  762. inputView: {
  763. padding: 5,
  764. backgroundColor: '#fff',
  765. alignItems: 'center',
  766. justifyContent: 'center',
  767. display: 'flex',
  768. },
  769. view: {
  770. flexDirection: 'row',
  771. height: 34,
  772. width: Dimensions.get('window').width * 0.8,
  773. },
  774. //通用textInput样式
  775. text: {
  776. lineHeight: 34,
  777. fontSize: 14,
  778. },
  779. //通用textInput样式
  780. lineTopBottom: {
  781. borderBottomWidth: 3 / PixelRatio.get(),
  782. borderColor: 'rgb(208,208,208)',
  783. },
  784. textInputStyle: {
  785. marginRight: 10,
  786. marginLeft: 20,
  787. fontSize: 14,
  788. marginTop: 4,
  789. },
  790. });