From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/views/mall/promotion/seckill/config/index.vue | 211 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 211 insertions(+), 0 deletions(-)
diff --git a/src/views/mall/promotion/seckill/config/index.vue b/src/views/mall/promotion/seckill/config/index.vue
new file mode 100644
index 0000000..9fa2c1e
--- /dev/null
+++ b/src/views/mall/promotion/seckill/config/index.vue
@@ -0,0 +1,211 @@
+<template>
+ <doc-alert title="銆愯惀閿�銆戠鏉�娲诲姩" url="https://doc.iocoder.cn/mall/promotion-seckill/" />
+
+ <ContentWrap>
+ <!-- 鎼滅储宸ヤ綔鏍� -->
+ <el-form
+ class="-mb-15px"
+ :model="queryParams"
+ ref="queryFormRef"
+ :inline="true"
+ label-width="108px"
+ >
+ <el-form-item label="绉掓潃鏃舵鍚嶇О" prop="name">
+ <el-input
+ v-model="queryParams.name"
+ placeholder="璇疯緭鍏ョ鏉�鏃舵鍚嶇О"
+ clearable
+ @keyup.enter="handleQuery"
+ class="!w-240px"
+ />
+ </el-form-item>
+ <el-form-item label="娲诲姩鐘舵��" prop="status">
+ <el-select
+ v-model="queryParams.status"
+ placeholder="璇烽�夋嫨娲诲姩鐘舵��"
+ clearable
+ class="!w-240px"
+ >
+ <el-option
+ v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item>
+ <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 鎼滅储</el-button>
+ <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 閲嶇疆</el-button>
+ <el-button
+ type="primary"
+ plain
+ @click="openForm('create')"
+ v-hasPermi="['promotion:seckill-config:create']"
+ >
+ <Icon icon="ep:plus" class="mr-5px" /> 鏂板
+ </el-button>
+ </el-form-item>
+ </el-form>
+ </ContentWrap>
+
+ <!-- 鍒楄〃 -->
+ <ContentWrap>
+ <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
+ <el-table-column label="绉掓潃鏃舵鍚嶇О" align="center" prop="name" />
+ <el-table-column label="寮�濮嬫椂闂寸偣" align="center" prop="startTime" />
+ <el-table-column label="缁撴潫鏃堕棿鐐�" align="center" prop="endTime" />
+ <el-table-column label="绉掓潃杞挱鍥�" align="center" prop="sliderPicUrls">
+ <template #default="scope">
+ <el-image
+ class="h-40px max-w-40px"
+ v-for="(url, index) in scope?.row.sliderPicUrls"
+ :key="index"
+ :src="url"
+ :preview-src-list="scope?.row.sliderPicUrls"
+ :initial-index="index"
+ preview-teleported
+ />
+ </template>
+ </el-table-column>
+ <el-table-column label="娲诲姩鐘舵��" align="center" prop="status">
+ <template #default="scope">
+ <el-switch
+ v-model="scope.row.status"
+ :active-value="0"
+ :inactive-value="1"
+ @change="handleStatusChange(scope.row)"
+ />
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="鍒涘缓鏃堕棿"
+ align="center"
+ prop="createTime"
+ :formatter="dateFormatter"
+ width="180px"
+ />
+ <el-table-column label="鎿嶄綔" align="center">
+ <template #default="scope">
+ <el-button
+ link
+ type="primary"
+ @click="openForm('update', scope.row.id)"
+ v-hasPermi="['promotion:seckill-config:update']"
+ >
+ 缂栬緫
+ </el-button>
+ <el-button
+ link
+ type="danger"
+ @click="handleDelete(scope.row.id)"
+ v-hasPermi="['promotion:seckill-config:delete']"
+ >
+ 鍒犻櫎
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <!-- 鍒嗛〉 -->
+ <Pagination
+ :total="total"
+ v-model:page="queryParams.pageNo"
+ v-model:limit="queryParams.pageSize"
+ @pagination="getList"
+ />
+ </ContentWrap>
+
+ <!-- 琛ㄥ崟寮圭獥锛氭坊鍔�/淇敼 -->
+ <SeckillConfigForm ref="formRef" @success="getList" />
+</template>
+
+<script setup lang="ts">
+import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
+import { dateFormatter } from '@/utils/formatTime'
+import { SeckillConfigApi, SeckillConfigVO } from '@/api/mall/promotion/seckill/seckillConfig.ts'
+import SeckillConfigForm from './SeckillConfigForm.vue'
+import { CommonStatusEnum } from '@/utils/constants'
+
+/** 绉掓潃鏃舵 鍒楄〃 */
+defineOptions({ name: 'SeckillConfig' })
+
+const message = useMessage() // 娑堟伅寮圭獥
+const { t } = useI18n() // 鍥介檯鍖�
+
+const loading = ref(true) // 鍒楄〃鐨勫姞杞戒腑
+const list = ref<SeckillConfigVO[]>([]) // 鍒楄〃鐨勬暟鎹�
+const total = ref(0) // 鍒楄〃鐨勬�婚〉鏁�
+const queryParams = reactive({
+ pageNo: 1,
+ pageSize: 10,
+ name: undefined,
+ status: undefined
+})
+const queryFormRef = ref() // 鎼滅储鐨勮〃鍗�
+const exportLoading = ref(false) // 瀵煎嚭鐨勫姞杞戒腑
+
+/** 鏌ヨ鍒楄〃 */
+const getList = async () => {
+ loading.value = true
+ try {
+ const data = await SeckillConfigApi.getSeckillConfigPage(queryParams)
+ list.value = data.list
+ total.value = data.total
+ } finally {
+ loading.value = false
+ }
+}
+
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+ queryParams.pageNo = 1
+ getList()
+}
+
+/** 閲嶇疆鎸夐挳鎿嶄綔 */
+const resetQuery = () => {
+ queryFormRef.value.resetFields()
+ handleQuery()
+}
+
+/** 娣诲姞/淇敼鎿嶄綔 */
+const formRef = ref()
+const openForm = (type: string, id?: number) => {
+ formRef.value.open(type, id)
+}
+
+/** 鍒犻櫎鎸夐挳鎿嶄綔 */
+const handleDelete = async (id: number) => {
+ try {
+ // 鍒犻櫎鐨勪簩娆$‘璁�
+ await message.delConfirm()
+ // 鍙戣捣鍒犻櫎
+ await SeckillConfigApi.deleteSeckillConfig(id)
+ message.success(t('common.delSuccess'))
+ // 鍒锋柊鍒楄〃
+ await getList()
+ } catch {}
+}
+
+/** 淇敼鐢ㄦ埛鐘舵�� */
+const handleStatusChange = async (row: 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()
+})
+</script>
--
Gitblit v1.8.0