Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kadycui
game-admin
提交
f0c34c15
game-admin
项目概览
kadycui
/
game-admin
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
game-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f0c34c15
编写于
9月 19, 2023
作者:
kadycui
💻
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ADD: 优惠券模块
上级
b107cd6c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
162 addition
and
4 deletion
+162
-4
src/api/coupon.js
src/api/coupon.js
+30
-0
src/pages/coupon/list.vue
src/pages/coupon/list.vue
+132
-4
未找到文件。
src/api/coupon.js
0 → 100644
浏览文件 @
f0c34c15
import
axios
from
'
@/axios
'
export
function
getCouponList
(
page
)
{
return
axios
.
get
(
`/admin/coupon/
${
page
}
`
)
}
export
function
createCoupon
(
data
)
{
return
axios
.
post
(
"
/admin/coupon
"
,
data
)
}
export
function
updateCoupon
(
id
,
data
)
{
return
axios
.
post
(
"
/admin/coupon/
"
+
id
,
data
)
}
export
function
deleteCoupon
(
id
)
{
return
axios
.
post
(
`/admin/coupon/
${
id
}
/delete`
)
}
export
function
updateCouponStatus
(
id
)
{
return
axios
.
post
(
`/admin/coupon/
${
id
}
/update_status`
,
{
status
:
0
})
}
\ No newline at end of file
src/pages/coupon/list.vue
浏览文件 @
f0c34c15
<
template
>
<div>
订单列表
</div>
</
template
>
\ No newline at end of file
<el-card
shadow=
"never"
class=
"border-0"
>
<!-- 新增 | 刷新 -->
<ListHeader
@
create=
"handleCreate"
@
refresh=
"getData"
/>
<el-table
:data=
"tableData"
stripe
style=
"width: 100%"
element-loading-text=
"加载中..."
element-loading-spinner=
"el-icon-loading"
v-loading=
"loading"
>
<el-table-column
label=
"优惠券名称"
width=
"350"
>
<template
#default
="
{ row }">
<div
class=
"border border-dashed py-2 px-4 rounded"
>
<h5
class=
"font-bold text-md"
>
{{
row
.
name
}}
</h5>
<small>
{{
row
.
start_time
}}
~
{{
row
.
end_time
}}
</small>
</div>
</
template
>
</el-table-column>
<el-table-column
prop=
"statusText"
label=
"状态"
/>
<el-table-column
label=
"优惠"
>
<
template
#default=
"{ row }"
>
{{
row
.
type
?
"
满减
"
:
"
折扣
"
}}
{{
row
.
type
?
(
"
¥
"
+
row
.
value
)
:(
row
.
value
+
"
折
"
)
}}
</
template
>
</el-table-column>
<el-table-column
prop=
"total"
label=
"发放数量"
/>
<el-table-column
prop=
"used"
label=
"已使用"
/>
<el-table-column
label=
"操作"
width=
"180"
align=
"center"
>
<
template
#default=
"scope"
>
<el-button
type=
"primary"
size=
"small"
text
@
click=
"handleEdit(scope.row)"
>
修改
</el-button>
<el-popconfirm
title=
"是否删除此公告?"
confirm-button-text=
"确认"
cancel-button-text=
"取消"
@
confirm=
"handleDelete(scope.row.id)"
>
<template
#reference
>
<el-button
text
type=
"primary"
size=
"small"
>
删除
</el-button>
</
template
>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
<div
class=
"flex items-center justify-center mt-5"
>
<el-pagination
background
layout=
"prev,pager, next"
:total=
"total"
:current-page=
"currentPage"
:page-size=
"limit"
@
current-change=
"getData"
/>
</div>
<FormDrawer
ref=
"formDrawerRef"
:title=
"drawerTitle"
@
submit=
"handleSubmit"
>
<el-form
:model=
"form"
ref=
"formRef"
:rules=
"rules"
label-width=
"80px"
:inline=
"false"
>
<el-form-item
label=
"公告标题"
prop=
"title"
>
<el-input
v-model=
"form.title"
placeholder=
"公告标题"
></el-input>
</el-form-item>
<el-form-item
label=
"公告内容"
prop=
"content"
>
<el-input
v-model=
"form.content"
placeholder=
"公告内容"
type=
"textarea"
:rows=
"5"
></el-input>
</el-form-item>
</el-form>
</FormDrawer>
</el-card>
</template>
<
script
setup
>
import
{
getCouponList
,
createCoupon
,
updateCoupon
,
deleteCoupon
,
updateCouponStatus
}
from
"
@/api/coupon
"
import
FormDrawer
from
"
@/components/FormDrawer.vue
"
import
ListHeader
from
"
@/components/ListHeader.vue
"
import
{
useInitTable
,
useInitForm
}
from
"
@/composables/useCommon.js
"
const
{
tableData
,
loading
,
currentPage
,
total
,
limit
,
getData
,
handleDelete
}
=
useInitTable
({
getList
:
getCouponList
,
delete
:
deleteCoupon
})
const
{
formDrawerRef
,
formRef
,
form
,
rules
,
drawerTitle
,
handleSubmit
,
handleCreate
,
handleEdit
}
=
useInitForm
(
{
form
:
{
title
:
""
,
content
:
""
},
rules
:
{
title
:
[
{
required
:
true
,
message
:
'
公告标题不能为空
'
,
trigger
:
'
blur
'
}
],
content
:
[
{
required
:
true
,
message
:
'
公告内容不能为空
'
,
trigger
:
'
blur
'
}
]
},
getData
,
update
:
updateCoupon
,
create
:
createCoupon
})
</
script
>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录