| 
					
				 | 
			
			
				@ -7,7 +7,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          <span>{{ bussiness == 1 ? '修改容量' : bussiness == 2 ? '矫正库存' : bussiness == 4 || bussiness == 5 ? '设置库存' : bussiness == 6 ? '新增' : '' }}</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        <template v-if="bussiness == 1 || bussiness == 4 || bussiness == 5 || bussiness == 6"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          <div class="tc pt30 pb20"><van-stepper v-model="stock" min="1" max="99" button-size="36px" input-width="60px" /></div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          <div class="tc pt30 pb20"><van-stepper v-model="stock" min="1" :max="data.cargoCapacity" button-size="36px" input-width="60px" /></div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        <div class="tc" v-else> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          <div class="pt10"> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -93,12 +93,12 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  watch: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    value: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      handler(val) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (this.init&&val) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (this.init && val) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          // 如果是初始化 则赋值。解决扫码回来这个地方重复调用的问题 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            this.stock = this.bussiness == 1 ? this.data.cargoCapacity : this.data.qty 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          console.log(this.codeList,"this.codeList"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            this.newCodeList = JSON.parse(JSON.stringify(this.codeList)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          this.stock = this.bussiness == 1 ? this.data.cargoCapacity : this.data.qty 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          console.log(this.codeList, 'this.codeList') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          this.newCodeList = JSON.parse(JSON.stringify(this.codeList)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          this.init = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      }, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -116,38 +116,74 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  created() {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  methods: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    confirm() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      if (this.bussiness == 1 && this.fillNum > this.stock) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 修改容量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        this.$toast('追溯码数量不能大于容量') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      const codeList = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      this.newCodeList.forEach((el, index) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        codeList.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          code: el.code, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          sort: this.newCodeList.length - index 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      let p = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        id: this.trackId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        userId: this.user.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        codeStr: JSON.stringify(codeList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      if (this.bussiness == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //修改容量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (this.fillNum > this.stock) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          this.$toast('追溯码数量不能大于容量') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      if (this.bussiness == 2 && this.fillNum != this.stock * 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 矫正库存 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        this.$toast('追溯码数量必须等于库存') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      if (this.bussiness == 4) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 更换商品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        this.$router.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          path: '/replenishment/start/traceability', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          query: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            deviceId: this.deviceId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            trackId: this.trackId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            drugId: this.drugId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            stock: this.stock, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            type: 3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        p.cargoCapacity = this.stock 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        medicineAbinetApi.updateMediicinecabineInventoryInfoById(p).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          this.emitValue(false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          this.$toast.clear() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          this.$emitRefreshPage('replenishmentStartDeviceDetail') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          history.back() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      if (this.trackId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        this.updateMediicinecabineInventory() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      } else if (this.bussiness == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 矫正库存 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (this.fillNum != this.stock * 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          this.$toast('追溯码数量必须等于库存') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        p.drugId = this.drugId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        p.qty = this.stock 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        medicineAbinetApi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          .updateMediicinecabineInventory(p) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          .then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            this.emitValue(false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            this.$toast.clear() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            this.$emitRefreshPage('replenishmentStartDeviceDetail') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            history.back() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          .catch(err => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            console.error(err) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (this.bussiness == 4) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          // 更换商品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          this.$router.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            path: '/replenishment/start/traceability', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            query: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              deviceId: this.deviceId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              trackId: this.trackId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              drugId: this.drugId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              stock: this.stock, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              type: 3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (this.trackId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          this.updateMediicinecabineInventory() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      this.$emit('onConfirm', { stock: this.stock, codeList: this.newCodeList }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      this.emitValue(false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        this.$emit('onConfirm', { stock: this.stock, codeList: this.newCodeList }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        this.emitValue(false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    emitValue(show) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      this.init = true 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -177,12 +213,6 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          this.$toast.clear() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          this.$emitRefreshPage('replenishmentStartDeviceDetail') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          history.back() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          // this.$router.replace({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          //     path: '/replenishment/start/productDetail', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          //     query: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          //         id: this.trackId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          //     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          // }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        .catch(err => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          console.error(err) 
			 |