lilei 3 years ago
parent
commit
7f7fbc71e2
2 changed files with 43 additions and 19 deletions
  1. 34 17
      pages/common/partList.vue
  2. 9 2
      pages/shuntBackManage/cancellingStocks.vue

+ 34 - 17
pages/common/partList.vue

@@ -9,21 +9,21 @@
 		<view class="partList-list">
 		<view class="partList-list">
 			<view class="partList-list-box" v-for="item in partList" :key="item.id">
 			<view class="partList-list-box" v-for="item in partList" :key="item.id">
 				<view class="product flex align_center">
 				<view class="product flex align_center">
-					<view class="checkbox"><u-checkbox size="40" shape="circle"></u-checkbox></view>
-					<view class="flex align_center">
+					<view class="checkbox"><u-checkbox v-model="item.checked" :name="item.id" @change="checkChange" size="40" shape="circle"></u-checkbox></view>
+					<view class="flex align_center flex_1">
 						<view class="pimgs">
 						<view class="pimgs">
 							<u-image width="128" height="128" border-radius="10"></u-image>
 							<u-image width="128" height="128" border-radius="10"></u-image>
 						</view>
 						</view>
 						<view class="pinfo">
 						<view class="pinfo">
 							<view class="pname">
 							<view class="pname">
-								箭牌机油滤清器 10 款进口大众途锐 5.0L V10
+								{{item.productName}}
 							</view>
 							</view>
 							<view class="ptxt flex align_center justify_between">
 							<view class="ptxt flex align_center justify_between">
 								<view>
 								<view>
-									<text class="pcode">JB-11066A</text>
+									<text class="pcode">{{item.productCode}}</text>
 								</view>
 								</view>
 								<view>
 								<view>
-								  调回数量:<text class="pnums">3个</text>
+								  调回数量:<text class="pnums">{{item.qty}}个</text>
 								</view>
 								</view>
 							</view>
 							</view>
 						</view>
 						</view>
@@ -33,7 +33,7 @@
 					<view></view>
 					<view></view>
 					<view class="pcurnums">
 					<view class="pcurnums">
 						<text>实退数量</text>
 						<text>实退数量</text>
-						<u-number-box :min="1"></u-number-box>
+						<u-number-box v-model="item.quitQty" :min="1" :max="item.qty"></u-number-box>
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>
@@ -60,25 +60,39 @@
 		},
 		},
 		watch: {
 		watch: {
 			list(newValue, oldValue) {
 			list(newValue, oldValue) {
-				this.partList = newValue
-			}
-		},
-		computed: {
-			totalNums() {
-				let ret = 0
-				this.list.map(item => {
-					ret = ret + item.qty
+				newValue.map(item => {
+					this.totalNums = this.totalNums + item.qty
+					item.quitQty = item.qty
+					item.checked = false
 				})
 				})
-				return ret
+				this.partList = JSON.parse(JSON.stringify(newValue))
 			}
 			}
 		},
 		},
 		data() {
 		data() {
 			return {
 			return {
-				partList: this.list
+				partList: this.list,
+				totalNums: 0
 			}
 			}
 		},
 		},
 		methods: {
 		methods: {
-			
+			// 全选
+			allSelect(val){
+				this.partList.map(item => {
+					item.checked = val
+				})
+				this.partList.splice()
+			},
+			checkChange(e){
+				const row = this.partList.find(item => item.id == e.name)
+				console.log(row.checked)
+				if(row){
+					row.checked = !row.checked
+					this.partList.splice()
+				}
+				// 判断是否全选
+				const isAllNoChecked = this.partList.filter(item => !item.checked)
+				this.$emit('allChecked',isAllNoChecked.length == 0)
+			}
 		}
 		}
 	}
 	}
 </script>
 </script>
@@ -110,6 +124,9 @@
 		}
 		}
 		.product{
 		.product{
 			flex-grow: 1;
 			flex-grow: 1;
+			.checkbox{
+				width: 60rpx;
+			}
 			.pinfo{
 			.pinfo{
 				flex-grow: 1;
 				flex-grow: 1;
 				padding-left: 20rpx;
 				padding-left: 20rpx;

+ 9 - 2
pages/shuntBackManage/cancellingStocks.vue

@@ -19,12 +19,12 @@
 			</view>
 			</view>
 			<view class="part-list">
 			<view class="part-list">
 				<!-- 配件列表 -->
 				<!-- 配件列表 -->
-				<partList :list="partList"></partList>
+				<partList ref="partList" :list="partList" @allChecked="allCheckedCallback"></partList>
 			</view>
 			</view>
 		</view>
 		</view>
 		<view class="cancelStockPages-footer">
 		<view class="cancelStockPages-footer">
 			<view>
 			<view>
-				<u-checkbox size="40" v-model="allChecked" shape="circle">全选</u-checkbox>
+				<u-checkbox size="40" @change="allCheckeChange" v-model="allChecked" shape="circle">{{allChecked?'取消全选':'全选'}}</u-checkbox>
 			</view>
 			</view>
 			<view>
 			<view>
 				<u-button shape="circle" :custom-style="{background:$config('primaryColor')}" type="primary">确定退库</u-button>
 				<u-button shape="circle" :custom-style="{background:$config('primaryColor')}" type="primary">确定退库</u-button>
@@ -60,6 +60,13 @@
 			this.getPartList()
 			this.getPartList()
 		},
 		},
 		methods: {
 		methods: {
+			// 全选
+			allCheckeChange(e){
+				this.$refs.partList.allSelect(e.value)
+			},
+			allCheckedCallback(val){
+				this.allChecked = val
+			},
 			getDetail(){
 			getDetail(){
 				shelfRecallFindBySn({sn:this.recallBillSn}).then(res => {
 				shelfRecallFindBySn({sn:this.recallBillSn}).then(res => {
 					if(res.status == 200){
 					if(res.status == 200){