|
@@ -12,11 +12,14 @@ import {
|
|
|
FlatList,
|
|
|
TouchableHighlight,
|
|
|
DeviceEventEmitter,
|
|
|
- ScrollView
|
|
|
+ ScrollView,
|
|
|
+ Modal,
|
|
|
+ Animated
|
|
|
} from "react-native";
|
|
|
import BasePage from "../BasePage";
|
|
|
import Dimensions from '../utils/dimensions';
|
|
|
import TopicTitle from '../components/TopicTitle';
|
|
|
+import CourseTitle from "../components/CourseTitle";
|
|
|
|
|
|
export default class Buy extends BasePage {
|
|
|
state = {
|
|
@@ -24,7 +27,9 @@ export default class Buy extends BasePage {
|
|
|
{ title: '1个月', originPrice: '199', price: '49', },
|
|
|
{ title: '12个月', originPrice: '499', price: '199' }
|
|
|
],
|
|
|
- currentTapindex: 0
|
|
|
+ currentTapindex: 0,
|
|
|
+ slideAnim: new Animated.Value(-150),
|
|
|
+ ifDialogShow: false
|
|
|
};
|
|
|
itemTap = (index) => {
|
|
|
this.setState({
|
|
@@ -40,16 +45,44 @@ export default class Buy extends BasePage {
|
|
|
</TouchableOpacity>
|
|
|
)
|
|
|
}
|
|
|
+ changeMethod = () => {
|
|
|
+ this.setState({
|
|
|
+ ifDialogShow: !this.state.ifDialogShow
|
|
|
+ }, () => {
|
|
|
+ Animated.timing(
|
|
|
+ this.state.slideAnim,
|
|
|
+ {
|
|
|
+ toValue: 0,
|
|
|
+ duration: 300,
|
|
|
+ }
|
|
|
+ ).start();
|
|
|
+ })
|
|
|
+ }
|
|
|
render() {
|
|
|
return (
|
|
|
<View style={{ flex: 1 }}>
|
|
|
+ <View
|
|
|
+ style={{
|
|
|
+ height: 30,
|
|
|
+ marginTop: 30
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <CourseTitle
|
|
|
+ width={this.getWindowWidth()}
|
|
|
+ title="VIP购买"
|
|
|
+ lefttype={1}
|
|
|
+ textcolor={"#231F20"}
|
|
|
+ backPress={() => this.goBack()}
|
|
|
+ // backPress={() => alert("左侧按钮")}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
<View style={styles.top}>
|
|
|
<Text style={styles.title}>套餐选择</Text>
|
|
|
<View>
|
|
|
{this.state.shopData.map((item, index) => this.renderItem(item, index))}
|
|
|
</View>
|
|
|
</View>
|
|
|
- <TouchableOpacity style={styles.payment} onPress={() => alert(123)}>
|
|
|
+ <TouchableOpacity style={styles.payment} onPress={() => this.changeMethod()}>
|
|
|
<Text style={styles.left}>支付方式</Text>
|
|
|
<View style={styles.right}>
|
|
|
<Text style={styles.method}>微信支付</Text>
|
|
@@ -62,7 +95,32 @@ export default class Buy extends BasePage {
|
|
|
<Text style={styles.bottomRightText}>支付</Text>
|
|
|
</TouchableOpacity>
|
|
|
</View>
|
|
|
+ {
|
|
|
+ this.state.ifDialogShow
|
|
|
+ ?
|
|
|
+ <View style={{ ...styles.dialog }}>
|
|
|
+ <Animated.View style={{ ...styles.payMethod, bottom: this.state.slideAnim }}>
|
|
|
+ <Text>选择支付方式</Text>
|
|
|
+ {/* <View> */}
|
|
|
+
|
|
|
+ {/* </View> */}
|
|
|
+ </Animated.View>
|
|
|
+ </View>
|
|
|
+ :
|
|
|
+ null
|
|
|
+ }
|
|
|
+
|
|
|
+ {/* <Modal
|
|
|
+ animationType="none "
|
|
|
+ transparent={true}
|
|
|
+ visible={true}
|
|
|
+ onRequestClose={() => {
|
|
|
+ alert("Modal has been closed.");
|
|
|
+ }}
|
|
|
+
|
|
|
+ ></Modal> */}
|
|
|
</View>
|
|
|
+
|
|
|
)
|
|
|
}
|
|
|
}
|
|
@@ -179,5 +237,20 @@ const styles = StyleSheet.create({
|
|
|
color: '#fff',
|
|
|
textAlign: 'center',
|
|
|
lineHeight: 60,
|
|
|
+ },
|
|
|
+ dialog: {
|
|
|
+ width: Dimensions.width,
|
|
|
+ height: Dimensions.height,
|
|
|
+ position: 'absolute',
|
|
|
+ backgroundColor: '#000',
|
|
|
+ opacity: 0.4
|
|
|
+
|
|
|
+ },
|
|
|
+ payMethod: {
|
|
|
+ width: Dimensions.width,
|
|
|
+ height: 150,
|
|
|
+ position: 'absolute',
|
|
|
+ // bottom: 0,
|
|
|
+ backgroundColor: '#fff'
|
|
|
}
|
|
|
})
|