wdyw.js 10.5 KB
layui.use('element', function () {
    let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
    //监听导航点击
    element.on('nav(demo)', function (elem) {
        layer.msg(elem.text());
    });
    $('.arrowList p').css("opacity", 0);
    $('.arrowList p').eq(0).css("opacity", 1);
});
$(function () {
    _applyBusinessRecord()
    _applyBusinessAJZTCount()
    $('.business_titleList li a').click(function () {
        let dataId = ($(this).attr('data-id'))
        $('.arrowList p').css("opacity", 0);
        $('.arrowList p').eq(dataId).css("opacity", 1);
        $('.business_titleList li a').removeClass('bus-active');
        $('.business_titleList li').eq(dataId).find('a').addClass('bus-active')
        if (dataId == '0') {
            _applyBusinessRecord()
            dataRendering(dataList.list)
        } else if (dataId == '1') {
            _applyBusinessWiat()
            dataRendering(dataList.list)
        } else if (dataId == '2') {
            _applyBusinessIn()
            dataRendering(dataList.list)
        } else if (dataId == '3') {
            _applyBusinessEnd()
            dataRendering(dataList.list)
        }
    })
    $(function() {
      $('#hellotime').text(getTimeState())
    })
    $(document).on("click", ".appintmentList li .handle", function () {
        let businessNo = $(this).attr('data-businessNo');
        let slsqBsm = $(this).attr('data-slsqBsm');
        let title = $(this).attr('data-title');
        getWorkBoxFLow(slsqBsm, businessNo, title)
    })
    // 业务列表操作

    $(document).on("click", ".delete", function () {
        let slsqBsm = $(this).attr('slsqBsm')
        layui.use('layer', function () {
            var layer = layui.layer;
            layer.confirm('此操作将删除业务是否继续?', {
                scrollbar: false,
                btn: ['是', '否'] //按钮
            }, function () {
                _listDel(slsqBsm)
            }, function () {
                layer.closeAll();
            });
        });
    })
  $('#zjhm').text(getItem('myCookie').zjhm)
  $('#username').text(getItem('myCookie').username )
})

// 列表操作

function _listDel(slsqBsm) {
    $.ajax({
        type: "delete",  //提交方式  
        url: portal.api_url + "/portal/FillInformation/deleteSlsqBybsmSlsq?bsmSlsq="+slsqBsm,//路径  
        dataType: "json",
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理      
            if (result.code == 200) {
                layer.msg('操作成功!');
                _applyBusinessAJZTCount()
                _applyBusinessRecord()
                dataRendering(dataList.list)
            }
        }
    });
}


//网上申请业务待提交
function _applyBusinessWiat(currentPage = 1) {
    var li;
    $.ajax({
        type: "post",  //提交方式  
        url: portal.api_url + "/portal/WorkBoxService/applyBusinessWait",//路径  
        dataType: "json",
        data: {
            "userId": getItem('myCookie').userid,
            "currentPage": currentPage,
            "pageSize": 10
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理      
            $('.appintmentListItem').empty();
            if (result.code == 200 && result.data != null) {
                dataList.list = result.data.records
                dataRendering()
            }
            paged(result.data.total);
        }
    });
}
//网上申请业务正在办理
function _applyBusinessIn(currentPage = 1) {
    var li;
    $.ajax({
        type: "post",  //提交方式  
        url: portal.api_url + "/portal/WorkBoxService/applyBusinessIn",//路径  
        dataType: "json",
        data: {
            "userId": getItem('myCookie').userid,
            "currentPage": currentPage,
            "pageSize": 10
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理      
            $('.appintmentListItem').empty();
            if (result.code == 200 && result.data != null) {
                dataList.list = result.data.records
                dataRendering()
            }
            paged(result.data.total);
        }
    });
}

//网上申请业务已办结
function _applyBusinessEnd(currentPage = 1) {
    var li;
    $.ajax({
        type: "post",  //提交方式  
        url: portal.api_url + "/portal/WorkBoxService/applyBusinessEnd",//路径  
        dataType: "json",
        data: {
            "userId": getItem('myCookie').userid,
            "currentPage": currentPage,
            "pageSize": 10
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理      
            $('.appintmentListItem').empty();
            if (result.code == 200 && result.data != null) {
                dataList.list = result.data.records
                dataRendering()
            }
            paged(result.data.total);
        }
    });
}

