<template>
	<view class="unleased-pages-main">
		<navBar type="index"/>
		<view class="recommend-car-name w_100 text-center">{{moder_info.model_name}}</view>
		<view class="recommend-car-tip w_100 text-center">{{moder_info.title||'续航开新路 路遥见实力'}}</view>
		<view >
			<view style="margin: 0 50rpx 0rpx;height: 420rpx;">
				<u-swiper
					v-if="img_list.length!=0"
					 :list="img_list"
					 @change="tapSwiper"
					 :autoplay="false"
					 mode="none"
					 :height="420"
					 bgColor="transparent"
					 class="custom-swiper"
				   >
				</u-swiper>
			</view>
			
			<view class="car-model-step">
				<view class="flex-row flex-around" style="padding-top: 80rpx;margin-bottom: 60rpx;">
					<!-- <view class="car-speed-view">
						<view class="car-speed">72 <text class="company">km</text></view>
						<text>全速续航</text>
					</view>
					<view class="car-speed-view">
						<view class="car-speed">52 <text class="company">km/h</text></view>
						<text>极速可达</text>
					</view> -->
				</view>
				<view class="flex-row" @tap="navCarDetail"  style="justify-content: center;" >
					<view class="more-btn flex-row">
						<view class="more-btn-text">了解更多</view>
						<img class="more-btn-img" src="https://qiniu.bms16.com/Fi2Lg800Mc1MhCnvHT1DkvOEdJB1" alt="">
					</view>	
				</view>
				<view class="flex-row dot-view" >
					<view v-for="(item,index) in img_list" :key="index"  :class="['dot', { active: index === current }]"></view>
				</view>
				<view class="flex-row flex-around" >
					<view @tap="navCarDetail" class="lease-btn">租赁设备</view>
					<view class="binding-btn">绑定设备</view>
				</view>
			</view>
		</view>
		
	</view>
</template>
<script module="tools" lang="wxs" src="@/pages/common/wxs/tools.wxs"></script>
<script module="tools" lang="sjs" src="@/pages/common/wxs/tools.sjs"></script>
<script>
	const config = require('@/common/config.js');
	const common = require('@/common/common.js');
	const http = require('@/common/http.js');
	const storage = require('@/common/storage.js');
	export default {
		props: {
			model_list: {
				type: Array,
				default: []
			},
			img_list: {
				type: Array,
				default: []
			},
		},
		data() {
			return {
				current: 0,
				model_id:'',//租赁设备编号
				moder_info:{},
				statusBarHeight:0
			};
		}
		/**
		 * 生命周期函数--监听页面加载
		 */
		,
		  watch: {
		    model_list(newVal) {
		      console.log("子组件 props 更新:", newVal);
			  if(newVal[0]){
				  this.moder_info=newVal[0]
				  this.model_id=newVal[0].model_id
			  }
		    }
		  },
		methods: {
			tapSwiper(e){
				this.setData({
					current:e,
					moder_info:this.model_list[e],
					model_id:this.model_list[e].model_id
				})
			},
			navCarDetail(){
				const me=this
				uni.navigateTo({
					url: '/pages/carDetail/carDetail?model_id=' + me.model_id
				})
			}
		}
	};
</script>
<style>
	@import './unleasedPages.css';
</style>