Commit 51e81212 authored by 李驰骋's avatar 李驰骋

扫码到货数量重复计划BUG修复

parent a61fb8b4
...@@ -140,12 +140,12 @@ import BottomBtn from "@/components/BottomBtn/index.vue"; ...@@ -140,12 +140,12 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
// 接收扫码页面返回的数据 // 接收扫码页面返回的数据
updateGoodsList(newGoodsList) { updateGoodsList(newGoodsList) {
if (newGoodsList && newGoodsList.length > 0) { if (newGoodsList && newGoodsList.length > 0) {
// 合并新的扫码数据到现有列表 // 智能合并数据,避免重复累加
newGoodsList.forEach(newItem => { newGoodsList.forEach(newItem => {
const existingIndex = this.goodsList.findIndex(item => item.joinlabel === newItem.joinlabel); const existingIndex = this.goodsList.findIndex(item => item.joinlabel === newItem.joinlabel);
if (existingIndex > -1) { if (existingIndex > -1) {
// 如果已存在,更新数量 // 如果已存在,直接替换数量(因为scanning页面已经处理了累加逻辑)
this.goodsList[existingIndex].arrivalQuantity = Number(this.goodsList[existingIndex].arrivalQuantity) + Number(newItem.arrivalQuantity); this.goodsList[existingIndex].arrivalQuantity = Number(newItem.arrivalQuantity);
} else { } else {
// 如果不存在,添加新项 // 如果不存在,添加新项
this.goodsList.push(newItem); this.goodsList.push(newItem);
......
...@@ -68,6 +68,14 @@ export default { ...@@ -68,6 +68,14 @@ export default {
this.isFocus = true; this.isFocus = true;
}); });
}, },
onLoad(options) {
// 接收主页面传递的数据
const pages = getCurrentPages();
const prevPage = pages[pages.length - 2];
if (prevPage && prevPage.$vm && prevPage.$vm.goodsList) {
this.goodsList = [...prevPage.$vm.goodsList];
}
},
methods: { methods: {
focus(){ focus(){
this.$nextTick(() => { this.$nextTick(() => {
...@@ -81,7 +89,7 @@ export default { ...@@ -81,7 +89,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(()=>{ setTimeout(()=>{
this.isFocus = true; this.isFocus = true;
},100); },500);
}); });
}, },
getBtnHandle(row) { getBtnHandle(row) {
......
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