lilei 2 gadi atpakaļ
vecāks
revīzija
6c6b08a5c3

+ 17 - 2
api/shelfCart.js

@@ -1,6 +1,6 @@
 import axios from '@/libs/axios.js'
 
-// 货架分页列表
+// 查询产品
 export const queryProduct = (params) => {
 	return axios.request({
 		url: `shelfCart/queryProduct`,
@@ -8,7 +8,22 @@ export const queryProduct = (params) => {
 		method: 'post'
 	})
 }
-
+// 查询产品 分页
+export const queryProductPage = (params) => {
+	return axios.request({
+		url: `shelfCart/queryProductPage/${params.pageNo}/${params.pageSize}`,
+		data: params,
+		method: 'post'
+	})
+}
+// 查询货架是否有录入的产品
+export const shelfCartNotEmpty = (params) => {
+	return axios.request({
+		url: `shelfCart/shelfCartNotEmpty`,
+		data: params,
+		method: 'post'
+	})
+}
 // 录入保存
 export const shelfCartSave = (params) => {
 	return axios.request({

+ 37 - 5
pages.json

@@ -371,12 +371,17 @@
             			"titleAlign": "auto",
             			"buttons": [ //原生标题栏按钮配置,
             				{
-            					"text": "\ue6ee 批量上架产品" ,//原生标题栏增加分享按钮,点击事件可通过页面的 onNavigationBarButtonTap 函数进行监听u
+            					"text": "" ,//原生标题栏增加分享按钮,点击事件可通过页面的 onNavigationBarButtonTap 函数进行监听u
             					"fontSrc": "/static/iconfont/iconfont.ttf",
             					"fontSize": "16",
-								"color": "#00aaff",
-            					"width":"150px"
-            				}
+								"color": "#ffffff",
+            					"width":"auto"
+            				},
+							{
+								"text": "",
+								"width":"10",
+								"redDot" : false
+							}
             			]
             		}
             	}
@@ -553,9 +558,36 @@
             "style" :                                                                                    
             {
                 "navigationBarTitleText": "批量上架产品",
+                "enablePullDownRefresh": false,
+				"app-plus":{
+					"titleNView": {
+						"titleAlign": "auto",
+						"buttons": [ //原生标题栏按钮配置,
+							{
+								"text": "\ue6ee 上架入库" ,//原生标题栏增加分享按钮,点击事件可通过页面的 onNavigationBarButtonTap 函数进行监听u
+								"fontSrc": "/static/iconfont/iconfont.ttf",
+								"fontSize": "16",
+								"color": "#00aaff",
+								"width":"110px"
+							},
+							{
+								"text": "\ue6f5 打印贴签" ,//原生标题栏增加分享按钮,点击事件可通过页面的 onNavigationBarButtonTap 函数进行监听u
+								"fontSrc": "/static/iconfont/iconfont.ttf",
+								"fontSize": "16",
+								"color": "#00aaff",
+								"width":"auto"
+							}
+						]
+					}
+				}
+            }
+        },{
+            "path" : "pages/batchShelves/editShelfHw",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "编辑上架信息",
                 "enablePullDownRefresh": false
             }
