buyer_qrcode.js 5.0 KB

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