Browse Source

扫码打印

chenrui 3 years ago
parent
commit
4dcc2d7a23

+ 9 - 1
api/shelfReplenish.js

@@ -60,4 +60,12 @@ export const shelfReplenishPrintSign = (params) => {
     data: params,
     method: 'post'
   })
-}
+}
+//  补货单 根据条形码获取产品详情
+export const shelfReplenishQrCode = (params) => {
+  return axios.request({
+    url: 'shelfReplenish/detail/queryByProductQrCode',
+    data: params,
+    method: 'post'
+  })
+}

+ 2 - 2
pages/common/commonModal.vue

@@ -73,8 +73,8 @@
 		left: 0;
 		top: 0;
 		.modal-con{
-			width: 78%;
-			margin: 50% auto 0;
+			width: 70%;
+			margin: 70% auto 0;
 			background-color: #fff;
 			border-radius: 24upx;
 			.modal-title{

+ 4 - 4
pages/common/partList.vue

@@ -13,14 +13,14 @@
 							<u-image :src="item.product&&item.product.productMsg?item.product.productMsg:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
 						</view>
 						<view class="pinfo">
-							<view class="pname" v-if="pageType=='replenishmentSign'||pageType=='replenishmentOut'||pageType=='manualPrint'||pageType=='replenishmentDetail'||pageType=='replenishmentDetailc'">{{item.product&&item.product.name?item.product.name:'--'}}</view>
+							<view class="pname" v-if="pageType=='replenishmentSign'||pageType=='replenishmentOut'||pageType=='manualPrint'||pageType=='replenishmentDetail'||pageType=='replenishmentDetailc'||pageType=='scanCodePrint'">{{item.product&&item.product.name?item.product.name:'--'}}</view>
 							<view class="pname" v-else>{{item.productName}}</view>
 							<view class="ptxt flex align_center justify_between">
 								<view>
-									<text class="pcode" v-if="pageType=='replenishmentSign'||pageType=='replenishmentOut'||pageType=='manualPrint'||pageType=='replenishmentDetail'||pageType=='replenishmentDetailc'">{{item.product&&item.product.code?item.product.code:'--'}}</text>
+									<text class="pcode" v-if="pageType=='replenishmentSign'||pageType=='replenishmentOut'||pageType=='manualPrint'||pageType=='replenishmentDetail'||pageType=='replenishmentDetailc'||pageType=='scanCodePrint'">{{item.product&&item.product.code?item.product.code:'--'}}</text>
 									<text class="pcode" v-else>{{item.productCode}}</text>
 								</view>
-								<view v-if="pageType=='replenishmentSign'||pageType=='manualPrint'">
+								<view v-if="pageType=='replenishmentSign'||pageType=='manualPrint'||pageType=='scanCodePrint'">
 									实发数量:<text class="pnums">{{item.confirmQty||item.confirmQty==0?item.confirmQty:'--'}}{{item.product&&item.product.unit?item.product.unit:'--'}}</text>
 								</view>
 								<view v-if="pageType=='replenishmentOut'">
@@ -104,7 +104,7 @@
 				type: String,
 				default: 'checkbox'
 			},
-			// 那个功能页面调用,展示不同的字段,recall: 调回单,replenishmentSign:补货签收,replenishmentOut:补货出库,manualPrint:手动打印,replenishmentDetail:补货详情-已完成,replenishmentDetailc:补货详情-已取消
+			// 那个功能页面调用,展示不同的字段,recall: 调回单,replenishmentSign:补货签收,replenishmentOut:补货出库,manualPrint:手动打印,replenishmentDetail:补货详情-已完成,replenishmentDetailc:补货详情-已取消,scanCodePrint:扫码打印
 			fromPage: {
 				type: String,
 				default: ''

+ 2 - 2
pages/replenishmentManage/outWarehousing.vue

@@ -116,9 +116,9 @@
 			modalPrint(type){
 				this.printModal = false
 				if(type == 'manual'){  // 手动打印
-					uni.navigateTo({ url: "/pages/replenishmentManage/manualPrint" })
+					uni.navigateTo({ url: "/pages/replenishmentManage/manualPrint?sn="+this.replenishBillSn })
 				}else if(type == 'scan'){  // 扫码打印
-					uni.navigateTo({ url: "/pages/replenishmentManage/scanCodePrint" })
+					uni.navigateTo({ url: "/pages/replenishmentManage/scanCodePrint?sn="+this.replenishBillSn })
 				}
 			}
 		}

+ 53 - 226
pages/replenishmentManage/scanCodePrint.vue

@@ -1,141 +1,77 @@
 <template>
-	<view class="scanCodePrint-wrap flex flex_column">
+	<view class="scanCodePrint-wrap">
 		<view class="barCode" id="barcode"></view>
 		<view class="info-body">
-			<view class="flex align-center orderTj" v-if="info">
-				<view>
-					<view class="redText">{{info.totalQty}}</view>
-					<view>总数量</view>
-				</view>
-				<view>
-					<view>{{info.outQty}}</view>
-					<view>已扫码</view>
-				</view>
-			</view>
 			<view class="info partList" v-if="partList.length">
-				<view class="infoList">
-					<view class="title">配件列表</view>
-					<view>
-						{{partList.length}}款,共<text class="redText">{{totalNums}}</text>件
-					</view>
-				</view>
-				<view v-for="item in partList" :key="item.id" class="flex align-center item-list">
-					<view>
-						<u-image border-radius="16" width="130" height="130" bg-color="#EBEBEB" ></u-image>
-					</view>
-					<view>
-						<view class="item-name">
-						  <text>{{item.productName}}</text>
-						</view>
-						<view class="item-nums">
-							<text>{{item.productCode}}</text>
-						</view>
-						<view class="item-head">
-							<view>
-								数量:<text class="redText">{{item.totalQty}}</text>
-								已扫:<text>{{item.outQty}}</text>
-							</view>
-							<text class="item-no">{{item.shelfPlaceCode}}</text>
-						</view>
-					</view>
-				</view>
+				<!-- 补货产品 -->
+				<partList :list="partList" title="补货产品" model="view" fromPage="scanCodePrint" ref="partList" noDataText="暂无产品"></partList>
 			</view>
 		</view>
-		<view class="footer flex align-center" v-if="info">
-			<u-button :throttle-time="100" @click="outShelfOrder" :style="{background:$config('buttonColors'),color:'#fff'}" shape="circle" type="info">确认取货</u-button>
-		</view>
+		<!-- 确认弹框 -->
+		<common-modal v-if="confirmModal" :openModal="confirmModal" title="扫码失败" content="确认对该数字货架进行补货吗?" confirmText="好的" :isCancel="false" @confirm="modalConfirm" @close="confirmModal=false" />
 	</view>
 </template>
 
 <script>
-	// import { findBySnShelfOrder, outShelfOrder, scanConfirmShelfOrder } from '@/api/shelf.js'
-	// import { clzConfirm } from '@/libs/tools.js'
+	import partList from '@/pages/common/partList.vue'
+	import commonModal from '@/pages/common/commonModal.vue'
+	import { shelfReplenishDetailList, shelfReplenishQrCode } from '@/api/shelfReplenish'
 	export default {
+		components: { partList, commonModal },
 		data() {
 			return {
 				barcode:null,
-				shelfOrderSn: null,
-				info: null,
-				partList: []
+				replenishBillSn: null,
+				partList: [],
+				confirmModal: false
 			}
 		},
-		computed: {
-		   totalNums(){
-			   let ret = 0
-			   this.partList.map(item => {
-				   ret += item.totalQty
-			   })
-			   return ret
-		   }
-		},
 		onReady() {
 			// 初始化摄像头
 			this.init()
 		},
 		onLoad(options) {
-			this.shelfOrderSn = options.shelfOrderSn
-			this.getDetail()
+			this.replenishBillSn = options.replenishBillSn
+			this.getPartList()
 		},
 		methods: {
-			// 获取详情
-			getDetail(){
-			  // findBySnShelfOrder({sn: this.shelfOrderSn}).then(res => {
-				 //  if(res.status == 200){
-					//   this.info = res.data
-					//   this.partList = res.data.shelfOrderDetailList
-					//   // 此单已全部扫码,是否确认取货
-					//   if(this.info.totalQty == this.info.outQty){
-					// 	  clzConfirm({
-					// 	  	title: '扫码成功',
-					// 	  	content: '此单已全部扫码,是否确认取货?',
-					// 	  	success: (ret) => {
-					// 	  	  if(ret.confirm||ret.index==0){
-					// 	  		  _this.outShelfOrder()
-					// 	  	  }
-					// 	  	}
-					// 	  })
-					//   }
-				 //  }
-			  // })
-			},
-			// 确认取货
-			outShelfOrder(){
-				// if(this.info.totalQty == this.info.outQty){
-				// 	outShelfOrder({id:this.info.id}).then(res => {
-				// 		if(res.status == 200){
-							
-				// 		}
-				// 	})
-				// }else{
-				// 	this.toashMsg("请先扫码取货")
-				// }
+			// 查询列表
+			getPartList(){
+				const _this = this
+				shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
+					if(res.status == 200 && res.data){
+						this.partList = res.data || []
+					}else{
+						this.partList = []
+					}
+				})
 			},
 			// 扫码结果
 			scanResult(qrCode){
-				console.log(qrCode)
-				// const _this = this
-				// scanConfirmShelfOrder({
-				// 	qrCode: qrCode,
-				// 	id: _this.info.id
-				// }).then(res => {
-				// 	if(res.status == 200){
-				// 		_this.toashMsg("扫码成功!")
-				// 		// 刷新列表
-				// 		_this.getDetail()
-				// 		setTimeout(()=>{
-				// 			_this.barcode.start()
-				// 		},1000)
-				// 	}else{
-				// 		// clzConfirm({
-				// 		// 	title: '扫码失败',
-				// 		// 	content: res.message,
-				// 		// 	showCancel: false,
-				// 		// 	success: (ret) => { 
-				// 		// 		_this.barcode.start()
-				// 		// 	}
-				// 		// })
-				// 	}
-				// })
+				const _this = this
+				shelfReplenishQrCode({
+					qrCode: qrCode,
+					replenishBillSn: this.replenishBillSn
+				}).then(res => {
+					if(res.status == 200){
+						_this.toashMsg("扫码成功!")
+						uni.navigateTo({ url: "/pages/common/printTag/printTag?sn="+item.replenishBillSn })
+					}else{
+						this.confirmModal = true
+						// clzConfirm({
+						// 	title: '扫码失败',
+						// 	content: res.message,
+						// 	showCancel: false,
+						// 	success: (ret) => { 
+						// 		_this.barcode.start()
+						// 	}
+						// })
+					}
+				})
+			},
+			modalConfirm(){
+				this.confirmModal = false
+				this.barcode.start()
 			},
 			init(){
 				const _this = this
@@ -144,7 +80,7 @@
 					top:'0px',
 					left:'0px',
 					width: '100%',
-					height: '35%',
+					height: '28%',
 					position: 'static',
 					frameColor: '#00aaff',
 					scanbarColor: '#00aaff'
@@ -164,7 +100,7 @@
 				// 扫码识别出错
 				this.barcode.onerror = function(error){
 					console.log(error)
-					_this.toashMsg("二维码错误!")
+					_this.toashMsg("条形码错误!")
 					_this.barcode.start()
 				}
 				
@@ -181,130 +117,21 @@
 		height: 100vh;
 	}
 	.scanCodePrint-wrap{
+		width: 100%;
 		height: 100%;
 		.barCode{
-			background-color: #000;
-			height: 500upx;
-		}
-		> view{
-			padding: 20rpx;
+			height: 28%;
 		}
 		.info-body{
 			flex-flow: 1;
 			overflow: auto;
-			height: 60%;
-		}
-		.redText{
-			color: #FB1E1E;
-		}
-		.orderTj{
-			padding: 20rpx;
-			background-color: #fff;
-			> view{
-				text-align: center;
-				border-right: 2rpx solid #eee;
-				width: 50%;
-				color: #666E75;
-				.redText{
-					color: #FB1E1E;
-				}
-				&:last-child{
-					border: 0;
-				}
-				> view{
-					color: #666E75;
-					&:first-child{
-						font-size: 56rpx;
-					}
-				}
-			}
-			border-radius: 20rpx;
+			height: 72%;
 		}
 		.info{
 			background-color: #FFFFFF;
 			padding: 10rpx 30upx;
 			font-size: 32rpx;
 			margin-top: 20rpx;
-			.infoList{
-				display: flex;
-				justify-content: space-between;
-				align-items: center;
-				padding: 20rpx 0;
-				border-bottom: 2rpx solid #f2f2f2;
-				.title{
-					font-weight: bold;
-				}
-				> text{
-					&:first-child{
-						color: #666E75;
-					}
-				}
-			}
-			.item-list{
-				border-bottom: 2rpx solid #f2f2f2;
-				&:last-child{
-					border: none;
-				}
-				> view{
-					padding: 20rpx 0;
-					&:first-child{
-						margin-right: 20rpx;
-						margin-top: 18rpx;
-					}
-					&:last-child{
-						flex-grow: 1;
-					}
-				}
-				.item-name{
-					word-wrap: break-word;
-					font-size: 32rpx;
-					color: #333;
-					font-weight: bold;
-					margin-top: 10rpx;
-				}
-				.item-nums{
-					padding: 10rpx 0;
-					text{
-						font-size: 32rpx;
-						color: #222222;
-					}
-				}
-				.item-head{
-					display: flex;
-					align-items: center;
-					justify-content: space-between;
-					color: #666;
-					> view{
-						&:first-child{
-							font-size: 28rpx;
-							text{
-								margin-right: 30rpx;
-							}
-						}
-					}
-					.item-no{
-						font-size: 28rpx;
-						background: rgba(3, 54, 146, 0.15);
-						color: #033692;
-						border-radius: 100rpx;
-						padding: 2rpx 30rpx;
-						margin-right: 20rpx;
-						display: block;
-					}
-				}
-			}
-		}
-		.footer{
-			padding: 20upx 40upx;
-			background: #FFFFFF;
-			uni-button{
-				&:after{
-					border: 0;
-				}
-				width: 90%;
-				color: #585858;
-				font-size: 32rpx;
-			}
 		}
 	}
 </style>