You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

72 lines
2.4 KiB

const priceOptionIndex = ()=>{
return {
init(){
console.log(this.kind);
this.initButtons(this.kind);
},
kind: kind,
pageLength: 999999,
search: '',
orioptions: options,
options: options,
options_arr: {
1:'標',
2:'選',
},
btntype:'',
buttons:[],
initButtons(kind){
if(kind == 'A'){
this.buttons = [
{name: '車廂意匠', type: 'A1'}
]
}else if(kind == 'B'){
this.buttons = [
{name: '天井', type: 'B1'},
{name: '地板', type: 'B2'},
{name: '操縱盤', type: 'B3'},
{name: '扶手', type: 'B4'},
{name: '車廂門與層門(轎門/層門)', type: 'B5'},
{name: '轎壁(車廂側板)', type: 'B6'},
{name: '其他車廂內裝配件', type: 'B7'},
]
}else if(kind == 'C'){
this.buttons = [
{name: '框', type: 'C1'},
{name: '乘場指示器', type: 'C2'},
{name: '燈', type: 'C3'},
{name: '方式與門', type: 'C4'},
]
}else if(kind == 'D'){
this.buttons = [
{name: '功能與配置', type: 'D1'},
{name: 'OH與樓高', type: 'D2'},
]
}
this.buttons.unshift({
name:'顯示全部',type:'1',
})
this.btntype = this.buttons[0].type;
},
changeType(type = this.btntype){
this.btntype = type
this.options = this.orioptions;
this.options = this.getOptions();
this.inputSearch()
},
getOptions(){
if(this.btntype != 1){
return this.options.filter(item=>(item.subkind == this.btntype)).slice(0, this.pageLength)
}
return this.options.slice(0, this.pageLength);
},
inputSearch(e=null){
let text = e!=null ? e.target.value : this.search;
this.search = text
this.options = this.orioptions
this.options = this.getOptions().filter(item=>{
return (item.group_name.includes(text))
})
}
}
}