51
51
<dict-tag :type =" DICT_TYPE.PROMOTION_ACTIVITY_STATUS" :value =" scope.row.status" />
52
52
</template >
53
53
</el-table-column >
54
- <el-table-column label =" 参与场次" prop =" timeId " width =" 250" >
54
+ <el-table-column label =" 参与场次" prop =" timeIds " width =" 250" >
55
55
<template slot-scope="scope">
56
56
<span v-for =" item in seckillTimeList" :key =" item.id"
57
- v-if =" scope.row.timeId.indexOf (item.id) !== -1 " >
57
+ v-if =" scope.row.timeIds.includes (item.id)" >
58
58
<el-tag style =" margin :4px ;" size =" small" >{{ item.name }}</el-tag >
59
59
</span >
60
60
</template >
107
107
<el-input type =" textarea" v-model =" form.remark" placeholder =" 请输入备注" />
108
108
</el-form-item >
109
109
<el-form-item label =" 场次选择" >
110
- <el-select v-model =" form.timeId " placeholder =" 请选择参与场次" clearable size =" small" multiple filterable
110
+ <el-select v-model =" form.timeIds " placeholder =" 请选择参与场次" clearable size =" small" multiple filterable
111
111
style =" width : 880px " >
112
112
<el-option v-for =" item in seckillTimeList" :key =" item.id" :label =" item.name" :value =" item.id" >
113
113
<span style =" float : left " >{{ item.name + ': { ' }} {{ item.startTime }} -- {{ item.endTime +
186
186
187
187
<script >
188
188
import { getSkuOptionList } from " @/api/mall/product/sku" ;
189
- import { createSeckillActivity , updateSeckillActivity , closeSeckillActivity ,deleteSeckillActivity , getSeckillActivity , getSeckillActivityPage , exportSeckillActivityExcel } from " @/api/mall/promotion/seckillActivity" ;
189
+ import { createSeckillActivity , updateSeckillActivity , closeSeckillActivity , deleteSeckillActivity , getSeckillActivity , getSeckillActivityPage , exportSeckillActivityExcel } from " @/api/mall/promotion/seckillActivity" ;
190
190
import { getSeckillTimeList } from " @/api/mall/promotion/seckillTime" ;
191
191
import { deepClone } from " @/utils" ;
192
192
@@ -223,7 +223,7 @@ export default {
223
223
form: {
224
224
skuIds: [], // 选中的 SKU
225
225
products: [], // 商品信息
226
- timeId : [], // 选中的秒杀场次id
226
+ timeIds : [], // 选中的秒杀场次id
227
227
},
228
228
// 商品 SKU 列表
229
229
productSkus: [],
@@ -233,32 +233,35 @@ export default {
233
233
status: [{ required: true , message: " 活动状态不能为空" , trigger: " blur" }],
234
234
startAndEndTime: [{ required: true , message: " 活动时间不能为空" , trigger: " blur" }],
235
235
sort: [{ required: true , message: " 排序不能为空" , trigger: " blur" }],
236
- timeId : [{ required: true , message: " 秒杀场次不能为空" , trigger: " blur" }],
236
+ timeIds : [{ required: true , message: " 秒杀场次不能为空" , trigger: " blur" }],
237
237
totalPrice: [{ required: true , message: " 订单实付金额,单位:分不能为空" , trigger: " blur" }],
238
238
}
239
239
};
240
240
},
241
241
created () {
242
242
this .getList ();
243
243
},
244
- watch: {
244
+ watch: {
245
245
$route: ' getList'
246
246
},
247
247
methods: {
248
248
/** 查询列表 */
249
249
getList () {
250
+ // 从秒杀时段跳转过来并鞋带timeId参数进行查询
250
251
const timeId = this .$route .params && this .$route .params .timeId ;
251
252
if (timeId) {
252
253
this .queryParams .timeId = timeId
253
254
}
254
255
this .loading = true ;
255
256
// 执行查询
256
257
getSeckillActivityPage (this .queryParams ).then (response => {
258
+ console .log (response .data .list , " 查询出的值" );
257
259
this .list = response .data .list ;
258
260
this .total = response .data .total ;
259
261
this .loading = false ;
260
262
});
261
263
if (timeId) {
264
+ // 查询完成后设置为空
262
265
this .$route .params .timeId = undefined
263
266
}
264
267
// 获得 SKU 商品列表
@@ -285,7 +288,7 @@ export default {
285
288
startTime: undefined ,
286
289
endTime: undefined ,
287
290
sort: undefined ,
288
- timeId : [],
291
+ timeIds : [],
289
292
totalPrice: undefined ,
290
293
skuIds: [],
291
294
products: [],
@@ -317,11 +320,9 @@ export default {
317
320
this .reset ();
318
321
const id = row .id ;
319
322
getSeckillActivity (id).then (response => {
320
- var timeIdList = response .data .timeId .split (' ,' )
321
323
this .form = response .data ;
322
324
// 修改数据
323
325
this .form .startAndEndTime = [response .data .startTime , response .data .endTime ];
324
- this .form .timeId = timeIdList .map (item => parseInt (item))
325
326
this .form .skuIds = response .data .products .map (item => item .skuId );
326
327
this .form .products .forEach (product => {
327
328
// 获得对应的 SKU 信息
@@ -334,7 +335,7 @@ export default {
334
335
product .spuName = sku .spuName ;
335
336
product .price = sku .price ;
336
337
product .productStock = sku .stock ;
337
- this .$set (product,' seckillStock' ,product .stock );
338
+ this .$set (product, ' seckillStock' , product .stock );
338
339
product .seckillPrice = product .seckillPrice !== undefined ? product .seckillPrice / 100 : undefined ;
339
340
340
341
});
@@ -353,7 +354,6 @@ export default {
353
354
const data = deepClone (this .form );
354
355
data .startTime = this .form .startAndEndTime [0 ];
355
356
data .endTime = this .form .startAndEndTime [1 ];
356
- data .timeId = data .timeId .toString ();
357
357
data .products .forEach (product => {
358
358
product .stock = product .seckillStock ;
359
359
product .seckillPrice = product .seckillPrice !== undefined ? product .seckillPrice * 100 : undefined ;
0 commit comments