grow_up_detal.js 3.05 KB
/***
 * 程序入口
 */
var page=1;
var isnomore=0;
$(function () {
    getList();
})

/*----同步调用----*/
function async_get(url,data,func,err) {
    $.ajax({
        url:  url, data: data, type: "get",
        dataType: "json",  async:false,
        success: function(res) {
            if(res.code==0){ func(res); }
        }
    });
}

///滑动到底部加载更多
$(document).unbind("scroll");
$(document).bind("scroll", function (event) {
    if ($(document).scrollTop() >= $(document).height() - window.innerHeight) {
       if(!isnomore)  getList();
    }
});

function getList() {
    //--获取成长值明细--
    var d_data={storeId:stoid,userId:user_id,page:page,pageSize:6};
    if($.trim($("#start_time").val())){
        var tt1=$.trim($("#start_time").val());
        d_data.beginDate=tt1.replace("/","-")
    }
    if($.trim($("#end_time").val())){
        var tt2=$.trim($("#end_time").val());
        d_data.endDate=tt2.replace("/","-")
    }
    async_get(apihost+"/api/weshop/users/grade/vipinoutgrade/page",d_data,
    function (res) {
        var data=res.data.pageData;
        if(data.length!=0 ){
            page++;
            var html="";
            for(var i in data) {
                var item=data[i];
                var htm = '<div class="xc-bills-frame" >'+
                '<div class="flex jc_sb">'+
                    '<div>' +
                    '<div class="word-number">' +(item.Remark?item.Remark:"未知")+
                    '</div>' +
                    '<div class="word-time">' +item.BillDate+
                    '</div></div>';

                  if(item.InGrade){

                      htm+= '<div class="xc-val fs035">+'+item.InGrade+'</div></div></div>';}
                 else if(item.OutGrade){
                      htm+= '<div class="xc-val fs035">-'+item.OutGrade+'</div></div></div>';}
                else{
                      htm+= '<div class="xc-val fs035">'+0+'</div></div></div>';}
                html+=htm;
            }
            $(".no_text").hide();
            $(".xc-list-frame").append(html);

        }else{
            html=''
            //$(".xc-list-frame").html(html);
            if(page==1)  $(".no_text").show();
            else{
                $(".xc-list-frame").append("<div class='xc-bills-frame' style='height: 0.5rem; border-bottom: none; text-align: center; color: #999'>无更多数据</div>");
            }
            isnomore=1;
        }

    })
}

function goto(e){
    var index=$(e).attr("ind");
    switch (index) {
        case "0": window.location.href= "/mobile/index/index/stoid/"+stoid;break;
        case "1": window.location.href= "/mobile/user/coupon/stoid/"+stoid; break;
        case "2": window.location.href= "/mobile/user/gorw_up/stoid/"+stoid; break;
    }
}

function show_submit() {
    $("#s_select_time").hide();
    $(".xc_sx ").removeClass("clicked");
    $(".xc-list-frame").html("");
    page=1; isnomore=0;
    getList();
}

function reset() {
    $("#start_time").val("");
    $("#end_time").val("");
    $(".xc-list-frame").html("");
    page=1;isnomore=0;
    getList();
}