Browse Source

采购退货-前端 2023年1月28日 sxm

master
[li_she] 3 years ago
parent
commit
fdcc14aa3b
  1. 163
      src/main/resources/static/pda/js/receipt/purchase_return.js
  2. 89
      src/main/resources/static/pda/js/receipt/purchase_supplier.js
  3. 142
      src/main/resources/templates/receipt/purchase_return.ftl
  4. 101
      src/main/resources/templates/receipt/purchase_supplier.ftl

163
src/main/resources/static/pda/js/receipt/purchase_return.js

@ -0,0 +1,163 @@
// 页面初始化加在数据
$(function () {
getSupplier()
});
// 拆分 供应商编号 供应商ID
function getSupplier() {
var item = localStorage.getItem("supplier");
let supplierId = item.split("|")[0]
let supplierName = item.split("|")[0]
$('#supplier').val(item)
$('#supplierId').val(supplierId)
$('#supplierName').val(supplierName)
}
//为内部卷号绑定一个失去焦点事件
$("#rollNo").bind("keydown", function (event) {
if (event.keyCode == 13) {
var rollNo = $("#rollNo").val();
if (null == rollNo || rollNo == "") {
layer.alert("卷号不能为空!");
} else {
scanRollNo(rollNo);
return false;
}
}
return true;
});
let rolls = []
// 通过内部卷号获取信息
function scanRollNo(rollNo) {
let dto = {
rollno: rollNo,
site: $('#current_site').val(),
supplierid: $('#supplierId').val()
}
$.ajax({
url: "/purchaseReturn/scanRollNo",
contentType: 'application/json',
type: "POST",
data: JSON.stringify(dto),//你的formid
dataType: "JSON",
beforeSend: function (request) {
request.setRequestHeader("token", $.cookie("token"));
},
success: function (data) {
var code = data.code;
var rollInfo = data.data;
if (code == 0) {
// 是否已扫描
let find = rolls.filter(item => item.rollno == rollInfo.rollno);
if (find.length>0){
layer.alert('该卷已扫描!')
return
}
rolls.push(rollInfo)
let str = '<tr>' +
'<th class="" >' +
'<button data-toggle="modal" onclick="removerRoll(\'' + rollInfo.rollno + '\')" style="padding: 3px 10px;">' +
'删除</button>' +
'<th class="" >' +
'<span>' + rollInfo.rollno + '</span></th>' +
'<th class="" >' +
'<span>' + rollInfo.rollqty + '</span></th>' +
'</tr>';
$("#roll_table").append(str);
} else if (code == 500) {
layer.alert(data.msg);
}
$("#rollNo").val('');
},
error: function (data) {
}
});
}
// 删除扫描的卷
function removerRoll(rollNo){
rolls = rolls.filter( item => item.rollno != rollNo)
$("#roll_table").html('');
let str = ''
for (let i = 0; i < rolls.length; i++) {
let rollInfo = rolls[i]
str = '<tr>' +
'<th class="" >' +
'<button data-toggle="modal" onclick="removerRoll(\'' + rollInfo.rollno + '\')" style="padding: 3px 10px;">' +
'删除</button>' +
'<th class="" >' +
'<span>' + rollInfo.rollno + '</span></th>' +
'<th class="" >' +
'<span>' + rollInfo.rollqty + '</span></th>' +
'</tr>';
}
$("#roll_table").html(str);
}
// 结束当前扫描操作
function returnGoods() {
if (rolls.length==0){
layer.alert('请扫描退货的卷')
return;
}
layer.confirm('确定退货?', {
btn : [ '确认', '取消' ]
// 按钮
}, function() {
layer.closeAll('dialog');
$.ajax({
url: "/purchaseReturn/returnGoods",
type: "POST",
contentType: 'application/json',
data: JSON.stringify(rolls),
dataType: "json",
beforeSend: function (request) {
request.setRequestHeader("token", $.cookie("token"));
},
success: function (data) {
var code = data.code;
if (code == 0) {
layer.confirm(data.msg+', 是否返回上级-选择供应商', {
btn: ['确认', '取消']
// 按钮
}, function () {
layer.closeAll('dialog');
window.document.location.href = "/pda/purchaseSupplier"
}, function () {
window.document.location.href = "/pda/purchaseReturn"
});
} else {
layer.alert(data.msg);
}
},
error: function (data) {
layer.alert(data.msg);
}
});
}, function() {
layer.closeAll('dialog');
});
}
// 返回主界面清除缓存信息
function goBack() {
layer.confirm("返回上级菜单,将会删除当前扫描信息!!", {
btn: ['确认', '取消']
// 按钮
}, function () {
layer.closeAll('dialog');
window.document.location.href = "/pda/purchaseSupplier"
}, function () {
layer.closeAll('dialog');
});
}
// 清楚信息
function clear() {
$("#rollNo").val("");
}

