|
|
@@ -18,11 +18,9 @@
|
|
|
<view class="item">
|
|
|
<text class="left">图片</text>
|
|
|
<view>
|
|
|
-
|
|
|
<htz-image-upload :max="1" :compress="true" v-model="currentImgData" :headers="headers"
|
|
|
@uploadSuccess="imgUploadSuccess" @imgDelete="imgDeleteFn" :action="getLoginInfo.imgUploadApi">
|
|
|
</htz-image-upload>
|
|
|
-
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -32,7 +30,7 @@
|
|
|
</view>
|
|
|
|
|
|
<view class="item" v-if="form.complete == 1">
|
|
|
- <text class="left">打印条码</text>
|
|
|
+ <text class="left">打印</text>
|
|
|
<switch :checked="form.needPrint == 1 ? true : false" @change="changePrint" style="transform: scale(0.9,0.8)" />
|
|
|
</view>
|
|
|
|
|
|
@@ -42,10 +40,6 @@
|
|
|
<button @click="confirmAdd()">确认</button>
|
|
|
</view>
|
|
|
|
|
|
- <uni-popup ref="getPrintRef" type="dialog">
|
|
|
- <uni-popup-dialog type="info" cancelText="取消" confirmText="好的" title="提示" content="您还没有连接标签机,请先连接" @confirm="confirmGetPrint"></uni-popup-dialog>
|
|
|
- </uni-popup>
|
|
|
-
|
|
|
<uni-popup ref="confirmCreateRef" type="dialog">
|
|
|
<uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="提示" content="确认提交?" @confirm="confirmCreate"></uni-popup-dialog>
|
|
|
</uni-popup>
|
|
|
@@ -137,11 +131,6 @@ export default {
|
|
|
cancelCreate(){
|
|
|
this.$emit('cancelCreate')
|
|
|
},
|
|
|
- confirmGetPrint(){
|
|
|
- plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{
|
|
|
- //console.log(ret)
|
|
|
- })
|
|
|
- },
|
|
|
confirmAdd(){
|
|
|
this.$refs.confirmCreateRef.open('center')
|
|
|
},
|
|
|
@@ -159,23 +148,7 @@ export default {
|
|
|
if(this.form.complete == 0){
|
|
|
this.form.needPrint = 2
|
|
|
}
|
|
|
- if(this.form.needPrint == 1){
|
|
|
- // #ifdef MP-WEIXIN
|
|
|
- this.$msg('小程序不支持打印条码')
|
|
|
- // #endif
|
|
|
- // #ifdef APP-PLUS
|
|
|
- plug.state({},ret=>{
|
|
|
- if(ret.code == 1){
|
|
|
- //提醒连接标签机
|
|
|
- that.$refs.getPrintRef.open('center')
|
|
|
- }else{
|
|
|
- this.commitCreate()
|
|
|
- }
|
|
|
- })
|
|
|
- // #endif
|
|
|
- }else{
|
|
|
- this.commitCreate()
|
|
|
- }
|
|
|
+ this.commitCreate()
|
|
|
},
|
|
|
commitCreate(){
|
|
|
let that = this
|
|
|
@@ -188,21 +161,6 @@ export default {
|
|
|
that.$emit('confirmCreate')
|
|
|
that.removeFromSaveDirect()
|
|
|
|
|
|
- if(that.form.needPrint == 1){
|
|
|
- let goodsSn = res.data.goodsSn || ''
|
|
|
- let name = res.data.name || ''
|
|
|
- let currentNum = res.data.num ? Number(res.data.num) : 1
|
|
|
- if(!that.$util.isEmpty(goodsSn)){
|
|
|
- let data = []
|
|
|
- let label = that.createLable(name,goodsSn,currentNum)
|
|
|
- data.push(label)
|
|
|
- //说明地址 https://ext.dcloud.net.cn/plugin?id=462
|
|
|
- plug.printer({"TSC":data,isArray:true},result=>{
|
|
|
- //console.log(result)
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
that.form.cover = ''
|
|
|
that.currentImgData = []
|
|
|
that.form.name=''
|
|
|
@@ -213,45 +171,7 @@ export default {
|
|
|
|
|
|
}
|
|
|
})
|
|
|
- },
|
|
|
- //大标签
|
|
|
- createLable(itemName,itemId,num){
|
|
|
- //制作标签格式,
|
|
|
- var data=[]; //定义一个数组
|
|
|
- var line={}; //每添加一个,代表一行字
|
|
|
-
|
|
|
- //设置标签纸大小
|
|
|
- line={};
|
|
|
- line.width=40; //mm
|
|
|
- line.height=50; //mm
|
|
|
- line.gap=2; //标签纸之间,间隙长度 mm
|
|
|
- line.page=num; //打印几份
|
|
|
- data.push(line); //每添加一个,代表一行字
|
|
|
-
|
|
|
- //添加文字
|
|
|
- line={};
|
|
|
- line.text= itemName;
|
|
|
- line.rotation=0;
|
|
|
- line.x=30;
|
|
|
- line.y=15;
|
|
|
- line.xscal=2;
|
|
|
- line.yscal=2;
|
|
|
- data.push(line); //每添加一个,代表一行字
|
|
|
-
|
|
|
- //添加条型码
|
|
|
- line={};
|
|
|
- line.barcode=itemId;
|
|
|
- line.x=30;
|
|
|
- line.y=80;
|
|
|
- line.type="CODE128";
|
|
|
- line.width=2;//条型宽度,这里的宽指的是 条型码 竖条的宽度,不是整个条型码的宽度
|
|
|
- line.height=90;
|
|
|
- line.readable=true;
|
|
|
- line.rotation=0;
|
|
|
- data.push(line);
|
|
|
-
|
|
|
- return data;
|
|
|
- },
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|