403 lines
15 KiB
HTML
403 lines
15 KiB
HTML
<!doctype html>
|
||
<html>
|
||
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
|
||
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
|
||
<title></title>
|
||
<link rel="stylesheet" type="text/css" href="/css/api.css" />
|
||
<link rel="stylesheet" type="text/css" href="/css/content.css" />
|
||
<script type="text/javascript" src="/scripts/jquery-2.0.2.min.js"></script>
|
||
<script type="text/javascript" src="/scripts/jquery.cookie.min.js"></script>
|
||
<!--<script type="text/javascript" src="/scripts/iscroll.js"></script>-->
|
||
<script type="text/javascript" src="/script/main.js?t=0"></script>
|
||
<script type="text/javascript" src="/layer/layer.js"></script>
|
||
<script type="text/javascript" src="/Scripts/long.js"></script>
|
||
<script type="text/javascript" src="/script/moment.js"></script>
|
||
<script type="text/javascript" src="/script/api.js"></script>
|
||
<style type="text/css">
|
||
html, body {
|
||
overflow: hidden;
|
||
}
|
||
|
||
#wrapper {
|
||
flex: 1;
|
||
overflow-y: auto;
|
||
-webkit-overflow-scrolling: touch;
|
||
}
|
||
.dbtnbox input[type='button'] {
|
||
height: 2.5em;
|
||
line-height: 2.5em;
|
||
}
|
||
|
||
.text {
|
||
margin-top: 1.6em;
|
||
}
|
||
|
||
.text text {
|
||
color: #000;
|
||
}
|
||
|
||
.mybalance-item {
|
||
float: none;
|
||
}
|
||
|
||
.mybalance-item div {
|
||
float: none;
|
||
}
|
||
|
||
.mybalance-item div .mybtn {
|
||
padding: 0.3em 0.5em;
|
||
color: #fff;
|
||
border-radius: 0.5em;
|
||
}
|
||
</style>
|
||
<script type="text/javascript">
|
||
var userId = null;
|
||
var LoginId = null;
|
||
var CartId = null;
|
||
var t=0;
|
||
var opentimes = null;
|
||
var myScroll = null;
|
||
var pullDown = 1; // 下拉刷新避免多次执行
|
||
var pullUp = 1; // 上拉加载避免多次执行
|
||
var downHeight = 0;
|
||
var upHeight = 0;
|
||
var isload = true;//设置是否终止滚动加载
|
||
var curScrollHeight = 0;//当前滚动位置
|
||
var curCount = 1;//计数器,防止滚动时重复执行加载下一页
|
||
$(document).ready(function () {
|
||
userId = getlocalStorage("userId");
|
||
LoginId = getlocalStorage("LoginId");
|
||
CartId = getlocalStorage("CartId");
|
||
|
||
rdata(1);
|
||
|
||
|
||
|
||
|
||
});
|
||
|
||
function onScroll0() {
|
||
isload = true;//设置是否终止滚动加载
|
||
curScrollHeight = 0;//当前滚动位置
|
||
curCount = 1;//计数器,防止滚动时重复执行加载下一页
|
||
$("#wrapper").scroll(function () {
|
||
var pageHeight = $("#sysnew").height();
|
||
var showHeight = $("#wrapper").height();
|
||
var scrollHeight = $("#wrapper").scrollTop();
|
||
|
||
if (curScrollHeight - scrollHeight < 10 && curScrollHeight > 0) {
|
||
if (curCount == 1 && isload) {
|
||
|
||
rdata(0);
|
||
}
|
||
curCount++; //加载下一页后计数器+1
|
||
}
|
||
if (curScrollHeight < scrollHeight) {
|
||
curScrollHeight = pageHeight - showHeight;//滚动到页面底部时,重设当前滚动位置
|
||
curCount = 1;
|
||
}
|
||
|
||
});
|
||
}
|
||
|
||
function rdata(ag) {
|
||
userId = getlocalStorage("userId");
|
||
LoginId = getlocalStorage("LoginId");
|
||
var Start = $("#sysnew .databox").length;
|
||
|
||
if (ag == 1) {
|
||
Start = 0;
|
||
}
|
||
$(".ajaxLoader").removeClass("uhide");
|
||
$.ajax({
|
||
type: 'GET',
|
||
url: "/apiajax.ashx",
|
||
data: "&action=getRestDaydata&ifweb=1&Start=" + Start + "&userId=" + (userId != null ? userId : "") + "&LoginId=" + (LoginId != null ? LoginId : ""),
|
||
dataType: "JSON",
|
||
error: function (xhr, type) {
|
||
tishi3("发生错误:" + JSON.stringify(xhr));
|
||
},
|
||
success: function (data) {
|
||
|
||
|
||
if (data) {
|
||
if (data.status == 1) {
|
||
|
||
var html = "";
|
||
|
||
if (data.data.length > 0) {
|
||
var html = "";
|
||
for (i = 0; i < data.data.length; i++) {
|
||
var bifshow = 0;
|
||
if (ag == 0) {
|
||
if ($("#databox_" + data.data[i].id).length == 0) {
|
||
bifshow = 1;
|
||
}
|
||
} else {
|
||
bifshow = 1;
|
||
}
|
||
if (bifshow == 1) {
|
||
html += addMsg(data.data[i]);
|
||
}
|
||
}
|
||
if (ag == 1 || ag == 2) {
|
||
$("#sysnew").html(html);
|
||
if (ag == 1) {
|
||
onScroll0();
|
||
}
|
||
} else {
|
||
$("#sysnew").append(html);
|
||
}
|
||
$(".more_box").html("");
|
||
} else {
|
||
isload = false;
|
||
if (Start > 0) {
|
||
if (Start > 10) {
|
||
$(".more_box").html("亲!找不到更多了");
|
||
|
||
}
|
||
} else {
|
||
$('#sysnew').html("");
|
||
$(".more_box").html("亲,您还没有添加休息日!");
|
||
}
|
||
}
|
||
$(".ajaxLoader").addClass("uhide");
|
||
} else {
|
||
|
||
tishi3(data.msg);
|
||
$(".ajaxLoader").addClass("uhide");
|
||
if (data.msg == "您未登录") {
|
||
//$api.rmStorage("userId");
|
||
//$api.rmStorage("LoginId");
|
||
}
|
||
}
|
||
} else {
|
||
tishi3("网络错误!");
|
||
$(".ajaxLoader").addClass("uhide");
|
||
}
|
||
}
|
||
});
|
||
|
||
}
|
||
function addMsg(param) {
|
||
var html = '<div class="mybalance-item databox" id="databox_' + param.id + '">';
|
||
html += '<div class="Total">';
|
||
html += '<div><span>' + param.dates + '</span></div>';
|
||
html += '</div>';
|
||
html += '<div class="Total0">';
|
||
html += '<div onclick="stopPropagation(event)"><input id="qlqbtn' + param.id + '" type="button" class="mybtn" onclick="dellog(' + param.id + ')" value="删除" /></div>';
|
||
|
||
html += '</div></div>';
|
||
html += '<div class="clear"></div>';
|
||
return html;
|
||
}
|
||
function ondatetype(){
|
||
var datetype=parseInt($("#datetype").val());
|
||
if(datetype==1){
|
||
$("#gddate").addClass("uhide");
|
||
$("#gddate0").addClass("uhide");
|
||
$("#jjrdate").removeClass("uhide");
|
||
}else{
|
||
$("#gddate").removeClass("uhide");
|
||
$("#gddate0").removeClass("uhide");
|
||
$("#jjrdate").addClass("uhide");
|
||
}
|
||
}
|
||
|
||
function dellog(id) {
|
||
var index_ = layer.confirm('您确定要删除此休息日吗?', {
|
||
title: "删除提醒",
|
||
btn: ['是', '否'] //按钮
|
||
}, function () {
|
||
$.ajax({
|
||
type: 'POST',
|
||
url: "/apiajax.ashx?ifweb=1",
|
||
data: { "action": "DelRestDay", "userId": userId, "LoginId": LoginId, "Id": id },
|
||
dataType: "json",
|
||
error: function (xhr) {
|
||
tishi3("发生错误:" + JSON.stringify(xhr));
|
||
},
|
||
success: function (data) {
|
||
if (data.status == 1) {
|
||
tishi3(data.msg);
|
||
$("#databox_" + id).hide();
|
||
} else {
|
||
tishi3(data.msg);
|
||
}
|
||
layer.close(index_);
|
||
}
|
||
});
|
||
}
|
||
);
|
||
}
|
||
function onsave() {
|
||
var datetype=parseInt($("#datetype").val());
|
||
var Startdate="";
|
||
var Enddate="";
|
||
var ifb=true;
|
||
if(datetype==0){
|
||
Startdate=fTrim($("#txtStartdate").val());
|
||
Enddate=fTrim($("#txtEnddate").val());
|
||
if(Startdate==""){
|
||
ifb=false;
|
||
toast("开始日期不能为空");
|
||
}
|
||
if(ifb){
|
||
if(Enddate==""){
|
||
ifb=false;
|
||
toast("结束日期不能为空");
|
||
}
|
||
}
|
||
}
|
||
if (ifb) {
|
||
if ($("#savebtn").val() == "请稍候...") {
|
||
ifb = false;
|
||
}
|
||
}
|
||
if (ifb) {
|
||
$("#savebtn").val("请稍候...");
|
||
|
||
try {
|
||
var datas = {
|
||
action: "addRestDay",
|
||
userId: userId,
|
||
LoginId: LoginId,
|
||
IFLeday:datetype,
|
||
Startdate:Startdate,
|
||
Enddate:Enddate
|
||
};
|
||
$.ajax({
|
||
type: 'POST',
|
||
url: "/apiajax.ashx?ifweb=1",
|
||
data: datas,
|
||
dataType: "json",
|
||
error: function (xhr) {
|
||
tishi3("发生错误:" + JSON.stringify(xhr));
|
||
},
|
||
success: function (data) {
|
||
|
||
$("#savebtn").val("添加休息日");
|
||
if (data) {
|
||
if (data.status == 1) {
|
||
tishi3(data.msg);
|
||
rdata(1);
|
||
} if (data.status == 0) {
|
||
tishi3(data.msg);
|
||
}
|
||
} else {
|
||
tishi3('网络异常,请稍后重试');
|
||
}
|
||
}
|
||
});
|
||
} catch (err) {
|
||
tishi3(err);
|
||
}
|
||
}
|
||
}
|
||
|
||
</script>
|
||
|
||
</head>
|
||
|
||
<body class="wrap">
|
||
<header>
|
||
<div class="ub">
|
||
<div class="nav-btn" id="nav-left" style=" margin:0; padding:0; padding-top:0.2em; min-width:3em" onclick="closeWin()">
|
||
|
||
<img src="../image/faifei.png" style="margin-left:0; margin-top:0em; height:1.2em;width:1.2em;" />
|
||
|
||
|
||
</div>
|
||
<h1 class="ub-f1">
|
||
<div class="tab flex-around">
|
||
<a href="mybusiness_hours.html">营业时间设置</a>
|
||
<a class="on">休息日设置</a>
|
||
</div>
|
||
</h1>
|
||
<div class="nav-btn blue" id="nav-right" style=" margin:0; padding:0; min-width:3em; padding-right:1em;">
|
||
</div>
|
||
</div>
|
||
</header>
|
||
<section class="ub-f1" id="wrapper">
|
||
<div class="ub ub-ac" style="background-color: #FFFFFF;margin-bottom: .08em;">
|
||
<div class="ub ub-f1" style="padding:0.8em;width:4em;">
|
||
日期类型<font color="red">*</font>
|
||
</div>
|
||
<div class="ub ub-ac ub-pc">
|
||
<div class="ub ub-ac ub-pc" style=" margin-right: 2.4em">
|
||
|
||
<select id="datetype" onchange="ondatetype()" style="width: 10em; height:2.2em;">
|
||
<option value="0">固定日期</option>
|
||
<option value="1">法定节假日</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
<div class="ub ub-ac" id="gddate" style="background-color: #FFFFFF;margin-bottom: .08em 0; box-sizing:border-box;">
|
||
<div class="ub ub-f1" style="padding:0.8em;width:4em;">
|
||
开始日期<font color="red">*</font>
|
||
</div>
|
||
<div class="ub ub-ac ub-pc">
|
||
<div class="ub ub-ac ub-pc uinput11" style="width:10em;padding-right: 1.6em">
|
||
<input type="date" id="txtStartdate" style=" width: 10em;" placeholder="格式:yyyy-MM-dd" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="ub ub-ac" id="gddate0" style="background-color: #FFFFFF;margin-bottom: .08em;">
|
||
<div class="ub ub-f1" style="padding:0.8em;width:4em;">
|
||
结束日期<font color="red">*</font>
|
||
</div>
|
||
<div class="ub ub-ac ub-pc">
|
||
<div class="ub ub-ac ub-pc uinput11" style="width:10em;padding-right: 1.6em">
|
||
<input type="date" id="txtEnddate" style=" width: 10em;" placeholder="格式:yyyy-MM-dd" />
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="ub ub-ac uhide" id="jjrdate" style="background-color: #FFFFFF;margin-bottom: .08em 0; box-sizing:border-box;">
|
||
<div class="ub ub-f1" style="padding:0.8em;width:4em;">
|
||
节假日<font color="red">*</font>
|
||
</div>
|
||
<div class="ub ub-ac ub-pc">
|
||
<div class="ub ub-ac ub-pc uinput11" style="width:10em;padding-right: 1.6em">
|
||
包括元旦、春节、清明节、劳动节、端午节、中秋节+国庆节
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<footer style="border:0; background:none; margin-top:0.8em;">
|
||
<div class="dbtnbox">
|
||
|
||
<input id="savebtn" type="button" class="mybtn" onclick="onsave()" value="添加休息日">
|
||
|
||
</div>
|
||
|
||
</footer>
|
||
<div class="clear"></div>
|
||
<div class="text" style="padding-left:0.8em;">
|
||
<div class="line_flag"></div>
|
||
<text style="flex-grow:1;">休息日列表</text>
|
||
<!--<span style="float:right;width:auto; margin-top:0em; height:2.2em; line-height:2.2em; color:#fff;background-color:#00B050;border-radius: 1.2em;padding:0 0.8em;border:1px solid #02662F;" onclick='tishi3("正在建设中...")'>添加休息日</span>-->
|
||
</div>
|
||
<div class="ub ub-ver" id="sysnew" style="border-radius:0.4em;padding:0.8em;box-sizing: border-box;"> </div>
|
||
<div class="clear"></div>
|
||
<div class="more_box"></div>
|
||
|
||
|
||
</section>
|
||
|
||
<div class="ajaxLoader ub ub-ac uhide" onclick="reload()">
|
||
<div class="ub ub-ac ub-ver"><img src="image/load.gif" /><br>正在加载...</div>
|
||
</div>
|
||
|
||
</body>
|
||
|
||
|
||
</html>
|