4 changed files with 480 additions and 16 deletions
@ -0,0 +1,450 @@ |
|||
<template> |
|||
<page-meta root-font-size="18px"></page-meta> |
|||
<view class=""> |
|||
<win-blank-view @goScan='openScanPopup' v-if="allDataList.length==0"></win-blank-view> |
|||
<scroll-view scroll-y class="scroll-detail" style="margin-top: 10rpx;padding-bottom:100px" > |
|||
<view class="detail-list " v-for="(item, index) in allDataList" :key="index"> |
|||
<view class="detail-content"> |
|||
<view class="" style=""> |
|||
<view class="uni-flex uni-row u-col-center"> |
|||
<view class="" style="margin-top: 20rpx; margin-left: 10rpx; font-weight: bold;"> |
|||
({{index+1}}). |
|||
</view> |
|||
<comItemCode :itemData="item"></comItemCode> |
|||
</view> |
|||
|
|||
<uni-table border stripe style=""> |
|||
<uni-tr> |
|||
<uni-td align="center">箱码</uni-td> |
|||
<uni-td>{{item.packingCode}}</uni-td> |
|||
</uni-tr> |
|||
<uni-tr> |
|||
<uni-td align="center">单位</uni-td> |
|||
<uni-td>{{item.uom}}</uni-td> |
|||
</uni-tr> |
|||
<uni-tr> |
|||
<uni-td align="center">标包数</uni-td> |
|||
<uni-td>{{item.stdPackQty}}</uni-td> |
|||
</uni-tr> |
|||
|
|||
<uni-tr> |
|||
<uni-td align="center">数量</uni-td> |
|||
<uni-td> |
|||
<view class="uni-flex uni-row"> |
|||
<view class="uni-flex uni-row space-between" style="width: 100%;"> |
|||
<view class=""> |
|||
<com-number-box :ref="'comNumberBox_'+index" v-model="item.qty" |
|||
:max="99999" :min="0" @change="qtyChanged($event,item,index)"> |
|||
</com-number-box> |
|||
</view> |
|||
|
|||
<view class=""> |
|||
<button type="primary" size="mini" style="margin-left: 30rpx;" |
|||
@click="remove(item,index)">移除</button> |
|||
</view> |
|||
|
|||
</view> |
|||
</view> |
|||
</uni-td> |
|||
</uni-tr> |
|||
</uni-table> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
</scroll-view> |
|||
<div class="new_bot_box" v-show="allDataList.length>0"> |
|||
<win-collapse-location scanTitle='扫描目标库位' ref='comCollapseLocation' @getLocationCode='getDefaultToLocation' |
|||
@clear='clearDefaultLocation'> |
|||
</win-collapse-location> |
|||
<view class="new_btn_bot bot_pos uni-flex"> |
|||
<button class="new_clear_btn btn_double" @click="cancel()">清空</button> |
|||
<button class="new_save_btn btn_double" @click="submit()">提交</button> |
|||
</view> |
|||
</div> |
|||
<win-scan-button @goScan='openScanPopup' v-if="allDataList.length>0"></win-scan-button> |
|||
<win-scan-by-pack ref="scanPopup" @getScanResult='getScanResult'></win-scan-by-pack> |
|||
<com-message ref="comMessage" @afterCloseScanMessage='closeScanMessage' @afterRescanMessage='afterRescan' |
|||
@afterCloseCommitMessage='closeCommitMessage'> |
|||
</com-message> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
locations, |
|||
getBalancesByFilterAsync, |
|||
getWipListAsync, |
|||
customerReturnCommit, |
|||
} from '@/api/index.js'; |
|||
|
|||
import { |
|||
showConfirmMsg, |
|||
goHome, |
|||
getRemoveOption |
|||
} from '@/common/basic.js'; |
|||
|
|||
import winBlankView from '@/mycomponents/wincom/winBlankView.vue' |
|||
import comBaseItem from '@/mycomponents/comItem/comBaseItem.vue' |
|||
import winScanButton from '@/mycomponents/wincom/winScanButton.vue' |
|||
import winScanByPack from '@/mycomponents/wincom/winScanByPack.vue' |
|||
import winScanByProductCode from '@/mycomponents/wincom/winScanByProductCode.vue' |
|||
|
|||
import winScanByCode from '@/mycomponents/wincom/winScanByCode.vue' |
|||
import comScanSemiPutaway from '@/mycomponents/scan/comScanSemiPutaway.vue' |
|||
import comMessage from '@/mycomponents/common/comMessage.vue' |
|||
import winCollapseLocation from '@/mycomponents/wincom/winCollapseLocation.vue' |
|||
import SemiCollapseItem from '@/mycomponents/common/SemiCollapseItem.vue' |
|||
import comItemCode from '@/mycomponents/comItem/comItemCode.vue' |
|||
import comNumberBox from '@/mycomponents/common/comNumberBox.vue'; |
|||
|
|||
|
|||
export default { |
|||
name: 'customerReturnCommit', |
|||
components: { |
|||
winBlankView, |
|||
comBaseItem, |
|||
comMessage, |
|||
winScanButton, |
|||
winScanByPack, |
|||
winScanByCode, |
|||
comScanSemiPutaway, |
|||
winCollapseLocation, |
|||
SemiCollapseItem, |
|||
winScanByProductCode, |
|||
comItemCode, |
|||
comNumberBox |
|||
}, |
|||
data() { |
|||
return { |
|||
options: [], |
|||
currentItem: {}, |
|||
toLocationInfo:{}, |
|||
toLocationCode: "", |
|||
allCount: 0, |
|||
allDataList: [], |
|||
loadingType: "", |
|||
scrollTop: 60, |
|||
old: { |
|||
scrollTop: 0 |
|||
}, |
|||
}; |
|||
}, |
|||
props: { |
|||
|
|||
}, |
|||
onLoad() { |
|||
}, |
|||
onPullDownRefresh() { |
|||
uni.stopPullDownRefresh() |
|||
}, |
|||
|
|||
|
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} else if (e.index === 1) { |
|||
window.location.reload(); |
|||
} |
|||
}, |
|||
mounted: function() { |
|||
this.openScanPopup(); |
|||
}, |
|||
|
|||
methods: { |
|||
|
|||
qtyChanged(value, item, index) { |
|||
if (value <= 0) { |
|||
this.showMessage('退货数量必须大于0') |
|||
item.handledQty = item.qty |
|||
this.$refs['comNumberBox_' + index][0].setValue(item.handledQty); |
|||
} |
|||
}, |
|||
remove(item, index) { |
|||
showConfirmMsg("是否移除当前" + item.itemCode, res => { |
|||
if (res) { |
|||
this.allDataList.splice(index, 1); |
|||
this.allCount = this.allDataList.length; |
|||
var title =this.allCount>0?"客户退货"+"("+this.allCount+")":"客户退货" |
|||
uni.setNavigationBarTitle({ |
|||
title: title |
|||
}) |
|||
this.$forceUpdate() |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
getScanResult(result) { |
|||
var resultData =result.data |
|||
var filterItem = this.allDataList.filter(res => { |
|||
if (res.packingCode == resultData.code) { |
|||
return res; |
|||
} |
|||
}) |
|||
if (filterItem.length > 0) { |
|||
this.showMessage("箱码【" + filterItem[0].packingCode + "】已经扫描") |
|||
return; |
|||
} |
|||
|
|||
var item = { |
|||
packingCode:resultData.code, |
|||
itemCode: resultData.itemCode, |
|||
itemName: resultData.itemName, |
|||
itemDesc1: resultData.itemDesc1, |
|||
stdPackQty: resultData.stdPackQty, |
|||
uom: resultData.uom, |
|||
qty: resultData.stdPackQty |
|||
|
|||
} |
|||
this.allDataList.unshift(item) |
|||
this.allCount = this.allDataList.length; |
|||
uni.setNavigationBarTitle({ |
|||
title: "客户退货"+"("+this.allCount+")" |
|||
}) |
|||
|
|||
this.$forceUpdate(); |
|||
}, |
|||
|
|||
|
|||
//扫描默认目标库位 |
|||
getDefaultToLocation(locationCode) { |
|||
uni.showLoading({ |
|||
title: "扫描中", |
|||
mask: true |
|||
}); |
|||
locations(locationCode).then(res => { |
|||
uni.hideLoading(); |
|||
if (res) { |
|||
this.toLocationInfo =res; |
|||
this.toLocationCode = res.code |
|||
} else { |
|||
this.showMessage('目标库位【' + locationCode + '】不存在'); |
|||
} |
|||
|
|||
}).catch(err => { |
|||
uni.hideLoading(); |
|||
this.toLocationInfo={} |
|||
this.toLocationCode = "" |
|||
this.showMessage(err.message); |
|||
|
|||
}) |
|||
}, |
|||
|
|||
clearDefaultLocation() { |
|||
this.toLocationCode = "" |
|||
}, |
|||
|
|||
submit() { |
|||
if (this.allDataList.length === 0) { |
|||
this.showMessage('请扫描箱码'); |
|||
return; |
|||
} |
|||
|
|||
if (this.toLocationCode == "") { |
|||
this.showMessage('请扫描目标库位'); |
|||
return; |
|||
} |
|||
var checkQtyItem =this.checkQty() |
|||
if(checkQtyItem!=undefined){ |
|||
this.showMessage("【"+checkQtyItem.itemCode+'】数量为0,退货数量必须大于0'); |
|||
return; |
|||
} |
|||
|
|||
uni.showLoading({ |
|||
title: "提交中....", |
|||
mask: true |
|||
}); |
|||
|
|||
let params = this.setSubmitParam(); |
|||
console.log( JSON.stringify(params) ) |
|||
customerReturnCommit(params) |
|||
.then(res => { |
|||
uni.hideLoading(); |
|||
this.showCommitSuccess(); |
|||
this.clearInfo(); |
|||
|
|||
}) |
|||
.catch(err => { |
|||
uni.hideLoading(); |
|||
this.showMessage(err.message); |
|||
|
|||
}); |
|||
}, |
|||
|
|||
checkQty(){ |
|||
var isCheck =true; |
|||
var result =undefined |
|||
for (let item of this.allDataList) { |
|||
if(item.qty==0){ |
|||
result =item |
|||
break |
|||
} |
|||
} |
|||
return result; |
|||
}, |
|||
|
|||
setSubmitParam() { |
|||
let item = { |
|||
worker: localStorage.userName_CN == "" ? localStorage.userName : localStorage.userName_CN, |
|||
details: [] |
|||
} |
|||
this.allDataList.forEach(res => { |
|||
var detail = { |
|||
itemCode: res.itemCode, |
|||
itemName: res.itemName, |
|||
itemDesc1: res.itemDesc1, |
|||
uom: res.uom, |
|||
qty: res.qty, |
|||
stdPackQty: res.stdPackQty, |
|||
toLocationCode:this.toLocationCode, |
|||
toLocationArea:this.toLocationInfo.areaCode, |
|||
toLocationGroup:this.toLocationInfo.locationGroupCode, |
|||
toLocationErpCode:this.toLocationInfo.erpLocationCode, |
|||
recommendPackingCode :res.packingCode, |
|||
handledPackingCode :res.packingCode |
|||
} |
|||
item.details.push(detail) |
|||
}) |
|||
|
|||
return item; |
|||
|
|||
}, |
|||
|
|||
|
|||
getSubmitParam() { |
|||
let that = this; |
|||
let item = { |
|||
number: "", |
|||
worker: localStorage.userName_CN == "" ? localStorage.userName : localStorage.userName_CN, |
|||
putawayType: 2, |
|||
details: [] |
|||
} |
|||
|
|||
that.allDataList.forEach(i => { |
|||
let balanceItem = i.balanceItem; |
|||
i.labelList.forEach(l => { |
|||
let detail = {}; |
|||
detail.itemCode = balanceItem.itemCode; |
|||
detail.itemName = balanceItem.itemName; |
|||
detail.itemDesc1 = balanceItem.itemDesc1; |
|||
detail.itemDesc2 = balanceItem.itemDesc2; |
|||
detail.uom = l.uom; |
|||
detail.qty = l.qty; |
|||
detail.stdPackQty = balanceItem.stdPackQty; |
|||
|
|||
detail.fromPackingCode = balanceItem.packingCode; |
|||
detail.toPackingCode = l.packingCode; |
|||
detail.fromLot = balanceItem.lot; |
|||
detail.toLot = l.lot; |
|||
|
|||
|
|||
detail.toLocationCode = l.toLocationCode ?? that.defaultToLocation.code; |
|||
detail.toLocationGroup = l.toLocationGroup ?? that.defaultToLocation |
|||
.locationGroupCode; |
|||
detail.toLocationArea = l.toLocationArea ?? that.defaultToLocation.areaCode; |
|||
detail.toLocationErpCode = l.toLocationErpCode ?? that.defaultToLocation |
|||
.erpLocationCode; |
|||
|
|||
detail.fromStatus = balanceItem.status; |
|||
detail.toStatus = l.status; |
|||
|
|||
detail.fromWarehouseCode = localStorage.warehouseCode; |
|||
detail.toWarehouseCode = localStorage.warehouseCode; |
|||
|
|||
detail.supplierBatch = balanceItem.supplierBatch; |
|||
detail.arriveDate = balanceItem.arriveDate; |
|||
detail.produceDate = balanceItem.produceDate; |
|||
detail.expireDate = balanceItem.expireDate; |
|||
//=========================================== |
|||
detail.recommendPackingCode = balanceItem.packingCode; |
|||
detail.recommendSupplierBatch = l.supplierBatch; |
|||
detail.recommendArriveDate = l.arriveDate; |
|||
detail.recommendProduceDate = l.produceDate; |
|||
detail.recommendExpireDate = l.expireDate; |
|||
detail.recommendLot = balanceItem.lot;; |
|||
detail.recommendToLocationCode = l.toLocationCode ?? that.defaultToLocation.code; |
|||
detail.recommendToLocationArea = l.toLocationArea ?? that.defaultToLocation |
|||
.areaCode; |
|||
detail.recommendToLocationGroup = l.toLocationGroup ?? that.defaultToLocation |
|||
.locationGroupCode; |
|||
detail.recommendToLocationErpCode = l.toLocationErpCode ?? that.defaultToLocation |
|||
.erpLocationCode; |
|||
detail.recommendToWarehouseCode = localStorage.warehouseCode; |
|||
detail.recommendQty = balanceItem.qty; |
|||
|
|||
|
|||
detail.handledContainerCode = l.containerCode; |
|||
detail.handledPackingCode = l.packingCode; |
|||
detail.handledSupplierBatch = l.supplierBatch; |
|||
detail.handledArriveDate = l.arriveDate; |
|||
detail.handledProduceDate = l.produceDate; |
|||
detail.handledExpireDate = l.expireDate; |
|||
detail.handledLot = l.lot; |
|||
detail.handledToLocationCode = l.toLocationCode ?? that.defaultToLocation.code; |
|||
detail.handledToLocationArea = l.toLocationArea ?? that.defaultToLocation.areaCode; |
|||
detail.handledToLocationGroup = l.toLocationGroup ?? that.defaultToLocation |
|||
.locationGroupCode; |
|||
detail.handledToLocationErpCode = l.toLocationErpCode ?? that.defaultToLocation |
|||
.erpLocationCode; |
|||
detail.handledToWarehouseCode = localStorage.warehouseCode; |
|||
detail.handledQty = l.qty; |
|||
item.details.push(detail); |
|||
}); |
|||
}) |
|||
return item; |
|||
}, |
|||
|
|||
cancel() { |
|||
let that = this; |
|||
showConfirmMsg('是否要清空已扫描信息?', confirm => { |
|||
if (confirm) { |
|||
that.clearInfo(); |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
clearInfo() { |
|||
this.allDataList = []; |
|||
this.toLocationInfo={} |
|||
this.toLocationCode = ""; |
|||
this.allCount = 0; |
|||
this.loadingType = "" |
|||
uni.setNavigationBarTitle({ |
|||
title: "客户退货" |
|||
}) |
|||
this.$refs.comCollapseLocation.clearLocation(); |
|||
}, |
|||
|
|||
openScanPopup() { |
|||
this.scanPopup(); |
|||
}, |
|||
|
|||
scanPopupGetFocus() { |
|||
this.$refs.scanPopup.getfocus(); |
|||
}, |
|||
showMessage(message) { |
|||
this.$refs.comMessage.showMessage(message); |
|||
}, |
|||
showCommitSuccess() { |
|||
this.$refs.comMessage.showCommitSuccess(); |
|||
}, |
|||
showScanMessage(message) { |
|||
this.$refs.comMessage.showScanMessage(message); |
|||
}, |
|||
closeCommitMessage() { |
|||
// this.openScanPopup(); |
|||
}, |
|||
closeScanMessage() { |
|||
this.scanPopupGetFocus(); |
|||
}, |
|||
|
|||
scanPopup() { |
|||
this.$refs.scanPopup.openScanPopup() |
|||
}, |
|||
|
|||
} |
|||
}; |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
</style> |
Loading…
Reference in new issue