|
|
@ -109,15 +109,8 @@ |
|
|
|
if (status == 200) { |
|
|
|
if (status == 200) { |
|
|
|
if (data.list.length > 0) { |
|
|
|
if (data.list.length > 0) { |
|
|
|
data.list.forEach((item_1, index_1) => { |
|
|
|
data.list.forEach((item_1, index_1) => { |
|
|
|
let arr = item_1.category.split(",").map(item => Number(item)) |
|
|
|
let name = this.findElementsById(this.categoryList, item_1.category.split(",").map( |
|
|
|
let name = this.categoryList.filter(function(obj) { |
|
|
|
item => Number(item))) |
|
|
|
return item_1.category.split(",").map(item => Number(item)).some( |
|
|
|
|
|
|
|
function(item) { |
|
|
|
|
|
|
|
return item === obj.category_id; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}).map(function(obj) { |
|
|
|
|
|
|
|
return obj.name |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
item_1.category_name = name.join(',') + (name.length > 0 ? '等' : ''); |
|
|
|
item_1.category_name = name.join(',') + (name.length > 0 ? '等' : ''); |
|
|
|
item_1.price_list.forEach((item_2, index_2) => { |
|
|
|
item_1.price_list.forEach((item_2, index_2) => { |
|
|
|
item_2.startProfit = Number((Number(item_2.min) * (Number(item_2 |
|
|
|
item_2.startProfit = Number((Number(item_2.min) * (Number(item_2 |
|
|
@ -137,7 +130,6 @@ |
|
|
|
let that = this |
|
|
|
let that = this |
|
|
|
let step = 0; |
|
|
|
let step = 0; |
|
|
|
let list = this.list |
|
|
|
let list = this.list |
|
|
|
console.log(list) |
|
|
|
|
|
|
|
list.forEach((item, index) => { |
|
|
|
list.forEach((item, index) => { |
|
|
|
if (!item.category_name) { |
|
|
|
if (!item.category_name) { |
|
|
|
step++ |
|
|
|
step++ |
|
|
@ -307,25 +299,30 @@ |
|
|
|
uni.setStorageSync('list', list) |
|
|
|
uni.setStorageSync('list', list) |
|
|
|
this.$refs.category.afterSale = true; |
|
|
|
this.$refs.category.afterSale = true; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
findElementsById(arr, ids) { |
|
|
|
|
|
|
|
let result = [] |
|
|
|
|
|
|
|
arr.forEach(item => { |
|
|
|
|
|
|
|
if (ids.indexOf(item.category_id) > -1) { |
|
|
|
|
|
|
|
result.push(item.name); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
item.children.forEach(item1 => { |
|
|
|
|
|
|
|
if (ids.indexOf(item1.category_id) > -1) { |
|
|
|
|
|
|
|
result.push(item1.name); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
}, |
|
|
|
// 获取分类 |
|
|
|
// 获取分类 |
|
|
|
getChoseCategory(res) { |
|
|
|
getChoseCategory(res) { |
|
|
|
let nameList = []; |
|
|
|
let nameList = []; |
|
|
|
let list = []; |
|
|
|
let list = []; |
|
|
|
console.log(this.list[this.categoryIndex].category, this.categoryIndex) |
|
|
|
|
|
|
|
if (this.list[this.categoryIndex].category) { |
|
|
|
if (this.list[this.categoryIndex].category) { |
|
|
|
list = this.list[this.categoryIndex].category.split(",").map(item => Number(item)) |
|
|
|
list = this.list[this.categoryIndex].category.split(",").map(item => Number(item)) |
|
|
|
} |
|
|
|
} |
|
|
|
let newList = list.concat(res.category_id); |
|
|
|
let newList = list.concat(res.category_id); |
|
|
|
|
|
|
|
nameList = this.findElementsById(this.categoryList, newList); |
|
|
|
this.categoryList.forEach(item1 => { |
|
|
|
this.list[this.categoryIndex].category_name = nameList.join(',') + (nameList.length > 0 ? '等' : ''); |
|
|
|
newList.forEach(item2 => { |
|
|
|
|
|
|
|
if (item1.category_id == item2) { |
|
|
|
|
|
|
|
nameList.push(item1.name) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
console.log(nameList, newList) |
|
|
|
|
|
|
|
this.list[this.categoryIndex].category_name = nameList.join(',') +(nameList.length > 0 ? '等' : ''); |
|
|
|
|
|
|
|
this.list[this.categoryIndex].category = newList.join(',') |
|
|
|
this.list[this.categoryIndex].category = newList.join(',') |
|
|
|
this.$refs.category.afterSale = false; |
|
|
|
this.$refs.category.afterSale = false; |
|
|
|
}, |
|
|
|
}, |
|
|
|