917f5b8f by 田浩浩

修改

1 parent 3678ee54
...@@ -4,10 +4,7 @@ $(function () { ...@@ -4,10 +4,7 @@ $(function () {
4 var appuintText = undefined; 4 var appuintText = undefined;
5 5
6 6
7 // 国有房屋无业点击选中记录 7
8 var busIndex = undefined;
9 // 机构id
10 var jgid = undefined;
11 getAppointmentDay(); 8 getAppointmentDay();
12 layui.use("element", function () { 9 layui.use("element", function () {
13 let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块 10 let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
...@@ -17,17 +14,17 @@ $(function () { ...@@ -17,17 +14,17 @@ $(function () {
17 }); 14 });
18 }); 15 });
19 16
20 function a(i) { 17 // function a(i) {
21 Date = data.dateList[i].jyjh; 18 // Date = data.dateList[i].jyjh;
22 bookingDate = data.dateList[i].bookingDate; 19 // bookingDate = data.dateList[i].bookingDate;
23 bustime = data.dateList[i].week; 20 // bustime = data.dateList[i].week;
24 getAppointmentPeriodAndBusiness() 21 // //getAppointmentPeriodAndBusiness()
25 $(".swiper-slide") 22 // $(".swiper-slide")
26 .eq(i) 23 // .eq(i)
27 .addClass("active1") 24 // .addClass("active1")
28 .siblings() 25 // .siblings()
29 .removeClass("active1"); 26 // .removeClass("active1");
30 } 27 // }
31 var swiper = new Swiper(".swiper-container", { 28 var swiper = new Swiper(".swiper-container", {
32 slidesPerView: 5, 29 slidesPerView: 5,
33 spaceBetween: 20, 30 spaceBetween: 20,
...@@ -37,7 +34,7 @@ function a(i) { ...@@ -37,7 +34,7 @@ function a(i) {
37 on: { 34 on: {
38 click: function (swiper) { 35 click: function (swiper) {
39 var index = swiper["clickedIndex"]; 36 var index = swiper["clickedIndex"];
40 a(index); 37 //a(index);
41 }, 38 },
42 }, 39 },
43 loopFillGroupWithBlank: true, 40 loopFillGroupWithBlank: true,
...@@ -49,23 +46,9 @@ function a(i) { ...@@ -49,23 +46,9 @@ function a(i) {
49 $(document).on("click", ".cancel", function () { 46 $(document).on("click", ".cancel", function () {
50 layer.closeAll(); 47 layer.closeAll();
51 }); 48 });
52 $(document).on("click", ".confim", function () { 49
53 var paramsobj = {}
54 paramsobj.jgid = GetQueryString("jgid");
55 paramsobj.periodRulesId = periodRulesId
56 paramsobj.userid = getCookie().userid
57 makeAppointment(paramsobj)
58 });
59 }); 50 });
60 $(document).on('click','#canlebutton',function(){ 51
61 console.log(2323)
62 var obj = {}
63 obj.appointmentId = cancleId,
64 obj.userid = getCookie().userid
65 obj.jgid = GetQueryString("jgid"),
66 obj.periodRulesId = choosePeriodRulesId,
67 cancleAppointment(obj)
68 })
69 //获取当前页面预约日期 52 //获取当前页面预约日期
70 function getAppointmentDay() { 53 function getAppointmentDay() {
71 $.ajax({ 54 $.ajax({
...@@ -78,21 +61,35 @@ function getAppointmentDay() { ...@@ -78,21 +61,35 @@ function getAppointmentDay() {
78 success: function (result) { 61 success: function (result) {
79 //返回数据根据结果进行相应的处理 62 //返回数据根据结果进行相应的处理
80 if (result.code == 200 && result.data != null) { 63 if (result.code == 200 && result.data != null) {
81 data.dateList = result.data.listTime; 64 RenderbookingDateList(result.data);
82 layui.use("laytpl", function () { 65 bookingDateClick(result.data.listTime[0].bookingDate);
83 laytpl = layui.laytpl;
84 var getTpl = document.getElementById("date").innerHTML,
85 view = document.getElementById("swiperDate");
86 laytpl(getTpl).render(data, function (html) {
87 view.innerHTML = html;
88 });
89 });
90 } 66 }
91 }, 67 },
92 }); 68 });
93 } 69 }
70
71
72
73 //渲染预约日期列表
74 function RenderbookingDateList(data) {
75 let DateConnect = "";
76 $.each(data.listTime, function (index, item) {
77 DateConnect += '<ul id="' + item.bookingDate + '" class="swiper-slide layui-bg-gray" onclick="bookingDateClick(this.id)">';
78 DateConnect += '<li>' + item.week + '</li><li>' + item.jyjh + '</li>';
79 DateConnect += '</ul>';
80 });
81 $("#swiperDate").html(DateConnect);
82 }
83
84 //预约日期点击事件
85 function bookingDateClick(id) {
86 $(".layui-bg-gray").removeClass("active1");
87 $("#" + id).addClass("active1");
88 getAppointmentPeriodAndBusiness(id);
89 }
90
94 // 根据办事大厅机构ID、日期、用户ID,获取对应日期的业务列表 GET 91 // 根据办事大厅机构ID、日期、用户ID,获取对应日期的业务列表 GET
95 function getAppointmentPeriodAndBusiness() { 92 function getAppointmentPeriodAndBusiness(bookingDate) {
96 $.ajax({ 93 $.ajax({
97 type: "get", //提交方式 94 type: "get", //提交方式
98 url: 95 url:
...@@ -107,38 +104,14 @@ function getAppointmentPeriodAndBusiness() { ...@@ -107,38 +104,14 @@ function getAppointmentPeriodAndBusiness() {
107 success: function (result) { 104 success: function (result) {
108 //返回数据根据结果进行相应的处理 105 //返回数据根据结果进行相应的处理
109 if (result.code == 200 && result.data != null) { 106 if (result.code == 200 && result.data != null) {
110 console.log(result.data)
111 data.busList = result.data.appointmentPeriodBusinessList;
112 choosePeriodRulesId = result.data.choosePeriodRulesId
113 cancleId = result.data.appointmentId
114 RenderBusinessList(result.data); 107 RenderBusinessList(result.data);
115 if (data.busList.length > 0) { 108 if (result.data.appointmentPeriodBusinessList.length > 0) {
116 data.busList.forEach((item, index) => { 109 hallname = result.data.appointmentPeriodBusinessList[0].orgBusinessList[0].jgName;
117 hallname = item.orgBusinessList[0].jgName
118 })
119 } 110 }
120 } 111 }
121 }, 112 },
122 }); 113 });
123 } 114 }
124 var bookingDate = undefined;
125 var flag = undefined;
126 var msg = undefined;
127 var hallname = undefined;
128 var periodRulesId = undefined
129 var choosePeriodRulesId = undefined
130 var appointmentId = undefined
131 var cancleId = undefined
132 var data = {
133 dateList: [],
134 busList: [
135 {
136 startTime: "",
137 endTime: "",
138 orgBusinessList: [],
139 },
140 ],
141 };
142 115
143 //渲染业务信息列表 116 //渲染业务信息列表
144 function RenderBusinessList(data) { 117 function RenderBusinessList(data) {
...@@ -171,7 +144,7 @@ function RenderBusinessList(data) { ...@@ -171,7 +144,7 @@ function RenderBusinessList(data) {
171 businessContent += '<li class="isAppoint" data-id="' + childItem.periodRulesId + '">'; 144 businessContent += '<li class="isAppoint" data-id="' + childItem.periodRulesId + '">';
172 businessContent += '<h3>' + childItem.shortName + '</h3>'; 145 businessContent += '<h3>' + childItem.shortName + '</h3>';
173 if (childItem.residueNumber > 0) { 146 if (childItem.residueNumber > 0) {
174 businessContent += '<input type="button" value="立即预约" id="' + childItem.periodRulesId + '" dataName="' + childItem.shortName + '" onclick="handle(this.id)"/>'; 147 businessContent += '<input type="button" value="立即预约" id="' + childItem.periodRulesId + '" periodRulesId="' + childItem.periodRulesId + '" onclick="handle(this.id)"/>';
175 } 148 }
176 businessContent += '<p style="color:#5FB878">(剩' + childItem.residueNumber + '票)</p></li>'; 149 businessContent += '<p style="color:#5FB878">(剩' + childItem.residueNumber + '票)</p></li>';
177 } 150 }
...@@ -209,7 +182,7 @@ function checkAppointment() { ...@@ -209,7 +182,7 @@ function checkAppointment() {
209 } 182 }
210 183
211 function handle(id) { 184 function handle(id) {
212 periodRulesId = id 185 let bookingDateUL = $(".active1");
213 let msg = checkAppointment(); 186 let msg = checkAppointment();
214 if (msg != undefined) { 187 if (msg != undefined) {
215 //layer.msg('hello'); 188 //layer.msg('hello');
...@@ -235,21 +208,25 @@ function handle(id) { ...@@ -235,21 +208,25 @@ function handle(id) {
235 hallname + 208 hallname +
236 "</div>" + 209 "</div>" +
237 '<div class="listItem"><h3>预约业务:</h3>' + 210 '<div class="listItem"><h3>预约业务:</h3>' +
238 input.attr("dataName") + 211 input.val() +
239 "</div>" + 212 "</div>" +
240 '<div class="listItem"><h3>预约时间:</h3>' + 213 '<div class="listItem"><h3>预约时间:</h3>' +
241 yysj + 214 bookingDateUL.children("li").get(1).innerHTML +
242 "&nbsp;&nbsp;" + 215 "&nbsp;&nbsp;" +
243 bustime + 216 bookingDateUL.children("li").get(0).innerHTML +
244 "</div>" + 217 "</div>" +
245 '<div class="confimButton"><button type="button" class="layui-btn cancel layui-btn-primary">取消</button><button type="button" class="layui-btn confim layui-btn-normal">确定</button></div>' + 218 '<div class="confimButton"><button type="button" class="layui-btn cancel layui-btn-primary">取消</button><button type="button" class="layui-btn confim layui-btn-normal" onclick="makeAppointment(\'' + input.attr("periodRulesId") + '\')">确定</button></div>' +
246 "</div>", 219 "</div>",
247 }); 220 });
248 }); 221 });
249 } 222 }
250 223
251 // 用户预约抢号 POST 224 // 提交预约记录
252 function makeAppointment(data) { 225 function makeAppointment(id) {
226 var paramsobj = {}
227 paramsobj.jgid = GetQueryString("jgid");
228 paramsobj.periodRulesId = id;
229 paramsobj.userid = getCookie().userid;
253 $.ajax({ 230 $.ajax({
254 type: "post", //提交方式 231 type: "post", //提交方式
255 async: false, 232 async: false,
...@@ -258,37 +235,21 @@ function makeAppointment(data) { ...@@ -258,37 +235,21 @@ function makeAppointment(data) {
258 'Content-Type': 'application/json;charset=UTF-8', 235 'Content-Type': 'application/json;charset=UTF-8',
259 }, 236 },
260 dataType: "json", 237 dataType: "json",
261 data: JSON.stringify(data),//***关键****** 238 data: JSON.stringify(paramsobj),//***关键******
262 success: function (result) {//返回数据根据结果进行相应的处理 239 success: function (result) {//返回数据根据结果进行相应的处理
263 if (result.code == 200 && result.data !== null) { 240 if (result.code == 200 && result.data !== null) {
264 appointmentId = result.data 241 appointmentId = result.data
265 window.location.href = "./yyjg.html?appointmentId=" + appointmentId 242 window.location.href = "./yyjg.html?appointmentId=" + appointmentId
266 } 243 }
267 } 244 else {
268 }); 245 alert(result.message);
269 }
270 // 用户取消预约
271 function cancleAppointment(data) {
272 $.ajax({
273 type: "post", //提交方式
274 url: portal.api_url + "/portal/appointmentmh/cancleAppointment",//路径
275 headers: {//***关键******
276 'Content-Type': 'application/json;charset=UTF-8',
277 },
278 dataType: "json",
279 data: JSON.stringify(data),//***关键******
280 success: function (result) {//返回数据根据结果进行相应的处理
281 if (result.code == 200 && result.data !== null) {
282 console.log('取消预约成功')
283 // a(i)
284 // appointmentId = result.data
285 // window.location.href = "./yyjg.html?appointmentId=" + appointmentId
286 } 246 }
287 } 247 }
288 }); 248 });
289 } 249 }
290 // GET 根据预约信息标识码appointmentId查看预约详情 250
291 function getAppointmentDetail(id){ 251 // 根据预约信息标识码appointmentId查看预约详情接口数据
252 function getAppointmentDetail(id) {
292 $.ajax({ 253 $.ajax({
293 type: "get", //提交方式 254 type: "get", //提交方式
294 url: 255 url:
...@@ -303,7 +264,7 @@ function getAppointmentDetail(id){ ...@@ -303,7 +264,7 @@ function getAppointmentDetail(id){
303 if (result.code == 200) { 264 if (result.code == 200) {
304 appointmentDetail(result.data); 265 appointmentDetail(result.data);
305 } 266 }
306 else{ 267 else {
307 alert(result.message); 268 alert(result.message);
308 } 269 }
309 }, 270 },
...@@ -311,7 +272,7 @@ function getAppointmentDetail(id){ ...@@ -311,7 +272,7 @@ function getAppointmentDetail(id){
311 } 272 }
312 273
313 274
314 //预约详情 275 //预约详情展示页面
315 function appointmentDetail(data) { 276 function appointmentDetail(data) {
316 layui.use("layer", function () { 277 layui.use("layer", function () {
317 layer.open({ 278 layer.open({
...@@ -335,10 +296,33 @@ function appointmentDetail(data) { ...@@ -335,10 +296,33 @@ function appointmentDetail(data) {
335 data.hbShortname + 296 data.hbShortname +
336 "</div>" + 297 "</div>" +
337 '<div class="listItem"><h3>预约时间:</h3>' + 298 '<div class="listItem"><h3>预约时间:</h3>' +
338 data.bookingDate.substr(0,4) + '年'+data.bookingDate.substr(4,2) + '月' + data.bookingDate.substr(6,2) + '日'+data.startTime + '至'+data.endTime + 299 data.bookingDate.substr(0, 4) + '年' + data.bookingDate.substr(4, 2) + '月' + data.bookingDate.substr(6, 2) + '日' + data.startTime + '至' + data.endTime +
339 "</div>" + 300 "</div>" +
340 '<div class="confimButton"><button type="button" class="layui-btn cancel layui-btn-primary" id="canlebutton">取消预约</button></div>' + 301 '<div class="confimButton"><button type="button" class="layui-btn cancel layui-btn-primary" onclick="cancleAppointment(\'' + data.aid + '\',\'' + data.jgid + '\',\'' + data.periodRulesId + '\',\'' + data.userid + '\')">取消预约</button></div>' +
341 "</div>", 302 "</div>",
342 }); 303 });
343 }); 304 });
344 } 305 }
306 // 用户取消预约
307 function cancleAppointment(aid, jgid, periodRulesId, userid) {
308
309 $.ajax({
310 type: "post", //提交方式
311 url: portal.api_url + "/portal/appointmentmh/cancleAppointment",//路径
312 headers: {//***关键******
313 'Content-Type': 'application/json;charset=UTF-8',
314 },
315 dataType: "json",
316 data: JSON.stringify({
317 "appointmentId": aid,
318 "jgid": jgid,
319 "periodRulesId": periodRulesId,
320 "userid": userid
321 }),//***关键******
322 success: function (result) {//返回数据根据结果进行相应的处理
323 if (result.code == 200) {
324 bookingDateClick($(".active1").attr('id'));
325 }
326 }
327 });
328 }
...\ No newline at end of file ...\ No newline at end of file
......
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 1 <!DOCTYPE html
2 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head> 4
5 <head>
4 <style></style> 6 <style></style>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <title>我的预约-预约时间</title> 8 <title>我的预约-预约时间</title>
7 <script type="text/javascript" src="../staticJs/head.js"></script> 9 <script type="text/javascript" src="../staticJs/head.js"></script>
8 <link rel="stylesheet" href="../staticCss/swiper-bundle.min.css" /> 10 <link rel="stylesheet" href="../staticCss/swiper-bundle.min.css" />
9 <link 11 <link rel="stylesheet" type="text/css" href="../staticCss/progressBar.css" />
10 rel="stylesheet"
11 type="text/css"
12 href="../staticCss/progressBar.css"
13 />
14 <link rel="stylesheet" type="text/css" href="../staticCss/yysj.css" /> 12 <link rel="stylesheet" type="text/css" href="../staticCss/yysj.css" />
15 <link 13 <link rel="stylesheet" type="text/css" href="../staticCss/layuiDialog.css" />
16 rel="stylesheet" 14 </head>
17 type="text/css"
18 href="../staticCss/layuiDialog.css"
19 />
20 </head>
21 15
22 <body> 16 <body>
23 <div class="yysj_main"> 17 <div class="yysj_main">
24 <div class="navigation_crumbs"> 18 <div class="navigation_crumbs">
25 <div class="contentBox"> 19 <div class="contentBox">
...@@ -62,7 +56,7 @@ ...@@ -62,7 +56,7 @@
62 </ul> 56 </ul>
63 </div> 57 </div>
64 <div class="appoint_time"> 58 <div class="appoint_time">
65 <div class="swiper-container" > 59 <div class="swiper-container">
66 <div class="swiper-wrapper" id="swiperDate"></div> 60 <div class="swiper-wrapper" id="swiperDate"></div>
67 </div> 61 </div>
68 <!-- Add Arrows --> 62 <!-- Add Arrows -->
...@@ -74,7 +68,7 @@ ...@@ -74,7 +68,7 @@
74 <div class="site-title"> 68 <div class="site-title">
75 <fieldset> 69 <fieldset>
76 <legend> 70 <legend>
77 <a href="" name="fieldset"> 业务预约 </a> 71 <h2>业务列表</h2>
78 </legend> 72 </legend>
79 </fieldset> 73 </fieldset>
80 </div> 74 </div>
...@@ -91,15 +85,17 @@ ...@@ -91,15 +85,17 @@
91 </div> 85 </div>
92 </div> 86 </div>
93 </div> 87 </div>
94 </body> 88 </body>
89
95 </html> 90 </html>
96 <script type="text/javascript" src="../staticJs/common.js"></script> 91 <script type="text/javascript" src="../staticJs/common.js"></script>
97 <script type="text/javascript" src="../staticJs/down.js"></script> 92 <script type="text/javascript" src="../staticJs/down.js"></script>
98 <script src="../staticJs/swiper-bundle.min.js"></script> 93 <script src="../staticJs/swiper-bundle.min.js"></script>
99 <script type="text/javascript" src="../staticJs/yysj.js"></script> 94 <script type="text/javascript" src="../staticJs/yysj.js"></script>
100 95
101 <script id="date" type="text/html"> 96 <!-- <script id="date" type="text/html">
102 {{# layui.each(d.dateList, function(index, item){ }} {{# if(item.isSelect){ }} 97 {{# layui.each(d.dateList, function(index, item){ }}
98 {{# if(item.isSelect){ }}
103 <ul class="swiper-slide layui-bg-gray active1"> 99 <ul class="swiper-slide layui-bg-gray active1">
104 <li>{{item.week}}</li> 100 <li>{{item.week}}</li>
105 <li>{{item.jyjh}}</li> 101 <li>{{item.jyjh}}</li>
...@@ -111,4 +107,4 @@ ...@@ -111,4 +107,4 @@
111 <li>{{item.jyjh}}</li> 107 <li>{{item.jyjh}}</li>
112 </ul> 108 </ul>
113 {{# } }} {{# }); }} 109 {{# } }} {{# }); }}
114 </script>
...\ No newline at end of file ...\ No newline at end of file
110 </script> -->
...\ No newline at end of file ...\ No newline at end of file
......