|
@@ -29,15 +29,17 @@
|
|
|
total: tableObject.total
|
|
|
}"
|
|
|
>
|
|
|
- <template #startTime="{ row }">
|
|
|
- {{ format(row.startTime) }}
|
|
|
- </template>
|
|
|
- <template #endTime="{ row }">
|
|
|
- {{ format(row.endTime) }}
|
|
|
- </template>
|
|
|
<template #picUrl="{ row }">
|
|
|
<el-image :src="row.picUrl" class="w-30px h-30px" @click="imagePreview(row.picUrl)" />
|
|
|
</template>
|
|
|
+ <template #status="{ row }">
|
|
|
+ <el-switch
|
|
|
+ v-model="row.status"
|
|
|
+ :active-value="0"
|
|
|
+ :inactive-value="1"
|
|
|
+ @change="handleStatusChange(row)"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
<template #action="{ row }">
|
|
|
<el-button
|
|
|
v-hasPermi="['promotion:seckill-config:update']"
|
|
@@ -63,11 +65,13 @@
|
|
|
<SeckillConfigForm ref="formRef" @success="getList" />
|
|
|
</template>
|
|
|
<script lang="ts" name="SeckillConfig" setup>
|
|
|
-import { allSchemas, format } from './seckillConfig.data'
|
|
|
+import { allSchemas } from './seckillConfig.data'
|
|
|
import * as SeckillConfigApi from '@/api/mall/promotion/seckill/seckillConfig'
|
|
|
import SeckillConfigForm from './SeckillConfigForm.vue'
|
|
|
import { createImageViewer } from '@/components/ImageViewer'
|
|
|
+import { CommonStatusEnum } from '@/utils/constants'
|
|
|
|
|
|
+const message = useMessage() // 消息弹窗
|
|
|
// tableObject:表格的属性对象,可获得分页大小、条数等属性
|
|
|
// tableMethods:表格的操作对象,可进行获得分页、删除记录等操作
|
|
|
// 详细可见:https://doc.iocoder.cn/vue3/crud-schema/
|
|
@@ -93,7 +97,22 @@ const openForm = (type: string, id?: number) => {
|
|
|
const handleDelete = (id: number) => {
|
|
|
tableMethods.delList(id, false)
|
|
|
}
|
|
|
-
|
|
|
+/** 修改用户状态 */
|
|
|
+const handleStatusChange = async (row: SeckillConfigApi.SeckillConfigVO) => {
|
|
|
+ try {
|
|
|
+ // 修改状态的二次确认
|
|
|
+ const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用'
|
|
|
+ await message.confirm('确认要"' + text + '""' + row.name + '?')
|
|
|
+ // 发起修改状态
|
|
|
+ await SeckillConfigApi.updateSeckillConfigStatus(row.id, row.status)
|
|
|
+ // 刷新列表
|
|
|
+ await getList()
|
|
|
+ } catch {
|
|
|
+ // 取消后,进行恢复按钮
|
|
|
+ row.status =
|
|
|
+ row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE : CommonStatusEnum.ENABLE
|
|
|
+ }
|
|
|
+}
|
|
|
/** 初始化 **/
|
|
|
onMounted(() => {
|
|
|
getList()
|