lilei 2 months ago
parent
commit
e327d3b5fc
2 changed files with 37 additions and 22 deletions
  1. 1 1
      App.vue
  2. 36 21
      pages/batchShelves/searchProduct.vue

+ 1 - 1
App.vue

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

+ 36 - 21
pages/batchShelves/searchProduct.vue

@@ -19,7 +19,7 @@
 		</view>
 		<view class="productList-body">
 			<scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
-				<view class="partList-list-box" v-for="item in productList" :key="item.shelfCartSn">
+				<view class="partList-list-box" v-for="item in productList" :key="item.id">
 					<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>
@@ -39,7 +39,7 @@
 						</view>
 					</view>
 					<view class="ptools flex align_center justify_between">
-						<view></view>
+						<view>{{item.id+'----'+item.pageNo}}</view>
 						<view class="pcurnums flex align_center">
 							<view class="u-ninput" v-if="item.shelfCartApi">
 								<u-number-box :long-press="false" :index="item.id" :input-height="60" @blur="updateNums" @minus="updateNums" @plus="updateNums" color="#000" bg-color="#fff" v-model="item.shelfCartApi.qty" :min="1"></u-number-box>
@@ -130,14 +130,14 @@
 				this.status == 'nomore'
 				this.getProductList()
 			},
-			getProductList(){
+			getProductList(refash,row,pageNo){
 				const _this = this
 				if(this.queryWord == ''){
 					this.productList = []
 					return
 				}
 				let params = {
-					pageNo:this.pageNo,
+					pageNo: pageNo || this.pageNo,
 					pageSize:this.pageSize,
 					code: this.$u.trim(this.queryWord),
 					shelfSn: this.shelfSn,
@@ -147,27 +147,38 @@
 				queryProductPage(params).then(res => {
 					if(res.status == 200&&res.data&&res.data.page&&res.data.page.list&&res.data.page.list.length){
 						_this.shelfPlaceCode = res.data.shelfPlaceCode
-						let list = res.data.page.list
-						console.log(list)
-						if (list && list.length){
-							// 分页 拼接数据
-							if (_this.pageNo != 1) {
-								_this.productList = _this.productList ? _this.productList.concat(list) : list
+						if(!refash){
+							let list = res.data.page.list
+							console.log(list)
+							if (list && list.length){
+								list.forEach(item=>{
+									item.pageNo = params.pageNo
+								})
+								// 分页 拼接数据
+								if (_this.pageNo != 1) {
+									_this.productList = _this.productList ? _this.productList.concat(list) : list
+								} else {
+									_this.productList = list
+								}
+								_this.total = res.data.page.count
+								if (_this.productList.length == res.data.page.count) {
+									_this.status = 'nomore'
+								} else {
+									_this.status = 'loadmore'
+								}
 							} else {
-								_this.productList = list
-							}
-							_this.total = res.data.page.count
-							if (_this.productList.length == res.data.page.count) {
+								_this.productList = list || []
+								_this.total = 0
 								_this.status = 'nomore'
-							} else {
-								_this.status = 'loadmore'
 							}
-						} else {
-							_this.productList = list || []
-							_this.total = 0
+							_this.noDataText = '暂无匹配产品'
+						}else{
+							const curRowIndex = _this.productList.findIndex(item => item.id == row.id)
+							const newRow = res.data.page.list.find(item => item.id == row.id)
+							newRow.pageNo = pageNo
+							_this.productList.splice(curRowIndex,1,newRow)
 							_this.status = 'nomore'
 						}
-						_this.noDataText = '暂无匹配产品'
 					}else{
 						_this.status = 'nomore'
 						_this.productList = []
@@ -196,6 +207,7 @@
 				this.saveData(row,nums)
 			},
 			saveData(row,nums){
+				console.log(row,nums)
 				// 继续修改数量
 				uni.showLoading({
 					title: '正在保存...'
@@ -219,7 +231,10 @@
 					uni.hideLoading()
 					if(res.status == 200){
 						// this.toashMsg(res.message)
-						this.getProductList()
+						if(!item){
+							row.shelfCartApi={shelfPlaceCode:this.shelfPlaceCode}
+							this.getProductList(true,row,row.pageNo)
+						}
 					}
 				})
 			}