<template>
<view>
 <proyearCarinfo :carname="canshu.popname" :carpic="canshu.popimg"></proyearCarinfo>
<proyearChoose1 desc="0.8L" ifarrow=true :cx="canshu.year"></proyearChoose1>
<proyearChoosetitle desc="选择车型"></proyearChoosetitle>
<view v-for="(i,j) in list" :key="j" @click="add(i.kuanxing_id)">
  <proyearChoose1 ifline=true :desc="i.kuanxing"></proyearChoose1>
</view>
<!-- <proyearChoose ifline=true desc="1999年生产"></proyearChoose>
<proyearChoose ifline=true desc="1999年生产"></proyearChoose>
<proyearChoose ifline=true desc="1999年生产"></proyearChoose>
<proyearChoose ifline=true desc="1999年生产"></proyearChoose>
<proyearChoose ifline=true desc="1999年生产"></proyearChoose> -->
</view>

</template>
<script>
import proyearCarinfo from "../../components/proyear/proyear-carinfo";
import proyearChoose1 from "../../components/proyear/proyear-choose1";
import proyearChoosetitle from '../../components/proyear/proyear-choosetitle'
import {requestP} from "../../static/js/request"
export default {
  components: {
    proyearCarinfo,
    proyearChoose1,
    proyearChoosetitle
  },
  data(){
    return {
      list:[],
        carname:[],
      carpic:[],
      canshu:{},
      cx:true
    }
  },
  methods:{
    add(a){
      console.log(a)
      requestP({
        url:"user_car/add_car",
        data:{
          brand_id:this.canshu.pinpaiid,
          chexi_id:this.canshu.chexiid,
          chexing_id:this.canshu.chexingid,
          pailiang_id:this.canshu.pailiangid,
          nianfen_id:this.canshu.year,
          kuanxing_id:a
        }
      }).then((ers)=>{
         uni.showToast({
            title: "添加成功",
            icon: "success",
            duration: 2000
          });
          uni.reLaunch({
            url:"/pages/mygarage/mygarage"
          })
      })
    }
  },
  onLoad(e){
    console.log(e,'uear')
    this.canshu=e
    requestP({
      url:"car/get_kuanxing_list",
      data:{
        brand_id:e.pinpaiid,
        chexi_id:e.chexiid,
        chexing_id:e.chexingid,
        pailiang_id:e.pailiangid,
        nianfen_id:e.yearid
      }
    }).then((res)=>{
      console.log(res)
      this.list = res.data.data
          // uni.showToast({
          //   title: "添加成功",
          //   icon: "success",
          //   duration: 2000
          // });
          // uni.navigateTo({
          //   url:"/pages/mygarage/mygarage"
          // })
    })
  }
};
</script>
<style lang="scss" scoped>
</style>