150 lines
4.4 KiB
Vue
150 lines
4.4 KiB
Vue
<template>
|
||
<view>
|
||
<uni-collapse>
|
||
<uni-forms ref="form" :modelValue="wmsSaleBackIn" >
|
||
<uni-forms-item label="销售退货任务单" :labelWidth='110' name="productInTaskCode">
|
||
<uni-combox :candidates="productInTaskCodeList" emptyTips="无" @input="scanBarCode"
|
||
v-model="wmsSaleBackIn.saleBackTaskCode"></uni-combox>
|
||
</uni-forms-item>
|
||
<uni-collapse-item title="直接入库单明细" :open="true">
|
||
<uni-swipe-action>
|
||
<uni-swipe-action-item :key="index"
|
||
v-for="(item, index) in wmsSaleBackIn.wmsSaleBackInDetailList"
|
||
@click="(data) => clickDetail(index,data)" @change="swipChange">
|
||
<uni-badge :text="index+1" type="primary"></uni-badge>
|
||
<uni-forms-item label="物料编码" :labelWidth='90'
|
||
:name="'wmsSaleBackInDetailList.'+ index +'.materialCode'">
|
||
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
|
||
</uni-forms-item>
|
||
<uni-forms-item label="物料名称" :labelWidth='90'
|
||
:name="'wmsSaleBackInDetailList.'+ index +'.materialName'">
|
||
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
|
||
</uni-forms-item>
|
||
<uni-forms-item label="物料批号" :labelWidth='90'
|
||
name="'wmsSaleBackInDetailList.'+ index +'.materialBatchNo'">
|
||
<uni-easyinput type="text" v-model="item.materialBatchNo" />
|
||
</uni-forms-item>
|
||
<uni-forms-item label="库位条码" :labelWidth='90'
|
||
name="'wmsSaleBackInDetailList.'+ index +'.storageLocationBarcode'">
|
||
<uni-easyinput suffixIcon="scan" type="text"
|
||
v-model="item.storageLocationBarcode" @iconClick="iconClick(index)"/>
|
||
</uni-forms-item>
|
||
<uni-forms-item label="上架数量" :labelWidth='90'
|
||
name="'wmsSaleBackInDetailList.'+ index +'number'">
|
||
<u-number-box inputWidth="120" button-size="36" v-model="item.number" min="0"></u-number-box>
|
||
</uni-forms-item>
|
||
</uni-swipe-action-item>
|
||
</uni-swipe-action>
|
||
</uni-collapse-item>
|
||
</uni-forms>
|
||
</uni-collapse>
|
||
<u-button type="primary" @click="submit">提交</u-button>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
listWarehouse,
|
||
backListTask,
|
||
addIn,
|
||
getInByTask
|
||
} from "@/api/wms/warehouse";
|
||
import {
|
||
toast,
|
||
} from '@/utils/common'
|
||
export default {
|
||
mounted() {
|
||
this.selectTypeList();
|
||
|
||
listWarehouse().then(res => {
|
||
console.log(res, "vuex数据");
|
||
})
|
||
},
|
||
data() {
|
||
return {
|
||
productInTaskCodeList:[],
|
||
wmsSaleBackIn:{}
|
||
}
|
||
},
|
||
methods: {
|
||
/**
|
||
* 获取销售退货任务单下拉数据
|
||
*/
|
||
selectTypeList() {
|
||
backListTask({
|
||
pageNum: 1,
|
||
pageSize: 25
|
||
}).then(async res => {
|
||
for (var i in res.rows) {
|
||
this.productInTaskCodeList.push(res.rows[i].saleBackTaskCode);
|
||
}
|
||
});
|
||
},
|
||
/**
|
||
* 获取相关信息
|
||
* @param {Object} value 销售退货任务单数据
|
||
*/
|
||
scanBarCode(value){
|
||
getInByTask({saleBackTaskCode:value}).then(res => {
|
||
this.wmsSaleBackIn = res.wmsSaleBackIn
|
||
this.wmsSaleBackIn.status = 3
|
||
})
|
||
},
|
||
/**
|
||
* 提交
|
||
*/
|
||
submit(){
|
||
//判断是否输入工业条码
|
||
if(!getStorageLocationBarcode(this.wmsSaleBackIn.wmsSaleBackInDetailList,'storageLocationBarcode')) return
|
||
addIn(this.wmsSaleBackIn).then(res =>{
|
||
toast('入库成功');
|
||
|
||
setTimeout(()=>{
|
||
uni.switchTab({
|
||
url:'/pages/work/index'
|
||
})
|
||
},2000)
|
||
})
|
||
|
||
/**
|
||
* 判断库位条码是否为nll,'',undefined
|
||
* @param {Object} list 要遍历的数据
|
||
* @param {String} key 要判断的值
|
||
*/
|
||
function getStorageLocationBarcode(list,key){
|
||
for(let i in list){
|
||
if(list[i][key] === null || list[i][key] ==='' || list[i][key] === undefined){
|
||
toast('请填写库位条码')
|
||
return false
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
},
|
||
/**
|
||
* 扫码方法
|
||
* @param {Object} value {industry || number }
|
||
*/
|
||
iconClick(index){
|
||
const _this = this;
|
||
uni.scanCode({
|
||
// 是否只能从相机扫码,不允许从相册选择图片
|
||
onlyFromCamera:true,
|
||
// 扫码类型
|
||
scanType: ['barCode', 'qrCode'],
|
||
success: function(res) {
|
||
// _this.wmsSaleBackIn.wmsSaleBackInDetailList[index].storageLocationBarcode = res;
|
||
_this.$set(_this.wmsSaleBackIn.wmsSaleBackInDetailList[index],'storageLocationBarcode',res.result)
|
||
}
|
||
})
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
page{
|
||
background-color: #ffffff;
|
||
padding-top: 2vh;
|
||
}
|
||
</style> |