89
src/main/resources/static/pda/js/receipt/purchase_supplier.js

@ -0,0 +1,89 @@
$(function () {
// 初始化供应商
initSupplier();
});
//初始化供应商信息
function initSupplier() {
var jsonData = {
site: $('#current_site').val(),
}
$.ajax({
url: "/toolPda/getSupplierList",
contentType: 'application/json',
type: "POST",
data: JSON.stringify(jsonData),//你的formid
dataType: "JSON",
beforeSend: function (request) {
request.setRequestHeader("token", $.cookie("token"));
},
success: function (data) {
if (data.code == 0) {
var rows = data.rows;
$("#supplier_table").html('');
var str = ''
for (var i = 0; i < rows.length; i++) {
let supplier = rows[i].supplierid+"|" +rows[i].suppliername
str += '<tr>' +
'<th class="" >' +
'<button data-toggle="modal" onclick="goPurchaseReturn(\'' + supplier + '\')" style="padding: 3px 10px;">' +
'选择</button>' +
'<th class="" >' +
'<span>' + rows[i].supplierid + '</span></th>' +
'<th class="" >' +
'<span>' + rows[i].suppliername + '</span></th>' +
'</tr>';
}
$("#supplier_table").html(str);
} else if (data.code == '401') {
window.location.href = "/login";
}
},
error: function (data) {
var responseText = data.responseText;
var json_str = JSON.parse(responseText);
var status = json_str.status;
var message = json_str.message;
//判断是否是session超时
if (403 == status) {
layer.alert(message, function () {
window.location.href = "/login";
});
}
layer.closeAll('loading');
}
})
}
// 执行返回主界面清除缓存信息
function goBackHome() {
var token = {
"token": $.cookie("token")
}
$.ajax({
url: "/qa/goBackHome",
type: "POST",
data: token,
dataType: "json",
beforeSend: function (request) {
request.setRequestHeader("token", $.cookie("token"));
},
success: function (data) {
var code = data.code;
if (code == '200') {
window.location.href = "/pda/publicMenu?titleName=''&menuId=0";
}
},
error: function (data) {
layer.alert(data.msg);
}
});
}
function goPurchaseReturn(item){
localStorage.setItem("supplier",item)
window.location.href='/pda/purchaseReturn'
}

142
src/main/resources/templates/receipt/purchase_return.ftl

@ -0,0 +1,142 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="/favicon.ico">
<title>${projectTitle!"MESPda"}</title>
<!-- Bootstrap core CSS -->
<link href="/pda/bootstrap/3.3.7/bootstrap.min.css" rel="stylesheet">
<link href="/pda/bootstrap/3.3.7/bootstrap-theme.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css"
href="/pda/jeasyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/pda/jeasyui/themes/icon.css">
<!-- Custom styles for this template -->
<link href="/pda/css/base.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="/css/button.css">
<style type="text/css">
/* reset ivu-btn*/
.ivu-btn {
padding: 6px 6px;
}
.ivu-table-body {
height: calc(100vh - 300px) !important;
}
</style>
</head>
<body>
<div id="app">
<input type="hidden" id="flag" value="${Session.flag!'N'}">
<input type="hidden" id="supplierId" >
<input type="hidden" id="supplierName" >
<div class="mint-tab-container screenHeight">
<header class="mint-header is-fixed">
<div class="mint-header-button is-left">
<div class="header-title">
<a onclick="goBack()" class="go-back"><i class="mintui mintui-back"></i></a>
<span>融欣MES - 退货采购订单</span>
</div>
</div>
<h1 class="mint-header-title"></h1>
<div class="mint-header-button is-right"></div>
</header>
<form autocomplete="off" class="ivu-form ivu-form-label-right">
<div class="ivu-form-item">
<label class="ivu-form-item-label" style="width: 90px;">供应商</label>
<div class="ivu-form-item-content" style="margin-left: 90px;">
<div class="ivu-input-wrapper ivu-input-type">
<input autocomplete="off" spellcheck="false" id="supplier" readonly autofocus="autofocus"
class="ivu-input"
></input>
</div>
<!---->
</div>
</div>
<div class="ivu-form-item">
<label class="ivu-form-item-label" style="width: 90px;">请扫描卷号</label>
<div class="ivu-form-item-content" style="margin-left: 90px;">
<div class="ivu-input-wrapper ivu-input-type">
<input autocomplete="off" spellcheck="false" id="rollNo" autofocus="autofocus"
class="ivu-input"></input>
</div>
</div>
</div>
</form>
<div class="ivu-row" id="rollCounts">
<div class="r-left" style="margin:0px;">已扫描记录</div>
<div class="ivu-table" style="font-size: 11px;">
<div class="ivu-table-header">
<table style="width: 100%;" cellspacing="0" cellpadding="0"
border="0" style="table-layout:fixed;">
<colgroup>
<col width="25%">
<col width="45%">
<col width="30%">
</colgroup>
<thead>
<tr>
<th class="" style="text-align:center">
<span>操作</span>
</th>
<th class="" style="text-align:center">
<span>卷号</span>
</th>
<th class="" style="text-align:center">
<span>数量</span>
</th>
</tr>
</thead>
</table>
</div>
<div class="ivu-table-body" >
<table style="width: 100%;" cellspacing="0" cellpadding="0"
border="0">
<colgroup>
<col width="25%">
<col width="45%">
<col width="30%">
</colgroup>
<tbody class="ivu-table-tbody" id="roll_table">
</tbody>
</table>
</div>
<div class="ivu-table-tip" style="display: none;">
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td><span>暂无筛选结果</span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="ivu-row" style="margin-top: 10px;">
<div class="ivu-col ivu-col-span-12">
<button type="button" onclick="returnGoods()" class="ivu-btn ivu-btn-primary">
<span>退货</span>
</button>
</div>
<div class="ivu-col ivu-col-span-12">
<button onclick="goBack()" class="ivu-btn ivu-btn-primary">
<span>返回</span>
</button>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript" src="/js/jquery/jquery-2.1.4.js"></script>
<script type="text/javascript" src="/pda/layer/layer.js"></script>
<script type="text/javascript" src="/pda/js/receipt/purchase_return.js"></script>
<script type="text/javascript" src="/js/jquery/jquery.cookie.js"></script>
</html>

