|
@@ -1040,17 +1040,22 @@ export default {
|
|
|
choiceBrand(brand, index) {
|
|
|
// 选择品牌
|
|
|
brand.isChecked = !brand.isChecked
|
|
|
- if (brand.isChecked) {
|
|
|
- this.checkedBrandList.push(brand.id)
|
|
|
- } else {
|
|
|
- this.checkedBrandList.splice(index, 1)
|
|
|
- }
|
|
|
+ if (brand.isChecked) {
|
|
|
+ if(!this.contains(this.checkedBrandList,brand.id)){
|
|
|
+ this.checkedBrandList.push(brand.id)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.checkedBrandList.splice(this.checkedBrandList.indexOf(brand.id),1)
|
|
|
+ }
|
|
|
this.isAllcheckedBrand = false
|
|
|
this.checkedBrandLength = this.checkedBrandList.length
|
|
|
console.log('checkedBrandList', this.checkedBrandList)
|
|
|
this.listQuery.brandIds = this.checkedBrandList.join(',')
|
|
|
console.log('this.listQuery.brandIds', this.listQuery.brandIds)
|
|
|
},
|
|
|
+ contains(arr, val) {// 校验
|
|
|
+ return arr.some(item => item === val)
|
|
|
+ },
|
|
|
choiceBrandAll() {
|
|
|
// 点击选择全部品牌
|
|
|
this.isAllcheckedBrand = true
|