@using YoSoft.DSM.YoDSMModel;
@using YoSoft.DSM.YoDSMBLL;
@{
Layout = "~/Views/Shared/_LayoutCompanySend.cshtml";
ViewBag.Title = "";
}
@*<link href="~/Content/person.css" rel="stylesheet" />*@
<style>

ul {
/*display: flex;*/
}

li {
position: relative;
}

#containermain {
/*margin-bottom:60px;*/
}

footer {
/*display:none;*/
}
</style>
<div class="middle-form">
<div class="weui_cell weui_cell_select weui_select_after" style="width:50%;float: left">
<div class="weui_cell_bd weui_cell_primary">
<select class="selectpicker" id="ddl_GuestName" style="width:100%">
<option value="" style="">请选择经销商</option>
@if (ViewBag.Products.Count > 0)
{
foreach (GL_GuestInfo p in ViewBag.GuestID)
{
<option value="@p.cID" style="">@p.cGuestName</option>
}
}
</select>
</div>
</div>
<div class="weui_cell weui_cell_select weui_select_after" style="width:50%;float: left">
<div class="weui_cell_bd weui_cell_primary">
<select class="selectpicker" id="ddlproduct" style="width:100%">
<option value="" style="">请选择产品</option>
@if (ViewBag.Products.Count > 0)
{
foreach (GL_GoodsInfo p in ViewBag.Products)
{
<option value="@p.cID" style="">@p.cGoodsName</option>
}
}
</select>
</div>
</div>
</div>
<div class="middle-form">
<div id="datePlugin" style="width: 50%;float: left">
<input type="text" readonly="" class="selectpicker select-input" id="txtStartDate" style="width: 100%;" name="txtStartDate" placeholder="请输入开始日期" data-lcalendar="2000-01-01,2099-12-31" />
</div> <div id="datePlugin1" style="width: 49%;float: left">
<input type="text" readonly="" class="selectpicker select-input" id="txtEndDate" style="width: 100%;" name="txtEndDate" placeholder="请输入结束日期" data-lcalendar="2000-01-01,2099-12-31" />
</div>
</div>

<div class="middle-form" style="display:none">
<button type="button" id="btn-query" class="btn btn-primary">查询</button>
</div>
<div id="containermain" class="">
<table id="tbSendList">
<thead class="thead-dark">
<tr>
<th>商品名称</th>
<th>数量</th>
</tr>
</thead>
<tbody style="height:100%;"></tbody>
</table>
<p id="mgsdone" style="display:none;padding:10px 0px;color:#AAA;font-weight:bold;text-align:center;">不要再刷啦,我是有底线的。</p>
</div>
<footer>
<div class="container-fluid navbar navbar-default navbar-fixed-bottom text-center nav-container" style="height:35px">
<div style="width: 50%;float: left;background-color:#0fcd77;font-size:18px">合计</div>
<div style="width: 50%;float: left;font-size:18px"><a id="RecordCount" style="font-size:18px">数量:0</a></div>
</div>
</footer>
<script src="~/Scripts/Person/companysend.js"></script>
<script>

</script>

