|
@@ -492,47 +492,40 @@ export default {
|
|
var referenceDosageQty=Number(list.referenceDosageQty)
|
|
var referenceDosageQty=Number(list.referenceDosageQty)
|
|
//var addArr= goods.goodsList
|
|
//var addArr= goods.goodsList
|
|
goods.goodsList.splice(300);
|
|
goods.goodsList.splice(300);
|
|
- var addArr=JSON.parse(JSON.stringify(goods.goodsList))
|
|
|
|
|
|
+
|
|
if(list.referenceDosageQty&&!goods.goodsList[0].del){
|
|
if(list.referenceDosageQty&&!goods.goodsList[0].del){
|
|
|
|
|
|
goods.goodsGroupDetail.forEach((tgoods,tindex)=>{
|
|
goods.goodsGroupDetail.forEach((tgoods,tindex)=>{
|
|
-
|
|
|
|
|
|
+ var addArr=JSON.parse(JSON.stringify(goods.goodsList))
|
|
if(tindex==0){
|
|
if(tindex==0){
|
|
if(referenceDosageQty>tgoods.capacity){
|
|
if(referenceDosageQty>tgoods.capacity){
|
|
var parseIntNum=parseInt(referenceDosageQty/tgoods.capacity)
|
|
var parseIntNum=parseInt(referenceDosageQty/tgoods.capacity)
|
|
tgoods.qty=parseIntNum
|
|
tgoods.qty=parseIntNum
|
|
|
|
+ addArr.unshift(tgoods)
|
|
var reduce= tgoods.capacity*parseIntNum
|
|
var reduce= tgoods.capacity*parseIntNum
|
|
referenceDosageQty=referenceDosageQty - reduce
|
|
referenceDosageQty=referenceDosageQty - reduce
|
|
- }else{
|
|
|
|
- addArr.unshift(tgoods)
|
|
|
|
- referenceDosageQty=referenceDosageQty-tgoods.capacity
|
|
|
|
- }
|
|
|
|
- /* remainder=referenceDosageQty%tgoods.capacity
|
|
|
|
- console.log('--remainder---'+remainder)
|
|
|
|
- if(remainder>0){
|
|
|
|
- //addArr.unshift(tgoods)
|
|
|
|
- } */
|
|
|
|
- var addDta={
|
|
|
|
- goodsGroupDetail:[],
|
|
|
|
- goodsList:addArr,
|
|
|
|
- del:true
|
|
|
|
- }
|
|
|
|
- addDta.goodsList.forEach(add=>{
|
|
|
|
- add.del=true;
|
|
|
|
- })
|
|
|
|
- //console.log(addArr)
|
|
|
|
- if(tindex==0){
|
|
|
|
- // console.log(addDta.goodsList[0])
|
|
|
|
|
|
+ var addDta={
|
|
|
|
+ goodsGroupDetail:[],
|
|
|
|
+ goodsList:addArr,
|
|
|
|
+ del:true,
|
|
|
|
+ }
|
|
|
|
+ addDta.goodsList.forEach(add=>{
|
|
|
|
+ add.del=true;
|
|
|
|
+ })
|
|
|
|
+
|
|
list.listGoodsAll.splice(index, 1,addDta)
|
|
list.listGoodsAll.splice(index, 1,addDta)
|
|
- //console.log(list.listGoodsAll[index])
|
|
|
|
}else{
|
|
}else{
|
|
- addNum++
|
|
|
|
- console.log('addNum=='+addNum)
|
|
|
|
- //console.log(addDta.goodsList[0])
|
|
|
|
- list.listGoodsAll.splice(addNum, 0,addDta)
|
|
|
|
- }
|
|
|
|
|
|
+ if(goods.goodsGroupDetail.length==1){
|
|
|
|
+ addArr.unshift(tgoods)
|
|
|
|
+ referenceDosageQty=referenceDosageQty-tgoods.capacity
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
}else{
|
|
}else{
|
|
|
|
+
|
|
if(referenceDosageQty>0){
|
|
if(referenceDosageQty>0){
|
|
console.log('referenceDosageQty'+referenceDosageQty)
|
|
console.log('referenceDosageQty'+referenceDosageQty)
|
|
console.log(tgoods)
|
|
console.log(tgoods)
|
|
@@ -548,30 +541,53 @@ export default {
|
|
addArr.unshift(tgoods)
|
|
addArr.unshift(tgoods)
|
|
var reduce= tgoods.capacity*parseIntNum
|
|
var reduce= tgoods.capacity*parseIntNum
|
|
referenceDosageQty=referenceDosageQty - reduce
|
|
referenceDosageQty=referenceDosageQty - reduce
|
|
|
|
+ var addDta={
|
|
|
|
+ goodsGroupDetail:[],
|
|
|
|
+ goodsList:addArr,
|
|
|
|
+ del:true
|
|
|
|
+ }
|
|
|
|
+ addDta.goodsList.forEach(add=>{
|
|
|
|
+ add.del=true;
|
|
|
|
+ })
|
|
|
|
+ //console.log(addArr)
|
|
|
|
+ if(tindex==0){
|
|
|
|
+ // console.log(addDta.goodsList[0])
|
|
|
|
+ //list.listGoodsAll.splice(index, 1,addDta)
|
|
|
|
+ //console.log(list.listGoodsAll[index])
|
|
|
|
+ }else{
|
|
|
|
+ addNum++
|
|
|
|
+ console.log('addNum=='+addNum)
|
|
|
|
+ //console.log(addDta.goodsList[0])
|
|
|
|
+ list.listGoodsAll.splice(addNum, 0,addDta)
|
|
|
|
+ }
|
|
}else{
|
|
}else{
|
|
- addArr.unshift(tgoods)
|
|
|
|
- referenceDosageQty=referenceDosageQty-tgoods.capacity
|
|
|
|
|
|
+ if(goods.goodsGroupDetail.length==tindex+1){
|
|
|
|
+ addArr.unshift(tgoods)
|
|
|
|
+ referenceDosageQty=referenceDosageQty-tgoods.capacity
|
|
|
|
+ var addDta={
|
|
|
|
+ goodsGroupDetail:[],
|
|
|
|
+ goodsList:addArr,
|
|
|
|
+ del:true
|
|
|
|
+ }
|
|
|
|
+ addDta.goodsList.forEach(add=>{
|
|
|
|
+ add.del=true;
|
|
|
|
+ })
|
|
|
|
+ //console.log(addArr)
|
|
|
|
+ if(tindex==0){
|
|
|
|
+ // console.log(addDta.goodsList[0])
|
|
|
|
+ //list.listGoodsAll.splice(index, 1,addDta)
|
|
|
|
+ //console.log(list.listGoodsAll[index])
|
|
|
|
+ }else{
|
|
|
|
+ addNum++
|
|
|
|
+ console.log('addNum=='+addNum)
|
|
|
|
+ //console.log(addDta.goodsList[0])
|
|
|
|
+ list.listGoodsAll.splice(addNum, 0,addDta)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
- var addDta={
|
|
|
|
- goodsGroupDetail:[],
|
|
|
|
- goodsList:addArr,
|
|
|
|
- del:true
|
|
|
|
- }
|
|
|
|
- addDta.goodsList.forEach(add=>{
|
|
|
|
- add.del=true;
|
|
|
|
- })
|
|
|
|
- //console.log(addArr)
|
|
|
|
- if(tindex==0){
|
|
|
|
- // console.log(addDta.goodsList[0])
|
|
|
|
- list.listGoodsAll.splice(index, 1,addDta)
|
|
|
|
- //console.log(list.listGoodsAll[index])
|
|
|
|
- }else{
|
|
|
|
- addNum++
|
|
|
|
- console.log('addNum=='+addNum)
|
|
|
|
- //console.log(addDta.goodsList[0])
|
|
|
|
- list.listGoodsAll.splice(addNum, 0,addDta)
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|