|
@@ -3,17 +3,18 @@
|
|
|
* @邠心vbe on 2024/04/17
|
|
* @邠心vbe on 2024/04/17
|
|
|
*/
|
|
*/
|
|
|
import React, { Component } from 'react';
|
|
import React, { Component } from 'react';
|
|
|
-import { View, StyleSheet, Text, TouchableOpacity } from 'react-native';
|
|
|
|
|
|
|
+import { View, StyleSheet, Text, TouchableOpacity, ScrollView } from 'react-native';
|
|
|
import TextView from '../../components/TextView';
|
|
import TextView from '../../components/TextView';
|
|
|
-import app from '../../../app.json';
|
|
|
|
|
import apiVoucher from '../../api/apiVoucher';
|
|
import apiVoucher from '../../api/apiVoucher';
|
|
|
import Dialog from '../../components/Dialog';
|
|
import Dialog from '../../components/Dialog';
|
|
|
import utils from '../../utils/utils';
|
|
import utils from '../../utils/utils';
|
|
|
|
|
+import VbeSkeleton from '../../components/VbeSkeleton';
|
|
|
|
|
|
|
|
export default class VoucherDetails extends Component {
|
|
export default class VoucherDetails extends Component {
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
|
super(props);
|
|
super(props);
|
|
|
this.state = {
|
|
this.state = {
|
|
|
|
|
+ loading: true,
|
|
|
voucherId: "",
|
|
voucherId: "",
|
|
|
voucherInfo: {}
|
|
voucherInfo: {}
|
|
|
};
|
|
};
|
|
@@ -31,7 +32,6 @@ export default class VoucherDetails extends Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
getVoucherDetail() {
|
|
getVoucherDetail() {
|
|
|
- Dialog.showProgressDialog();
|
|
|
|
|
apiVoucher.getVoucherInfo(this.state.voucherId).then(res => {
|
|
apiVoucher.getVoucherInfo(this.state.voucherId).then(res => {
|
|
|
if (res.data) {
|
|
if (res.data) {
|
|
|
this.setState({
|
|
this.setState({
|
|
@@ -41,7 +41,9 @@ export default class VoucherDetails extends Component {
|
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
|
toastShort(err)
|
|
toastShort(err)
|
|
|
}).finally(() => {
|
|
}).finally(() => {
|
|
|
- Dialog.dismissLoading();
|
|
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ loading: false
|
|
|
|
|
+ })
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -69,8 +71,41 @@ export default class VoucherDetails extends Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
|
|
+ if (this.state.loading) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <VbeSkeleton
|
|
|
|
|
+ style={styles.loadingView}
|
|
|
|
|
+ viewStyle={styles.container}
|
|
|
|
|
+ layout={[
|
|
|
|
|
+ {width: '100%', height: 20},
|
|
|
|
|
+ {width: '50%', height: 20, marginTop: 8},
|
|
|
|
|
+ {width: '30%', height: 18, marginTop: 32},
|
|
|
|
|
+ {width: '100%', height: 15, marginTop: 16},
|
|
|
|
|
+ {width: '100%', height: 15, marginTop: 8},
|
|
|
|
|
+ {width: '60%', height: 15, marginTop: 8},
|
|
|
|
|
+ {width: '30%', height: 18, marginTop: 24},
|
|
|
|
|
+ {width: '100%', height: 15, marginTop: 8},
|
|
|
|
|
+ {width: '100%', height: 15, marginTop: 8},
|
|
|
|
|
+ {width: '60%', height: 15, marginTop: 8},
|
|
|
|
|
+ {width: '30%', height: 18, marginTop: 24},
|
|
|
|
|
+ {width: '100%', height: 15, marginTop: 8},
|
|
|
|
|
+ {width: '100%', height: 15, marginTop: 8},
|
|
|
|
|
+ {width: '60%', height: 15, marginTop: 8},
|
|
|
|
|
+ {width: '30%', height: 18, marginTop: 24},
|
|
|
|
|
+ {width: '100%', height: 15, marginTop: 8},
|
|
|
|
|
+ {width: '100%', height: 15, marginTop: 8},
|
|
|
|
|
+ {width: '60%', height: 15, marginTop: 8},
|
|
|
|
|
+ {width: '30%', height: 18, marginTop: 24},
|
|
|
|
|
+ {width: '100%', height: 15, marginTop: 8},
|
|
|
|
|
+ {width: '100%', height: 15, marginTop: 8},
|
|
|
|
|
+ {width: '60%', height: 15, marginTop: 8}
|
|
|
|
|
+ ]}/>
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
return (
|
|
return (
|
|
|
- <View style={styles.container}>
|
|
|
|
|
|
|
+ <ScrollView
|
|
|
|
|
+ style={styles.container}
|
|
|
|
|
+ contentContainerStyle={$padding(16)}>
|
|
|
<TextView style={styles.voucherName}>{this.state.voucherInfo.voucherName}</TextView>
|
|
<TextView style={styles.voucherName}>{this.state.voucherInfo.voucherName}</TextView>
|
|
|
<EndView half/>
|
|
<EndView half/>
|
|
|
<TextView style={styles.labelText}>{$t("voucher.voucherType")}</TextView>
|
|
<TextView style={styles.labelText}>{$t("voucher.voucherType")}</TextView>
|
|
@@ -153,7 +188,7 @@ export default class VoucherDetails extends Component {
|
|
|
))
|
|
))
|
|
|
}
|
|
}
|
|
|
</View>
|
|
</View>
|
|
|
- </View>
|
|
|
|
|
|
|
+ </ScrollView>
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -161,7 +196,13 @@ export default class VoucherDetails extends Component {
|
|
|
const styles = StyleSheet.create({
|
|
const styles = StyleSheet.create({
|
|
|
container: {
|
|
container: {
|
|
|
flex: 1,
|
|
flex: 1,
|
|
|
- padding: 16
|
|
|
|
|
|
|
+ backgroundColor: pageBackground
|
|
|
|
|
+ },
|
|
|
|
|
+ loadingView: {
|
|
|
|
|
+ flex: 1,
|
|
|
|
|
+ padding: 16,
|
|
|
|
|
+ justifyContent: 'flex-start',
|
|
|
|
|
+ backgroundColor: pageBackground
|
|
|
},
|
|
},
|
|
|
voucherName: {
|
|
voucherName: {
|
|
|
color: textPrimary,
|
|
color: textPrimary,
|
|
@@ -181,9 +222,10 @@ const styles = StyleSheet.create({
|
|
|
valueText: {
|
|
valueText: {
|
|
|
color: textSecondary,
|
|
color: textSecondary,
|
|
|
fontSize: 14,
|
|
fontSize: 14,
|
|
|
- paddingTop: 4
|
|
|
|
|
|
|
+ paddingTop: 6
|
|
|
},
|
|
},
|
|
|
olView: {
|
|
olView: {
|
|
|
|
|
+ paddingTop: 6,
|
|
|
paddingLeft: 8
|
|
paddingLeft: 8
|
|
|
},
|
|
},
|
|
|
circleIcon: {
|
|
circleIcon: {
|