...
|
...
|
@@ -2,44 +2,15 @@ import Service from '../service'; |
|
|
import _ from 'lodash';
|
|
|
|
|
|
let apiUrl = {
|
|
|
brand: '/platform/getSellerBrandInfo',
|
|
|
sort: '/platform/getSellerSortInfo',
|
|
|
color: '/platform/querySellerProductColors',
|
|
|
size: '/platform/querySortSize',
|
|
|
addProduct: '/platform/addProduct',
|
|
|
params: '/platform/queryProductParamBySortId',
|
|
|
attr: '/platform/selectAttributes',
|
|
|
material: '/platform/querySellerProductMaterial',
|
|
|
updateNetInfo: '/platform/updateSellerProductNetSaleInfo',
|
|
|
updateProduct: '/platform/updateProduct',
|
|
|
getProduct: '/platform/getProduct'
|
|
|
updateProduct: '/platform/updateProduct'
|
|
|
};
|
|
|
|
|
|
class ProductCreateService extends Service {
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获得品牌所支持的所有颜色
|
|
|
*/
|
|
|
getColor() {
|
|
|
return this.get(apiUrl.color, {
|
|
|
cache: true
|
|
|
}).then((result) => result.data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得品类下所支持的尺码
|
|
|
* @param smallSortId
|
|
|
*/
|
|
|
getSize(smallSortId) {
|
|
|
return this.get(apiUrl.size, {
|
|
|
params: {
|
|
|
sortId: smallSortId
|
|
|
},
|
|
|
cache: true
|
|
|
}).then(result => result.data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得品类支持的商品相关参数
|
|
|
* @param sortId
|
...
|
...
|
@@ -50,7 +21,7 @@ class ProductCreateService extends Service { |
|
|
sortId
|
|
|
},
|
|
|
cache: true
|
|
|
}).then(result => result.data);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -68,7 +39,7 @@ class ProductCreateService extends Service { |
|
|
displayPosition
|
|
|
},
|
|
|
cache: true
|
|
|
}).then(result => result.data);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -86,7 +57,7 @@ class ProductCreateService extends Service { |
|
|
displayPosition
|
|
|
},
|
|
|
cache: true
|
|
|
}).then(result => result.data);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -99,7 +70,7 @@ class ProductCreateService extends Service { |
|
|
maxSortId: maxSortId
|
|
|
},
|
|
|
cache: true
|
|
|
}).then(result => result.data);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -115,10 +86,10 @@ class ProductCreateService extends Service { |
|
|
|
|
|
getAllAttr(smallSortId, maxSortId) {
|
|
|
return Promise.all([
|
|
|
this.getProductParams(smallSortId).then(r => r.data).then(r => r.map(this.addModelAttr)),
|
|
|
this.getProductAttribute(smallSortId).then(r => r.data).then(r => r.map(this.addModelAttr)),
|
|
|
this.getProductStyle(smallSortId).then(r => r.data).then(r => r.map(this.addModelAttr)),
|
|
|
this.getMaterial(maxSortId).then(r => r.data).then(r => this.addModelAttr(r)),
|
|
|
this.getProductParams(smallSortId).then(r => r.data.map(this.addModelAttr)),
|
|
|
this.getProductAttribute(smallSortId).then(r => r.data.map(this.addModelAttr)),
|
|
|
this.getProductStyle(smallSortId).then(r => r.data.map(this.addModelAttr)),
|
|
|
this.getMaterial(maxSortId).then(r => this.addModelAttr(r.data)),
|
|
|
]);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -127,8 +98,7 @@ class ProductCreateService extends Service { |
|
|
* @param info
|
|
|
*/
|
|
|
updateNetInfo(info) {
|
|
|
return this.post(apiUrl.updateNetInfo, info)
|
|
|
.then(result => result.data);
|
|
|
return this.post(apiUrl.updateNetInfo, info);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -136,29 +106,16 @@ class ProductCreateService extends Service { |
|
|
* @param product
|
|
|
*/
|
|
|
saveBaseProductInfo(product) {
|
|
|
return this.post(apiUrl.addProduct, product)
|
|
|
.then(result => result.data);
|
|
|
return this.post(apiUrl.addProduct, product);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询商品所以有信息,包括网销信息
|
|
|
* @param skn
|
|
|
*/
|
|
|
getProductAllInfo(skn) {
|
|
|
return this.get(apiUrl.getProduct, {
|
|
|
params: {
|
|
|
productSkn: skn
|
|
|
}
|
|
|
}).then(result => result.data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新商品信息,包括基础信息和网销信息
|
|
|
* @param product
|
|
|
*/
|
|
|
updateProductAllInfo(product) {
|
|
|
return this.post(apiUrl.updateProduct, product)
|
|
|
.then(result => result.data);
|
|
|
return this.post(apiUrl.updateProduct, product);
|
|
|
}
|
|
|
|
|
|
handleRelation(oneValuesObj = []) {
|
...
|
...
|
@@ -327,12 +284,6 @@ class ProductCreateService extends Service { |
|
|
return colorsObj;
|
|
|
}
|
|
|
|
|
|
getProduct(skn) {
|
|
|
return this.getProductAllInfo(skn).then((result) => {
|
|
|
return result.data;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
addNoneItem(objArray) {
|
|
|
const objArrayClone = _.cloneDeep(objArray);
|
|
|
|
...
|
...
|
|