Browse Source

打印优化

lilei 3 years ago
parent
commit
88942b037e
3 changed files with 119 additions and 22 deletions
  1. 14 0
      manifest.json
  2. 71 7
      pages/replenishmentManage/scanCodePrint.vue
  3. 34 15
      pages/replenishmentManage/sendOutGoods.vue

+ 14 - 0
manifest.json

@@ -166,6 +166,20 @@
                         }
                     }
                 }
+            },
+            "wss-scan" : {
+                "__plugin_info__" : {
+                    "name" : "华为ScanKit统一扫码插件,支持连续扫描模式,安卓-IOS双端 - [试用版,仅用于自定义调试基座]",
+                    "description" : "基于华为HMS ScanKit的统一扫码插件,支持连续和多码扫描模式,支持component组件模式,支持横屏模式",
+                    "platforms" : "Android,iOS",
+                    "url" : "https://ext.dcloud.net.cn/plugin?id=2683",
+                    "android_package_name" : "",
+                    "ios_bundle_id" : "",
+                    "isCloud" : true,
+                    "bought" : 0,
+                    "pid" : "2683",
+                    "parameters" : {}
+                }
             }
         }
     },

+ 71 - 7
pages/replenishmentManage/scanCodePrint.vue

@@ -1,14 +1,20 @@
 <template>
 	<view class="scanCodePrint-wrap">
-		<view class="barCode" id="barcode"></view>
+		<!-- <view class="barCode" id="barcode"></view> -->
 		<view class="info-body">
 			<view class="info partList">
 				<!-- 补货产品 -->
 				<partList :list="partList" title="补货产品" model="view" fromPage="scanCodePrint" ref="partList" noDataText="暂无产品"></partList>
 			</view>
 		</view>
+		<view class="sendOutGoods-footer">
+			<u-button @click="scanCode" type="success" :custom-style="customStyle" hover-class="none" shape="circle">
+				<u-icon name="scan" size="34"></u-icon>
+				点击扫码
+			</u-button>
+		</view>
 		<!-- 确认弹框 -->
-		<common-modal v-if="confirmModal" :openModal="confirmModal" title="扫码失败" content="抱歉,该产品不是此补货单的产品请更换产品重新扫描?" confirmText="好的" :isCancel="false" @confirm="modalConfirm" @close="confirmModal=false" />
+		<common-modal v-if="confirmModal" :openModal="confirmModal" :title="contTitle?'扫码成功':'扫码失败'" :content="contModal" confirmText="继续扫码" @confirm="modalConfirm" @close="confirmModal=false" />
 	</view>
 </template>
 
@@ -23,12 +29,20 @@
 				barcode:null,
 				replenishBillSn: null,
 				partList: [],
-				confirmModal: false
+				contTitle: '',
+				contModal: '',
+				confirmModal: false,
+				mpaasScanModule: null,
+				customStyle: {
+					borderRadius:'100rpx',
+					fontSize:'30rpx',
+					background: this.$config('primaryColor')
+				},
 			}
 		},
 		onReady() {
 			// 初始化摄像头
-			this.init()
+			// this.init()
 		},
 		onLoad(options) {
 			this.replenishBillSn = options.sn
@@ -40,6 +54,43 @@
 			uni.$off('refreshBL')
 		},
 		methods: {
+			// 扫码
+			scanCode(){
+				// this.mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
+				// this.mpaasScanModule.mpaasScan({
+				// 	// 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
+				// 	'scanType':  ['qrCode','barCode'],
+				// 	// 是否隐藏相册,默认false不隐藏
+				// 	'hideAlbum': false
+				// },
+				// (ret) => {
+				// 	// 返回值中,resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
+				// 	// 返回值中,resp_message 表示返回结果信息
+				// 	// 返回值中,resp_result 表示扫码结果,只有成功才会有返回
+				// 	if(ret.resp_code == '1000'){
+				// 		this.scanResult(ret.resp_result)
+				// 	}
+				// })
+				this.mpaasScanModule = uni.requireNativePlugin("wss-scan")
+				this.mpaasScanModule.scan(
+					{
+						"scanType":["CODABAR","CODE93","CODE39","CODE128","EAN13","EAN8","ITF14","UPCCODE_A","UPCCODE_E"],
+						"scanMode":"Customized",
+						"scanStyle":{
+							"scanFrameSizePlus":{"width":250,"height":120},
+							"scanFrameSize":200,
+							"scanLight":"visible",
+							"scanText":"对准物品条形码",
+							"scanTitle":"扫码打印",
+						}
+					},
+					(result) => {
+						console.log(result)
+						if(result.scanStatus == 1){
+							this.scanResult(result.scanValue)
+						}
+					})
+			},
 			// 查询列表
 			getPartList(){
 				const _this = this
@@ -83,6 +134,8 @@
 						}
 						uni.navigateTo({ url: "/pages/common/printTag/printTag?page=smdy&data="+JSON.stringify(params) })
 					}else{
+						this.contTitle = 0
+						this.contModal = "抱歉,该产品不是此补货单的产品请更换产品重新扫描?"
 						this.confirmModal = true
 					}
 					uni.hideLoading()
