预约时间代码修改
Showing
1 changed file
with
69 additions
and
44 deletions
| ... | @@ -17,7 +17,7 @@ $(function () { | ... | @@ -17,7 +17,7 @@ $(function () { |
| 17 | }); | 17 | }); |
| 18 | }); | 18 | }); |
| 19 | 19 | ||
| 20 | function a(i) { | 20 | function a(i) { |
| 21 | Date = data.dateList[i].jyjh; | 21 | Date = data.dateList[i].jyjh; |
| 22 | bookingDate = data.dateList[i].bookingDate; | 22 | bookingDate = data.dateList[i].bookingDate; |
| 23 | bustime = data.dateList[i].week; | 23 | bustime = data.dateList[i].week; |
| ... | @@ -46,21 +46,6 @@ $(function () { | ... | @@ -46,21 +46,6 @@ $(function () { |
| 46 | prevEl: ".swiper-button-prev", | 46 | prevEl: ".swiper-button-prev", |
| 47 | }, | 47 | }, |
| 48 | }); | 48 | }); |
| 49 | |||
| 50 | function detailHandle() { | ||
| 51 | layui.use("layer", function () { | ||
| 52 | layer.open({ | ||
| 53 | type: 1, | ||
| 54 | title: "请确认以下信息", | ||
| 55 | shadeClose: false, | ||
| 56 | area: ["500px", "320px"], | ||
| 57 | scrollbar: false, | ||
| 58 | skin: "confimInfo", | ||
| 59 | content: '123', | ||
| 60 | }); | ||
| 61 | }); | ||
| 62 | } | ||
| 63 | |||
| 64 | $(document).on("click", ".cancel", function () { | 49 | $(document).on("click", ".cancel", function () { |
| 65 | layer.closeAll(); | 50 | layer.closeAll(); |
| 66 | }); | 51 | }); |
| ... | @@ -72,7 +57,15 @@ $(function () { | ... | @@ -72,7 +57,15 @@ $(function () { |
| 72 | makeAppointment(paramsobj) | 57 | makeAppointment(paramsobj) |
| 73 | }); | 58 | }); |
| 74 | }); | 59 | }); |
| 75 | 60 | $(document).on('click','#canlebutton',function(){ | |
| 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 | }) | ||
| 76 | //获取当前页面预约日期 | 69 | //获取当前页面预约日期 |
| 77 | function getAppointmentDay() { | 70 | function getAppointmentDay() { |
| 78 | $.ajax({ | 71 | $.ajax({ |
| ... | @@ -115,29 +108,27 @@ function getAppointmentPeriodAndBusiness() { | ... | @@ -115,29 +108,27 @@ function getAppointmentPeriodAndBusiness() { |
| 115 | //返回数据根据结果进行相应的处理 | 108 | //返回数据根据结果进行相应的处理 |
| 116 | if (result.code == 200 && result.data != null) { | 109 | if (result.code == 200 && result.data != null) { |
| 117 | console.log(result.data) | 110 | console.log(result.data) |
| 118 | data.busList = result.data.appointmentPeriodBusinessList; | 111 | data.busList = result.data.appointmentPeriodBusinessList; |
| 112 | choosePeriodRulesId = result.data.choosePeriodRulesId | ||
| 113 | cancleId = result.data.appointmentId | ||
| 119 | RenderBusinessList(result.data); | 114 | RenderBusinessList(result.data); |
| 120 | |||
| 121 | if (data.busList.length > 0) { | 115 | if (data.busList.length > 0) { |
| 122 | data.busList.forEach((item, index) => { | 116 | data.busList.forEach((item, index) => { |
| 123 | hallname = item.orgBusinessList[0].jgName | 117 | hallname = item.orgBusinessList[0].jgName |
| 124 | }) | 118 | }) |
| 125 | } | 119 | } |
| 126 | |||
| 127 | } | 120 | } |
| 128 | }, | 121 | }, |
| 129 | }); | 122 | }); |
| 130 | } | 123 | } |
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | var bookingDate = undefined; | 124 | var bookingDate = undefined; |
| 135 | var flag = undefined; | 125 | var flag = undefined; |
| 136 | var msg = undefined; | 126 | var msg = undefined; |
| 137 | var hallname = undefined; | 127 | var hallname = undefined; |
| 138 | var periodRulesId = undefined | 128 | var periodRulesId = undefined |
| 129 | var choosePeriodRulesId = undefined | ||
| 139 | var appointmentId = undefined | 130 | var appointmentId = undefined |
| 140 | var periodRulesId = undefined | 131 | var cancleId = undefined |
| 141 | var data = { | 132 | var data = { |
| 142 | dateList: [], | 133 | dateList: [], |
| 143 | busList: [ | 134 | busList: [ |
| ... | @@ -169,7 +160,7 @@ function RenderBusinessList(data) { | ... | @@ -169,7 +160,7 @@ function RenderBusinessList(data) { |
| 169 | if (data.choosePeriodRulesId == childItem.periodRulesId) { | 160 | if (data.choosePeriodRulesId == childItem.periodRulesId) { |
| 170 | businessContent += '<li class="isAppoint" style="border: 1px solid red ;" data-id="' + childItem.periodRulesId + '">'; | 161 | businessContent += '<li class="isAppoint" style="border: 1px solid red ;" data-id="' + childItem.periodRulesId + '">'; |
| 171 | businessContent += '<h3>' + childItem.shortName + '</h3>'; | 162 | businessContent += '<h3>' + childItem.shortName + '</h3>'; |
| 172 | businessContent += '<input type="button" value="查看详情" id="' + childItem.periodRulesId + '" dataName="' + childItem.shortName + '" onclick="appointmentDetail(this.id)"/>'; | 163 | businessContent += '<input type="button" value="查看详情" id="' + data.appointmentId + '" dataName="' + childItem.shortName + '" onclick="getAppointmentDetail(this.id)"/>'; |
| 173 | } | 164 | } |
| 174 | else { | 165 | else { |
| 175 | businessContent += '<li class="isAppoint">'; | 166 | businessContent += '<li class="isAppoint">'; |
| ... | @@ -209,9 +200,6 @@ function checkAppointment() { | ... | @@ -209,9 +200,6 @@ function checkAppointment() { |
| 209 | //数据,这里使用的是Json格式进行传输 | 200 | //数据,这里使用的是Json格式进行传输 |
| 210 | success: function (result) { | 201 | success: function (result) { |
| 211 | //返回数据根据结果进行相应的处理 | 202 | //返回数据根据结果进行相应的处理 |
| 212 | // if (result.code == 200) { | ||
| 213 | // return flag = result.data | ||
| 214 | // } | ||
| 215 | if (result.code == 210) { | 203 | if (result.code == 210) { |
| 216 | msg = result.message; | 204 | msg = result.message; |
| 217 | } | 205 | } |
| ... | @@ -220,13 +208,11 @@ function checkAppointment() { | ... | @@ -220,13 +208,11 @@ function checkAppointment() { |
| 220 | return msg; | 208 | return msg; |
| 221 | } | 209 | } |
| 222 | 210 | ||
| 223 | var yyrq; | ||
| 224 | function handle(id) { | 211 | function handle(id) { |
| 225 | 212 | periodRulesId = id | |
| 226 | let msg = checkAppointment(); | 213 | let msg = checkAppointment(); |
| 227 | if (msg != undefined) { | 214 | if (msg != undefined) { |
| 228 | //layer.msg('hello'); | 215 | //layer.msg('hello'); |
| 229 | alert(msg); | ||
| 230 | return; | 216 | return; |
| 231 | }; | 217 | }; |
| 232 | var input = $("#" + id); | 218 | var input = $("#" + id); |
| ... | @@ -252,7 +238,7 @@ function handle(id) { | ... | @@ -252,7 +238,7 @@ function handle(id) { |
| 252 | input.attr("dataName") + | 238 | input.attr("dataName") + |
| 253 | "</div>" + | 239 | "</div>" + |
| 254 | '<div class="listItem"><h3>预约时间:</h3>' + | 240 | '<div class="listItem"><h3>预约时间:</h3>' + |
| 255 | bookingDate + | 241 | yysj + |
| 256 | " " + | 242 | " " + |
| 257 | bustime + | 243 | bustime + |
| 258 | "</div>" + | 244 | "</div>" + |
| ... | @@ -281,10 +267,52 @@ function makeAppointment(data) { | ... | @@ -281,10 +267,52 @@ function makeAppointment(data) { |
| 281 | } | 267 | } |
| 282 | }); | 268 | }); |
| 283 | } | 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 | } | ||
| 287 | } | ||
| 288 | }); | ||
| 289 | } | ||
| 290 | // GET 根据预约信息标识码appointmentId查看预约详情 | ||
| 291 | function getAppointmentDetail(id){ | ||
| 292 | $.ajax({ | ||
| 293 | type: "get", //提交方式 | ||
| 294 | url: | ||
| 295 | portal.api_url + "/portal/appointmentmh/getAppointmentDetail", | ||
| 296 | data: { | ||
| 297 | appointmentId: id, | ||
| 298 | }, | ||
| 299 | dataType: "json", | ||
| 300 | //数据,这里使用的是Json格式进行传输 | ||
| 301 | success: function (result) { | ||
| 302 | //返回数据根据结果进行相应的处理 | ||
| 303 | if (result.code == 200) { | ||
| 304 | appointmentDetail(result.data); | ||
| 305 | } | ||
| 306 | else{ | ||
| 307 | alert(result.message); | ||
| 308 | } | ||
| 309 | }, | ||
| 310 | }); | ||
| 311 | } | ||
| 312 | |||
| 284 | 313 | ||
| 285 | //预约详情 | 314 | //预约详情 |
| 286 | function appointmentDetail(id) { | 315 | function appointmentDetail(data) { |
| 287 | var input = $("#" + id); | ||
| 288 | layui.use("layer", function () { | 316 | layui.use("layer", function () { |
| 289 | layer.open({ | 317 | layer.open({ |
| 290 | type: 1, | 318 | type: 1, |
| ... | @@ -296,24 +324,21 @@ function appointmentDetail(id) { | ... | @@ -296,24 +324,21 @@ function appointmentDetail(id) { |
| 296 | content: | 324 | content: |
| 297 | '<div class="infoContent">' + | 325 | '<div class="infoContent">' + |
| 298 | "<ul>" + | 326 | "<ul>" + |
| 299 | "<li><span>姓名</span>:" + getCookie().username + "</li>" + | 327 | "<li><span>姓名</span>:" + data.username + "</li>" + |
| 300 | "<li><span>身份证号</span>:" + getCookie().zjhm + "</li>" + | 328 | "<li><span>身份证号</span>:" + data.zjhm + "</li>" + |
| 301 | "<li><span>联系电话</span>:" + getCookie().phone + "</li>" + | 329 | "<li><span>联系电话</span>:" + data.phone + "</li>" + |
| 302 | "</ul>" + | 330 | "</ul>" + |
| 303 | '<div class="listItem"><h3>预约编号:</h3>' + | 331 | '<div class="listItem"><h3>预约编号:</h3>' + |
| 304 | hallname + | 332 | data.reservationNumber + |
| 305 | "</div>" + | 333 | "</div>" + |
| 306 | '<div class="listItem"><h3>预约业务:</h3>' + | 334 | '<div class="listItem"><h3>预约业务:</h3>' + |
| 307 | input.attr("dataName") + | 335 | data.hbShortname + |
| 308 | "</div>" + | 336 | "</div>" + |
| 309 | '<div class="listItem"><h3>预约时间:</h3>' + | 337 | '<div class="listItem"><h3>预约时间:</h3>' + |
| 310 | bookingDate + | 338 | data.bookingDate.substr(0,4) + '年'+data.bookingDate.substr(4,2) + '月' + data.bookingDate.substr(6,2) + '日'+data.startTime + '至'+data.endTime + |
| 311 | " " + | ||
| 312 | bustime + | ||
| 313 | "</div>" + | 339 | "</div>" + |
| 314 | '<div class="confimButton"><button type="button" class="layui-btn cancel layui-btn-primary">取消预约</button></div>' + | 340 | '<div class="confimButton"><button type="button" class="layui-btn cancel layui-btn-primary" id="canlebutton">取消预约</button></div>' + |
| 315 | "</div>", | 341 | "</div>", |
| 316 | }); | 342 | }); |
| 317 | }); | 343 | }); |
| 318 | } | 344 | } |
| 319 | ... | ... |
-
Please register or sign in to post a comment