Statistics.js 4.57 KB
'use strict';

import React, {Component} from 'react';
import {DeviceEventEmitter, Dimensions, Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native';

export default class Statistics extends Component {
    constructor(props) {
        super(props);
    }

    componentDidMount() {
        this.subscription = DeviceEventEmitter.addListener('BankCardBindSuccessEvent', () => {
            this.props.refreshSettlementInfo && this.props.refreshSettlementInfo();
        });
    }

    componentWillUnmount() {
        this.subscription.remove();
    }

    render() {
        let {statisticsInfo} = this.props;
        let currentTab = this.props.currentTab;
        return (
            
            <View style={styles.container}>
                <View style={styles.statisticsView}>

                    <TouchableOpacity activeOpacity={1} style={styles.container} onPress={() => {
                        let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"title":"预估佣金","type":"estimateDetails","time_type":${currentTab}, "tab_type":"1"}}`;
                        this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url);
                    }} >

                        <View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}>
                            <Text style={styles.numberText}>¥{statisticsInfo.orderAmountSum}</Text>
                            <Text style={styles.tipsText}>预估订单佣金</Text>
                        </View>

                    </TouchableOpacity>
                    
                    <View style={styles.spaceView}/>

                    <TouchableOpacity activeOpacity={1} style={styles.container} onPress={() => {
                        let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"title":"预估佣金","type":"estimateDetails","time_type":${currentTab}, "tab_type":"2"}}`;
                        this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url);
                    }} >

                        <View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}>
                            <Text style={styles.numberText}>¥{statisticsInfo.extraAmountSum}</Text>
                            <Text style={styles.tipsText}>预估其他佣金</Text>
                        </View>

                    </TouchableOpacity>

                </View>
                <View style={styles.lineView}/>

                <TouchableOpacity activeOpacity={1} style={styles.container} onPress={() => {
                    let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"title":"全部佣金","type":"orderIncome"}}`;
                    this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url);
                }} >

                    <View style={styles.statisticsView}>
                        <View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}>
                            <Text style={styles.numberText}>{statisticsInfo.orderNum}</Text>
                            <Text style={styles.tipsText}>订单数</Text>
                        </View>
                        <View style={styles.spaceView}/>
                        <View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}>
                            <Text style={styles.numberText}>{statisticsInfo.clickNum}</Text>
                            <Text style={styles.tipsText}>点击数</Text>
                        </View>
                    </View>

                </TouchableOpacity>


                <View style={styles.lineView}/>
            </View>
        );
    }

}

let {width, height} = Dimensions.get('window');

let styles = StyleSheet.create({
        container: {
            flex: 1,
        },
        statisticsView: {
            width: width,
            height: 90,
            backgroundColor: 'white',
            flexDirection: 'row',
            alignItems: 'center',
        },
        numberText: {
            fontFamily: 'PingFang-SC-Regular',
            fontSize: 25,
            color: '#444444',
        },
        tipsText: {
            fontFamily: 'PingFang-SC-Regular',
            marginTop: 5,
            fontSize: 12,
            color: '#B0B0B0',
        },
        arrowImage: {
            width: 16,
            height: 16,
            marginLeft: 2,
        },
        spaceView: {
            width: 0.5,
            height: 90,
            backgroundColor: '#e0e0e0'
        },
        lineView: {
            width: width,
            height: 0.5,
            backgroundColor: '#e0e0e0'
        }
    })
;