101
src/main/resources/templates/receipt/purchase_supplier.ftl

@ -0,0 +1,101 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="/favicon.ico">
<title>${projectTitle!"MESPda"}</title>
<!-- Bootstrap core CSS -->
<link href="/pda/bootstrap/3.3.7/bootstrap.min.css" rel="stylesheet">
<link href="/pda/bootstrap/3.3.7/bootstrap-theme.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css"
href="/pda/jeasyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/pda/jeasyui/themes/icon.css">
<!-- Custom styles for this template -->
<link href="/pda/css/base.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="/css/button.css">
<style type="text/css">
/* reset ivu-btn*/
.ivu-btn {
padding: 6px 6px;
}
</style>
</head>
<body>
<div id="app">
<input type="hidden" id="flag" value="${Session.flag!'N'}">
<input type="hidden" id="supplierId" value="${Session.supplierId!'N'}">
<div class="mint-tab-container screenHeight">
<header class="mint-header is-fixed">
<div class="mint-header-button is-left">
<div class="header-title">
<a onclick="goBackHome()" class="go-back"><i class="mintui mintui-back"></i></a>
<span>融欣MES - 选择供应商</span>
</div>
</div>
<h1 class="mint-header-title"></h1>
<div class="mint-header-button is-right"></div>
</header>
<div class="ivu-table" style="font-size: 11px;">
<div class="ivu-table-header">
<table style="width: 100%;" cellspacing="0" cellpadding="0"
border="0" style="table-layout:fixed;">
<colgroup>
<col width="25%">
<col width="25%">
<col width="50%">
</colgroup>
<thead>
<tr>
<th class="" style="text-align:center">
<span>操作</span>
</th>
<th class="" style="text-align:center">
<span>供应商编号</span>
</th>
<th class="" style="text-align:center">
<span>供应商名称</span>
</th>
</tr>
</thead>
</table>
</div>
<div class="ivu-table-body" style="">
<table style="width: 100%;" cellspacing="0" cellpadding="0"
border="0">
<colgroup>
<col width="25%">
<col width="25%">
<col width="50%">
</colgroup>
<tbody class="ivu-table-tbody" id = "supplier_table" >
</tbody>
</table>
</div>
<div class="ivu-table-tip" style="display: none;">
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td><span>暂无筛选结果</span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript" src="/js/jquery/jquery-2.1.4.js"></script>
<script type="text/javascript" src="/pda/layer/layer.js"></script>
<script type="text/javascript" src="/pda/js/receipt/purchase_supplier.js"></script>
<script type="text/javascript" src="/js/jquery/jquery.cookie.js"></script>
</html>
Loading…
Cancel
Save