/*
*
*/
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View,
Image,
TouchableOpacity,
FlatList,
TouchableHighlight,
DeviceEventEmitter,
StatusBar,
ScrollView,
ImageBackground
} from 'react-native';
import BasePage from '../BasePage';
import Dimensions from '../utils/dimensions';
import CourseTitle from '../components/CourseTitle';
export default class Ticket extends BasePage {
state = {
data: [
{
type: 1,
price: 12,
num: 6,
time: '2019-12-12'
},
{
type: 1,
price: 33,
num: 9,
time: '2019-12-12'
},
{
type: 1,
price: 50,
limit: '199',
time: '2019-12-12'
}
]
};
renderItem = (item, index) => {
return (
{item.type === 1 ? (
// 抵用券
this.userdiscount(item)}
activeOpacity={1}
style={{ width: '100%', justifyContent: 'center', alignItems: 'center' }}
>
¥{item.price}
抵用券
购买{item.num}个单课程的奖励
有效期:{item.time}
立即使用
注:开通会员时方可使用
查看订单
) : (
// 优惠券
¥{item.price}
优惠券
满{item.limit}可用
有效期:{item.time}
)}
);
};
render() {
return (
this.goBack()}
// backPress={() => alert("左侧按钮")}
/>
this.renderItem(item, index)}
keyExtractor={(item, index) => index.toString()}
/>
);
}
userdiscount = (item) => {
if (this.props.navigation.state.params != undefined) {
this.props.navigation.state.params.choseTicketCallBack(item);
this.props.navigation.goBack();
}
};
}
const styles = StyleSheet.create({
type1: {
width: '100%',
height: 154,
flexDirection: 'column',
justifyContent: 'center',
// paddingHorizontal: 70,
alignItems: 'center'
},
type2: {
width: '100%',
height: 100,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center'
},
left2: {
flex: 1,
flexDirection: 'column'
},
price: {
color: '#ff6d2f',
fontSize: 19,
fontWeight: '500'
},
type: {
color: '#ff6d2f',
fontSize: 18,
fontWeight: '500'
},
right2: {
flex: 2.8,
flexDirection: 'column',
marginTop: 10
},
topInfo: {
flex: 1,
flexDirection: 'row',
alignItems: 'center'
},
bottomInfo: {
width: '100%',
flex: 1,
paddingHorizontal: 12,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between'
},
greyText: {
fontSize: 14,
color: '#888'
},
blueText: {
color: '#4a90e2',
fontSize: 14
}
});