/**
 * [OElove] (C)2010-2099 oelove.com
 * Email: service@phpcoo.com ,phpcoo@qq.com
 * This is NOT a freeware, use is subject to license terms
 * $ Last update 2020/04/13 by CL $
*/
var _inst_oeyunresult = null; 
$(function () {
    
    //实名认证结果
    function OEYunResult() {
        this.check_box = 'rztips_box';
        this.rzno = ''; //认证单
        
        this.initCheck();
    }
    
    OEYunResult.prototype = {
        
        //检测进度
        initCheck:function() {
            var _this = this;
            _this.rzno = $("#rzno").val(); //单号
            
            var $obj_img = $("#"+_this.check_box+" img");
            var i = 0;
            var $timer = setInterval(function () {
                $("#"+_this.check_box+" img").eq(i).fadeOut();
                i++;
                if (i >= $obj_img.length) {
                    i = 0;
                }
                $("#"+_this.check_box+" img").eq(i).fadeIn();
            }, 1000);
            
            
            setTimeout(function(){
                _this.doRz();
            }, 500);
        },
        
        
        //请求结果
        doRz:function() {
            var _this = this;
            
            $.ajax({
                type: "POST",
                url: WAP_APPFILE,
                cache: false,
                data: {
                    c:'yunresult', a:'dorz', datatype:'ajax',
                    rzno:_this.rzno
                },
                dataType: "json",
                success: function($data) {
                    var $json = eval($data);
                    var $response = $json.response;
                    var $result = $json.result;
                    
                    if ($response == "1") { 
                        //实名匹配
                        $("#step_0").hide();
                        $("#step_1").show();
                    }
                    else if ($response == "2") {
                        //实名不匹配
                        $("#step_0").hide();
                        if ($result != "") {
                            $("#step_2_result").html($result);
                        }
                        $("#step_2").show();
                    }
                    else if ($response == "3") {
                        //实名失败
                        $("#step_0").hide();
                        if ($result != "") {
                            $("#step_3_result").html($result);
                        }
                        $("#step_3").show();
                    }
                    else {
                        if ($result.length == 0 || $result == '') {
                            $result = "实名失败，请检查！";
                        }
                        $("#step_0").hide();
                        if ($result != "") {
                            $("#step_3_result").html($result);
                        }
                        $("#step_3").show();
                    }
                },
                error: function() {
                    OEUI.toast({
                        type: 'bottom',
                        text: '网络繁忙，请稍后再试！'
                    });
                }
            });
 
        }
    }
    _inst_oeyunresult = new OEYunResult();
});