Skip to content

Commit 4830158

Browse files
YunaiVgitee-org
authored andcommitted
!320 秒杀活动相关
Merge pull request !320 from halfninety/feature/1.8.0-uniapp
2 parents 3e5428d + c3dea36 commit 4830158

File tree

1 file changed

+12
-12
lines changed
  • src/views/mall/promotion/seckill/seckillActivity

1 file changed

+12
-12
lines changed

src/views/mall/promotion/seckill/seckillActivity/index.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@
5151
<dict-tag :type="DICT_TYPE.PROMOTION_ACTIVITY_STATUS" :value="scope.row.status" />
5252
</template>
5353
</el-table-column>
54-
<el-table-column label="参与场次" prop="timeId" width="250">
54+
<el-table-column label="参与场次" prop="timeIds" width="250">
5555
<template slot-scope="scope">
5656
<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)">
5858
<el-tag style="margin:4px;" size="small">{{ item.name }}</el-tag>
5959
</span>
6060
</template>
@@ -107,7 +107,7 @@
107107
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注" />
108108
</el-form-item>
109109
<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
111111
style="width: 880px">
112112
<el-option v-for="item in seckillTimeList" :key="item.id" :label="item.name" :value="item.id">
113113
<span style="float: left">{{ item.name + ': { ' }} {{ item.startTime }} -- {{ item.endTime +
@@ -186,7 +186,7 @@
186186

187187
<script>
188188
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";
190190
import { getSeckillTimeList } from "@/api/mall/promotion/seckillTime";
191191
import { deepClone } from "@/utils";
192192
@@ -223,7 +223,7 @@ export default {
223223
form: {
224224
skuIds: [], // 选中的 SKU
225225
products: [], // 商品信息
226-
timeId: [], //选中的秒杀场次id
226+
timeIds: [], //选中的秒杀场次id
227227
},
228228
// 商品 SKU 列表
229229
productSkus: [],
@@ -233,32 +233,35 @@ export default {
233233
status: [{ required: true, message: "活动状态不能为空", trigger: "blur" }],
234234
startAndEndTime: [{ required: true, message: "活动时间不能为空", trigger: "blur" }],
235235
sort: [{ required: true, message: "排序不能为空", trigger: "blur" }],
236-
timeId: [{ required: true, message: "秒杀场次不能为空", trigger: "blur" }],
236+
timeIds: [{ required: true, message: "秒杀场次不能为空", trigger: "blur" }],
237237
totalPrice: [{ required: true, message: "订单实付金额,单位:分不能为空", trigger: "blur" }],
238238
}
239239
};
240240
},
241241
created() {
242242
this.getList();
243243
},
244-
watch:{
244+
watch: {
245245
$route: 'getList'
246246
},
247247
methods: {
248248
/** 查询列表 */
249249
getList() {
250+
// 从秒杀时段跳转过来并鞋带timeId参数进行查询
250251
const timeId = this.$route.params && this.$route.params.timeId;
251252
if (timeId) {
252253
this.queryParams.timeId = timeId
253254
}
254255
this.loading = true;
255256
// 执行查询
256257
getSeckillActivityPage(this.queryParams).then(response => {
258+
console.log(response.data.list, "查询出的值");
257259
this.list = response.data.list;
258260
this.total = response.data.total;
259261
this.loading = false;
260262
});
261263
if (timeId) {
264+
//查询完成后设置为空
262265
this.$route.params.timeId = undefined
263266
}
264267
// 获得 SKU 商品列表
@@ -285,7 +288,7 @@ export default {
285288
startTime: undefined,
286289
endTime: undefined,
287290
sort: undefined,
288-
timeId: [],
291+
timeIds: [],
289292
totalPrice: undefined,
290293
skuIds: [],
291294
products: [],
@@ -317,11 +320,9 @@ export default {
317320
this.reset();
318321
const id = row.id;
319322
getSeckillActivity(id).then(response => {
320-
var timeIdList = response.data.timeId.split(',')
321323
this.form = response.data;
322324
// 修改数据
323325
this.form.startAndEndTime = [response.data.startTime, response.data.endTime];
324-
this.form.timeId = timeIdList.map(item => parseInt(item))
325326
this.form.skuIds = response.data.products.map(item => item.skuId);
326327
this.form.products.forEach(product => {
327328
// 获得对应的 SKU 信息
@@ -334,7 +335,7 @@ export default {
334335
product.spuName = sku.spuName;
335336
product.price = sku.price;
336337
product.productStock = sku.stock;
337-
this.$set(product,'seckillStock',product.stock);
338+
this.$set(product, 'seckillStock', product.stock);
338339
product.seckillPrice = product.seckillPrice !== undefined ? product.seckillPrice / 100 : undefined;
339340
340341
});
@@ -353,7 +354,6 @@ export default {
353354
const data = deepClone(this.form);
354355
data.startTime = this.form.startAndEndTime[0];
355356
data.endTime = this.form.startAndEndTime[1];
356-
data.timeId = data.timeId.toString();
357357
data.products.forEach(product => {
358358
product.stock = product.seckillStock;
359359
product.seckillPrice = product.seckillPrice !== undefined ? product.seckillPrice * 100 : undefined;

0 commit comments

Comments
 (0)