lilei 2 gadi atpakaļ
vecāks
revīzija
8241184fd6

+ 1 - 1
App.vue

@@ -5,7 +5,7 @@
 			token: '',
 			changeOrg:'',
 			version: '', // 当前版本号
-			buildType: 'uat', // 打包环境对应类型,pro 生产 uat 预发布 dev 本地开发
+			buildType: 'dev', // 打包环境对应类型,pro 生产 uat 预发布 dev 本地开发
 			envTips: '', // 环境文字提示
 			theme: 'default', // 主题,default
 			isIphoneXup: false //是否iphonex以及以上的版本

+ 44 - 0
api/shelfCart.js

@@ -0,0 +1,44 @@
+import axios from '@/libs/axios.js'
+
+// 货架分页列表
+export const queryProduct = (params) => {
+	return axios.request({
+		url: `shelfCart/queryProduct`,
+		data: params,
+		method: 'post'
+	})
+}
+
+// 录入保存
+export const shelfCartSave = (params) => {
+	return axios.request({
+		url: `shelfCart/save`,
+		data: params,
+		method: 'post'
+	})
+}
+
+// 已录入的所有产品
+export const queryMapList = (params) => {
+	return axios.request({
+		url: `shelfCart/queryMap`,
+		data: params,
+		method: 'post'
+	})
+}
+// 查询产品统计
+export const queryCountList = (params) => {
+	return axios.request({
+		url: `shelfCart/queryCount`,
+		data: params,
+		method: 'post'
+	})
+}
+// 删除产品
+export const shelfCartDelete = (params) => {
+	return axios.request({
+		url: `shelfCart/delete`,
+		data: params,
+		method: 'post'
+	})
+}

+ 1 - 1
config/index.js

@@ -6,7 +6,7 @@ const getConfig = (theme) => {
 			themePath: 'default',
 			pro_URL: 'https://iscm.360arrow.com/qpls-md/', // 生产地址
 			uat_URL: 'http://p.iscm.360arrow.com/qpls-md/', // 预发布地址
-			dev_URL: 'http://192.168.0.182:8503/qpls-md/', // 本地地址
+			dev_URL: 'http://192.168.0.215:8503/qpls-md/', // 本地地址
 			appName: 'iSCM智慧供应链', // app 名称
 			company: '陕西山海高科信息技术有限公司',
 			loadText:{

+ 2 - 1
main.js

@@ -48,7 +48,8 @@ Vue.prototype.toashMsg = function (title) {
 	title = title == undefined ? "系统繁忙" : title;
 	uni.showToast({
 		title:title,
-		icon:'none'
+		icon:'none',
+		duration: 4000
 	})
 }
 

+ 81 - 5
pages.json

@@ -363,12 +363,24 @@
         }
         ,{
             "path" : "pages/shelfSetting/shelfSet",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "货架设置",
-                "enablePullDownRefresh": false
+            "style": {
+            	"navigationBarTitleText": "货架设置",
+            	"navigationStyle":"custom",
+            	"app-plus":{
+            		"titleNView": {
+            			"titleAlign": "auto",
+            			"buttons": [ //原生标题栏按钮配置,
+            				{
+            					"text": "\ue6ee 批量上架产品" ,//原生标题栏增加分享按钮,点击事件可通过页面的 onNavigationBarButtonTap 函数进行监听u
+            					"fontSrc": "/static/iconfont/iconfont.ttf",
+            					"fontSize": "16",
+								"color": "#00aaff",
+            					"width":"150px"
+            				}
+            			]
+            		}
+            	}
             }
-            
         }
         ,{
             "path" : "pages/shelfSetting/editShelf",
@@ -481,6 +493,70 @@
             }
             
         }
