소스 검색

商品替换添加

twt 3 년 전
부모
커밋
5403956c19
1개의 변경된 파일68개의 추가작업 그리고 4개의 파일을 삭제
  1. 68 4
      pages/module/maintain.vue

+ 68 - 4
pages/module/maintain.vue

@@ -39,7 +39,9 @@
 						<view class="contTop">
 							<view class="contTopLeft">
 								<view class="listPackgeName"> {{item.name}} </view>
-								<view class="listPackgeMs">{{item.referenceDosage}}</view>
+								<view class="listPackgeMs">
+								    <span  v-if="item.referenceDosageQty">{{item.referenceDosage}}</span>
+								</view>
 							</view>
 							<view class="contTopRight" @click="listcheck(item)">
 								<image src="../../static/img/login_icon_checked.png" mode="" class="imgPrivacy" v-show="item.planItem"></image>
@@ -127,7 +129,7 @@
 									<image src="../../static/img/noimg.png" mode="" class="goodsImg " v-else></image>
 								</view>
 								<view class="goodsItemRight" >
-									<view class="goodsItemName">{{v.goodsName}}</view>
+									<view class="goodsItemName">{{v.showName}}</view>
 									<view class="goodsItemBottom">
 										<view class="goodssalePrice">¥{{v.salePrice}}</view>
 										<view class="goodsNum">x{{v.qty}}</view>
@@ -398,9 +400,13 @@ export default {
 			console.log(this.orderData)
 		},
 		reduce(v){
+			console.log(v)
 			if(v.qty>1){
 				v.qty--;
 				this.calculation()
+			}else if(v.del){
+				v.qty--;
+				this.calculation()
 			}
 		},
 		plus(v){
@@ -417,7 +423,57 @@ export default {
 			   guidePrice:this.maintainCarData.guidePrice,
 			 },'GET').then(res => {
 				uni.hideLoading();
+				res.data.forEach(item=>{
+					//console.log(item)
+					item.listPackage.forEach((list,i)=>{
+						if(list.listGoodsAll.length>0){
+							//console.log(list)
+							//if(true){
+								//if(list.listGoodsAll[i]!=list.listGoodsAll[i-1]){
+									list.listGoodsAll.forEach((goods,index)=>{
+										//console.log(goods[0])
+										
+										if(goods[0].capacity&&!goods[0].del){
+											//console.log(Number(list.referenceDosageQty)/goods[0].capacity)
+											if(Number(list.referenceDosageQty)/goods[0].capacity>1){
+												console.log("添加一条")
+												var addDta=list.listGoodsAll[index];
+												
+												addDta.forEach(add=>{
+													add.del=true;
+												})
+												//addDta.splice(1,0)
+												//console.log(addDta)
+												var add=JSON.parse(JSON.stringify(addDta))
+												list.listGoodsAll.splice(index+1, 0,add)
+												//list.listGoodsAll.splice(1,0)
+												//list.listGoodsAll.push(list.listGoodsAll[index])
+											}
+										}
+									})
+								//}
+							/* }else{
+								list.listGoodsAll.forEach((goods,index)=>{
+									//console.log(goods[0])
+									
+									if(goods[0].capacity){
+										console.log(Number(list.referenceDosageQty)/goods[0].capacity)
+										if(Number(list.referenceDosageQty)/goods[0].capacity>1){
+											console.log("添加一条")
+											list.listGoodsAll.splice(index+1, 0,list.listGoodsAll[index])
+											//list.listGoodsAll.push(list.listGoodsAll[index])
+										}
+									}
+								})
+							} */
+							
+							
+						}
+					})
+				})
 				this.mealData=res.data;
+				this.mealData.splice(1,0)
+				console.log(this.mealData)
 				this.calculation();
 			})
 		},
@@ -484,16 +540,20 @@ export default {
 <style scoped>
 	
 	.caidanTk{
-		height: calc(100vh - 120rpx);
+		height: calc(100vh );
 		width: 100vw;
 		background: rgba(0,0,0,0.6);
 		position:fixed;
 		left: 0;
 		top: 0;
+	
 	}
 	.tkCont{
 		height: 60vh;
-		margin-top: calc(40vh - 120rpx);
+		margin-top: calc(40vh );
+		padding-bottom: constant(safe-area-inset-bottom);
+		padding-bottom: env(safe-area-inset-bottom);
+		box-sizing: content-box; 
 	}
 	.caidanTkTop{
 		width: 750rpx;
@@ -637,6 +697,9 @@ export default {
 		height: 120rpx;
 		background: #FFFFFF;
 		box-shadow: 0px -2px 20px 0px rgba(153, 153, 153, 0.2);
+		padding-bottom: constant(safe-area-inset-bottom);
+			padding-bottom: env(safe-area-inset-bottom);
+			box-sizing: content-box;
 	}
 	.main{
 		display: flex;
@@ -722,6 +785,7 @@ export default {
 		font-weight: 400;
 		color: #999999;
 		padding-top: 5rpx;
+		line-height: 30rpx;
 	}
 	.contZk{
 		border-bottom: 1px solid #EEEEEE;