|
@@ -104,45 +104,14 @@ |
|
@@ -104,45 +104,14 @@ |
104
|
</Col>
|
104
|
</Col>
|
105
|
</Row>
|
105
|
</Row>
|
106
|
|
106
|
|
107
|
- <Row>
|
|
|
108
|
- <div class="ivu-form-item ivu-form-item-required">
|
|
|
109
|
- <label class="ivu-form-item-label" style="width: 70px;"> 颜色</label>
|
|
|
110
|
- <div :class="{'product-table-error' : table.showValidateColor}" style="margin-left: 70px;">
|
|
|
111
|
- <span class='squre'
|
|
|
112
|
- v-for="color in colors"
|
|
|
113
|
- @click="clickColor(color)"
|
|
|
114
|
- :class="{
|
|
|
115
|
- 'squre-selected': color.selected,
|
|
|
116
|
- 'squre-disabled': color.disabled
|
|
|
117
|
- }">
|
|
|
118
|
- <span class="squre-color"
|
|
|
119
|
- :style="{ 'background-color': '#' + color.colorCode}">
|
|
|
120
|
- </span>
|
|
|
121
|
- <span class="squre-name">{{color.colorName}}</span>
|
|
|
122
|
- </span>
|
|
|
123
|
- </div>
|
|
|
124
|
- <div class="product-table-tip" v-if="table.showValidateColor">颜色必须选择</div>
|
|
|
125
|
- </div>
|
|
|
126
|
- </Row>
|
|
|
127
|
|
107
|
|
128
|
- <Row>
|
|
|
129
|
- <div class="ivu-form-item ivu-form-item-required">
|
|
|
130
|
- <label class="ivu-form-item-label" style="width: 70px;">尺寸</label>
|
|
|
131
|
- <div :class="{
|
|
|
132
|
- 'ivu-form-item-content': true,
|
|
|
133
|
- 'product-table-error': table.showValidateSize
|
|
|
134
|
- }"
|
|
|
135
|
- style="margin-left: 70px;"
|
|
|
136
|
- >
|
|
|
137
|
- <Checkbox-group v-model='table.selectedSizes'>
|
|
|
138
|
- <Checkbox v-for="size in sizes" :key="size" :label="size.id" >
|
|
|
139
|
- <span>{{size.sizeName}}</span>
|
|
|
140
|
- </Checkbox>
|
|
|
141
|
- </Checkbox-group>
|
|
|
142
|
- </div>
|
|
|
143
|
- <div class="product-table-tip" v-if="table.showValidateSize">尺码必须选择</div>
|
|
|
144
|
- </div>
|
|
|
145
|
- </Row>
|
108
|
+ <Form-item label="颜色">
|
|
|
109
|
+ <CheckboxColor @on-add="addColor" @on-remove="removeColor"></CheckboxColor>
|
|
|
110
|
+ </Form-item>
|
|
|
111
|
+
|
|
|
112
|
+ <Form-item label="尺寸">
|
|
|
113
|
+ <CheckboxSize :sort-id="product.smallSortId"></CheckboxSize>
|
|
|
114
|
+ </Form-item>
|
146
|
|
115
|
|
147
|
<Row>
|
116
|
<Row>
|
148
|
<Form-item >
|
117
|
<Form-item >
|
|
@@ -190,7 +159,7 @@ |
|
@@ -190,7 +159,7 @@ |
190
|
import _ from 'lodash';
|
159
|
import _ from 'lodash';
|
191
|
import api from 'product-create/api';
|
160
|
import api from 'product-create/api';
|
192
|
import service from 'product-create/service';
|
161
|
import service from 'product-create/service';
|
193
|
-import {CheckboxAge} from 'components/checkbox';
|
162
|
+import {CheckboxAge, CheckboxColor, CheckboxSize} from 'components/checkbox';
|
194
|
import {RadioSeason, RadioGender} from 'components/radio';
|
163
|
import {RadioSeason, RadioGender} from 'components/radio';
|
195
|
import {SelectSeason} from 'components/select';
|
164
|
import {SelectSeason} from 'components/select';
|
196
|
|
165
|
|
|
@@ -206,8 +175,6 @@ const makeColor = () => { |
|
@@ -206,8 +175,6 @@ const makeColor = () => { |
206
|
};
|
175
|
};
|
207
|
};
|
176
|
};
|
208
|
|
177
|
|
209
|
-
|
|
|
210
|
-
|
|
|
211
|
export default {
|
178
|
export default {
|
212
|
props: ['step', 'product'],
|
179
|
props: ['step', 'product'],
|
213
|
data() {
|
180
|
data() {
|
|
@@ -411,8 +378,6 @@ export default { |
|
@@ -411,8 +378,6 @@ export default { |
411
|
};
|
378
|
};
|
412
|
},
|
379
|
},
|
413
|
mounted: function() {
|
380
|
mounted: function() {
|
414
|
- this.getColorAsync();
|
|
|
415
|
- this.getSizeAsync();
|
|
|
416
|
},
|
381
|
},
|
417
|
methods: {
|
382
|
methods: {
|
418
|
beforeSubmit: function() {
|
383
|
beforeSubmit: function() {
|
|
@@ -489,23 +454,6 @@ export default { |
|
@@ -489,23 +454,6 @@ export default { |
489
|
this.step.value = 0;
|
454
|
this.step.value = 0;
|
490
|
this.$router.push({name: 'product.create.step1'});
|
455
|
this.$router.push({name: 'product.create.step1'});
|
491
|
},
|
456
|
},
|
492
|
- getColorAsync: function() {
|
|
|
493
|
- return api.getColor().then((result) => {
|
|
|
494
|
- if (result.code === 200) {
|
|
|
495
|
- this.colors = result.data;
|
|
|
496
|
- }
|
|
|
497
|
- });
|
|
|
498
|
- },
|
|
|
499
|
- getSizeAsync: function() {
|
|
|
500
|
- return api.getSize(this.product.smallSortId).then((result) => {
|
|
|
501
|
- if (result.code === 200) {
|
|
|
502
|
- this.sizes = result.data;
|
|
|
503
|
- }
|
|
|
504
|
- });
|
|
|
505
|
- },
|
|
|
506
|
- clickColor: function(color) {
|
|
|
507
|
- this.addColor(color);
|
|
|
508
|
- },
|
|
|
509
|
clickDefault: function(index) {
|
457
|
clickDefault: function(index) {
|
510
|
this.refreshTable();
|
458
|
this.refreshTable();
|
511
|
let color = this.table.data[index];
|
459
|
let color = this.table.data[index];
|
|
@@ -570,6 +518,11 @@ export default { |
|
@@ -570,6 +518,11 @@ export default { |
570
|
},
|
518
|
},
|
571
|
addColor: function(color) {
|
519
|
addColor: function(color) {
|
572
|
this.refreshTable();
|
520
|
this.refreshTable();
|
|
|
521
|
+ this.addColorData(color);
|
|
|
522
|
+ this.table.selectedColors.push(color);
|
|
|
523
|
+ this.initDefault();
|
|
|
524
|
+ },
|
|
|
525
|
+ removeColor(color) {
|
573
|
let findColorIndex = this.table.selectedColors.findIndex((c) => {
|
526
|
let findColorIndex = this.table.selectedColors.findIndex((c) => {
|
574
|
return c.id === color.id;
|
527
|
return c.id === color.id;
|
575
|
});
|
528
|
});
|
|
@@ -577,14 +530,7 @@ export default { |
|
@@ -577,14 +530,7 @@ export default { |
577
|
if (findColorIndex !== -1) {
|
530
|
if (findColorIndex !== -1) {
|
578
|
this.removeColorData(color);
|
531
|
this.removeColorData(color);
|
579
|
this.table.selectedColors.splice(findColorIndex, 1);
|
532
|
this.table.selectedColors.splice(findColorIndex, 1);
|
580
|
- color.selected = false;
|
|
|
581
|
- } else {
|
|
|
582
|
- this.addColorData(color);
|
|
|
583
|
- this.table.selectedColors.push(color);
|
|
|
584
|
- color.selected = true;
|
|
|
585
|
}
|
533
|
}
|
586
|
-
|
|
|
587
|
- this.initDefault();
|
|
|
588
|
},
|
534
|
},
|
589
|
addColorData: function(color) {
|
535
|
addColorData: function(color) {
|
590
|
let newColor = {
|
536
|
let newColor = {
|
|
@@ -830,6 +776,8 @@ export default { |
|
@@ -830,6 +776,8 @@ export default { |
830
|
RadioSeason,
|
776
|
RadioSeason,
|
831
|
RadioGender,
|
777
|
RadioGender,
|
832
|
SelectSeason,
|
778
|
SelectSeason,
|
|
|
779
|
+ CheckboxColor,
|
|
|
780
|
+ CheckboxSize
|
833
|
}
|
781
|
}
|
834
|
};
|
782
|
};
|
835
|
</script>
|
783
|
</script>
|