Commit 7bd7f39e authored by Damon's avatar Damon

fix: 默认品牌选择

parent 878a1bfe
...@@ -123,9 +123,8 @@ export default { ...@@ -123,9 +123,8 @@ export default {
getApp().trackPage('选择配件页') getApp().trackPage('选择配件页')
if (e) { if (e) {
this.categaryId = e.categaryId this.categaryId = e.categaryId
this.brandId = e.brandId
this.type = e.type this.type = e.type
this.getBrandList() this.getBrandList(e.brandId)
} else { } else {
this.getCategaryList() this.getCategaryList()
} }
...@@ -150,20 +149,31 @@ export default { ...@@ -150,20 +149,31 @@ export default {
}) })
}, },
// 获取品牌 // 获取品牌
getBrandList() { getBrandList(id) {
this.$u.api.getBrandList({categoryId: this.categaryId}).then(res => { this.$u.api.getBrandList({categoryId: this.categaryId}).then(res => {
if (res.code === 200) { if (res.code === 200) {
const data = res.data const data = res.data
if (data.length > 0) { 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 v.label = v.brandName
return v return v
}) })
if (item && index) {
this.selectBrand(item, index)
this.scrollId = `brand${item.brandId}`
} else {
this.brandId = this.brand[0].brandId this.brandId = this.brand[0].brandId
}
this.lists = [] this.lists = []
this.getPartsList() 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