invoice_qrcode.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. import React, {Component} from 'react';
  2. import { View, Text, StyleSheet, TextInput, SafeAreaView, ScrollView, Image } from "react-native";
  3. import QRCode from 'react-native-qrcode-svg';
  4. import { RetrieveData } from "../../data/storage";
  5. import public_css from '../../source/css/public_css';
  6. import login_css from "../login/login_css";
  7. export default class invoice_qrcode extends Component {
  8. constructor(props) {
  9. super(props);
  10. this.props.navigation.dangerouslyGetParent().setOptions({
  11. tabBarVisible: false,
  12. });
  13. this.state = {
  14. listData: [],
  15. product_number_total: 0,
  16. amount_total: 0.0,
  17. tax_rate_total: 0.0,
  18. text: '2132132132',
  19. companyTaxId: '',
  20. companyName: '',
  21. userName: '',
  22. headImage: '',
  23. sex: '',
  24. };
  25. }
  26. render() {
  27. return (
  28. <SafeAreaView style={public_css.body}>
  29. <ScrollView>
  30. <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
  31. <View style={styles.container}>
  32. <View style={{marginTop: 10, flexDirection: 'row'}}>
  33. {this.state.headImage === '' || this.state.headImage === null ? (
  34. this.state.sex === 'F' ? (
  35. <View style={{marginLeft: 20, justifyContent: 'center'}}>
  36. <Image
  37. source={require('../../source/img/personal/woman.png')}
  38. style={{
  39. width: 65,
  40. height: 65,
  41. borderRadius: 50,
  42. }}
  43. />
  44. </View>
  45. ) : (
  46. <View style={{marginLeft: 20, justifyContent: 'center'}}>
  47. <Image
  48. source={require('../../source/img/personal/man.png')}
  49. style={{
  50. width: 65,
  51. height: 65,
  52. borderRadius: 50,
  53. }}
  54. />
  55. </View>
  56. )) : (
  57. <View style={{marginLeft: 20, justifyContent: 'center'}}>
  58. <Image
  59. source={{uri: this.state.headImage}}
  60. style={{
  61. width: 65,
  62. height: 65,
  63. borderRadius: 50,
  64. }}
  65. />
  66. </View>
  67. )}
  68. <View style={{flex: 1, justifyContent: 'center', marginLeft: 10}}>
  69. <Text style={{fontSize: 16, color: '#414141'}}>{this.state.userName}</Text>
  70. <Text style={{color: '#747474'}}>{this.state.companyName}</Text>
  71. </View>
  72. </View>
  73. <View style={{backgroundColor: '#F5F5F5'}}>
  74. <Image
  75. source={require('../../source/img/qrcode.png')}
  76. resizeMode={'contain'}
  77. style={{height: 46, width: 320}}
  78. />
  79. </View>
  80. <View style={{marginTop: 10, marginBottom: 10}}>
  81. <QRCode
  82. size={200}
  83. value={
  84. 'https://www.chtax.cn/qrcode/#/titleTodo?entTaxId=' +
  85. this.state.companyTaxId +
  86. '&entName=' +
  87. this.state.companyName
  88. }
  89. logoSize={30}
  90. logoBackgroundColor="transparent"
  91. />
  92. </View>
  93. <View style={{height: 50, justifyContent: 'center'}}>
  94. <Text style={{color: '#8D8D8D'}}>
  95. 购方扫码并添加抬头便可进行开票
  96. </Text>
  97. </View>
  98. </View>
  99. </View>
  100. </ScrollView>
  101. </SafeAreaView>
  102. );
  103. }
  104. // render加载完后调用
  105. async componentDidMount() {
  106. let userHeadImg = JSON.parse(await RetrieveData('userHeadImg'));
  107. let company = JSON.parse(await RetrieveData('company'));
  108. let userName = await RetrieveData('userName');
  109. this.setState({
  110. companyTaxId: company.entTaxId,
  111. companyName: company.entName,
  112. userName: userName,
  113. headImage: userHeadImg.headImage,
  114. sex: userHeadImg.sex,
  115. });
  116. }
  117. }
  118. const styles = StyleSheet.create({
  119. container: {
  120. // height: 90,
  121. backgroundColor: '#ffffff',
  122. zIndex: 1,
  123. // top: -50,
  124. position: 'relative',
  125. // flexDirection: 'row',
  126. elevation: 20, // 适配android的
  127. shadowOffset: {width: 0, height: 0},
  128. shadowColor: 'black',
  129. shadowOpacity: 0.15,
  130. shadowRadius: 5,
  131. flex: 1,
  132. // backgroundColor: 'white',
  133. alignItems: 'center',
  134. justifyContent: 'center',
  135. margin: 30,
  136. width: 320,
  137. },
  138. input: {
  139. height: 40,
  140. borderColor: 'gray',
  141. borderWidth: 1,
  142. margin: 10,
  143. borderRadius: 5,
  144. padding: 5,
  145. },
  146. });