// 车系
vehicleseries(e){
console.log(e);
this.vehicleseriesindex=e.detail.value;
this.train_system_id=this.carAudidata[e.detail.value].id
// 车系id用于获取车型
this.pid=this.train_system_id
this.vehiclemodelindex=""
this.car_model_id=""
this.vehiclecolorindex=""
this.color_id=""
this.carAudi(3,3,this.train_system_id);
},
//车型
vehiclemodel(e){
this.vehiclemodelindex=e.detail.value;
this.car_model_id=this.carAudidata1[e.detail.value].id
// 车系id用于获取车型
// this.pid=this.car_model_id
this.vehiclecolorindex=""
this.color_id=""
this.level=4
this.carAudi(4,4,this.car_model_id);
},
//颜色
vehiclecolor(e){
this.vehiclecolorindex=e.detail.value;
this.color_id=this.carAudidata2[e.detail.value].id
// 车系id用于获取车型
this.pid=this.color_id
// this.carAudi(4);
},
反填重点
carAudi(type,level,pid){
this.rq.getData('show/api/Config/carAudi', {
level:level,
pid:pid||''
}).then(res => {
if (res.code == 0) {
if(type==3){
this.carAudidata1=res.data
if(this.info.car_model_id){
let index=this.carAudidata1.findIndex((item)=>item.id==this.info.car_model_id);
this.vehiclemodelindex=index==-1?'':index
}
return
}else if(type==4){
this.carAudidata2=res.data
if(this.info.color_id){
let index=this.carAudidata2.findIndex((item)=>item.id==this.info.color_id);
this.vehiclecolorindex=index==-1?'':index
}
return
}else{
this.carAudidata=res.data
if(this.info.train_system_id){
let index=this.carAudidata.findIndex((item)=>item.id==this.info.train_system_id);
this.vehicleseriesindex=index==-1?'':index
}
return
}
}
})
},
getContract(){
this.rq.getData('show/api/Show/getContract', {
id:'476090148134111'
}).then(res => {
if (res.code == 0) {
this.info = res.data.info
this.agree=res.data.info.is_beijing_inhabitant
this.date=res.data.info.index_end_time
this.date1=res.data.info.delivery_date
this.imagePath=res.data.info.upload_receipt
this.train_system_id=res.data.info.train_system_id
this.carAudi('','',2);
if(this.train_system_id){
this.carAudi(3,3,this.train_system_id);
if(this.car_model_id){
this.carAudi(4,4,this.car_model_id);
}
}
}
})
},
数据格式
level
2 车系 3 车型 4 颜色
pid
上级id【车系不用传】
5
data": [...<array>
-{
"id": 10,车系id 车型 id 颜色id【也是上级id】 <number>
"name": "白色",名称 <string>
"is_select": 1预留字段 <number>
}
]
提醒自己(findindex) 下拉联动反填
最新推荐文章于 2024-07-26 11:09:07 发布