init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
@@ -0,0 +1,682 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<!--[1.5.46]-->
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css"/>
|
||||
<title>规格标签打印</title>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
th, td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.sku-list-down {
|
||||
border-radius: 2px;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
background-color: #009688;
|
||||
padding: 5px 10px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.sku-list-down:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.sku-list-down::selection {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.sku-list-down:active {
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
.alert {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.alertCenter {
|
||||
padding: 30px 40px 60px;
|
||||
background-color: white;
|
||||
border-radius: 6px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.sureBtnBox {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: #009688;
|
||||
font-size: 14px;
|
||||
color: white;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
border-bottom-left-radius: 6px;
|
||||
border-bottom-right-radius: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sureBtn {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.cancel {
|
||||
background-color: #f1f1f1;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 1px solid #ccc;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.isCheck {
|
||||
border-color: #009688;
|
||||
}
|
||||
|
||||
.isCheck:before {
|
||||
content: '';
|
||||
width: 5px;
|
||||
height: 9px;
|
||||
border-right: 1px solid #009688;
|
||||
border-bottom: 1px solid #009688;
|
||||
transform: rotateZ(45deg);
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
top: 2px;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.wrap-inline {
|
||||
line-height: 12px;
|
||||
margin-top: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
i {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
font-family: "AvantGarde Bk BT", "arial", "微软雅黑";
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.layui-form-label {
|
||||
color: #333;
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.labelNum {
|
||||
width: 460px;
|
||||
text-align: center;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background-color: white;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-webkit-background-clip: content;
|
||||
border-radius: 2px;
|
||||
box-shadow: 1px 1px 50px rgba(0, 0, 0, .3);
|
||||
}
|
||||
|
||||
.labelNum input {
|
||||
height: 30px;
|
||||
border-radius: 3px;
|
||||
border: 1px solid #ddd;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.status {
|
||||
width: 52px;
|
||||
height: 22px;
|
||||
border-radius: 13px;
|
||||
font-size: 12px;
|
||||
border: 1px solid #ccc;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
.isOpen {
|
||||
background-color: #009688;
|
||||
border-color: #009688;
|
||||
}
|
||||
|
||||
.isOpen:before {
|
||||
content: '开启';
|
||||
color: white;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
left: 5px;
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
.isOpen:after {
|
||||
content: '';
|
||||
background-color: white;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 30px;
|
||||
border-radius: 50%;
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
.isClose:before {
|
||||
content: '关闭';
|
||||
color: #aaa;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
left: 20px;
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
.isClose:after {
|
||||
content: '';
|
||||
background-color: #bbb;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 5px;
|
||||
border-radius: 50%;
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
.tipsI {
|
||||
line-height: 16px;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
padding: 12px 0;
|
||||
text-align: left;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.layui-layer-content {
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.label-check-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.label-set-title {
|
||||
padding: 0 80px 0 20px;
|
||||
height: 42px;
|
||||
line-height: 42px;
|
||||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #eee;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
overflow: hidden;
|
||||
background-color: #EBEEF5;
|
||||
border-radius: 2px 2px 0 0;
|
||||
}
|
||||
|
||||
.label-set-close {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 15px;
|
||||
line-height: initial;
|
||||
cursor: pointer;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-left: 10px;
|
||||
font-size: 12px;
|
||||
display: inline-block;
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
vertical-align: top;
|
||||
background: url(/Public/layui/css/modules/layer/default/icon.png) no-repeat;
|
||||
background-position: 1px -40px;
|
||||
}
|
||||
|
||||
.label-set-close:hover {
|
||||
opacity: 0.5;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" v-cloak>
|
||||
<div class="sku-list-down" @click="downloadMoreSku" style="padding: 10px;margin: 20px;">批量打印标签</div>
|
||||
<div class="sku-list-down" @click="showLabelSet=true" style="padding: 10px;margin: 20px;">打印设置</div>
|
||||
<div style="width: calc(100% - 50px);margin: 0 auto;">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="60">
|
||||
<col width="50">
|
||||
<col v-for="(title,index) in skuAttr" width="80">
|
||||
<col width="90">
|
||||
<col width="90">
|
||||
<col width="100">
|
||||
<col width="50">
|
||||
<col width="180">
|
||||
<col width="80">
|
||||
<col width="50">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2" @click="checkAll" style="cursor: pointer">
|
||||
<div class="checkbox" :class="checkAllSku?'isCheck':''"></div>
|
||||
<span style="padding-left: 10px">全选</span>
|
||||
</th>
|
||||
<th rowspan="2" style="padding: 10px;text-align: center;">序号</th>
|
||||
<th :colspan="skuAttr.length">规格名称</th>
|
||||
<th rowspan="2">规格货号</th>
|
||||
<th rowspan="2">规格条码</th>
|
||||
<th rowspan="2">零售价</th>
|
||||
<th rowspan="2">生产日期</th>
|
||||
<th rowspan="2">保质期</th>
|
||||
<th rowspan="2">操作</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th v-for="(title,index) in skuAttr">{{title.name}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="attrData">
|
||||
<tr v-for="(list,index) in skuList">
|
||||
<th style="text-align: center">
|
||||
<div class="checkbox" :class="list.checked||checkAllSku?'isCheck':''" @click="check(index)"></div>
|
||||
</th>
|
||||
<td style="padding: 0;text-align: center;">{{index+1*1}}</td>
|
||||
<td v-for="(name,i) in list.name">
|
||||
<span>{{name}}</span>
|
||||
</td>
|
||||
<td>{{list.sku_goods_number}}</td>
|
||||
<td>{{list.sku_code}}</td>
|
||||
<td>{{list.retail_price}}</td>
|
||||
<td style="padding: 0;width: 180px"><input class="layui-input layui-input-edit" type="text"
|
||||
v-model="list.production_date"></td>
|
||||
<td style="padding: 0"><input class="layui-input layui-input-edit" type="text"
|
||||
v-model="list.shelf_life"></td>
|
||||
<td style="text-align: center">
|
||||
<div class="sku-list-down" @click="downloadSku(index)">打印标签</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!skuList.length">
|
||||
<td style="text-align: center;height: 40px;" :colspan="8+skuAttr.length">该商品暂无规格</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div v-if="showLabelSet" class="labelNum">
|
||||
<div class="label-set-title">
|
||||
<div class="label-set-close" @click="showLabelSet=!showLabelSet"></div>
|
||||
</div>
|
||||
<div style="padding: 25px 0 0">
|
||||
<div class="gA_inner layui-form-item">
|
||||
<span class="layui-form-label">打印数量:</span>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" v-model="printNum" value="1" class="layui-input"
|
||||
oninput="value=this.value.replace(/^[0]|\D/,'')"/>
|
||||
<div class="wrap-inline">
|
||||
<i style="line-height: 14px;">每个商品标签打印张数,留空默认1张</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gA_inner layui-form-item">
|
||||
<span class="layui-form-label">打印纸尺寸:</span>
|
||||
<div class="layui-input-inline">
|
||||
<div style="display: flex;align-items: center;color: #666;">
|
||||
<span>宽:</span>
|
||||
<input type="text" style="text-align: center;padding-left: 0" v-model="labelWidth"
|
||||
placeholder="宽" class="layui-input"
|
||||
oninput="value=this.value.replace(/^[0]|\D/,'')"/>
|
||||
<span style="padding-left: 20px">高:</span>
|
||||
<input type="text" style="text-align: center;padding-left: 0" v-model="labelHeight"
|
||||
placeholder="高" class="layui-input"
|
||||
oninput="value=this.value.replace(/^[0]|\D/,'')"/>
|
||||
</div>
|
||||
<div class="wrap-inline">
|
||||
<i style="line-height: 14px;">尺寸按mm(毫米)填入</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gA_inner layui-form-item">
|
||||
<span class="layui-form-label">打印商品名称:</span>
|
||||
<div class="label-check-box">
|
||||
<div class="status" :class="showGoodsName?'isOpen':'isClose'"
|
||||
@click="showGoodsName=!showGoodsName"></div>
|
||||
<i style="line-height: 14px;">关闭则不打印名称</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gA_inner layui-form-item">
|
||||
<span class="layui-form-label">打印规格名称:</span>
|
||||
<div class="label-check-box">
|
||||
<div class="status" :class="showGoodsSkuName?'isOpen':'isClose'"
|
||||
@click="showGoodsSkuName=!showGoodsSkuName"></div>
|
||||
<i style="line-height: 14px;">关闭则不打印名称</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gA_inner layui-form-item">
|
||||
<span class="layui-form-label">打印规格货号:</span>
|
||||
<div class="label-check-box">
|
||||
<div class="status" :class="showGoodsNum?'isOpen':'isClose'"
|
||||
@click="showGoodsNum=!showGoodsNum"></div>
|
||||
<i class="tipsI">关闭则不打印货号</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gA_inner layui-form-item">
|
||||
<span class="layui-form-label">打印条形码:</span>
|
||||
<div class="label-check-box">
|
||||
<div class="status" :class="showGoodsCode?'isOpen':'isClose'"
|
||||
@click="showGoodsCode=!showGoodsCode"></div>
|
||||
<i class="tipsI">关闭则不打印条形码,当没有条形码时则打印货号</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gA_inner layui-form-item">
|
||||
<span class="layui-form-label">打印条码数字:</span>
|
||||
<div class="label-check-box">
|
||||
<div class="status" :class="showCodeNumber?'isOpen':'isClose'"
|
||||
@click="showCodeNumber=!showCodeNumber"></div>
|
||||
<i class="tipsI">条形码底部明文数字</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gA_inner layui-form-item">
|
||||
<span class="layui-form-label">打印单价:</span>
|
||||
<div class="label-check-box">
|
||||
<div class="status" :class="showGoodsPrice?'isOpen':'isClose'"
|
||||
@click="showGoodsPrice=!showGoodsPrice"></div>
|
||||
<i class="tipsI">关闭则不打印单价</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gA_inner layui-form-item">
|
||||
<span class="layui-form-label">打印保质期:</span>
|
||||
<div class="label-check-box">
|
||||
<div class="status" :class="showGoodsDate?'isOpen':'isClose'"
|
||||
@click="showGoodsDate=!showGoodsDate"></div>
|
||||
<i class="tipsI">未设置保质期的商品不打印</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="prints" style="width: 240px;text-align: center;padding:10px 20px;display: none">
|
||||
</div>
|
||||
</body>
|
||||
<script src="__PUBLIC__/jquery/js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
|
||||
<script src="__PUBLIC__/vue/js/vue2.5.16.js"></script>
|
||||
<script type="text/javascript" src="__PUBLIC__/retails/js/LodopFuncs.js"></script>
|
||||
<script type="text/javascript" src="__PUBLIC__/retails/js/JsBarcode.all.js"></script>
|
||||
<script>
|
||||
var arrDPI = new Array;
|
||||
if (window.screen.deviceXDPI) {
|
||||
arrDPI[0] = window.screen.deviceXDPI;
|
||||
arrDPI[1] = window.screen.deviceYDPI;
|
||||
} else {
|
||||
var tmpNode = document.createElement("DIV");
|
||||
tmpNode.style.cssText = "width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden";
|
||||
document.body.appendChild(tmpNode);
|
||||
arrDPI[0] = parseInt(tmpNode.offsetWidth);
|
||||
arrDPI[1] = parseInt(tmpNode.offsetHeight);
|
||||
tmpNode.parentNode.removeChild(tmpNode);
|
||||
}
|
||||
var ppiRate = arrDPI[0] * 100 / 2540;
|
||||
console.log(arrDPI, ppiRate);
|
||||
var goods = {$goods};
|
||||
var layer;
|
||||
layui.use(['layer'], function () {
|
||||
layer = layui.layer;
|
||||
});
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: function () {
|
||||
return {
|
||||
skuList: [],
|
||||
skuAttr: [],//已选规格
|
||||
goods: goods,
|
||||
printList: [],
|
||||
checkAllSku: false,
|
||||
checkedNum: 0,
|
||||
printNum: 1,//打印数量
|
||||
labelWidth: 58,//宽
|
||||
labelHeight: 50,//高
|
||||
showGoodsName: true,//名称
|
||||
showGoodsSkuName: true,//名称
|
||||
showGoodsCode: true,//条码
|
||||
showCodeNumber: true,//条码编号显示
|
||||
showGoodsPrice: true,//价格
|
||||
showGoodsDate: true,//日期
|
||||
showGoodsNum: true,//货号
|
||||
showLabelSet: true,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickIt: function () {
|
||||
|
||||
},
|
||||
check: function (index) {
|
||||
var skuList = this.skuList;
|
||||
if (skuList[index].checked) {
|
||||
skuList[index].checked = false;
|
||||
this.checkedNum--
|
||||
} else {
|
||||
skuList[index].checked = true;
|
||||
this.checkedNum++
|
||||
}
|
||||
if (this.checkedNum != skuList.length) {
|
||||
this.checkAllSku = false;
|
||||
} else {
|
||||
this.checkAllSku = true;
|
||||
}
|
||||
this.skuList = [];
|
||||
this.skuList = skuList;
|
||||
},
|
||||
checkAll: function () {
|
||||
if (this.checkAllSku) {
|
||||
var skuList = this.skuList;
|
||||
for (var i = 0; i < skuList.length; i++) {
|
||||
skuList[i].checked = false;
|
||||
}
|
||||
this.skuList = [];
|
||||
this.skuList = skuList;
|
||||
this.checkAllSku = false;
|
||||
this.checkedNum = 0;
|
||||
} else {
|
||||
var skuList = this.skuList;
|
||||
for (var i = 0; i < skuList.length; i++) {
|
||||
skuList[i].checked = true;
|
||||
}
|
||||
this.skuList = [];
|
||||
this.skuList = skuList;
|
||||
this.checkAllSku = true;
|
||||
this.checkedNum = skuList.length;
|
||||
}
|
||||
},
|
||||
downloadSku: function (index) {
|
||||
console.log(this.skuList[index])
|
||||
if (!this.skuList[index].sku_code && !this.skuList[index].sku_goods_number && this.showGoodsCode) {
|
||||
layer.msg('该规格没有货号和条码,不支持打印', {time: 1500});
|
||||
return;
|
||||
}
|
||||
this.printList = [JSON.parse(JSON.stringify(this.skuList[index]))];
|
||||
var that = this;
|
||||
this.$nextTick(function () {
|
||||
that.down();
|
||||
});
|
||||
},
|
||||
downloadMoreSku: function () {
|
||||
if (this.checkedNum == 0) {
|
||||
layer.msg('请选择要打印的规格', {time: 1500});
|
||||
return;
|
||||
}
|
||||
var arr = [];
|
||||
for (var i = 0; i < this.skuList.length; i++) {
|
||||
if (this.skuList[i].checked && (this.skuList[i].sku_code || !this.showGoodsCode)) {
|
||||
arr.push(JSON.parse(JSON.stringify(this.skuList[i])));
|
||||
}
|
||||
}
|
||||
if (!arr.length) {
|
||||
layer.msg('暂无可打印的规格条码', {time: 1500});
|
||||
return;
|
||||
}
|
||||
this.printList = [];
|
||||
this.printList = arr;
|
||||
var that = this;
|
||||
this.$nextTick(function () {
|
||||
that.down();
|
||||
});
|
||||
},
|
||||
down: function () {
|
||||
var printNum = this.printNum ? this.printNum : 1;
|
||||
var labelHeight = parseInt(this.labelHeight * this.ppiRate);
|
||||
var labelWidth = parseInt(this.labelWidth * this.ppiRate);
|
||||
for (var i = 0; i < printNum; i++) {
|
||||
for (var j = 0; j < this.printList.length; j++) {
|
||||
var goodsDate = '';
|
||||
if (this.showGoodsDate) {
|
||||
if (this.printList[i].production_date) {
|
||||
goodsDate += `<div style="font-size: 12px;color: #666;">生产日期:${this.printList[i].production_date}</div>`;
|
||||
}
|
||||
if (this.printList[i].shelf_life) {
|
||||
goodsDate += `<div style="font-size: 12px;color: #666;">保质期:${this.printList[i].shelf_life}</div>`;
|
||||
}
|
||||
}
|
||||
var codeNumber = '';
|
||||
if (this.showCodeNumber && this.printList[j].sku_code) {
|
||||
codeNumber = `<div style="padding-top: -5px;padding-bottom: 5px;font-size: 14px;">${this.printList[j].sku_code}</div>`;
|
||||
}
|
||||
var goodsName = '';
|
||||
if (this.showGoodsName) {
|
||||
goodsName = `<div style="width:100%;">${this.goods.goods_name}</div>`;
|
||||
}
|
||||
var goodsNum = '';
|
||||
if (this.showGoodsNum) {
|
||||
goodsNum = `<div style="width:100%;">货号:${this.printList[j].sku_goods_number}</div>`;
|
||||
}
|
||||
var goodsSkuName = '';
|
||||
if (this.showGoodsSkuName) {
|
||||
goodsSkuName = `<div style="width:100%;font-size: 12px;">${(this.printList[j].name).join(';')}</div>`;
|
||||
}
|
||||
var goodsCode = '';
|
||||
var print_code = '';
|
||||
if (this.showGoodsCode && (this.printList[j].sku_code || this.printList[j].sku_goods_number)) {
|
||||
goodsCode = `<img id="imgCode"/>`;
|
||||
print_code = this.printList[j].sku_code ? this.printList[j].sku_code : this.printList[j].sku_goods_number;
|
||||
}
|
||||
var goodsPrice = '';
|
||||
if (this.showGoodsPrice) {
|
||||
goodsPrice = `<div style="font-size: 12px;"><b>单价:¥ ${this.printList[j].retail_price} 元</b></div>`;
|
||||
}
|
||||
$("#prints").html(`<div id="prints" style="width: ${labelWidth}px;height: ${labelHeight}px;padding:0 10px;display: flex;align-items:center;justify-content:center;flex-direction:column;text-align: center;box-sizing: border-box">
|
||||
${goodsName}
|
||||
${goodsSkuName}
|
||||
${goodsCode}
|
||||
${codeNumber}
|
||||
${goodsNum}
|
||||
${goodsPrice}
|
||||
${goodsDate}
|
||||
</div>`);
|
||||
if (this.showGoodsCode) {
|
||||
var h = parseInt(labelHeight * 0.25);
|
||||
$('#imgCode').JsBarcode(print_code, {
|
||||
format: "CODE128",
|
||||
displayValue: false,
|
||||
height: h,
|
||||
width: 1,
|
||||
fontSize: 12,
|
||||
margin: 0
|
||||
});//jQuery
|
||||
}
|
||||
Preview1();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
created: function () {
|
||||
var that = this;
|
||||
$.post("{:U('getDownLabelGoodsSku')}", {
|
||||
id: goods.id
|
||||
}, function (res) {
|
||||
that.skuAttr = res.data.attr;
|
||||
that.skuList = res.data.list;
|
||||
});
|
||||
var arrDPI = new Array;
|
||||
if (window.screen.deviceXDPI) {
|
||||
arrDPI[0] = window.screen.deviceXDPI;
|
||||
arrDPI[1] = window.screen.deviceYDPI;
|
||||
} else {
|
||||
var tmpNode = document.createElement("DIV");
|
||||
tmpNode.style.cssText = "width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden";
|
||||
document.body.appendChild(tmpNode);
|
||||
arrDPI[0] = parseInt(tmpNode.offsetWidth);
|
||||
arrDPI[1] = parseInt(tmpNode.offsetHeight);
|
||||
tmpNode.parentNode.removeChild(tmpNode);
|
||||
}
|
||||
this.ppiRate = arrDPI[0] * 100 / 2540;
|
||||
}
|
||||
})
|
||||
var LODOP; //声明为全局变量
|
||||
var LODOPbol = true;
|
||||
|
||||
function Preview1() {
|
||||
if (!LODOPbol) {
|
||||
return;
|
||||
}
|
||||
LODOP = getLodop();
|
||||
// console.log(LODOP);
|
||||
if (LODOP) {
|
||||
LODOP.SET_PREVIEW_WINDOW(0, 1, 0, 800, 600, "");
|
||||
LODOP.SET_SHOW_MODE("PREVIEW_NO_MINIMIZE", true);//预览窗口禁止最小化,并始终最前
|
||||
LODOP.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW", 1);
|
||||
AddPrintContent();
|
||||
LODOP.PRINT();
|
||||
} else {
|
||||
top.layer.msg('打印机未准备好,无法打印', {time: 1000}, function () {
|
||||
LODOPbol = false;
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
function AddPrintContent(strCode, strName) {
|
||||
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", document.getElementById("prints").innerHTML);
|
||||
LODOP.SET_PRINT_PAGESIZE(3, 5700, 50, "");
|
||||
};
|
||||
</script>
|
||||
</html>
|
||||
在新工单中引用
屏蔽一个用户