-            
         }
     ],
 	"globalStyle": {

+ 69 - 24
pages/batchShelves/cartList.vue

@@ -4,22 +4,29 @@
 			<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">
+			<scroll-view scroll-y class="rightCons" v-if="shelfPlaceList">
+				<view 
+				class="partList-list-box" 
+				v-for="item in shelfPlaceList[curTab]" 
+				:key="item.shelfCartSn"
+				@click="editRow(item)"
+				>
 					<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">
+							<view class="ptxt">
 								<text>{{item.shelfPlaceCode}}</text>
+								{{item.productCode}}
+							</view>
+							<view class="pname">
 								{{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>
@@ -27,7 +34,7 @@
 						</view>
 					</view>
 				</view>
-			</view>
+			</scroll-view>
 		</view>
 		<view class="footer-bar flex align_center justify_between">
 			<view class="heji flex align_center" @click="showPop=!showPop">
@@ -40,7 +47,7 @@
 		</view>
 		
 		<!-- 合计弹框 -->
-		<u-popup mode="bottom" :mask="false" closeable v-model="showPop" :custom-style="{bottom:'100rpx'}">
+		<u-popup mode="bottom" :mask="false" closeable v-model="showPop" :z-index="100">
 			<view class="heji-content">
 				<scroll-view scroll-y="true" style="height: 400rpx;">
 					<view class="heji-con-list">
@@ -57,7 +64,7 @@
 		</u-popup>
 		
 		<!-- 选中层 -->
-		<u-popup mode="center" width="80%" closeable v-model="showLayer" border-radius="15">
+		<u-popup mode="center" width="80%" :mask-close-able="false" closeable @close="curLayer=''" v-model="showLayer" border-radius="15">
 			<view class="layer-content">
 				 <view class="tits">请选择产品的货架层号</view>
 				 <view class="tagbox flex">
@@ -84,7 +91,8 @@
 			return {
 				showPop: false,
 				shelfSn: '',
-				shelfPlaceList: [],
+				shelfName: '',
+				shelfPlaceList: null,
 				placeTab: [],
 				curTab: '',
 				totalKs: 0,
@@ -98,37 +106,64 @@
 		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
+			this.shelfName = opts.shelfName
+			this.customerSn = opts.customerSn
 			this.pageInit()
+			
+			uni.$on("updateTempHw",()=>{
+				this.pageInit(true)
+			})
+		},
+		onUnload() {
+			uni.$off("updateTempHw")
 		},
 		methods: {
-			pageInit(){
+			pageInit(flag){
 				this.placeTab = []
-				this.shelfPlaceList = []
+				this.shelfPlaceList = null
 				this.countData = []
-				this.getList()
+				this.getList(flag)
 				this.getCount()
 			},
 			scanProduct(){
-				uni.redirectTo({
-					url: "/pages/batchShelves/scanProduct?shelfSn="+this.shelfSn+'&layer='+this.curLayer+'&shelfName='+this.shelfName
+				this.showLayer = false
+				this.curLayer = ''
+				uni.navigateTo({
+					url: "/pages/batchShelves/scanProduct?shelfSn="+this.shelfSn+'&layer='+this.curLayer+'&shelfName='+this.shelfName+'&customerSn='+this.customerSn
 				})
 			},
 			searchProduct(){
-				uni.redirectTo({
-					url: "/pages/batchShelves/searchProduct?shelfSn="+this.shelfSn+'&layer='+this.curLayer+'&shelfName='+this.shelfName
+				this.showLayer = false
+				this.curLayer = ''
+				uni.navigateTo({
+					url: "/pages/batchShelves/searchProduct?shelfSn="+this.shelfSn+'&layer='+this.curLayer+'&shelfName='+this.shelfName+'&customerSn='+this.customerSn
+				})
+			},
+			// 编辑
+			editRow(item){
+				this.$store.state.vuex_tempData = item
+				uni.navigateTo({
+					url: "/pages/batchShelves/editShelfHw?shelfSn="+this.shelfSn+'&shelfName='+this.shelfName+'&customerSn='+this.customerSn
 				})
 			},
 			// 获取产品列表
 			getList(flag){
+				uni.showLoading({
+					title: '正在加载...'
+				})
 				queryMapList({ shelfSn: this.shelfSn }).then(res => {
 				  console.log(res.data)
 				  if (res.status == 200 && res.data) {
-				    this.shelfPlaceList = res.data
+				    this.shelfPlaceList = JSON.stringify(res.data) == '{}' ? null : res.data
 					for(let a in res.data){
 						this.placeTab.push(a)
 					}
 					if(!flag || this.placeTab.length==1){
 					  this.curTab = this.placeTab[0]
+					}else{
+						if(!this.shelfPlaceList[this.curTab]){
+							this.curTab = this.placeTab[0]
+						}
 					}
 					if(this.placeTab.length == 0){
 						this.shelfPlaceList = null
@@ -137,6 +172,7 @@
 				    this.shelfPlaceList = null
 					this.placeTab = []
 				  }
+				  uni.hideLoading()
 				})
 			},
 			// 获取统计数据
@@ -168,12 +204,12 @@
 							shelfCartDelete({ shelfCartSn: row.shelfCartSn }).then(res => {
 							  if (res.status == 200) {
 								  _this.toashMsg(res.message)
-								  _this.pageInit()
+								  _this.pageInit(true)
 							  }
 							  uni.hideLoading()
 							})
 						}else{
-							row.qty = 1
+							_this.pageInit(true)
 						}
 				  }
 				})
@@ -242,17 +278,17 @@
 				width: 80%;
 				background-color: #fff;
 				position: relative;
-				overflow: auto;
 				padding: 0 20upx;
+				height: calc(100vh - 110rpx);
 				.partList-list-box{
 					padding: 10px 0;
 					border-bottom: 2rpx solid #f5f5f5;
 					.pinfo{
 						flex-grow: 1;
 						padding-left: 20rpx;
-						.pname{
-							color: #191919;
-							font-size: 24rpx;
+						.ptxt{
+							color: #666;
+							font-size: 26rpx;
 							text{
 								font-weight: normal;
 								margin-right: 10rpx;
@@ -262,11 +298,17 @@
 								color: #033692;
 								font-size: 24rpx;
 							}
+							margin-bottom: 15upx;
+						}
+						.pname{
+							color: #666;
+							font-size: 26rpx;
+							font-weight: bold;
 						}
 					}
 					.ptools{
 						color: #666;
-						font-size: 24rpx;
+						font-size: 26rpx;
 						.u-ninput{
 							border: 2rpx solid #eee;
 							border-radius: 50rpx;
@@ -290,13 +332,16 @@
 		}
 		.footer-bar{
 			padding: 20rpx;
+			position: relative;
+			z-index: 200;
+			background-color: #fff;
 			.heji{
 				flex-grow: 1;
 				color: #999;
 				text{
 					color: #333;
 				}
-				font-size: 24rpx;
+				font-size: 26rpx;
 				padding-right: 30upx;
 			}
 			.btns{

+ 295 - 0
pages/batchShelves/editShelfHw.vue

@@ -0,0 +1,295 @@
+<template>
+	<view class="content flex flex_column" v-if="nowData">
+		<view class="form-body">
+			<u-form :model="nowData" label-width="180rpx" :error-type="['toast']" ref="uForm">
+				<view style="padding: 20upx 0;" v-if="nowData.shelfProductApi" >
+					<view class="placeCode">
+						{{nowData.shelfPlaceCode}}
+					</view>
+					<view class="flex flex_1 align_center">
+						<view class="pimgs">
+							<u-image :src="nowData.product.images?nowData.product.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">
+								<text>{{nowData.productCode}}</text>
+								<text class="pkuc">
+									 可用库存:<text>{{nowData.shelfProductApi.qty}}</text>{{nowData.product.unit}}
+								</text>
+							</view>
+							<view class="pname">
+								{{nowData.product.productName}}
+							</view>
+						</view>
+					</view>
+				</view>
+				<view style="padding: 20upx 0;" v-else>
+					<u-form-item label="货位号" required prop="shelfPlaceCode">
+						<u-input v-model="nowData.shelfPlaceCode" @input="placeCodeBlur" :maxlength="30" placeholder="请输入货位号(字母+数字的格式)"/>
+					</u-form-item>
+					<u-gap height="10" bg-color="#f8f8f8"></u-gap>
+					<u-form-item label="绑定产品" required prop="productSn">
+						<view class="pinfo" style="width: 100%;">
+							<view class="ptxt flex align_center justify_between">
+								<text>{{nowData.productCode}}</text>
+								<text class="pcode" @click="toBindProduct">
+									<u-icon name='reload'></u-icon>
+									更换产品
+								</text>
+							</view>
+						</view>
+					</u-form-item>
+					<u-form-item label="">
+						<view class="flex flex_1 align_center">
+							<view class="pimgs">
+								<u-image :src="nowData.product.images?nowData.product.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="pname">
+									{{nowData.product.productName}}
+								</view>
+							</view>
+						</view>
+					</u-form-item>
+				</view>
+				<u-gap height="10" bg-color="#f8f8f8"></u-gap>
+				<u-form-item label="本次上架数量" required prop="qty">
+					<view style="width: 100%;" class="flex justify_end">
+						<view class="u-ninput">
+							<u-number-box :min="1" :max="999999" positive-integer v-model="nowData.qty" color="#000" bg-color="#fff" size="30" :input-height="70" :input-width="150"></u-number-box>
+						</view>
+					</view>
+				</u-form-item>
+			</u-form>
+		</view>
+		<view class="flex footer-btn">
+			<u-button class="delbtn" :loading='loading' @click="handleDel" type='primary' shape="circle" size="medium">删除货位</u-button>
+			<u-button :style="{width:type=='bind'?'45%':'100%'}" class="newbtn" :loading='loading' @click="formSubmit" type='primary' shape="circle" size="medium">保存</u-button>
+		</view>
+	</view>
+</template>
+
+<script>
+	import { clzConfirm, numberToFixed } from '@/libs/tools';
+	import { shelfCartSave, shelfCartDelete} from '@/api/shelfCart.js'
+	export default {
+		data() {
+			return {
+				nowData: {
+					shelfPlaceCode: '',
+					productSn: '',
+					qty: '',
+				},
+				rules: {
+					shelfPlaceCode:[
+						{ required: true, message: '请输入货位号', trigger: 'change' },
+						{
+							pattern: /^[a-zA-Z]{1}[0-9]{1,29}$/g,
+							message: '必需字母开头且后面紧跟数字'
+						}
+					],
+					productSn: [{ required: true, message: '请选择绑定产品', trigger: 'change' }],
+					qty: [{ required: true,type:'number', message: '请输入上架数量', trigger: 'change' }],
+				},
+				shelfSn: null,
+				customerSn: '',
+				shelfName: null,
+				loading: false,
+				type:"",
+			}
+		},
+		// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
+		onReady() {
+			this.$refs.uForm.setRules(this.rules);
+		},
+		onLoad(opts) {
+			const _this = this
+			this.nowData = this.$store.state.vuex_tempData;
+			console.log(this.nowData)
+			this.shelfName = opts.shelfName
+			this.shelfSn = opts.shelfSn
+			this.customerSn = opts.customerSn
+			this.type = this.nowData.shelfProductApi ? 'edit' : 'new'
+			 
+			// 选在产品
+			uni.$on('addProductToHw',function(data){
+				console.log(data)
+				_this.nowData.product.images = data.productMsg
+				_this.nowData.product.productName = data.name
+				_this.nowData.product.unit = data.unit
+				_this.nowData.price = Number(data.price)
+				_this.nowData.cost = Number(data.cost)
+				_this.nowData.productCode = data.code
+				_this.nowData.productSn = data.productSn
+			})
+		},
+		onUnload(){
+			uni.$off("addProductToHw")
+			this.$store.state.vuex_tempData = null
+		},
+		methods: {
+			placeCodeBlur(v){
+				this.$nextTick(() => {
+					this.nowData.shelfPlaceCode = this.nowData.shelfPlaceCode.toLocaleUpperCase()
+				})
+			},
+			// 更换产品
+			toBindProduct(){
+				uni.navigateTo({
+					url: "/pages/shelfSetting/bindProduct?customerSn="+this.customerSn+"&shelfSn="+this.shelfSn
+				})
+			},
+			// 删除
+			handleDel(){
+				const _this = this
+				clzConfirm({
+				  title: '提示',
+				  content: '确认删除此货位和产品吗?',
+				  success (ret) {
+						if (ret.confirm || ret.index == 0) {
+							uni.showLoading({
+								title: '正在删除...'
+							})
+							shelfCartDelete({ shelfCartSn: _this.nowData.shelfCartSn }).then(res => {
+							  console.log(res)
+							  if (res.status == 200) {
+								  _this.toashMsg(res.message)
+								  uni.$emit("updateTempHw")
+								  uni.navigateBack()
+							  }
+							  uni.hideLoading()
+							})
+						}
+				  }
+				})
+			},
+			//  表单提交
+			formSubmit(){
+				const _this = this
+				this.$refs.uForm.validate(valid => {
+					if (valid) {
+						 const row = _this.nowData
+						 uni.showLoading({
+						 	title: '正在保存...'
+						 })
+						 _this.loading = true
+						 const params = {
+						 	shelfSn: this.shelfSn,
+						 	shelfName: this.shelfName,
+						 	shelfTierCode: row.shelfTierCode,
+						 	shelfPlaceSn: row.shelfPlaceSn,
+						 	shelfPlaceCode: row.shelfPlaceCode,
+						 	productSn: row.productSn,
+						 	productCode: row.productCode,
+						 	qty: row.qty,
+						 	price: row.price,
+						 	cost: row.cost,
+						 	shelfCartSn: row.shelfCartSn
+						 }
+						 console.log(params)
+						 shelfCartSave(params).then(res => {
+						 	if(res.status == 200){
+						 		this.toashMsg(res.message)
+								uni.$emit("updateTempHw")
+								uni.navigateBack()
+						 	}
+						 	uni.hideLoading()
+							_this.loading = false
+						 })
+					} else {
+						console.log('验证失败');
+					}
+				});
+			},
+		}
+	}
+</script>
+
+<style lang="less">
+.content{
+	height: 100vh;
+	width: 100%;
+	.placeCode{
+		text-align: center;
+		border-radius: 20rpx;
+		background-color: #eee;
+		padding: 10upx 20upx;
+		margin-bottom: 15upx;
+	}
+	.form-body{
+		flex-grow: 1;
+		> view{
+			background-color: #fff;
+			padding: 0 1.5rem;
+		}
+		.pimgs{
+			padding:0.1rem;
+			background:#f8f8f8;
+			border-radius:0.3rem;
+			padding-right: 20rpx;
+		}
+		.pinfo{
+			line-height:normal;
+			color: #666;
+			.pcode{
+				color:rgb(0, 170, 255);
+			}
+			.pname{
+				font-weight: bold;
+			}
+			.pkuc{
+				color: #999;
+				text{
+					color: #333;
+				}
+			}
+		}
+		.noproduct{
+			padding: 40rpx 20rpx;
+			text-align: center;
+			color: #999;
+			>view{
+				padding: 10rpx 0;
+			}
+			text{
+				color: #00aaff;
+				margin-left: 10rpx;
+			}
+		}
+		
+		.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-btn{
+		padding: 0.5rem 1rem;
+		justify-content: space-between;
+		button{
+			min-width: 45%;
+			margin: 0 20upx;
+		}
+		.newbtn{
+			background-color: rgb(51, 95, 182);
+			color: #fff;
+		}
+		.delbtn{
+			background-color: #fff;
+			color: red;
+		}
+	}
+}
+</style>

+ 5 - 3
pages/batchShelves/index.vue

@@ -22,23 +22,25 @@
 				list:[],
 				curTag: '',
 				shelfSn: '',
-				shelfName: ''
+				shelfName: '',
+				customerSn: ''
 			}
 		},
 		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
+			this.customerSn = opts.customerSn
 		},
 		methods: {
 			scanProduct(){
 				uni.redirectTo({
-					url: "/pages/batchShelves/scanProduct?shelfSn="+this.shelfSn+'&layer='+this.curTag+'&shelfName='+this.shelfName
+					url: "/pages/batchShelves/scanProduct?shelfSn="+this.shelfSn+'&layer='+this.curTag+'&shelfName='+this.shelfName+'&customerSn='+this.customerSn
 				})
 			},
 			searchProduct(){
 				uni.redirectTo({
-					url: "/pages/batchShelves/searchProduct?shelfSn="+this.shelfSn+'&layer='+this.curTag+'&shelfName='+this.shelfName
+					url: "/pages/batchShelves/searchProduct?shelfSn="+this.shelfSn+'&layer='+this.curTag+'&shelfName='+this.shelfName+'&customerSn='+this.customerSn
 				})
 			}
 		}

+ 4 - 3
pages/batchShelves/scanProduct.vue

@@ -80,13 +80,14 @@
 			this.shelfSn = options.shelfSn
 			this.layer = options.layer
 			this.shelfName = options.shelfName
+			this.customerSn = options.customerSn
 			uni.setNavigationBarTitle({
 				title: '扫描条形码——' +this.layer+'层'
 			})
 		},
 		onBackPress() {
 			uni.redirectTo({
-				url: "/pages/batchShelves/cartList?shelfSn="+this.shelfSn+'&layer='+this.layer+'&shelfName='+this.shelfName
+				url: "/pages/batchShelves/cartList?shelfSn="+this.shelfSn+'&layer='+this.layer+'&shelfName='+this.shelfName+'&customerSn='+this.customerSn
 			})
 		},
 		onNavigationBarButtonTap(e) {
@@ -98,7 +99,7 @@
 			},
 			searchProduct(){
 				uni.redirectTo({
-					url: "/pages/batchShelves/searchProduct?shelfSn="+this.shelfSn+'&layer='+this.layer+'&shelfName='+this.shelfName
+					url: "/pages/batchShelves/searchProduct?shelfSn="+this.shelfSn+'&layer='+this.layer+'&shelfName='+this.shelfName+'&customerSn='+this.customerSn
 				})
 			},
 			// 扫码结果
@@ -118,7 +119,7 @@
 					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
+						 this.shelfPlaceCode = res.data.shelfPlaceCode
 						 // 已录入
 						 if(ret.shelfCartApi){
 							 this.curQty = ret.shelfCartApi.qty

+ 31 - 15
pages/batchShelves/searchProduct.vue

@@ -42,7 +42,7 @@
 					<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>
+							<u-number-box :index="item.id" @blur="updateNums" @minus="updateNums" @plus="updateNums" color="#000" bg-color="#fff" v-model="item.shelfCartApi.qty" :min="1"></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">
@@ -52,15 +52,20 @@
 					</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 
+			v-if="productList&&productList.length" 
+			style="color:#999;font-size: 26upx;text-align: center;padding: 20upx;">
+				最多显示前20条匹配产品,请尝试输入更多内容
+			</view>
+			<view v-if="productList && productList.length == 0">
+				<u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="60"></u-empty>
 			</view>
 		</view>
 	</view>
 </template>
 
 <script>
-	import { queryProduct, shelfCartSave } from '@/api/shelfCart'
+	import { queryProductPage, shelfCartSave } from '@/api/shelfCart'
 	export default {
 		data() {
 			return {
@@ -79,17 +84,24 @@
 			this.shelfSn = options.shelfSn
 			this.layer = options.layer
 			this.shelfName = options.shelfName
+			this.customerSn = options.customerSn
 			uni.setNavigationBarTitle({
 				title: '按产品编码搜索——' +this.layer+'层'
 			})
 		},
+		onBackPress() {
+			uni.$emit("updateTempHw")
+			uni.redirectTo({
+				url: "/pages/batchShelves/cartList?shelfSn="+this.shelfSn+'&layer='+this.layer+'&shelfName='+this.shelfName+'&customerSn='+this.customerSn
+			})
+		},
 		onNavigationBarButtonTap(e) {
 			 this.scanProduct()
 		},
 		methods: {
 			scanProduct(){
 				uni.redirectTo({
-					url: "/pages/batchShelves/scanProduct?shelfSn="+this.shelfSn+'&layer='+this.layer+'&shelfName='+this.shelfName
+					url: "/pages/batchShelves/scanProduct?shelfSn="+this.shelfSn+'&layer='+this.layer+'&shelfName='+this.shelfName+'&customerSn='+this.customerSn
 				})
 			},
 			clearSearch(){
@@ -107,20 +119,23 @@
 					title: "正在查询..."
 				})
 				let params = {
+					pageNo:1,
+					pageSize:20,
 					code: this.queryWord,
 					shelfSn: this.shelfSn,
 					shelfTierCode: this.layer
 				}
 				console.log(params)
-				queryProduct(params).then(res => {
+				queryProductPage(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
+					if(res.status == 200&&res.data&&res.data.page){
+						this.productList = res.data.page.list
+						this.shelfPlaceCode = res.data.shelfPlaceCode
+						this.total = res.data.page.count
 					}else{
-						this.noDataText = '查询最近20条数据,没有匹配到相关产品,请输入更多内容'
+						this.noDataText = '没有搜索到相关产品'
 					}
+					this.status = 'nomore'
 					uni.hideLoading()
 				})
 			},
@@ -202,8 +217,9 @@
 					flex-grow: 1;
 					padding-left: 20rpx;
 					.pname{
-						color: #191919;
-						font-size: 24rpx;
+						color: #666;
+						font-size: 26rpx;
+						font-weight: bold;
 						text{
 							font-weight: normal;
 							margin-right: 10rpx;
@@ -211,12 +227,12 @@
 							background: rgba(3, 54, 146, 0.15);
 							border-radius: 30rpx;
 							color: #033692;
-							font-size: 24rpx;
+							font-size: 26rpx;
 						}
 					}
 					.ptxt{
 						color: #666;
-						font-size: 24rpx;
+						font-size: 26rpx;
 						padding: 10upx 0;
 					}
 				}

+ 1 - 1
pages/shelfSetting/bindProduct.vue

@@ -60,7 +60,7 @@
 			}
 		},
 		onLoad(opts) {
-			this.customerSn = opts.customerSn
+			this.customerSn = opts.customerSn||''
 			this.shelfSn = opts.shelfSn
 			console.log(this.customerSn)
 		},

+ 20 - 2
pages/shelfSetting/shelfSet.vue

@@ -55,6 +55,7 @@
 
 <script>
     import { shelfDetail, shelfSave, modifFinishFlag, getProductPlace } from '@/api/shelf'
+	import { shelfCartNotEmpty } from '@/api/shelfCart'
 	import { createShelfReplenishBill } from '@/api/shelfReplenish'
 	export default {
 		components:{
@@ -70,7 +71,8 @@
 				ptop:0,
 				shelfPlaceList: null,
 				placeTab: [],
-				curTab: ''
+				curTab: '',
+				cartNotEmpty: false
 			}
 		},
 		onLoad(option) {
@@ -108,8 +110,9 @@
 		methods: {
 			// 批量上架
 			toPlRacking(){
+				const url = this.cartNotEmpty ? '/pages/batchShelves/cartList' : '/pages/batchShelves/index'
 				uni.navigateTo({
-					url: "/pages/batchShelves/index?shelfSn="+this.shelfSn+'&shelfName='+this.detailData.shelfName
+					url: url+"?shelfSn="+this.shelfSn+'&shelfName='+this.detailData.shelfName+'&customerSn='+this.detailData.customerSn
 				})
 			},
 			// 更多操作
@@ -292,10 +295,25 @@
 				    this.shelfPlaceList = null
 					this.placeTab = []
 				  }
+				  // 是否有已录入的产品
+				  this.getHasCartNotEmpty()
 				})
 			},
 			tabChange(item){
 				this.curTab = item
+			},
+			getHasCartNotEmpty(){
+				var webView = this.$mp.page.$getAppWebview(); 
+				webView.setTitleNViewButtonStyle(0, {
+					"text":this.placeTab.length?"\ue6ee 批量上架产品 ":'',
+					"color": "#00aaff"
+				});
+				shelfCartNotEmpty({ shelfSn: this.shelfSn }).then(res => {
+					this.cartNotEmpty = res.data == 1
+					webView.setTitleNViewButtonStyle(1, {  
+						"redDot": this.cartNotEmpty
+					}); 
+				})
 			}
 		}
 	}