Commit 94d365aa authored by dragondean@qq.com's avatar dragondean@qq.com

备货选择商品全选了某入仓记录的明细则带上快递单号和入仓影像https://zentao.test.jdshangmen.com/bug-view-5906.html

parent 0e4a7655
......@@ -81,7 +81,13 @@ export default {
let arr = []
this.orderItemDetails.forEach(item => {
item.orderWarehouseInCommonAttrVOList?.forEach((vo, index) => {
arr.push({...item, ...vo, index, span: index === 0 ? item.orderWarehouseInCommonAttrVOList?.length : 0})
arr.push({
...item,
...vo,
index,
span: index === 0 ? item.orderWarehouseInCommonAttrVOList?.length : 0,
warehouseInId: item.id
})
})
})
return arr
......@@ -112,6 +118,26 @@ export default {
}
})
// 如果某条入仓记录下的箱明细被全部选中了,则需要将他的快递单号和影像带过去
const expressNos = []
const pictureUrls = []
this.orderItemDetails.forEach(warehouseIn => {
// 本条入仓记录被选中的明细数
const selectedCount = arr.filter(item => item.warehouseInId == warehouseIn.id).length
if(selectedCount == warehouseIn.orderWarehouseInCommonAttrVOList?.length){
if(warehouseIn.expressNo){
expressNos.push(warehouseIn.expressNo)
}
if(warehouseIn.pictureUrls?.length){
pictureUrls.push(...warehouseIn.pictureUrls)
}
}
})
// 根据warehouseInId 给对应的入仓记录追加快递单号和影像
// 存到全局变量,在调用对应finishPack接口的时候判断追加
window.ChooseOrderProductsExpressNos = expressNos
window.ChooseOrderProductsPictureUrls = pictureUrls
this.$emit("success", arr)
},
handleClose() {
......
......@@ -201,6 +201,7 @@
show-choose-order-item
:order-id="order.orderId"
:warehouse-in-id="row.id"
@close="checkAppendExpressAndPictures(row)"
/>
<el-popconfirm
v-if="$index >= protectRowCount"
......@@ -720,6 +721,26 @@ export default {
titleZh: undefined,
titleEn: undefined
}
},
// 检查并追加快递单号和入仓影像
checkAppendExpressAndPictures(row){
if(window.ChooseOrderProductsExpressNos?.length){
// 去重追加
window.ChooseOrderProductsExpressNos?.forEach(no => {
if(row.expressNo.indexOf(no) === -1){
row.expressNo += "," + no
}
})
}
if(window.ChooseOrderProductsPictureUrls?.length){
this.pictureUrls = this.pictureUrls.concat(window.ChooseOrderProductsPictureUrls)
// 去重
this.pictureUrls = Array.from(new Set(this.pictureUrls))
}
// 清掉
window.ChooseOrderProductsExpressNos = null
window.ChooseOrderProductsPictureUrls = null
}
}
}
......
......@@ -69,10 +69,11 @@
<template v-slot="{row}">
<WarehouseRecordDetail
v-model="row.orderWarehouseInDetailsVOList"
@input="saveDetail(props.row)"
@input="saveDetail(props.row, row.id)"
show-choose-order-item
:order-id="orderId"
:warehouse-in-id="row.id"
@close="clearAppendExpressNoAndPictures"
/>
<el-button class="pl-5 pr-5" size="mini" type="primary" @click="package(props.row, $t('修改打包'))">{{$t('修改')}}</el-button>
<el-button class="pl-5 pr-5" size="mini" type="danger" @click="package(props.row, $t('修改打包'))">{{$t('删除')}}</el-button>
......@@ -482,18 +483,35 @@ export default {
this.curPictrues = wareItem.pictureUrls || []
},
// 保存箱明细
saveDetail(row){
saveDetail(row, warehouseInId){
const wareItem = this.wareItem(row.orderItemId)
const orderWarehouseInItemDtoList = wareItem.orderWarehouseInBackItemDoList
orderWarehouseInItemDtoList.map(item =>{
item.orderLocationCreateReqVOList = item.orderLocationBackVOList || []
return item
})
let pictures = wareItem.pictureUrls || []
if(window.ChooseOrderProductsPictureUrls?.length){
pictures.push(...window.ChooseOrderProductsPictureUrls)
// 去重
pictures = Array.from(new Set(pictures))
}
if(window.ChooseOrderProductsExpressNos?.length){
const warehouseInItem = orderWarehouseInItemDtoList.find(item => item.id === warehouseInId)
if(!warehouseInItem.expressNo)warehouseInItem.expressNo = ""
window.ChooseOrderProductsExpressNos?.forEach(item => {
if(warehouseInItem.expressNo.indexOf(item) === -1){
if(warehouseInItem.expressNo?.length) warehouseInItem.expressNo += ","
warehouseInItem.expressNo += item
}
})
}
const data = {
orderId: row.orderId,
orderItemId: row.orderItemId,
orderWarehouseInItemDtoList: orderWarehouseInItemDtoList,
pictureUrls: wareItem.pictureUrls || []
pictureUrls: pictures
}
finishPacked(data).then(res => {
this.$message.success(this.$t('操作成功'))
......@@ -514,6 +532,13 @@ export default {
},
printTag(){
this.showPrintTagDialog = true
},
// 箱明细关闭后清理快递单号和影像临时数据
clearAppendExpressNoAndPictures(){
setTimeout(() => {
window.ChooseOrderProductsExpressNos = null
window.ChooseOrderProductsPictureUrls = null
}, 100)
}
},
watch: {
......
......@@ -92,7 +92,13 @@ export default {
showChooseDialog: false
};
},
watch:{
dialogVisible(v){
if(!v){
this.$emit("close")
}
}
},
mounted() {
this.getAttrList()
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment