|
@@ -11,11 +11,13 @@ import { MyRefreshProps } from '../../components/ThemesConfig';
|
|
|
import utils from '../../utils/utils';
|
|
import utils from '../../utils/utils';
|
|
|
import { PageList } from '../Router';
|
|
import { PageList } from '../Router';
|
|
|
import TextView from '../../components/TextView';
|
|
import TextView from '../../components/TextView';
|
|
|
|
|
+import Skeleton from 'react-native-reanimated-skeleton';
|
|
|
|
|
|
|
|
export default class SummaryV3 extends Component {
|
|
export default class SummaryV3 extends Component {
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
|
super(props);
|
|
super(props);
|
|
|
this.state = {
|
|
this.state = {
|
|
|
|
|
+ loading: true,
|
|
|
isActully: true,
|
|
isActully: true,
|
|
|
refreshing: false,
|
|
refreshing: false,
|
|
|
summaryInfo: {
|
|
summaryInfo: {
|
|
@@ -37,7 +39,7 @@ export default class SummaryV3 extends Component {
|
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
|
const params = this.props.route.params;
|
|
const params = this.props.route.params;
|
|
|
if (params.chargingPk) {
|
|
if (params.chargingPk) {
|
|
|
- Dialog.showProgressDialog();
|
|
|
|
|
|
|
+ //Dialog.showProgressDialog();
|
|
|
this.setState({
|
|
this.setState({
|
|
|
chargingPk: params.chargingPk
|
|
chargingPk: params.chargingPk
|
|
|
})
|
|
})
|
|
@@ -45,11 +47,13 @@ export default class SummaryV3 extends Component {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
isActully: false
|
|
isActully: false
|
|
|
});
|
|
});
|
|
|
- this.getSummaryData(params.chargingPk);
|
|
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.getSummaryData(params.chargingPk);
|
|
|
|
|
+ }, 1000);
|
|
|
} else {
|
|
} else {
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
this.getSummaryData(params.chargingPk);
|
|
this.getSummaryData(params.chargingPk);
|
|
|
- }, 1500);
|
|
|
|
|
|
|
+ }, 3000);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (params.action) {
|
|
if (params.action) {
|
|
@@ -70,16 +74,17 @@ export default class SummaryV3 extends Component {
|
|
|
apiCharge.getChargeSummaryV2({
|
|
apiCharge.getChargeSummaryV2({
|
|
|
chargingPk: chargingPk
|
|
chargingPk: chargingPk
|
|
|
}).then(res => {
|
|
}).then(res => {
|
|
|
- Dialog.dismissLoading();
|
|
|
|
|
|
|
+ //Dialog.dismissLoading();
|
|
|
if (res.data) {
|
|
if (res.data) {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
|
|
+ loading: false,
|
|
|
refreshing: false,
|
|
refreshing: false,
|
|
|
summaryInfo: res.data,
|
|
summaryInfo: res.data,
|
|
|
isPendding: (res.data.hasSettled != true)
|
|
isPendding: (res.data.hasSettled != true)
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}).catch((err) => {
|
|
}).catch((err) => {
|
|
|
- Dialog.dismissLoading();
|
|
|
|
|
|
|
+ //Dialog.dismissLoading();
|
|
|
toastShort(err);
|
|
toastShort(err);
|
|
|
this.setState({
|
|
this.setState({
|
|
|
isPendding: true,
|
|
isPendding: true,
|
|
@@ -132,6 +137,58 @@ export default class SummaryV3 extends Component {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ isLoading(precond) {
|
|
|
|
|
+ return utils.isNotEmpty(precond) || this.state.loading;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ getSkeletonLeft(size=3) {
|
|
|
|
|
+ const list = [];
|
|
|
|
|
+ for (let i = 0; i < size; i++) {
|
|
|
|
|
+ list.push({width: i % 2 ==0 ? '100%' : '70%', height: 18, marginTop: 4, marginBottom: 4, borderRadius: 3});
|
|
|
|
|
+ }
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ getSkeletonRight(size=3) {
|
|
|
|
|
+ const list = [];
|
|
|
|
|
+ for (let i = 0; i < size; i++) {
|
|
|
|
|
+ list.push({width: '100%', height: 18, marginTop: 4, marginBottom: 4, borderRadius: 3});
|
|
|
|
|
+ }
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ getSectionSkeleton(size) {
|
|
|
|
|
+ if (this.state.loading) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <View style={[styles.sections, ui.flexc]}>
|
|
|
|
|
+ <Skeleton
|
|
|
|
|
+ containerStyle={ui.flex2}
|
|
|
|
|
+ isLoading={this.state.loading}
|
|
|
|
|
+ boneColor='#eeeeee'
|
|
|
|
|
+ highlightColor='#f6f6f6'
|
|
|
|
|
+ animationType="shiver"
|
|
|
|
|
+ layout={this.getSkeletonLeft(size)}
|
|
|
|
|
+ animationDirection={'horizontalRight'}>
|
|
|
|
|
+
|
|
|
|
|
+ </Skeleton>
|
|
|
|
|
+ <View style={ui.flex2}></View>
|
|
|
|
|
+ <Skeleton
|
|
|
|
|
+ containerStyle={ui.flex1}
|
|
|
|
|
+ isLoading={this.state.loading}
|
|
|
|
|
+ boneColor='#eeeeee'
|
|
|
|
|
+ highlightColor='#f6f6f6'
|
|
|
|
|
+ animationType="shiver"
|
|
|
|
|
+ layout={this.getSkeletonRight(size)}
|
|
|
|
|
+ animationDirection={'horizontalRight'}>
|
|
|
|
|
+
|
|
|
|
|
+ </Skeleton>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ )
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return <></>
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
render() {
|
|
render() {
|
|
|
if (this.state.isPendding) {
|
|
if (this.state.isPendding) {
|
|
|
return (
|
|
return (
|
|
@@ -164,15 +221,39 @@ export default class SummaryV3 extends Component {
|
|
|
onRefresh={() => this.onRefresh()}
|
|
onRefresh={() => this.onRefresh()}
|
|
|
/>
|
|
/>
|
|
|
}>
|
|
}>
|
|
|
- { utils.isNotEmpty(this.state.summaryInfo.top) &&
|
|
|
|
|
|
|
+ { this.isLoading(this.state.summaryInfo.top) &&
|
|
|
<View style={styles.headerView}>
|
|
<View style={styles.headerView}>
|
|
|
{ this.state.isActully && <>
|
|
{ this.state.isActully && <>
|
|
|
- <Octicons
|
|
|
|
|
- name="check-circle-fill"
|
|
|
|
|
- color={colorAccent}
|
|
|
|
|
- size={56}/>
|
|
|
|
|
- <TextView style={styles.topTitle}>{$t('receipt.successful')}</TextView>
|
|
|
|
|
- <TextView style={styles.topDesc}>{$t('receipt.chargingSessionComplete')}</TextView>
|
|
|
|
|
|
|
+ <Skeleton
|
|
|
|
|
+ isLoading={this.state.loading}
|
|
|
|
|
+ boneColor='#eeeeee'
|
|
|
|
|
+ highlightColor='#f6f6f6'
|
|
|
|
|
+ animationType="shiver"
|
|
|
|
|
+ layout={[{width: 56, height: 56, borderRadius: 56}]}
|
|
|
|
|
+ animationDirection={'horizontalRight'}>
|
|
|
|
|
+ <Octicons
|
|
|
|
|
+ name="check-circle-fill"
|
|
|
|
|
+ color={colorAccent}
|
|
|
|
|
+ size={56}/>
|
|
|
|
|
+ </Skeleton>
|
|
|
|
|
+ <Skeleton
|
|
|
|
|
+ isLoading={this.state.loading}
|
|
|
|
|
+ boneColor='#eeeeee'
|
|
|
|
|
+ highlightColor='#f6f6f6'
|
|
|
|
|
+ animationType="shiver"
|
|
|
|
|
+ layout={[{width: 60, height: 20, marginTop: 8, borderRadius: 3}]}
|
|
|
|
|
+ animationDirection={'horizontalRight'}>
|
|
|
|
|
+ <TextView style={styles.topTitle}>{$t('receipt.successful')}</TextView>
|
|
|
|
|
+ </Skeleton>
|
|
|
|
|
+ <Skeleton
|
|
|
|
|
+ isLoading={this.state.loading}
|
|
|
|
|
+ boneColor='#eeeeee'
|
|
|
|
|
+ highlightColor='#f6f6f6'
|
|
|
|
|
+ animationType="shiver"
|
|
|
|
|
+ layout={[{width: 100, height: 18, marginTop: 4, marginBottom: 32, borderRadius: 3}]}
|
|
|
|
|
+ animationDirection={'horizontalRight'}>
|
|
|
|
|
+ <TextView style={styles.topDesc}>{$t('receipt.chargingSessionComplete')}</TextView>
|
|
|
|
|
+ </Skeleton>
|
|
|
</>}
|
|
</>}
|
|
|
{ utils.isNotEmpty(this.state.summaryInfo.top.company) &&
|
|
{ utils.isNotEmpty(this.state.summaryInfo.top.company) &&
|
|
|
<View style={styles.formRow}>
|
|
<View style={styles.formRow}>
|
|
@@ -187,19 +268,49 @@ export default class SummaryV3 extends Component {
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
<View style={styles.formRow}>
|
|
<View style={styles.formRow}>
|
|
|
- <TextView style={styles.label}>{$t('receipt.labelTransactionID')}</TextView>
|
|
|
|
|
- <TextView style={styles.text}>{this.state.summaryInfo.top.transactionId}</TextView>
|
|
|
|
|
- </View>
|
|
|
|
|
- <View style={styles.formRow}>
|
|
|
|
|
- <TextView style={styles.label}>{$t('receipt.labelReferenceID')}</TextView>
|
|
|
|
|
- <TextView style={styles.text}>{this.state.summaryInfo.top.referenceId}</TextView>
|
|
|
|
|
- </View>
|
|
|
|
|
- <View style={styles.formRow}>
|
|
|
|
|
- <TextView style={styles.label}>{$t('receipt.labelDateTime')}</TextView>
|
|
|
|
|
- <TextView style={styles.text}>{this.state.summaryInfo.top.dateTime}</TextView>
|
|
|
|
|
|
|
+ <Skeleton
|
|
|
|
|
+ containerStyle={ui.flex1}
|
|
|
|
|
+ isLoading={this.state.loading}
|
|
|
|
|
+ boneColor='#eeeeee'
|
|
|
|
|
+ highlightColor='#f6f6f6'
|
|
|
|
|
+ animationType="shiver"
|
|
|
|
|
+ layout={this.getSkeletonLeft()}
|
|
|
|
|
+ animationDirection={'horizontalRight'}>
|
|
|
|
|
+
|
|
|
|
|
+ </Skeleton>
|
|
|
|
|
+ <View style={ui.flex2}></View>
|
|
|
|
|
+ <Skeleton
|
|
|
|
|
+ containerStyle={ui.flex1}
|
|
|
|
|
+ isLoading={this.state.loading}
|
|
|
|
|
+ boneColor='#eeeeee'
|
|
|
|
|
+ highlightColor='#f6f6f6'
|
|
|
|
|
+ animationType="shiver"
|
|
|
|
|
+ layout={this.getSkeletonRight()}
|
|
|
|
|
+ animationDirection={'horizontalRight'}>
|
|
|
|
|
+
|
|
|
|
|
+ </Skeleton>
|
|
|
</View>
|
|
</View>
|
|
|
|
|
+ { utils.isNotEmpty(this.state.summaryInfo.top.transactionId) &&
|
|
|
|
|
+ <View style={styles.formRow}>
|
|
|
|
|
+ <TextView style={styles.label}>{$t('receipt.labelTransactionID')}</TextView>
|
|
|
|
|
+ <TextView style={styles.text}>{this.state.summaryInfo.top.transactionId}</TextView>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ }
|
|
|
|
|
+ { utils.isNotEmpty(this.state.summaryInfo.top.referenceId) &&
|
|
|
|
|
+ <View style={styles.formRow}>
|
|
|
|
|
+ <TextView style={styles.label}>{$t('receipt.labelReferenceID')}</TextView>
|
|
|
|
|
+ <TextView style={styles.text}>{this.state.summaryInfo.top.referenceId}</TextView>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ }
|
|
|
|
|
+ { utils.isNotEmpty(this.state.summaryInfo.top.dateTime) &&
|
|
|
|
|
+ <View style={styles.formRow}>
|
|
|
|
|
+ <TextView style={styles.label}>{$t('receipt.labelDateTime')}</TextView>
|
|
|
|
|
+ <TextView style={styles.text}>{this.state.summaryInfo.top.dateTime}</TextView>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ }
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
+ {this.getSectionSkeleton(2)}
|
|
|
{ utils.isNotEmpty(this.state.summaryInfo.station) &&
|
|
{ utils.isNotEmpty(this.state.summaryInfo.station) &&
|
|
|
<View style={styles.sections}>
|
|
<View style={styles.sections}>
|
|
|
<TextView style={styles.formTitle}>{$t('wallet.labelYourStation')}</TextView>
|
|
<TextView style={styles.formTitle}>{$t('wallet.labelYourStation')}</TextView>
|
|
@@ -213,6 +324,7 @@ export default class SummaryV3 extends Component {
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
+ {this.getSectionSkeleton()}
|
|
|
{ utils.isNotEmpty(this.state.summaryInfo.connector) &&
|
|
{ utils.isNotEmpty(this.state.summaryInfo.connector) &&
|
|
|
<View style={styles.sections}>
|
|
<View style={styles.sections}>
|
|
|
<TextView style={styles.formTitle}>{$t('wallet.labelYourConnector')}</TextView>
|
|
<TextView style={styles.formTitle}>{$t('wallet.labelYourConnector')}</TextView>
|
|
@@ -230,6 +342,7 @@ export default class SummaryV3 extends Component {
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
+ {this.getSectionSkeleton(1)}
|
|
|
{ utils.isNotEmpty(this.state.summaryInfo.payment?.pointsReward) &&
|
|
{ utils.isNotEmpty(this.state.summaryInfo.payment?.pointsReward) &&
|
|
|
<View style={styles.sections}>
|
|
<View style={styles.sections}>
|
|
|
<TextView style={styles.formTitle}>{$t('receipt.labelPointsRewards')}</TextView>
|
|
<TextView style={styles.formTitle}>{$t('receipt.labelPointsRewards')}</TextView>
|
|
@@ -239,6 +352,7 @@ export default class SummaryV3 extends Component {
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
+ {this.getSectionSkeleton(1)}
|
|
|
{ utils.isNotEmpty(this.state.summaryInfo.vouchers) &&
|
|
{ utils.isNotEmpty(this.state.summaryInfo.vouchers) &&
|
|
|
<View style={styles.sections}>
|
|
<View style={styles.sections}>
|
|
|
<TextView style={styles.formTitle}>{$t('receipt.labelVoucherUsage')}</TextView>
|
|
<TextView style={styles.formTitle}>{$t('receipt.labelVoucherUsage')}</TextView>
|
|
@@ -253,6 +367,7 @@ export default class SummaryV3 extends Component {
|
|
|
)}
|
|
)}
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
+ {this.getSectionSkeleton()}
|
|
|
{ utils.isNotEmpty(this.state.summaryInfo.chargingFee) &&
|
|
{ utils.isNotEmpty(this.state.summaryInfo.chargingFee) &&
|
|
|
<View style={styles.sections}>
|
|
<View style={styles.sections}>
|
|
|
<TextView style={styles.formTitle}>{$t('receipt.breakdownChargingFees')}</TextView>
|
|
<TextView style={styles.formTitle}>{$t('receipt.breakdownChargingFees')}</TextView>
|
|
@@ -270,6 +385,7 @@ export default class SummaryV3 extends Component {
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
+ {this.getSectionSkeleton()}
|
|
|
{ utils.isNotEmpty(this.state.summaryInfo.idleFee) &&
|
|
{ utils.isNotEmpty(this.state.summaryInfo.idleFee) &&
|
|
|
<View style={styles.sections}>
|
|
<View style={styles.sections}>
|
|
|
<TextView style={styles.formTitle}>{$t('receipt.breakdownIdlesFees')}</TextView>
|
|
<TextView style={styles.formTitle}>{$t('receipt.breakdownIdlesFees')}</TextView>
|
|
@@ -287,6 +403,7 @@ export default class SummaryV3 extends Component {
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
+ {this.getSectionSkeleton()}
|
|
|
{ utils.isNotEmpty(this.state.summaryInfo.reservationFee) &&
|
|
{ utils.isNotEmpty(this.state.summaryInfo.reservationFee) &&
|
|
|
<View style={styles.sections}>
|
|
<View style={styles.sections}>
|
|
|
<TextView style={styles.formTitle}>{$t('receipt.breakdownReservationFees')}</TextView>
|
|
<TextView style={styles.formTitle}>{$t('receipt.breakdownReservationFees')}</TextView>
|
|
@@ -304,6 +421,7 @@ export default class SummaryV3 extends Component {
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
+ {this.getSectionSkeleton(8)}
|
|
|
{ utils.isNotEmpty(this.state.summaryInfo.payment) &&
|
|
{ utils.isNotEmpty(this.state.summaryInfo.payment) &&
|
|
|
<View style={styles.sections}>
|
|
<View style={styles.sections}>
|
|
|
<TextView style={styles.formTitle}>{$t('receipt.breakdownPayment')}</TextView>
|
|
<TextView style={styles.formTitle}>{$t('receipt.breakdownPayment')}</TextView>
|
|
@@ -394,7 +512,7 @@ const styles = StyleSheet.create({
|
|
|
topTitle: {
|
|
topTitle: {
|
|
|
color: textPrimary,
|
|
color: textPrimary,
|
|
|
fontSize: 16,
|
|
fontSize: 16,
|
|
|
- marginTop: 8,
|
|
|
|
|
|
|
+ paddingTop: 8,
|
|
|
paddingLeft: 8,
|
|
paddingLeft: 8,
|
|
|
fontWeight: 'bold'
|
|
fontWeight: 'bold'
|
|
|
},
|
|
},
|