var CurrentPageIndex = 1;
var PageCount = 0;
var RecordCount = 0;
var PageSize = 10;
var startY = 0;
var endY = 0;
var queryDone = true;
var bShow = false;
$(function () {
$("#mgsdone").hide();
var calendar0 = new LCalendar();
calendar0.init({
'trigger': '#txtStartDate',//标签id
'type': 'date',//date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择
'minDate': '2000-01-01',//最小日期 注意:该值会覆盖标签内定义的日期范围
'maxDate': '2099-12-31'//最大日期 注意:该值会覆盖标签内定义的日期范围
});

var calendar1 = new LCalendar();
calendar1.init({
'trigger': '#txtEndDate',//标签id
'type': 'date',//date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择
'minDate': '2000-01-01',//最小日期 注意:该值会覆盖标签内定义的日期范围
'maxDate': '2099-12-31'//最大日期 注意:该值会覆盖标签内定义的日期范围
});

$("#btn-store").click(function () {
$("#modalstore").modal("show");
});
$("#btn-product").click(function () {
$("#modalproduct").modal("show");
});
$("#btn-date").click(function () {
$("#modaldate").modal("show");
});

$("select").change(function () {
var selectVal = $(this).val();
var id = $(this).attr("id");
console.log(selectVal);
$("#" + id + " option[selected='selected']").each(function () {
//console.log(this);
if ($(this).attr("value") != selectVal) {
$(this).removeAttr("selected");
}
});

$(this).find("option[value='" + $(this).val() + "']").attr("selected", true);
CurrentPageIndex = 1;
PageCount = 0;
RecordCount = 0;
$("#mgsdone").hide();
bShow = false;
});

$("#txtStartDate").change(function () {
CurrentPageIndex = 1;
PageCount = 0;
RecordCount = 0;
alert(433443);
$("#mgsdone").hide();
bShow = false;
});

$("#txtEndDate").change(function () {
CurrentPageIndex = 1;
PageCount = 0;
RecordCount = 0;
alert(433443);
$("#mgsdone").hide();
bShow = false;

});

$("#btn-query").click(function () {
console.log('查询', CurrentPageIndex, RecordCount, PageCount);
CurrentPageIndex = 1;
PageCount = 0;
RecordCount = 0;
queryData();
$("#mgsdone").hide();
bShow = false;
});

//$(window).scroll(function () {
// var scrollTop = $(this).scrollTop(),
// scrollHeight = $(document).height(),
// windowHeight = $(this).height();
// var positionValue = (scrollTop + windowHeight) - scrollHeight;
// console.log(scrollTop, scrollHeight, windowHeight, positionValue)
// if (positionValue == 0) {
// console.log("加载");
// //do something
// }
//});
$("#containermain").on("touchstart", function (e) {
//if (e.cancelable) {
// if (!e.defaultPrevented) {
// e.preventDefault();
// }
//} 这几行不要,否则会影响滑动时的滚动惯性
startY = e.touches[0].clientY;
});

$("#containermain").on("touchend", function (e) {
//if (e.cancelable) {
// if (!e.defaultPrevented) {
// e.preventDefault();
// }
//}这几行不要,否则会影响滑动时的滚动惯性
endY = e.originalEvent.changedTouches[0].clientY,
Y = endY - startY;

//下滑
if (Y > 0) {
//$(document).scrollTop($(document).scrollTop() - Y);
console.log('下滑');
//if ($(document).scrollTop() > 0 && $(document).scrollTop() >= $(document).height() - $(window).height()) {
// console.log("滚动条已经到达底部为" + $(document).scrollTop(), ($(document).height() - $(window).height()), $(document).height(), $(window).height(),startY, endY,CurrentPageIndex);
//}
}
//上滑
else if (Y < 0) {
$(document).scrollTop($(document).scrollTop() - Y + 1);
//alert($(document).scrollTop() - Y);
//alert($(document).scrollTop());
//alert($(document).height() - $(window).height());
//console.log('上滑', $(document).scrollTop(), ($(document).height() - $(window).height()), CurrentPageIndex, RecordCount, PageCount, Y);

console.log('上滑', CurrentPageIndex, PageCount, queryDone);
if ($(document).scrollTop() > 0 && $(document).scrollTop() >= $(document).height() - $(window).height() && CurrentPageIndex <= PageCount) {
scrollLoad();
$(document).scrollTop($(document).height());
}
else if (CurrentPageIndex > PageCount & !bShow) {
bShow = true;
$("#mgsdone").show();
$(document).scrollTop($(document).height());
}

}
//单击
else {
console.log('单击', CurrentPageIndex);
//queryData();
}
});
queryData();
});

