|
@@ -1,4 +1,5 @@
|
|
|
//@ sourceURL=request-holidays-config.js
|
|
|
+var switchery;
|
|
|
$(function () {
|
|
|
$(".selectpicker").selectpicker({
|
|
|
dropuAuto: false
|
|
@@ -144,14 +145,87 @@ $(function () {
|
|
|
$("#editModal").modal();
|
|
|
clearInput();
|
|
|
});
|
|
|
+ //周末是否免费设置
|
|
|
+ $("#btn_weekend").click(function (t) {
|
|
|
+ $("#weekendModal").modal();
|
|
|
|
|
|
+ //查询已经设置好的结果,回显
|
|
|
+ $.ajax({
|
|
|
+ type: "GET",
|
|
|
+ url: '/thmz/getConfigByKey?key=weekend_fee',
|
|
|
+ dataType: "json",
|
|
|
+ headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
|
|
|
+ success: function (res) {
|
|
|
+ if (res == '401' || res == 401) {
|
|
|
+ window.location.href = '/thmz/login/view'
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(res.data.configValue=='0'){
|
|
|
+ setSwitchery(false);
|
|
|
+ }else {
|
|
|
+ setSwitchery(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
|
|
|
$("#saveEdit").click(function (t) {
|
|
|
saveHolidays();
|
|
|
});
|
|
|
+
|
|
|
+ var elem = document.querySelector('.js-switch');
|
|
|
+ //size 设置禁用可用按钮的大小、secondaryColor:设置右边的颜色为红色
|
|
|
+ switchery = new Switchery(elem,{
|
|
|
+ color: "#26B99A"
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $('#saveWeekend').click(function () {
|
|
|
+ var weekendFee=$("input:checkbox:checked").val();
|
|
|
+ if(weekendFee=='on'){
|
|
|
+ weekendFee='1';
|
|
|
+ }else {
|
|
|
+ weekendFee='0';
|
|
|
+ }
|
|
|
+ //修改周末是否免费设置
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ contentType: "application/json;charset=UTF-8",
|
|
|
+ url: '/thmz/setConfig',
|
|
|
+ dataType: "json",
|
|
|
+ data: JSON.stringify({"configKey": "weekend_fee","configValue": weekendFee}),
|
|
|
+ headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
|
|
|
+ success: function (res) {
|
|
|
+ if (res == '401' || res == 401) {
|
|
|
+ window.location.href = '/thmz/login/view'
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (res.code == 0) {
|
|
|
+ $("#weekendModal").modal('hide');
|
|
|
+ successMesage(res);
|
|
|
+ } else {
|
|
|
+ errorMesage(res);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
});
|
|
|
|
|
|
|
|
|
+/**
|
|
|
+ * 切换Switchery开关函数 switchElement Switchery对象,checkedBool 选中的状态
|
|
|
+ */
|
|
|
+function setSwitchery(checkedBool) {
|
|
|
+ if((checkedBool && !switchery.isChecked()) || (!checkedBool && switchery.isChecked())) {
|
|
|
+ switchery.setPosition(true);
|
|
|
+ switchery.handleOnchange(true);
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
|
|
|
/**
|