twt 6 kuukautta sitten
vanhempi
commit
55c8de95a9
1 muutettua tiedostoa jossa 27 lisäystä ja 35 poistoa
  1. 27 35
      pages/index/engineOil.vue

+ 27 - 35
pages/index/engineOil.vue

@@ -29,8 +29,9 @@
 			</view>
 			<view class="jiyouBox" v-if="loading">
 				<view class="modelRemarkBox">
-					<view class="modelRemarkLine" @click="modelRemarkTab(1)" :class="{activeMr:modelRemarkNum==1}">0-10万公里</view>
-					<view class="modelRemarkLine" @click="modelRemarkTab(2)" :class="{activeMr:modelRemarkNum==2}">10万公里以上</view>
+					<view class="modelRemarkLine" v-for="(item,index) in brandArr"
+					 @click="modelRemarkTab(item.id)" :class="{activeMr:modelRemarkNum==item.id}">{{item.name}}</view>
+				
 				</view>
 				<view class="jiyouTop">
 					<view class="jiyoutopTitle">机油推荐</view>
@@ -93,8 +94,16 @@
 			   iStatusBarHeight:'',
 			   loading:false,
 			   spec:'',
-			   modelRemarkNum:1,
+			   modelRemarkNum:"283915b2-ae34-4238-90aa-7be4be9815c8",
 			   oldMaintainPartList:'',
+			   brandArr:[
+				   {name:'漠驼',id:'283915b2-ae34-4238-90aa-7be4be9815c8'},
+				   {name:'蓝油',id:'00d3cdf2-4ab4-4d7e-8e48-9e77624cc945'},
+				   {name:'领航1号',id:'e03f63ba-7045-4485-8adb-ee1c2d07de07'},
+				   {name:'领航',id:'0ef3e44c-59c7-4911-bc68-8723a1d05c31'},
+				   {name:'氢洁',id:'b617d3aa-0513-4fbc-b0e9-e4f65b0495fd'},
+				 
+			   ]
 			}
 		},
 		onLoad(opt) {
@@ -105,42 +114,25 @@
 			  this.queryOilInfoByGroupID()
 		},
 		methods: {
-			 modelRemarkTab(num){
-				 this.modelRemarkNum=num
-				 if(num == 1){
-					 var name='0-10万公里'
+			 modelRemarkTab(id){
+				 this.modelRemarkNum=id
+				 this.queryMaintainPartList()
+					/* 
 					 var arr=[]
 					 this.oldMaintainPartList.forEach(item=>{
 						 var state=false
-						 item.ruleList.forEach(v=>{
-							 if(v.version == name){
-								 state=true
-							 }
-						 })
+						 if(item.brandId == id){
+							 state=true
+						 }
+						 
 						 if(state){
 						 	 arr.push(item)
 						 }
 					 })
 					
-					 this.MaintainPartList=arr
+					 this.MaintainPartList=arr */
 					  //this.MaintainPartList= this.oldMaintainPartList.filter(item => item.modelRemark.includes(name))
-				 }else{
-					 var name='10万公里以上'
-					 var arr=[]
-					this.oldMaintainPartList.forEach(item=>{
-						 var state=false
-						 item.ruleList.forEach(v=>{
-							 if(v.version == name){
-								 state=true
-							 }
-						 })
-						 if(state){
-							 arr.push(item)
-						 }
-					})
-					 this.MaintainPartList=arr 
-					 //this.MaintainPartList= this.oldMaintainPartList.filter(item => item.modelRemark.includes(name))
-				 }
+				 
 			 },
              queryMaintainPartList(){
 				 this.loading=false;
@@ -148,13 +140,13 @@
 				 this.$http('partsByOpen/queryMaintainPartList', {
 				   groupId:this.optdata.id,
 				   componentCode:'015001',
-				   
+				   brandId:this.modelRemarkNum
 				  },'POST').then(res => {
 					  this.loading=true;
 				 	  uni.hideLoading();
-				 	  //this.MaintainPartList=res.data
-					  this.oldMaintainPartList=res.data
-					  this.modelRemarkTab(1)
+				 	  this.MaintainPartList=res.data
+					  //this.oldMaintainPartList=res.data
+					  //this.modelRemarkTab("283915b2-ae34-4238-90aa-7be4be9815c8")
 				 })
 			 },
 			 queryOilInfoByGroupID(){
@@ -345,7 +337,7 @@ color: #FFFFFF;font-size: 28rpx;padding-left: 16rpx;
 		background: #eee;
 		padding: 6rpx 20rpx;
 		border-radius: 6rpx;
-		margin-right: 30rpx;
+		margin-right: 20rpx;
 		font-size: 26rpx;
 	}
 	.activeMr{