|
@@ -4,11 +4,9 @@
|
|
|
|
|
|
|
|
<common-table ref="tableRef" :columns="columns" :page-config="pageConfig" :bodyStyle="{ padding: 0 }">
|
|
<common-table ref="tableRef" :columns="columns" :page-config="pageConfig" :bodyStyle="{ padding: 0 }">
|
|
|
<template #toolbar>
|
|
<template #toolbar>
|
|
|
- <div class="flex items-center justify-end w-full">
|
|
|
|
|
- <el-button type="primary" plain :icon="Plus" @click="handleCreate">
|
|
|
|
|
- 新增
|
|
|
|
|
- </el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <el-button type="primary" plain :icon="Plus" @click="handleCreate">
|
|
|
|
|
+ 新增
|
|
|
|
|
+ </el-button>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template #time="{ row }">
|
|
<template #time="{ row }">
|
|
@@ -16,7 +14,15 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template #limitFirst="{ row }">
|
|
<template #limitFirst="{ row }">
|
|
|
- {{ row.limitFirst ? '是' : '否' }}
|
|
|
|
|
|
|
+ <el-tag :type="String(row.limitFirst) === '1' ? 'success' : 'info'">
|
|
|
|
|
+ {{ String(row.limitFirst) === '1' ? '限制' : '不限制' }}
|
|
|
|
|
+ </el-tag>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <template #status="{ row }">
|
|
|
|
|
+ <el-tag :type="String(row.status) === '1' ? 'success' : 'danger'">
|
|
|
|
|
+ {{ String(row.status) === '1' ? '开启' : '关闭' }}
|
|
|
|
|
+ </el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template #action="{ row }">
|
|
<template #action="{ row }">
|
|
@@ -27,8 +33,9 @@
|
|
|
<el-button type="success" link @click="handleViewData(row)">
|
|
<el-button type="success" link @click="handleViewData(row)">
|
|
|
[查看数据]
|
|
[查看数据]
|
|
|
</el-button>
|
|
</el-button>
|
|
|
- <el-button :type="row.status === 1 ? 'danger' : 'warning'" link @click="handleToggleStatus(row)">
|
|
|
|
|
- [{{ row.status === 1 ? '关闭活动' : '启动活动' }}]
|
|
|
|
|
|
|
+ <el-button :type="String(row.status) === '1' ? 'danger' : 'success'" link
|
|
|
|
|
+ @click="handleToggleStatus(row)">
|
|
|
|
|
+ [{{ String(row.status) === '1' ? '关闭活动' : '启动活动' }}]
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -39,74 +46,61 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { ref, reactive } from 'vue';
|
|
|
|
|
-import { EleMessage } from 'ele-admin-plus/es';
|
|
|
|
|
-import CommonTable from '@/components/CommonPage/CommonTable.vue';
|
|
|
|
|
-import request from '@/utils/request';
|
|
|
|
|
-import PageSearch from './components/PageSearch.vue';
|
|
|
|
|
-import ActivityEdit from './components/ActivityEdit.vue';
|
|
|
|
|
-import { Plus } from '@element-plus/icons-vue';
|
|
|
|
|
-
|
|
|
|
|
-defineOptions({ name: 'ShareDiscountActivity' });
|
|
|
|
|
-
|
|
|
|
|
-const tableRef = ref(null);
|
|
|
|
|
-const activityEditRef = ref(null);
|
|
|
|
|
-
|
|
|
|
|
-const pageConfig = reactive({
|
|
|
|
|
- pageUrl: '/marketing/shareDiscount/activity/list',
|
|
|
|
|
- fileName: '分享降价活动列表',
|
|
|
|
|
- cacheKey: 'shareDiscountActivityTable',
|
|
|
|
|
- rowKey: 'id'
|
|
|
|
|
-});
|
|
|
|
|
-
|
|
|
|
|
-const columns = ref([
|
|
|
|
|
- { label: '活动名称', prop: 'activityName', minWidth: 150 },
|
|
|
|
|
- { label: '活动时间', slot: 'time', minWidth: 300 },
|
|
|
|
|
- { label: '是否限制首单', slot: 'limitFirst', width: 120 },
|
|
|
|
|
- { label: '操作', slot: 'action', width: 250, fixed: 'right' }
|
|
|
|
|
-]);
|
|
|
|
|
-
|
|
|
|
|
-const reload = (where) => {
|
|
|
|
|
- tableRef.value?.reload(where);
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-const handleCreate = () => {
|
|
|
|
|
- activityEditRef.value?.handleOpen();
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-const handleEdit = (row) => {
|
|
|
|
|
- request.get(`/marketing/shareDiscount/activity/info/${row.id}`).then((res) => {
|
|
|
|
|
- if (res.data.code === 200) {
|
|
|
|
|
- activityEditRef.value?.handleOpen(res.data.data);
|
|
|
|
|
- } else {
|
|
|
|
|
- EleMessage.error(res.data.msg || '获取详情失败');
|
|
|
|
|
- }
|
|
|
|
|
- }).catch(() => {
|
|
|
|
|
- activityEditRef.value?.handleOpen(row);
|
|
|
|
|
|
|
+ import { ref, reactive } from 'vue';
|
|
|
|
|
+ import { EleMessage } from 'ele-admin-plus/es';
|
|
|
|
|
+ import CommonTable from '@/components/CommonPage/CommonTable.vue';
|
|
|
|
|
+ import request from '@/utils/request';
|
|
|
|
|
+ import PageSearch from './components/PageSearch.vue';
|
|
|
|
|
+ import ActivityEdit from './components/ActivityEdit.vue';
|
|
|
|
|
+ import { Plus } from '@element-plus/icons-vue';
|
|
|
|
|
+
|
|
|
|
|
+ defineOptions({ name: 'ShareDiscountActivity' });
|
|
|
|
|
+
|
|
|
|
|
+ const tableRef = ref(null);
|
|
|
|
|
+ const activityEditRef = ref(null);
|
|
|
|
|
+
|
|
|
|
|
+ const pageConfig = reactive({
|
|
|
|
|
+ pageUrl: '/activity/activityReduceInfo/pagelist',
|
|
|
|
|
+ fileName: '分享降价活动列表',
|
|
|
|
|
+ cacheKey: 'shareDiscountActivityTable',
|
|
|
|
|
+ rowKey: 'id'
|
|
|
});
|
|
});
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-const handleViewData = (row) => {
|
|
|
|
|
- EleMessage.info('查看数据功能待对接');
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-const handleToggleStatus = (row) => {
|
|
|
|
|
- const newStatus = row.status === 1 ? 0 : 1;
|
|
|
|
|
- const actionText = newStatus === 1 ? '启动' : '关闭';
|
|
|
|
|
-
|
|
|
|
|
- request.post('/marketing/shareDiscount/activity/status', { id: row.id, status: newStatus })
|
|
|
|
|
- .then(res => {
|
|
|
|
|
- if (res.data.code === 200) {
|
|
|
|
|
- EleMessage.success(`${actionText}成功`);
|
|
|
|
|
- reload();
|
|
|
|
|
- } else {
|
|
|
|
|
- EleMessage.error(res.data.msg || `${actionText}失败`);
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- .catch(() => {
|
|
|
|
|
- // Mock success
|
|
|
|
|
- EleMessage.success(`${actionText}成功 (Mock)`);
|
|
|
|
|
- row.status = newStatus;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const columns = ref([
|
|
|
|
|
+ { label: '活动名称', prop: 'activityName', minWidth: 150 },
|
|
|
|
|
+ { label: '活动时间', slot: 'time', minWidth: 300 },
|
|
|
|
|
+ { label: '是否限制首单', slot: 'limitFirst', minWidth: 120 },
|
|
|
|
|
+ { label: '状态', slot: 'status', minWidth: 100 },
|
|
|
|
|
+ { label: '创建时间', prop: 'createTime', minWidth: 180 },
|
|
|
|
|
+ { label: '操作', slot: 'action', minWidth: 200, fixed: 'right' }
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ const reload = (where) => {
|
|
|
|
|
+ tableRef.value?.reload(where);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const handleCreate = () => {
|
|
|
|
|
+ activityEditRef.value?.handleOpen();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const handleEdit = (row) => {
|
|
|
|
|
+ activityEditRef.value?.handleOpen(row);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const handleViewData = (row) => {
|
|
|
|
|
+ EleMessage.info('查看数据功能待对接');
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const handleToggleStatus = (row) => {
|
|
|
|
|
+ // 0-关闭 1-开启
|
|
|
|
|
+ let message = row.status == 1 ? '确认关闭活动?' : '确认开启活动?';
|
|
|
|
|
+ let data = {
|
|
|
|
|
+ activityId: row.id,
|
|
|
|
|
+ status: row.status == 1 ? 0 : 1
|
|
|
|
|
+ };
|
|
|
|
|
+ pageRef.value?.messageBoxConfirm({
|
|
|
|
|
+ message,
|
|
|
|
|
+ fetch: () => request.post('/activity/activityReduceInfo/changeStatus', data)
|
|
|
});
|
|
});
|
|
|
-};
|
|
|
|
|
|
|
+ };
|
|
|
</script>
|
|
</script>
|