ApplyResult.js 5.03 KB
//
//  ClassName.js
//
//  Created by Cheney Mars on 2018/9/26.
//  Copyright © 2018年 saygoodlolita. All rights reserved.
//

import React, {Component} from "react";
import {Image, Text, DeviceEventEmitter,TouchableOpacity, View} from "react-native";
import {zoomW,width,height} from "../../utils/getSize";
// import ForumHeader from "../../widget/ForumHeader";

const  auditFail = require('../../img/auditfd.png');
const  audit = require('../../img/audit.png');


const defaultIcon = require("../../img/defaultIcon.png");

export default class ApplyResult extends Component {
    static navigationOptions = ({ navigation, screenProps }) => ({
        headerTitle:
            !!navigation.state.params && !!navigation.state.params.name ?navigation.state.params.name:"关联商家",
        headerLeft: (
            <View style={{ flexDirection: "row", flex: 1 }}>
                <TouchableOpacity
                    style={{
                        flexDirection: "column",
                        justifyContent: "center",
                        paddingRight: 15,
                        paddingLeft: 10
                    }}
                    onPress={
                        navigation.state.params ? navigation.state.params.back : null
                    }
                >
                    <Image
                        source={require("../../img/loadBack.png")}
                        resizeMode="contain"
                    />
                </TouchableOpacity>
            </View>
        ),
        headerRight: (
            <View style={{ flexDirection: "row", flex: 1, justifyContent: "center" }}>
                <TouchableOpacity
                    style={{
                        flexDirection: "column",
                        justifyContent: "center",
                        paddingRight: 15,
                        paddingLeft: 10
                    }}
                >
                    <Image
                        style={{ width: 20 / zoomW, height: 20 / zoomW }}
                        resizeMode="contain"
                    />
                </TouchableOpacity>
            </View>
        )
    });

    constructor(props) {
        super(props);
        let isApproving = !!this.props.navigation.state.params &&this.props.navigation.state.params.isApproving?this.props.navigation.state.params.isApproving :false;
        this.state = {
            isApproving :isApproving ,//是否审核中
        }
    }
    componentWillUnmount() {
        DeviceEventEmitter.emit('refreshSpamasterInfo');
    }

    componentDidMount() {
        //设置头部
        this.props.navigation.setParams({
            back: () => {
                this.props.navigation.goBack();
            }
        });
        let _this = this;
        this.refreshApproving = DeviceEventEmitter.addListener(
            "refreshApproving",
            function(name) {
                _this.props.navigation.setParams({
                    name: name
                });
                _this.setState({
                   isApproving :true
               })
            }
        );

    }
    render() {
        let _this = this;
        return (
            <View style={{flex: 1,backgroundColor:'white'}}>
                {/*<ForumHeader title={ !!this.props.navigation.state.params && !!this.props.navigation.state.params.name ?this.props.navigation.state.params.name:"关联商家"} pop navigation={this.props.navigation}/>*/}
                {!this.state.isApproving && <View style = {{flex: 1,justifyContent:'center',alignItems:'center'}}>
                    <Image style={{width:width/4,height:width/4}}  resizeMode={'contain'} source={auditFail} />
                    <Text style={{marginTop:36,color:'#666666', fontSize:18,fontWeight: 'bold'}}> 信息审核未通过 </Text>
                    <Text style={{marginTop:9,color:'#999999',marginLeft:15,marginRight:15, fontSize:14,fontWeight: 'bold'}}> {"原因:"+_this.props.navigation.state.params.refusedReason} </Text>
                    <TouchableOpacity   onPress={() => {
                        _this.props.navigation.navigate("RelateMerchants", { from:'disagreed'
                        });
                    }}>
                        <View style={{width:296, height:44,backgroundColor:'#333333',marginTop:44,borderRadius:4,justifyContent:'center',alignItems:'center'}}>
                            <Text    style={{color:'white',fontWeight:'bold',fontSize:18}}> 重新申请 </Text>
                        </View>
                    </TouchableOpacity>
                </View>
                }
                {this.state.isApproving && <View  style = {{flex: 1,marginTop:height*0.2,alignItems:'center'}}>
                    <Image style={{width:width/4,height:width/4}}  resizeMode={'contain'} source={audit} />
                    <Text style={{marginTop:30,color:'#666666', fontSize:18}}> 审核中! </Text>
                    <Text style={{marginTop:6,color:'#999999', fontSize:14}}> 预计1-3个工作日内完成审核,请耐心等待... </Text>
                </View>
                }
            </View>
        );

    }
}