|
|
@@ -40,6 +40,7 @@
|
|
|
@changeCategory="changeCategory"
|
|
|
@updataProdDataForm="updataProdDataForm"
|
|
|
@changeWriteOffTime="changeWriteOffTime"
|
|
|
+ @updateSkuTags="updateSkuTags"
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
|
@@ -125,6 +126,7 @@ export default {
|
|
|
|
|
|
useLang: 0 // 0中文 1中英文
|
|
|
},
|
|
|
+ skuTags:[],
|
|
|
|
|
|
// 平台选定分类名称
|
|
|
platCategoryName: '',
|
|
|
@@ -168,6 +170,9 @@ export default {
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+ updateSkuTags(skuTags){
|
|
|
+ this.skuTags = skuTags;
|
|
|
+ },
|
|
|
/**
|
|
|
* 获取产品详情数据
|
|
|
*/
|
|
|
@@ -394,6 +399,7 @@ export default {
|
|
|
|
|
|
// 表单提交
|
|
|
dataFormSubmit () {
|
|
|
+ console.log(this.skuTags);
|
|
|
if (!this.dataForm.categoryId || !this.dataForm.shopCategoryId) {
|
|
|
// 请选择商品分类
|
|
|
this.errorMsg(this.$i18n.t('product.thisProduCategroy'))
|
|
|
@@ -408,6 +414,13 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
+ //skuMap拼接
|
|
|
+ let skuPicMapArr = this.cartesianProduct(this.skuTags);
|
|
|
+
|
|
|
+ for(let i = 0; i < this.dataForm.skuList.length; i++){
|
|
|
+ this.dataForm.skuList[i].skuPicMap = skuPicMapArr[i]
|
|
|
+ this.dataForm.skuList[i].pic = skuPicMapArr[i].split(",")[0]
|
|
|
+ }
|
|
|
this.dataForm.prodName = this.dataForm.prodNameCn
|
|
|
this.dataForm.brief = this.dataForm.briefCn
|
|
|
let param = Object.assign({}, this.dataForm)
|
|
|
@@ -501,6 +514,29 @@ export default {
|
|
|
}).catch((e) => {
|
|
|
this.isSubmit = false
|
|
|
})
|
|
|
+ },
|
|
|
+ //求skutag笛卡尔值组成sku图片映射
|
|
|
+ cartesianProduct(skuTags) {
|
|
|
+ let result = [];
|
|
|
+ if (skuTags.length === 0) {
|
|
|
+ return result;
|
|
|
+ } else {
|
|
|
+ let tempResult = skuTags[0].tagItems.map(item => item.pic);
|
|
|
+ for (let i = 1; i < skuTags.length; i++) {
|
|
|
+ let newResult = [];
|
|
|
+ tempResult.forEach(arr =>{
|
|
|
+ skuTags[i].tagItems.forEach(item =>{
|
|
|
+ if(!item.pic){
|
|
|
+ item.pic = 'null'
|
|
|
+ }
|
|
|
+ let newArr = arr.concat(',').concat(item.pic);
|
|
|
+ newResult.push(newArr);
|
|
|
+ })
|
|
|
+ })
|
|
|
+ tempResult = newResult;
|
|
|
+ }
|
|
|
+ return tempResult;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|