mirror of
https://gitee.com/ShopeX/OMS
synced 2026-03-23 10:55:34 +08:00
251 lines
9.5 KiB
HTML
251 lines
9.5 KiB
HTML
<!--
|
||
Copyright 2012-2026 ShopeX (https://www.shopex.cn)
|
||
|
||
Licensed under the Apache License, Version 2.0 (the "License");
|
||
you may not use this file except in compliance with the License.
|
||
You may obtain a copy of the License at
|
||
|
||
http://www.apache.org/licenses/LICENSE-2.0
|
||
|
||
Unless required by applicable law or agreed to in writing, software
|
||
distributed under the License is distributed on an "AS IS" BASIS,
|
||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
See the License for the specific language governing permissions and
|
||
limitations under the License.
|
||
-->
|
||
|
||
<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没有安装控件为object,Firfox没有安装控件为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"> </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>
|