/**
* 钱包充值的支付方式列表
* @邠心vbe on 2023/02/02
*/
import React, { Component } from 'react';
import { View, Text, StyleSheet, Image } from 'react-native';
import Svg, { Path } from 'react-native-svg';
import apiWallet from '../../api/apiWallet';
import BadgeSelectItem from '../../components/BadgeSelectItem';
import { ElevationObject } from '../../components/Button';
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)}>
{item.payName}
{this.getSecuryNumber(item.payName, item.cardPk)}
);
})
}
);
}
}
export const PaymentIcon = ({method="CARD", size=40, checked=false}) => {
switch (method) {
case "CARD":
return (
/**/
);
case "PAYNOW":
return (
)
case "GRABPAY":
return (
);
case "WALLET":
return (
)
}
}
const styles = StyleSheet.create({
listView: {
flexWrap: 'wrap',
flexDirection: 'row'
},
paytypeView: {
flex: 1,
alignItems: 'center',
backgroundColor: colorLight,
...ElevationObject(5)
},
selected: {
borderColor: colorPrimary
},
next: {
marginLeft: 16,
},
paytypeText: {
color: textPrimary,
fontSize: 14,
fontWeight: 'bold',
paddingBottom: 14
},
cardText: {
color: "#666",
fontSize: 8,
marginTop: -18,
paddingBottom: 4
},
selectIcon: {
width: 18,
height: 18,
},
accountLogo: {
width: 36,
height: 18,
marginRight: 32
},
});