|
@@ -3,16 +3,18 @@
|
|
|
* @邠心vbe on 2021/04/13
|
|
* @邠心vbe on 2021/04/13
|
|
|
*/
|
|
*/
|
|
|
import React, { Component } from 'react';
|
|
import React, { Component } from 'react';
|
|
|
-import { View, Text, StyleSheet, Pressable, ScrollView } from 'react-native';
|
|
|
|
|
|
|
+import { View, StyleSheet, Pressable, ScrollView } from 'react-native';
|
|
|
import BottomModal from '../../components/BottomModal';
|
|
import BottomModal from '../../components/BottomModal';
|
|
|
import BadgeSelectItem from '../../components/BadgeSelectItem';
|
|
import BadgeSelectItem from '../../components/BadgeSelectItem';
|
|
|
import { ChargeStyle } from './Charging';
|
|
import { ChargeStyle } from './Charging';
|
|
|
import { PAYTYPE, PaymentIcon } from '../payment/PaymentConfig';
|
|
import { PAYTYPE, PaymentIcon } from '../payment/PaymentConfig';
|
|
|
|
|
+import Skeleton from "react-native-reanimated-skeleton";
|
|
|
import TextView from '../../components/TextView';
|
|
import TextView from '../../components/TextView';
|
|
|
import apiCharge from '../../api/apiCharge';
|
|
import apiCharge from '../../api/apiCharge';
|
|
|
import Button from '../../components/Button';
|
|
import Button from '../../components/Button';
|
|
|
import Dialog from '../../components/Dialog';
|
|
import Dialog from '../../components/Dialog';
|
|
|
import app from '../../../app.json';
|
|
import app from '../../../app.json';
|
|
|
|
|
+import utils from '../../utils/utils';
|
|
|
|
|
|
|
|
export default class PaymentListV2 extends Component {
|
|
export default class PaymentListV2 extends Component {
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
@@ -22,7 +24,8 @@ export default class PaymentListV2 extends Component {
|
|
|
isSelect: true,
|
|
isSelect: true,
|
|
|
options: [],
|
|
options: [],
|
|
|
selectIndex: 0,
|
|
selectIndex: 0,
|
|
|
- selectOptions: {}
|
|
|
|
|
|
|
+ selectOptions: {},
|
|
|
|
|
+ isloading: true
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -42,12 +45,19 @@ export default class PaymentListV2 extends Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
getPaymentOptions() {
|
|
getPaymentOptions() {
|
|
|
|
|
+ if (utils.isEmpty(this.props.chargeBoxId)) {
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.getPaymentOptions();
|
|
|
|
|
+ }, 1000);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
apiCharge.getPaymentTypeOptions({
|
|
apiCharge.getPaymentTypeOptions({
|
|
|
chargeBoxId: this.props.chargeBoxId
|
|
chargeBoxId: this.props.chargeBoxId
|
|
|
}).then(res => {
|
|
}).then(res => {
|
|
|
if (res.data) {
|
|
if (res.data) {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
- options: res.data
|
|
|
|
|
|
|
+ options: res.data,
|
|
|
|
|
+ isloading: false
|
|
|
})
|
|
})
|
|
|
if (this.props.payType && this.props.payType.code) {
|
|
if (this.props.payType && this.props.payType.code) {
|
|
|
for (let i = 0; i < res.data.length; i++) {
|
|
for (let i = 0; i < res.data.length; i++) {
|
|
@@ -133,12 +143,26 @@ export default class PaymentListV2 extends Component {
|
|
|
<TextView style={styles.numberDot}>{this.state.options.length}</TextView>
|
|
<TextView style={styles.numberDot}>{this.state.options.length}</TextView>
|
|
|
}
|
|
}
|
|
|
<View style={styles.paymentView}>
|
|
<View style={styles.paymentView}>
|
|
|
- <TextView
|
|
|
|
|
- style={styles.valueText}
|
|
|
|
|
- numberOfLines={1}>{this.state.selectOptions?.name}</TextView>
|
|
|
|
|
- <TextView
|
|
|
|
|
- style={styles.paymentText}
|
|
|
|
|
- numberOfLines={1}>{this.state.selectOptions?.desc}</TextView>
|
|
|
|
|
|
|
+ <Skeleton
|
|
|
|
|
+ containerStyle={ui.flex1}
|
|
|
|
|
+ isLoading={this.state.isloading}
|
|
|
|
|
+ animationType="pulse"
|
|
|
|
|
+ layout={[{width: '60%', height: 20, marginLeft: 10}]}
|
|
|
|
|
+ animationDirection={"horizontalRight"}>
|
|
|
|
|
+ <TextView
|
|
|
|
|
+ style={styles.valueText}
|
|
|
|
|
+ numberOfLines={1}>{this.state.selectOptions?.name}</TextView>
|
|
|
|
|
+ </Skeleton>
|
|
|
|
|
+ <Skeleton
|
|
|
|
|
+ containerStyle={ui.flex1}
|
|
|
|
|
+ isLoading={this.state.isloading}
|
|
|
|
|
+ animationType="pulse"
|
|
|
|
|
+ layout={[{width: '60%', height: 20, marginLeft: 20}]}
|
|
|
|
|
+ animationDirection={"horizontalRight"}>
|
|
|
|
|
+ <TextView
|
|
|
|
|
+ style={styles.paymentText}
|
|
|
|
|
+ numberOfLines={1}>{this.state.selectOptions?.desc}</TextView>
|
|
|
|
|
+ </Skeleton>
|
|
|
</View>
|
|
</View>
|
|
|
{ this.state.selectOptions?.def &&
|
|
{ this.state.selectOptions?.def &&
|
|
|
<TextView style={styles.textDefault}>Default</TextView>
|
|
<TextView style={styles.textDefault}>Default</TextView>
|
|
@@ -267,7 +291,7 @@ const styles = StyleSheet.create({
|
|
|
},
|
|
},
|
|
|
numberDot: {
|
|
numberDot: {
|
|
|
top: 10,
|
|
top: 10,
|
|
|
- left: 32,
|
|
|
|
|
|
|
+ left: app.charge.version >= 4 ? 32 : 35,
|
|
|
width: 16,
|
|
width: 16,
|
|
|
height: 16,
|
|
height: 16,
|
|
|
color: textButton,
|
|
color: textButton,
|
|
@@ -277,6 +301,6 @@ const styles = StyleSheet.create({
|
|
|
position: 'absolute',
|
|
position: 'absolute',
|
|
|
alignItems: 'center',
|
|
alignItems: 'center',
|
|
|
justifyContent: 'center',
|
|
justifyContent: 'center',
|
|
|
- backgroundColor: colorAccent
|
|
|
|
|
|
|
+ backgroundColor: app.charge.version >= 4 ? colorAccent : "#FF2622"
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|