|
@@ -60,7 +60,8 @@
|
|
|
<view class="goodsContTop">
|
|
|
<view class="goodsItemName">{{v.showName}}</view>
|
|
|
<view class="replaceBox" @click.stop="replace(vf,index,findex,i)">
|
|
|
- <view class="replace" v-if="vf.goodsList.length>1&&!v.gh">更换</view>
|
|
|
+ <!-- <view class="replace" v-if="vf.goodsList.length>1&&!v.gh">更换</view> -->
|
|
|
+ <view class="replace" v-if="vf.goodsList.length>1">更换</view>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
@@ -225,6 +226,7 @@ export default {
|
|
|
//this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2]=replaceData
|
|
|
//this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].goodsName='666'
|
|
|
//console.log(this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2])
|
|
|
+
|
|
|
this.$forceUpdate()
|
|
|
this.newData()
|
|
|
}
|
|
@@ -483,8 +485,8 @@ export default {
|
|
|
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(referenceDosageQty/goods.goodsList[0].capacity>1||referenceDosageQty/goods.goodsList[0].capacity==1){
|
|
|
+ console.log(list.name+"??==="+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)
|
|
|
|
|
@@ -633,12 +635,14 @@ export default {
|
|
|
}
|
|
|
tgoods.qty=parseIntNum
|
|
|
addArr.unshift(tgoods)
|
|
|
+ //addArr[0].gh=true
|
|
|
referenceDosageQty=referenceDosageQty - reduce
|
|
|
var addDta={
|
|
|
//goodsGroupDetail:[],
|
|
|
goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
+
|
|
|
//tpn:true,
|
|
|
}
|
|
|
addDta.goodsList.forEach(add=>{
|
|
@@ -658,13 +662,15 @@ export default {
|
|
|
}else{
|
|
|
if(goods.goodsGroupDetail.length==tindex+1){
|
|
|
addArr.unshift(tgoods)
|
|
|
+ //addArr[0].gh=true
|
|
|
referenceDosageQty=referenceDosageQty-tgoods.capacity
|
|
|
var addDta={
|
|
|
//goodsGroupDetail:[],
|
|
|
goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
- tpn:true,
|
|
|
+ //tpn:true,
|
|
|
+ //gh:true,
|
|
|
}
|
|
|
addDta.goodsList.forEach(add=>{
|
|
|
add.del=true;
|
|
@@ -738,21 +744,32 @@ export default {
|
|
|
var arr=[]
|
|
|
this.$http('miniApp/tPackageMiniAppController/queryTGoodsGroupDetailForApp', params,'GET').then(res => {
|
|
|
uni.hideLoading();
|
|
|
- res.data.forEach(item=>{
|
|
|
- if(item.brandName==replaceData.brandName){
|
|
|
- arr.push(item)
|
|
|
- }
|
|
|
- })
|
|
|
- arr.forEach((item,index)=>{
|
|
|
- if(item.goodsID==replaceData.goodsID){
|
|
|
- arr.splice(index, 1)
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- arr.unshift(replaceData)
|
|
|
+ if(res.data.length>0){
|
|
|
+ res.data.forEach(item=>{
|
|
|
+ if(item.brandName==replaceData.brandName){
|
|
|
+ arr.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ arr.forEach((item,index)=>{
|
|
|
+ if(item.goodsID==replaceData.goodsID){
|
|
|
+ arr.splice(index, 1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ arr.unshift(replaceData)
|
|
|
+ }
|
|
|
+
|
|
|
console.log("处理的同品组")
|
|
|
console.log(arr)
|
|
|
- //debugger;
|
|
|
+ // debugger;
|
|
|
+ var packageGoodsGroupID=this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].goodsList[0].packageGoodsGroupID
|
|
|
+ this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll.forEach(item=>{
|
|
|
+ if(packageGoodsGroupID==item.goodsList[0].packageGoodsGroupID){
|
|
|
+ item.tpn=true
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].tpn=false;
|
|
|
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)
|
|
@@ -815,19 +832,24 @@ export default {
|
|
|
|
|
|
if(goods.goodsGroupDetail.length==0){
|
|
|
//同组品为空的情况
|
|
|
+ console.log("同组品为空的情况")
|
|
|
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(referenceDosageQty/goods.goodsList[0].capacity>1||referenceDosageQty/goods.goodsList[0].capacity==1){
|
|
|
+ if(Number.isInteger(referenceDosageQty/goods.goodsList[0].capacity)){
|
|
|
+ goods.goodsList[0].qty=referenceDosageQty/goods.goodsList[0].capacity
|
|
|
+ }else
|
|
|
+ if(referenceDosageQty-goods&&!goods.goodsList[0].del){
|
|
|
+ console.log(referenceDosageQty)
|
|
|
+ console.log(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)
|
|
|
-
|
|
|
+ console.log("qtynum2=="+qtynum2)
|
|
|
goods.goodsList.splice(300);
|
|
|
var addArrnt=JSON.parse(JSON.stringify(goods.goodsList))
|
|
|
//console.log(addArrnt[0])
|
|
|
addArrnt[0].qty=qtynum2;
|
|
|
- addArrnt[0].gh=true
|
|
|
+ //addArrnt[0].gh=true
|
|
|
var addDta={
|
|
|
goodsGroupDetail:[],
|
|
|
goodsList:addArrnt
|
|
@@ -977,7 +999,7 @@ export default {
|
|
|
goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
- tpn:true,
|
|
|
+ //tpn:true,
|
|
|
}
|
|
|
addDta.goodsList.forEach(add=>{
|
|
|
add.del=true;
|
|
@@ -1002,7 +1024,7 @@ export default {
|
|
|
goodsGroupDetail:goods.goodsGroupDetail,
|
|
|
goodsList:addArr,
|
|
|
del:true,
|
|
|
- tpn:true,
|
|
|
+ //tpn:true,
|
|
|
}
|
|
|
addDta.goodsList.forEach(add=>{
|
|
|
add.del=true;
|