Commit 7bd7f39e authored by Damon's avatar Damon

fix: 默认品牌选择

parent 878a1bfe
......@@ -123,9 +123,8 @@ export default {
getApp().trackPage('选择配件页')
if (e) {
this.categaryId = e.categaryId
this.brandId = e.brandId
this.type = e.type
this.getBrandList()
this.getBrandList(e.brandId)
} else {
this.getCategaryList()
}
......@@ -150,19 +149,30 @@ export default {
})
},
// 获取品牌
getBrandList() {
getBrandList(id) {
this.$u.api.getBrandList({categoryId: this.categaryId}).then(res => {
if (res.code === 200) {
const data = res.data
if (data.length > 0) {
this.brand = data.map(v => {
let item, index
this.brand = data.map((v, i) => {
if (id && parseInt(id) === v.brandId) {
item = v
index = i
}
v.label = v.brandName
return v
})
this.brandId = this.brand[0].brandId
if (item && index) {
this.selectBrand(item, index)
this.scrollId = `brand${item.brandId}`
} else {
this.brandId = this.brand[0].brandId
this.lists = []
this.getPartsList()
}
}
this.lists = []
this.getPartsList()
}
})
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment