|
|
<template>
|
|
|
<div>
|
|
|
<Form :model="product" :label-width="80">
|
|
|
<Row>
|
|
|
<Col span="8">
|
|
|
<Form-item>
|
|
|
<span>商品基本信息</span>
|
|
|
</Form-item>
|
|
|
<Form :model="product" :label-width="70">
|
|
|
|
|
|
<Row>
|
|
|
<div class="create-group">
|
|
|
<span class="create-group-indicator"></span>
|
|
|
<span class="create-group-title">基础信息</span>
|
|
|
<span class="create-group-sub-title">(该信息必须项编缉完成后可以保存, 可以将商品发货入仓)</span>
|
|
|
</div>
|
|
|
</Row>
|
|
|
|
|
|
<Row>
|
|
|
<Col>
|
|
|
<div class="create-item-title">商品基本信息</div>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
|
|
|
<Row>
|
|
|
<Col span="8">
|
|
|
<Form-item label="品 牌*">
|
|
|
<Form-item label="品牌*">
|
|
|
<span>{{product.brandName}}</span>
|
|
|
</Form-item>
|
|
|
</Col>
|
...
|
...
|
@@ -52,7 +59,8 @@ |
|
|
<Row>
|
|
|
<Col span="8">
|
|
|
<Form-item label="货品年*">
|
|
|
<Date-picker type="year" placeholder="选择年" style="width: 200px"></Date-picker>
|
|
|
<Date-picker :value="product.goodsYears" @on-change="clickGoodsYear" type="year" placeholder="选择年" style="width: 200px">
|
|
|
</Date-picker>
|
|
|
</Form-item>
|
|
|
</Col>
|
|
|
</Row>
|
...
|
...
|
@@ -75,7 +83,7 @@ |
|
|
<Row>
|
|
|
<Col span="8">
|
|
|
<Form-item label="上市日期*">
|
|
|
<Date-picker type="date" placeholder="选择日期" style="width: 200px"></Date-picker>
|
|
|
<Date-picker :value="product.expectSaleTimeStr" @on-change="clickSaleDate" type="date" placeholder="选择日期" style="width: 200px"></Date-picker>
|
|
|
</Form-item>
|
|
|
</Col>
|
|
|
</Row>
|
...
|
...
|
@@ -113,7 +121,7 @@ |
|
|
|
|
|
|
|
|
<Form-item label="年龄层*">
|
|
|
<Checkbox-group v-model="product.ageLevel">
|
|
|
<Checkbox-group v-model="ageLevel">
|
|
|
<Checkbox label="1">
|
|
|
<span>成人</span>
|
|
|
</Checkbox>
|
...
|
...
|
@@ -133,15 +141,20 @@ |
|
|
</Form-item>
|
|
|
|
|
|
<Row>
|
|
|
<Col span="8">
|
|
|
<span>商品规格</span>
|
|
|
<Col>
|
|
|
<div class="create-item-title">商品规格
|
|
|
<span class="create-group-sub-title">(颜色名称只能填写中文,最多5个汉字。款型编码和条码只能填写英文和数字,不区分大小写)</span>
|
|
|
</div>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
|
|
|
<Row>
|
|
|
<Form-item label="颜色*">
|
|
|
<span class='squre' v-for="color in colors" @click="clickColor(color)">
|
|
|
<span class="squre-color" :style="{ 'background-color': '#' + color.colorCode}"></span>
|
|
|
<span class="squre-color"
|
|
|
:style="{ 'background-color': '#' + color.colorCode}"
|
|
|
:class="{ 'squre-color-selected': color.selected}">
|
|
|
</span>
|
|
|
<span class="squre-name">{{color.colorName}}</span>
|
|
|
</span>
|
|
|
</Form-item>
|
...
|
...
|
@@ -164,10 +177,8 @@ |
|
|
</Row>
|
|
|
|
|
|
<Row>
|
|
|
<Col span="8">
|
|
|
<Form-item>
|
|
|
<span>商品价格</span>
|
|
|
</Form-item>
|
|
|
<Col>
|
|
|
<div class="create-item-title">商品价格</div>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
|
...
|
...
|
@@ -190,10 +201,12 @@ |
|
|
|
|
|
</Form>
|
|
|
|
|
|
<div>
|
|
|
<Button type="primary" @click="backStep">上一步</Button>
|
|
|
<Button type="primary" @click="nextStep">下一步</Button>
|
|
|
</div>
|
|
|
<Row>
|
|
|
<Col span="6" offset="10" class="text-center">
|
|
|
<Button type="primary" @click="backStep">上一步</Button>
|
|
|
<Button type="primary" @click="nextStep">下一步</Button>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
...
|
...
|
@@ -202,6 +215,18 @@ |
|
|
import api from '../api';
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
const makeColor = () => {
|
|
|
return {
|
|
|
factoryCode: '',
|
|
|
factoryGoodsName: '',
|
|
|
goodsColorImage: '',
|
|
|
goodsName: '',
|
|
|
colorId: '',
|
|
|
isDefault: 'Y',
|
|
|
goodsSizeList: []
|
|
|
};
|
|
|
};
|
|
|
|
|
|
export default {
|
|
|
props: ['step', 'product'],
|
|
|
data() {
|
...
|
...
|
@@ -226,7 +251,14 @@ |
|
|
title: '颜色展示名称*',
|
|
|
key: 'factoryGoodsName',
|
|
|
render(row, col, index) {
|
|
|
return `<i-input placeholder="请输入..." style="width: 50px"></i-input>`
|
|
|
return `<div v-if="isExist(${index})">
|
|
|
<i-input
|
|
|
:value="table.data[${index}].factoryGoodsName"
|
|
|
placeholder="请输入..."
|
|
|
style="width: 100px"
|
|
|
@on-change="changeFactoryGoodsName($event,${index})">
|
|
|
</i-input>
|
|
|
</div>`
|
|
|
}
|
|
|
},
|
|
|
{
|
...
|
...
|
@@ -242,7 +274,9 @@ |
|
|
title: '款型编码',
|
|
|
key: 'factoryCode',
|
|
|
render(row, col, index) {
|
|
|
return `<i-input placeholder="请输入..." style="width: 50px"></i-input>`
|
|
|
return `<div v-if="isExist(${index})">
|
|
|
<i-input :value="table.data[${index}].factoryCode" placeholder="请输入..." style="width: 100px"></i-input>
|
|
|
</div>`
|
|
|
}
|
|
|
},
|
|
|
{
|
...
|
...
|
@@ -261,8 +295,8 @@ |
|
|
key: 'sizeCode',
|
|
|
render(row, col, index) {
|
|
|
return `<div class='size-code'>
|
|
|
<div v-for="size in row.sizeCode" class="row-span">
|
|
|
<i-input placeholder="请输入..." style="width: 50px"/>
|
|
|
<div v-for="size,i in row.sizeCode" class="row-span">
|
|
|
<i-input :value="table.data[${index}].sizeCode.name" placeholder="请输入..." style="width: 100px"/>
|
|
|
</div>
|
|
|
</div>`;
|
|
|
}
|
...
|
...
|
@@ -285,7 +319,8 @@ |
|
|
data: [],
|
|
|
selectedSizes: [],
|
|
|
selectedColors: []
|
|
|
}
|
|
|
},
|
|
|
ageLevel: [],
|
|
|
}
|
|
|
},
|
|
|
mounted: function() {
|
...
|
...
|
@@ -294,12 +329,11 @@ |
|
|
},
|
|
|
methods: {
|
|
|
nextStep: function() {
|
|
|
console.log(this.product);
|
|
|
console.log(this.table);
|
|
|
|
|
|
this.step.value = 2;
|
|
|
this.$router.push({name:'product.create.step3'})
|
|
|
},
|
|
|
nextStep: function() {
|
|
|
this.step.value = 2;
|
|
|
this.$router.push({name:'product.create.step3'})
|
|
|
// this.$router.push({name:'product.create.step3'})
|
|
|
},
|
|
|
backStep: function() {
|
|
|
this.step.value = 0;
|
...
|
...
|
@@ -313,7 +347,8 @@ |
|
|
});
|
|
|
},
|
|
|
getSize: function() {
|
|
|
return api.getSize(119).then((result) => {
|
|
|
// return api.getSize(this.product.smallSortId).then((result) => {
|
|
|
return api.getSize(129).then((result) => {
|
|
|
if(result.code === 200) {
|
|
|
this.sizes = result.data;
|
|
|
}
|
...
|
...
|
@@ -322,6 +357,10 @@ |
|
|
clickColor: function(color) {
|
|
|
this.addColor(color);
|
|
|
},
|
|
|
changeFactoryGoodsName: function(event, index) {
|
|
|
console.log(event.target.value);
|
|
|
this.table.data[index].factoryGoodsName = event.target.value;
|
|
|
},
|
|
|
clickDefault: function(index) {
|
|
|
let color = this.table.data[index];
|
|
|
|
...
|
...
|
@@ -330,16 +369,22 @@ |
|
|
if(c.colorId !== color.colorId) {
|
|
|
c.goodsName.isDefault = false;
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
clickOperator: function(rowIndex, itemIndex) {
|
|
|
let rowColor = this.table.data[rowIndex];
|
|
|
rowColor.operator[itemIndex].value = rowColor.operator[itemIndex].value ? false:true;
|
|
|
},
|
|
|
clickGoodsYear: function(value) {
|
|
|
this.product.goodsYears = value;
|
|
|
},
|
|
|
clickSaleDate: function(value) {
|
|
|
this.product.expectSaleTimeStr = value
|
|
|
},
|
|
|
initDefault: function() {
|
|
|
let init = _.some(this.table.data, (c) => {
|
|
|
return c.goodsName.isDefault
|
|
|
})
|
|
|
});
|
|
|
|
|
|
if (init) {
|
|
|
return;
|
...
|
...
|
@@ -354,14 +399,16 @@ |
|
|
addColor: function(color) {
|
|
|
let findColorIndex = this.table.selectedColors.findIndex((c) => {
|
|
|
return c.id === color.id;
|
|
|
})
|
|
|
});
|
|
|
|
|
|
if (findColorIndex !== -1) {
|
|
|
this.removeColorData(color);
|
|
|
this.table.selectedColors.splice(findColorIndex, 1)
|
|
|
this.table.selectedColors.splice(findColorIndex, 1);
|
|
|
color.selected = false;
|
|
|
} else {
|
|
|
this.addColorData(color);
|
|
|
this.table.selectedColors.push(color)
|
|
|
this.table.selectedColors.push(color);
|
|
|
color.selected = true;
|
|
|
}
|
|
|
|
|
|
this.initDefault();
|
...
|
...
|
@@ -389,8 +436,7 @@ |
|
|
removeSize: function(color, sizeId) {
|
|
|
let index = color.sizeId.findIndex((s) => {
|
|
|
return s.id === sizeId;
|
|
|
})
|
|
|
|
|
|
});
|
|
|
|
|
|
if (index !== -1) {
|
|
|
color.sizeId.splice(index, 1);
|
...
|
...
|
@@ -411,12 +457,12 @@ |
|
|
sizeId: [],
|
|
|
sizeCode: [],
|
|
|
operator: []
|
|
|
}
|
|
|
};
|
|
|
|
|
|
if (this.table.selectedSizes.length > 0) {
|
|
|
this.table.selectedSizes.forEach((sizeId) => {
|
|
|
this.addSize(newColor, sizeId)
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
|
|
|
this.table.data.push(newColor);
|
...
|
...
|
@@ -465,6 +511,16 @@ |
|
|
}
|
|
|
|
|
|
return false;
|
|
|
},
|
|
|
submit: function() {
|
|
|
api.saveBaseProductInfo(this.product).then((result) => {
|
|
|
if (result.code === 200) {
|
|
|
console.log(result.data);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
beforeSubmit: function() {
|
|
|
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
...
|
...
|
@@ -486,6 +542,9 @@ |
|
|
this.removeSize(color, removeSize[0]);
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
'ageLevel': function() {
|
|
|
this.product.ageLevel = this.ageLevel.join('|');
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -522,7 +581,10 @@ |
|
|
display: inline-block;
|
|
|
height: 30px;
|
|
|
width: 30px;
|
|
|
border: 1px solid gainsboro;
|
|
|
}
|
|
|
|
|
|
.squre-color-selected {
|
|
|
border: 2px solid black;
|
|
|
}
|
|
|
|
|
|
.squre-name {
|
...
|
...
|
|