|
@@ -88,7 +88,7 @@
|
|
|
</text>
|
|
</text>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="info-line">
|
|
<view class="info-line">
|
|
|
- <text class="item-type">{{ s.property }}</text>
|
|
|
|
|
|
|
+ <text class="item-type" style="color:#3385FF;" @click.stop="printLabel(s)">打标签</text>
|
|
|
<text class="item-count">{{ parseFloat(s.itemNum) }}扎</text>
|
|
<text class="item-count">{{ parseFloat(s.itemNum) }}扎</text>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -220,6 +220,34 @@ export default {
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ printLabel(ele){
|
|
|
|
|
+ let that = this
|
|
|
|
|
+ // #ifdef APP-PLUS
|
|
|
|
|
+ plug.state({},ret=>{
|
|
|
|
|
+ if(ret.code == 1){
|
|
|
|
|
+ that.$util.confirmModal({content:'您还没有连接蓝牙,请先链接'},() => {
|
|
|
|
|
+ that.pageTo({url:'/admin/tools/blue'})
|
|
|
|
|
+ })
|
|
|
|
|
+ }else{
|
|
|
|
|
+ that.$util.confirmModal({content:'确定打印'+ele.name+'的标签?'},() => {
|
|
|
|
|
+ let data = []
|
|
|
|
|
+ if(ele.name && !that.$util.isEmpty(ele.name)){
|
|
|
|
|
+ let num = parseFloat(ele.itemNum)
|
|
|
|
|
+ let label = that.createLable(ele.name,ele.itemId,num)
|
|
|
|
|
+ data.push(label)
|
|
|
|
|
+ }
|
|
|
|
|
+ //说明地址 https://ext.dcloud.net.cn/plugin?id=462
|
|
|
|
|
+ plug.printer({"TSC":data,isArray:true},result=>{
|
|
|
|
|
+ //console.log(result)
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ // #endif
|
|
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
|
|
+ that.$msg('请在App上打印')
|
|
|
|
|
+ // #endif
|
|
|
|
|
+ },
|
|
|
printAllLabel(){
|
|
printAllLabel(){
|
|
|
let that = this
|
|
let that = this
|
|
|
// #ifdef APP-PLUS
|
|
// #ifdef APP-PLUS
|
|
@@ -232,11 +260,14 @@ export default {
|
|
|
that.$util.confirmModal({content:'确定打印全部标签?'},() => {
|
|
that.$util.confirmModal({content:'确定打印全部标签?'},() => {
|
|
|
if(!that.$util.isEmpty(that.detailInfo.itemInfo)){
|
|
if(!that.$util.isEmpty(that.detailInfo.itemInfo)){
|
|
|
let data = []
|
|
let data = []
|
|
|
- for (const elem of that.detailInfo.itemInfo) {
|
|
|
|
|
- if(elem.name && !that.$util.isEmpty(elem.name)){
|
|
|
|
|
- let num = parseFloat(elem.itemNum)
|
|
|
|
|
- let label = that.createLable(elem.name,elem.itemId,num)
|
|
|
|
|
|
|
+ for (const ele of that.detailInfo.itemInfo) {
|
|
|
|
|
+ if(ele.name && !that.$util.isEmpty(ele.name)){
|
|
|
|
|
+ let num = parseFloat(ele.itemNum)
|
|
|
|
|
+ num = 5
|
|
|
|
|
+ let label = that.createLable(ele.name,ele.itemId,num)
|
|
|
data.push(label)
|
|
data.push(label)
|
|
|
|
|
+ let separateLabel = that.createSeparateLabel()
|
|
|
|
|
+ data.push(separateLabel)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//说明地址 https://ext.dcloud.net.cn/plugin?id=462
|
|
//说明地址 https://ext.dcloud.net.cn/plugin?id=462
|
|
@@ -251,7 +282,33 @@ export default {
|
|
|
// #ifdef MP-WEIXIN
|
|
// #ifdef MP-WEIXIN
|
|
|
that.$msg('请在App上打印')
|
|
that.$msg('请在App上打印')
|
|
|
// #endif
|
|
// #endif
|
|
|
- },
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ //分隔标签
|
|
|
|
|
+ createSeparateLabel(){
|
|
|
|
|
+ //制作标签格式,
|
|
|
|
|
+ var data=[]; //定义一个数组
|
|
|
|
|
+ var line={}; //每添加一个,代表一行字
|
|
|
|
|
+
|
|
|
|
|
+ //设置标签纸大小
|
|
|
|
|
+ line={};
|
|
|
|
|
+ line.width=40; //mm
|
|
|
|
|
+ line.height=50; //mm
|
|
|
|
|
+ line.gap=2; //标签纸之间,间隙长度 mm
|
|
|
|
|
+ line.page=2; //打印几份
|
|
|
|
|
+ data.push(line); //每添加一个,代表一行字
|
|
|
|
|
+
|
|
|
|
|
+ //添加文字
|
|
|
|
|
+ line={};
|
|
|
|
|
+ line.text= '======';
|
|
|
|
|
+ line.rotation=0;
|
|
|
|
|
+ line.x=30;
|
|
|
|
|
+ line.y=15;
|
|
|
|
|
+ line.xscal=2;
|
|
|
|
|
+ line.yscal=2;
|
|
|
|
|
+ data.push(line); //每添加一个,代表一行字
|
|
|
|
|
+
|
|
|
|
|
+ return data;
|
|
|
|
|
+ },
|
|
|
createLable(itemName,itemId,num){
|
|
createLable(itemName,itemId,num){
|
|
|
//制作标签格式,
|
|
//制作标签格式,
|
|
|
var data=[]; //定义一个数组
|
|
var data=[]; //定义一个数组
|