|
@@ -455,13 +455,23 @@
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
-
|
|
|
+ filterChildren(){
|
|
|
+ return function(id){
|
|
|
+ let data = []
|
|
|
+ this.mainList.forEach(item=>{
|
|
|
+ if(item.categoryId == id){
|
|
|
+ data = item.children?[...[{categoryId: '0', name: '不限'}],...item.children]:[]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return data
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
created() {
|
|
|
+ this.initData()
|
|
|
if(this.id){
|
|
|
this.getDetail()
|
|
|
}
|
|
|
- this.initData()
|
|
|
},
|
|
|
methods: {
|
|
|
// 返回
|
|
@@ -473,19 +483,18 @@
|
|
|
this.formData.checkTypeList = []
|
|
|
getDetail({id: this.id}).then( async res => {
|
|
|
Object.assign(this.formData, res.data, {
|
|
|
- websit: {websitId: res.data.websitId,name: res.data.websitName},
|
|
|
-
|
|
|
+
|
|
|
})
|
|
|
this.historyList = res.data.operatorLogList
|
|
|
this.formData.dateList = [res.data.startTime,res.data.endTime]
|
|
|
- for(var item of res.data.productList){
|
|
|
- item.smallList = await this.filterChildren(item.mainId).then(ress=>{
|
|
|
- return ress
|
|
|
+ this.formData1.productList = res.data.productList.map(item=>{
|
|
|
+ return Object.assign(item, {
|
|
|
+ smallList: this.filterChildren(item.mainId),
|
|
|
+ brand: {id: item.brandId,brandName: item.brandName},
|
|
|
+ main: {categoryId: item.mainId,name: item.mainName},
|
|
|
+ small: {categoryId: item.smallId,name: item.smallName}
|
|
|
})
|
|
|
- item.brand = {id: item.brandId,brandName: item.brandName}
|
|
|
- item.main = {categoryId: item.mainId,name: item.mainName}
|
|
|
- item.small = {categoryId: item.smallId,name: item.smallName}
|
|
|
- }
|
|
|
+ })
|
|
|
|
|
|
res.data.websitList.map(item=>{
|
|
|
item.websit = {websitId: item.websitId,name: item.websitName}
|
|
@@ -495,23 +504,11 @@
|
|
|
})
|
|
|
this.formData2.byList = res.data.byList
|
|
|
this.formData3.websitList = res.data.websitList
|
|
|
- this.formData1.productList = res.data.productList
|
|
|
|
|
|
- console.log(this.formData.checkTypeList,'123123123')
|
|
|
+
|
|
|
+ console.log(this.formData1.productList,'123123123')
|
|
|
})
|
|
|
},
|
|
|
- async filterChildren(id){
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- // 对 arr 进行处理...
|
|
|
- let data = []
|
|
|
- this.mainList.forEach(async item=>{
|
|
|
- if(item.categoryId == id){
|
|
|
- data = item.children?[...[{categoryId: '0', name: '不限'}],...item.children]:[]
|
|
|
- }
|
|
|
- })
|
|
|
- resolve(data);
|
|
|
- });
|
|
|
- },
|
|
|
initData(){
|
|
|
this.getOrderType()
|
|
|
this.getBrandList()
|