wdyy.js
3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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()
})
// 获取列表信息
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":'0026609ddc6d2afabaa3c9b0ea3b0ec3'
};