<template>
|
<view class="overflow">
|
<cu-custom bgColor="bg-white" :isBack="true">
|
<block slot="backText">
|
</block>
|
<block slot="content">容器解绑</block>
|
</cu-custom>
|
<view class="flex justify-end align-center padding_right30rpx padding_top12rpx">
|
<text class="fontSize12rpx"> 操作人:{{operator}} </text>
|
</view>
|
<view v-if="renameFocus" class="text-bold width fontSize32rpx"
|
style="padding: 10rpx 10rpx;background-color: #d6d6d6;">
|
<view class="flex justify-between align-center">
|
<text class="width23 padding10">入库单号</text>
|
<text>{{putCode}}</text>
|
</view>
|
</view>
|
<u-form labelPosition="top" :model="warehouse" ref="warehouseRef">
|
<u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="10">
|
<u-form-item label="容器编号:" prop="containerCode" required
|
style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
|
<input v-model="warehouse.containerCode" placeholder="请录入或扫码" @focus="focu=true"
|
@blur="getUnboundMaterial" style="font-weight: bolder;margin-left: 15rpx;"
|
class="width padding_left30rpx">
|
</input>
|
<u-icon name="close-circle-fill" color="#848484" v-if="warehouse.containerCode && focu"
|
@click="warehouse.containerCode=''"></u-icon>
|
</u-form-item>
|
</u-col>
|
<u-col span="2">
|
<u-icon class="iconfont icon-saoma fontSize60rpx"></u-icon>
|
</u-col>
|
</u-row>
|
<u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="10" class="">
|
<u-form-item label="物料编号:" prop="materialCode"
|
style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
|
<!-- <view class="fontSize32rpx font_weight_bold" style="padding: 0 0 10rpx;">
|
物料编号:
|
</view>
|
<view class="flex"> -->
|
<input v-model="warehouse.materialCode" placeholder="请录入或扫码" @focus="focuM=true"
|
@blur="getUnboundMaterial" style="font-weight: 800;margin:15rpx;"
|
class="width padding_left30rpx fontSize32rpx">
|
</input>
|
<u-icon name="close-circle-fill" color="#848484" v-if="warehouse.materialCode && focuM"
|
@click="warehouse.materialCode=''"></u-icon>
|
<!-- </view> -->
|
</u-form-item>
|
</u-col>
|
<u-col span="2">
|
<u-icon class="iconfont icon-saoma fontSize60rpx"></u-icon>
|
</u-col>
|
</u-row>
|
</u-form>
|
<modal-code :rescode='rescode' :resmessage='resmessage' ref="resmodal" />
|
<view v-if="singlist.length>0" :style="'height:calc(100vh - '+(CustomBar+155)+'px'">
|
<view class="margin_top10rpx overflow_auto" style="height:calc(100% - 225rpx)">
|
<scroll-view scroll-y="true">
|
<u-swipe-action :show="item.show" :index="eindex" v-for="(item, eindex) in singlist" :key="eindex"
|
@click="longpress" @open="open" :options="options">
|
<view class="item u-border-bottom">
|
<!-- 此层wrap在此为必写的,否则可能会出现标题定位错误 -->
|
<view class="title-wrap">
|
<view :key="eindex+'singlist'" :class="item.edit?'clickactive':''"
|
class="fontSize32rpx width margin_auto background_fff padding15 border_radius margin_bottom10rpx relative box_sizing transition">
|
<u-row>
|
<u-col span="12" class="flex">
|
<view class="flex justify-center align-center"
|
style="background-color: #f18202;color: #fff;border-radius: 50vh;width: 20px;height: 20px;">
|
{{eindex+1}}
|
</view>
|
<view class="color_f18202 padding_left10rpx">
|
{{item.code}}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<view class="" style="padding: 10rpx 0 10rpx 45rpx;color: #808080;">
|
名称:{{item.name}}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<input disabled=""
|
class="border_bottom_f18202 width45 fontSize32rpx text-left"
|
style="margin:10rpx 0 10rpx 45rpx;" v-model="item.unit"
|
@blur="changeNum(item)" placeholder="单位"/>
|
</u-col>
|
<u-col span="5">
|
<input
|
class="border_bottom_f18202 width text-left fontSize32rpx padding_left10rpx"
|
v-model="item.unquantity" type="number" @blur="changeNum(item)"
|
placeholder="请输入解绑数量"/>
|
</u-col>
|
</u-row>
|
</view>
|
</view>
|
</view>
|
</u-swipe-action>
|
</scroll-view>
|
</view>
|
<u-popup v-model="detailshow" border-radius="14" @close="detailshow=false" mode="bottom">
|
<view class="pop ">
|
<h2 class="text_align_center padding_bottom18 padding15">物料信息</h2>
|
<view class="line flex justify-between">
|
<text class="text-gray">容器编号</text>
|
<text>{{warehouse.containerCode}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料编号</text>
|
<text>{{materlist.code}}</text>
|
</view>
|
|
<view class="line flex justify-between">
|
<text class="text-gray">物料名称</text>
|
<text>{{materlist.name}}</text>
|
</view>
|
<!-- <view class="line flex justify-between">
|
<text class="text-gray">物料类型</text>
|
<text>{{materlist.wareMaterialTypeName}}</text>
|
</view> -->
|
<view class="line flex justify-between">
|
<text class="text-gray">物料规格</text>
|
<text>{{materlist.specificationModel}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">长(mm)</text>
|
<text>{{materlist.long}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">宽(mm)</text>
|
<text>{{materlist.width}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">高(mm)</text>
|
<text>{{materlist.high}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">重量(kg)</text>
|
<text>{{materlist.weight}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">条码</text>
|
<text>{{materlist.barCode}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">总数</text>
|
<text>{{materlist.quantity}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">单位</text>
|
<text>{{materlist.unit}}</text>
|
</view>
|
</view>
|
</u-popup>
|
</view>
|
<button-modal :cleaningShow='true' allTitle="全部解绑" cleaningTitle='确认解绑' @submit='submit'
|
@allsubmit="allsubmit" />
|
|
</view>
|
</template>
|
|
<script>
|
import ButtonModal from '../../../components/buttonModal.vue'
|
import ModalCode from '../../../components/ModalCode.vue'
|
import {
|
getUnboundMaterial,
|
updateunbound
|
} from '../../../api/putIn/untie.js'
|
export default {
|
data() {
|
return {
|
renameFocus: false,
|
modalshow: false,
|
show: false,
|
rescode: 0,
|
resmessage: "",
|
detailshow: false,
|
operator: '', //操作人
|
focu: false,
|
focuM: false,
|
singlist: [
|
// {
|
// "warematerialCode": "string",
|
// "collectNo": "string",
|
// "purchaseNo": "string",
|
// "category": "string",
|
// "wareMaterialTypeName": "string",
|
// "specificationModel": "string",
|
// "long": "string",
|
// "width": "string",
|
// "high": "string",
|
// "weight": "string",
|
// "barCode": "string",
|
// "company": "string",
|
// "uncollectedQuantity": 0,
|
// "id": 0
|
// }
|
], //物料详情
|
options: [{
|
text: '详情',
|
style: {
|
backgroundColor: '#fc9f35'
|
}
|
}],
|
materlist: [],
|
warehouse: {
|
containerCode: '',
|
materialCode: ''
|
},
|
warehouseRules: {
|
containerCode: [{
|
required: true,
|
message: '容器编号不能为空',
|
trigger: 'blur'
|
}],
|
// materialCode: [{
|
// required: true,
|
// message: '物料编号不能为空',
|
// trigger: 'blur'
|
// }]
|
},
|
putCode: ''
|
};
|
},
|
components: {
|
ButtonModal,
|
ModalCode
|
},
|
onReady() {
|
this.$refs.warehouseRef.setRules(this.warehouseRules)
|
},
|
mounted() {
|
// this.WarehousChangePort()
|
this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
|
// this.getOrderNo()
|
},
|
methods: {
|
//入库单号
|
// getOrderNo() {
|
// getOrderNo().then((res) => {
|
// if (res.code == 200) {
|
// this.putCode = res.data
|
// } else {
|
// this.$refs.resmodal.show = true
|
// }
|
// })
|
// },
|
//查询物料
|
getUnboundMaterial() {
|
this.$refs.warehouseRef.validate(valid => {
|
if (valid) {
|
setTimeout(() => {
|
this.focu = false
|
this.focuM = false
|
if (this.warehouse.containerCode !== '' || this.warehouse.materialCode !==
|
'') {
|
let params = {
|
wareContainerCode: this.warehouse.containerCode,
|
materialCode: this.warehouse.materialCode
|
}
|
getUnboundMaterial(params).then((res) => {
|
if (res.code == 200) {
|
if (res.data.length == 0) {
|
this.rescode = 400
|
this.resmessage = '暂无数据'
|
this.$refs.resmodal.show = true
|
this.singlist = []
|
} else {
|
this.singlist = res.data
|
this.putCode = res.data[0].orderNo
|
this.renameFocus = true
|
}
|
} else {
|
this.$refs.resmodal.show = true
|
this.rescode = res.code
|
this.resmessage = res.message
|
}
|
})
|
}
|
}, 200)
|
}
|
})
|
},
|
//删除详情
|
longpress(index, eindex) {
|
this.materlist = this.singlist[index]
|
this.detailshow = true
|
},
|
// 如果打开一个的时候,不需要关闭其他,则无需实现本方法
|
open(index) {
|
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
|
// 原本为'false',再次设置为'false'会无效
|
this.singlist[index].show = true;
|
this.singlist.map((val, idx) => {
|
if (index != idx) this.singlist[idx].show = false;
|
})
|
},
|
//改变组盘数量
|
changeNum(val) {
|
if (val.unquantity && val.unquantity > 0) {
|
val.edit = true
|
this.$forceUpdate()
|
} else {
|
val.edit = false
|
this.$forceUpdate()
|
}
|
|
},
|
//全部解绑
|
allsubmit() {
|
let arr = this.singlist.filter(item => item.edit)
|
if (arr.length == this.singlist.length) {
|
this.submit()
|
} else {
|
this.rescode = 400
|
this.resmessage = '请填写所有解绑数量'
|
this.$refs.resmodal.show = true
|
}
|
},
|
//重置
|
rest() {
|
this.warehouse.containerCode = ''
|
this.warehouse.materialCode = ''
|
this.renameFocus = false
|
this.singlist = []
|
},
|
//确认
|
submit() {
|
this.$refs.warehouseRef.validate(valid => {
|
if (valid) {
|
if (this.singlist.length == 0) {
|
return
|
}
|
let arr = this.singlist.filter(item => item.edit)
|
if (arr.length == 0 && this.singlist.length !== 0) {
|
this.rescode = 400
|
this.resmessage = '请填写解绑数量'
|
this.$refs.resmodal.show = true
|
return
|
}
|
let unboundMatatils = []
|
let subshow = true
|
arr.forEach(item => {
|
if (item.quantity - item.unquantity < 0) {
|
this.rescode = 400
|
this.resmessage = '解绑数量不能大于原数量'
|
this.$refs.resmodal.show = true
|
subshow = false
|
return
|
}
|
unboundMatatils.push({
|
collectNo: item.collectNo,
|
batchNo: item.batchNo,
|
id: item.id,
|
materialCode: item.wareMaterialCode,
|
quantity: item.quantity,
|
updateQuantity: item.quantity - item.unquantity
|
|
})
|
})
|
if (subshow) {
|
let params = {
|
wareContainerCode: this.warehouse.containerCode,
|
ordersNo: this.putCode,
|
unboundMatatils: unboundMatatils
|
}
|
updateunbound(params).then((res) => {
|
this.$refs.resmodal.show = true
|
this.rescode = res.code
|
this.resmessage = res.message
|
if (res.code == 200) {
|
this.rest()
|
}
|
})
|
}
|
|
}
|
})
|
}
|
},
|
|
}
|
</script>
|
|
<style lang="scss">
|
|
</style>
|