|
|
|
@ -65,6 +65,7 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="规格信息">
|
|
|
|
<el-form-item label="规格信息">
|
|
|
|
|
|
|
|
<el-button @click="refreshSku(null)">刷新列表</el-button>
|
|
|
|
<el-table :data="skuList" :max-height="400">
|
|
|
|
<el-table :data="skuList" :max-height="400">
|
|
|
|
<el-table-column v-for="s in productAttr" :label="s.name" :key="s.name" :prop="s.name"></el-table-column>
|
|
|
|
<el-table-column v-for="s in productAttr" :label="s.name" :key="s.name" :prop="s.name"></el-table-column>
|
|
|
|
<el-table-column label="展示图片">
|
|
|
|
<el-table-column label="展示图片">
|
|
|
|
@ -118,6 +119,7 @@ export default {
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
form: {},
|
|
|
|
form: {},
|
|
|
|
|
|
|
|
skuList:[],
|
|
|
|
productAttr: [
|
|
|
|
productAttr: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: '颜色',
|
|
|
|
name: '颜色',
|
|
|
|
@ -130,12 +132,21 @@ export default {
|
|
|
|
maxOptionNum: 44
|
|
|
|
maxOptionNum: 44
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
created() {
|
|
|
|
skuList() {
|
|
|
|
const {id} = this.$route.query
|
|
|
|
|
|
|
|
if (id) {
|
|
|
|
|
|
|
|
this.getInfo(id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
refreshSku(preSkus){
|
|
|
|
let skus = [];
|
|
|
|
let skus = [];
|
|
|
|
let skuMap = new Map()
|
|
|
|
let skuMap = new Map()
|
|
|
|
if(this.form.skuList){
|
|
|
|
if(preSkus){
|
|
|
|
this.form.skuList.forEach(sku=>{
|
|
|
|
this.skuList=preSkus
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(this.skuList){
|
|
|
|
|
|
|
|
this.skuList.forEach(sku=>{
|
|
|
|
skuMap.set(sku.spData,sku)
|
|
|
|
skuMap.set(sku.spData,sku)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -173,16 +184,9 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return skus
|
|
|
|
this.form.productAttr = JSON.stringify(this.productAttr)
|
|
|
|
}
|
|
|
|
this.skuList= skus
|
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
|
|
|
|
const {id} = this.$route.query
|
|
|
|
|
|
|
|
if (id) {
|
|
|
|
|
|
|
|
this.getInfo(id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
getInfo(id) {
|
|
|
|
getInfo(id) {
|
|
|
|
getPmsProduct(id).then(response => {
|
|
|
|
getPmsProduct(id).then(response => {
|
|
|
|
const {albumPics } = response
|
|
|
|
const {albumPics } = response
|
|
|
|
@ -193,13 +197,13 @@ export default {
|
|
|
|
if(this.form.productAttr){
|
|
|
|
if(this.form.productAttr){
|
|
|
|
this.productAttr =JSON.parse(this.form.productAttr)
|
|
|
|
this.productAttr =JSON.parse(this.form.productAttr)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.refreshSku(this.form.skuList)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/** 提交按钮 */
|
|
|
|
/** 提交按钮 */
|
|
|
|
submitForm() {
|
|
|
|
submitForm() {
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
if (valid) {
|
|
|
|
if (valid) {
|
|
|
|
this.form.productAttr = JSON.stringify(this.productAttr)
|
|
|
|
|
|
|
|
this.form.skuList = this.skuList
|
|
|
|
this.form.skuList = this.skuList
|
|
|
|
if(this.form.categoryId && Array.isArray(this.form.categoryId)){
|
|
|
|
if(this.form.categoryId && Array.isArray(this.form.categoryId)){
|
|
|
|
this.form.categoryId = this.form.categoryId.pop()
|
|
|
|
this.form.categoryId = this.form.categoryId.pop()
|
|
|
|
|