|
|
@@ -3,7 +3,7 @@
|
|
|
* @邠心vbe on 2023/02/02
|
|
|
*/
|
|
|
import React, { Component } from 'react';
|
|
|
-import { View, Text, StyleSheet, Switch, AppState, Linking } from 'react-native';
|
|
|
+import { View, Text, StyleSheet, ScrollView, AppState, Linking } from 'react-native';
|
|
|
import apiWallet from '../../api/apiWallet';
|
|
|
import BadgeSelectItem from '../../components/BadgeSelectItem';
|
|
|
import Button, { ElevationObject } from '../../components/Button';
|
|
|
@@ -86,6 +86,10 @@ export default class TopupNew extends Component {
|
|
|
currency: topup?.currency,
|
|
|
payAmount: topup?.amount
|
|
|
}
|
|
|
+ if (this.state.payType?.fomoPayType) {
|
|
|
+ params.payTypeSelection = this.state.payType.fomoPayType
|
|
|
+ }
|
|
|
+ //console.log('充值请求参数', params);
|
|
|
apiWallet.doPaymentV2(params).then(res => {
|
|
|
Dialog.dismissLoading();
|
|
|
if (res.data.webPaymentUrl) {
|
|
|
@@ -107,7 +111,7 @@ export default class TopupNew extends Component {
|
|
|
const params = {
|
|
|
currency: topup?.currency,
|
|
|
payAmount: topup?.amount,
|
|
|
- fomoPayType: this.state.payType.fomoPayType
|
|
|
+ fomoPayType: this.state.payType?.fomoPayType
|
|
|
}
|
|
|
//console.log('params',params);
|
|
|
if (params.payAmount) {
|
|
|
@@ -149,89 +153,90 @@ export default class TopupNew extends Component {
|
|
|
render() {
|
|
|
return (
|
|
|
<View style={styles.container}>
|
|
|
- <View style={styles.headerView}>
|
|
|
- <Balance balanceText={this.state.balance}/>
|
|
|
- </View>
|
|
|
- <View style={styles.contentView}>
|
|
|
- <View style={styles.topupView}>
|
|
|
- <WalletTitle>{$t('wallet.titleChooseCreditValue')}</WalletTitle>
|
|
|
- { app.modules.nationally
|
|
|
- ? <View style={styles.topupItems2}>
|
|
|
- { this.state.topupList.map((item, index) => {
|
|
|
- return (
|
|
|
- <BadgeSelectItem
|
|
|
- key={index}
|
|
|
- style={[styles.topupItem2]}
|
|
|
- checked={index == this.state.selectIndex}
|
|
|
- onPress={() => {
|
|
|
- this.setState({
|
|
|
- selectIndex: index
|
|
|
- })
|
|
|
- }}>
|
|
|
- <Text style={[styles.topupText, index == this.state.selectIndex && {color: colorAccent}]}>
|
|
|
- <Text style={{fontSize: 16}}>{item.currencySymbol} </Text>
|
|
|
- {item.amount}
|
|
|
- {/* <Text style={{fontSize: 16}}> {item.currency}</Text> */}
|
|
|
- </Text>
|
|
|
- </BadgeSelectItem>
|
|
|
- );
|
|
|
- })
|
|
|
- }
|
|
|
- </View>
|
|
|
- : <View style={styles.topupItems}>
|
|
|
- { this.state.topupList.map((item, index) => {
|
|
|
- return (
|
|
|
- <BadgeSelectItem
|
|
|
- key={index}
|
|
|
- style={[styles.topupItem, index > 0 && styles.right]}
|
|
|
- checked={index == this.state.selectIndex}
|
|
|
- onPress={() => {
|
|
|
- this.setState({
|
|
|
- selectIndex: index
|
|
|
- })
|
|
|
- }}>
|
|
|
- <Text style={[styles.topupText, index == this.state.selectIndex && {color: colorAccent}]}>
|
|
|
- <Text style={{fontSize: 16}}>{item.currencySymbol} </Text>
|
|
|
- {item.amount}
|
|
|
- {/* <Text style={{fontSize: 16}}> {item.currency}</Text> */}
|
|
|
- </Text>
|
|
|
- </BadgeSelectItem>
|
|
|
- );
|
|
|
- })
|
|
|
- }
|
|
|
- </View>
|
|
|
- }
|
|
|
+ <ScrollView style={ui.flex1}>
|
|
|
+ <View style={styles.headerView}>
|
|
|
+ <Balance balanceText={this.state.balance}/>
|
|
|
</View>
|
|
|
- { !PaymentDefault.is2c2p &&
|
|
|
+ <View style={styles.contentView}>
|
|
|
<View style={styles.topupView}>
|
|
|
- <WalletTitle>{$t('wallet.titleChoosePaymentType')}</WalletTitle>
|
|
|
- <TopupPaythod
|
|
|
- onChange={type => {
|
|
|
- this.setState({
|
|
|
- payType: type
|
|
|
- });
|
|
|
- }}/>
|
|
|
- </View>
|
|
|
- }
|
|
|
- </View>
|
|
|
- <View style={ui.flex1}></View>
|
|
|
- { utils.isNotEmpty(app.storeUrl.refundUrl) &&
|
|
|
- <View style={styles.agreeView}>
|
|
|
- <CheckBox
|
|
|
- value={this.state.agree}
|
|
|
- onTintColor={colorAccent}
|
|
|
- onCheckColor={colorAccent}
|
|
|
- onValueChange={v => this.changeAgree(v)}
|
|
|
- />
|
|
|
- <View style={styles.agreeTextRow}>
|
|
|
- <TextView style={styles.agreeText} onPress={() => this.changeAgree(!this.state.agree)}>
|
|
|
- {$t('sign.iHaveReadAndAgree')}
|
|
|
- </TextView>
|
|
|
- <TextView style={styles.agreeLink} onPress={() => this.toPolicy()}>Refund Policy</TextView>
|
|
|
+ <WalletTitle>{$t('wallet.titleChooseCreditValue')}</WalletTitle>
|
|
|
+ { app.modules.nationally
|
|
|
+ ? <View style={styles.topupItems2}>
|
|
|
+ { this.state.topupList.map((item, index) => {
|
|
|
+ return (
|
|
|
+ <BadgeSelectItem
|
|
|
+ key={index}
|
|
|
+ style={[styles.topupItem2]}
|
|
|
+ checked={index == this.state.selectIndex}
|
|
|
+ onPress={() => {
|
|
|
+ this.setState({
|
|
|
+ selectIndex: index
|
|
|
+ })
|
|
|
+ }}>
|
|
|
+ <Text style={[styles.topupText, index == this.state.selectIndex && {color: colorAccent}]}>
|
|
|
+ <Text style={{fontSize: 16}}>{item.currencySymbol} </Text>
|
|
|
+ {item.amount}
|
|
|
+ {/* <Text style={{fontSize: 16}}> {item.currency}</Text> */}
|
|
|
+ </Text>
|
|
|
+ </BadgeSelectItem>
|
|
|
+ );
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ : <View style={styles.topupItems}>
|
|
|
+ { this.state.topupList.map((item, index) => {
|
|
|
+ return (
|
|
|
+ <BadgeSelectItem
|
|
|
+ key={index}
|
|
|
+ style={[styles.topupItem, index > 0 && styles.right]}
|
|
|
+ checked={index == this.state.selectIndex}
|
|
|
+ onPress={() => {
|
|
|
+ this.setState({
|
|
|
+ selectIndex: index
|
|
|
+ })
|
|
|
+ }}>
|
|
|
+ <Text style={[styles.topupText, index == this.state.selectIndex && {color: colorAccent}]}>
|
|
|
+ <Text style={{fontSize: 16}}>{item.currencySymbol} </Text>
|
|
|
+ {item.amount}
|
|
|
+ {/* <Text style={{fontSize: 16}}> {item.currency}</Text> */}
|
|
|
+ </Text>
|
|
|
+ </BadgeSelectItem>
|
|
|
+ );
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ }
|
|
|
</View>
|
|
|
+ { (!PaymentDefault.is2c2p || app.modules.topup_payment_type) &&
|
|
|
+ <View style={styles.topupView}>
|
|
|
+ <WalletTitle>{$t('wallet.titleChoosePaymentType')}</WalletTitle>
|
|
|
+ <TopupPaythod
|
|
|
+ onChange={type => {
|
|
|
+ this.setState({
|
|
|
+ payType: type
|
|
|
+ });
|
|
|
+ }}/>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
</View>
|
|
|
- }
|
|
|
+ </ScrollView>
|
|
|
<View style={styles.buttonView}>
|
|
|
+ { utils.isNotEmpty(app.storeUrl.refundUrl) &&
|
|
|
+ <View style={styles.agreeView}>
|
|
|
+ <CheckBox
|
|
|
+ value={this.state.agree}
|
|
|
+ onTintColor={colorAccent}
|
|
|
+ onCheckColor={colorAccent}
|
|
|
+ onValueChange={v => this.changeAgree(v)}
|
|
|
+ />
|
|
|
+ <View style={styles.agreeTextRow}>
|
|
|
+ <TextView style={styles.agreeText} onPress={() => this.changeAgree(!this.state.agree)}>
|
|
|
+ {$t('sign.iHaveReadAndAgree')}
|
|
|
+ </TextView>
|
|
|
+ <TextView style={styles.agreeLink} onPress={() => this.toPolicy()}>Refund Policy</TextView>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
<Button
|
|
|
text={$t('wallet.btnPurchase')}
|
|
|
elevation={1.5}
|
|
|
@@ -334,6 +339,7 @@ const styles = StyleSheet.create({
|
|
|
topupText: {
|
|
|
fontSize: 18,
|
|
|
color: textPrimary,
|
|
|
+ fontWeight: 'bold',
|
|
|
...$padding(20, 0)
|
|
|
},
|
|
|
right: {
|
|
|
@@ -352,13 +358,13 @@ const styles = StyleSheet.create({
|
|
|
},
|
|
|
buttonView: {
|
|
|
padding: 16,
|
|
|
- marginTop: 0,
|
|
|
+ marginTop: 2,
|
|
|
marginBottom: 16
|
|
|
},
|
|
|
agreeView: {
|
|
|
- margin: 16,
|
|
|
- flexDirection: 'row',
|
|
|
+ marginBottom: 16,
|
|
|
alignItems: 'center',
|
|
|
+ flexDirection: 'row'
|
|
|
},
|
|
|
agreeTextRow: {
|
|
|
flex: 1,
|