var url = null;
|
var dateTime; //日期:yyyy-MM-dd
|
var inRecordData = null;
|
var data = {
|
"interfaceId": "5203",
|
"sign": "10203",
|
"outId": "10203",
|
"reqDateTime": new Date(),
|
"tokenAuth": "",
|
"data": {
|
"deptId": "",
|
"dateTime": ''
|
}
|
};
|
|
//初始化数据
|
function init() {
|
var user = JSON.parse(localStorage.getItem('user'));
|
var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId'));
|
url = user.url + "/api-phone/v35/gateway";
|
data.tokenAuth = user.tokenAuth;
|
data.data.deptId = selectDeptId;
|
|
//获取当前天时间
|
dateTime = getDate(new Date());
|
$("#dateTime").val(dateTime);
|
|
//获取入库记录
|
getInRecordList();
|
}
|
|
//查询入库记录
|
function getInRecordList() {
|
inRecordData = null;
|
|
//赋值参数的日期
|
data.data.dateTime = dateTime;
|
|
//请求
|
mui.ajax(url, {
|
type: "POST",
|
dataType: "json",
|
crossDomain: true,
|
contentType: "application/json;charset=utf-8",
|
data: JSON.stringify(data),
|
success: function(result) {
|
if (result.code == "0000") {
|
inRecordData = result.data;
|
renderData();
|
} else {
|
renderData();
|
mui.toast(result.mag);
|
}
|
},
|
error: function() {
|
mui.alert("系统繁忙,请重试!", "提示", ["确定"], function() {}, "div")
|
}
|
})
|
}
|
|
//渲染页面
|
function renderData() {
|
|
var html = '';
|
var sumHtml = '0';
|
if(inRecordData){
|
sumHtml = inRecordData.sum;
|
|
var inRecordList = inRecordData.listInout;
|
if (inRecordList && inRecordList.length > 0) {
|
$.each(inRecordList, function(index, item) {
|
html += '<div class="item">';
|
html += '<div class="id">单据号: ' + item.id + '</div>';
|
html += '<ul class="g-listb2">';
|
html += '<li><div class="con" style="background-image: url(images/icons/g-i24.png);">';
|
html += '车牌号:<b>' + (item.plateNum == null ? "" : item.plateNum) + '</b></div></li>';
|
html += '<li><div class="con" style="background-image: url(images/icons/g-i25.png);">';
|
html += '仓库名称:<b>' + (item.depotName == null ? "" : item.depotName) + '</b></div></li>';
|
html += '<li><div class="con" style="background-image: url(images/icons/g-i32.png);">';
|
html += '粮食品种:<b>' + (item.foodVarietyName == null ? "" : item.foodVarietyName) + '</b></div></li>';
|
html += '<li><div class="con" style="background-image: url(images/icons/g-i24.png);">';
|
html += '结算重量:<span><em>' + (item.recordWeight == null ? "0" : item.recordWeight) + '</em>KG</span></div></li>';
|
html += '</ul><div class="time">完成时间:' + getStrDate(item.completeTime) + '</div></div>';
|
})
|
} else {
|
html += '<div class="id" style="text-align: center;font-size: 20px;color:#dd524d">所选日期暂无入库记录信息</div>';
|
}
|
}else{
|
html += '<div class="id" style="text-align: center;font-size: 20px;color:#dd524d">所选日期暂无入库记录信息</div>';
|
}
|
$("#sum").html(sumHtml);
|
$("#recordList").html(html);
|
}
|
|
//加减天
|
function addAndReduceMonth(tag) {
|
var date = new Date(dateTime);
|
|
date = date.setDate(date.getDate() + tag);
|
date = new Date(date);
|
dateTime = getDate(date);
|
$("#dateTime").val(dateTime);
|
|
getInRecordList();
|
}
|
|
//选择日期
|
function chooseDate() {
|
var dtpicker = new mui.DtPicker({
|
type: "date" //设置日历初始视图模式
|
})
|
dtpicker.show(function(e) {
|
dateTime = e.value;
|
$("#dateTime").val(dateTime);
|
})
|
|
getInRecordList();
|
}
|
|
//默认获取当前日期(yyyy-MM-dd)
|
function getDate(date) {
|
var year = date.getFullYear();
|
var month, day;
|
month = date.getMonth() + 1;
|
if (month >= 1 && month <= 9) {
|
month = "0" + month;
|
}
|
day = date.getDate();
|
if (day >= 1 && day <= 9) {
|
day = "0" + day;
|
}
|
return year + "-" + month + "-" + day;
|
}
|
|
//获取日期格式(yyyy-MM-dd HH:mm)
|
function getStrDate(tag) {
|
var date = new Date(tag);
|
var year = date.getFullYear();
|
var month, day, hour, min;
|
month = date.getMonth() + 1;
|
if (month >= 1 && month <= 9) {
|
month = "0" + month;
|
}
|
day = date.getDate();
|
if (day >= 1 && day <= 9) {
|
day = "0" + day;
|
}
|
hour = date.getHours();
|
if (hour >= 1 && hour <= 9) {
|
hour = "0" + hour;
|
}
|
min = date.getMinutes();
|
if (min >= 1 && min <= 9) {
|
min = "0" + min;
|
}
|
return year + "-" + month + "-" + day + " " + hour + ":" + min;
|
}
|
|
//滑动
|
mui('.mui-scroll-wrapper').scroll({
|
indicators: false, //是否显示滚动条
|
deceleration: 0.0006, //阻尼系数,系数越小滑动越灵敏
|
bounce: false, //是否启用回弹
|
deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
|
});
|