import React, {Component} from 'react'; import { View, Text, TextInput, TouchableOpacity, DeviceEventEmitter, Image, ScrollView, KeyboardAvoidingView, } from 'react-native'; import login_css from '../login/login_css'; import public_css from '../../source/css/public_css'; import {RoundingData, GetNum} from '../../source/inspect/inspect'; import {ShowToast} from '../../components/rootToast/root_toast'; export default class invoice_product_number extends Component { constructor(props) { super(props); this.props.navigation.dangerouslyGetParent().setOptions({ tabBarVisible: false, }); this.state = { key: this.props.route.params.key, product_name: this.props.route.params.XMMC, specsModel: this.props.route.params.GGXH, price: this.props.route.params.XMDJ, taxRate: this.props.route.params.SL, product_number: '', }; } render() { return ( *产品名称: { this.setState({ product_name: text, }); }} /> *规格型号: { this.setState({ specsModel: text, }); }} /> *单价: { this.setState({ price: text, }); }} /> *税率(%): { this.setState({ taxRate: text, }); }} /> *产品数量: { this.setState({ product_number: text, }); }} /> 合计: this.submitData()}> 确定添加 ); } //提交数据添加到产品列表中 submitData = () => { if (this.state.product_name == '') { ShowToast('产品名称不能为空!'); return; } if (this.state.specsModel == '') { ShowToast('规格型号不能为空!'); return; } if (this.state.price == '') { ShowToast('单价不能为空!'); return; } if (this.state.taxRate == '') { ShowToast('税率不能为空!'); return; } if (this.state.product_number == '') { ShowToast('产品数量不能为空!'); return; } if (this.state.product_number == 0) { ShowToast('产品数量不能为空!'); return; } let data = { FPHXZ: this.props.route.params.FPHXZ, //发票行性质 0正常行 1折扣行 2被折扣行 必填 SPBM: this.props.route.params.SPBM, //商品编码 ZXBM: this.props.route.params.ZXBM, //自行编码 YHZCBS: this.props.route.params.YHZCBS, //优惠政策标识 0不使用 1使用 LSLBS: this.props.route.params.LSLBS, //零税率标识 ZZSTSGL: this.props.route.params.ZZSTSGL, //增值税特殊管理 XMMC: this.state.product_name, //项目名称 必填 DW: this.props.route.params.DW, //计量单位 GGXH: this.state.specsModel, //规格型号 XMSL: this.state.product_number, //项目数量 XMDJ: GetNum(this.state.price / (1 + this.state.taxRate / 100)), //项目单价 XMJE: RoundingData( this.state.product_number * this.state.price - ((this.state.product_number * this.state.price) / (1 + this.state.taxRate / 100)) * (this.state.taxRate / 100), ), //项目金额 不含税 SL: this.state.taxRate / 100, //税率 必填 SE: RoundingData( ((this.state.product_number * this.state.price) / (1 + this.state.taxRate / 100)) * (this.state.taxRate / 100), ), //税额 必填 // SE: RoundingData((this.state.product_number * this.state.price) * this.state.taxRate), //税额 必填 }; DeviceEventEmitter.emit('产品监听', data); this.props.navigation.navigate('invoice_product_list'); }; }