|
|
@@ -12,7 +12,6 @@
|
|
|
</div>
|
|
|
<text class="add-price" @click.stop="pageTo('/admin/itemClass/addPrice?classId='+item.id)">加价</text>
|
|
|
<text class="add-price" @click.stop="pageTo('/admin/itemClass/more?classId='+item.id)">排序</text>
|
|
|
- <text class="add-price" @click.stop="barCodePrint(item.id)">条码打印</text>
|
|
|
<div class="operate-icon" @click="editItem(item)">
|
|
|
<i class="iconfont" :class="[ index == operateIndex ? 'iconbianji' : 'iconbianji']" style="font-size:38upx;"></i>
|
|
|
</div>
|
|
|
@@ -129,76 +128,6 @@ export default {
|
|
|
onLoad() {
|
|
|
},
|
|
|
methods: {
|
|
|
- barCodePrint(classId){
|
|
|
- let that = this
|
|
|
- plug.state({},ret=>{
|
|
|
- if(ret.code == 1){
|
|
|
- that.$util.confirmModal({content:'您还没有连接条码机,请先连接'},() => {
|
|
|
- // #ifdef APP-PLUS
|
|
|
- plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{
|
|
|
- //console.log(ret)
|
|
|
- })
|
|
|
- // #endif
|
|
|
- })
|
|
|
- }else{
|
|
|
- that.$util.confirmModal({content:'确认打印?'},() => {
|
|
|
- allProduct({classId:classId}).then(res=>{
|
|
|
- if(res.code == 1){
|
|
|
- that.$msg(res.msg)
|
|
|
- let itemData = res.data.list
|
|
|
- if(!that.$util.isEmpty(itemData)){
|
|
|
- itemData.forEach((item)=>{
|
|
|
- console.log(item.name+item.id)
|
|
|
- plug.printer({"TSC":that.OrderLable(item.name,item.itemId)},ret=>{
|
|
|
- //uni.showToast({ title: JSON.stringify(ret), duration: 5000 })
|
|
|
- })
|
|
|
- })
|
|
|
- }else{
|
|
|
- that.$msg('此分类下没有花材')
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- OrderLable(itemName,itemId){
|
|
|
-
|
|
|
- //制作条码格式,
|
|
|
- var data=[]; //定义一个数组
|
|
|
- var line={}; //每添加一个,代表一行字
|
|
|
-
|
|
|
- //设置条码纸大小
|
|
|
- line={};
|
|
|
- line.width=30; //mm
|
|
|
- line.height=20; //mm
|
|
|
- line.gap=2; //条码纸之间,间隙长度 mm
|
|
|
- line.page=1; //打印几份
|
|
|
- data.push(line); //每添加一个,代表一行字
|
|
|
-
|
|
|
- //添加文字
|
|
|
- line={};
|
|
|
- line.text= itemName;
|
|
|
- line.rotation=0;
|
|
|
- line.x=35;
|
|
|
- line.y=20;
|
|
|
- line.xscal=1;
|
|
|
- line.yscal=1;
|
|
|
- data.push(line); //每添加一个,代表一行字
|
|
|
-
|
|
|
- //添加条型码
|
|
|
- line={};
|
|
|
- line.barcode=itemId;
|
|
|
- line.x=35;
|
|
|
- line.y=55;
|
|
|
- line.type="CODE128";
|
|
|
- line.height=50;
|
|
|
- line.readable=true;
|
|
|
- line.rotation=0;
|
|
|
- data.push(line);
|
|
|
-
|
|
|
- return data;
|
|
|
- },
|
|
|
editItem(item){
|
|
|
this.modifyModal = true
|
|
|
this.modifyTitle = '编辑'
|