$('#ddl_GuestName,#ddlproduct').on('change', function () {
queryData();
});
function queryData() {
if (!queryDone || (CurrentPageIndex > PageCount && CurrentPageIndex > 1)) {
return;
}
queryDone = false;
var store = $("#ddlstore").val();
var product = $("#ddlproduct").val();
var guestid = $("#ddl_GuestName").val();
var startDate = $("#txtStartDate").val();
var endDate = $("#txtEndDate").val();
$("#tbSendList tbody").empty();
//console.log(CurrentPageIndex , PageCount)
$.ajax({
url: "/Person/SendList",
type: "post",
data: { store: store, product: product, startDate: startDate, endDate: endDate, PageSize: PageSize, CurrentPageIndex: CurrentPageIndex, guestid: guestid },
dataType: "json",
async: false,
success: function (data) {
//console.log(data);
//console.log($("#tbSendList tbody"));
RecordCount = data.RecordCount;
PageCount = parseInt(RecordCount / PageSize) + 1;
var iNum = 0;
var html = "";
if (data.success) {
var list = JSON.parse(data.sendlist);
console.log(list)
for (var i in list) {
html += "<tr><td>" + list[i].cGoodsName + "</td><td>" + list[i].iNum + "</td></tr>"
iNum += parseInt(list[i].iNum);
}
$('#RecordCount').text("数量:" + iNum);
$("#tbSendList tbody").html(html);
if (list.length > 0) {
CurrentPageIndex++;
}
}
else {
$("#tbSendList tbody").html('<tr><td colspan="2">没有数据</td></tr>');
}
queryDone = true;
},
error: function (err) {
console.log(err);
queryDone = true;
}

});
}

function scrollLoad() {
if (!queryDone || CurrentPageIndex > PageCount) {
return;
}
//console.log(CurrentPageIndex, PageCount)
queryDone = false;
var store = $("#ddlstore").val();
var product = $("#ddlproduct").val();
var startDate = $("#txtStarTime").val();
var endDate = $("#txtEndTime").val();
$.ajax({
url: "/Person/SendList",
type: "post",
data: { store: store, product: product, startDate: startDate, endDate: endDate, PageSize: PageSize, CurrentPageIndex: CurrentPageIndex },
dataType: "json",
async: false,
success: function (data) {
//console.log(data);
//console.log($("#tbSendList tbody"));
RecordCount = data.RecordCount;
PageCount = parseInt(RecordCount / PageSize) + 1;
var html = $("#tbSendList tbody").html();
if (data.success) {
var list = JSON.parse(data.sendlist);
console.log(list)
for (var i in list) {
html += "<tr><td>" + list[i].cGoodsName + "</td><td>" + list[i].iNum + "</td></tr>"
}
$("#tbSendList tbody").html(html);
if (list.length > 0) {
CurrentPageIndex++;
//$(document).scrollTop($(document).scrollTop() + 80);
}
}
else {
$("#tbSendList tbody").html('<tr><td colspan="2">没有数据</td></tr>');
}
queryDone = true;
},
error: function (err) {
console.log(err);
queryDone = true;
}

});
}

