Commit 61c4053cbb3c81419d9e549be16e7254d14a6d6b
1 parent
fc3245a0
前端修改秒杀相关文件存放地址
Showing
4 changed files
with
77 additions
and
130 deletions
yudao-ui-admin/src/api/promotion/seckillActivity.js renamed to yudao-ui-admin/src/api/mall/promotion/seckillActivity.js
yudao-ui-admin/src/api/promotion/seckillTime.js renamed to yudao-ui-admin/src/api/mall/promotion/seckillTime.js
yudao-ui-admin/src/views/promotion/seckillActivity/index.vue renamed to yudao-ui-admin/src/views/mall/promotion/seckill/seckillActivity/index.vue
| @@ -18,8 +18,6 @@ | @@ -18,8 +18,6 @@ | ||
| 18 | <el-select v-model="queryParams.timeId" placeholder="请选择参与场次" clearable size="small"> | 18 | <el-select v-model="queryParams.timeId" placeholder="请选择参与场次" clearable size="small"> |
| 19 | <el-option v-for="item in seckillTimeList" :key="item.id" :label="item.name" :value="item.id" /> | 19 | <el-option v-for="item in seckillTimeList" :key="item.id" :label="item.name" :value="item.id" /> |
| 20 | </el-select> | 20 | </el-select> |
| 21 | - <!-- <el-option v-for="seckill in seckillTimeList" :key="seckill.id" :lable="seckill.name" :value="seckill.id" /> --> | ||
| 22 | - <!-- <el-input v-model="queryParams.timeId" placeholder="请输入秒杀时段id" clearable @keyup.enter.native="handleQuery" /> --> | ||
| 23 | </el-form-item> | 21 | </el-form-item> |
| 24 | <el-form-item label="创建时间" prop="createTime"> | 22 | <el-form-item label="创建时间" prop="createTime"> |
| 25 | <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" | 23 | <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" |
| @@ -39,8 +37,8 @@ | @@ -39,8 +37,8 @@ | ||
| 39 | v-hasPermi="['promotion:seckill-activity:create']">新增秒杀活动</el-button> | 37 | v-hasPermi="['promotion:seckill-activity:create']">新增秒杀活动</el-button> |
| 40 | </el-col> | 38 | </el-col> |
| 41 | <el-col :span="1.5"> | 39 | <el-col :span="1.5"> |
| 42 | - <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" | ||
| 43 | - :loading="exportLoading" v-hasPermi="['promotion:seckill-activity:export']">导出</el-button> | 40 | + <el-button type="primary" plain icon="el-icon-menu" size="mini" @click="openSeckillTime" |
| 41 | + v-hasPermi="['promotion:seckill-activity:create']">管理参与场次</el-button> | ||
| 44 | </el-col> | 42 | </el-col> |
| 45 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | 43 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| 46 | </el-row> | 44 | </el-row> |
| @@ -70,11 +68,6 @@ | @@ -70,11 +68,6 @@ | ||
| 70 | 68 | ||
| 71 | <el-table-column label="付款订单数" align="center" prop="orderCount" /> | 69 | <el-table-column label="付款订单数" align="center" prop="orderCount" /> |
| 72 | <el-table-column label="付款人数" align="center" prop="userCount" /> | 70 | <el-table-column label="付款人数" align="center" prop="userCount" /> |
| 73 | - <el-table-column label="订单实付金额" align="center"> | ||
| 74 | - <template slot-scope="scope"> | ||
| 75 | - ¥{{ (scope.row.totalPrice / 100.0).toFixed(2) }} | ||
| 76 | - </template> | ||
| 77 | - </el-table-column> | ||
| 78 | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | 71 | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
| 79 | <template slot-scope="scope"> | 72 | <template slot-scope="scope"> |
| 80 | <span>{{ parseTime(scope.row.createTime) }}</span> | 73 | <span>{{ parseTime(scope.row.createTime) }}</span> |
| @@ -84,6 +77,8 @@ | @@ -84,6 +77,8 @@ | ||
| 84 | <template slot-scope="scope"> | 77 | <template slot-scope="scope"> |
| 85 | <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | 78 | <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" |
| 86 | v-hasPermi="['promotion:seckill-activity:update']">修改</el-button> | 79 | v-hasPermi="['promotion:seckill-activity:update']">修改</el-button> |
| 80 | + <el-button size="mini" type="text" icon="el-icon-close" @click="handleClose(scope.row)" | ||
| 81 | + v-hasPermi="['promotion:seckill-activity:delete']">关闭</el-button> | ||
| 87 | <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" | 82 | <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
| 88 | v-hasPermi="['promotion:seckill-activity:delete']">删除</el-button> | 83 | v-hasPermi="['promotion:seckill-activity:delete']">删除</el-button> |
| 89 | </template> | 84 | </template> |
| @@ -99,40 +94,20 @@ | @@ -99,40 +94,20 @@ | ||
| 99 | <el-form-item label="活动名称" prop="name"> | 94 | <el-form-item label="活动名称" prop="name"> |
| 100 | <el-input v-model="form.name" placeholder="请输入秒杀活动名称" /> | 95 | <el-input v-model="form.name" placeholder="请输入秒杀活动名称" /> |
| 101 | </el-form-item> | 96 | </el-form-item> |
| 102 | - <!-- <el-form-item label="活动状态" prop="status"> | ||
| 103 | - <el-radio-group v-model="form.status"> | ||
| 104 | - <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.PROMOTION_ACTIVITY_STATUS)" | ||
| 105 | - :key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio> | ||
| 106 | - </el-radio-group> | ||
| 107 | - </el-form-item> --> | ||
| 108 | - | ||
| 109 | <el-form-item label="活动时间" prop="startAndEndTime"> | 97 | <el-form-item label="活动时间" prop="startAndEndTime"> |
| 110 | <el-date-picker clearable v-model="form.startAndEndTime" type="datetimerange" | 98 | <el-date-picker clearable v-model="form.startAndEndTime" type="datetimerange" |
| 111 | value-format="timestamp" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" | 99 | value-format="timestamp" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" |
| 112 | style="width: 1080px" /> | 100 | style="width: 1080px" /> |
| 113 | </el-form-item> | 101 | </el-form-item> |
| 114 | - <!-- | ||
| 115 | - <el-form-item label="活动结束时间" prop="endTime"> | ||
| 116 | - <el-date-picker clearable v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择活动结束时间" /> | ||
| 117 | - </el-form-item> --> | ||
| 118 | - | ||
| 119 | <el-form-item label="排序" prop="sort"> | 102 | <el-form-item label="排序" prop="sort"> |
| 120 | <el-input-number v-model="form.sort" controls-position="right" :min="0" :max="10000"> | 103 | <el-input-number v-model="form.sort" controls-position="right" :min="0" :max="10000"> |
| 121 | </el-input-number> | 104 | </el-input-number> |
| 122 | </el-form-item> | 105 | </el-form-item> |
| 123 | - | ||
| 124 | - <!-- <el-form-item label="秒杀时段id" prop="timeId"> | ||
| 125 | - <el-input v-model="form.timeId" placeholder="请输入秒杀时段id" /> | ||
| 126 | - </el-form-item> | ||
| 127 | - <el-form-item label="订单实付金额(分)" prop="totalPrice"> | ||
| 128 | - <el-input v-model="form.totalPrice" placeholder="请输入订单实付金额(分)" /> | ||
| 129 | - </el-form-item> --> | ||
| 130 | - | ||
| 131 | <el-form-item label="备注" prop="remark"> | 106 | <el-form-item label="备注" prop="remark"> |
| 132 | <el-input type="textarea" v-model="form.remark" placeholder="请输入备注" /> | 107 | <el-input type="textarea" v-model="form.remark" placeholder="请输入备注" /> |
| 133 | </el-form-item> | 108 | </el-form-item> |
| 134 | <el-form-item label="场次选择"> | 109 | <el-form-item label="场次选择"> |
| 135 | - <el-select v-model="form.timeIds" placeholder="请选择参与场次" clearable size="small" multiple filterable | 110 | + <el-select v-model="form.timeId" placeholder="请选择参与场次" clearable size="small" multiple filterable |
| 136 | style="width: 880px"> | 111 | style="width: 880px"> |
| 137 | <el-option v-for="item in seckillTimeList" :key="item.id" :label="item.name" :value="item.id"> | 112 | <el-option v-for="item in seckillTimeList" :key="item.id" :label="item.name" :value="item.id"> |
| 138 | <span style="float: left">{{ item.name + ': { ' }} {{ item.startTime }} -- {{ item.endTime + | 113 | <span style="float: left">{{ item.name + ': { ' }} {{ item.startTime }} -- {{ item.endTime + |
| @@ -142,7 +117,6 @@ | @@ -142,7 +117,6 @@ | ||
| 142 | </el-option> | 117 | </el-option> |
| 143 | </el-select> | 118 | </el-select> |
| 144 | </el-form-item> | 119 | </el-form-item> |
| 145 | - | ||
| 146 | <el-form-item label="商品选择"> | 120 | <el-form-item label="商品选择"> |
| 147 | <el-select v-model="form.skuIds" placeholder="请选择活动商品" clearable size="small" multiple filterable | 121 | <el-select v-model="form.skuIds" placeholder="请选择活动商品" clearable size="small" multiple filterable |
| 148 | style="width: 880px" @change="changeFormSku"> | 122 | style="width: 880px" @change="changeFormSku"> |
| @@ -154,13 +128,11 @@ | @@ -154,13 +128,11 @@ | ||
| 154 | }}</span> | 128 | }}</span> |
| 155 | </el-option> | 129 | </el-option> |
| 156 | </el-select> | 130 | </el-select> |
| 157 | - | ||
| 158 | <el-row> | 131 | <el-row> |
| 159 | <el-button type="primary" size="mini" @click="batchEditProduct('limitBuyCount')">限购</el-button> | 132 | <el-button type="primary" size="mini" @click="batchEditProduct('limitBuyCount')">限购</el-button> |
| 160 | <el-button type="primary" size="mini" @click="batchEditProduct('seckillPrice')">秒杀价</el-button> | 133 | <el-button type="primary" size="mini" @click="batchEditProduct('seckillPrice')">秒杀价</el-button> |
| 161 | <el-button type="primary" size="mini" @click="batchEditProduct('seckillStock')">秒杀库存</el-button> | 134 | <el-button type="primary" size="mini" @click="batchEditProduct('seckillStock')">秒杀库存</el-button> |
| 162 | </el-row> | 135 | </el-row> |
| 163 | - | ||
| 164 | <el-table v-loading="loading" ref="productsTable" :data="form.products"> | 136 | <el-table v-loading="loading" ref="productsTable" :data="form.products"> |
| 165 | <el-table-column type="selection" width="55"> | 137 | <el-table-column type="selection" width="55"> |
| 166 | </el-table-column> | 138 | </el-table-column> |
| @@ -177,28 +149,23 @@ | @@ -177,28 +149,23 @@ | ||
| 177 | <el-table-column label="库存" align="center" prop="productStock" /> | 149 | <el-table-column label="库存" align="center" prop="productStock" /> |
| 178 | <el-table-column label="限购(0为不限购)" align="center" width="150"> | 150 | <el-table-column label="限购(0为不限购)" align="center" width="150"> |
| 179 | <template slot-scope="scope"> | 151 | <template slot-scope="scope"> |
| 180 | - <el-input-number v-model="scope.row.limitBuyCount" size="mini" controls-position="right" | ||
| 181 | - :min="0" :max="10000"> | 152 | + <el-input-number v-model="scope.row.limitBuyCount" size="mini" :min="0" :max="10000"> |
| 182 | </el-input-number> | 153 | </el-input-number> |
| 183 | </template> | 154 | </template> |
| 184 | </el-table-column> | 155 | </el-table-column> |
| 185 | - | ||
| 186 | <el-table-column label="秒杀价(元)" align="center" width="150"> | 156 | <el-table-column label="秒杀价(元)" align="center" width="150"> |
| 187 | <template slot-scope="scope"> | 157 | <template slot-scope="scope"> |
| 188 | - <el-input-number v-model="scope.row.seckillPrice" size="mini" controls-position="right" | ||
| 189 | - :precision="2" :min="0" :max="10000"> | 158 | + <el-input-number v-model="scope.row.seckillPrice" size="mini" :precision="2" :min="0" |
| 159 | + :max="10000"> | ||
| 190 | </el-input-number> | 160 | </el-input-number> |
| 191 | </template> | 161 | </template> |
| 192 | </el-table-column> | 162 | </el-table-column> |
| 193 | - | ||
| 194 | - <el-table-column label="秒杀库存" align="center" width="150"> | 163 | + <el-table-column label="秒杀库存" align="center" width="150" prop="seckillStock"> |
| 195 | <template slot-scope="scope"> | 164 | <template slot-scope="scope"> |
| 196 | - <el-input-number v-model="scope.row.seckillStock" size="mini" controls-position="right" | ||
| 197 | - :min="0" :max="10000"> | 165 | + <el-input-number v-model="scope.row.seckillStock" size="mini" :min="0" :max="10000"> |
| 198 | </el-input-number> | 166 | </el-input-number> |
| 199 | </template> | 167 | </template> |
| 200 | </el-table-column> | 168 | </el-table-column> |
| 201 | - | ||
| 202 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | 169 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| 203 | <template slot-scope="scope"> | 170 | <template slot-scope="scope"> |
| 204 | <el-button size="mini" type="text" icon="el-icon-delete" | 171 | <el-button size="mini" type="text" icon="el-icon-delete" |
| @@ -208,8 +175,6 @@ | @@ -208,8 +175,6 @@ | ||
| 208 | </el-table-column> | 175 | </el-table-column> |
| 209 | </el-table> | 176 | </el-table> |
| 210 | </el-form-item> | 177 | </el-form-item> |
| 211 | - | ||
| 212 | - | ||
| 213 | </el-form> | 178 | </el-form> |
| 214 | <div slot="footer" class="dialog-footer"> | 179 | <div slot="footer" class="dialog-footer"> |
| 215 | <el-button type="primary" @click="submitForm">确 定</el-button> | 180 | <el-button type="primary" @click="submitForm">确 定</el-button> |
| @@ -221,10 +186,9 @@ | @@ -221,10 +186,9 @@ | ||
| 221 | 186 | ||
| 222 | <script> | 187 | <script> |
| 223 | import { getSkuOptionList } from "@/api/mall/product/sku"; | 188 | import { getSkuOptionList } from "@/api/mall/product/sku"; |
| 224 | -import { createSeckillActivity, updateSeckillActivity, deleteSeckillActivity, getSeckillActivity, getSeckillActivityPage, exportSeckillActivityExcel } from "@/api/promotion/seckillActivity"; | ||
| 225 | -import { getSeckillTimeList } from "@/api/promotion/seckillTime"; | ||
| 226 | -import router from '@/router'; | ||
| 227 | -import { PromotionDiscountTypeEnum } from "@/utils/constants"; | 189 | +import { createSeckillActivity, updateSeckillActivity, closeSeckillActivity,deleteSeckillActivity, getSeckillActivity, getSeckillActivityPage, exportSeckillActivityExcel } from "@/api/mall/promotion/seckillActivity"; |
| 190 | +import { getSeckillTimeList } from "@/api/mall/promotion/seckillTime"; | ||
| 191 | +import { deepClone } from "@/utils"; | ||
| 228 | 192 | ||
| 229 | export default { | 193 | export default { |
| 230 | name: "SeckillActivity", | 194 | name: "SeckillActivity", |
| @@ -234,8 +198,6 @@ export default { | @@ -234,8 +198,6 @@ export default { | ||
| 234 | return { | 198 | return { |
| 235 | // 遮罩层 | 199 | // 遮罩层 |
| 236 | loading: true, | 200 | loading: true, |
| 237 | - // 导出遮罩层 | ||
| 238 | - exportLoading: false, | ||
| 239 | // 显示搜索条件 | 201 | // 显示搜索条件 |
| 240 | showSearch: true, | 202 | showSearch: true, |
| 241 | // 总条数 | 203 | // 总条数 |
| @@ -261,7 +223,7 @@ export default { | @@ -261,7 +223,7 @@ export default { | ||
| 261 | form: { | 223 | form: { |
| 262 | skuIds: [], // 选中的 SKU | 224 | skuIds: [], // 选中的 SKU |
| 263 | products: [], // 商品信息 | 225 | products: [], // 商品信息 |
| 264 | - timeIds: [], //选中的秒杀场次id | 226 | + timeId: [], //选中的秒杀场次id |
| 265 | }, | 227 | }, |
| 266 | // 商品 SKU 列表 | 228 | // 商品 SKU 列表 |
| 267 | productSkus: [], | 229 | productSkus: [], |
| @@ -270,9 +232,8 @@ export default { | @@ -270,9 +232,8 @@ export default { | ||
| 270 | name: [{ required: true, message: "秒杀活动名称不能为空", trigger: "blur" }], | 232 | name: [{ required: true, message: "秒杀活动名称不能为空", trigger: "blur" }], |
| 271 | status: [{ required: true, message: "活动状态不能为空", trigger: "blur" }], | 233 | status: [{ required: true, message: "活动状态不能为空", trigger: "blur" }], |
| 272 | startAndEndTime: [{ required: true, message: "活动时间不能为空", trigger: "blur" }], | 234 | startAndEndTime: [{ required: true, message: "活动时间不能为空", trigger: "blur" }], |
| 273 | - endTime: [{ required: true, message: "活动结束时间不能为空", trigger: "blur" }], | ||
| 274 | sort: [{ required: true, message: "排序不能为空", trigger: "blur" }], | 235 | sort: [{ required: true, message: "排序不能为空", trigger: "blur" }], |
| 275 | - timeIds: [{ required: true, message: "秒杀场次不能为空", trigger: "blur" }], | 236 | + timeId: [{ required: true, message: "秒杀场次不能为空", trigger: "blur" }], |
| 276 | totalPrice: [{ required: true, message: "订单实付金额,单位:分不能为空", trigger: "blur" }], | 237 | totalPrice: [{ required: true, message: "订单实付金额,单位:分不能为空", trigger: "blur" }], |
| 277 | } | 238 | } |
| 278 | }; | 239 | }; |
| @@ -280,17 +241,26 @@ export default { | @@ -280,17 +241,26 @@ export default { | ||
| 280 | created() { | 241 | created() { |
| 281 | this.getList(); | 242 | this.getList(); |
| 282 | }, | 243 | }, |
| 244 | + watch:{ | ||
| 245 | + $route: 'getList' | ||
| 246 | + }, | ||
| 283 | methods: { | 247 | methods: { |
| 284 | /** 查询列表 */ | 248 | /** 查询列表 */ |
| 285 | getList() { | 249 | getList() { |
| 250 | + const timeId = this.$route.params && this.$route.params.timeId; | ||
| 251 | + if (timeId) { | ||
| 252 | + this.queryParams.timeId = timeId | ||
| 253 | + } | ||
| 286 | this.loading = true; | 254 | this.loading = true; |
| 287 | // 执行查询 | 255 | // 执行查询 |
| 288 | getSeckillActivityPage(this.queryParams).then(response => { | 256 | getSeckillActivityPage(this.queryParams).then(response => { |
| 289 | this.list = response.data.list; | 257 | this.list = response.data.list; |
| 290 | - console.log(response, "查询返回的秒杀活动列表"); | ||
| 291 | this.total = response.data.total; | 258 | this.total = response.data.total; |
| 292 | this.loading = false; | 259 | this.loading = false; |
| 293 | }); | 260 | }); |
| 261 | + if (timeId) { | ||
| 262 | + this.$route.params.timeId = undefined | ||
| 263 | + } | ||
| 294 | // 获得 SKU 商品列表 | 264 | // 获得 SKU 商品列表 |
| 295 | getSkuOptionList().then(response => { | 265 | getSkuOptionList().then(response => { |
| 296 | this.productSkus = response.data; | 266 | this.productSkus = response.data; |
| @@ -298,7 +268,6 @@ export default { | @@ -298,7 +268,6 @@ export default { | ||
| 298 | // 获取参与场次列表 | 268 | // 获取参与场次列表 |
| 299 | getSeckillTimeList().then(response => { | 269 | getSeckillTimeList().then(response => { |
| 300 | this.seckillTimeList = response.data; | 270 | this.seckillTimeList = response.data; |
| 301 | - console.log(this.seckillTimeList, "最终获取的参与场次列表"); | ||
| 302 | }); | 271 | }); |
| 303 | }, | 272 | }, |
| 304 | /** 取消按钮 */ | 273 | /** 取消按钮 */ |
| @@ -316,7 +285,7 @@ export default { | @@ -316,7 +285,7 @@ export default { | ||
| 316 | startTime: undefined, | 285 | startTime: undefined, |
| 317 | endTime: undefined, | 286 | endTime: undefined, |
| 318 | sort: undefined, | 287 | sort: undefined, |
| 319 | - timeId: undefined, | 288 | + timeId: [], |
| 320 | totalPrice: undefined, | 289 | totalPrice: undefined, |
| 321 | skuIds: [], | 290 | skuIds: [], |
| 322 | products: [], | 291 | products: [], |
| @@ -333,6 +302,10 @@ export default { | @@ -333,6 +302,10 @@ export default { | ||
| 333 | this.resetForm("queryForm"); | 302 | this.resetForm("queryForm"); |
| 334 | this.handleQuery(); | 303 | this.handleQuery(); |
| 335 | }, | 304 | }, |
| 305 | + /**打开秒杀场次管理页面 */ | ||
| 306 | + openSeckillTime() { | ||
| 307 | + this.$tab.openPage("秒杀场次管理", "/promotion/seckill-time"); | ||
| 308 | + }, | ||
| 336 | /** 新增按钮操作 */ | 309 | /** 新增按钮操作 */ |
| 337 | handleAdd() { | 310 | handleAdd() { |
| 338 | this.reset(); | 311 | this.reset(); |
| @@ -341,14 +314,34 @@ export default { | @@ -341,14 +314,34 @@ export default { | ||
| 341 | }, | 314 | }, |
| 342 | /** 修改按钮操作 */ | 315 | /** 修改按钮操作 */ |
| 343 | handleUpdate(row) { | 316 | handleUpdate(row) { |
| 344 | - console.log(row, "当前行数据"); | ||
| 345 | this.reset(); | 317 | this.reset(); |
| 346 | const id = row.id; | 318 | const id = row.id; |
| 347 | getSeckillActivity(id).then(response => { | 319 | getSeckillActivity(id).then(response => { |
| 320 | + var timeIdList = response.data.timeId.split(',') | ||
| 348 | this.form = response.data; | 321 | this.form = response.data; |
| 322 | + // 修改数据 | ||
| 323 | + this.form.startAndEndTime = [response.data.startTime, response.data.endTime]; | ||
| 324 | + this.form.timeId = timeIdList.map(item => parseInt(item)) | ||
| 325 | + this.form.skuIds = response.data.products.map(item => item.skuId); | ||
| 326 | + this.form.products.forEach(product => { | ||
| 327 | + // 获得对应的 SKU 信息 | ||
| 328 | + const sku = this.productSkus.find(item => item.id === product.skuId); | ||
| 329 | + if (!sku) { | ||
| 330 | + return; | ||
| 331 | + } | ||
| 332 | + // 设置商品信息 | ||
| 333 | + product.name = sku.name; | ||
| 334 | + product.spuName = sku.spuName; | ||
| 335 | + product.price = sku.price; | ||
| 336 | + product.productStock = sku.stock; | ||
| 337 | + this.$set(product,'seckillStock',product.stock); | ||
| 338 | + product.seckillPrice = product.seckillPrice !== undefined ? product.seckillPrice / 100 : undefined; | ||
| 339 | + | ||
| 340 | + }); | ||
| 341 | + // 打开弹窗 | ||
| 349 | this.open = true; | 342 | this.open = true; |
| 350 | - this.title = "修改秒杀活动"; | ||
| 351 | - }); | 343 | + this.title = "修改限时折扣活动"; |
| 344 | + }) | ||
| 352 | }, | 345 | }, |
| 353 | /** 提交按钮 */ | 346 | /** 提交按钮 */ |
| 354 | submitForm() { | 347 | submitForm() { |
| @@ -360,6 +353,11 @@ export default { | @@ -360,6 +353,11 @@ export default { | ||
| 360 | const data = deepClone(this.form); | 353 | const data = deepClone(this.form); |
| 361 | data.startTime = this.form.startAndEndTime[0]; | 354 | data.startTime = this.form.startAndEndTime[0]; |
| 362 | data.endTime = this.form.startAndEndTime[1]; | 355 | data.endTime = this.form.startAndEndTime[1]; |
| 356 | + data.timeId = data.timeId.toString(); | ||
| 357 | + data.products.forEach(product => { | ||
| 358 | + product.stock = product.seckillStock; | ||
| 359 | + product.seckillPrice = product.seckillPrice !== undefined ? product.seckillPrice * 100 : undefined; | ||
| 360 | + }); | ||
| 363 | // 修改的提交 | 361 | // 修改的提交 |
| 364 | if (this.form.id != null) { | 362 | if (this.form.id != null) { |
| 365 | updateSeckillActivity(data).then(response => { | 363 | updateSeckillActivity(data).then(response => { |
| @@ -377,6 +375,16 @@ export default { | @@ -377,6 +375,16 @@ export default { | ||
| 377 | }); | 375 | }); |
| 378 | }); | 376 | }); |
| 379 | }, | 377 | }, |
| 378 | + /** 关闭按钮操作 */ | ||
| 379 | + handleClose(row) { | ||
| 380 | + const id = row.id; | ||
| 381 | + this.$modal.confirm('是否确认关闭秒杀活动编号为"' + id + '"的数据项?').then(function () { | ||
| 382 | + return closeSeckillActivity(id); | ||
| 383 | + }).then(() => { | ||
| 384 | + this.getList(); | ||
| 385 | + this.$modal.msgSuccess("关闭成功"); | ||
| 386 | + }).catch(() => { }); | ||
| 387 | + }, | ||
| 380 | /** 删除按钮操作 */ | 388 | /** 删除按钮操作 */ |
| 381 | handleDelete(row) { | 389 | handleDelete(row) { |
| 382 | const id = row.id; | 390 | const id = row.id; |
| @@ -387,20 +395,6 @@ export default { | @@ -387,20 +395,6 @@ export default { | ||
| 387 | this.$modal.msgSuccess("删除成功"); | 395 | this.$modal.msgSuccess("删除成功"); |
| 388 | }).catch(() => { }); | 396 | }).catch(() => { }); |
| 389 | }, | 397 | }, |
| 390 | - /** 导出按钮操作 */ | ||
| 391 | - handleExport() { | ||
| 392 | - // 处理查询参数 | ||
| 393 | - let params = { ...this.queryParams }; | ||
| 394 | - params.pageNo = undefined; | ||
| 395 | - params.pageSize = undefined; | ||
| 396 | - this.$modal.confirm('是否确认导出所有秒杀活动数据项?').then(() => { | ||
| 397 | - this.exportLoading = true; | ||
| 398 | - return exportSeckillActivityExcel(params); | ||
| 399 | - }).then(response => { | ||
| 400 | - this.$download.excel(response, '秒杀活动.xls'); | ||
| 401 | - this.exportLoading = false; | ||
| 402 | - }).catch(() => { }); | ||
| 403 | - }, | ||
| 404 | /** 批量修改商品秒杀价,秒杀库存,每人限购数量 */ | 398 | /** 批量修改商品秒杀价,秒杀库存,每人限购数量 */ |
| 405 | batchEditProduct(editType) { | 399 | batchEditProduct(editType) { |
| 406 | const selectProducts = this.$refs.productsTable.selection; | 400 | const selectProducts = this.$refs.productsTable.selection; |
| @@ -459,7 +453,6 @@ export default { | @@ -459,7 +453,6 @@ export default { | ||
| 459 | return; | 453 | return; |
| 460 | } | 454 | } |
| 461 | // 判断已存在,直接跳过 | 455 | // 判断已存在,直接跳过 |
| 462 | - console.log(this.form, "当前form") | ||
| 463 | const product = this.form.products.find(item => item.skuId === skuId); | 456 | const product = this.form.products.find(item => item.skuId === skuId); |
| 464 | if (product) { | 457 | if (product) { |
| 465 | return; | 458 | return; |
yudao-ui-admin/src/views/promotion/seckillTime/index.vue renamed to yudao-ui-admin/src/views/mall/promotion/seckill/seckillTime/index.vue
| 1 | <template> | 1 | <template> |
| 2 | <div class="app-container"> | 2 | <div class="app-container"> |
| 3 | 3 | ||
| 4 | - <!-- 搜索工作栏 --> | ||
| 5 | - <!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px"> | ||
| 6 | - <el-form-item label="秒杀时段名称" prop="name"> | ||
| 7 | - <el-input v-model="queryParams.name" placeholder="请输入秒杀时段名称" clearable @keyup.enter.native="handleQuery" /> | ||
| 8 | - </el-form-item> | ||
| 9 | - | ||
| 10 | - <el-form-item label="开始时间点" prop="startTime"> | ||
| 11 | - <el-time-picker v-model="queryParams.startTime" placeholder="选择开始时间" value-format="HH:mm:ss" /> | ||
| 12 | - </el-form-item> | ||
| 13 | - | ||
| 14 | - <el-form-item label="结束时间点" prop="endTime"> | ||
| 15 | - <el-time-picker v-model="queryParams.endTime" placeholder="选择结束时间" value-format="HH:mm:ss" /> | ||
| 16 | - </el-form-item> | ||
| 17 | - | ||
| 18 | - <el-form-item> | ||
| 19 | - <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> | ||
| 20 | - <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> | ||
| 21 | - </el-form-item> | ||
| 22 | - </el-form> --> | ||
| 23 | - | ||
| 24 | <!-- 操作工具栏 --> | 4 | <!-- 操作工具栏 --> |
| 25 | <el-row :gutter="10" class="mb8"> | 5 | <el-row :gutter="10" class="mb8"> |
| 26 | <el-col :span="1.5"> | 6 | <el-col :span="1.5"> |
| 27 | <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" | 7 | <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" |
| 28 | - v-hasPermi="['promotion:seckill-time:create']">新增</el-button> | 8 | + v-hasPermi="['promotion:seckill-time:create']">新增秒杀时段</el-button> |
| 29 | </el-col> | 9 | </el-col> |
| 30 | - <!-- <el-col :span="1.5"> | ||
| 31 | - <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" | ||
| 32 | - :loading="exportLoading" v-hasPermi="['promotion:seckill-time:export']">导出</el-button> | ||
| 33 | - </el-col> --> | ||
| 34 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | 10 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| 35 | </el-row> | 11 | </el-row> |
| 36 | 12 | ||
| @@ -55,6 +31,8 @@ | @@ -55,6 +31,8 @@ | ||
| 55 | </el-table-column> | 31 | </el-table-column> |
| 56 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | 32 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| 57 | <template slot-scope="scope"> | 33 | <template slot-scope="scope"> |
| 34 | + <el-button size="mini" type="text" icon="el-icon-view" @click="handleOpenSeckillActivity(scope.row)"> | ||
| 35 | + 查看秒杀活动</el-button> | ||
| 58 | <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | 36 | <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" |
| 59 | v-hasPermi="['promotion:seckill-time:update']">修改</el-button> | 37 | v-hasPermi="['promotion:seckill-time:update']">修改</el-button> |
| 60 | <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" | 38 | <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" |
| @@ -62,9 +40,6 @@ | @@ -62,9 +40,6 @@ | ||
| 62 | </template> | 40 | </template> |
| 63 | </el-table-column> | 41 | </el-table-column> |
| 64 | </el-table> | 42 | </el-table> |
| 65 | - <!-- 分页组件 --> | ||
| 66 | - <!-- <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | ||
| 67 | - @pagination="getList" /> --> | ||
| 68 | 43 | ||
| 69 | <!-- 对话框(添加 / 修改) --> | 44 | <!-- 对话框(添加 / 修改) --> |
| 70 | <el-dialog :title="title" :visible.sync="open" width="600px" v-dialogDrag append-to-body> | 45 | <el-dialog :title="title" :visible.sync="open" width="600px" v-dialogDrag append-to-body> |
| @@ -87,7 +62,8 @@ | @@ -87,7 +62,8 @@ | ||
| 87 | </template> | 62 | </template> |
| 88 | 63 | ||
| 89 | <script> | 64 | <script> |
| 90 | -import { createSeckillTime, updateSeckillTime, deleteSeckillTime, getSeckillTime, getSeckillTimePage, exportSeckillTimeExcel, getSeckillTimeList } from "@/api/promotion/seckillTime"; | 65 | +import { createSeckillTime, updateSeckillTime, deleteSeckillTime, getSeckillTime, getSeckillTimePage, exportSeckillTimeExcel, getSeckillTimeList } from "@/api/mall/promotion/seckillTime"; |
| 66 | +import router from "@/router"; | ||
| 91 | import { deepClone } from "@/utils"; | 67 | import { deepClone } from "@/utils"; |
| 92 | 68 | ||
| 93 | export default { | 69 | export default { |
| @@ -110,14 +86,6 @@ export default { | @@ -110,14 +86,6 @@ export default { | ||
| 110 | title: "", | 86 | title: "", |
| 111 | // 是否显示弹出层 | 87 | // 是否显示弹出层 |
| 112 | open: false, | 88 | open: false, |
| 113 | - // 查询参数 | ||
| 114 | - // queryParams: { | ||
| 115 | - // pageNo: 1, | ||
| 116 | - // pageSize: 10, | ||
| 117 | - // name: null, | ||
| 118 | - // startTime: null, | ||
| 119 | - // endTime: null, | ||
| 120 | - // }, | ||
| 121 | // 表单参数 | 89 | // 表单参数 |
| 122 | form: {}, | 90 | form: {}, |
| 123 | // 表单校验 | 91 | // 表单校验 |
| @@ -136,9 +104,7 @@ export default { | @@ -136,9 +104,7 @@ export default { | ||
| 136 | this.loading = true; | 104 | this.loading = true; |
| 137 | // 执行查询 | 105 | // 执行查询 |
| 138 | getSeckillTimeList().then(response => { | 106 | getSeckillTimeList().then(response => { |
| 139 | - console.log(response, "返回的数据") | ||
| 140 | this.list = response.data; | 107 | this.list = response.data; |
| 141 | - // this.total = response.data.total; | ||
| 142 | this.loading = false; | 108 | this.loading = false; |
| 143 | }); | 109 | }); |
| 144 | }, | 110 | }, |
| @@ -160,7 +126,6 @@ export default { | @@ -160,7 +126,6 @@ export default { | ||
| 160 | }, | 126 | }, |
| 161 | /** 搜索按钮操作 */ | 127 | /** 搜索按钮操作 */ |
| 162 | handleQuery() { | 128 | handleQuery() { |
| 163 | - // this.queryParams.pageNo = 1; | ||
| 164 | this.getList(); | 129 | this.getList(); |
| 165 | }, | 130 | }, |
| 166 | /** 重置按钮操作 */ | 131 | /** 重置按钮操作 */ |
| @@ -168,10 +133,13 @@ export default { | @@ -168,10 +133,13 @@ export default { | ||
| 168 | this.resetForm("queryForm"); | 133 | this.resetForm("queryForm"); |
| 169 | this.handleQuery(); | 134 | this.handleQuery(); |
| 170 | }, | 135 | }, |
| 136 | + /**查看当前秒杀时段的秒杀活动 */ | ||
| 137 | + handleOpenSeckillActivity(row) { | ||
| 138 | + router.push({ name: 'SeckillActivity', params: { timeId: row.id } }) | ||
| 139 | + }, | ||
| 171 | /** 新增按钮操作 */ | 140 | /** 新增按钮操作 */ |
| 172 | handleAdd() { | 141 | handleAdd() { |
| 173 | this.reset(); | 142 | this.reset(); |
| 174 | - console.log(this.form, "点击新增时的form"); | ||
| 175 | this.open = true; | 143 | this.open = true; |
| 176 | this.title = "添加秒杀时段"; | 144 | this.title = "添加秒杀时段"; |
| 177 | }, | 145 | }, |
| @@ -224,20 +192,6 @@ export default { | @@ -224,20 +192,6 @@ export default { | ||
| 224 | this.$modal.msgSuccess("删除成功"); | 192 | this.$modal.msgSuccess("删除成功"); |
| 225 | }).catch(() => { }); | 193 | }).catch(() => { }); |
| 226 | }, | 194 | }, |
| 227 | - /** 导出按钮操作 */ | ||
| 228 | - // handleExport() { | ||
| 229 | - // // 处理查询参数 | ||
| 230 | - // let params = { ...this.queryParams }; | ||
| 231 | - // params.pageNo = undefined; | ||
| 232 | - // params.pageSize = undefined; | ||
| 233 | - // this.$modal.confirm('是否确认导出所有秒杀时段数据项?').then(() => { | ||
| 234 | - // this.exportLoading = true; | ||
| 235 | - // return exportSeckillTimeExcel(params); | ||
| 236 | - // }).then(response => { | ||
| 237 | - // this.$download.excel(response, '秒杀时段.xls'); | ||
| 238 | - // this.exportLoading = false; | ||
| 239 | - // }).catch(() => { }); | ||
| 240 | - // } | ||
| 241 | } | 195 | } |
| 242 | }; | 196 | }; |
| 243 | </script> | 197 | </script> |