|
@@ -58,7 +58,7 @@ import { mapGetters } from "vuex";
|
|
|
import { getWeixinId } from "@/api/invite/index";
|
|
import { getWeixinId } from "@/api/invite/index";
|
|
|
import { generatePriceTable,generateBarcodeTable } from '@/api/product/index'
|
|
import { generatePriceTable,generateBarcodeTable } from '@/api/product/index'
|
|
|
// #ifdef APP-PLUS
|
|
// #ifdef APP-PLUS
|
|
|
-const plug= uni.requireNativePlugin('Html5app-Gprinter')
|
|
|
|
|
|
|
+const plug = uni.requireNativePlugin('Html5app-Gprinter')
|
|
|
// #endif
|
|
// #endif
|
|
|
export default {
|
|
export default {
|
|
|
name: "item_list",
|
|
name: "item_list",
|
|
@@ -102,8 +102,8 @@ export default {
|
|
|
moreToDo(item){
|
|
moreToDo(item){
|
|
|
//查询是否已经连接蓝牙
|
|
//查询是否已经连接蓝牙
|
|
|
let that=this;
|
|
let that=this;
|
|
|
- let doList = ['复制花材', '打印1个条形', '打印条形2个', '打印条形5个','打印条形10个','打印条形20个']
|
|
|
|
|
- let doNum = [0,1,2,5,10,20]
|
|
|
|
|
|
|
+ let doList = ['复制花材', '打印1个条形', '打印2个条形码', '打印条形10个','打印条形20个']
|
|
|
|
|
+ let doNum = [0,1,2,10,20]
|
|
|
uni.showActionSheet({
|
|
uni.showActionSheet({
|
|
|
itemList: doList,
|
|
itemList: doList,
|
|
|
success: function (respond) {
|
|
success: function (respond) {
|
|
@@ -111,7 +111,6 @@ export default {
|
|
|
if (index == 0) {
|
|
if (index == 0) {
|
|
|
that.pageTo({url: '/admin/item/copy',query: {id: item.id}})
|
|
that.pageTo({url: '/admin/item/copy',query: {id: item.id}})
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
// #ifdef APP-PLUS
|
|
// #ifdef APP-PLUS
|
|
|
plug.state({},ret=>{
|
|
plug.state({},ret=>{
|
|
|
if(ret.code == 1){
|
|
if(ret.code == 1){
|
|
@@ -120,27 +119,68 @@ export default {
|
|
|
})
|
|
})
|
|
|
}else{
|
|
}else{
|
|
|
let currentNum = Number(doNum[index])
|
|
let currentNum = Number(doNum[index])
|
|
|
- console.log(currentNum)
|
|
|
|
|
|
|
+ if(Number(currentNum)<0){
|
|
|
|
|
+ this.$msg('请选择打印数量')
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ let data = []
|
|
|
for (let i = 0; i < currentNum; i++) {
|
|
for (let i = 0; i < currentNum; i++) {
|
|
|
- //https://ext.dcloud.net.cn/plugin?id=462
|
|
|
|
|
- plug.printer({"TSC":that.OrderLable(item.name,item.itemId)},ret=>{
|
|
|
|
|
- //uni.showToast({ title: JSON.stringify(ret), duration: 5000 })
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ let label = that.createLable(item.name,item.itemId)
|
|
|
|
|
+ data.push(label)
|
|
|
}
|
|
}
|
|
|
|
|
+ //说明地址 https://ext.dcloud.net.cn/plugin?id=462
|
|
|
|
|
+ plug.printer({"TSC":data,isArray:true},result=>{
|
|
|
|
|
+ //console.log(result)
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
// #endif
|
|
// #endif
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+ },
|
|
|
|
|
+ createLable(itemName,itemId){
|
|
|
|
|
+
|
|
|
|
|
+ //制作标签格式,
|
|
|
|
|
+ var data=[]; //定义一个数组
|
|
|
|
|
+ var line={}; //每添加一个,代表一行字
|
|
|
|
|
+
|
|
|
|
|
+ //设置标签纸大小
|
|
|
|
|
+ line={};
|
|
|
|
|
+ line.width=40; //mm
|
|
|
|
|
+ line.height=30; //mm
|
|
|
|
|
+ line.gap=2; //标签纸之间,间隙长度 mm
|
|
|
|
|
+ line.page=1; //打印几份
|
|
|
|
|
+ data.push(line); //每添加一个,代表一行字
|
|
|
|
|
+
|
|
|
|
|
+ //添加文字
|
|
|
|
|
+ line={};
|
|
|
|
|
+ line.text= itemName;
|
|
|
|
|
+ line.rotation=0;
|
|
|
|
|
+ line.x=30;
|
|
|
|
|
+ line.y=40;
|
|
|
|
|
+ line.xscal=1;
|
|
|
|
|
+ line.yscal=1;
|
|
|
|
|
+ data.push(line); //每添加一个,代表一行字
|
|
|
|
|
+
|
|
|
|
|
+ //添加条型码
|
|
|
|
|
+ line={};
|
|
|
|
|
+ line.barcode=itemId;
|
|
|
|
|
+ line.x=30;
|
|
|
|
|
+ line.y=110;
|
|
|
|
|
+ line.type="CODE128";
|
|
|
|
|
+ line.height=300;
|
|
|
|
|
+ line.readable=true;
|
|
|
|
|
+ line.rotation=0;
|
|
|
|
|
+ data.push(line);
|
|
|
|
|
|
|
|
|
|
+ return data;
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- OrderLable(itemName,itemId){
|
|
|
|
|
-
|
|
|
|
|
|
|
+ createLable2(itemName,itemId){
|
|
|
|
|
+
|
|
|
//制作标签格式,
|
|
//制作标签格式,
|
|
|
var data=[]; //定义一个数组
|
|
var data=[]; //定义一个数组
|
|
|
var line={}; //每添加一个,代表一行字
|
|
var line={}; //每添加一个,代表一行字
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//设置标签纸大小
|
|
//设置标签纸大小
|
|
|
line={};
|
|
line={};
|
|
|
line.width=30; //mm
|
|
line.width=30; //mm
|
|
@@ -180,7 +220,6 @@ export default {
|
|
|
itemList: doList,
|
|
itemList: doList,
|
|
|
success: function (respond) {
|
|
success: function (respond) {
|
|
|
let index = respond.tapIndex
|
|
let index = respond.tapIndex
|
|
|
-
|
|
|
|
|
if(index == 0){
|
|
if(index == 0){
|
|
|
that.downBarcodeTable()
|
|
that.downBarcodeTable()
|
|
|
}
|
|
}
|
|
@@ -203,7 +242,7 @@ export default {
|
|
|
if(!that.$util.isEmpty(globalItem.child)){
|
|
if(!that.$util.isEmpty(globalItem.child)){
|
|
|
globalItem.child.forEach((currentItem)=>{
|
|
globalItem.child.forEach((currentItem)=>{
|
|
|
console.log(currentItem)
|
|
console.log(currentItem)
|
|
|
- plug.printer({"TSC":that.OrderLable(currentItem.name,currentItem.itemId)},ret=>{
|
|
|
|
|
|
|
+ plug.printer({"TSC":that.createLable(currentItem.name,currentItem.itemId)},ret=>{
|
|
|
//uni.showToast({ title: JSON.stringify(ret), duration: 5000 })
|
|
//uni.showToast({ title: JSON.stringify(ret), duration: 5000 })
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|