Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
snow-guizhou-web-frontend
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
雪花
snow-guizhou-web-frontend
Commits
c698518d
提交
c698518d
authored
5月 11, 2022
作者:
郁骅焌
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优惠券列表
上级
5e5321f2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
251 行增加
和
0 行删除
+251
-0
list.js
src/api/coupon/list.js
+19
-0
index.vue
src/views/coupon/list/index.vue
+232
-0
没有找到文件。
src/api/coupon/list.js
0 → 100644
浏览文件 @
c698518d
import
request
from
'@/utils/request'
// 查询列表
export
function
listCoupon
(
data
)
{
return
request
({
url
:
'/xh/coupon/coupon/xhlist'
,
method
:
'post'
,
data
:
data
})
}
// 修改状态
export
function
editStatus
(
data
)
{
return
request
({
url
:
'/xh/coupon/coupon/editStatus'
,
method
:
'post'
,
data
:
data
})
}
src/views/coupon/list/index.vue
0 → 100644
浏览文件 @
c698518d
<
template
>
<div
class=
"app-container"
>
<xy-table
ref=
"tableRef"
:table=
"table"
:columns=
"columns"
>
<template
#
couponType=
"
{ scope }">
<dict-tag
:options=
"dict.type.coupon_type"
:value=
"scope.row.couponType"
/>
</
template
>
<
template
#
expiryType=
"{ scope }"
>
{{
scope
.
row
.
expiryType
===
'1'
?
`${scope.row.fixedEffectiveTime
}
~ ${scope.row.fixedExpiryTime
}
`
:
`领取后${scope.row.expiryDayNum
}
天内`
}}
<
/template
>
<
template
#
left
=
"{ scope
}
"
>
{{
scope
.
row
.
total
-
scope
.
row
.
used
}}
<
/template
>
<
template
#
state
=
"{ scope
}
"
>
<!--
<
el
-
switch
v
-
model
=
"scope.row.status"
active
-
value
=
"A"
inactive
-
value
=
"P"
@
change
=
"handleStatusChange(scope.row)"
/>
-->
{{
scope
.
row
.
state
===
'A'
?
'启用'
:
scope
.
row
.
state
===
'P'
?
'禁用'
:
''
}}
<
/template
>
<
/xy-table
>
<!--
添加或修改岗位对话框
-->
<
el
-
dialog
:
title
=
"title"
:
visible
.
sync
=
"open"
width
=
"500px"
append
-
to
-
body
>
<
el
-
form
ref
=
"form"
:
model
=
"form"
:
rules
=
"rules"
label
-
width
=
"120px"
>
<
el
-
form
-
item
label
=
"分类名称"
prop
=
"categoryName"
>
<
el
-
input
v
-
model
=
"form.categoryName"
placeholder
=
"请输入分类名称"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"是否前端展示"
prop
=
"isShow"
>
<
el
-
radio
-
group
v
-
model
=
"form.isShow"
>
<
el
-
radio
v
-
for
=
"dict in dict.type.classify_isshow"
:
key
=
"dict.value"
:
label
=
"dict.value"
>
{{
dict
.
label
}}
<
/el-radio
>
<
/el-radio-group
>
<
/el-form-item
>
<
/el-form
>
<
div
slot
=
"footer"
class
=
"dialog-footer"
>
<
el
-
button
type
=
"primary"
@
click
=
"submitForm"
>
确
定
<
/el-button
>
<
el
-
button
@
click
=
"cancel"
>
取
消
<
/el-button
>
<
/div
>
<
/el-dialog
>
<
/div
>
<
/template
>
<
script
>
import
{
listCoupon
,
editStatus
}
from
'@/api/coupon/list'
export
default
{
name
:
'CouponList'
,
dicts
:
[
'coupon_type'
],
data
()
{
return
{
open
:
false
,
title
:
undefined
,
form
:
{
id
:
undefined
,
categoryName
:
undefined
,
isShow
:
'0'
}
,
rules
:
{
categoryName
:
[
{
required
:
true
,
message
:
"分类名称不能为空"
,
trigger
:
"blur"
}
]
}
,
table
:
{
rowKey
:
'couponInfoId'
,
data
:
[],
firstColumn
:
{
type
:
'index'
}
,
// hiddenLine: true,
// 表格内操作列
operator
:
[
{
text
:
'编辑'
,
icon
:
'el-icon-edit'
,
fun
:
(
row
)
=>
this
.
handleEdit
(
row
)
}
,
{
text
:
'启用'
,
icon
:
'el-icon-check'
,
show
:
{
key
:
'state'
,
val
:
[
'P'
]
}
,
fun
:
(
row
)
=>
this
.
handleStatusChange
(
row
)
}
,
{
text
:
'禁用'
,
icon
:
'el-icon-close'
,
show
:
{
key
:
'state'
,
val
:
[
'A'
]
}
,
fun
:
(
row
)
=>
this
.
handleStatusChange
(
row
)
}
,
{
text
:
'数据'
,
icon
:
'el-icon-help'
,
fun
:
(
row
)
=>
this
.
handleMoreData
(
row
)
}
],
// 操作列样式
operatorConfig
:
{
width
:
180
}
,
// 表格外操作
toolbar
:
[
//
{
// text: '新增分类',
// icon: 'el-icon-plus',
// type: 'primary',
// fun: () => this.handleAdd()
//
}
],
// 分页配置
page
:
{
total
:
0
,
pageNum
:
1
,
pageSize
:
10
}
,
// 搜索表单配置
searchForm
:
{
formLabelWidth
:
'90px'
,
formData
:
{
couponName
:
undefined
,
state
:
undefined
,
couponType
:
undefined
}
,
fieldList
:
[
{
prop
:
'couponName'
,
label
:
'优惠券标题'
,
type
:
'input'
}
,
{
prop
:
'state'
,
label
:
'状态'
,
type
:
'select'
,
options
:
'stateOptions'
}
,
{
prop
:
'couponType'
,
label
:
'优惠券类型'
,
type
:
'select'
,
options
:
'couponTypeOptions'
}
,
],
// 相关下拉列表
listOptions
:
{
stateOptions
:
[
{
value
:
'A'
,
label
:
'启用'
}
,
{
value
:
'P'
,
label
:
'禁用'
}
,
],
couponTypeOptions
:
[]
}
}
,
// 请求
request
:
listCoupon
}
,
columns
:
[
{
prop
:
'couponName'
,
label
:
'优惠券标题'
}
,
{
prop
:
'couponType'
,
label
:
'优惠券类型'
,
slotName
:
'couponType'
}
,
{
prop
:
'categoryName'
,
label
:
'优惠券分类'
}
,
{
prop
:
'expiryType'
,
label
:
'有效期'
,
slotName
:
'expiryType'
,
minWidth
:
200
}
,
{
prop
:
'total'
,
label
:
'总库存'
}
,
{
label
:
'剩余库存'
,
slotName
:
'left'
}
,
{
prop
:
'used'
,
label
:
'已发放'
}
,
{
prop
:
'state'
,
label
:
'状态'
,
slotName
:
'state'
}
]
}
}
,
mounted
()
{
this
.
initOptions
()
}
,
methods
:
{
initOptions
()
{
this
.
table
.
searchForm
.
listOptions
.
couponTypeOptions
=
this
.
dict
.
type
.
coupon_type
}
,
/** 查询列表 */
getList
()
{
this
.
$refs
.
tableRef
.
getData
()
}
,
/** 新增按钮操作 */
handleAdd
()
{
}
,
/** 编辑按钮操作 */
handleEdit
(
row
)
{
}
,
/** 删除按钮操作 */
async
handleDelete
(
row
)
{
}
,
handleStatusChange
(
row
)
{
const
text
=
row
.
state
===
'P'
?
'启用'
:
'禁用'
this
.
$modal
.
confirm
(
'确认要"'
+
text
+
'""'
+
row
.
couponName
+
'"优惠券吗?'
).
then
(
function
()
{
return
editStatus
({
id
:
row
.
couponInfoId
,
status
:
row
.
state
===
'P'
?
'A'
:
'P'
}
)
}
).
then
(()
=>
{
this
.
$modal
.
msgSuccess
(
text
+
'成功'
)
this
.
getList
()
}
).
catch
(
function
()
{
// row.status = row.status === 'P' ? 'A' : 'P'
}
)
}
,
handleMoreData
()
{
}
,
/** 提交按钮 */
submitForm
:
function
()
{
this
.
$refs
[
"form"
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
this
.
form
.
id
!=
undefined
)
{
updateClassify
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"修改成功"
);
this
.
open
=
false
;
this
.
getList
();
}
);
}
else
{
addClassify
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"新增成功"
);
this
.
open
=
false
;
this
.
getList
();
}
);
}
}
}
);
}
,
// 表单重置
reset
()
{
this
.
form
=
{
id
:
undefined
,
categoryName
:
undefined
,
isShow
:
'0'
}
;
this
.
resetForm
(
"form"
);
}
,
// 取消按钮
cancel
()
{
this
.
open
=
false
;
this
.
reset
();
}
,
}
}
<
/script
>
<
style
>
<
/style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论