@@ -90,7 +143,7 @@
 			},
 			modalConfirm(){
 				this.confirmModal = false
-				this.barcode.start()
+				this.scanCode()
 			},
 			init(){
 				const _this = this
@@ -139,13 +192,15 @@
 	.scanCodePrint-wrap{
 		width: 100%;
 		height: 100%;
+		display: flex;
+		flex-direction: column;
 		.barCode{
 			height: 28%;
 		}
 		.info-body{
-			flex-flow: 1;
+			flex-grow: 1;
 			overflow: auto;
-			height: 72%;
+			padding-bottom: 120rpx;
 		}
 		.info{
 			background-color: #FFFFFF;
@@ -153,5 +208,14 @@
 			font-size: 32rpx;
 			margin-top: 20rpx;
 		}
+		.sendOutGoods-footer{
+			padding: 26upx 32upx 30upx;
+			background-color: #fff;
+			position: fixed;
+			left: 0;
+			bottom: 0;
+			width: 100%;
+			box-shadow: 3px 1px 7px #eee;
+		}
 	}
 </style>

+ 34 - 15
pages/replenishmentManage/sendOutGoods.vue

@@ -66,21 +66,40 @@
 		methods: {
 			// 扫码
 			scanCode(){
-				this.mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
-				this.mpaasScanModule.mpaasScan({
-					// 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
-					'scanType':  ['qrCode','barCode'],
-					// 是否隐藏相册,默认false不隐藏
-					'hideAlbum': false
-				},
-				(ret) => {
-					// 返回值中,resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
-					// 返回值中,resp_message 表示返回结果信息
-					// 返回值中,resp_result 表示扫码结果,只有成功才会有返回
-					if(ret.resp_code == '1000'){
-						this.scanResult(ret.resp_result)
-					}
-				})
+				// this.mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
+				// this.mpaasScanModule.mpaasScan({
+				// 	// 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
+				// 	'scanType':  ['qrCode','barCode'],
+				// 	// 是否隐藏相册,默认false不隐藏
+				// 	'hideAlbum': false
+				// },
+				// (ret) => {
+				// 	// 返回值中,resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
+				// 	// 返回值中,resp_message 表示返回结果信息
+				// 	// 返回值中,resp_result 表示扫码结果,只有成功才会有返回
+				// 	if(ret.resp_code == '1000'){
+				// 		this.scanResult(ret.resp_result)
+				// 	}
+				// })
+				this.mpaasScanModule = uni.requireNativePlugin("wss-scan")
+				this.mpaasScanModule.scan(
+					{
+						"scanType":["QRCODE","DATAMATRIX"],
+						"scanMode":"Customized",
+						"scanStyle":{
+							"scanFrameSizePlus":{"width":200,"height":200},
+							"scanFrameSize":200,
+							"scanLight":"visible",
+							"scanText":"对准物品二维码",
+							"scanTitle":"扫码发货出库",
+						}
+					},
+					(result) => {
+						console.log(result)
+						if(result.scanStatus == 1){
+							this.scanResult(result.scanValue)
+						}
+					})
 			},
 			// 详情
 			getDetail(){