twt %!s(int64=3) %!d(string=hai) anos
pai
achega
001ac1218d
Modificáronse 2 ficheiros con 22 adicións e 8 borrados
  1. 21 7
      pages/module/maintain.vue
  2. 1 1
      pages/module/replaceGoods.vue

+ 21 - 7
pages/module/maintain.vue

@@ -210,10 +210,11 @@ export default {
 		if(replaceData){
 			replaceData.qty=1;
 			console.log(replaceData)
-			this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].unshift(replaceData)
-			console.log(this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2])
+			//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])
 			
-			this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2]=this.unique(this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2])
+			this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].goodsList=this.unique(this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].goodsList)
 			
 			//this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2]=replaceData
 			//this.mealData[this.leftIndex].listPackage[this.replaceIndex1].listGoodsAll[this.replaceIndex2].goodsName='666'
@@ -467,10 +468,16 @@ export default {
 											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){
-													console.log("添加一条")
+													var qtynum1=Number(list.referenceDosageQty)-goods.goodsList[0].capacity
+													var qtynum2=Math.ceil(qtynum1/goods.goodsList[0].capacity)
+                                                    
+													goods.goodsList.splice(300);
+													var addArrnt=JSON.parse(JSON.stringify(goods.goodsList))
+													//console.log(addArrnt[0])
+													addArrnt[0].qty=qtynum2
 													var addDta={
 														goodsGroupDetail:[],
-														goodsList:goods.goodsList
+														goodsList:addArrnt
 													}
 													
 													addDta.goodsList.forEach(add=>{
@@ -537,9 +544,16 @@ export default {
 														referenceDosageQty=referenceDosageQty-tgoods.capacity */
 													    if(referenceDosageQty>tgoods.capacity){
 															var parseIntNum=parseInt(referenceDosageQty/tgoods.capacity)
+															
+															var reduce= tgoods.capacity*parseIntNum
+															if(goods.goodsGroupDetail.length==tindex+1){
+																var a=referenceDosageQty - reduce
+																if(a>0){
+																	parseIntNum++
+																}
+															}
 															tgoods.qty=parseIntNum
 															addArr.unshift(tgoods)
-															var reduce= tgoods.capacity*parseIntNum
 															referenceDosageQty=referenceDosageQty - reduce
 															var addDta={
 																goodsGroupDetail:[],
@@ -641,7 +655,7 @@ export default {
 			//v.splice(replaceIndex, 1)
 			console.log(v)
 			console.log(replaceIndex)
-			v.forEach((item,vindex)=>{
+			v.goodsList.forEach((item,vindex)=>{
 				if(replaceIndex==vindex){
 					item.showr=false
 				}else{

+ 1 - 1
pages/module/replaceGoods.vue

@@ -2,7 +2,7 @@
 	<view>
 		<view class="main">
 			<view class="mainLine">
-				<view class="goodsItem" v-for="(v,i) in list" v-if='v.showr' @click="goGoods(v)">
+				<view class="goodsItem" v-for="(v,i) in list.goodsList" v-if='v.showr' @click="goGoods(v)">
 					<view>
 						<image :src="v.picUrl" mode="" class="goodsImg" v-if="v.picUrl"></image>
 						<image src="../../static/img/noimg.png" mode="" class="goodsImg" v-else></image>