张雄 3 years ago
parent 2db412e7ae
commit 86907e9a74

@ -18,6 +18,16 @@
<li v-for="(item,index) in letterArr" :key="index" :class="activeLi === index ? 'lactive': ''" @click="handlerLi(index)">{{item}}</li> <li v-for="(item,index) in letterArr" :key="index" :class="activeLi === index ? 'lactive': ''" @click="handlerLi(index)">{{item}}</li>
<li @click="selectAll"></li> <li @click="selectAll"></li>
</ul> </ul>
<div style="margin: 0 0 0 16px">
<a-form-model layout="inline">
<a-form-model-item label="关键词">
<a-input v-model="sKeyword" style="width: 160px"></a-input>
</a-form-model-item>
<a-form-model-item>
<a-button type="primary" @click="onSearch"></a-button>
</a-form-model-item>
</a-form-model>
</div>
<div style="clear: both"></div> <div style="clear: both"></div>
<div class="sb-dd"> <div class="sb-dd">
<vue-scroll> <vue-scroll>
@ -95,6 +105,7 @@ export default {
models: [], models: [],
brandname: "", brandname: "",
brandList: [], brandList: [],
sKeyword:'',
}; };
}, },
methods: { methods: {
@ -105,6 +116,7 @@ export default {
}, },
// li // li
handlerLi(n) { handlerLi(n) {
this.sKeyword = '';
this.activeLi = n; this.activeLi = n;
let key = this.letterArr[n]; let key = this.letterArr[n];
this.showCars = this.cars.filter((ele) => ele.firstword === key); this.showCars = this.cars.filter((ele) => ele.firstword === key);
@ -160,6 +172,10 @@ export default {
arr.push(ele.brandname); arr.push(ele.brandname);
}) })
this.$emit("selectAll", arr); this.$emit("selectAll", arr);
},
onSearch() {
let kw = this.sKeyword;
this.showCars = this.cars.filter((ele) => ele.brandname.indexOf(kw) != -1 && ele.firstword != '热门');
} }
}, },
}; };
@ -221,7 +237,7 @@ export default {
} }
.sb-dd { .sb-dd {
width: 100%; width: 100%;
height: calc(100% - 30px); height: calc(100% - 70px);
box-shadow: 0 0 20px; box-shadow: 0 0 20px;
} }
.sb-bd { .sb-bd {

@ -248,7 +248,6 @@ export default {
getUserBrand(this.form) getUserBrand(this.form)
.then((res) => { .then((res) => {
let data = res.data; let data = res.data;
console.log(data)
let arr = []; let arr = [];
data.forEach((ele) => { data.forEach((ele) => {
let fk = ele.firstword; let fk = ele.firstword;

@ -17,6 +17,16 @@
<span class="liSn">按品牌拼音首字母查找:</span> <span class="liSn">按品牌拼音首字母查找:</span>
<li v-for="(item,index) in letterArr" :key="index" :class="activeLi === index ? 'lactive': ''" @click="handlerLi(index)">{{item}}</li> <li v-for="(item,index) in letterArr" :key="index" :class="activeLi === index ? 'lactive': ''" @click="handlerLi(index)">{{item}}</li>
</ul> </ul>
<div style="margin: 0 0 0 16px">
<a-form-model layout="inline">
<a-form-model-item label="关键词">
<a-input v-model="sKeyword" style="width: 160px"></a-input>
</a-form-model-item>
<a-form-model-item>
<a-button type="primary" @click="onSearch"></a-button>
</a-form-model-item>
</a-form-model>
</div>
<div style="clear: both"></div> <div style="clear: both"></div>
<div class="sb-dd"> <div class="sb-dd">
<vue-scroll> <vue-scroll>
@ -87,6 +97,7 @@ export default {
chooseModel: null, chooseModel: null,
models: [], models: [],
brandname: "", brandname: "",
sKeyword:'',
}; };
}, },
methods: { methods: {
@ -97,6 +108,7 @@ export default {
}, },
// li // li
handlerLi(n) { handlerLi(n) {
this.sKeyword = '';
this.activeLi = n; this.activeLi = n;
let key = this.letterArr[n]; let key = this.letterArr[n];
this.showCars = this.cars.filter((ele) => ele.firstword === key); this.showCars = this.cars.filter((ele) => ele.firstword === key);
@ -167,6 +179,10 @@ export default {
this.$message.warning("请选择品牌"); this.$message.warning("请选择品牌");
} }
}, },
onSearch() {
let kw = this.sKeyword;
this.showCars = this.cars.filter((ele) => ele.brandname.indexOf(kw) != -1 && ele.firstword != '热门');
}
}, },
}; };
</script> </script>
@ -227,7 +243,7 @@ export default {
} }
.sb-dd { .sb-dd {
width: 100%; width: 100%;
height: calc(100% - 30px); height: calc(100% - 70px);
box-shadow: 0 0 20px; box-shadow: 0 0 20px;
} }
.sb-bd { .sb-bd {

Loading…
Cancel
Save