d5b16982 by 焦小希

预约时间代码修改

1 parent c1822b35
......@@ -17,7 +17,7 @@ $(function () {
});
});
function a(i) {
function a(i) {
Date = data.dateList[i].jyjh;
bookingDate = data.dateList[i].bookingDate;
bustime = data.dateList[i].week;
......@@ -46,21 +46,6 @@ $(function () {
prevEl: ".swiper-button-prev",
},
});
function detailHandle() {
layui.use("layer", function () {
layer.open({
type: 1,
title: "请确认以下信息",
shadeClose: false,
area: ["500px", "320px"],
scrollbar: false,
skin: "confimInfo",
content: '123',
});
});
}
$(document).on("click", ".cancel", function () {
layer.closeAll();
});
......@@ -72,7 +57,15 @@ $(function () {
makeAppointment(paramsobj)
});
});
$(document).on('click','#canlebutton',function(){
console.log(2323)
var obj = {}
obj.appointmentId = cancleId,
obj.userid = getCookie().userid
obj.jgid = GetQueryString("jgid"),
obj.periodRulesId = choosePeriodRulesId,
cancleAppointment(obj)
})
//获取当前页面预约日期
function getAppointmentDay() {
$.ajax({
......@@ -116,28 +109,26 @@ function getAppointmentPeriodAndBusiness() {
if (result.code == 200 && result.data != null) {
console.log(result.data)
data.busList = result.data.appointmentPeriodBusinessList;
choosePeriodRulesId = result.data.choosePeriodRulesId
cancleId = result.data.appointmentId
RenderBusinessList(result.data);
if (data.busList.length > 0) {
data.busList.forEach((item, index) => {
hallname = item.orgBusinessList[0].jgName
})
}
}
},
});
}
var bookingDate = undefined;
var flag = undefined;
var msg = undefined;
var hallname = undefined;
var periodRulesId = undefined
var choosePeriodRulesId = undefined
var appointmentId = undefined
var periodRulesId = undefined
var cancleId = undefined
var data = {
dateList: [],
busList: [
......@@ -169,7 +160,7 @@ function RenderBusinessList(data) {
if (data.choosePeriodRulesId == childItem.periodRulesId) {
businessContent += '<li class="isAppoint" style="border: 1px solid red ;" data-id="' + childItem.periodRulesId + '">';
businessContent += '<h3>' + childItem.shortName + '</h3>';
businessContent += '<input type="button" value="查看详情" id="' + childItem.periodRulesId + '" dataName="' + childItem.shortName + '" onclick="appointmentDetail(this.id)"/>';
businessContent += '<input type="button" value="查看详情" id="' + data.appointmentId + '" dataName="' + childItem.shortName + '" onclick="getAppointmentDetail(this.id)"/>';
}
else {
businessContent += '<li class="isAppoint">';
......@@ -209,9 +200,6 @@ function checkAppointment() {
//数据,这里使用的是Json格式进行传输
success: function (result) {
//返回数据根据结果进行相应的处理
// if (result.code == 200) {
// return flag = result.data
// }
if (result.code == 210) {
msg = result.message;
}
......@@ -220,13 +208,11 @@ function checkAppointment() {
return msg;
}
var yyrq;
function handle(id) {
periodRulesId = id
let msg = checkAppointment();
if (msg != undefined) {
//layer.msg('hello');
alert(msg);
return;
};
var input = $("#" + id);
......@@ -252,7 +238,7 @@ function handle(id) {
input.attr("dataName") +
"</div>" +
'<div class="listItem"><h3>预约时间:</h3>' +
bookingDate +
yysj +
"&nbsp;&nbsp;" +
bustime +
"</div>" +
......@@ -281,10 +267,52 @@ function makeAppointment(data) {
}
});
}
// 用户取消预约
function cancleAppointment(data) {
$.ajax({
type: "post", //提交方式
url: portal.api_url + "/portal/appointmentmh/cancleAppointment",//路径
headers: {//***关键******
'Content-Type': 'application/json;charset=UTF-8',
},
dataType: "json",
data: JSON.stringify(data),//***关键******
success: function (result) {//返回数据根据结果进行相应的处理
if (result.code == 200 && result.data !== null) {
console.log('取消预约成功')
// a(i)
// appointmentId = result.data
// window.location.href = "./yyjg.html?appointmentId=" + appointmentId
}
}
});
}
// GET 根据预约信息标识码appointmentId查看预约详情
function getAppointmentDetail(id){
$.ajax({
type: "get", //提交方式
url:
portal.api_url + "/portal/appointmentmh/getAppointmentDetail",
data: {
appointmentId: id,
},
dataType: "json",
//数据,这里使用的是Json格式进行传输
success: function (result) {
//返回数据根据结果进行相应的处理
if (result.code == 200) {
appointmentDetail(result.data);
}
else{
alert(result.message);
}
},
});
}
//预约详情
function appointmentDetail(id) {
var input = $("#" + id);
function appointmentDetail(data) {
layui.use("layer", function () {
layer.open({
type: 1,
......@@ -296,24 +324,21 @@ function appointmentDetail(id) {
content:
'<div class="infoContent">' +
"<ul>" +
"<li><span>姓名</span>:" + getCookie().username + "</li>" +
"<li><span>身份证号</span>:" + getCookie().zjhm + "</li>" +
"<li><span>联系电话</span>:" + getCookie().phone + "</li>" +
"<li><span>姓名</span>:" + data.username + "</li>" +
"<li><span>身份证号</span>:" + data.zjhm + "</li>" +
"<li><span>联系电话</span>:" + data.phone + "</li>" +
"</ul>" +
'<div class="listItem"><h3>预约编号:</h3>' +
hallname +
data.reservationNumber +
"</div>" +
'<div class="listItem"><h3>预约业务:</h3>' +
input.attr("dataName") +
data.hbShortname +
"</div>" +
'<div class="listItem"><h3>预约时间:</h3>' +
bookingDate +
"&nbsp;&nbsp;" +
bustime +
data.bookingDate.substr(0,4) + '年'+data.bookingDate.substr(4,2) + '月' + data.bookingDate.substr(6,2) + '日'+data.startTime + '至'+data.endTime +
"</div>" +
'<div class="confimButton"><button type="button" class="layui-btn cancel layui-btn-primary">取消预约</button></div>' +
'<div class="confimButton"><button type="button" class="layui-btn cancel layui-btn-primary" id="canlebutton">取消预约</button></div>' +
"</div>",
});
});
}
......