yysj.js
4.87 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
$(function () {
var Date = undefined;
var appuintText = undefined
var bustime = undefined;
// 国有房屋无业点击选中记录
var busIndex = undefined
var data = {
'dateList': [
{
week: '星期一',
date: '10月15号',
isSelect: true
},
{
week: '星期二',
date: '10月16号'
},
{
week: '星期三',
date: '10月17号'
},
{
week: '星期二',
date: '10月18号'
},
{
week: '星期五',
date: '10月19号'
},
{
week: '星期六',
date: '10月19号'
}
],
"list": ['上午:09:00-10:00', '上午:10:00-11:00', '上午:11:00-12:00', '下午:14:00-15:00', '下午:15:00-16:00'],
"appint_detail": [
{
'total': 2
},
{
'total': 2
},
{
'total': 0
},
{
'total': 0
},
{
'total': 1
}
]
};
// 获取当前选中的日期
// for (var i = 0; i < data.dateList.length; i++) {
// if (data.dateList[i].isSelect) {
// Date = data.dateList[i].date
// break
// }
// };
layui.use('element', function () {
let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
//监听导航点击
element.on('nav(demo)', function (elem) {
layer.msg(elem.text());
});
});
function a(i) {
Date = data.dateList[i].date
$(".swiper-slide").eq(i).addClass('active').siblings().removeClass('active');
}
$('.business_list li').click(function () {
// 获取元素
appuintText = $(this).find('a').text()
$('.layui_anim_list').removeClass('disnone')
$('.layui_anim_content').show()
var demo = $('.layui-anim')
$('html,body').addClass('ovfHiden');
var othis = demo, anim = othis.data('anim');
othis.removeClass(anim);
setTimeout(function () {
demo.show()
othis.addClass(anim);
});
// 获取当前点击li 的下标
let index = $(this).index()
busIndex = index
})
layui.use('laytpl', function () {
laytpl = layui.laytpl;
var getTpl = document.getElementById('date').innerHTML
, view = document.getElementById('swiperDate');
laytpl(getTpl).render(data, function (html) {
view.innerHTML = html;
});
var getTpl = document.getElementById('appoint_timeList').innerHTML
, view = document.getElementById('view');
laytpl(getTpl).render(data, function (html) {
view.innerHTML = html;
});
var getTpl = document.getElementById('appint_detail').innerHTML
, view = document.getElementById('view1');
laytpl(getTpl).render(data, function (html) {
view.innerHTML = html;
});
});
var swiper = new Swiper('.swiper-container', {
slidesPerView: 5,
spaceBetween: 20,
slidesPerGroup: 1,
observer: true,
observeParents: true,
on: {
click: function (swiper) {
var index = swiper['clickedIndex'];
a(index);
}
},
loopFillGroupWithBlank: true,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
});
$(document).on('click', '.able_appint', function () {
$('.able_appint').removeClass("able_appintActive")
$(this).addClass("able_appintActive")
let index = $(this).index()
// 获取当前选中的日期
bustime = data.list[index]
modleClose()
$(".business_list li .allowedMask").remove()
$(".business_list li .reserved").remove()
var str = "<div class='reserved'> <i class='layui-icon layui-icon-log'></i> <div><p>" + appuintText + "</p><p>" + bustime + "</p></div> <i class='layui-icon appintDel layui-icon-reduce-circle'></i></div>"
$(".business_list li").append('<div class="allowedMask"></div>');
$(".business_list li:eq(" + busIndex + ") a").removeClass('not-allowed')
$(".business_list li").eq(busIndex).append(str);
$(".business_list li:eq(" + busIndex + ") a").hide()
});
// 删除预约记录
$(document).on('click', '.appintDel', function (event) {
$('.layui_anim_list').addClass('disnone')
$('.able_appint').removeClass('able_appintActive')
layui.use('layer', function () {
var layer = layui.layer;
layer.confirm('此操作将删除预约记录,是否继续', {
btn: ['取消', '继续'] //按钮
}, function () {
layer.closeAll();
modleClose()
}, function () {
modleClose()
$(".business_list li a").show()
$(".business_list li .allowedMask").remove()
$(".business_list li .reserved").remove()
});
});
});
$(document).on('click', '.allowedMask', function () {
$('.layui_anim_list').addClass('disnone')
modleClose()
});
});
function modleClose() {
$('.layui_anim_content').hide()
$('.layui-anim').hide()
$('html,body').removeClass('ovfHiden');
}