RepayDetail.js 5.59 KB
'use strict';
import React from 'react';
import ReactNative, {
    View,
    Text,
    Image,
    StyleSheet,
    Dimensions,
    PixelRatio,
    TouchableOpacity,
    ListView,
} from 'react-native';

import Immutable, {Map} from 'immutable';
import Prompt from '../../../coupon/components/coupon/Prompt';
import LoadingIndicator from '../../../common/components/LoadingIndicator';

export default class RepayList extends React.Component {
    constructor(props) {
        super(props);
    }

    render() {
        let {repayList,tipMessage,isFetching} = this.props.dataSource;
        repayList = repayList.toJS();
        let curRepayInfo = repayList[0];
        if (!curRepayInfo) {
            return null;
        }
        let styleStatusEnable ={backgroundColor:'#444444'};
        let styleStatusDisable ={backgroundColor:'#444444'};
        let isTwo = curRepayInfo.isTwo ? styleStatusEnable : styleStatusDisable;
        let isThree = curRepayInfo.isThree ? styleStatusEnable : styleStatusDisable;

        return(
            <View style={styles.container}>
                <View style={styles.repayAmtContianer}>
                    <Text style={[styles.repayAmtText,{marginLeft:100*DEVICE_WIDTH_RATIO}]}>本次还款</Text>
                    <Text style={[styles.repayAmtText,{color:'#d0021b',marginLeft:5*DEVICE_WIDTH_RATIO}]}>¥{curRepayInfo.amt?curRepayInfo.amt:'0.00'}</Text>
                </View>
                <View style={{
                    width: width,
                    height: 15 * DEVICE_WIDTH_RATIO,
                    backgroundColor: '#e5e5e5',
                }}/>

                <View style={styles.repayStatusContianer}>
                    <View style={styles.repayStatusTextContianer}>
                        <Text style={[styles.repayStatusText,{left:-15*DEVICE_WIDTH_RATIO}]}>付款</Text>
                        <Text style={[styles.repayStatusText,{left:70*DEVICE_WIDTH_RATIO}]}>银行处理</Text>
                        <Text style={[styles.repayStatusText,{right:-30*DEVICE_WIDTH_RATIO}]}>还款结果</Text>
                    </View>
                    <View style={styles.repayStatusLineContianer}>
                        <View style={[{
                            width: 100*DEVICE_WIDTH_RATIO,
                            height: 1 * DEVICE_WIDTH_RATIO,
                            backgroundColor: 'red',
                        },isTwo]}/>
                        <View style={[{
                            width: 100*DEVICE_WIDTH_RATIO,
                            height: 1 * DEVICE_WIDTH_RATIO,
                            backgroundColor: 'blue',
                        },isThree]}/>
                        <View style={[styles.circle,{left:-5*DEVICE_WIDTH_RATIO}]}/>
                        <View style={[styles.circle,{left:95*DEVICE_WIDTH_RATIO},isTwo]}/>
                        <View style={[styles.circle,{right:-5*DEVICE_WIDTH_RATIO},isThree]}/>
                    </View>

                    <Text style={styles.repayResult}>{curRepayInfo.txt?curRepayInfo.txt:''}</Text>

                </View>


                <View style={styles.questionContianer}>
                    <Text style={styles.question}>如有问题请联系客服</Text>
                </View>

                {tipMessage !== '' ? <Prompt
                    text={tipMessage}
                    duration={800}
                    onPromptHidden={this.props.clearTipMessage}
                /> : null}
                <LoadingIndicator
                    isVisible={isFetching}
                />
            </View>
        );
    }
};

let {width, height} = Dimensions.get('window');
const DEVICE_WIDTH_RATIO = width / 320;

let styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#e5e5e5',
        alignItems: 'center',
        width: width,
        height: 61 * DEVICE_WIDTH_RATIO,
        position: 'relative',
    },
    repayAmtContianer: {
        width: width,
        height: 60 * DEVICE_WIDTH_RATIO,
        alignItems: 'center',
        backgroundColor: 'white',
        flexDirection: 'row',
    },
    repayAmtText: {
        lineHeight: Math.ceil(29 * DEVICE_WIDTH_RATIO),
        fontSize:15*DEVICE_WIDTH_RATIO,
    },
    repayStatusContianer: {
        width: width,
        height: 150 * DEVICE_WIDTH_RATIO,
        alignItems: 'center',
        backgroundColor: 'white',
        marginBottom: 15 * DEVICE_WIDTH_RATIO,
    },
    repayStatusTextContianer: {
        height: 50 * DEVICE_WIDTH_RATIO,
        flexDirection: 'row',
        width: 200 * DEVICE_WIDTH_RATIO,
        position: 'relative',
    },
    repayStatusLineContianer: {
        height: 1 * DEVICE_WIDTH_RATIO,
        width: 200 * DEVICE_WIDTH_RATIO,
        flexDirection: 'row',
        position: 'relative',
    },
    repayStatusText: {
        marginTop: 15 * DEVICE_WIDTH_RATIO,
        fontSize: 15 * DEVICE_WIDTH_RATIO,
        position: 'absolute',
    },
    circle: {
        width: 10 * DEVICE_WIDTH_RATIO,
        height: 10 * DEVICE_WIDTH_RATIO,
        borderRadius: 5 * DEVICE_WIDTH_RATIO,
        backgroundColor: '#444444',
        position: 'absolute',
        top: -5 * DEVICE_WIDTH_RATIO,
    },
    repayResult: {
        marginTop: 40 * DEVICE_WIDTH_RATIO,
        color: '#b0b0b0',
        fontSize: 12 * DEVICE_WIDTH_RATIO,
        lineHeight: Math.ceil(15 * DEVICE_WIDTH_RATIO),
    },
    questionContianer: {
        borderBottomWidth: 1*DEVICE_WIDTH_RATIO,
        borderBottomColor:'#444444',
        position:'absolute',
        bottom:25*DEVICE_WIDTH_RATIO,
        marginLeft: 100 * DEVICE_WIDTH_RATIO,
    },
    question: {
        fontSize: 14 * DEVICE_WIDTH_RATIO,
        color: '#444444',
    },
});