/**
 * Created by Administrator on 2021/4/5.
 */
define(['jquery', "template", "Tools", "biddingApi", "itemsApi"], function ($, template, Tools ) {
    //数据存储
    var module = {
        data: {
            timeArray: {
                d: '',
                h: '',
                m: '',
                s: '',
            },
            timer:null,
            setimer:null,
            outProjectInformationDetail:{}
        },
    };
    var tools = new Tools();

    module.init = function (page) {

        tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation,true);

        tools.doGet(webConfig, {}, module.webConfigInformation, true)

        var nowTime = new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date"));

        $("#nowDateNYR").html(nowTime.getFullYear()+'.'+(nowTime.getMonth()+1)+'.'+nowTime.getDate())

        setInterval(function () {
            var nowTime = new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date"));
            $("#nowDateSFM").html(nowTime.toLocaleTimeString());
            $("#nowTime").html('服务器时间：'+nowTime.getFullYear()+'.'+(nowTime.getMonth()+1)+'.'+nowTime.getDate()+' '+nowTime.toLocaleTimeString());
        },1000)
        tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation,true);

        setInterval(function (){
            tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true);
            tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation2,true);
        },5000)
    };

    //获取地址栏参数
    function getQueryVariable(variable){
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++) {
            var pair = vars[i].split("=");
            if(pair[0] == variable){return pair[1];}
        }
        return(false);
    }

    //获取地址栏参数
    rechSelect = function (){
        tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation,true);
    }

    //项目基本信息
    module.outProjectInformation = function (data) {
        if (data.code == 200) {
            var content = data.data;
            module.data.outProjectInformationDetail = content;
            // var outProjectInformationData = template('outProjectInformationData', module.data);
            // $("#outProjectInformationContent").html(outProjectInformationData);
            //挂牌价格字典
            tools.doGet(Dictionaries+'/price_unit', {}, (data)=>{
                if (data.code == 200) {
                    var unit = eval(data.data).filter(function (e) { return e.dictValue == content.unit;})[0].dictLabel;
                    module.data.outProjectInformationDetail.unit = unit;
                    var outProjectInformationData = template('outProjectInformationData', module.data);
                    $("#outProjectInformationContent").html(outProjectInformationData);
                    var outProjectInformationData2 = template('outProjectInformationData2', module.data);
                    $("#outProjectInformationContent2").html(outProjectInformationData2);
                    $('#unit').html('出价【'+unit+'】')
                }
            },true);
            //竞价方式字典
            tools.doGet(Dictionaries+'/bidding_type', {}, (data)=>{
                if (data.code == 200) {
                    var biddingType = eval(data.data).filter(function (e) { return e.dictValue == content.biddingType;})[0].dictLabel;
                    module.data.outProjectInformationDetail.biddingType = biddingType;
                    var outProjectInformationData = template('outProjectInformationData', module.data);
                    $("#outProjectInformationContent").html(outProjectInformationData);
                    var outProjectInformationData2 = template('outProjectInformationData2', module.data);
                    $("#outProjectInformationContent2").html(outProjectInformationData2);
                }
            },true);
            //期满处理字典
            tools.doGet(Dictionaries+'/bidding_direct', {}, (data)=>{
                if (data.code == 200) {
                    var biddingDirect = eval(data.data).filter(function (e) { return e.dictValue == content.biddingDirect;})[0].dictLabel;
                    module.data.outProjectInformationDetail.biddingDirect = biddingDirect;
                    var outProjectInformationData = template('outProjectInformationData', module.data);
                    $("#outProjectInformationContent").html(outProjectInformationData);
                    var outProjectInformationData2 = template('outProjectInformationData2', module.data);
                    $("#outProjectInformationContent2").html(outProjectInformationData2);
                }
            },true);
            //交易项目竞价记录
            tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true);

            //倒计时
            module.data.timer = setInterval(function(){
                let signupStartTime = module.data.outProjectInformationDetail.signupStartTime;
                let signupStopTime = module.data.outProjectInformationDetail.signupStopTime;
                let biddingStartTime = module.data.outProjectInformationDetail.biddingStartTime;
                let biddingStopTime = module.data.outProjectInformationDetail.biddingStopTime;//延时后结束时间
                let biddingStopSetime = module.data.outProjectInformationDetail.biddingStopSetime;//原始结束时间
                var nowTime = Date.parse(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date")));

                var difference = Date.parse(biddingStopTime)-nowTime;//延时后时间差
                var differenceSetime = Date.parse(biddingStopSetime)-nowTime;//原始时间差

                var centerTime = content.delayPeriod * 1000//延时周期

                var m,s;
                m = Math.floor(difference/1000/60%60);
                s = Math.floor(difference/1000%60);
                if(s%2 == 0&&centerTime!=0){
                    tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, (data)=>{
                        if (data.code == 200) {
                            module.data.outProjectInformationDetail.biddingStopTime = data.data
                        }
                    },true);
                }
                if ( differenceSetime <= 0 && difference >= 0 && difference <= centerTime){
                    module.dataCompare(signupStartTime,signupStopTime,biddingStartTime,biddingStopTime);
                    if (s < 1 && m < 1){
                        console.log("竞价结束22222222222")
                        tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, function(data){
                            if (data.code == 200) {
                                module.data.outProjectInformationDetail.biddingStopTime = data.data
                                let timeNew = Date.parse(data.data) + 0 - nowTime;
                                if (timeNew > 0) {
                                    module.data.outProjectInformationDetail.biddingStopTime = data.data;
                                }else{
                                    $('#countDown').html('竞价结束')
                                    module.data.outProjectInformationDetail.projectShowStatus = '等待成交';
                                    // setTimeout(()=>{
                                    //     tools.doGet(biddinglist, {projectId: getQueryVariable('id')}, (data1)=>{
                                    //         let content1 = data1.rows;
                                    //         module.data.biddinglistInformationDetail = content1;
                                    //         module.data.biddinglistInformationDetailLength = content1.length;
                                    //         var biddingInformationData = template('biddingInformationData', module.data);
                                    //         $("#biddingInformationContent").html(biddingInformationData);
                                    //     }, true);
                                    // },2000);
                                    return;
                                }
                            }
                        },true);
                    }else if(s%2 == 0&&centerTime!=0){
                        tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, (data)=>{
                            if (data.code == 200) {
                                module.data.outProjectInformationDetail.biddingStopTime = data.data
                            }
                        },true);
                    }
                }else{
                    module.dataCompare(signupStartTime,signupStopTime,biddingStartTime,biddingStopSetime);
                }
            },1000);
        }
    }

    //项目基本信息
    module.outProjectInformation2 = function (data) {
        if (data.code == 200) {
            var content = data.data;
            $("#bmrs").html(content.bidderNum);
            if((module.data.outProjectInformationDetail.biddingType=='自由竞价'||module.data.outProjectInformationDetail.biddingType=='1')&&(module.data.outProjectInformationDetail.projectShowStatus=='正在竞价'||module.data.outProjectInformationDetail.projectShowStatus=='等待竞价')){
                $("#cjcs").html('*');
            }else{
                $("#cjcs").html(content.bidPriceNum);
            }

        }
    }

    //竞价记录
    module.biddinglistInformation = function (data) {
        if (data.code == 200) {
            //console.log(data)
            var content = data.rows;
            module.data.biddinglistInformationDetail = content;
            var biddingInformationData = template('biddingInformationData', module.data);
            $("#biddingInformationContent").html(biddingInformationData);
            if (content.length > 0){
                if((module.data.outProjectInformationDetail.biddingType=='自由竞价'||module.data.outProjectInformationDetail.biddingType=='1')&&(module.data.outProjectInformationDetail.projectShowStatus=='正在竞价'||module.data.outProjectInformationDetail.projectShowStatus=='等待竞价')){
                    $("#biddingMoney").html('*');
                    $("#biddingPeople").html('*');
                }else{
                    $("#biddingMoney").html(content[0].money+module.data.outProjectInformationDetail.unit);
                    $("#biddingPeople").html(content[0].memberId);
                }
            }else{
                if((module.data.outProjectInformationDetail.biddingType=='自由竞价'||module.data.outProjectInformationDetail.biddingType=='1')&&(module.data.outProjectInformationDetail.projectShowStatus=='正在竞价'||module.data.outProjectInformationDetail.projectShowStatus=='等待竞价')){
                    $("#biddingMoney").html('*');
                    $("#biddingPeople").html('*');
                }else{
                    $("#biddingPeople").html('无');
                    $("#biddingMoney").html('无');
                }
            }
        }
    }

    module.dataCompare = function(signupStartTime,signupStopTime,biddingStartTime,biddingStopTime){
        var signupStartTime = signupStartTime;
        var signupStopTime = signupStopTime;
        var biddingStartTime = biddingStartTime;
        var biddingStopTime = biddingStopTime;
        var nowTime = Date.parse(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date")));

        var beginTimes=signupStartTime.substring(0,10).split('-');
        var endTimes=signupStopTime.substring(0,10).split('-');

        var biddingBeginTimes=biddingStartTime.substring(0,10).split('-');
        var biddingEndTimes=biddingStopTime.substring(0,10).split('-');

        signupStartTime=beginTimes[1]+'/'+beginTimes[2]+'/'+beginTimes[0]+' '+signupStartTime.substring(10,19);
        signupStopTime=endTimes[1]+'/'+endTimes[2]+'/'+endTimes[0]+' '+signupStopTime.substring(10,19);

        biddingStartTime=biddingBeginTimes[1]+'/'+biddingBeginTimes[2]+'/'+biddingBeginTimes[0]+' '+biddingStartTime.substring(10,19);
        biddingStopTime=biddingEndTimes[1]+'/'+biddingEndTimes[2]+'/'+biddingEndTimes[0]+' '+biddingStopTime.substring(10,19);


        //时间差
        var leftTime = Date.parse(biddingStopTime)-nowTime;
        //报名开始时间差
        var signupLeftTime = Date.parse(signupStartTime)-nowTime;
        //报名结束时间差
        var signDownLeftTime = Date.parse(signupStopTime)-nowTime;

        var centerTime = module.data.delayPeriod * 1000//延时周期

        //定义变量 d,h,m,s保存倒计时的时间
        var d,h,m,s;
        if(Date.parse(biddingStartTime)<nowTime&&nowTime<Date.parse(biddingStopTime)){
            //正在竞价
            module.data.biddingTimeType = 1;
            module.data.outProjectInformationDetail.projectShowStatus = '正在竞价';
            $('#d0').html(
                (
                    (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ?
                    '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
                    (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ?
                    '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
                    Math.floor(leftTime / 1000 / 60 / 60 / 24) + ''
                )[0]
            );
            $('#d1').html(
                (
                    (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ?
                        '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
                        (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ?
                            '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
                            Math.floor(leftTime / 1000 / 60 / 60 / 24) + ''
                )[1]
            );
            $('#d2').html(
                (
                    (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ?
                        '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
                        (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ?
                            '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
                            Math.floor(leftTime / 1000 / 60 / 60 / 24) + ''
                )[2]
            );

            $('#h0').html(((Math.floor(leftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[0]);
            $('#h1').html(((Math.floor(leftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[1]);

            $('#m0').html(((Math.floor(leftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]);
            $('#m1').html(((Math.floor(leftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]);

            $('#s0').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]);
            $('#s1').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]);

            //tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true);

            $('#countType').html('距竞价结束还有')
        }else if (nowTime>Date.parse(biddingStopTime)){
            module.data.outProjectInformationDetail.projectShowStatus = '等待成交';
            //竞价结束
            $('#d0').html('0')
            $('#d1').html('0')
            $('#d2').html('0')

            $('#h0').html('0')
            $('#h1').html('0')

            $('#m0').html('0')
            $('#m1').html('0')

            $('#s0').html('0')
            $('#s1').html('0')
            $('#countType').html('竞价结束')
            module.data.biddingTimeType = 2;
        }else if (nowTime<Date.parse(biddingStartTime)){
            module.data.outProjectInformationDetail.projectShowStatus = '等待竞价';
            //竞价暂未开始
            $('#d0').html('0')
            $('#d1').html('0')
            $('#d2').html('0')

            $('#h0').html('0')
            $('#h1').html('0')

            $('#m0').html('0')
            $('#m1').html('0')

            $('#s0').html('0')
            $('#s1').html('0')
            $('#countType').html('暂未开始')
            module.data.biddingTimeType = 3;
        }

        if(Date.parse(signupStartTime)<nowTime&&nowTime<Date.parse(signupStopTime)){
            //正在报名
            module.data.signupTimeType = 1;
            $('#d0').html(((Math.floor(signDownLeftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : Math.floor(leftTime / 1000 / 60 / 60 / 24) + '')[0]);
            $('#d1').html(((Math.floor(signDownLeftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : Math.floor(leftTime / 1000 / 60 / 60 / 24) + '')[1]);
            $('#d2').html(((Math.floor(signDownLeftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : Math.floor(leftTime / 1000 / 60 / 60 / 24) + '')[2]);

            $('#h0').html(((Math.floor(signDownLeftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[0]);
            $('#h1').html(((Math.floor(signDownLeftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[1]);

            $('#m0').html(((Math.floor(signDownLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]);
            $('#m1').html(((Math.floor(signDownLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]);

            $('#s0').html(((Math.floor(signDownLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]);
            $('#s1').html(((Math.floor(signDownLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]);

            $('#countType').html('距报名结束还有')
        }else if (nowTime>Date.parse(signupStopTime)){
            //报名结束
            module.data.signupTimeType = 2;
        }else if (nowTime<Date.parse(signupStartTime)){
            //报名暂未开始
            module.data.signupTimeType = 3;
            $('#d0').html(((Math.floor(signupLeftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : Math.floor(leftTime / 1000 / 60 / 60 / 24) + '')[0]);
            $('#d1').html(((Math.floor(signupLeftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : Math.floor(leftTime / 1000 / 60 / 60 / 24) + '')[1]);
            $('#d2').html(((Math.floor(signupLeftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : Math.floor(leftTime / 1000 / 60 / 60 / 24) + '')[2]);

            $('#h0').html(((Math.floor(signupLeftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[0]);
            $('#h1').html(((Math.floor(signupLeftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[1]);

            $('#m0').html(((Math.floor(signupLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]);
            $('#m1').html(((Math.floor(signupLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]);

            $('#s0').html(((Math.floor(signupLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]);
            $('#s1').html(((Math.floor(signupLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]);

            $('#countType').html('距报名开始还有')
        }
        // if(module.data.outProjectInformationDetail.biddingType != '拍卖' && module.data.biddingTimeType != 2){
        //     document.getElementById('biddingTable').style.display = 'none';
        //     document.getElementById('biddingTitle').style.display = 'block';
        // }
    }

    module.setimeDataCompare = function(){
        tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, (data)=>{
            if (data.code == 200) {
                module.data.outProjectInformationDetail.biddingStopTime = data.data
            }
        },true);
        var biddingStartTime = module.data.outProjectInformationDetail.biddingStartTime
        var biddingStopTime = module.data.outProjectInformationDetail.biddingStopTime;
        var nowTime = Date.parse(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date")));

        var biddingBeginTimes=biddingStartTime.substring(0,10).split('-');
        var biddingEndTimes=biddingStopTime.substring(0,10).split('-');

        biddingStartTime=biddingBeginTimes[1]+'/'+biddingBeginTimes[2]+'/'+biddingBeginTimes[0]+' '+biddingStartTime.substring(10,19);
        biddingStopTime=biddingEndTimes[1]+'/'+biddingEndTimes[2]+'/'+biddingEndTimes[0]+' '+biddingStopTime.substring(10,19);

        //时间差
        var leftTime = Date.parse(biddingStopTime)-nowTime;

        //定义变量 d,h,m,s保存倒计时的时间
        var d,h,m,s;
        if(Date.parse(biddingStartTime)<nowTime&&nowTime<Date.parse(biddingStopTime)){
            //正在竞价
            module.data.biddingTimeType = 1;

            $('#d0').html(
                (
                    (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ?
                        '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
                        (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ?
                            '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
                            Math.floor(leftTime / 1000 / 60 / 60 / 24) + ''
                )[0]
            );
            $('#d1').html(
                (
                    (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ?
                        '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
                        (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ?
                            '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
                            Math.floor(leftTime / 1000 / 60 / 60 / 24) + ''
                )[1]
            );
            $('#d2').html(
                (
                    (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ?
                        '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
                        (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ?
                            '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
                            Math.floor(leftTime / 1000 / 60 / 60 / 24) + ''
                )[2]
            );

            $('#h0').html(((Math.floor(leftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[0]);
            $('#h1').html(((Math.floor(leftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[1]);

            $('#m0').html(((Math.floor(leftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]);
            $('#m1').html(((Math.floor(leftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]);

            $('#s0').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]);
            $('#s1').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]);

            let d,h,m,s;
            d = Math.floor(leftTime / 1000 / 60 / 60 / 24);
            h = Math.floor(leftTime / 1000 / 60 / 60 % 24);
            m = Math.floor(leftTime / 1000 / 60 % 60);
            s = Math.floor(leftTime / 1000 % 60);

            if (d<1&&h<1&&m<1&&s<1){
                console.log('竞价结束')
                clearInterval(module.data.setimer)
            }
            //tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true);

            $('#countType').html('距竞价结束还有')
        }
    }

    //网站配置信息
    module.webConfigInformation = function (data) {
        if (data.code == 200) {
            var content = data.data;
            //console.log(content)
            //document.getElementById('time').innerHTML = '延时周期：'+content[8].configValue+content[8].remark+'<i class="wh">?</i>'
            module.data.timeConfig = content[8].configValue;
            module.data.titleConfig = content[9].configValue;
            module.data.importantTitle = content[7].configName+':'+ content[7].configValue.substr(3).substr(0,(content[7].configValue.substr(3).length-4));
            module.data.know = content[6].configValue;
            $("#know").html(content[6].configValue + '<span style="margin-left: 10px;"></span>' + content[6].configValue);
        }
    }

    module.biddingDirectDictionaries = function (data) {
        if (data.code == 200 && module.data.outProjectInformationDetail.biddingDirect!='') {
            var content = data.data;
            var biddingDirect = eval(content).filter(function (e) { return e.dictValue == module.data.outProjectInformationDetail.biddingDirect;})[0].dictLabel;
            module.data.outProjectInformationDetail.biddingDirect = biddingDirect;
        }
    }

    module.unitDictionaries = function (data) {
        if (data.code == 200 && module.data.outProjectInformationDetail.unit!='') {
            var content = data.data;
            var unit = eval(content).filter(function (e) { return e.dictValue == module.data.outProjectInformationDetail.unit;})[0].dictLabel;
            module.data.outProjectInformationDetail.unit = unit;
        }
    }

    module.biddingTypeDictionaries = function (data) {
        if (data.code == 200 && module.data.outProjectInformationDetail.biddingType!='') {
            var content = data.data;
            console.log(eval(content).filter(function (e) { return e.dictValue == module.data.outProjectInformationDetail.biddingType;}))
            var biddingType = eval(content).filter(function (e) { return e.dictValue == module.data.outProjectInformationDetail.biddingType;})[0].dictLabel;
            module.data.outProjectInformationDetail.biddingType = biddingType;
        }
    }

    return module;
});
