<template>
	<view style="background-color: #f2f2f2;">
		<!-- 公共组件-每个页面必须引入 -->
		<public-module></public-module>
		<view class="box">

			<view class="row d-flex flex-column" v-for="(item,index) in typeList" :key="index"
				@tap="chooseVehicleType(index)">
				<!-- 永安 -->
				<view class="row_header d-flex a-center  j-sb">
					<view class="left">{{item.modelName }}</view>
					<view class="right">￥{{item.replacementValue}}</view>
				</view>
				<view class="row_body">
					<view>
						<view>车系：{{item.series}}</view>
						<view>{{item.remark}}</view>
						<view>厂牌型号代码：<text style="color:#ea552d;">{{item.modelCode}}</text> </view>
						<view>年款：<text style="color: #2432ff;">{{item.marketYear}}</text></view>
						<view>排量：<text style="color: #2432ff;">{{item.displacement}}</text></view>
						<view>座位数：<text style="color: #2432ff;">{{item.ratedPassengerCapacity}}</text></view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		mapState,
		mapMutations
	} from "vuex"
	export default {
		data() {
			return {
				frameNo: "", //车架号
				enrollDate: "", //
				typeList: [],
			}
		},
		async onLoad(options) {
			if (options.frameNo) {
				this.frameNo = decodeURIComponent(options.frameNo);
				let res = await this.$http.get('/order/carModel/vinSearch?frameNo=' + this.frameNo);
				this.typeList = res.data;
			}
		},
		computed: {
			getHeight() {
				let height = uni.getSystemInfoSync().windowHeight;
				return `height: ${height}px;`;
			}
		},
		methods: {
			async queryList(pageNo, pageSize) {

				// if (!!this.brandName) {
				// 	/* 永安 */
				// 	let param = {
				// 		// "rows": pageSize,
				// 		// "pageNo": pageNo,
				// 		"modelName": this.brandName,
				// 		// "enrollDate": this.enrollDate,
				// 		// "frameNo": this.frameNo,
				// 	}
				// 	let res = await this.$http.post('/insZhongmei/modelQuery', param);
				// 	let resList = [];
				// 	if (!!res.data) {
				// 		resList = res.data;
				// 	}
				// 	this.$refs.paging.complete(res.data);
				// 	this.firstLoaded = true;
				// } else if (!!this.frameNo) {
				// 	let res = await this.$http.get('/insZhongmei/vinSearch?frameNo=' + this.frameNo);
				// 	let resList = [];
				// 	if (!!res.data) {
				// 		resList = res.data;
				// 	}
				// 	this.$refs.paging.complete(res.data);
				// 	this.firstLoaded = true;
				// }

			},
			chooseVehicleType(index) {
				let pages = getCurrentPages(); //获取所有页面栈实例列表
				let nowPage = pages[pages.length - 1]; //当前页页面实例
				let prevPage = pages[pages.length - 2]; //上一页页面实例
				prevPage.$vm.carInfo.brandName = this.typeList[index].modelName; //车型
				prevPage.$vm.carInfo.modelcname = this.typeList[index].modelName; //车型
				prevPage.$vm.carInfo.caryear = this.typeList[index].marketYear; //年款
				prevPage.$vm.carInfo.seatCount = this.typeList[index].ratedPassengerCapacity; //座位数
				prevPage.$vm.carInfo.purchasePrice = this.typeList[index].replacementValue; //价格
				prevPage.$vm.carInfo.modelCode = this.typeList[index].modelCode; //车辆型号编码
				prevPage.$vm.carInfo.familyName = this.typeList[index].series; //系列
				prevPage.$vm.carInfo.enginedesc = this.typeList[index].displacement; //排量
				prevPage.$vm.carInfo.powertype = this.typeList[index].fuelType; //燃油种类
				prevPage.$vm.carInfo.powerScale = this.typeList[index].powerScale; //功率
				uni.navigateBack({ //uni.navigateTo跳转的返回，默认1为返回上一级
					delta: 1
				});
			}
		}
	}
</script>
<style>
	page {
		background-color: #f2f2f2;
	}

	.box {
		padding-top: 10px;
	}

	.display {
		display: flex;
	}

	.row {
		width: 100%;
		box-sizing: border-box;
		margin-bottom: 20upx;
		border-radius: 5upx;
		padding: 10upx;
		background-color: #FFFFFF;
		padding: 10px;
	}

	.row .row_header {
		font-size: 28upx;
		border-bottom: 1upx solid #EEEEEE;
		height: 50upx;
	}

	.row .row_header .left {
		flex: 5;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		color: #333;
	}

	.row .row_header .right {
		flex: 2;
		color: #ea552d;
		text-align: right;
	}

	.row_body {
		padding: 10px;
	}

	.row .row_body view {
		color: #333;
		font-size: 24upx;
		text-align: center;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
	}

	.row .row_body view>view {
		margin: 0 5px;
	}

	/* 底部的样式Start */
	.bottom {
		height: 120upx;
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		background: #FFFFFF;
		border-top: 1upx solid #EEEEEE;
		z-index: 99;
	}

	.bottom>button {
		font-size: 30upx;
		background: #337ab7;
		color: #FFFFFF;
		flex: 1;
		margin: 0upx 30upx;
	}

	/* 底部的样式End */
</style>