<template>
	<view class="content">
	  <view class="box">
		  <view class="historyLine" >
		  	<image :src="optdata.logo" mode="" class="historylinecarImg"></image>
		  	<view class="historylinecar">{{optdata.value}}</view>
		  </view>
	  </view>
	  
	  <view class="title">机油推荐</view>
	  
	  <view class="lineBox flex">
	  	<view class="line" @click="goEngineOil">
			<view class="lineTitle">机油</view>
			<view class="lineEnglish">Engine Oil</view>
			<view class="lineImgbox">
				<image src="../../static/img/icon_jiyou.png" mode="" class="lineImg1"></image>
			</view>
		</view>
		<view class="line" @click="goGearboxOil">
			<view class="lineTitle">变速箱油</view>
			<view class="lineEnglish">Gearbox Oil</view>
			<view class="lineImgbox">
				<image src="../../static/img/icon_biansuxiang.png" mode="" class="lineImg2"></image>
			</view>
		</view>
	  </view>
	  
	</view>
</template>

<script>
	export default {
		components: {
			
		},
		data() {
			return {
				optdata:'',
				isVin:'',
				vin:'',
				scarid:'',
			}
		},
		onLoad(opt) {
		   console.log(opt);
           this.optdata=opt;
		   if(opt.scarid){
			   this.scarid=opt.scarid;
			   this.queryCarModelGroupInfo()
		   }else{
			   if(opt.isVin==1){
				   this.isVin=1;
				   this.vin=opt.vin
			   }
			   		 
			   this.saveQueryHistory()
		   }
		   
		},
		methods: {
		   queryCarModelGroupInfo(){
			   uni.showLoading({ title: '加载中'});
			   this.$http('matchingByOpen/queryCarModelGroupInfo', {
			     id:this.scarid,
			    
			    },'POST').then(res => {
					uni.hideLoading();
			   		var data={
						value:res.data.value,
						id:res.data.id,
						nLevelID:res.data.carModelInfo.nLevelID,
						logo:res.data.carModelInfo.logo,
					}
					 this.optdata=data;
			   		this.saveQueryHistory()
			   })
		   },
		   saveQueryHistory(){
			   this.$http2('saveQueryHistory', {
			     nLevelID:this.optdata.nLevelID,
				 logo:this.optdata.logo,
				 title:this.optdata.value,
				 groupId:this.optdata.id,
				 isVin:this.isVin,
				 vin:this.vin
			    },'POST').then(res => {
			   				
			   		
			   })
		   },
           goEngineOil(){
			   uni.navigateTo({
			   	url:'/pages/index/engineOil?nLevelID='+this.optdata.nLevelID+'&logo='+this.optdata.logo+'&value='+this.optdata.value+'&id='+this.optdata.id
			   })
		   },
		   goGearboxOil(){
			   uni.navigateTo({
			   	url:'/pages/index/gearboxOil?nLevelID='+this.optdata.nLevelID+'&logo='+this.optdata.logo+'&value='+this.optdata.value+'&id='+this.optdata.id
			   })
		   }
		}
	}
</script>

<style scoped>
.content{
	min-height: 100vh;
	background: #F4F5F7;
}
.box{
	padding: 0 24rpx;
	background: #ffffff;
}
.historylinecarImg{
	width: 46rpx;
	height: 46rpx;
}
.historylinecar{
	font-weight: 400;font-size: 26rpx;
	color: #1A1A1A;
	line-height: 37rpx;width: 636rpx;
}
.historyLine{
	display: flex;justify-content: space-between;
	padding: 30rpx 0;border-top: 1rpx solid #EEEEEE;
}
.title{
	font-weight: 500;font-size: 28rpx;
	color: #1A1A1A;padding: 30rpx 24rpx;
	line-height: 40rpx;
}
.lineBox{
padding: 0 24rpx;	
}
.line{
	width: 332rpx;
	height: 206rpx;
	background: #FFFFFF;
	border-radius: 16rpx;
}
.lineTitle{
	font-weight: 500;font-size: 28rpx;padding-top: 32rpx;
	color: #1A1A1A;padding-left: 30rpx;
	line-height: 40rpx;
}
.lineEnglish{
	font-weight: 400;font-size: 24rpx;
	color: #999999;padding-left: 30rpx;
	line-height: 34rpx;padding-top: 10rpx;
}
.lineImg1{
	width: 82rpx;height: 92rpx;
}
.lineImgbox{
	text-align: right;
}
.lineImg2{
	width: 106rpx;height: 82rpx;    margin-top: 10rpx;
}
</style>