//网上申请业务记录
function _applyBusinessRecord(currentPage = 1) {
    var li;
    $.ajax({
        type: "post",  //提交方式  
        url: portal.api_url + "/portal/WorkBoxService/applyBusinessRecord",//路径  
        dataType: "json",
        data: {
            "userId": getItem('myCookie').userid,
            "currentPage": currentPage,
            "pageSize": 10
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理      
            $('.appintmentListItem').empty();
            if (result.code == 200 && result.data != null) {
                dataList.list = result.data.records
                dataRendering()
            }
            paged(result.data.total, result.data.current);
        }
    });
}

// 网上申请业务案件状态数量统计
function _applyBusinessAJZTCount() {
    $.ajax({
        type: "get",  //提交方式  
        url: portal.api_url + "/portal/WorkBoxService/applyBusinessAJZTCount?userId=" + dataList.userid,//路径  
        dataType: "json",
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理
            $('.applyBusinessRecord span').text(result.data.allBusinessCount)
            $('.to_be_submitted span').text(result.data.businessWaitCount)
            $('.applyBusinessIn span').text(result.data.businessInProcessCount)
            $('.applyBusinessEnd span').text(result.data.businessEndCount)
        }
    });
}


// 分页
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) {
                    _applyBusinessRecord(obj.curr);
                }
            }
        });
    })
    if (pageCount == 0) {
        $('#page').hide();
        $('.noData').show();
    }else {
        $('#page').show();
        $('.noData').hide();
    }
}


// 列表数据渲染
function dataRendering() {
    for (var i = 0; i < dataList.list.length; i++) {
        li = '<li data-slsqBsm="' + dataList.list[i].slsqBsm + '" data-businessNo="' + dataList.list[i].businessNo + '">';
        if (dataList.list[i].ajzt == '1') {
            li += '<span class="state tobeSubmit">办理中</span>'
        } else if (dataList.list[i].ajzt == '2') {
            li += '<span class="state dataReview">资料审核</span>'
        } else if (dataList.list[i].ajzt == '3') {
            li += '<span class="state pay">待缴费</span>'
        } else if (dataList.list[i].ajzt == '4') {
            li += '<span class="state return">退回</span>'
        } else if (dataList.list[i].ajzt == '5') {
            li += '<span class="state reject">驳回</span>'
        } else {
            li += '<span class="state success">办理成功</span>'
        }
        li += ' <div class="business_name">'
        li += '<h5>' + dataList.list[i].djywjc + '</h5>'
        li += '<p>权利类型:' + dataList.list[i].qllxmc + '</p>'
        li += '</div>'
        li += '<div class="obligee">'
        li += '<p>权利人</p>'
        if (dataList.list[i].qlrmc!='') {
            li += '<p>' + dataList.list[i].qlrmc + '</p>'
        }else {
            li += '<p>-----</p>'
        }
        li += '</div>'
        li += '<div class="obligee">'
        li += '<p>义务人</p>'
        if (dataList.list[i].ywrmc!='') {
            li += '<p>' + dataList.list[i].ywrmc + '</p>'
        }else {
            li += '<p>-----</p>'
        }
        li += '</div>'
        li += '<div>'
        li += '<p>办理流水</p>'
        li += '<p>' + dataList.list[i].wwsqbh + '</p>'
        li += '</div>'
        li += '<div>'
        li += '<p>办理时间</p>'
        li += '<p>' + dataList.list[i].sqrq + '</p>'
        li += '</div>'
        li += '<a slsqBsm="'+dataList.list[i].slsqBsm+'" class="delete">删除</a>'
        if (dataList.list[i].ajzt == '1') {
            li += '<a class="handle" data-slsqBsm="' + dataList.list[i].slsqBsm + '"data-businessNo="' + dataList.list[i].businessNo + '" data-title="我的业务">继续办理</a>'
        } else if (dataList.list[i].ajzt == '3') {
            li += '<a slsqBsm="'+dataList.list[i].slsqBsm+'" class="handle">缴费</a>'
        }else if  (dataList.list[i].ajzt == '4' || dataList.list[i].ajzt == '5' || dataList.list[i].ajzt == '6') {
            li += '<a class="completed">已办结</a>'
        }
        $('.appintmentListItem').append(li)
    }
}
function getTimeState(){
  // 获取当前时间
  let timeNow = new Date();
  // 获取当前小时
  let hours = timeNow.getHours();
  // 设置默认文字
  let text = '';
  // 判断当前时间段
  if (hours >= 0 && hours <= 10) {
      text = '早上好:';
  } else if (hours > 10 && hours <= 14) {
      text = '中午好:';
  } else if (hours > 14 && hours <= 18) {
      text = '下午好:';
  } else if (hours > 18 && hours <= 24) {
      text = `晚上好:`;
  }
  // 返回当前时间段对应的状态
  return text;
};

var dataList = {
    "list": [],
    "userid": getItem('myCookie').userid
};