chenrui %!s(int64=2) %!d(string=hai) anos
pai
achega
3c343daa8d
Modificáronse 2 ficheiros con 42 adicións e 25 borrados
  1. 41 24
      pages/shuntBackManage/chooseProduct.vue
  2. 1 1
      pages/shuntBackManage/productList.vue

+ 41 - 24
pages/shuntBackManage/chooseProduct.vue

@@ -11,12 +11,11 @@
 					<u-icon color="#0485F6" size="30" name="shaixuan" custom-prefix="iscm-icon"></u-icon>
 				</view>
 			</view>
-			<!-- @input="$u.debounce(changeSearch, 800)" -->
 			<view class="search flex align_center">
 				<view class="input">
 					<u-search 
 					v-model="keyword" 
-					@change="getSearchCon"
+					@input="$u.debounce(getSearchCon, 800)"
 					@search="getSearchCon"
 					@custom="getSearchCon"
 					@clear="clearSearch"
@@ -30,7 +29,7 @@
 			</view>
 		</view>
 		<view class="check-list">
-			<productList ref="productList" noDataText="暂无产品" @updateNums="updateNums" @allChecked="allCheckedCallback"></productList>
+			<productList ref="productList" noDataText="暂无产品" @allChecked="allCheckedCallback"></productList>
 		</view>
 		<!-- 底部栏 -->
 		<view class="footer-bar flex align_center" v-if="partList.length">
@@ -161,13 +160,13 @@
 				  unsalableDaysBegin: undefined,
 				  unsalableDaysEnd: undefined,
 				  queryWord:undefined
-				},
-				againChooseList:[]
+				}
 			}
 		},
 		onBackPress(e) {
-		  if(this.chooseShow) {  
+		  if(this.chooseShow || this.isDetailShow) {  
 			this.chooseShow = false;
+			this.isDetailShow= false
 			return true;  
 		  } 
 		},
@@ -184,14 +183,35 @@
 			},
 		},
 		methods: {
-			// 全选
+			// 单击全选
 			allCheckeChange(e){
 				this.$refs.productList.allSelect(e.value)
-				this.chooseList = this.$refs.productList.getAllChecked()
+				const list = this.$refs.productList.getAllData()
+				list.map(item => {
+					this.allCheckedCallback(true,item)
+				})
+				if(!e.value && this.showCart){
+					this.showCart = false
+				}
 			},
-			allCheckedCallback(val){
-				this.allChecked = val
-				this.chooseList = this.$refs.productList.getAllChecked()
+			// 选中事件
+			allCheckedCallback(isAllChecked,row){
+				console.log(isAllChecked,row)
+				const has = this.chooseList.findIndex(k => k.id == row.id)
+				// 在已选列表中
+				if(has>=0){
+					// 取消选中
+					if(!row.checked){
+						this.chooseList.splice(has,1)
+					}
+				}else{
+					// 不在已选列表中,添加
+					if(row.checked){
+						this.chooseList.push(row)
+					}
+				}
+				// 是否全选
+				this.allChecked = isAllChecked
 			},
 			// 清空已选数据
 			clearChoose(){
@@ -201,9 +221,7 @@
 					this.$refs.productList.allSelect(false)
 				}
 			},
-			updateNums(){
-				this.chooseList = this.$refs.productList.getAllChecked()
-			},
+			
 			clearSearch(){
 				// 重置
 				this.keyword = ''
@@ -258,7 +276,6 @@
 							}else{
 								item.confirmQty = item.qty
 							}
-							
 						})
 						_this.partList=res.data;
 					}else{
@@ -321,15 +338,6 @@
 					}
 				})
 			},
-			delDetail(con,pot){
-				this.$refs.productList.setChecked(con.id,false)
-				this.chooseList.splice(pot,1);
-				this.allChecked = false
-				// 全部清空
-				if(this.chooseList.length==0){
-					this.clearChoose()
-				}
-			},
 			// 扫描结果
 			scanResult(data){
 				// 二维码
@@ -344,6 +352,15 @@
 				this.queryParam.shelfSn = this.nowData.shelfSn
 				this.loadData(this.queryParam);
 			},
+			delDetail(con,pot){
+				this.$refs.productList.setChecked(con.id,false)
+				this.chooseList.splice(pot,1);
+				this.allChecked = false
+				// 全部清空
+				if(this.chooseList.length==0){
+					this.clearChoose()
+				}
+			},
 			// 搜索
 			getSearchCon() {
 				var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');

+ 1 - 1
pages/shuntBackManage/productList.vue

@@ -124,7 +124,7 @@
 				}
 				// 判断是否全选
 				const isAllNoChecked = this.partList.filter(item => !item.checked)
-				this.$emit('allChecked',isAllNoChecked.length == 0)
+				this.$emit('allChecked',isAllNoChecked.length == 0,row)
 			},
 			// 获取所有选择的
 			getAllChecked(){