|
|
|
@ -89,7 +89,6 @@ |
|
|
|
|
list: [], |
|
|
|
|
categoryList: '', |
|
|
|
|
type: '', |
|
|
|
|
isEdit: false |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onLoad(op) { |
|
|
|
@ -109,17 +108,17 @@ |
|
|
|
|
}); |
|
|
|
|
if (status == 200) { |
|
|
|
|
if (data.list.length > 0) { |
|
|
|
|
this.isEdit = true |
|
|
|
|
data.list.forEach((item_1, index_1) => { |
|
|
|
|
let arr = item_1.category.split(",").map(item => Number(item)) |
|
|
|
|
let name = this.categoryList.filter(function(obj) { |
|
|
|
|
return arr.some(function(item) { |
|
|
|
|
return item === obj.category_id; |
|
|
|
|
}); |
|
|
|
|
return item_1.category.split(",").map(item => Number(item)).some( |
|
|
|
|
function(item) { |
|
|
|
|
return item === obj.category_id; |
|
|
|
|
}); |
|
|
|
|
}).map(function(obj) { |
|
|
|
|
return obj.name + '等'; |
|
|
|
|
return obj.name |
|
|
|
|
}); |
|
|
|
|
item_1.category_name = name.join(',') |
|
|
|
|
item_1.category_name = name.join(',') + (name.length > 0 ? '等' : ''); |
|
|
|
|
item_1.price_list.forEach((item_2, index_2) => { |
|
|
|
|
item_2.startProfit = Number((Number(item_2.min) * (Number(item_2 |
|
|
|
|
.add_price_rate) / 100)).toFixed(2)); |
|
|
|
@ -129,7 +128,7 @@ |
|
|
|
|
}) |
|
|
|
|
this.list = data.list |
|
|
|
|
} else { |
|
|
|
|
this.isEdit = false |
|
|
|
|
this.list = [] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -206,23 +205,14 @@ |
|
|
|
|
delete item_1.startProfit |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
let url = '' |
|
|
|
|
if (this.isEdit) { |
|
|
|
|
url = newFunApi.editStore({ |
|
|
|
|
list: list, |
|
|
|
|
type: this.type |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
url = newFunApi.setStorePrice({ |
|
|
|
|
list: list, |
|
|
|
|
type: this.type |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
let { |
|
|
|
|
status, |
|
|
|
|
message, |
|
|
|
|
data |
|
|
|
|
} = await url; |
|
|
|
|
} = await newFunApi.setStorePrice({ |
|
|
|
|
list: list, |
|
|
|
|
type: this.type |
|
|
|
|
}); |
|
|
|
|
if (status == 200) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "保存成功" |
|
|
|
@ -335,7 +325,7 @@ |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
console.log(nameList, newList) |
|
|
|
|
this.list[this.categoryIndex].category_name = nameList.join(','); |
|
|
|
|
this.list[this.categoryIndex].category_name = nameList.join(',') +(nameList.length > 0 ? '等' : ''); |
|
|
|
|
this.list[this.categoryIndex].category = newList.join(',') |
|
|
|
|
this.$refs.category.afterSale = false; |
|
|
|
|
}, |
|
|
|
|