mobliehtmpingdlist.html 8.18 KB
<style>
    .goods_img{position: relative;}
    .goods_img .round_show{ width: 0.5rem; height:0.5rem; color: #fff; font-size: 0.18rem; line-height: 0.48rem; background:#E9030D; border-radius: 100%;position: absolute; top: 2px; right:3px;}
</style>
<script> var tf=new Array();var tf2=new Array();var isyu=new Array();var Dif=new Array(); </script>
<div class="floor_body">
    <h2>
        <a href="/index.php/mobile/team/team_list/stoid/{$Think.request.stoid}.html">
            <em></em>拼单
            <div class="geng">
            </div>
            <p class="clear"></p>
        </a>
    </h2>
    <ul class="seckill_off seckill_list" >
        <pind no="{{no}}"  idlist='{{idlist}}'  item="v"  limit='9'>
            <li onclick="javascript:window.location.href='{:U('Mobile/team/team_info',array('stoid'=>$Think.request.stoid,'id'=>$v.goods_id))}'" >
            <div class="imgbox">
                <img src="{:getimg($v.original_img,NOIMG,0,1);}"/>
                <switch name="v.kttype" >
                    <case value="1"><em class="round_show">商家</em></case>
                    <case value="2"><em class="round_show">会员</em></case>
                    <case value="3"><em class="round_show">阶梯</em></case>
                </switch>
            </div>
            <div class="content">
                <p class="tit">{$v.title}</p>
                <p class="tit" style="font-size: 12px">已团{$v.buy_num}件&nbsp;
                    <font style="font-size: 10px; color: grey">{$v.ct_num}人团</font></p>
                <p class="price"><span>{$v.price}</span><i>¥{$v.market_price}</i></p>
                <p class="time">
                    <img src="__STATIC__/images/time.png" />
                    <span id="jstimerBox{$v.goods_id}"> </span>
                </p>
                <if condition="$v.goods_num gt $v.buy_num">
                   <if condition="$v.isyure eq 0">
                        <if condition="$v['kttype'] eq 1">
                            <div class="btnRed">去参团</div>
                        <else/>
                            <div class="btnRed">去开团</div>
                        </if>
                   <else/>
                       <div class="btnRed" style="background: gainsboro; color: #888;">正在预热</div>
                   </if>
                 <else/>
                    <div class="btnRed" style="background: gainsboro; color: #888;">已拼完</div>
                </if>
            </div>
            <div style="clear: both"></div>
            </li>
            <script>
               $(function () {
                isyu['$v.goods_id']="{$v.isyure}";
                tf2['{$v.goods_id}']=new Date('{$v.end_time|date="Y/m/d H:i:s",###}');
                <if condition="$v.isyure eq 1">
                     var ttt= tf2['{$v.goods_id}']-new Date().getTime();
                     if(ttt<=0){

                         $("#jstimerBox{$v.goods_id}").parent().parent().find(".btnRed").css("color", "#888");
                         $("#jstimerBox{$v.goods_id}").parent().parent().find(".btnRed").css("background-color", "gainsboro");
                         $("#jstimerBox{$v.goods_id}").parent().parent().find(".btnRed").text("已结束");
                         $("#jstimerBox{$v.goods_id}").parent().remove();
                         tf['{$v.goods_id}'] = "false";
                     }else{
                         tf['{$v.goods_id}'] = new Date('{$v.start_time|date="Y/m/d H:i:s",###}');
                         Dif['{$v.goods_id}'] =tf['{$v.goods_id}'] - new Date().getTime();
                         if(Dif['{$v.goods_id}']<=0) {
                             $("#jstimerBox{$v.goods_id}").parent().parent().find(".btnRed").css("color", "#fff");
                             $("#jstimerBox{$v.goods_id}").parent().parent().find(".btnRed").css("background-color", "#C4182E");
                         <if condition = "$v['kttype'] eq 1" >
                                 $("#jstimerBox{$v.goods_id}").parent().parent().find(".btnRed").text('去参团');
                         <else/>
                             $("#jstimerBox{$v.goods_id}").parent().parent().find(".btnRed").text('去开团');
                         </if>
                             isyu['$v.goods_id']="0";
                         }
                     }
                <else/>
                    tf['{$v.goods_id}'] = new Date('{$v.end_time|date="Y/m/d H:i:s",###}');
                    Dif['{$v.goods_id}'] =tf['{$v.goods_id}'] - new Date().getTime();
                    if(Dif['{$v.goods_id}']<=0) {
                        $("#jstimerBox{$v.goods_id}").parent().parent().find(".btnRed").css("color", "#888");
                        $("#jstimerBox{$v.goods_id}").parent().parent().find(".btnRed").css("background-color", "gainsboro");
                        $("#jstimerBox{$v.goods_id}").parent().parent().find(".btnRed").text("已结束");
                        $("#jstimerBox{$v.goods_id}").parent().remove();
                        tf['{$v.goods_id}'] = "false";
                    }
                </if>
                window.setInterval(function(){clock11('{$v.goods_id}',"{$v['kttype']}");}, 1000);
               });
            </script>
        </pind>
    </ul>
</div>
<script type="text/javascript">
    var daysms0 = 24 * 60 * 60 * 1000;
    var hoursms0 = 60 * 60 * 1000;
    var Secondms0 = 60 * 1000;
    var microsecond0 = 1000;
    var DifferHour0 = -1;
    var DifferMinute0 = -1;
    var DifferSecond0 = -1;

    // 倒计时
    function clock11(key,t) {
        if(tf[key]=="false") return false;
        var time = new Date()
        var hour = time.getHours()
        var minute = time.getMinutes()
        var second = time.getSeconds()
        var timevalue = "" + ((hour > 12) ? hour - 12 : hour)
        timevalue += ((minute < 10) ? ":0" : ":") + minute
        timevalue += ((second < 10) ? ":0" : ":") + second
        timevalue += ((hour > 12 ) ? " PM" : " AM")
        var convertHour = DifferHour0
        var convertMinute = DifferMinute0
        var convertSecond = DifferSecond0
        var Diffms = tf[key].getTime() - time.getTime()
        if(Diffms<=0)
        {
            //$("#jstimerBox" + key).parent().parent().parent().remove();
            if(isyu[key]=="0") {
                $("#jstimerBox" + key).parent().parent().find(".btnRed").css("color","#888");
                $("#jstimerBox" + key).parent().parent().find(".btnRed").css("background-color","gainsboro");
                $("#jstimerBox" + key).parent().parent().find(".btnRed").text("已结束");
                $("#jstimerBox" + key).parent().remove();
                tf[key]="false";
            }else{
                $("#jstimerBox" + key).parent().parent().find(".btnRed").css("color","#fff");
                $("#jstimerBox" + key).parent().parent().find(".btnRed").css("background-color","#C4182E");
                tf[key]=tf2[key];
                if(t=="1"){
                    $("#jstimerBox" + key).parent().parent().find(".btnRed").text('去参团');
                }else{
                    $("#jstimerBox" + key).parent().parent().find(".btnRed").text('去开团');
                }
                isyu[key]="0";
            }
        }
        else
        {
            DifferHour0 = Math.floor(Diffms / daysms0);
            Diffms -= DifferHour0 * daysms0;
            DifferMinute0 = Math.floor(Diffms / hoursms0);
            Diffms -= DifferMinute0 * hoursms0;
            DifferSecond0 = Math.floor(Diffms / Secondms0);
            Diffms -= DifferSecond0 * Secondms0;
            var dSecs = Math.floor(Diffms / microsecond0);

            if (convertHour != DifferHour0) e = "<span class=hour>" + DifferHour0 + "</span><font color=black>天</font>";
            if (convertMinute != DifferMinute0) f = "<span class=min>" + DifferMinute0 + "</span><font color=black>时</font>";
            if (convertSecond != DifferSecond0) g = "<span class=sec>" + DifferSecond0+ "</span><font color=black>分</font>";
            h = "<span class=msec>" + dSecs + "</span><font color=black>秒</font>";
            if (DifferHour0 > 0) {
                e = e;
            }
            else {
                e = '';
            }
            document.getElementById("jstimerBox" + key).innerHTML = e + f + g + h;
        }
    }

</script>