|
@@ -1,5 +1,6 @@
|
|
<template>
|
|
<template>
|
|
<view class="printTag">
|
|
<view class="printTag">
|
|
|
|
+ <u-alert-tips :show="show" @close="show = false" type="warning" description="正在打印中,请勿息屏或退出应用!"></u-alert-tips>
|
|
<view class="print-nums flex flex_column align_center justify_center">
|
|
<view class="print-nums flex flex_column align_center justify_center">
|
|
<view>打印数量</view>
|
|
<view>打印数量</view>
|
|
<view class="u-ninput">
|
|
<view class="u-ninput">
|
|
@@ -8,7 +9,7 @@
|
|
</view>
|
|
</view>
|
|
<view class="shelf-info">
|
|
<view class="shelf-info">
|
|
<view class="shelf-info-title">
|
|
<view class="shelf-info-title">
|
|
- <view>{{infoData&&infoData.shelfName || '--'}}</view>
|
|
|
|
|
|
+ <view class="shelf-name">{{infoData&&infoData.shelfName || '--'}}</view>
|
|
<view class="pno">{{infoData&&infoData.shelfPlaceCode}}</view>
|
|
<view class="pno">{{infoData&&infoData.shelfPlaceCode}}</view>
|
|
</view>
|
|
</view>
|
|
<view>产品编码:{{fromPage == 'smdy'?infoData.productCode : infoData.productEntity&&infoData.productEntity.code}}</view>
|
|
<view>产品编码:{{fromPage == 'smdy'?infoData.productCode : infoData.productEntity&&infoData.productEntity.code}}</view>
|
|
@@ -36,6 +37,7 @@
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ show: false,
|
|
infoData: null,
|
|
infoData: null,
|
|
fromPage: '',
|
|
fromPage: '',
|
|
printInfo: null,
|
|
printInfo: null,
|
|
@@ -50,6 +52,10 @@
|
|
_this.printNum = _this.fromPage == 'smdy' ? _this.infoData.confirmQty : _this.infoData.qty
|
|
_this.printNum = _this.fromPage == 'smdy' ? _this.infoData.confirmQty : _this.infoData.qty
|
|
_this.printNum = _this.printNum||1
|
|
_this.printNum = _this.printNum||1
|
|
console.log(_this.infoData)
|
|
console.log(_this.infoData)
|
|
|
|
+ // 保持屏幕常亮
|
|
|
|
+ uni.setKeepScreenOn({
|
|
|
|
+ keepScreenOn: true
|
|
|
|
+ });
|
|
},
|
|
},
|
|
onUnload() {
|
|
onUnload() {
|
|
// this.$refs.kkprinter.closeConnect()
|
|
// this.$refs.kkprinter.closeConnect()
|
|
@@ -57,11 +63,22 @@
|
|
this.infoData = null
|
|
this.infoData = null
|
|
this.printInfo = null
|
|
this.printInfo = null
|
|
this.fromPage = ''
|
|
this.fromPage = ''
|
|
|
|
+ // 保持屏幕常亮
|
|
|
|
+ uni.setKeepScreenOn({
|
|
|
|
+ keepScreenOn: false
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 监听页面返回,返回 event = {from:backbutton、 navigateBack} ,backbutton 表示来源是左上角返回按钮或 android 返回键;navigateBack表示来源是 uni.navigateBack
|
|
// 监听页面返回,返回 event = {from:backbutton、 navigateBack} ,backbutton 表示来源是左上角返回按钮或 android 返回键;navigateBack表示来源是 uni.navigateBack
|
|
onBackPress(event){
|
|
onBackPress(event){
|
|
if(event.from == 'backbutton'){
|
|
if(event.from == 'backbutton'){
|
|
- this.cancel()
|
|
|
|
|
|
+ if(this.isParinting){
|
|
|
|
+ uni.showToast({
|
|
|
|
+ icon:'none',
|
|
|
|
+ title: '正在打印中...'
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ this.cancel()
|
|
|
|
+ }
|
|
return true // 阻止默认返回行为(会导致无限循环)
|
|
return true // 阻止默认返回行为(会导致无限循环)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -123,14 +140,15 @@
|
|
return
|
|
return
|
|
}
|
|
}
|
|
this.isParinting = true
|
|
this.isParinting = true
|
|
|
|
+ this.show = true
|
|
const command = printTempl(tsc,this.printInfo)
|
|
const command = printTempl(tsc,this.printInfo)
|
|
blesdk.senBlData(opt.deviceId, opt.serviceId, opt.writeId, command.getData(), this.onPrintSuccess);
|
|
blesdk.senBlData(opt.deviceId, opt.serviceId, opt.writeId, command.getData(), this.onPrintSuccess);
|
|
},
|
|
},
|
|
// 打印成功
|
|
// 打印成功
|
|
onPrintSuccess(){
|
|
onPrintSuccess(){
|
|
- // uni.navigateBack()
|
|
|
|
this.$refs.kkprinter.onPrintSuccess()
|
|
this.$refs.kkprinter.onPrintSuccess()
|
|
this.isParinting = false
|
|
this.isParinting = false
|
|
|
|
+ this.show = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -172,17 +190,23 @@
|
|
border-radius: 12rpx;
|
|
border-radius: 12rpx;
|
|
color: #707070;
|
|
color: #707070;
|
|
.shelf-info-title{
|
|
.shelf-info-title{
|
|
- font-size: 32rpx;
|
|
|
|
|
|
+ font-size: 30rpx;
|
|
color: #222222;
|
|
color: #222222;
|
|
display: flex;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
margin-bottom: 10rpx;
|
|
margin-bottom: 10rpx;
|
|
|
|
+ .shelf-name{
|
|
|
|
+ flex:1;
|
|
|
|
+ margin-right: 10rpx;
|
|
|
|
+ }
|
|
.pno{
|
|
.pno{
|
|
background: rgba(3, 54, 146, 0.15);
|
|
background: rgba(3, 54, 146, 0.15);
|
|
border-radius: 100rpx;
|
|
border-radius: 100rpx;
|
|
- padding: 4rpx 20rpx;
|
|
|
|
|
|
+ padding: 0 20rpx;
|
|
color: #033692;
|
|
color: #033692;
|
|
font-size: 26rpx;
|
|
font-size: 26rpx;
|
|
|
|
+ height: 40rpx;
|
|
|
|
+ margin-top:5rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|