1
1
<template >
2
2
<doc-alert title =" 功能开启" url =" https://doc.iocoder.cn/mall/build/" />
3
3
4
+ <!-- 搜索工作栏 -->
4
5
<ContentWrap >
5
- <!-- 搜索工作栏 -->
6
- <el-form :model =" queryParams" ref =" queryFormRef" :inline =" true" label-width =" 68px" >
6
+ <el-form
7
+ ref =" queryFormRef"
8
+ :inline =" true"
9
+ :model =" queryParams"
10
+ class =" -mb-15px"
11
+ label-width =" 68px"
12
+ >
7
13
<el-form-item label =" 会员昵称" prop =" nickname" >
8
14
<el-input
9
15
v-model =" queryParams.nickname"
16
+ class =" !w-240px"
10
17
placeholder =" 请输入会员昵称"
11
18
clearable
12
19
@keyup =" handleQuery"
15
22
<el-form-item label =" 创建时间" prop =" createTime" >
16
23
<el-date-picker
17
24
v-model =" queryParams.createTime"
18
- style =" width : 240px "
19
- type =" datetimerange"
20
25
value-format =" YYYY-MM-DD HH:mm:ss"
21
- range-separator = " - "
26
+ type = " daterange "
22
27
start-placeholder =" 开始日期"
23
28
end-placeholder =" 结束日期"
24
- :default-time =" [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]"
29
+ :default-time =" [new Date('1 00:00:00'), new Date('1 23:59:59')]"
30
+ class =" !w-240px"
25
31
/>
26
32
</el-form-item >
27
33
<el-form-item >
31
37
<el-button @click =" resetQuery" > <Icon icon =" ep:refresh" class =" mr-5px" />重置 </el-button >
32
38
</el-form-item >
33
39
</el-form >
34
-
35
- <!-- 操作工具栏 -->
36
- <!-- <el-row :gutter="10" class="mb8">
37
- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
38
- </el-row> -->
39
40
</ContentWrap >
40
41
41
42
<ContentWrap >
86
87
<el-table-column label =" 操作" align =" center" class-name =" small-padding fixed-width" >
87
88
<template #default =" scope " >
88
89
<el-button
89
- size =" small"
90
- type =" primary"
91
- link
92
- @click =" handleDelete(scope.row)"
93
90
v-hasPermi =" ['promotion:coupon:delete']"
94
- ><Icon icon =" ep:delete" :size =" 12" class =" mr-1px" />回收</el-button
91
+ type =" danger"
92
+ link
93
+ @click =" handleDelete(scope.row.id)"
95
94
>
95
+ 回收
96
+ </el-button >
96
97
</template >
97
98
</el-table-column >
98
99
</el-table >
99
-
100
- <!-- 分页组件 -->
101
- <pagination
102
- v-show =" total > 0"
103
- :total =" total"
104
- v-model:page =" queryParams.pageNo"
100
+ <!-- 分页 -->
101
+ <Pagination
105
102
v-model:limit =" queryParams.pageSize"
103
+ v-model:page =" queryParams.pageNo"
104
+ :total =" total"
106
105
@pagination =" getList"
107
106
/>
108
107
</ContentWrap >
112
111
import { deleteCoupon , getCouponPage } from ' @/api/mall/promotion/coupon'
113
112
import { DICT_TYPE , getIntDictOptions } from ' @/utils/dict'
114
113
import { dateFormatter } from ' @/utils/formatTime'
115
- import { FormInstance } from ' element-plus'
116
114
117
- // 消息弹窗
118
- const message = useMessage ()
115
+ defineOptions ({ name: ' PromotionCoupon' })
116
+
117
+ const message = useMessage () // 消息弹窗
119
118
120
- // 遮罩层
121
- const loading = ref (true )
122
- // 总条数
123
- const total = ref (0 )
124
- // 优惠劵列表
125
- const list = ref ([])
119
+ const loading = ref (true ) // 列表的加载中
120
+ const total = ref (0 ) // 列表的总页数
121
+ const list = ref ([]) // 字典表格数据
126
122
// 查询参数
127
123
const queryParams = reactive ({
128
124
pageNo: 1 ,
129
125
pageSize: 10 ,
130
126
createTime: [],
131
127
status: undefined
132
128
})
133
- // Tab 筛选
134
- const activeTab = ref (' all' )
129
+ const queryFormRef = ref () // 搜索的表单
135
130
131
+ const activeTab = ref (' all' ) // Tab 筛选
136
132
const statusTabs = reactive ([
137
133
{
138
134
label: ' 全部' ,
139
135
value: ' all'
140
136
}
141
137
])
142
138
143
- const queryFormRef = ref <FormInstance | null >(null )
144
-
145
139
/** 查询列表 */
146
140
const getList = async () => {
147
141
loading .value = true
@@ -168,16 +162,17 @@ const resetQuery = () => {
168
162
}
169
163
170
164
/** 删除按钮操作 */
171
- const handleDelete = async (row ) => {
172
- const id = row .id
173
-
165
+ const handleDelete = async (id : number ) => {
174
166
try {
167
+ // 二次确认
175
168
await message .confirm (
176
169
' 回收将会收回会员领取的待使用的优惠券,已使用的将无法回收,确定要回收所选优惠券吗?'
177
170
)
171
+ // 发起删除
178
172
await deleteCoupon (id )
179
- getList ()
180
173
message .notifySuccess (' 回收成功' )
174
+ // 重新加载列表
175
+ await getList ()
181
176
} catch {}
182
177
}
183
178
@@ -187,6 +182,7 @@ const onTabChange = (tabName) => {
187
182
getList ()
188
183
}
189
184
185
+ /** 初始化 **/
190
186
onMounted (() => {
191
187
getList ()
192
188
// 设置 statuses 过滤
0 commit comments