|
@@ -1,16 +1,40 @@
|
1
|
1
|
<template>
|
2
|
|
- <div class="page" :class="{'page--iphoneX': iphoneX}">
|
|
2
|
+ <div class="page" :class="{ 'page--iphoneX': iphoneX }">
|
3
|
3
|
<div class="form-card">
|
|
4
|
+ <div class="head">
|
|
5
|
+ <div class="tit">基本信息</div>
|
|
6
|
+ <div class="switch"></div>
|
|
7
|
+ </div>
|
4
|
8
|
<section class="form-item">
|
5
|
9
|
<div class="label">
|
6
|
10
|
<span class="required">*</span>
|
|
11
|
+ 店铺:
|
|
12
|
+ </div>
|
|
13
|
+ <div class="box">
|
|
14
|
+ <picker
|
|
15
|
+ :mode="'selector'"
|
|
16
|
+ :range="storeList"
|
|
17
|
+ :range-key="'name'"
|
|
18
|
+ @change="pickerStoreChange"
|
|
19
|
+ >
|
|
20
|
+ <input
|
|
21
|
+ type="text"
|
|
22
|
+ v-model="baseInfo._storeName"
|
|
23
|
+ :disabled="true"
|
|
24
|
+ placeholder="请选择"
|
|
25
|
+ />
|
|
26
|
+ </picker>
|
|
27
|
+ </div>
|
|
28
|
+ </section>
|
|
29
|
+ <section class="form-item">
|
|
30
|
+ <div class="label">
|
|
31
|
+ <span class="required hide">*</span>
|
7
|
32
|
商品条码:
|
8
|
33
|
</div>
|
9
|
34
|
<div class="box">
|
10
|
|
- <input type="text" />
|
|
35
|
+ <input type="text" v-model="baseInfo.barCode" />
|
11
|
36
|
</div>
|
12
|
37
|
<div class="tool code-tool">
|
13
|
|
- <span class="generate">生成</span>
|
14
|
38
|
<my-image
|
15
|
39
|
class="scan-img"
|
16
|
40
|
@click="scan"
|
|
@@ -18,73 +42,215 @@
|
18
|
42
|
></my-image>
|
19
|
43
|
</div>
|
20
|
44
|
</section>
|
|
45
|
+
|
|
46
|
+ <section class="form-item">
|
|
47
|
+ <div class="label">
|
|
48
|
+ <span class="required">*</span>
|
|
49
|
+ 商品标题:
|
|
50
|
+ </div>
|
|
51
|
+ <div class="box">
|
|
52
|
+ <input type="text" v-model="baseInfo.name" />
|
|
53
|
+ </div>
|
|
54
|
+ </section>
|
|
55
|
+
|
21
|
56
|
<section class="form-item">
|
22
|
57
|
<div class="label">
|
23
|
58
|
<span class="required">*</span>
|
24
|
|
- 商品名称:
|
|
59
|
+ 商品编码:
|
|
60
|
+ </div>
|
|
61
|
+ <div class="box">
|
|
62
|
+ <input type="text" v-model="baseInfo.code" />
|
|
63
|
+ </div>
|
|
64
|
+ <div class="tool code-tool">
|
|
65
|
+ <span class="generate" @click="generateCode('code')"
|
|
66
|
+ >生成</span
|
|
67
|
+ >
|
|
68
|
+ </div>
|
|
69
|
+ </section>
|
|
70
|
+
|
|
71
|
+ <section class="form-item">
|
|
72
|
+ <div class="label">
|
|
73
|
+ <span class="required hide">*</span>
|
|
74
|
+ 商品描述:
|
25
|
75
|
</div>
|
26
|
76
|
<div class="box">
|
27
|
|
- <input type="text" />
|
|
77
|
+ <textarea
|
|
78
|
+ v-model="baseInfo.description"
|
|
79
|
+ :maxlength="1048"
|
|
80
|
+ :auto-height="true"
|
|
81
|
+ ></textarea>
|
28
|
82
|
</div>
|
29
|
83
|
</section>
|
|
84
|
+
|
30
|
85
|
<section class="form-item">
|
31
|
86
|
<div class="label">
|
32
|
87
|
<span class="required">*</span>
|
33
|
88
|
分类:
|
34
|
89
|
</div>
|
35
|
90
|
<div class="box">
|
36
|
|
- <picker :mode="'multiSelector'" :range="cateList">
|
37
|
|
- <input
|
38
|
|
- type="text"
|
39
|
|
- :disabled="true"
|
40
|
|
- placeholder="请选择"
|
41
|
|
- />
|
42
|
|
- </picker>
|
|
91
|
+ <div
|
|
92
|
+ class="type-tip"
|
|
93
|
+ v-if="cateList.length === 0"
|
|
94
|
+ @touchstart.stop
|
|
95
|
+ >
|
|
96
|
+ 请先选择店铺
|
|
97
|
+ </div>
|
|
98
|
+ <div
|
|
99
|
+ class="type-item"
|
|
100
|
+ v-for="(item, index) of typeList"
|
|
101
|
+ :key="index"
|
|
102
|
+ >
|
|
103
|
+ <picker
|
|
104
|
+ :mode="'multiSelector'"
|
|
105
|
+ :range="cateList"
|
|
106
|
+ :range-key="'name'"
|
|
107
|
+ @columnchange="typeColumnchange"
|
|
108
|
+ @change="pickerTypeChange($event, index)"
|
|
109
|
+ >
|
|
110
|
+ <input
|
|
111
|
+ type="text"
|
|
112
|
+ :disabled="true"
|
|
113
|
+ :value="item.name"
|
|
114
|
+ placeholder="请选择"
|
|
115
|
+ />
|
|
116
|
+ </picker>
|
|
117
|
+ <span class="remove-text" @click="typeRemove(index)"
|
|
118
|
+ >删除</span
|
|
119
|
+ >
|
|
120
|
+ </div>
|
|
121
|
+ <div class="add-type" @click="addType">增加分类</div>
|
43
|
122
|
</div>
|
44
|
123
|
</section>
|
|
124
|
+ </div>
|
|
125
|
+ <div class="form-card">
|
|
126
|
+ <div class="head">
|
|
127
|
+ <div class="tit">规格库存</div>
|
|
128
|
+ <div class="switch"></div>
|
|
129
|
+ </div>
|
|
130
|
+
|
45
|
131
|
<section class="form-item">
|
46
|
132
|
<div class="label">
|
47
|
133
|
<span class="required">*</span>
|
48
|
|
- 重量:
|
|
134
|
+ 价格:
|
49
|
135
|
</div>
|
50
|
136
|
<div class="box">
|
51
|
|
- <input type="digit" />
|
|
137
|
+ <input type="digit" v-model="baseInfo.price" />
|
52
|
138
|
</div>
|
53
|
139
|
<div class="tool">
|
54
|
|
- <span class="">kg</span>
|
|
140
|
+ <span class="">元</span>
|
55
|
141
|
</div>
|
56
|
142
|
</section>
|
|
143
|
+
|
57
|
144
|
<section class="form-item">
|
58
|
145
|
<div class="label">
|
59
|
|
- <span class="required">*</span>
|
60
|
|
- 售价:
|
|
146
|
+ <span class="required hide">*</span>
|
|
147
|
+ 进货价:
|
61
|
148
|
</div>
|
62
|
149
|
<div class="box">
|
63
|
|
- <input type="digit" />
|
|
150
|
+ <input type="digit" v-model="baseInfo.supplyPrice" />
|
64
|
151
|
</div>
|
65
|
152
|
<div class="tool">
|
66
|
153
|
<span class="">元</span>
|
67
|
154
|
</div>
|
68
|
155
|
</section>
|
|
156
|
+
|
69
|
157
|
<section class="form-item">
|
70
|
158
|
<div class="label">
|
71
|
|
- <span class="required">*</span>
|
|
159
|
+ <span class="required hide">*</span>
|
|
160
|
+ 成本:
|
|
161
|
+ </div>
|
|
162
|
+ <div class="box">
|
|
163
|
+ <input type="digit" v-model="baseInfo.cost" />
|
|
164
|
+ </div>
|
|
165
|
+ <div class="tool">
|
|
166
|
+ <span class="">元</span>
|
|
167
|
+ </div>
|
|
168
|
+ </section>
|
|
169
|
+
|
|
170
|
+ <section class="form-item">
|
|
171
|
+ <div class="label">
|
|
172
|
+ <span class="required hide">*</span>
|
72
|
173
|
划线价:
|
73
|
174
|
</div>
|
74
|
175
|
<div class="box">
|
75
|
|
- <input type="digit" />
|
|
176
|
+ <input type="digit" v-model="baseInfo.tagPrice" />
|
76
|
177
|
</div>
|
77
|
178
|
<div class="tool">
|
78
|
179
|
<span class="">元</span>
|
79
|
180
|
</div>
|
80
|
181
|
</section>
|
|
182
|
+
|
|
183
|
+ <section class="form-item">
|
|
184
|
+ <div class="label">
|
|
185
|
+ <span class="required">*</span>
|
|
186
|
+ 重量:
|
|
187
|
+ </div>
|
|
188
|
+ <div class="box">
|
|
189
|
+ <input type="digit" v-model="baseInfo.weight" />
|
|
190
|
+ </div>
|
|
191
|
+ <div class="tool">
|
|
192
|
+ <span class="">克</span>
|
|
193
|
+ </div>
|
|
194
|
+ </section>
|
|
195
|
+
|
81
|
196
|
<section class="form-item">
|
82
|
197
|
<div class="label">
|
83
|
198
|
<span class="required">*</span>
|
84
|
199
|
库存:
|
85
|
200
|
</div>
|
86
|
201
|
<div class="box">
|
87
|
|
- <input type="number" />
|
|
202
|
+ <input type="digit" v-model="baseInfo.stock" />
|
|
203
|
+ </div>
|
|
204
|
+ </section>
|
|
205
|
+
|
|
206
|
+ <section class="form-item">
|
|
207
|
+ <div class="label">
|
|
208
|
+ <span class="required">*</span>
|
|
209
|
+ sku编码:
|
|
210
|
+ </div>
|
|
211
|
+ <div class="box">
|
|
212
|
+ <input type="digit" v-model="baseInfo.skuCode" />
|
|
213
|
+ </div>
|
|
214
|
+ <div class="tool code-tool">
|
|
215
|
+ <span class="generate" @click="generateCode('skuCode')"
|
|
216
|
+ >生成</span
|
|
217
|
+ >
|
|
218
|
+ </div>
|
|
219
|
+ </section>
|
|
220
|
+ </div>
|
|
221
|
+
|
|
222
|
+ <div class="form-card img-card">
|
|
223
|
+ <section class="form-img-item">
|
|
224
|
+ <div class="tit"><span class="required">*</span>主图</div>
|
|
225
|
+ <div class="list">
|
|
226
|
+ <easy-upload
|
|
227
|
+ :types="'image'"
|
|
228
|
+ v-model="baseInfo.mainImg"
|
|
229
|
+ :uploadCount="1"
|
|
230
|
+ @change="minImgChange"
|
|
231
|
+ ></easy-upload>
|
|
232
|
+ </div>
|
|
233
|
+ </section>
|
|
234
|
+ <section class="form-img-item">
|
|
235
|
+ <div class="tit"><span class="required">*</span>封面图</div>
|
|
236
|
+ <div class="list">
|
|
237
|
+ <easy-upload
|
|
238
|
+ :types="'image'"
|
|
239
|
+ v-model="productForm.images"
|
|
240
|
+ :uploadCount="100"
|
|
241
|
+ @change="imagesChange"
|
|
242
|
+ ></easy-upload>
|
|
243
|
+ </div>
|
|
244
|
+ </section>
|
|
245
|
+ <section class="form-img-item">
|
|
246
|
+ <div class="tit"><span class="required">*</span>详情图</div>
|
|
247
|
+ <div class="list">
|
|
248
|
+ <easy-upload
|
|
249
|
+ :types="'image'"
|
|
250
|
+ v-model="productForm.detailImages"
|
|
251
|
+ :uploadCount="100"
|
|
252
|
+ @change="detailImagesChange"
|
|
253
|
+ ></easy-upload>
|
88
|
254
|
</div>
|
89
|
255
|
</section>
|
90
|
256
|
</div>
|
|
@@ -105,11 +271,17 @@
|
105
|
271
|
<div class="box">
|
106
|
272
|
<radio-group @change="tempChange">
|
107
|
273
|
<label>
|
108
|
|
- <radio :value="true" />
|
|
274
|
+ <radio
|
|
275
|
+ :value="true"
|
|
276
|
+ :checked="productForm.useTemplate === true"
|
|
277
|
+ />
|
109
|
278
|
<text>是</text>
|
110
|
279
|
</label>
|
111
|
280
|
<label>
|
112
|
|
- <radio :value="false" />
|
|
281
|
+ <radio
|
|
282
|
+ :value="false"
|
|
283
|
+ :checked="productForm.useTemplate === false"
|
|
284
|
+ />
|
113
|
285
|
<text>否</text>
|
114
|
286
|
</label>
|
115
|
287
|
</radio-group>
|
|
@@ -117,11 +289,11 @@
|
117
|
289
|
</section>
|
118
|
290
|
<section class="form-item">
|
119
|
291
|
<div class="label">
|
120
|
|
- <span class="required">*</span>
|
|
292
|
+ <span class="required hide">*</span>
|
121
|
293
|
初始销量:
|
122
|
294
|
</div>
|
123
|
295
|
<div class="box">
|
124
|
|
- <input type="number" />
|
|
296
|
+ <input type="number" v-model="baseInfo.initialSale" />
|
125
|
297
|
</div>
|
126
|
298
|
</section>
|
127
|
299
|
<section class="form-item">
|
|
@@ -130,56 +302,52 @@
|
130
|
302
|
出售方式:
|
131
|
303
|
</div>
|
132
|
304
|
<div class="box">
|
133
|
|
- <picker :mode="'selector'" :range="sellType">
|
134
|
|
- <input type="text" :disabled="true" placeholder="请选择"/>
|
|
305
|
+ <picker
|
|
306
|
+ :mode="'selector'"
|
|
307
|
+ :range="sellType"
|
|
308
|
+ :range-key="'key'"
|
|
309
|
+ @change="pickerStatusChange"
|
|
310
|
+ >
|
|
311
|
+ <input
|
|
312
|
+ type="text"
|
|
313
|
+ :disabled="true"
|
|
314
|
+ v-model="baseInfo._statusName"
|
|
315
|
+ placeholder="请选择"
|
|
316
|
+ />
|
135
|
317
|
</picker>
|
136
|
318
|
</div>
|
137
|
319
|
</section>
|
138
|
320
|
<section class="form-item">
|
139
|
321
|
<div class="label">
|
140
|
|
- <span class="required">*</span>
|
|
322
|
+ <span class="required hide">*</span>
|
141
|
323
|
限购数:
|
142
|
324
|
</div>
|
143
|
325
|
<div class="box">
|
144
|
|
- <input type="number" />
|
|
326
|
+ <input
|
|
327
|
+ type="number"
|
|
328
|
+ v-model="baseInfo.maxBuyableCount"
|
|
329
|
+ />
|
145
|
330
|
</div>
|
146
|
331
|
</section>
|
147
|
|
- <section class="form-item">
|
|
332
|
+ <!-- <section class="form-item">
|
148
|
333
|
<div class="label">
|
149
|
334
|
<span class="required">*</span>
|
150
|
335
|
供应商:
|
151
|
336
|
</div>
|
152
|
337
|
<div class="box">
|
153
|
338
|
<picker :mode="'selector'" :range="supplierList">
|
154
|
|
- <input type="text" :disabled="true" placeholder="请选择"/>
|
|
339
|
+ <input
|
|
340
|
+ type="text"
|
|
341
|
+ :disabled="true"
|
|
342
|
+ placeholder="请选择"
|
|
343
|
+ />
|
155
|
344
|
</picker>
|
156
|
345
|
</div>
|
157
|
|
- </section>
|
|
346
|
+ </section> -->
|
158
|
347
|
</block>
|
159
|
348
|
</div>
|
160
|
349
|
|
161
|
|
- <div class="form-card img-card">
|
162
|
|
- <section class="form-img-item">
|
163
|
|
- <div class="tit">封面图</div>
|
164
|
|
- <div class="list">
|
165
|
|
- <easy-upload :types="'image'" :dataList="coverImg" :uploadUrl="'http://localhost:3000/upload'" :uploadCount="1" @successImage="successImage"></easy-upload>
|
166
|
|
- </div>
|
167
|
|
- </section>
|
168
|
|
- <section class="form-img-item">
|
169
|
|
- <div class="tit">主图</div>
|
170
|
|
- <div class="list">
|
171
|
|
- <easy-upload :types="'image'" :dataList="mainImg" :uploadUrl="'http://localhost:3000/upload'" :uploadCount="100" @successImage="successImage"></easy-upload>
|
172
|
|
- </div>
|
173
|
|
- </section>
|
174
|
|
- <section class="form-img-item">
|
175
|
|
- <div class="tit">详情图</div>
|
176
|
|
- <div class="list">
|
177
|
|
- <easy-upload :types="'image'" :dataList="detailImg" :uploadUrl="'http://localhost:3000/upload'" :uploadCount="100" @successImage="successImage"></easy-upload>
|
178
|
|
- </div>
|
179
|
|
- </section>
|
180
|
|
- </div>
|
181
|
|
-
|
182
|
|
- <button type="button" class="btn">保存</button>
|
|
350
|
+ <button type="button" class="btn" @click="save">保存</button>
|
183
|
351
|
</div>
|
184
|
352
|
</template>
|
185
|
353
|
|
|
@@ -189,30 +357,91 @@ import easyUpload from "../../components/easy-upload/easy-upload";
|
189
|
357
|
|
190
|
358
|
export default {
|
191
|
359
|
name: "",
|
192
|
|
- components: { MyImage,easyUpload },
|
|
360
|
+ components: { MyImage, easyUpload },
|
193
|
361
|
|
194
|
362
|
// 数据
|
195
|
363
|
data() {
|
196
|
364
|
return {
|
|
365
|
+ sellType: [
|
|
366
|
+ { key: "立即出售", value: 1 },
|
|
367
|
+ { key: "放入仓库", value: 0 },
|
|
368
|
+ ], // 出售方式
|
|
369
|
+ supplierList: ["测试供应商"], // 供应商
|
|
370
|
+ storeList: [], // 店铺列表
|
197
|
371
|
cateList: [], // 分类列表
|
198
|
|
- sellType:['立即开售','放入仓库'], // 出售方式
|
199
|
|
- supplierList:['测试供应商'], // 供应商
|
200
|
|
- showOther: true,
|
201
|
|
- mainImg:[],
|
202
|
|
- coverImg:[],
|
203
|
|
- detailImg:[],
|
|
372
|
+ showOther: true, // 显示其他
|
|
373
|
+
|
|
374
|
+ // 选中的分类列表
|
|
375
|
+ typeList: [{}],
|
|
376
|
+
|
|
377
|
+ // 基本信息表, _为前端临时用
|
|
378
|
+ baseInfo: {
|
|
379
|
+ storeId: "", // 店铺id
|
|
380
|
+ _storeName: "", // 店铺名 前台显示用
|
|
381
|
+ barCode: "", // 条码
|
|
382
|
+ name: "", // 标题
|
|
383
|
+ code: "", // 编码
|
|
384
|
+ description: "", // 描述
|
|
385
|
+ productTypeIds: [], // 分类
|
|
386
|
+
|
|
387
|
+ price: "", // 价格
|
|
388
|
+ supplyPrice: "", // 进货价
|
|
389
|
+ cost: "", // 成本
|
|
390
|
+ tagPrice: "", //划线价,单位为分
|
|
391
|
+ weight: "", //商品重量,单位为g
|
|
392
|
+ stock: "", // 库存
|
|
393
|
+ skuCode: "", // sku编码
|
|
394
|
+
|
|
395
|
+ initialSale: 0, // 初始销量
|
|
396
|
+ status: 1, // 出售方式 0-放入仓库(即没有上架),1-立即出售(即上架)
|
|
397
|
+ _statusName: "立即出售",
|
|
398
|
+ maxBuyableCount: 0, // 限购数
|
|
399
|
+
|
|
400
|
+ mainImage: "", // 主图 300 *300
|
|
401
|
+ },
|
|
402
|
+ productForm: {
|
|
403
|
+ useTemplate: false, // 是否使用模板
|
|
404
|
+
|
|
405
|
+ images: [], // 封面图
|
|
406
|
+ detailImages: [], // 详情图
|
|
407
|
+ },
|
|
408
|
+ mainImg: [],
|
|
409
|
+ coverImg: [],
|
|
410
|
+ detailImg: [],
|
204
|
411
|
};
|
205
|
412
|
},
|
206
|
|
-
|
207
|
|
- async onShow() {
|
208
|
|
- this.cateList = [
|
209
|
|
- [1, 2, 3, 4, 5],
|
210
|
|
- ["一", "二", "三", "四", "五"],
|
211
|
|
- ];
|
|
413
|
+ onLoad() {
|
|
414
|
+ this.getStore();
|
212
|
415
|
},
|
213
|
416
|
|
|
417
|
+ async onShow() {},
|
|
418
|
+
|
214
|
419
|
// 函数
|
215
|
420
|
methods: {
|
|
421
|
+ // 获取店铺
|
|
422
|
+ getStore() {
|
|
423
|
+ this.api.get("/Store/GetShopList").then((res) => {
|
|
424
|
+ this.storeList = res.data;
|
|
425
|
+ });
|
|
426
|
+ },
|
|
427
|
+
|
|
428
|
+ // 获取分类
|
|
429
|
+ getClassify(storeId) {
|
|
430
|
+ this.api
|
|
431
|
+ .get("/Product/GetProductType", {
|
|
432
|
+ storeId,
|
|
433
|
+ })
|
|
434
|
+ .then((res) => {
|
|
435
|
+ let arr = [res.data];
|
|
436
|
+ if (res.data[0].children) {
|
|
437
|
+ arr.push(res.data[0].children);
|
|
438
|
+ } else {
|
|
439
|
+ arr.push([]);
|
|
440
|
+ }
|
|
441
|
+ this.cateList = arr;
|
|
442
|
+ });
|
|
443
|
+ },
|
|
444
|
+
|
216
|
445
|
// 条码扫描
|
217
|
446
|
scan() {
|
218
|
447
|
let self = this;
|
|
@@ -226,10 +455,11 @@ export default {
|
226
|
455
|
});
|
227
|
456
|
},
|
228
|
457
|
|
229
|
|
- // 生成条码
|
230
|
|
- generateBarCode() {
|
|
458
|
+ // 生成编码
|
|
459
|
+ generateCode(file) {
|
231
|
460
|
// 后台编码生成方式
|
232
|
461
|
const timestamp = Date.parse(new Date());
|
|
462
|
+ this.baseInfo[file] = timestamp;
|
233
|
463
|
},
|
234
|
464
|
|
235
|
465
|
// 其他面板切换
|
|
@@ -241,14 +471,186 @@ export default {
|
241
|
471
|
tempChange(e) {
|
242
|
472
|
let val = e.target.value;
|
243
|
473
|
if (val === "true") {
|
|
474
|
+ this.productForm.useTemplate = true;
|
244
|
475
|
} else {
|
|
476
|
+ this.productForm.useTemplate = false;
|
245
|
477
|
}
|
246
|
478
|
},
|
247
|
479
|
|
248
|
|
- // 上传成功
|
249
|
|
- successImage(e){
|
250
|
|
- console.log(e);
|
251
|
|
- }
|
|
480
|
+ // 主图
|
|
481
|
+ minImgChange(e) {
|
|
482
|
+ this.baseInfo.mainImage = e[0] || "";
|
|
483
|
+ },
|
|
484
|
+
|
|
485
|
+ // 封面图
|
|
486
|
+ imagesChange(e) {
|
|
487
|
+ this.productForm.images = e;
|
|
488
|
+ },
|
|
489
|
+
|
|
490
|
+ // 详情图
|
|
491
|
+ detailImagesChange(e) {
|
|
492
|
+ this.productForm.detailImages = e;
|
|
493
|
+ },
|
|
494
|
+
|
|
495
|
+ // picker变化
|
|
496
|
+ // 店铺
|
|
497
|
+ pickerStoreChange(e) {
|
|
498
|
+ let index = e.target.value;
|
|
499
|
+ let val = this.storeList[index];
|
|
500
|
+ this.baseInfo.storeId = val.id;
|
|
501
|
+ this.baseInfo._storeName = val.name;
|
|
502
|
+ this.typeList = [{}];
|
|
503
|
+ this.cateList = [];
|
|
504
|
+ this.getClassify(val.id);
|
|
505
|
+ },
|
|
506
|
+
|
|
507
|
+ // 分类
|
|
508
|
+ addType() {
|
|
509
|
+ this.typeList.push({});
|
|
510
|
+ },
|
|
511
|
+ typeRemove(i) {
|
|
512
|
+ this.typeList.splice(i, 1);
|
|
513
|
+ this.typeList = [...this.typeList];
|
|
514
|
+ },
|
|
515
|
+ pickerTypeChange(e, typeListIndex) {
|
|
516
|
+ console.log(e.detail);
|
|
517
|
+ let index1 = e.detail.value[0] || 0;
|
|
518
|
+ let index2 = e.detail.value[1] || 0;
|
|
519
|
+ let name = this.cateList[0][index1].name;
|
|
520
|
+ let id = this.cateList[0][index1].id;
|
|
521
|
+ if (this.cateList[1].length) {
|
|
522
|
+ name += "/" + this.cateList[1][index2].name;
|
|
523
|
+ id = this.cateList[1][index2].id;
|
|
524
|
+ }
|
|
525
|
+ console.log(name, id);
|
|
526
|
+ this.typeList[typeListIndex].name = name;
|
|
527
|
+ this.typeList[typeListIndex].id = id;
|
|
528
|
+ this.typeList = [...this.typeList];
|
|
529
|
+ let ids = [];
|
|
530
|
+ for (let item of this.typeList) {
|
|
531
|
+ if (item.id) {
|
|
532
|
+ ids.push(item.id);
|
|
533
|
+ }
|
|
534
|
+ }
|
|
535
|
+ this.baseInfo.productTypeIds = ids;
|
|
536
|
+ },
|
|
537
|
+ typeColumnchange(e) {
|
|
538
|
+ let column = e.detail.column;
|
|
539
|
+ let index = e.detail.value;
|
|
540
|
+ if (column === 0) {
|
|
541
|
+ let val = this.cateList[0][index];
|
|
542
|
+ if (val.children) {
|
|
543
|
+ this.cateList[1] = val.children;
|
|
544
|
+ } else {
|
|
545
|
+ this.cateList[1] = [];
|
|
546
|
+ }
|
|
547
|
+ this.$forceUpdate();
|
|
548
|
+ }
|
|
549
|
+ },
|
|
550
|
+
|
|
551
|
+ // 出售方式
|
|
552
|
+ pickerStatusChange(e) {
|
|
553
|
+ let index = e.target.value;
|
|
554
|
+ let val = this.sellType[index];
|
|
555
|
+ this.baseInfo.status = val.value;
|
|
556
|
+ this.baseInfo._statusName = val.key;
|
|
557
|
+ },
|
|
558
|
+
|
|
559
|
+ // 保存
|
|
560
|
+ save() {
|
|
561
|
+ let requiredFile1 = [
|
|
562
|
+ {
|
|
563
|
+ key: "storeId",
|
|
564
|
+ msg: "请选择店铺",
|
|
565
|
+ },
|
|
566
|
+ {
|
|
567
|
+ key: "name",
|
|
568
|
+ msg: "请输入商品标题",
|
|
569
|
+ },
|
|
570
|
+ {
|
|
571
|
+ key: "code",
|
|
572
|
+ msg: "请输入商品编码",
|
|
573
|
+ },
|
|
574
|
+ {
|
|
575
|
+ key: "productTypeIds",
|
|
576
|
+ type: "array",
|
|
577
|
+ msg: "请选择分类",
|
|
578
|
+ },
|
|
579
|
+ {
|
|
580
|
+ key: "price",
|
|
581
|
+ msg: "请输入价格",
|
|
582
|
+ },
|
|
583
|
+ {
|
|
584
|
+ key: "weight",
|
|
585
|
+ msg: "请输入重量",
|
|
586
|
+ },
|
|
587
|
+ {
|
|
588
|
+ key: "stock",
|
|
589
|
+ msg: "请输入库存",
|
|
590
|
+ },
|
|
591
|
+ {
|
|
592
|
+ key: "skuCode",
|
|
593
|
+ msg: "请输入sku编码",
|
|
594
|
+ },
|
|
595
|
+ {
|
|
596
|
+ key: "mainImage",
|
|
597
|
+ msg: "请上传主图",
|
|
598
|
+ },
|
|
599
|
+ ];
|
|
600
|
+ let requiredFile2 = [
|
|
601
|
+ {
|
|
602
|
+ key: "images",
|
|
603
|
+ type: "array",
|
|
604
|
+ msg: "请上传封面图",
|
|
605
|
+ },
|
|
606
|
+ {
|
|
607
|
+ key: "detailImages",
|
|
608
|
+ type: "array",
|
|
609
|
+ msg: "请上传详情图",
|
|
610
|
+ },
|
|
611
|
+ ];
|
|
612
|
+
|
|
613
|
+ for (let item of requiredFile1) {
|
|
614
|
+ if (item.type === "array") {
|
|
615
|
+ if (this.baseInfo[item.key].length === 0) {
|
|
616
|
+ return this.fn.showToast(item.msg);
|
|
617
|
+ }
|
|
618
|
+ } else {
|
|
619
|
+ if (!this.baseInfo[item.key]) {
|
|
620
|
+ return this.fn.showToast(item.msg);
|
|
621
|
+ }
|
|
622
|
+ }
|
|
623
|
+ }
|
|
624
|
+
|
|
625
|
+ for (let item of requiredFile2) {
|
|
626
|
+ if (item.type === "array") {
|
|
627
|
+ if (this.productForm[item.key].length === 0) {
|
|
628
|
+ return this.fn.showToast(item.msg);
|
|
629
|
+ }
|
|
630
|
+ } else {
|
|
631
|
+ if (!this.productForm[item.key]) {
|
|
632
|
+ return this.fn.showToast(item.msg);
|
|
633
|
+ }
|
|
634
|
+ }
|
|
635
|
+ }
|
|
636
|
+
|
|
637
|
+ let sendData = {
|
|
638
|
+ baseInfo: {
|
|
639
|
+ ...this.baseInfo,
|
|
640
|
+ companyId:'0520aa13-517d-4f69-88ef-c0b543372af7'
|
|
641
|
+ },
|
|
642
|
+ ...this.productForm,
|
|
643
|
+ hotSaleRecommendIds:[],
|
|
644
|
+ businessRecommendIds:[],
|
|
645
|
+ participated:false,
|
|
646
|
+ video:''
|
|
647
|
+ };
|
|
648
|
+ sendData.baseInfo.price = Number(sendData.baseInfo.price)* 100;
|
|
649
|
+ sendData.baseInfo.supplyPrice = Number(sendData.baseInfo.supplyPrice)* 100;
|
|
650
|
+ sendData.baseInfo.cost = Number(sendData.baseInfo.cost)* 100;
|
|
651
|
+ sendData.baseInfo.tagPrice = Number(sendData.baseInfo.tagPrice)* 100;
|
|
652
|
+ this.api.post("/product/SaveEdit", sendData).then((res) => {});
|
|
653
|
+ },
|
252
|
654
|
},
|
253
|
655
|
|
254
|
656
|
// 数据计算
|
|
@@ -277,11 +679,20 @@ export default {
|
277
|
679
|
font-size: px(48);
|
278
|
680
|
}
|
279
|
681
|
}
|
|
682
|
+.required {
|
|
683
|
+ color: #f00;
|
|
684
|
+ font-size: px(44);
|
|
685
|
+ &.hide {
|
|
686
|
+ visibility: hidden;
|
|
687
|
+ }
|
|
688
|
+}
|
280
|
689
|
.form-item {
|
281
|
690
|
display: flex;
|
282
|
|
- font-size: px(44);
|
283
|
|
- height: px(140);
|
|
691
|
+ min-height: px(140);
|
|
692
|
+ padding: px(30) 0;
|
|
693
|
+ box-sizing: border-box;
|
284
|
694
|
align-items: center;
|
|
695
|
+ font-size: px(44);
|
285
|
696
|
& ~ .form-item {
|
286
|
697
|
border-top: 1px solid #f1f1f1;
|
287
|
698
|
}
|
|
@@ -293,6 +704,7 @@ export default {
|
293
|
704
|
}
|
294
|
705
|
.box {
|
295
|
706
|
width: 100%;
|
|
707
|
+ position: relative;
|
296
|
708
|
input {
|
297
|
709
|
width: 100%;
|
298
|
710
|
}
|
|
@@ -302,8 +714,10 @@ export default {
|
302
|
714
|
color: #999;
|
303
|
715
|
margin-left: px(10);
|
304
|
716
|
}
|
305
|
|
- .required {
|
306
|
|
- color: #f00;
|
|
717
|
+ textarea,
|
|
718
|
+ input {
|
|
719
|
+ max-width: 100%;
|
|
720
|
+ width: 100%;
|
307
|
721
|
}
|
308
|
722
|
}
|
309
|
723
|
.code-tool {
|
|
@@ -325,29 +739,61 @@ export default {
|
325
|
739
|
flex-shrink: 0;
|
326
|
740
|
}
|
327
|
741
|
}
|
328
|
|
-radio-group{
|
329
|
|
- label~label{
|
|
742
|
+radio-group {
|
|
743
|
+ label ~ label {
|
330
|
744
|
margin-left: px(40);
|
331
|
745
|
}
|
332
|
746
|
}
|
333
|
|
-.img-card{
|
|
747
|
+.img-card {
|
334
|
748
|
padding-top: px(30);
|
335
|
749
|
padding-bottom: px(30);
|
336
|
750
|
}
|
337
|
|
-.form-img-item{
|
338
|
|
- .tit{
|
|
751
|
+.form-img-item {
|
|
752
|
+ .tit {
|
339
|
753
|
padding: px(30);
|
340
|
754
|
font-size: px(44);
|
341
|
755
|
}
|
342
|
|
- .list{
|
343
|
|
-
|
|
756
|
+ .list {
|
344
|
757
|
}
|
345
|
758
|
}
|
346
|
|
-.btn{
|
|
759
|
+.btn {
|
347
|
760
|
margin-top: px(60);
|
348
|
761
|
background-color: rgb(0, 188, 38);
|
349
|
762
|
color: #fff;
|
350
|
763
|
border-radius: 0;
|
351
|
764
|
border: none;
|
352
|
765
|
}
|
|
766
|
+.add-type {
|
|
767
|
+ width: 100%;
|
|
768
|
+ font-size: px(40);
|
|
769
|
+ color: #0097d1;
|
|
770
|
+ padding: px(20) 0;
|
|
771
|
+}
|
|
772
|
+.type-item {
|
|
773
|
+ padding: px(20) 0;
|
|
774
|
+ display: flex;
|
|
775
|
+ justify-content: space-between;
|
|
776
|
+ align-items: center;
|
|
777
|
+ border-bottom: 1px solid #f1f1f1;
|
|
778
|
+ .remove-text {
|
|
779
|
+ color: red;
|
|
780
|
+ flex-shrink: 0;
|
|
781
|
+ margin-left: px(20);
|
|
782
|
+ }
|
|
783
|
+}
|
|
784
|
+.type-tip {
|
|
785
|
+ position: absolute;
|
|
786
|
+ top: 0;
|
|
787
|
+ left: 0;
|
|
788
|
+ width: 100%;
|
|
789
|
+ height: 100%;
|
|
790
|
+ z-index: 100;
|
|
791
|
+ background-color: rgba(0, 0, 0, 0.4);
|
|
792
|
+ color: #fff;
|
|
793
|
+ font-size: px(44);
|
|
794
|
+ display: flex;
|
|
795
|
+ justify-content: center;
|
|
796
|
+ align-items: center;
|
|
797
|
+ pointer-events: none;
|
|
798
|
+}
|
353
|
799
|
</style>
|