earnings_log.html 4.1 KB
<!DOCTYPE html>
<html lang="en">

{include file="public/head"/}
<link rel="stylesheet" href="__CDN__/assets/advertising/css/record.css">

<body>
    <!-- 收益记录 -->
    <div class="income_record" id="dom">
        <div class="record_tips">红包劵收益记录</div>
        {foreach name="$data" item="vo"}
            <div class="record_single">
                <div class="record_box layout justify flex_diection">
                    <div class="layout justify flex_row">
                        <div class="record_title">
                            {if condition="$vo.type eq 4"}
                            参与答题
                            {elseif condition='$vo.type eq 5'}
                            下级答题
                            {elseif condition='$vo.type eq 6'}
                            商户消费
                            {/if}
                        </div>
                        <div class="record_num">+{$vo.rmb}元</div>
                    </div>
                    <div class="record_date">
                        {$vo.createtime}
                    </div>
                </div>
            </div>
        {/foreach}
    </div>
    {empty name="$data"}
    <div class="empty_data">
        暂无数据
    </div>
    {/empty}
    {notempty name="$data"}
    <div class="load_more layout align_center justify_center">
        <div>加载更多</div>
        <div class="layout align_center justify_center">
            <img src="__CDN__/assets/advertising/img/right.png" alt="">
        </div>
    </div>
    <!--当前页-->
    <input type="hidden" id="page" value="1"/>
    {/notempty}
    {include file="public/js" /}
</body>
<script>
    $(function(){
        //加载更多
        $(".load_more").click(function () {
            var page = $('#page').val();
            var user_id = "{$user.id}";
            page++;
            $.ajax({
                url:"{:url('home/member/more_earnings_log')}",
                type:"POST",
                data:{'page':page,'user_id':user_id},
                success:function(res){
                    if(res.code == 1){
                        if(res.data == ''){
                            $('.justify_center').html("<div>没有更多了~</div>");
                            toast('没有更多了~');
                            return;
                        }
                        var html = "";
                        $(res.data).each(function (key, vo) {
                            var type = "";
                            if(vo.type == 4){
                                type = "参与答题";
                            }else if(vo.type == 5){
                                type = "下级答题";
                            }
                            html += "<div class=\"record_single\">\n" +
                                "                <div class=\"record_box layout justify flex_diection\">\n" +
                                "                    <div class=\"layout justify flex_row\">\n" +
                                "                        <div class=\"record_title\">\n" +
                                "                            "+type+"\n" +
                                "                        </div>\n" +
                                "                        <div class=\"record_num\">+"+vo.rmb+"元</div>\n" +
                                "                    </div>\n" +
                                "                    <div class=\"record_date\">\n" +
                                "                        "+vo.createtime+"\n" +
                                "                    </div>\n" +
                                "                </div>\n" +
                                "            </div>";
                        });
                        $('#dom').append(html);
                        $('#page').val(page);
                    }else{
                        toast('与服务器断开连接');
                    }
                },
                error:function(){
                    toast('与服务器断开连接');
                }
            })
        })
    })
</script>
</html>