lilei 3 vuotta sitten
vanhempi
commit
faffae14e6
3 muutettua tiedostoa jossa 109 lisäystä ja 0 poistoa
  1. 8 0
      pages.json
  2. 4 0
      pages/index/index.vue
  3. 97 0
      pages/index/printAbc.vue

+ 8 - 0
pages.json

@@ -59,6 +59,14 @@
                 "enablePullDownRefresh": false
             }
         },
+		{
+		    "path" : "pages/index/printAbc",
+		    "style" :                                                                                    
+		    {
+		        "navigationBarTitleText": "打印ABC",
+		        "enablePullDownRefresh": false
+		    }
+		},
 		{
             "path" : "pages/shuntBackManage/shuntBackList",
             "style" :                                                                                    

+ 4 - 0
pages/index/index.vue

@@ -15,6 +15,10 @@
 				 <div class="title">补打贴签</div>
 				 <div>遗漏标签快捷处理</div>
 			 </div>
+			 <!-- <div class="graid-box-1" @click="toPage('/pages/index/printAbc')">
+				 <div class="title">打印ABC</div>
+				 <div>遗漏标签快捷处理</div>
+			 </div> -->
 		 </div>
 	</view>
 </template>

+ 97 - 0
pages/index/printAbc.vue

@@ -0,0 +1,97 @@
+<template>
+	<view class="replenishment-manualPrint-wrap">
+		<view class="replenishment-manualPrint-footer">
+			<view>
+				<kk-printer ref="kkprinter" defaultText="开始打印" @startPrint="startPrint"></kk-printer>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import kkPrinter from '@/components/kk-printer/index.vue';
+	import {printText} from '@/libs/printTools.js'
+	export default {
+		components: { kkPrinter },
+		data() {
+			return {
+				printIndex: 0,
+			}
+		},
+		onReady() {
+			uni.setNavigationBarColor({
+				frontColor: '#ffffff',
+				backgroundColor: this.$config('primaryColor')
+			})
+		},
+		methods: {
+			printOnce(opt,tsc,blesdk,data){
+				const _this = this
+				// 60*40 打印模板
+				const command = printText(tsc,data)
+				// 开始批量打印 
+				blesdk.senBlData(
+				opt.deviceId, 
+				opt.serviceId, 
+				opt.writeId, 
+				command.getData(), 
+				function(){
+					const result ='A、B、C、D、E、F、G、H、I、J'.split('、')
+					_this.printIndex = _this.printIndex + 1
+					if(_this.printIndex < result.length){
+						_this.printOnce(opt,tsc,blesdk,result[_this.printIndex])
+					}else{
+						_this.printIndex = 0
+						_this.$refs.kkprinter.onPrintSuccess()
+						_this.isParinting = false
+					}
+				});
+			},
+			// 批量打印 
+			startPrint(opt,tsc,blesdk){
+				const result = 'A、B、C、D、E、F、G、H、I、J'.split('、')
+				if(result.length){
+					 if(this.isParinting){
+					 	return
+					 }
+					 this.isParinting = true
+					 this.printOnce(opt,tsc,blesdk,result[this.printIndex])
+				}else{
+					this.toashMsg("请选择产品!")
+					this.$refs.kkprinter.onPrintFail()
+				}
+			},
+		}
+	}
+</script>
+
+<style lang="less">
+.replenishment-manualPrint-wrap{
+	position: relative;
+	width: 100%;
+	height: 100%;
+	overflow: hidden;
+	padding-bottom: 102upx;
+	.replenishment-manualPrint-body{
+		> view{
+			padding: 10rpx 25rpx;
+			background-color: #fff;
+			margin-bottom: 20rpx;
+			border-radius: 25rpx;
+			box-shadow: 2rpx 3rpx 5rpx #eee;
+		}
+	}
+	.replenishment-manualPrint-footer{
+		padding: 10upx 32upx 12upx;
+		background-color: #fff;
+		position: fixed;
+		left: 0;
+		bottom: 0;
+		width: 100%;
+		box-shadow: 3px 1px 7px #eee;
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+	}
+}
+</style>