/** * 钱包充值的支付方式列表 * @邠心vbe on 2023/02/02 */ import React, { Component } from 'react'; import { View, Text, StyleSheet } from 'react-native'; import apiWallet from '../../api/apiWallet'; import BadgeSelectItem from '../../components/BadgeSelectItem'; import { ElevationObject } from '../../components/Button'; import TextView from '../../components/TextView'; import { PaymentIcon } from '../payment/PaymentConfig'; export default class TopupPaythod extends Component { constructor(props) { super(props); this.state = { cIndex: 0, payTypeList: [] }; } componentDidMount() { this.getPayType(); } getPayType() { apiWallet.getPayTypeList().then(res => { if (res.data) { this.setState({ payTypeList: res.data }); this.onChange(0); } }).catch(err => { }); } changePayType(index) { this.setState({ cIndex: index }); this.onChange(index); } onChange(index) { if (this.props.onChange) { this.props.onChange(this.state.payTypeList[index]); } } getSecuryNumber(number, pk) { if (pk) { const last = number.substring(number.length - 8); var x = '' for (let i = 0; i < number.length - 8; i++) { x += 'X'; } return x + last; } else { return " "; } } render() { return ( { this.state.payTypeList.map((item, index) => { return ( 0 && styles.next ]} checked={index == this.state.cIndex} onPress={() => this.changePayType(index)}> { this.props.showIcon && } {item.payName} {/* {this.getSecuryNumber(item.payName, item.cardPk)} */} ); }) } ); } } const styles = StyleSheet.create({ listView: { /*flexWrap: 'wrap', flexDirection: 'row'*/ }, paytypeView: { //flex: 1, alignItems: 'center', backgroundColor: colorLight, ...ElevationObject(5) }, selected: { borderColor: colorPrimary }, next: { marginTop: 16, }, paytypeText: { color: textPrimary, fontSize: 16, fontWeight: 'bold', padding: 18 }, cardText: { color: "#666", fontSize: 8, marginTop: -18, paddingBottom: 4 }, selectIcon: { width: 18, height: 18, }, accountLogo: { width: 36, height: 18, marginRight: 32 }, });