HTML5滚动加载的更多相关文章

  1. HTML5商城开发一 楼层滚动加载数据

    对于楼层加载在以前只是个想法,从来没实现过,刚好项目中碰到,再此总结一下 场景:HTML5,局部商品列表信息滚动(局部滚动条) 1.通过jq设置subCategoryScroll的高度为屏幕显示高度( ...

  2. js 滚动加载iframe框中内容

    var isIE6 = !!window.ActiveXObject&&!window.XMLHttpRequest; //滚动加载 var scrollLoad =function( ...

  3. [转] Jquery滚动加载

    原文地址:http://hi.baidu.com/vipxiaofan/item/9eb927b795671f77254b0985 另外一个asp.net的例子:http://blog.csdn.ne ...

  4. js滚动加载小插件

    本文实例讲述了jquery滚动加载数据的方法.分享给大家供大家参考.具体分析如下: 少废话直接上代码!!!粗暴,直接,干脆 0//lk-2017-05-04 1(function($, win) { ...

  5. 基于 Vue.js 的移动端组件库mint-ui实现无限滚动加载更多

    通过多次爬坑,发现了这些监听滚动来加载更多的组件的共同点, 因为这些加载更多的方法是绑定在需要加载更多的内容的元素上的, 所以是进入页面则直接触发一次,当监听到滚动事件之后,继续加载更多, 所以对于无 ...

  6. 记录WEUI中滚动加载的一个BUG

    最近写微信公众号,用到的技术栈是jq+vue的混合开发,采用的UI是移动端比较火的WEUI,在微信开发中应该较广泛.个人看惯了elementUI文档,相对于饿了么组件文档的详细,WEUI的文档还是比较 ...

  7. HTML5 预加载

    原文地址: HTML5 Link Prefetching 原文日期: 2010年07月07日 翻译日期: 2013年08月13日 浏览器厂商和开发者之间共同努力的一个方向就是让网站更快.现在已有很多广 ...

  8. 兼容IE8,滚动加载下一页

    // 滚动加载下一页         var nowScrolledHeight = document.documentElement.scrollTop || document.body.scrol ...

  9. vue2.0无限滚动加载数据插件

      做vue项目用到下拉滚动加载数据功能,由于选的UI库(element)没有这个组件,就用Vue-infinite-loading 这个插件代替,使用中遇到的一些问题及使用方法,总结作记录! 安装: ...

随机推荐

  1. 在Vuex更新,组件内的视图更新问题

    由于js的限制,vue无法进行监听数组; 当你利用索引直接设置一个项时,例如: vm.items[indexOfItem] = newValue 当你修改数组的长度时,例如: vm.items.len ...

  2. windy数

    windy数指的是相邻两位差至少为2的数.问区间[a,b]中有多少个windy数 调了半个多小时,不过调出来之后对数位dp理解大大加深 #include<iostream> #includ ...

  3. c++ STL概述

    2018-09-26 c++ STL(标准模板库)是一套通过c++模板类实现的标准类库,提供了通用的模板和函数,功能强大,大大的提高了c++的开发效率. c++ STL的核心主要包括三个组件:(1)容 ...

  4. 使用genism训练词向量【转载】

    转自:https://blog.csdn.net/qq_16912257/article/details/79099581 https://blog.csdn.net/thriving_fcl/art ...

  5. Windows环境下安装Oracle数据库

    Windows环境 1.解压文件 1)Oracle下载官网地址: http://www.oracle.com/technetwork/cn/database/enterprise-edition/do ...

  6. 白话skynet第一篇

    当你走过一个坐在自己店门前的杂货商面前.走过一个吸着烟斗的守门人面前,走过一个马车夫面前时,请你给我描绘一下这个杂货商.守门人和马车夫,他们的姿态,他们的外貌,要用画家那样的细节描绘出他们的精神本质, ...

  7. HTTP 返回状态代码

    一.HTTP状态码 如果某项请求发送到您的服务器要求显示您网站上的某个网页(例如,用户通过浏览器访问您的网页或 Googlebot 抓取网页时),服务器将会返回 HTTP 状态代码以响应请求. 此状态 ...

  8. 1、写在开头的话——Tinking in Java 绪论之我见

    新兵道歉!版式不懂,技术若有错误,请指正,或发我邮箱1300431700@qq.com 不胜感激! 本文力图通过文章总结的形式,阐述自己的观点,迫使自己思考书中精髓,即使跟技术无关! 正文开始! “上 ...

  9. Oracle游标使用

    Oracle游标介绍: --声明游标 CURSOR cursor_name IS select_statement --For 循环游标 --()定义游标 --()定义游标变量 --()使用for循环 ...

  10. Spring Boot:简介

    一.概述 Spring Boot 是Java一个开源框架,主要用途是用来创建微服务:可以用来创建独立的.生产的基于Spring的应用程序. Spring Boot 采用默认配置观点,多数Spring ...