/* * */ import React, { Component } from "react"; import { Platform, StyleSheet, Text, View, Image, TouchableOpacity, FlatList, TouchableHighlight, DeviceEventEmitter, ScrollView, ImageBackground } from "react-native"; import BasePage from "../BasePage"; import Dimensions from '../utils/dimensions'; export default class Ticket extends BasePage { state = { data: [ { type: 1, price: 12, num: 6, time: '2019-12-12' }, { type: 2, price: 50, limit: '199', time: '2019-12-12' } ] }; renderItem = (item, index) => { return ( { item.type === 1 ? // 抵用券 ¥{item.price} 抵用券 购买{item.num}个单课程的奖励 有效期:{item.time} 注:开通会员时方可使用 查看订单 : // 优惠券 ¥{item.price} 优惠券 满{item.limit}可用 有效期:{item.time} } ) } render() { return ( this.renderItem(item, index)} keyExtractor={(item, index) => index.toString()} /> ) } } const styles = StyleSheet.create({ type1: { width: 343, height: 144, flexDirection: 'column', justifyContent: 'space-between', alignItems: 'center', paddingTop: 12, paddingBottom: 14 }, type2: { width: 343, height: 100, flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', paddingLeft: 27 }, left2: { flexDirection: 'column', }, price: { color: '#ff6d2f', fontSize: 19, fontWeight: '500' }, type: { color: '#ff6d2f', fontSize: 18, fontWeight: '500' }, right2: { flexDirection: 'column' }, topInfo: { flexDirection: 'row', alignItems: 'center' }, bottomInfo: { width: '100%', paddingHorizontal: 12, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }, greyText: { fontSize: 14, color: '#888' }, blueText: { color: '#4a90e2', fontSize: 14 } })