提醒自己(findindex) 下拉联动反填

// 车系
			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>
	}
]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值