Payment.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import React, { Component } from 'react';
  2. import { View, Text, StyleSheet } from 'react-native';
  3. import BadgeSelectItem from '../../components/BadgeSelectItem';
  4. import { PAYTYPE } from '../wallet/Payment';
  5. import { PaymentIcon } from '../wallet/TopupPaythod';
  6. import { ChargeStyle } from './Charging';
  7. export const CHARGE_PAYTYPE = [/*{
  8. // 按次支付
  9. name: "Pay Per Use",
  10. type: PAYTYPE.PAY_PER_USE,
  11. title: "SGQR",
  12. icon: "PAYNOW"
  13. }, */{
  14. // 钱包余额支付
  15. name: "Credit Wallet",
  16. type: PAYTYPE.CREDIT_WALLET,
  17. icon: "WALLET",
  18. balance: true
  19. }]
  20. export const PaymentList = ({isSelect=true, payType, payPerUse, onMethodChange}) => (
  21. CHARGE_PAYTYPE.map((item, index) => {
  22. if (isSelect || payType==item.type) {
  23. return (
  24. <BadgeSelectItem
  25. key={index}
  26. style={ChargeStyle.stationInfoView}
  27. checked={payType==item.type}
  28. onPress={() => {
  29. if (onMethodChange) {
  30. onMethodChange(item.type);
  31. }
  32. }}>
  33. <PaymentIcon
  34. method={item.icon}
  35. checked={payType==item.type}/>
  36. <View style={styles.paymentView}>
  37. <Text style={styles.valueText}>{item.balance ? (currency + userInfo.credit) : item.title}</Text>
  38. <Text style={styles.paymentText}>{item.name}</Text>
  39. </View>
  40. </BadgeSelectItem>
  41. )
  42. } else {
  43. return null
  44. }
  45. })
  46. )
  47. const styles = StyleSheet.create({
  48. paymentView: {
  49. flex: 1,
  50. alignItems: 'center'
  51. },
  52. valueText: {
  53. color: textPrimary,
  54. fontSize: 16,
  55. fontWeight: 'bold'
  56. },
  57. paymentText: {
  58. color: textSecondary,
  59. fontSize: 12
  60. }
  61. })