style:预约列表
Showing
3 changed files
with
71 additions
and
21 deletions
| 1 | $(function () { | 1 | $(function () { |
| 2 | _initData() | 2 | if(GetQueryString('id')) { |
| 3 | _initData(); | ||
| 4 | }else { | ||
| 5 | _getBsznDetailByYwid(); | ||
| 6 | } | ||
| 3 | }) | 7 | }) |
| 4 | 8 | ||
| 5 | layui.use('element', function () { | 9 | layui.use('element', function () { |
| ... | @@ -26,6 +30,29 @@ function _initData() { | ... | @@ -26,6 +30,29 @@ function _initData() { |
| 26 | } | 30 | } |
| 27 | }); | 31 | }); |
| 28 | } | 32 | } |
| 33 | // 通过业务ID获取对应的办事指南明细 | ||
| 34 | |||
| 35 | function _getBsznDetailByYwid() { | ||
| 36 | var newsDetail = $("#newsDetail"); | ||
| 37 | newsDetail.empty(); | ||
| 38 | $.ajax({ | ||
| 39 | type: "get", //提交方式 | ||
| 40 | url: portal.api_url + "/portal/MhGuide/getBsznDetailByYwid",//路径 | ||
| 41 | data: { | ||
| 42 | "ywid": GetQueryString('ywid'), | ||
| 43 | }, | ||
| 44 | dataType: "json", | ||
| 45 | //数据,这里使用的是Json格式进行传输 | ||
| 46 | success: function (result) {//返回数据根据结果进行相应的处理 | ||
| 47 | if (result.code == 200 && result.data != null) { | ||
| 48 | $('.newsTitle').html(result.data.headline) | ||
| 49 | $('.releaseTime').html(result.data.publishTime) | ||
| 50 | newsDetail.append(result.data.content) | ||
| 51 | } | ||
| 52 | } | ||
| 53 | }); | ||
| 54 | } | ||
| 55 | |||
| 29 | 56 | ||
| 30 | function GetQueryString(name) { | 57 | function GetQueryString(name) { |
| 31 | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); | 58 | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); | ... | ... |
| 1 | layui.use('element', function () { | 1 | layui.use('element', function () { |
| 2 | let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块 | 2 | let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块 |
| 3 | //监听导航点击 | ||
| 4 | element.on('nav(demo)', function (elem) { | ||
| 5 | //console.log(elem) | ||
| 6 | layer.msg(elem.text()); | ||
| 7 | }); | ||
| 8 | }); | 3 | }); |
| 9 | $(function () { | 4 | $(function () { |
| 10 | _initData(); | 5 | _initData(); |
| ... | @@ -12,11 +7,11 @@ $(function () { | ... | @@ -12,11 +7,11 @@ $(function () { |
| 12 | $('#username').text(getCookie().username); | 7 | $('#username').text(getCookie().username); |
| 13 | 8 | ||
| 14 | $(document).on("click", ".business", function (e) { | 9 | $(document).on("click", ".business", function (e) { |
| 15 | window.open("./businessGuideDeatil.html?id=" + $(this).attr('ywid') + "") | 10 | window.open("./businessGuideDeatil.html?ywid=" + $(this).attr('ywid') + "") |
| 16 | }) | 11 | }) |
| 17 | }) | 12 | }) |
| 18 | // 获取列表信息 | 13 | // 获取列表信息 |
| 19 | function _initData(currentPage=1) { | 14 | function _initData(currentPage = 1) { |
| 20 | var appointment_list = $(".appointment_list"); | 15 | var appointment_list = $(".appointment_list"); |
| 21 | appointment_list.empty(); | 16 | appointment_list.empty(); |
| 22 | var li; | 17 | var li; |
| ... | @@ -41,28 +36,28 @@ function _initData(currentPage=1) { | ... | @@ -41,28 +36,28 @@ function _initData(currentPage=1) { |
| 41 | li += '<h3>预约成功</h3>' | 36 | li += '<h3>预约成功</h3>' |
| 42 | li += '<a href="./yyjg.html">查看<i class="layui-icon layui-icon-right"></i></a>' | 37 | li += '<a href="./yyjg.html">查看<i class="layui-icon layui-icon-right"></i></a>' |
| 43 | li += '</div>' | 38 | li += '</div>' |
| 44 | }else if (records[i].state == '1') { | 39 | } else if (records[i].state == '1') { |
| 45 | li += '<div class="item_title success">' | 40 | li += '<div class="item_title success">' |
| 46 | li += '<h3>已赴约</h3>' | 41 | li += '<h3>已赴约</h3>' |
| 47 | li += '</div>' | 42 | li += '</div>' |
| 48 | }else if(records[i].state == '2') { | 43 | } else if (records[i].state == '2') { |
| 49 | li += '<div class="item_title overdue">' | 44 | li += '<div class="item_title overdue">' |
| 50 | li += '<h3>已逾期</h3>' | 45 | li += '<h3>已逾期</h3>' |
| 51 | li += '</div>' | 46 | li += '</div>' |
| 52 | }else if(records[i].state == '3' || records[i].state == '4') { | 47 | } else if (records[i].state == '3' || records[i].state == '4') { |
| 53 | li += '<div class="item_title cancel">' | 48 | li += '<div class="item_title cancel">' |
| 54 | li += '<h3>已取消预约</h3>' | 49 | li += '<h3>已取消预约</h3>' |
| 55 | li += '</div>' | 50 | li += '</div>' |
| 56 | } | 51 | } |
| 57 | li += '<ul class="item_info">' | 52 | li += '<ul class="item_info">' |
| 58 | li += '<li><span>预约人:</span><p>'+records[i].name+'</p></li>' | 53 | li += '<li><span>预约人:</span><p>' + records[i].name + '</p></li>' |
| 59 | li += '<li><span>办事大厅:</span><p>'+records[i].organizationName+'</p></li>' | 54 | li += '<li><span>办事大厅:</span><p>' + records[i].organizationName + '</p></li>' |
| 60 | li += '<li><span>办理业务类型:</span><p>'+records[i].businessName+'</p><a class="business" ywid="'+records[i].ywid+'">办事指南</a></li>' | 55 | li += '<li><span>办理业务类型:</span><p>' + records[i].businessName + '</p><a class="business" ywid="' + records[i].ywid + '">办事指南</a></li>' |
| 61 | li += '<li><span>预约日期:</span><p>'+records[i].reserveTime+'</p></li>' | 56 | li += '<li><span>预约日期:</span><p>' + records[i].reserveTime + '</p></li>' |
| 62 | li += '<li><span>预约流水号:</span><p>'+records[i].reservationNumber+'</p></li>' | 57 | li += '<li><span>预约流水号:</span><p>' + records[i].reservationNumber + '</p></li>' |
| 63 | li += '</ul>' | 58 | li += '</ul>' |
| 64 | if (records[i].state == '1') { | 59 | if (records[i].state == '0') { |
| 65 | li += '<a class="cancel_reservation">取消预约</a>' | 60 | li += '<a periodRulesId="' + records[i].periodRulesId + '" jgid="' + records[i].jgid + '" appointmentId="' + records[i].appointmentId + '" class="cancel_reservation">取消预约</a>' |
| 66 | } | 61 | } |
| 67 | li += '</div>' | 62 | li += '</div>' |
| 68 | li += '</li>' | 63 | li += '</li>' |
| ... | @@ -75,6 +70,34 @@ function _initData(currentPage=1) { | ... | @@ -75,6 +70,34 @@ function _initData(currentPage=1) { |
| 75 | }); | 70 | }); |
| 76 | } | 71 | } |
| 77 | 72 | ||
| 73 | // 用户取消预约 | ||
| 74 | $(document).on("click", ".cancel_reservation", function (e) { | ||
| 75 | _cancleAppointment($(this).attr('appointmentId'), $(this).attr('jgid'), $(this).attr('periodRulesId'), getCookie('myCookie').userid) | ||
| 76 | }) | ||
| 77 | |||
| 78 | function _cancleAppointment(appointmentId, jgid, periodRulesId, userid) { | ||
| 79 | $.ajax({ | ||
| 80 | type: "post", //提交方式 | ||
| 81 | url: portal.api_url + "/portal/appointmentmh/cancleAppointment",//路径 | ||
| 82 | dataType: "json", | ||
| 83 | headers: { | ||
| 84 | 'Content-Type': 'application/json;charset=UTF-8', | ||
| 85 | }, | ||
| 86 | data: JSON.stringify({ | ||
| 87 | 'appointmentId': appointmentId, | ||
| 88 | 'jgid': jgid, | ||
| 89 | 'periodRulesId': periodRulesId, | ||
| 90 | 'userid': userid | ||
| 91 | }), | ||
| 92 | //数据,这里使用的是Json格式进行传输 | ||
| 93 | success: function (result) {//返回数据根据结果进行相应的处理 | ||
| 94 | if (result.code == 200) { | ||
| 95 | layer.msg('取消预约成功'); | ||
| 96 | _initData(); | ||
| 97 | } | ||
| 98 | } | ||
| 99 | }); | ||
| 100 | } | ||
| 78 | 101 | ||
| 79 | // 分页 | 102 | // 分页 |
| 80 | function paged(pageCount, curr) { | 103 | function paged(pageCount, curr) { |
| ... | @@ -90,7 +113,6 @@ function paged(pageCount, curr) { | ... | @@ -90,7 +113,6 @@ function paged(pageCount, curr) { |
| 90 | , theme: '#0091FF' | 113 | , theme: '#0091FF' |
| 91 | , jump: function (obj, first) { | 114 | , jump: function (obj, first) { |
| 92 | if (!first) { | 115 | if (!first) { |
| 93 | console.log(obj.curr) | ||
| 94 | _initData(obj.curr); | 116 | _initData(obj.curr); |
| 95 | } | 117 | } |
| 96 | } | 118 | } |
| ... | @@ -98,6 +120,6 @@ function paged(pageCount, curr) { | ... | @@ -98,6 +120,6 @@ function paged(pageCount, curr) { |
| 98 | }) | 120 | }) |
| 99 | } | 121 | } |
| 100 | 122 | ||
| 101 | var dataList = { | 123 | var dataList = { |
| 102 | "userid":getCookie().userid | 124 | "userid": getCookie().userid |
| 103 | }; | 125 | }; |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment