默认
已退货
草稿
已撤销
更多筛选选项
单条打印
多条打印
☐ 状态 ⇅ 业务日期 客户名称 打印次数 欠数
销售退货单 --
复制为销售单
复制为采购单
复制为采购退货单
生成报价单
'; return html; } // 打印销售退货单(只打印右侧单据内容) function printOrder(id) { var o = RETURN_ORDERS.find(function(x){return x.id===id;}); if(!o) { toast('未找到销售退货单','error'); return; } var templates = getPrintTemplates(32); var tpl = templates.find(function(t){ return t.isMainTemplate; }) || templates[0]; if(!tpl) { toast('未找到打印模板','error'); return; } var html = buildPrintHTMLWithTemplate(o, tpl, 'return'); if(!html) { toast('生成打印内容失败','error'); return; } // 方案1:优先弹出新窗口打印 var pw = window.open('', '_blank', 'width=900,height=700,scrollbars=1'); if(pw && !pw.closed){ pw.document.open(); pw.document.write(html); pw.document.close(); setTimeout(function(){ try { pw.print(); } catch(e){} }, 300); return; } // 方案2:使用隐藏 iframe 打印(避免被弹窗拦截,打印的是单据详情不是整个网页界面) var iframe = document.createElement('iframe'); iframe.style.cssText = 'position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;'; document.body.appendChild(iframe); var idoc = iframe.contentWindow.document; idoc.open(); idoc.write(html); idoc.close(); setTimeout(function(){ try { iframe.contentWindow.focus(); iframe.contentWindow.print(); } catch(e){} setTimeout(function(){ if(iframe.parentNode) iframe.parentNode.removeChild(iframe); }, 1000); }, 300); }