step2.vue
9.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<template>
<div>
<Form :model="product" :label-width="80">
<Row>
<Col span="8">
<Form-item>
<span>商品基本信息</span>
</Form-item>
</Col>
</Row>
<Row>
<Col span="8">
<Form-item label="品 牌*">
<span>{{product.brandName}}</span>
</Form-item>
</Col>
</Row>
<Row>
<Col span="8">
<Form-item label="类目*">
<span>{{product.sortName}}</span>
</Form-item>
</Col>
</Row>
<Row>
<Col span="8">
<Form-item label="商品名称*">
<Input v-model="product.productName" placeholder="请输入..."/>
</Form-item>
</Col>
</Row>
<Row>
<Col span="8">
<Form-item label="商品卖点*">
<Input v-model="product.phrase" type="textarea" :rows="4" placeholder="请输入..."/>
</Form-item>
</Col>
</Row>
<Row>
<Col span="8">
<Form-item label="商品编码*">
<Input v-model="product.factoryCode" placeholder="请输入..."/>
</Form-item>
</Col>
</Row>
<Row>
<Col span="8">
<Form-item label="货品年*">
<Date-picker type="year" placeholder="选择年" style="width: 200px"></Date-picker>
</Form-item>
</Col>
</Row>
<Row>
<Col span="8">
<Form-item label="货品季*">
<Select v-model="product.goodsSeason" placeholder="请选择">
<Option value="1">春季</Option>
<Option value="2">夏季</Option>
<Option value="3">秋季</Option>
<Option value="4">冬季</Option>
<Option value="5">春夏季</Option>
<Option value="6">秋冬季</Option>
</Select>
</Form-item>
</Col>
</Row>
<Row>
<Col span="8">
<Form-item label="上市日期*">
<Date-picker type="date" placeholder="选择日期" style="width: 200px"></Date-picker>
</Form-item>
</Col>
</Row>
<Form-item label="性别*">
<Radio-group v-model="product.gender">
<Radio label="1">
<span>男</span>
</Radio>
<Radio label="2">
<span>女</span>
</Radio>
<Radio label="3">
<span>通用</span>
</Radio>
</Radio-group>
</Form-item>
<Form-item label="适销季*">
<Radio-group v-model="product.seasons">
<Radio label="1">
<span>春秋</span>
</Radio>
<Radio label="2">
<span>夏</span>
</Radio>
<Radio label="3">
<span>冬</span>
</Radio>
<Radio label="4">
<span>四季</span>
</Radio>
</Radio-group>
</Form-item>
<Form-item label="年龄层*">
<Checkbox-group v-model="product.ageLevel">
<Checkbox label="1">
<span>成人</span>
</Checkbox>
<Checkbox label="2">
<span>大童</span>
</Checkbox>
<Checkbox label="4">
<span>中童</span>
</Checkbox>
<Checkbox label="3">
<span>小童</span>
</Checkbox>
<Checkbox label="5">
<span>幼童 </span>
</Checkbox>
</Checkbox-group>
</Form-item>
<Row>
<Col span="8">
<span>商品规格</span>
</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-name">{{color.colorName}}</span>
</span>
</Form-item>
</Row>
<Row>
<Form-item label="尺寸*">
<Checkbox-group v-model="table.selectedSizes" @on-change="clickSize">
<Checkbox v-for="size in sizes" :key="size" :label="size.id" >
<span>{{size.sizeName}}</span>
</Checkbox>
</Checkbox-group>
</Form-item>
</Row>
<Row>
<Form-item >
<Table :columns="table.columns" :data="table.data"></Table>
</Form-item>
</Row>
<Row>
<Col span="8">
<Form-item>
<span>商品价格</span>
</Form-item>
</Col>
</Row>
<Row>
<Col span="8">
<Form-item label="吊牌价*">
<Input v-model="product.retailPrice" placeholder="请输入..."/>
</Form-item>
</Col>
</Row>
<Row>
<Col span="8">
<Form-item label="销售价*">
<Input v-model="product.salesPrice" placeholder="请输入..."/>
</Form-item>
</Col>
</Row>
</Form>
<div>
<Button type="primary" @click="backStep">上一步</Button>
<Button type="primary" @click="nextStep">下一步</Button>
</div>
</div>
</template>
<script>
import api from '../api';
export default {
props: ['step', 'product'],
data() {
return {
colors: [],
sizes: [],
table: {
columns: [
{
title: '色系名称',
key: 'colorName'
},
{
title: '颜色展示名称*',
key: 'color'
},
{
title: '色卡图片*',
key: 'address'
},
{
title: '类型编码',
key: 'name'
},
{
title: '尺码*',
key: 'age'
},
{
title: '商品条码*',
key: 'address'
},
{
title: '操作',
key: 'address'
}
],
data: [
],
selectedSizes: [],
selectedColors: []
}
}
},
mounted: function() {
console.log(this.product);
this.getColor();
this.getSize();
},
methods: {
nextStep: function() {
this.step.value = 2;
this.$router.push({name:'product.create.step3'})
},
backStep: function() {
this.step.value = 0;
this.$router.push({name:'product.create.step1'})
},
getColor: function() {
return api.getColor().then((result) => {
if (result.code === 200) {
this.colors = result.data;
}
});
},
getSize: function() {
return api.getSize(119).then((result) => {
if(result.code === 200) {
this.sizes = result.data;
}
});
},
clickColor: function(color) {
console.log(color)
},
clickSize: function(size) {
console.log(size);
},
},
watch: {
'table.selectedSizes': function() {
console.log(this.table.selectedSizes);
}
}
}
</script>
<style lang="scss" scoped>
.squre {
display: inline-block;
height: 30px;
margin-right: 10px;
cursor: pointer;
}
.squre-color {
display: inline-block;
height: 30px;
width: 30px;
border: 1px solid gainsboro;
}
.squre-name {
display: inline-block;
height: 30px;
line-height: 30px;
vertical-align: top;
}
</style>