lilei пре 2 година
родитељ
комит
914415d745

+ 21 - 11
pages/batchShelves/scanProduct.vue

@@ -75,11 +75,17 @@
 			}
 		},
 		onReady() {
-			// 初始化摄像头
-			this.init()
 			uni.setNavigationBarTitle({
 				title: '扫描条形码—' +this.layer+'层'
 			})
+			// 设置高度
+			const query = uni.createSelectorQuery().in(this);
+			query.select('#barcode').boundingClientRect(data => {
+				this.barcode.setStyle({
+					width: data.width + 'px',
+					height: data.height	+ 'px'	// 调整扫码控件的位置
+				})
+			}).exec()
 		},
 		onLoad(options) {
 			this.shelfSn = options.shelfSn
@@ -87,6 +93,8 @@
 			this.shelfName = options.shelfName
 			this.customerSn = options.customerSn
 			this.fromPage = options.from
+			// 初始化摄像头
+			this.init()
 		},
 		onBackPress(e) {
 			uni.$emit("updateTempHw")
@@ -191,7 +199,17 @@
 			init(){
 				const _this = this
 				// 初始化
-				this.barcode = plus.barcode.create('barcode', [], {
+				this.barcode = plus.barcode.create('barcode', [
+					plus.barcode.QR,
+					plus.barcode.EAN13,
+					plus.barcode.EAN8,
+					plus.barcode.UPCA,
+					plus.barcode.UPCE,
+					plus.barcode.CODABAR,
+					plus.barcode.CODE39,
+					plus.barcode.CODE128,
+					plus.barcode.ITF
+				], {
 					top:'0px',
 					left:'0px',
 					width: '100%',
@@ -200,14 +218,6 @@
 					frameColor: '#00aaff',
 					scanbarColor: '#00aaff'
 				})
-				// 设置高度
-				const query = uni.createSelectorQuery().in(this);
-				query.select('#barcode').boundingClientRect(data => {
-					this.barcode.setStyle({
-						width: data.width + 'px',
-						height: data.height	+ 'px'	// 调整扫码控件的位置
-					})
-				}).exec()
 				 
 				// 扫码成功后
 				this.barcode.onmarked = function(type, result) {

+ 6 - 2
pages/batchShelves/searchProduct.vue

@@ -27,12 +27,16 @@
 					</view>
 					<view class="pinfo">
 						<view class="pname">
-							<text v-if="item.shelfCartApi&&item.shelfCartApi.shelfPlaceCode">{{item.shelfCartApi.shelfPlaceCode}}</text>
+							<text v-if="item.shelfCartApi">{{item.shelfCartApi.shelfPlaceCode}}</text>
+							<text v-else-if="item.shelfProductApi">{{item.shelfProductApi.shelfPlaceCode}}</text>
 							{{item.productName}}
 						</view>
 						<view class="ptxt flex justify_between">
 							<text style="word-break: break-all;">{{item.code}}</text>
-							<view v-if="item.shelfProductApi">
+							<view v-if="item.shelfCartApi">
+								可用库存:<text>{{item.shelfCartApi.qty}}</text>{{item.unit}}
+							</view>
+							<view v-else-if="item.shelfProductApi">
 								可用库存:<text>{{item.shelfProductApi.qty}}</text>{{item.unit}}
 							</view>
 						</view>

+ 13 - 7
pages/shelfSetting/shelfList.vue

@@ -71,17 +71,16 @@
 			}
 		},
 		onLoad(opts) {
-			this.getShelfList()
 			uni.$on("setCustome",(data)=>{
-				this.pageNo = 1
-				this.shelfList = []
-				this.search()
 				this.saveShelf(data)
 			})
 		},
 		onUnload() {
 			uni.$off("setCustome")
 		},
+		onShow() {
+			this.search()
+		},
 		methods: {
 			clearSearch(){
 				this.shelfName = ''
@@ -99,13 +98,20 @@
 			},
 			// 关联客户
 			saveShelf(data){
+				uni.showLoading({
+					mask: true,
+					title: '正在关联客户...'
+				})
 				shelfSave({
 					shelfSn: this.tempData.shelfSn,
 					customerSn: data.customerSn
 				}).then(res => {
-					uni.navigateTo({
-						url: "/pages/shelfSetting/shelfSet?shelfSn="+this.tempData.shelfSn
-					})
+					if(res.status == 200){
+						uni.navigateTo({
+							url: "/pages/shelfSetting/shelfSet?shelfSn="+this.tempData.shelfSn
+						})
+					}
+					uni.hideLoading()
 				})
 			},
 			// 获取数字货架列表