Files
OMS/app/logisticsmanager/view/admin/print/include/template.html
2025-12-28 23:13:25 +08:00

240 lines
9.0 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--
Copyright © ShopeX http://www.shopex.cn. All rights reserved.
See LICENSE file for license details.
-->
<textarea id="template_data" name="template_data" style="display:none">
<{if $printTmpl.template_data}>
<{$printTmpl.template_data}>
<{else}>
paper:<{$printTmpl.template_width}>,<{$printTmpl.template_height}>,NONE;
<{/if}>
</textarea>
<textarea id="jsondata_newdata" style="display:none">
<{$jsondata}>
</textarea>
<script>
window.addEvent('domready', function() {
var embedId = 'embed1<{$uniqid}>';
var embed1 = $(embedId);
var browerType = parseInt("<{$userAgent.type}>");
var totalPage = '<{$totalPage}>';
var curPage = 0;
//控件没有安装, IE, Chrome没有安装控件为objectFirfox没有安装控件为function
if ( ("object" == typeof(embed1) || "function" == typeof(embed1)) && ('adjustpos' in embed1 == false)) {
$('print-warning').setHTML('与SHOPEX打印组件通信失败确认是否已安装>><a target="_blank" href="http://update.tg.taoex.com/Store/admin/shopex_Setup.exe">点击下载</a>');
$('print-warning').show();
return false;
}
Ex_Loader('security','<{$env.BASE_URL}>/app/logisticsmanager/statics/js/printer.js?v=20190354',function(){
var ShopexPrintAx = initPrinter('shopex',{
activex:embed1,
brower:"<{$userAgent.type}>",
template:$('template_data').value,
data:$('jsondata_newdata').value,
onDecryptStart:function(p){
this.decryptDialog = new Dialog(new Element("div.tableform",{html:'<div class="division"><div><h4 id="iTitle">正在数据解密,请稍等......</h4><div style="margin-left: 5px;">需处理 <span id="total">0</span> 条,已处理 <span id="iTotal" style="color:#083E96">0</span> 条。<span id="iMsg" style="color:red"></span> </div></div><div id="processBarBg" class="processBarBg"><div class="processBar" id="processBar">&nbsp;</div></div></div>'}),
{
title:'数据解密',
width:600,
height:130,
resizeable:false,
});
$E('#total', this.decryptDialog).setText(p.t);
},
onDecryptProcess:function(p){
$E('#iTotal', this.decryptDialog).setText(p.s);
$('processBar').setStyle('width',p.s/p.t*100+'%');
},
onDecryptComplete:function(p){
$E('#iTotal', this.decryptDialog).setText(p.s);
if (p.rsp == 'fail') {
$E('#iTitle', this.decryptDialog).setText('解密失败');
return $E('#iMsg', this.decryptDialog).setText(p.errmsg);
}
$('jsondata_newdata').setText(p.d);
this.decryptDialog.close();
this.preview();
var _this = this;
setTimeout(function(){
_this.options.activex.refresh();
_this.options.activex.moveto(0);
}, 300);
if('normal' == '<{$printTmpl.template_type}>' && typeof bandLogiDecrypt === 'function'){
setTimeout(bandLogiDecrypt,1000,p.d);
}
},
onPrintComplete:function(){
if('normal' == '<{$printTmpl.template_type}>' && typeof showBindLogi === 'function'){
setTimeout(showBindLogi,1000);
}
}
});
ShopexPrintAx.decrypt();
// 设置打印机
if (!ShopexPrintAx.setPrinters($('printer-list'))) {
$('print-warning').setHTML('您的系统尚未安装打印机,安装完打印机后,请重新打印。');
return $('print-warning').show();
}
$('printer-setting').addEvent('click', function(){
ShopexPrintAx.setPrinterConfig({
name:$('printerlist').value,
is_thermal:$('thermal').checked==true ? 1 : 0
});
});
if ($defined($('uppage'))) {
$('uppage').addEvent('click',function(){
curPage = curPage-1;
if (curPage < 0) curPage = 0;
ShopexPrintAx.moveto(curPage);
});
}
if ($defined($('nextpage'))) {
$('nextpage').addEvent('click',function(){
curPage = curPage+1;
if (curPage >= totalPage) curPage = totalPage-1;
ShopexPrintAx.moveto(curPage);
});
}
if ($defined($('jumpinput'))) {
var keyCodeFix = [13,48,49,50,51,52,53,54,55,56,57,96,97,98,99,100,101,102,103,104,105,8,9,46,37,39];
$('jumpinput').addEvent('keydown',function(e){
if(!keyCodeFix.contains(e.code)){e.stop();}
if (e.key=="enter") {
var page = this.value.toInt()-1;
if (page>=0 && page<totalPage) {
curPage = page;
ShopexPrintAx.moveto(curPage);
}
}
});
}
// 补打
if ($defined($('onlyprint_btn'))) {
$('onlyprint_btn').addEvent('click',function(){
if (ShopexPrintAx.destatus != 'succ') {
return alert(ShopexPrintAx.demsg+',不能打印');
}
ShopexPrintAx.print({
name:$('printerlist').value,
offsetx:$('offsetx').value,
offsety:$('offsety').value,
is_thermal:$('thermal').checked==true ? 1 : 0
});
});
}
// 打印
var hasprintlist=[];
if ($defined($('doprint_btn'))) {
$('doprint_btn').addEvent('click', function(){
if (ShopexPrintAx.destatus != 'succ') {
return alert(ShopexPrintAx.demsg+',不能打印');
}
var dialog = new Dialog(new Element("div.tableform",{html:'<div id="pause" class="division">正在提交...<{img app="desktop" src="bundle/loading_small.gif"}></div><div class="table-action"><{button label="关闭" onclick="re_finder();"}></div>'}),
{
title:'提示',
width:230,
height:130,
modal:true,
resizeable:false
});
var printname= '<{$vid}>';
if (hasprintlist.contains(printname) && confirm('您的选择含有已打印快递单,你确定要重复打印吗?')==false ){
window.close();
}
hasprintlist.push(printname);
// 设置打印状态
new Request({url:'index.php?<{$appCtl}>&act=setPrintStatus',method:'post',
data:{
type:'express',
str:printname,
printpos:'<{$printpos}>'
},
onSuccess:function(json){
if (json == '6003' && confirm('您的选择含有已打印快递单,你确定要重复打印吗?') == false) {
dialog.close();
return window.close();
}
if (json != '6003' && json != 'true') {
return $('pause').set('text',json);
}
dialog.close();
ShopexPrintAx.print({
name:$('printerlist').value,
offsetx:$('offsetx').value,
offsety:$('offsety').value,
is_thermal:$('thermal').checked==true ? 1 : 0
});
}
}).send();
});
}
});
<{ if $errIds }>
var alertMsg = '';
<{ foreach from=$errIds item=cid }>
alertMsg = alertMsg + "<{$errBns[$cid]}>" + "<{$errInfo[$cid]}> <br/>" ;
alertMsg = alertMsg + '';
<{/foreach}>
alertMsg = alertMsg + '<br/>以上发货单在本次打印列表中已被剔除,请在处理后重新打印。';
$('information').style.display='';
if ($('information').innerHTML != '') {
$('information').innerHTML = $('information').innerHTML + alertMsg;
} else {
$('information').innerHTML = alertMsg;
}
<{ /if }>
});
function downloadprintsite() {
setTimeout('diagLoadPrintSite()',1000);
}
function diagLoadPrintSite() {
new Dialog('index.php?app=ome&ctl=admin_order&act=diagLoadPrintSite',{width:500,height:220,title:'ShopEx Print Controller',
onClose:function(){
self.close();
}
});
}
function errorreportprintsite(errmsg) {
var data={'errmsg':errmsg};
new Request({
url : 'index.php?app=ome&ctl=admin_order&act=errorReportPrintSite',
method : 'post',
data:data,
onSuccess:function(responseText){
;
}
}).send();
}
</script>