wdyy.js 3.78 KB
layui.use('element', function () {
    let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
    //监听导航点击
    element.on('nav(demo)', function (elem) {
        //console.log(elem)
        layer.msg(elem.text());
    });
});
$(function () {
    _initData()
    $('#zjhm').text(getCookie().zjhm)
    $('#username').text(getCookie().username )
})
// 获取列表信息
function _initData(currentPage=1) {
    var appointment_list = $(".appointment_list");
    appointment_list.empty();
    var li;
    $.ajax({
        type: "post",  //提交方式  
        url: portal.api_url + "/portal/WorkBoxService/bookingBusinessReord",//路径  
        dataType: "json",
        data: {
            "userId": dataList.userid,
            "currentPage": currentPage,
            "pageSize": 10
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理           
            if (result.code == 200 && result.data != null) {
                let records = result.data.records
                for (var i = 0; i < records.length; i++) {
                    li = '<li>'
                    li += '<div class="item_content">'
                    if (records[i].state == '1') {
                        li += '<div class="item_title success">'
                        li += '<h3>赴约</h3>'
                        li += '<a>查看<i class="layui-icon layui-icon-right"></i></a>'
                        li += '</div>'
                    }else if(records[i].state == '2') {
                        li += '<div class="item_title overdue">'
                        li += '<h3>逾期</h3>'
                        li += '<a>查看<i class="layui-icon layui-icon-right"></i></a>'
                        li += '</div>'
                    }else if(records[i].state == '4') {
                        li += '<div class="item_title cancel">'
                        li += '<h3>取消</h3>'
                        li += '<a>查看<i class="layui-icon layui-icon-right"></i></a>'
                        li += '</div>'
                    }
                    li += '<ul class="item_info">'
                    li += '<li><span>预约人:</span><p>'+records[i].name+'</p></li>'
                    li += '<li><span>办事大厅:</span><p>'+records[i].organizationName+'</p></li>'
                    li += '<li><span>办理业务类型:</span><p>'+records[i].businessName+'</p><a href="">办事指南</a></li>'
                    li += '<li><span>预约日期:</span><p>'+records[i].reserveTime+'</p></li>'
                    li += '<li><span>预约流水号:</span><p>'+records[i].reservationNumber+'</p></li>'
                    li += '</ul>'
                    if (records[i].state == '1') {
                        li += '<a class="cancel_reservation">取消预约</a>'
                    }
                    li += '</div>'
                    li += '</li>'
                    appointment_list.append(li);
                }
            }

            paged(result.data.total, result.data.current);
        }
    });
}


// 分页
function paged(pageCount, curr) {
    layui.use('laypage', function () {
        let laypage = layui.laypage;
        //执行一个laypage实例
        laypage.render({
            elem: 'page' //注意,这里的 test1 是 ID,不用加 # 号
            , count: pageCount //数据总数,从服务端得到
            , curr: curr
            , prev: '<'
            , next: '>'
            , theme: '#0091FF'
            , jump: function (obj, first) {
                if (!first) {
                    console.log(obj.curr)
                    _initData(obj.curr);
                }
            }
        });
    })
}
var dataList = { 
    "userid":getCookie().userid
};