已废弃
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
4.5 KiB

<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<title>扫码</title>
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all">
<link rel="stylesheet" href="/static/css/layuimini.css?v=2.0.4.2" media="all">
<link rel="stylesheet" href="/static/css/themes/default.css" media="all">
<link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
<!--[if lt IE 9]>
<script src="/static/js/html5.min.js"></script>
<script src="/static/js/respond.min.js"></script>
<![endif]-->
<!-- vue相关-->
<script src="../static/js/vue/vue.js"></script>
<script src="../static/js/vue/vue-router.js"></script>
<script src="../static/lib/http-vue-loader/src/httpVueLoader.js"></script>
<script src="../static/js/VueQrcodeReader.umd.min.js"></script>
</head>
<body>
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
function outboundLogic() {
};
function temporaryScanValue() {
}
function chooseInOrOut() {
}
var material = null,
depository = null,
place = null;
let wxScan = parent;
layui.$(function () {
if (wxScan.wx === undefined) {
wxScan = wxScan.parent.wx;
} else {
wxScan = wxScan.wx;
}
wxScan.scanQRCode({
desc: 'scanQRCode desc',
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
success: function (res) {
// 回调
var result = res.resultStr;//当needResult为1时返回处理结果
var req = {};
req.qrCode = result;
outboundLogic(req);
},
error: function (res) {
if (res.errMsg.indexOf('function_not_exist') > 0) {
alert('版本过低请升级')
}
}
});
});
outboundLogic = function (req) {
layui.$.ajax({
url: "/material/qywxScanCodeOut",
type: "post",
dataType: 'json',
data: JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: function (d) {
var data = d.data;
// 获取标准
var flag = data.flag;
if (flag === 0) {
// 如果是无效码
layer.confirm("扫描失败,是否重新扫描", {
btn: ["确定", "取消"]
}, function () {
wxScan.scanQRCode({
desc: 'scanQRCode desc',
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
scanType: ["barCode", "qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
success: function (res) {
// 回调
var result = res.resultStr;//当needResult为1时返回处理结果
var req = {};
req.qrCode = result;
outboundLogic(req);
}
})
}, function () {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
})
} else if (flag === 1) {
// 如果是物料
material = data.material;
window.location.href = "/toShowInventory?id="+material.id+"&type=m";
} else if (flag === 2) {
// 如果扫描的为库位
place = data.place;// 将扫描结果保存到vue中
window.location.href = "/toShowInventory?id="+place.id+"&type=p";
} else if (flag === 3) {
depository = data.depository;// 将扫描结果保存到vue中
window.location.href = "/toShowInventory?id="+depository.id+"&type=d";
}
}
})
};
</script>
</body>
</html>