123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- import React, {Component} from 'react';
- import {
- View,
- Text,
- TextInput,
- TouchableOpacity,
- StyleSheet,
- Dimensions,
- PixelRatio,
- Modal,
- FlatList,
- Image,
- } from 'react-native';
- import {RoundingData} from '../../source/inspect/inspect';
- import {List, SwipeAction} from '@ant-design/react-native';
- import {RequestNetwork} from '../../data/encryption';
- import {RetrieveData, StorageData} from '../../data/storage';
- import invoice_head_css from './invoice_head_css';
- import public_css from '../../source/css/public_css';
- import { ToastShow } from "../../components/toast/toast";
- export default class invoice_head_information extends Component {
- constructor(props) {
- super(props);
- this.props.navigation.dangerouslyGetParent().setOptions({
- tabBarVisible: false,
- });
- this.state = {
- listData: this.props.route.params.listData,
- customerName: this.props.route.params.customerName,
- customerEntTaxId: this.props.route.params.customerEntTaxId,
- address: this.props.route.params.address,
- contactPhone: this.props.route.params.contactPhone,
- bankName: this.props.route.params.bankName,
- bankAccountNo: this.props.route.params.bankAccountNo,
- customerEmail: this.props.route.params.customerEmail,
- customerMobile: this.props.route.params.customerMobile,
- remark: this.props.route.params.remark,
- belongEntTaxId: this.props.route.params.belongEntTaxId,
- entName: this.props.route.params.entName,
- product_number_total: this.props.route.params.product_number_total,
- amount_total: this.props.route.params.amount_total,
- tax_rate_total: this.props.route.params.tax_rate_total,
- };
- }
- render() {
- return (
- <View style={public_css.body}>
- <View style={{marginLeft: 10}}>
- <View style={invoice_head_css.itemView}>
- <Text style={invoice_head_css.itemViewName}>
- 客户姓名:
- </Text>
- <Text>{this.state.customerName}</Text>
- </View>
- <View style={invoice_head_css.itemView}>
- <Text style={invoice_head_css.itemViewName}>
- 客户企业税号:
- </Text>
- <Text>{this.state.customerEntTaxId}</Text>
- </View>
- <View style={invoice_head_css.itemView}>
- <Text style={invoice_head_css.itemViewName}>
- 联系电话:
- </Text>
- <Text>{this.state.contactPhone}</Text>
- </View>
- <View style={invoice_head_css.itemView}>
- <Text style={invoice_head_css.itemViewName}>
- 地址:
- </Text>
- <Text>{this.state.address}</Text>
- </View>
- <View style={invoice_head_css.itemView}>
- <Text style={invoice_head_css.itemViewName}>
- 开户银行:
- </Text>
- <Text>{this.state.bankName}</Text>
- </View>
- <View style={invoice_head_css.itemView}>
- <Text style={invoice_head_css.itemViewName}>
- 银行账号:
- </Text>
- <Text>{this.state.bankAccountNo}</Text>
- </View>
- <View style={invoice_head_css.itemView}>
- <Text style={invoice_head_css.itemViewName}>
- 客户邮箱:
- </Text>
- <Text>{this.state.customerEmail}</Text>
- </View>
- <View style={invoice_head_css.itemView}>
- <Text style={invoice_head_css.itemViewName}>
- 客户手机号:
- </Text>
- <Text>{this.state.customerMobile}</Text>
- </View>
- <View style={invoice_head_css.itemView}>
- <Text style={invoice_head_css.itemViewName}>
- 备注:
- </Text>
- <Text>{this.state.remark}</Text>
- </View>
- </View>
- <View style={invoice_head_css.list_view}>
- <Text style={invoice_head_css.list_title_text}>产品名称</Text>
- <Text sstyle={invoice_head_css.list_title_text}>产品数量</Text>
- <Text sstyle={invoice_head_css.list_title_text}>规格型号</Text>
- <Text style={invoice_head_css.list_title_text}>单价</Text>
- <Text style={invoice_head_css.list_title_text}>税率(%)</Text>
- </View>
- <View
- style={{
- flex: 1,
- }}>
- <FlatList
- data={this.state.listData}
- renderItem={item => this.renderItem(item)}
- />
- </View>
- <View
- style={{
- flexDirection: 'row',
- justifyContent: 'space-around',
- alignItems: 'center',
- width: Dimensions.get('window').width,
- height: 50,
- }}>
- <Text>共{this.state.product_number_total}个产品</Text>
- <Text>
- 开票金额:
- {RoundingData(parseFloat(this.state.amount_total)).replace(
- /(\d)(?=(\d{3})+(?:\.\d+)?$)/g,
- '$1,',
- )}
- 元
- </Text>
- <Text>
- 税额:{RoundingData(parseFloat(this.state.tax_rate_total))}
- </Text>
- </View>
- <View style={[public_css.bottomStatus]}>
- <TouchableOpacity
- style={[public_css.statusBtn, public_css.statusRBtn]}
- onPress={() => this.submitData()}>
- <Image
- source={require('../../source/img/productImg/confirm.png')}
- style={{width: 32, height: 32}}
- />
- <Text style={{color: '#fff'}}>提交</Text>
- </TouchableOpacity>
- </View>
- </View>
- );
- }
- //提交开票信息
- submitData = async () => {
- let account = await RetrieveData('account');
- let token = await RetrieveData('token');
- let ent = await RetrieveData('defaultEnt');
- if (token && account && ent) {
- let entInformation = JSON.parse(ent);
- const url = '/sys/invoice_info/save';
- let response = await RequestNetwork(
- url,
- token,
- {
- interactType: 1,
- interactTypeDetail: this.state.customerEmail,
- invoiceWay: 1,
- invoiceCategory: 1,
- cmdParam: {
- REQUEST_COMMON_FPKJ: {
- KPLX: 0, //开票类型 0-蓝字发票;1-红字发票
- FPZL: 1, //发票种类 1.增值税普通电子发票 2.增值税电子专用发票 3.增值税普通纸质发票 4 增值税专用纸质发票
- TTLX: 2, //收票客户抬头类型 1:个人 2:企业
- KPF_NSRSBH: entInformation.entTaxId, //开票方纳税人识别号
- KPF_MC: entInformation.entName, //开票方名称
- KPF_DZ: entInformation.entAddress, //开票方地址
- KPF_DH: entInformation.entAddress, //开票方电话
- KPF_YHZH: '', //开票方银行账号
- KPF_KHHMC: '', //开票方开户行名称
- SPF_NSRSBH: this.state.customerEntTaxId, //收票方纳税人识别号
- SPF_MC: this.state.customerName, //收票方名称
- SPF_DH: this.state.contactPhone.toString(), //收票方电话
- SPF_DZ: this.state.address.toString(), //收票方地址
- SPF_YHZH: this.state.bankAccountNo, //收票方银行账号
- SPF_KHHMC: '', //收票方开户行名称
- KPR: account, //开票人
- SKR: this.state.payees, //收款人
- FHR: this.state.reviewers, //复核人
- YFP_DM: '', //原发票代码
- YFP_HM: '', //原发票号码
- JSHJ: RoundingData(parseFloat(this.state.amount_total)), //价税合计
- HJJE: RoundingData(
- this.state.amount_total - this.state.tax_rate_total,
- ), //合计金额
- HJSE: RoundingData(this.state.tax_rate_total), //合计税额
- BZ: this.state.remark, //备注
- HYLX: 0, //发票行性质 0 正常行、1 折扣行、2 被折扣行
- TSPZ: '00', //特殊票种标识 “00”不是 “01”农产品销售“02”农产品收购“06”抵扣通行费“07”其它通行费“08”成品油销售说明:如果非特殊票种此节点可以没有。
- // FPQQLSH: '',
- // KPLX: '0',
- // BMB_BBH: '',
- // ZSFS: '0',
- // XSF_NSRSBH: entInformation.entTaxId,
- // XSF_MC: entInformation.entName,
- // XSF_DZDH: entInformation.entAddress,
- // XSF_YHZH: '',
- // GMF_NSRSBH: this.state.customerEntTaxId,
- // GMF_MC: this.state.customerName,
- // GMF_DZDH:
- // this.state.address.toString() +
- // this.state.contactPhone.toString(),
- // GMF_YHZH: this.state.bankAccountNo,
- // GMF_SJH: '',
- // GMF_DZYX: this.state.customerEmail,
- // FPT_ZH: '',
- // WX_OPENID: '',
- // KPR: account,
- // SKR: '',
- // FHR: '',
- // YFP_DM: '',
- // YFP_HM: '',
- // JSHJ: RoundingData(parseFloat(this.state.amount_total)),
- // HJJE: RoundingData(
- // this.state.amount_total - this.state.tax_rate_total,
- // ),
- // HJSE: RoundingData(this.state.tax_rate_total),
- // KCE: '',
- // BZ: this.state.remark,
- // HYLX: '0',
- // BY1: '',
- // BY2: '',
- // BY3: '',
- // BY4: '',
- // BY5: '',
- // BY6: '',
- // BY7: '',
- // BY8: '',
- // BY9: '',
- // BY10: '',
- // WX_ORDER_ID: '',
- // WX_APP_ID: '',
- // ZFB_UID: '',
- // // TSPZ: '',
- // QJ_ORDER_ID: '',
- // WX_GROUP_ID: '',
- COMMON_FPKJ_XMXXS: {
- COMMON_FPKJ_XMXX: this.state.listData,
- }, // 产品列表
- },
- },
- mobile: account,
- reqChannel: 3,
- },
- false,
- 1,
- );
- if (response) {
- if (response.code == 0) {
- ToastShow(1, '开票成功!');
- this.props.navigation.popToTop();
- }
- } else {
- ToastShow(1, '服务器故障!');
- }
- }
- };
- //产品列表
- renderItem = data => (
- <SwipeAction autoClose style={{backgroundColor: 'transparent'}}>
- <List.Item>
- <View style={{flexDirection: 'row', justifyContent: 'space-around'}}>
- <Text>{data.item.XMMC} </Text>
- <Text>{data.item.XMSL} </Text>
- <Text>{data.item.GGXH}</Text>
- <Text>{data.item.XMDJ}</Text>
- <Text>{data.item.SL * 100}</Text>
- </View>
- </List.Item>
- </SwipeAction>
- );
- //初始化数据
- initData = () => {
- this.setState({
- customer_name: '',
- ent_tax_id: '',
- contact_phone: '',
- address: '',
- bank_account: '',
- });
- };
- }
|