+        ,{
+            "path" : "pages/batchShelves/index",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "批量上架产品——选层",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/batchShelves/scanProduct",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "扫描条形码",
+                "enablePullDownRefresh": false,
+				"app-plus":{
+					"titleNView": {
+						"titleAlign": "auto",
+						"buttons": [ //原生标题栏按钮配置,
+							{
+								"text": "\ue694 按产品编码搜索" ,//原生标题栏增加分享按钮,点击事件可通过页面的 onNavigationBarButtonTap 函数进行监听u
+								"fontSrc": "/static/iconfont/iconfont.ttf",
+								"fontSize": "14",
+								"color": "#00aaff",
+								"width":"150px"
+							}
+						]
+					}
+				}
+            }
+            
+        }
+        ,{
+            "path" : "pages/batchShelves/searchProduct",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "按产品编码搜索",
+                "enablePullDownRefresh": false,
+				"app-plus":{
+					"titleNView": {
+						"titleAlign": "auto",
+						"buttons": [ //原生标题栏按钮配置,
+							{
+								"text": "\ue694 扫描条形码" ,//原生标题栏增加分享按钮,点击事件可通过页面的 onNavigationBarButtonTap 函数进行监听u
+								"fontSrc": "/static/iconfont/iconfont.ttf",
+								"fontSize": "14",
+								"color": "#00aaff",
+								"width":"120px"
+							}
+						]
+					}
+				}
+            }
+            
+        }
+        ,{
+            "path" : "pages/batchShelves/cartList",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "批量上架产品",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",

+ 377 - 0
pages/batchShelves/cartList.vue

@@ -0,0 +1,377 @@
+<template>
+	<view class="content flex flex_column">
+		<view class="product-list flex">
+			<view class="leftTabs">
+				<view v-for="item in placeTab" :key="item" :class="curTab==item?'active':''" @click="curTab = item">{{item}}层</view>
+			</view>
+			<view class="rightCons">
+				<view class="partList-list-box" v-for="item in shelfPlaceList[curTab]" :key="item.shelfCartSn">
+					<view class="flex align_center flex_1">
+						<view class="pimgs">
+							<u-image :src="item.product&&item.product.images?item.product.images:`../../static/${$config('themePath')}/def_img@2x.png`" width="120" height="120" border-radius="10"></u-image>
+						</view>
+						<view class="pinfo">
+							<view class="pname">
+								<text>{{item.shelfPlaceCode}}</text>
+								{{item.product.productName}}
+							</view>
+						</view>
+					</view>
+					<view class="ptools flex align_center justify_between">
+						<view></view>
+						<view>{{item.productCode}}</view>
+						<view class="pcurnums flex align_center">
+							<view class="u-ninput">
+								<u-number-box :index="item.id" @blur="updateNums" @minus="updateNums" @plus="updateNums" color="#000" bg-color="#fff" v-model="item.qty" :min="0"></u-number-box>
+							</view>
+						</view>
+					</view>
+				</view>
+			</view>
+		</view>
+		<view class="footer-bar flex align_center justify_between">
+			<view class="heji flex align_center" @click="showPop=!showPop">
+				所有层合计款数:<text>{{totalKs}}</text>;数量:<text>{{totalNums}}</text>;
+				<u-icon name="arrow-up"></u-icon>
+			</view>
+			<view class="btns">
+				<u-button @click="showLayer=true" type='primary' shape="circle" size="medium">继续录入产品</u-button>
+			</view>
+		</view>
+		
+		<!-- 合计弹框 -->
+		<u-popup mode="bottom" :mask="false" closeable v-model="showPop" :custom-style="{bottom:'100rpx'}">
+			<view class="heji-content">
+				<scroll-view scroll-y="true" style="height: 400rpx;">
+					<view class="heji-con-list">
+						<view class="flex align_center" v-for="item in countData" :key="item.shelfTierCode">
+							<view>{{item.shelfTierCode}}层</view>
+							<view class="flex align_center">
+								<text>款数:{{item.category}}</text>
+								<text>数量:{{item.qty}}</text>
+							</view>
+						</view>
+					</view>
+				</scroll-view>
+			</view>
+		</u-popup>
+		
+		<!-- 选中层 -->
+		<u-popup mode="center" width="80%" closeable v-model="showLayer" border-radius="15">
+			<view class="layer-content">
+				 <view class="tits">请选择产品的货架层号</view>
+				 <view class="tagbox flex">
+				 	<view>
+				 		<view class="tag" :class="curLayer==item?'active':''" v-for="item in layerList" :key="item" @click="curLayer=curLayer==item?'':item">
+				 			{{item}}层
+				 		</view>
+				 	</view>
+				 </view>
+				 <view class="newbtn flex justify_between" v-if="curLayer">
+				 	<u-button shape="circle" @click="searchProduct()" size="medium">按产品编码搜索</u-button>
+				 	<u-button @click="scanProduct()" type='primary' shape="circle" size="medium">扫描条形码匹配</u-button>
+				 </view>
+			</view>
+		</u-popup>
+	</view>
+</template>
+
+<script>
+	import { clzConfirm, numberToFixed } from '@/libs/tools';
+	import {queryMapList, queryCountList, shelfCartSave, shelfCartDelete} from '@/api/shelfCart.js'
+	export default {
+		data() {
+			return {
+				showPop: false,
+				shelfSn: '',
+				shelfPlaceList: [],
+				placeTab: [],
+				curTab: '',
+				totalKs: 0,
+				totalNums: 0,
+				countData: [],
+				layerList: [],
+				showLayer: false,
+				curLayer: ''
+			}
+		},
+		onLoad(opts) {
+			this.layerList = 'A、B、C、D、E、F、G、H、I、J、K、L、M、N、O、P、Q、R、S、T、U、V、W、X、Y、Z'.split('、');
+			this.shelfSn = opts.shelfSn || '438473399995965440'
+			this.pageInit()
+		},
+		methods: {
+			pageInit(){
+				this.placeTab = []
+				this.shelfPlaceList = []
+				this.countData = []
+				this.getList()
+				this.getCount()
+			},
+			scanProduct(){
+				uni.redirectTo({
+					url: "/pages/batchShelves/scanProduct?shelfSn="+this.shelfSn+'&layer='+this.curLayer+'&shelfName='+this.shelfName
+				})
+			},
+			searchProduct(){
+				uni.redirectTo({
+					url: "/pages/batchShelves/searchProduct?shelfSn="+this.shelfSn+'&layer='+this.curLayer+'&shelfName='+this.shelfName
+				})
+			},
+			// 获取产品列表
+			getList(flag){
+				queryMapList({ shelfSn: this.shelfSn }).then(res => {
+				  console.log(res.data)
+				  if (res.status == 200 && res.data) {
+				    this.shelfPlaceList = res.data
+					for(let a in res.data){
+						this.placeTab.push(a)
+					}
+					if(!flag || this.placeTab.length==1){
+					  this.curTab = this.placeTab[0]
+					}
+					if(this.placeTab.length == 0){
+						this.shelfPlaceList = null
+					}
+				  } else {
+				    this.shelfPlaceList = null
+					this.placeTab = []
+				  }
+				})
+			},
+			// 获取统计数据
+			getCount(){
+				this.totalKs = 0
+				this.totalNums = 0
+				queryCountList({shelfSn: this.shelfSn}).then(res => {
+					if(res.status == 200){
+						this.countData = res.data
+						// 计算合计
+						this.countData.map(item => {
+							this.totalKs += item.category||0
+							this.totalNums += item.qty||0
+						})
+					}
+				})
+			},
+			// 删除
+			shelfCartDelete(row){
+				const _this = this
+				clzConfirm({
+				  title: '提示',
+				  content: '确认删除此货位和产品吗?',
+				  success (ret) {
+						if (ret.confirm || ret.index == 0) {
+							uni.showLoading({
+								title: '正在删除...'
+							})
+							shelfCartDelete({ shelfCartSn: row.shelfCartSn }).then(res => {
+							  if (res.status == 200) {
+								  _this.toashMsg(res.message)
+								  _this.pageInit()
+							  }
+							  uni.hideLoading()
+							})
+						}else{
+							row.qty = 1
+						}
+				  }
+				})
+			},
+			// 修改数量
+			updateNums(e){
+				console.log(e)
+				const row = this.shelfPlaceList[this.curTab].find(item => item.id == e.index)
+				const nums = e.value
+				
+				// 如果小于1,提示是否删除
+				if(nums<1){
+					this.shelfCartDelete(row)
+					return
+				}
+				// 继续修改数量
+				uni.showLoading({
+					title: '正在保存...'
+				})
+				const params = {
+					shelfSn: row.shelfSn,
+					shelfName: this.shelfName,
+					shelfTierCode: row.shelfTierCode,
+					shelfPlaceSn: row.shelfPlaceSn,
+					shelfPlaceCode: row.shelfPlaceCode,
+					productSn: row.productSn,
+					productCode: row.productCode,
+					qty: nums,
+					price: row.price,
+					cost: row.cost,
+					shelfCartSn: row.shelfCartSn
+				}
+				console.log(params)
+				shelfCartSave(params).then(res => {
+					if(res.status == 200){
+						this.toashMsg(res.message)
+						this.getCount()
+					}
+					uni.hideLoading()
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="less">
+	.content{
+		width: 100%;
+		height: 100vh;
+		.product-list{
+			flex-grow: 1;
+			.leftTabs{
+				width: 20%;
+				overflow: auto;
+				> view{
+					padding: 0.8rem 0.5rem;
+					border-left: 0.2rem solid #f8f8f8;
+					text-align: center;
+				}
+				.active{
+					border-color: rgb(47, 126, 209);
+					background-color: #fff;
+				}
+			}
+			.rightCons{
+				width: 80%;
+				background-color: #fff;
+				position: relative;
+				overflow: auto;
+				padding: 0 20upx;
+				.partList-list-box{
+					padding: 10px 0;
+					border-bottom: 2rpx solid #f5f5f5;
+					.pinfo{
+						flex-grow: 1;
+						padding-left: 20rpx;
+						.pname{
+							color: #191919;
+							font-size: 24rpx;
+							text{
+								font-weight: normal;
+								margin-right: 10rpx;
+								padding: 0 10rpx;
+								background: rgba(3, 54, 146, 0.15);
+								border-radius: 30rpx;
+								color: #033692;
+								font-size: 24rpx;
+							}
+						}
+					}
+					.ptools{
+						color: #666;
+						font-size: 24rpx;
+						.u-ninput{
+							border: 2rpx solid #eee;
+							border-radius: 50rpx;
+							padding: 0 6rpx;
+						}
+						/deep/ .u-icon-disabled{
+							background: #fff!important;
+						}
+						/deep/ .u-number-input{
+							margin: 0 0;
+							border: 2rpx solid #eee;
+							border-top: 0;
+							border-bottom: 0;
+						}
+						/deep/ .u-icon-plus, /deep/ .u-icon-minus{
+							border-radius: 50rpx;
+						}
+					}
+				}
+			}
+		}
+		.footer-bar{
+			padding: 20rpx;
+			.heji{
+				flex-grow: 1;
+				color: #999;
+				text{
+					color: #333;
+				}
+				font-size: 24rpx;
+				padding-right: 30upx;
+			}
+			.btns{
+				button{
+					width: 200rpx;
+					background-color: rgb(51, 95, 182);
+					color: #fff;
+				}
+			}
+		}
+		.heji-content{
+			padding: 60upx 30upx 30upx;
+		}
+		.heji-con-list{
+			> view{
+				display: flex;
+				align-items: center;
+				border-bottom: 2rpx solid #eee;
+				padding: 18rpx 0;
+				> view{
+					&:first-child{
+						font-weight: normal;
+						padding: 4rpx 15rpx;
+						background: rgba(3, 54, 146, 0.15);
+						border-radius: 10rpx;
+						color: #033692;
+						font-size: 24rpx;
+						margin-right: 30upx;
+					}
+					&:last-child{
+						flex-grow: 1;
+						text{
+							margin-right: 20upx;
+						}
+					}
+				}
+			}
+		}
+		
+		.layer-content{
+			padding: 30upx;
+			.tits{
+				padding: 10upx 0 20upx;
+				text-align: center;
+			}
+			.tagbox{
+				flex-grow: 1;
+				> view{
+					margin: 0 auto;
+					overflow: hidden;
+					width: 100%;
+					.tag{
+						width: 16%;
+						background-color: #fff;
+						border:1rpx solid #aeaeae;
+						box-shadow: 2rpx 4rpx 6rpx #eee;
+						border-radius: 15rpx;
+						text-align: center;
+						padding: 10rpx 0;
+						float: left;
+						margin: 10rpx 2%;
+					}
+					.active{
+						background-color: #55aaff;
+						border-color: #55aaff;
+						color: #fff;
+					}
+				}
+			}
+			.newbtn{
+				padding: 40upx 0 10upx;
+				button{
+					width: 45%;
+				}
+			}
+		}
+	}
+</style>

+ 89 - 0
pages/batchShelves/index.vue

@@ -0,0 +1,89 @@
+<template>
+	<view class="content flex flex_column">
+		<view class="tits">请选择产品的货架层号</view>
+		<view class="tagbox flex">
+			<view>
+				<view class="tag" :class="curTag==item?'active':''" v-for="item in list" :key="item" @click="curTag=curTag==item?'':item">
+					{{item}}层
+				</view>
+			</view>
+		</view>
+		<view class="newbtn flex justify_between" v-if="curTag">
+			<u-button shape="circle" @click="searchProduct()" size="medium">按产品编码搜索</u-button>
+			<u-button @click="scanProduct()" type='primary' shape="circle" size="medium">扫描条形码匹配</u-button>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				list:[],
+				curTag: '',
+				shelfSn: '',
+				shelfName: ''
+			}
+		},
+		onLoad(opts) {
+			this.list = 'A、B、C、D、E、F、G、H、I、J、K、L、M、N、O、P、Q、R、S、T、U、V、W、X、Y、Z'.split('、');
+			this.shelfName = opts.shelfName
+			this.shelfSn = opts.shelfSn
+		},
+		methods: {
+			scanProduct(){
+				uni.redirectTo({
+					url: "/pages/batchShelves/scanProduct?shelfSn="+this.shelfSn+'&layer='+this.curTag+'&shelfName='+this.shelfName
+				})
+			},
+			searchProduct(){
+				uni.redirectTo({
+					url: "/pages/batchShelves/searchProduct?shelfSn="+this.shelfSn+'&layer='+this.curTag+'&shelfName='+this.shelfName
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.content{
+		width: 100%;
+		height: 100vh;
+		padding: 20upx;
+		background-color: #fff;
+		.tits{
+			padding: 30upx 0;
+			text-align: center;
+		}
+		.tagbox{
+			flex-grow: 1;
+			> view{
+				margin: 0 auto;
+				overflow: hidden;
+				width: 100%;
+				.tag{
+					width: 16%;
+					background-color: #fff;
+					border:1rpx solid #aeaeae;
+					box-shadow: 2rpx 4rpx 6rpx #eee;
+					border-radius: 15rpx;
+					text-align: center;
+					padding: 10rpx 0;
+					float: left;
+					margin: 20rpx 2%;
+				}
+				.active{
+					background-color: #55aaff;
+					border-color: #55aaff;
+					color: #fff;
+				}
+			}
+		}
+		.newbtn{
+			padding: 30upx;
+			button{
+				width: 45%;
+			}
+		}
+	}
+</style>

+ 319 - 0
pages/batchShelves/scanProduct.vue

@@ -0,0 +1,319 @@
+<template>
+	<view class="scanCode-wrap">
+		<view class="barCode" id="barcode"></view>
+		<view class="info-body">
+			<view class="info" v-if="productInfo">
+				<view>
+					<view class="shelfPlaceCode">{{shelfPlaceCode}}</view>
+					<view class="flex flex_1 align_center">
+						<view class="pimgs">
+							<u-image :src="productInfo.images?productInfo.images:`../../static/${$config('themePath')}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
+						</view>
+						<view class="pinfo flex_1">
+							<view class="ptxt flex align_center justify_between">
+								<view>{{productInfo.code}}</view>
+								<view class="pcode">
+									可用库存:<text>{{productInfo.currQty||0}} </text> {{productInfo.unit}}
+								</view>
+							</view>
+							<view class="pname">
+								{{productInfo.productName}}
+							</view>
+						</view>
+					</view>
+				</view>
+				<view class="product-nums">
+					<view>本次上架数量</view>
+					<view class="numsBox flex align_center justify_between">
+						<view class="a-left" @click="numsBoxScroll(0)"><u-icon name="arrow-left"></u-icon></view>
+						<scroll-view class="scroll-nums" scroll-x="true" :scroll-left="scleft">
+							<view class="ntabs-box flex align_center">
+								<view class="ntabs" @click="saveData(item)" :class="curQty==item?'active':''" v-for="item in 100" :key="item">{{item}}</view>
+							</view>
+						</scroll-view>
+						<view class="a-right" @click="numsBoxScroll(1)"><u-icon name="arrow-right"></u-icon></view>
+					</view>
+				</view>
+				<view class="infoTits" v-if="productInfo.shelfCartApi">产品已录入,请确认数量</view>
+			</view>
+			<view class="noData" v-else>
+				暂无扫描结果
+			</view>
+		</view>
+		<!-- 确认弹框 -->
+		<u-popup v-model="confirmModal" closeable mode="center" border-radius="14" width="80%" @close="modalConfirm">
+			<view style="display: flex;flex-direction:column;justify-content: center;padding: 30rpx;">
+				<view style="margin-top: 40rpx;text-align: center;">没有找到该产品,请重新扫描</view>
+				<view style="color: dodgerblue;padding: 30upx 30upx 50upx;text-align: center;">试一试</view>
+				<view style="text-align: center;display: flex;justify-content: space-between;">
+					<u-button style="width: 40%;" shape="circle" @click="searchProduct()" size="medium">按产品编码搜索</u-button>
+					<u-button style="width: 40%;" @click="modalConfirm" type='primary' shape="circle" size="medium">继续扫码</u-button>
+				</view>
+			</view>
+		</u-popup>
+	</view>
+</template>
+
+<script>
+	import { queryProduct, shelfCartSave } from '@/api/shelfCart'
+	export default {
+		components: { },
+		data() {
+			return {
+				barcode:null,
+				shelfSn: null,
+				shelfName: '',
+				layer:'',
+				confirmModal: false,
+				productInfo: null,
+				shelfPlaceCode: '',
+				shelfPlaceSn: '',
+				shelfCartSn: '',
+				curQty: '',
+				scleft: 0
+			}
+		},
+		onReady() {
+			// 初始化摄像头
+			this.init()
+		},
+		onLoad(options) {
+			this.shelfSn = options.shelfSn
+			this.layer = options.layer
+			this.shelfName = options.shelfName
+			uni.setNavigationBarTitle({
+				title: '扫描条形码——' +this.layer+'层'
+			})
+		},
+		onBackPress() {
+			uni.redirectTo({
+				url: "/pages/batchShelves/cartList?shelfSn="+this.shelfSn+'&layer='+this.layer+'&shelfName='+this.shelfName
+			})
+		},
+		onNavigationBarButtonTap(e) {
+			 this.searchProduct()
+		},
+		methods: {
+			numsBoxScroll(type){
+				this.scleft = type ? (this.scleft+150) : (this.scleft-150)
+			},
+			searchProduct(){
+				uni.redirectTo({
+					url: "/pages/batchShelves/searchProduct?shelfSn="+this.shelfSn+'&layer='+this.layer+'&shelfName='+this.shelfName
+				})
+			},
+			// 扫码结果
+			scanResult(qrCode){
+				const _this = this
+				uni.showLoading({
+					title: "正在查询产品信息"
+				})
+				let params = {
+					qrCode: qrCode,
+					shelfSn: this.shelfSn,
+					shelfTierCode: this.layer
+				}
+				console.log(params)
+				queryProduct(params).then(res => {
+					console.log(res)
+					if(res.status == 200&&res.data&&res.data.productList&&res.data.productList.length){
+						const ret = res.data.productList[0]
+						 this.productInfo = ret
+						 this.shelfPlaceCode = res.data.shelfTierCode
+						 // 已录入
+						 if(ret.shelfCartApi){
+							 this.curQty = ret.shelfCartApi.qty
+							 this.scleft = this.curQty * 30
+							 this.shelfPlaceSn = ret.shelfCartApi.shelfPlaceSn
+							 this.shelfCartSn = ret.shelfCartApi.shelfCartSn
+							 this.shelfPlaceCode = ret.shelfCartApi.shelfPlaceCode
+						 }else{
+							 this.shelfPlaceSn = ''
+							 this.curQty = ''
+							 this.scleft = 0
+							 this.shelfCartSn = ''
+						 }
+						 setTimeout(()=>{
+							 this.barcode.start()
+						 },2000)
+					}else{
+						this.confirmModal = true
+					}
+					uni.hideLoading()
+				})
+			},
+			// 保存
+			saveData(nums){
+				uni.showLoading({
+					title: '正在保存...'
+				})
+				const a = this.productInfo.shelfCartApi
+				const params = {
+					shelfSn: this.shelfSn,
+					shelfName: this.shelfName,
+					shelfTierCode: a && a.shelfTierCode ? a.shelfTierCode : this.layer,
+					shelfPlaceSn: this.shelfPlaceSn,
+					shelfPlaceCode: this.shelfPlaceCode,
+					productSn: this.productInfo.productSn,
+					productCode: this.productInfo.code,
+					qty: nums,
+					price: this.productInfo.price,
+					cost: this.productInfo.cost,
+					shelfCartSn: this.shelfCartSn
+				}
+				console.log(params)
+				shelfCartSave(params).then(res => {
+					console.log(res)
+					if(res.status == 200){
+						this.toashMsg('保存成功,继续扫描')
+						this.curQty = nums
+						this.shelfCartSn = res.data.shelfCartSn
+					}
+					setTimeout(()=>{
+						uni.hideLoading()
+					},4000)
+				})
+			},
+			modalConfirm(){
+				this.confirmModal = false
+				this.barcode.start()
+			},
+			startScan(){
+				this.barcode.start()
+			},
+			init(){
+				const _this = this
+				// 初始化
+				this.barcode = plus.barcode.create('barcode', [], {
+					top:'0px',
+					left:'0px',
+					width: '100%',
+					height: '35%',
+					position: 'static',
+					frameColor: '#00aaff',
+					scanbarColor: '#00aaff'
+				})
+				// 设置高度
+				const query = uni.createSelectorQuery().in(this);
+				query.select('#barcode').boundingClientRect(data => {
+					this.barcode.setStyle({
+						height: data.height	+ 'px'	// 调整扫码控件的位置
+					})
+				}).exec()
+				 
+				// 扫码成功后
+				this.barcode.onmarked = function(type, result) {
+					console.log(type,result)
+					_this.scanResult(result)
+				}
+				// 扫码识别出错
+				this.barcode.onerror = function(error){
+					console.log(error)
+					_this.toashMsg("条形码错误!")
+					_this.barcode.start()
+				}
+				
+				 const currentWebview = this.$mp.page.$getAppWebview()
+				 currentWebview.append(this.barcode)
+				 this.barcode.start()
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	page{
+		height: 100vh;
+	}
+	.scanCode-wrap{
+		width: 100%;
+		height: 100vh;
+		display: flex;
+		flex-direction: column;
+		.barCode{
+			height: 35%;
+		}
+		.info-body{
+			flex-grow: 1;
+			overflow: auto;
+			.noData{
+				padding: 100rpx 20rpx 0;
+				text-align: center;
+				color: #999;
+			}
+			.info{
+				background-color: #FFFFFF;
+				padding: 10rpx 30upx;
+				font-size: 32rpx;
+				margin-top: 20rpx;
+				.shelfPlaceCode{
+					background-color: #f6f6f6;
+					text-align: center;
+					padding: 10rpx 20rpx;
+					border-radius: 50rpx;
+					margin-bottom: 15rpx;
+				}
+				.pimgs{
+					padding:0.1rem;
+					background:#f8f8f8;
+					border-radius:0.3rem;
+				}
+				.pinfo{
+					line-height:normal;
+					padding-left: 20rpx;
+					color: #666;
+					.pcode{
+						color:#999;
+						text{
+							color: #000;
+						}
+					}
+				}
+				
+				.product-nums{
+					border-top: 10rpx solid #eee;
+					margin-top: 20rpx;
+					> view{
+						&:first-child{
+							text-align: center;
+							color: #999;
+							margin-top: 20rpx;
+						}
+					}
+					.numsBox{
+						.scroll-nums{
+							width: 85%;
+							padding: 10rpx 0;
+							.ntabs-box{
+								margin: 10rpx 0;
+							}
+							.ntabs{
+								background-color: #fff;
+								border:1rpx solid #aeaeae;
+								box-shadow: 2rpx 4rpx 6rpx #eee;
+								border-radius: 15rpx;
+								padding: 10rpx 15rpx;
+								margin: 10rpx 2%;
+								width: 100rpx;
+							}
+							.active{
+								border-color: crimson;
+								background-color: crimson;
+								color: #FFFFFF;
+							}
+							.a-left,.a-right{
+								color: #666;
+							}
+						}
+					}
+				}
+				.infoTits{
+					padding: 30rpx;
+					text-align: center;
+					color: red;
+					font-size: 24rpx;
+				}
+			}
+		}
+	}
+</style>

+ 247 - 0
pages/batchShelves/searchProduct.vue

@@ -0,0 +1,247 @@
+<template>
+	<view class="productList flex flex_column">
+		<view class="productList-search">
+			<view class="search flex align_center">
+				<view class="input">
+					<u-search 
+					focus
+					v-model="queryWord" 
+					@input="$u.debounce(getProductList, 800)"
+					@custom="$u.debounce(getProductList, 500)" 
+					@search="$u.debounce(getProductList, 500)" 
+					@clear="clearSearch" 
+					bg-color="#fff" 
+					:show-action="false"
+					placeholder="请输入产品编码查询"></u-search>
+				</view>
+				<!-- <view class="icon" @click="toScan">
+					<u-icon name="scan"></u-icon>
+				</view> -->
+			</view>
+		</view>
+		<view class="productList-body">
+			<view class="partList-list-box" v-for="item in productList" :key="item.shelfCartSn">
+				<view class="flex align_center flex_1">
+					<view class="pimgs">
+						<u-image :src="item.images?item.images:`../../static/${$config('themePath')}/def_img@2x.png`" width="120" height="120" border-radius="10"></u-image>
+					</view>
+					<view class="pinfo">
+						<view class="pname">
+							<text v-if="item.shelfCartApi&&item.shelfCartApi.shelfPlaceCode">{{item.shelfCartApi.shelfPlaceCode}}</text>
+							{{item.productName}}
+						</view>
+						<view class="ptxt flex justify_between">
+							<text>{{item.code}}</text>
+							<view v-if="item.shelfProductApi">
+								可用库存:<text>{{item.shelfProductApi.qty}}</text>{{item.unit}}
+							</view>
+						</view>
+					</view>
+				</view>
+				<view class="ptools flex align_center justify_between">
+					<view></view>
+					<view class="pcurnums flex align_center">
+						<view class="u-ninput" v-if="item.shelfCartApi">
+							<u-number-box :index="item.id" @blur="updateNums" @minus="updateNums" @plus="updateNums" color="#000" bg-color="#fff" v-model="item.shelfCartApi.qty" :min="0"></u-number-box>
+						</view>
+						<view v-else>
+							<u-button @click="addItem(item)" plain style="width: 40rpx;height: 40rpx;line-height: 40rpx;" size="mini" shape="circle">
+								<u-icon name="plus"></u-icon>
+							</u-button>
+						</view>
+					</view>
+				</view>
+			</view>
+			<view v-if="productList&&productList.length==0">
+				<u-empty v-if="status!='loading'" :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="180" :text="noDataText" mode="list" :margin-top="50"></u-empty>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import { queryProduct, shelfCartSave } from '@/api/shelfCart'
+	export default {
+		data() {
+			return {
+				shelfSn: null,
+				shelfName: '',
+				layer:'',
+				queryWord: '',
+				productList: [],
+				total: 0, // 列表总数
+				noDataText: '暂无产品',
+				status: 'nomore',
+				shelfPlaceCode: ''
+			}
+		},
+		onLoad(options) {
+			this.shelfSn = options.shelfSn
+			this.layer = options.layer
+			this.shelfName = options.shelfName
+			uni.setNavigationBarTitle({
+				title: '按产品编码搜索——' +this.layer+'层'
+			})
+		},
+		onNavigationBarButtonTap(e) {
+			 this.scanProduct()
+		},
+		methods: {
+			scanProduct(){
+				uni.redirectTo({
+					url: "/pages/batchShelves/scanProduct?shelfSn="+this.shelfSn+'&layer='+this.layer+'&shelfName='+this.shelfName
+				})
+			},
+			clearSearch(){
+				this.queryWord = ''
+				this.productList = []
+				this.getProductList()
+			},
+			getProductList(){
+				const _this = this
+				if(this.queryWord == ''){
+					this.productList = []
+					return
+				}
+				uni.showLoading({
+					title: "正在查询..."
+				})
+				let params = {
+					code: this.queryWord,
+					shelfSn: this.shelfSn,
+					shelfTierCode: this.layer
+				}
+				console.log(params)
+				queryProduct(params).then(res => {
+					console.log(res)
+					if(res.status == 200&&res.data){
+						this.productList = res.data.productList.slice(0,20)
+						this.shelfPlaceCode = res.data.shelfTierCode
+						this.total = res.data.productList.length
+					}else{
+						this.noDataText = '查询最近20条数据,没有匹配到相关产品,请输入更多内容'
+					}
+					uni.hideLoading()
+				})
+			},
+			// 新增
+			addItem(item){
+				this.saveData(item,1)
+			},
+			// 修改数量
+			updateNums(e){
+				console.log(e)
+				const row = this.productList.find(item => item.id == e.index)
+				const nums = e.value
+				this.saveData(row,nums)
+			},
+			saveData(row,nums){
+				// 继续修改数量
+				uni.showLoading({
+					title: '正在保存...'
+				})
+				const params = {
+					shelfSn: this.shelfSn,
+					shelfName: this.shelfName,
+					shelfTierCode: row.shelfCartApi?row.shelfCartApi.shelfTierCode:this.layer,
+					shelfPlaceSn: row.shelfCartApi?row.shelfCartApi.shelfPlaceSn:'',
+					shelfPlaceCode: row.shelfCartApi?row.shelfCartApi.shelfPlaceCode:this.shelfPlaceCode,
+					productSn: row.productSn,
+					productCode: row.code,
+					qty: nums,
+					price: row.price,
+					cost: row.cost,
+					shelfCartSn: row.shelfCartApi?row.shelfCartApi.shelfCartSn:''
+				}
+				console.log(params)
+				shelfCartSave(params).then(res => {
+					if(res.status == 200){
+						this.toashMsg(res.message)
+						this.getProductList()
+					}
+					uni.hideLoading()
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.productList{
+		width: 100%;
+		height: 100vh;
+		.productList-search{
+			padding: 20rpx 30rpx;
+			background-color: #FFFFFF;
+			.search{
+				padding: 0.1rem;
+				border-radius: 50rpx;
+				border:0.1rpx solid #eee;
+				.input{
+					flex-grow: 1;
+					padding: 0.1rpx;
+				}
+				.icon{
+					width: 13%;
+					text-align: center;
+					font-size: 46rpx;
+					color: #999;
+				}
+			}
+		}
+		.productList-body{
+			flex-grow: 1;
+			background-color: #fff;
+			padding: 0 40upx;
+			overflow: auto;
+			.partList-list-box{
+				padding: 10px 0;
+				border-bottom: 2rpx solid #f5f5f5;
+				.pinfo{
+					flex-grow: 1;
+					padding-left: 20rpx;
+					.pname{
+						color: #191919;
+						font-size: 24rpx;
+						text{
+							font-weight: normal;
+							margin-right: 10rpx;
+							padding: 0 10rpx;
+							background: rgba(3, 54, 146, 0.15);
+							border-radius: 30rpx;
+							color: #033692;
+							font-size: 24rpx;
+						}
+					}
+					.ptxt{
+						color: #666;
+						font-size: 24rpx;
+						padding: 10upx 0;
+					}
+				}
+				.ptools{
+					color: #666;
+					font-size: 24rpx;
+					.u-ninput{
+						border: 2rpx solid #eee;
+						border-radius: 50rpx;
+						padding: 0 6rpx;
+					}
+					/deep/ .u-icon-disabled{
+						background: #fff!important;
+					}
+					/deep/ .u-number-input{
+						margin: 0 0;
+						border: 2rpx solid #eee;
+						border-top: 0;
+						border-bottom: 0;
+					}
+					/deep/ .u-icon-plus, /deep/ .u-icon-minus{
+						border-radius: 50rpx;
+					}
+				}
+			}
+		}
+		 
+	}
+</style>

+ 13 - 3
pages/shelfSetting/shelfSet.vue

@@ -48,7 +48,7 @@
 			</view>
 		</view>
 		<view v-else>
-			<view class="nodata">暂无货位信息,请点击 <text @click="addHw('add',0)">新增货位</text></view>
+			<view class="nodata">暂无货位信息,请点击 <text @click="toPlRacking">批量上架产品</text></view>
 		</view>
 	</view>
 </template>
@@ -94,16 +94,26 @@
 			const win = uni.getWindowInfo()
 			this.pleft = Math.floor(win.windowWidth * 0.3)
 			this.ptop = Math.floor(win.windowHeight - 70)
+			
+			console.log(this.shelfSn)
 		},
 		onUnload() {
 			uni.$off("editCustome")
 			uni.$off("editShelfName")
 			uni.$off("updateHw")
 		},
+		onNavigationBarButtonTap(e) {
+			 this.toPlRacking()
+		},
 		methods: {
+			// 批量上架
+			toPlRacking(){
+				uni.navigateTo({
+					url: "/pages/batchShelves/index?shelfSn="+this.shelfSn+'&shelfName='+this.detailData.shelfName
+				})
+			},
 			// 更多操作
 			tapPopup(e){
-				console.log(e)
 				// 打印贴签
 				if(e == 1){
 					if(this.hasNoBindPro()){
@@ -255,6 +265,7 @@
 			},
 			getShelfDetal(){
 				shelfDetail({ sn: this.shelfSn }).then(res => {
+					console.log(res)
 				  if (res.status == 200) {
 				    this.detailData = res.data
 					this.switchVal = res.data.finishFlag == 1
@@ -264,7 +275,6 @@
 				})
 			},
 			getShelfPlace(flag){
-				console.log(this.shelfSn)
 				getProductPlace({ shelfSn: this.shelfSn }).then(res => {
 				  console.log(res.data)
 				  if (res.status == 200 && res.data) {