关于剩余时间

来源:互联网 发布:中国8个一线城市 知乎 编辑:程序博客网 时间:2024/05/17 22:03
<#list projectList as vo>
<div class="x-index-layout x-index-layout_1 x-index-layout_x clearfix">
    <div class="pull-left clearfix x-lh20">
        <div class="pull-left x-h40">
            <span class="x-f14 x-p_r x-d_ib x-w180">
                <span class="x-w100 x-t_hidden x-d_ib x-h20 x-v-m">${vo.projectName}</span>
                   <span id="stateText${vo_index}" class="x-stateText x-v-m">
                   <input type="hidden" value="${vo.projectState}" id="stateValue${vo_index}" class="x-stateValue">
                   <input type="hidden" value="${vo.valueShow}" id="value_show${vo_index}" class="x-valueShow">
                   </span>
               
            </span>
            <br/>
            <span class="x-lh20">预期年化收益率:${vo.annualizedReturn}%</span>
        </div>
        <div class="pull-left  x-pt20 x-w170 x-t_hidden">
            <span>投资期限:</span>
            <span>${vo.investTerm}个月</span>
        </div>
        <div class="pull-left x-pt20 x-w170 x-t_hidden">
            <span>起投金额:</span>
            <span class="x-red">${vo.startInvestMoney}元</span>
        </div>
        <div class="pull-left  x-pt10 x-w180 x-t_hidden">
            <span>项目本金:</span><span>${vo.principal}元</span><br/>
            <span>获取收益方式:</span><span>
              <#if vo.profitType = 1>
                                            按月付息
              </#if>
              <#if vo.profitType = 2>
                                           一次性还本付息
              </#if>
           
            </span>
        </div>
    </div>
    <div class="pull-right x-r-tender">
        <input type="hidden" value="" id="time_value${vo_index}">
        <input type="hidden" value="" id="date_time_value${vo_index}">
        <input type="hidden" value="${vo.valueDate?string("yyyy-MM-dd HH:mm:ss")}" id="value_date${vo_index}" class="x-value_date">
        <input type="hidden" value="${vo.investTime?string("yyyy-MM-dd HH:mm:ss")}" id="invest_time${vo_index}" class="x-invest_time">
        <#if vo.projectState = 2>
           <span id="show_time${vo_index}" class="x-time-l_1">剩余时间:<span id="day_show${vo_index}" class="x-day_show"></span>天<span id="hour_show${vo_index}" class="x-hour_show"></span>小时<span id="minute_show${vo_index}" class="x-minute_show"></span>分钟</span>
        <#else>
        </#if>
        
        <a href="javascript:void(0);" status="" investTime="${vo.investTime?string("yyyy-MM-dd HH:mm:ss")}" sign_show="0" id="button${vo_index}" projectid="${vo.id}" class="q-invest-btnred x-mt3 x-mb10">了解详情</a>
    </div>
</div>

</#list>


  //全局服务器系统时间计时器
        var currentServiceTime = '${currentServiceTime}';
        var currentServiceTimeDate = new Date(currentServiceTime.replace(/-/g, "/"));
        var setIntervalIndex = function(investTimeDateValue,valueTimeDateValue,state,valueShow){
            var that = this,
            timer = setInterval(function() {
                if(state==2 && investTimeDateValue > 0 ){
                    investTimeDateValue--;
                    var d = parseInt(investTimeDateValue / 3600 / 24),h = parseInt((investTimeDateValue / 3600) % 24),m = parseInt((investTimeDateValue / 60) % 60);
                    
                    that.find('.x-stateText').text("投标中");
                    that.find('.x-stateText').addClass("x-btn_1");
                    
                    if (m <= 9)
                        m = '0' + m;
                    that.find('.x-day_show').html(d);
                    that.find('.x-hour_show').html(h);
                    that.find('.x-minute_show').html(m);    
                }else{
                    that.find('.x-day_show').attr('style','display:none;');
               
                   if(state == 4){
                     that.find('.x-stateText').text("还款完成");
                     that.find('.x-stateText').addClass("x-btn_3");
                   }else{
                     if(valueShow == 0){
                        that.find('.x-stateText').text("满标");
                        that.find('.x-stateText').addClass("x-btn_4");
                     }else{
                        if(valueTimeDateValue > 0){
                          that.find('.x-stateText').text("满标");
                          that.find('.x-stateText').addClass("x-btn_4");
                        }else{
                          that.find('.x-stateText').text("还款中");
                          that.find('.x-stateText').addClass("x-btn_2");
                        }
                    }
                  }
                  if(investTimeDateValue <= 0){
                    that.find('.x-time-l_1').css({
                        'visibility': 'hidden'
                    });
                    clearInterval(timer);
                    timer = null;
                  }
              }      
           }, 1000);
        };        
        $('.x-index-layout_x').each(function(){
            var investTime,investTimeDate,content = $(this);
            valueTime = content.find('.x-value_date').val();
            var valueTimeDate = new Date(valueTime.replace(/-/g, "/"));
            var valueTimeDateValue = parseInt((valueTimeDate.getTime() - currentServiceTimeDate.getTime()) / 1000);
            
            
            investTime = content.find('.x-invest_time').val();
            var investTimeDate = new Date(investTime.replace(/-/g, "/"));
            var investTimeDateValue = parseInt((investTimeDate.getTime() - currentServiceTimeDate.getTime()) / 1000);
            var $btn = content.find('.x-stateText');
            
            var state = content.find('.x-stateValue' ).val();
            var valueShow = content.find('.x-valueShow').val();
            setIntervalIndex.call(content,investTimeDateValue,valueTimeDateValue,state,valueShow);
            
            
            investTime = null;
            investTimeDate = null;
            content = null;
        });    
       



0 0
原创粉丝点击