|
@@ -25,6 +25,7 @@
|
|
|
<span>{{item.name}}</span>
|
|
|
<view class="lineNum" v-show="item.num!=0">{{item.num}}</view>
|
|
|
</view>
|
|
|
+ <view style="height: 100rpx;"></view>
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
<view class="mainRight">
|
|
@@ -92,7 +93,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view style="height: 100rpx;"></view>
|
|
|
+ <view style="height: 120rpx;"></view>
|
|
|
|
|
|
</scroll-view>
|
|
|
</view>
|
|
@@ -183,6 +184,7 @@ export default {
|
|
|
replaceIndex2:'',
|
|
|
brand:'',
|
|
|
isNull:true,
|
|
|
+ csdata:'',
|
|
|
}
|
|
|
},
|
|
|
onLoad(opt) {
|
|
@@ -212,6 +214,8 @@ export default {
|
|
|
if(replaceData){
|
|
|
//replaceData.qty=1;
|
|
|
console.log(replaceData)
|
|
|
+
|
|
|
+ //this.mealData=JSON.parse(JSON.stringify(this.csdata))
|
|
|
//console.log(this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll.goodsList[this.replaceIndex2])
|
|
|
this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].goodsList.unshift(replaceData)
|
|
|
//console.log(this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll.goodsList[this.replaceIndex2])
|
|
@@ -446,6 +450,7 @@ export default {
|
|
|
guidePrice:this.maintainCarData.guidePrice?this.maintainCarData.guidePrice:0,
|
|
|
},'GET').then(res => {
|
|
|
console.log(res)
|
|
|
+ // this.csdata=JSON.parse(JSON.stringify(res.data))
|
|
|
uni.hideLoading();
|
|
|
if(res.code==1){
|
|
|
uni.showModal({
|
|
@@ -475,10 +480,12 @@ export default {
|
|
|
|
|
|
if(goods.goodsGroupDetail.length==0){
|
|
|
//同组品为空的情况
|
|
|
+ var referenceDosageQty=Number(list.referenceDosageQty)
|
|
|
+ referenceDosageQty=Math.ceil(referenceDosageQty)
|
|
|
if(goods.goodsList[0].capacity&&!goods.goodsList[0].del){
|
|
|
//console.log(Number(list.referenceDosageQty)/goods[0].capacity)
|
|
|
- if(Number(list.referenceDosageQty)/goods.goodsList[0].capacity>1){
|
|
|
- var qtynum1=Number(list.referenceDosageQty)-goods.goodsList[0].capacity
|
|
|
+ if(referenceDosageQty/goods.goodsList[0].capacity>1){
|
|
|
+ var qtynum1=referenceDosageQty-goods.goodsList[0].capacity
|
|
|
var qtynum2=Math.ceil(qtynum1/goods.goodsList[0].capacity)
|
|
|
|
|
|
goods.goodsList.splice(300);
|
|
@@ -504,11 +511,13 @@ export default {
|
|
|
}else{
|
|
|
//同组品不为空的情况
|
|
|
//console.log("同组品不为空的情况 ")
|
|
|
+ //debugger;
|
|
|
var remainder=0;
|
|
|
var addNum=index
|
|
|
console.log("list.referenceDosageQty - "+list.referenceDosageQty+list.name)
|
|
|
var referenceDosageQty=Number(list.referenceDosageQty)
|
|
|
//var addArr= goods.goodsList
|
|
|
+ referenceDosageQty=Math.ceil(referenceDosageQty)
|
|
|
goods.goodsList.splice(300);
|
|
|
|
|
|
if(list.referenceDosageQty&&!goods.goodsList[0].del){
|
|
@@ -519,7 +528,7 @@ export default {
|
|
|
if(tindex==0){
|
|
|
console.log(tgoods.brandName)
|
|
|
if(tgoods.capacity){
|
|
|
- if(referenceDosageQty>tgoods.capacity){
|
|
|
+ if(referenceDosageQty>tgoods.capacity||referenceDosageQty==tgoods.capacity){
|
|
|
if(goods.goodsGroupDetail.length==1){
|
|
|
//console.log("referenceDosageQty>tgoods.capacity")
|
|
|
var parseIntNum=parseInt(referenceDosageQty/tgoods.capacity)
|
|
@@ -529,7 +538,8 @@ export default {
|
|
|
var reduce= tgoods.capacity*parseIntNum
|
|
|
referenceDosageQty=referenceDosageQty - reduce
|
|
|
var addDta={
|
|
|
- goodsGroupDetail:[],
|
|
|
+ //goodsGroupDetail:[],
|
|
|
+ goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
}
|
|
@@ -547,7 +557,8 @@ export default {
|
|
|
var reduce= tgoods.capacity*parseIntNum
|
|
|
referenceDosageQty=referenceDosageQty - reduce
|
|
|
var addDta={
|
|
|
- goodsGroupDetail:[],
|
|
|
+ //goodsGroupDetail:[],
|
|
|
+ goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
}
|
|
@@ -565,7 +576,8 @@ export default {
|
|
|
addArr.unshift(tgoods)
|
|
|
referenceDosageQty=referenceDosageQty-tgoods.capacity
|
|
|
var addDta={
|
|
|
- goodsGroupDetail:[],
|
|
|
+ //goodsGroupDetail:[],
|
|
|
+ goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
}
|
|
@@ -582,7 +594,8 @@ export default {
|
|
|
}else{
|
|
|
addArr.unshift(tgoods)
|
|
|
var addDta={
|
|
|
- goodsGroupDetail:[],
|
|
|
+ //goodsGroupDetail:[],
|
|
|
+ goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
}
|
|
@@ -622,10 +635,11 @@ export default {
|
|
|
addArr.unshift(tgoods)
|
|
|
referenceDosageQty=referenceDosageQty - reduce
|
|
|
var addDta={
|
|
|
- goodsGroupDetail:[],
|
|
|
+ //goodsGroupDetail:[],
|
|
|
+ goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
- tpn:true,
|
|
|
+ //tpn:true,
|
|
|
}
|
|
|
addDta.goodsList.forEach(add=>{
|
|
|
add.del=true;
|
|
@@ -646,7 +660,8 @@ export default {
|
|
|
addArr.unshift(tgoods)
|
|
|
referenceDosageQty=referenceDosageQty-tgoods.capacity
|
|
|
var addDta={
|
|
|
- goodsGroupDetail:[],
|
|
|
+ //goodsGroupDetail:[],
|
|
|
+ goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
tpn:true,
|
|
@@ -692,6 +707,7 @@ export default {
|
|
|
this.mealData=res.data;
|
|
|
this.mealData.splice(1,0)
|
|
|
//debugger;
|
|
|
+ console.log("第一次的数据")
|
|
|
console.log(this.mealData)
|
|
|
this.calculation();
|
|
|
})
|
|
@@ -736,7 +752,7 @@ export default {
|
|
|
arr.unshift(replaceData)
|
|
|
console.log("处理的同品组")
|
|
|
console.log(arr)
|
|
|
- //debugger;
|
|
|
+ //debugger;
|
|
|
this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].goodsGroupDetail=arr
|
|
|
this.mealData.splice(1,0)
|
|
|
console.log("this.leftIndex"+this.leftIndex+'--'+this.replaceIndex1+'--'+this.replaceIndex2)
|
|
@@ -750,16 +766,31 @@ export default {
|
|
|
|
|
|
},
|
|
|
chulidata(){
|
|
|
+ //debugger;
|
|
|
this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].goodsList.forEach((item,index)=>{
|
|
|
if(item.gh){
|
|
|
this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].goodsList.splice(index, 1)
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll.forEach((item,index)=>{
|
|
|
if(item.tpn){
|
|
|
this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll.splice(index, 1)
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+ this.mealData.forEach(item=>{
|
|
|
+ item.listPackage.forEach((list,i)=>{
|
|
|
+ list.listGoodsAll.forEach((goods,index)=>{
|
|
|
+ goods.goodsGroupDetail.forEach(tgoods=>{
|
|
|
+ tgoods.del=false;
|
|
|
+
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ console.log("重新初始化数据")
|
|
|
+ console.log(this.mealData)
|
|
|
this.mealData.forEach(item=>{
|
|
|
//console.log(item)
|
|
|
item.listPackage.forEach((list,i)=>{
|
|
@@ -768,20 +799,23 @@ export default {
|
|
|
var brandName=goods.goodsList[0].brandName
|
|
|
var newtp=[];
|
|
|
goods.goodsGroupDetail.forEach(tgoods=>{
|
|
|
+ //tgoods.del=false;
|
|
|
if(brandName==tgoods.brandName){
|
|
|
newtp.push(tgoods)
|
|
|
}
|
|
|
})
|
|
|
goods.goodsGroupDetail=newtp
|
|
|
- /* console.log("同品组")
|
|
|
+ /* console.log("同品组")
|
|
|
console.log(goods.goodsGroupDetail) */
|
|
|
|
|
|
if(goods.goodsGroupDetail.length==0){
|
|
|
//同组品为空的情况
|
|
|
+ var referenceDosageQty=Number(list.referenceDosageQty)
|
|
|
+ referenceDosageQty=Math.ceil(referenceDosageQty)
|
|
|
if(goods.goodsList[0].capacity&&!goods.goodsList[0].del){
|
|
|
//console.log(Number(list.referenceDosageQty)/goods[0].capacity)
|
|
|
- if(Number(list.referenceDosageQty)/goods.goodsList[0].capacity>1){
|
|
|
- var qtynum1=Number(list.referenceDosageQty)-goods.goodsList[0].capacity
|
|
|
+ if(referenceDosageQty/goods.goodsList[0].capacity>1){
|
|
|
+ var qtynum1=referenceDosageQty-goods.goodsList[0].capacity
|
|
|
var qtynum2=Math.ceil(qtynum1/goods.goodsList[0].capacity)
|
|
|
|
|
|
goods.goodsList.splice(300);
|
|
@@ -812,17 +846,18 @@ export default {
|
|
|
console.log("list.referenceDosageQty - "+list.referenceDosageQty+list.name)
|
|
|
var referenceDosageQty=Number(list.referenceDosageQty)
|
|
|
//var addArr= goods.goodsList
|
|
|
+ referenceDosageQty=Math.ceil(referenceDosageQty)
|
|
|
goods.goodsList.splice(300);
|
|
|
|
|
|
if(list.referenceDosageQty&&!goods.goodsList[0].del){
|
|
|
|
|
|
goods.goodsGroupDetail.forEach((tgoods,tindex)=>{
|
|
|
var addArr=JSON.parse(JSON.stringify(goods.goodsList))
|
|
|
-
|
|
|
+ //debugger;
|
|
|
if(tindex==0){
|
|
|
console.log(tgoods.brandName)
|
|
|
if(tgoods.capacity){
|
|
|
- if(referenceDosageQty>tgoods.capacity){
|
|
|
+ if(referenceDosageQty>tgoods.capacity||referenceDosageQty==tgoods.capacity){
|
|
|
if(goods.goodsGroupDetail.length==1){
|
|
|
//console.log("referenceDosageQty>tgoods.capacity")
|
|
|
var parseIntNum=parseInt(referenceDosageQty/tgoods.capacity)
|
|
@@ -832,7 +867,8 @@ export default {
|
|
|
var reduce= tgoods.capacity*parseIntNum
|
|
|
referenceDosageQty=referenceDosageQty - reduce
|
|
|
var addDta={
|
|
|
- goodsGroupDetail:[],
|
|
|
+ //goodsGroupDetail:[],
|
|
|
+ goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
}
|
|
@@ -842,15 +878,20 @@ export default {
|
|
|
|
|
|
list.listGoodsAll.splice(index, 1,addDta)
|
|
|
}else{
|
|
|
+
|
|
|
//console.log("referenceDosageQty>tgoods.capacity")
|
|
|
var parseIntNum=parseInt(referenceDosageQty/tgoods.capacity)
|
|
|
//console.log("parseIntNum--"+parseIntNum)
|
|
|
tgoods.qty=parseIntNum
|
|
|
+ /* if(tgoods.capacity==1){
|
|
|
+ tgoods.qty=tgoods.qty+1
|
|
|
+ } */
|
|
|
addArr.unshift(tgoods)
|
|
|
var reduce= tgoods.capacity*parseIntNum
|
|
|
referenceDosageQty=referenceDosageQty - reduce
|
|
|
var addDta={
|
|
|
- goodsGroupDetail:[],
|
|
|
+ //goodsGroupDetail:[],
|
|
|
+ goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
}
|
|
@@ -868,7 +909,8 @@ export default {
|
|
|
addArr.unshift(tgoods)
|
|
|
referenceDosageQty=referenceDosageQty-tgoods.capacity
|
|
|
var addDta={
|
|
|
- goodsGroupDetail:[],
|
|
|
+ //goodsGroupDetail:[],
|
|
|
+ goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
}
|
|
@@ -885,7 +927,8 @@ export default {
|
|
|
}else{
|
|
|
addArr.unshift(tgoods)
|
|
|
var addDta={
|
|
|
- goodsGroupDetail:[],
|
|
|
+ //goodsGroupDetail:[],
|
|
|
+ goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
}
|
|
@@ -902,7 +945,7 @@ export default {
|
|
|
}else{
|
|
|
if(goods.goodsGroupDetail[0].capacity){
|
|
|
|
|
|
- if(referenceDosageQty>0){
|
|
|
+ if(referenceDosageQty>1){
|
|
|
console.log('referenceDosageQty'+referenceDosageQty)
|
|
|
console.log(tgoods)
|
|
|
/* remainder=Number(referenceDosageQty)%tgoods.capacity
|
|
@@ -925,10 +968,11 @@ export default {
|
|
|
addArr.unshift(tgoods)
|
|
|
referenceDosageQty=referenceDosageQty - reduce
|
|
|
var addDta={
|
|
|
- goodsGroupDetail:[],
|
|
|
+ //goodsGroupDetail:[],
|
|
|
+ goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
- tpn:true,
|
|
|
+ //tpn:true,
|
|
|
}
|
|
|
addDta.goodsList.forEach(add=>{
|
|
|
add.del=true;
|
|
@@ -949,7 +993,8 @@ export default {
|
|
|
addArr.unshift(tgoods)
|
|
|
referenceDosageQty=referenceDosageQty-tgoods.capacity
|
|
|
var addDta={
|
|
|
- goodsGroupDetail:[],
|
|
|
+ //goodsGroupDetail:[],
|
|
|
+ goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
tpn:true,
|