...
|
...
|
@@ -104,45 +104,14 @@ |
|
|
</Col>
|
|
|
</Row>
|
|
|
|
|
|
<Row>
|
|
|
<div class="ivu-form-item ivu-form-item-required">
|
|
|
<label class="ivu-form-item-label" style="width: 70px;"> 颜色</label>
|
|
|
<div :class="{'product-table-error' : table.showValidateColor}" style="margin-left: 70px;">
|
|
|
<span class='squre'
|
|
|
v-for="color in colors"
|
|
|
@click="clickColor(color)"
|
|
|
:class="{
|
|
|
'squre-selected': color.selected,
|
|
|
'squre-disabled': color.disabled
|
|
|
}">
|
|
|
<span class="squre-color"
|
|
|
:style="{ 'background-color': '#' + color.colorCode}">
|
|
|
</span>
|
|
|
<span class="squre-name">{{color.colorName}}</span>
|
|
|
</span>
|
|
|
</div>
|
|
|
<div class="product-table-tip" v-if="table.showValidateColor">颜色必须选择</div>
|
|
|
</div>
|
|
|
</Row>
|
|
|
|
|
|
<Row>
|
|
|
<div class="ivu-form-item ivu-form-item-required">
|
|
|
<label class="ivu-form-item-label" style="width: 70px;">尺寸</label>
|
|
|
<div :class="{
|
|
|
'ivu-form-item-content': true,
|
|
|
'product-table-error': table.showValidateSize
|
|
|
}"
|
|
|
style="margin-left: 70px;"
|
|
|
>
|
|
|
<Checkbox-group v-model='table.selectedSizes'>
|
|
|
<Checkbox v-for="size in sizes" :key="size" :label="size.id" >
|
|
|
<span>{{size.sizeName}}</span>
|
|
|
</Checkbox>
|
|
|
</Checkbox-group>
|
|
|
</div>
|
|
|
<div class="product-table-tip" v-if="table.showValidateSize">尺码必须选择</div>
|
|
|
</div>
|
|
|
</Row>
|
|
|
<Form-item label="颜色">
|
|
|
<CheckboxColor @on-add="addColor" @on-remove="removeColor"></CheckboxColor>
|
|
|
</Form-item>
|
|
|
|
|
|
<Form-item label="尺寸">
|
|
|
<CheckboxSize :sort-id="product.smallSortId"></CheckboxSize>
|
|
|
</Form-item>
|
|
|
|
|
|
<Row>
|
|
|
<Form-item >
|
...
|
...
|
@@ -190,7 +159,7 @@ |
|
|
import _ from 'lodash';
|
|
|
import api from 'product-create/api';
|
|
|
import service from 'product-create/service';
|
|
|
import {CheckboxAge} from 'components/checkbox';
|
|
|
import {CheckboxAge, CheckboxColor, CheckboxSize} from 'components/checkbox';
|
|
|
import {RadioSeason, RadioGender} from 'components/radio';
|
|
|
import {SelectSeason} from 'components/select';
|
|
|
|
...
|
...
|
@@ -206,8 +175,6 @@ const makeColor = () => { |
|
|
};
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
props: ['step', 'product'],
|
|
|
data() {
|
...
|
...
|
@@ -411,8 +378,6 @@ export default { |
|
|
};
|
|
|
},
|
|
|
mounted: function() {
|
|
|
this.getColorAsync();
|
|
|
this.getSizeAsync();
|
|
|
},
|
|
|
methods: {
|
|
|
beforeSubmit: function() {
|
...
|
...
|
@@ -489,23 +454,6 @@ export default { |
|
|
this.step.value = 0;
|
|
|
this.$router.push({name: 'product.create.step1'});
|
|
|
},
|
|
|
getColorAsync: function() {
|
|
|
return api.getColor().then((result) => {
|
|
|
if (result.code === 200) {
|
|
|
this.colors = result.data;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
getSizeAsync: function() {
|
|
|
return api.getSize(this.product.smallSortId).then((result) => {
|
|
|
if (result.code === 200) {
|
|
|
this.sizes = result.data;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
clickColor: function(color) {
|
|
|
this.addColor(color);
|
|
|
},
|
|
|
clickDefault: function(index) {
|
|
|
this.refreshTable();
|
|
|
let color = this.table.data[index];
|
...
|
...
|
@@ -570,6 +518,11 @@ export default { |
|
|
},
|
|
|
addColor: function(color) {
|
|
|
this.refreshTable();
|
|
|
this.addColorData(color);
|
|
|
this.table.selectedColors.push(color);
|
|
|
this.initDefault();
|
|
|
},
|
|
|
removeColor(color) {
|
|
|
let findColorIndex = this.table.selectedColors.findIndex((c) => {
|
|
|
return c.id === color.id;
|
|
|
});
|
...
|
...
|
@@ -577,14 +530,7 @@ export default { |
|
|
if (findColorIndex !== -1) {
|
|
|
this.removeColorData(color);
|
|
|
this.table.selectedColors.splice(findColorIndex, 1);
|
|
|
color.selected = false;
|
|
|
} else {
|
|
|
this.addColorData(color);
|
|
|
this.table.selectedColors.push(color);
|
|
|
color.selected = true;
|
|
|
}
|
|
|
|
|
|
this.initDefault();
|
|
|
},
|
|
|
addColorData: function(color) {
|
|
|
let newColor = {
|
...
|
...
|
@@ -830,6 +776,8 @@ export default { |
|
|
RadioSeason,
|
|
|
RadioGender,
|
|
|
SelectSeason,
|
|
|
CheckboxColor,
|
|
|
CheckboxSize
|
|
|
}
|
|
|
};
|
|
|
</script>
|
...
|
...
|
|