Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_web
Commits
062283b4
Commit
062283b4
authored
Jan 09, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加团购优惠卷管理页面
parent
bba5187a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
580 additions
and
29 deletions
+580
-29
coupon.js
src/api/system/coupon.js
+16
-0
index.vue
src/views/system/consumer/index.vue
+20
-3
index.vue
src/views/system/consumerCoupon/index.vue
+1
-18
durationIndex.vue
src/views/system/coupon/durationIndex.vue
+471
-0
index.vue
src/views/system/coupon/index.vue
+72
-8
No files found.
src/api/system/coupon.js
View file @
062283b4
...
...
@@ -9,6 +9,22 @@ export function listCoupon(query) {
})
}
export
function
listDuration
(
query
)
{
return
request
({
url
:
'/system/coupon/list/duration'
,
method
:
'get'
,
params
:
query
})
}
export
function
listGroup
(
query
)
{
return
request
({
url
:
'/system/coupon/list/group'
,
method
:
'get'
,
params
:
query
})
}
// 查询优惠券详细
export
function
getCoupon
(
id
)
{
return
request
({
...
...
src/views/system/consumer/index.vue
View file @
062283b4
...
...
@@ -268,6 +268,7 @@
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"时长"
align
=
"center"
prop
=
"duration"
/>
<
el
-
table
-
column
label
=
"优惠金额"
align
=
"center"
prop
=
"subPrice"
/>
<
el
-
table
-
column
label
=
"平台类型"
align
=
"center"
prop
=
"platformType"
>
<
template
slot
-
scope
=
"scope"
>
<
dict
-
tag
:
options
=
"dict.type.store_platform_type"
:
value
=
"scope.row.platformType"
/>
...
...
@@ -304,6 +305,13 @@
<
/template
>
<
/el-table-column
>
<
/el-table
>
<
pagination
v
-
show
=
"couponTotal>0"
:
total
=
"couponTotal"
:
page
.
sync
=
"couponQueryParams.pageNum"
:
limit
.
sync
=
"couponQueryParams.pageSize"
@
pagination
=
"getCouponList"
/>
<
div
slot
=
"footer"
class
=
"dialog-footer"
>
<
el
-
button
@
click
=
"couponCancel"
>
取
消
<
/el-button
>
<
/div
>
...
...
@@ -334,6 +342,7 @@ export default {
showSearch
:
true
,
// 总条数
total
:
0
,
couponTotal
:
0
,
// 会员用户表格数据
consumerList
:
[],
couponList
:
[],
...
...
@@ -358,6 +367,10 @@ export default {
totalTimes
:
null
,
duration
:
null
}
,
couponQueryParams
:
{
pageNum
:
1
,
pageSize
:
10
}
,
// 表单参数
form
:
{
}
,
couponForm
:
{
}
,
...
...
@@ -388,6 +401,12 @@ export default {
this
.
loading
=
false
;
}
);
}
,
getCouponList
()
{
listCoupon
(
this
.
couponQueryParams
).
then
(
response
=>
{
this
.
couponList
=
response
.
rows
;
this
.
couponTotal
=
response
.
total
;
}
);
}
,
// 取消按钮
cancel
()
{
this
.
open
=
false
;
...
...
@@ -481,9 +500,7 @@ export default {
give
(
row
)
{
this
.
consumerId
=
row
.
id
;
this
.
couponLoading
=
true
;
listCoupon
().
then
(
response
=>
{
this
.
couponList
=
response
.
rows
;
}
);
this
.
getCouponList
();
this
.
couponLoading
=
false
;
this
.
couponOpen
=
true
;
this
.
couponTitle
=
"优惠卷列表"
;
...
...
src/views/system/consumerCoupon/index.vue
View file @
062283b4
...
...
@@ -190,32 +190,15 @@
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"ID"
align=
"center"
prop=
"id"
/>
<el-table-column
label=
"用户ID"
align=
"center"
prop=
"consumerId"
/>
<!--
<el-table-column
label=
"优惠券ID"
align=
"center"
prop=
"couponId"
/>
-->
<el-table-column
label=
"优惠券编码"
align=
"center"
prop=
"couponCode"
/>
<el-table-column
label=
"优惠券名称"
align=
"center"
prop=
"name"
width=
"240px"
/>
<!--
<el-table-column
label=
"优惠房型"
align=
"center"
prop=
"roomType"
/>
-->
<!--
<el-table-column
label=
"优惠房型"
align=
"center"
prop=
"roomType"
width=
"240px"
>
-->
<!--
<template
slot-scope=
"scope"
>
-->
<!--
<div
v-if=
"scope.row.roomType.length"
style=
"display: flex;flex-wrap: wrap;width: 100%;"
>
-->
<!--
<dict-tag
style=
"margin: 0 3px;"
v-for=
"(item ,k) in scope.row.roomType"
:key=
"k"
--
>
<!-- :options="dict.type.store_room_type" :value="item"-->
<!-- />-->
<!--
</div>
-->
<!--
</
template
>
-->
<!-- </el-table-column>-->
<!-- <el-table-column label="优惠开始" align="center" prop="couponTimeStart"/>-->
<!-- <el-table-column label="优惠结束" align="center" prop="couponTimeEnd"/>-->
<!-- <el-table-column label="优惠券类型" align="center" prop="couponType" />-->
<el-table-column
label=
"优惠券类型"
align=
"center"
prop=
"couponType"
>
<template
slot-scope=
"scope"
>
<dict-tag
:options=
"dict.type.store_coupon_type"
:value=
"scope.row.couponType"
/>
</
template
>
</el-table-column>
<!-- <el-table-column label="折扣最大时长" align="center" prop="maxDuration"/>-->
<!-- <el-table-column label="时长" align="center" prop="duration"/>-->
<!-- <el-table-column label="门槛金额" align="center" prop="minPrice"/>-->
<el-table-column
label=
"时长"
align=
"center"
prop=
"duration"
/>
<el-table-column
label=
"优惠金额"
align=
"center"
prop=
"subPrice"
/>
<!-- <el-table-column label="优惠券来源" align="center" prop="sourceType" />-->
<el-table-column
label=
"优惠券来源"
align=
"center"
prop=
"sourceType"
>
<
template
slot-scope=
"scope"
>
<dict-tag
:options=
"dict.type.consumer_coupon_source_type"
:value=
"scope.row.sourceType"
/>
...
...
src/views/system/coupon/durationIndex.vue
0 → 100644
View file @
062283b4
<
template
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:inline=
"true"
v-show=
"showSearch"
label-width=
"120px"
>
<el-form-item
label=
"优惠券名称"
prop=
"name"
>
<el-input
v-model=
"queryParams.name"
placeholder=
"请输入优惠券名称"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"优惠券类型"
prop=
"couponType"
>
<el-select
v-model=
"queryParams.couponType"
placeholder=
"请选择优惠券类型"
clearable
>
<el-option
v-for=
"dict in dict.type.store_coupon_type"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"第三方平台类型"
prop=
"platformType"
>
<el-select
v-model=
"queryParams.platformType"
placeholder=
"请选择第三方平台类型"
clearable
>
<el-option
v-for=
"dict in dict.type.store_platform_type"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"有效期开始"
prop=
"startDate"
>
<el-date-picker
clearable
v-model=
"queryParams.startDate"
type=
"date"
value-format=
"yyyy-MM-dd"
placeholder=
"请选择有效期开始"
>
</el-date-picker>
</el-form-item>
<el-form-item
label=
"有效期结束"
prop=
"endDate"
>
<el-date-picker
clearable
v-model=
"queryParams.endDate"
type=
"date"
value-format=
"yyyy-MM-dd"
placeholder=
"请选择有效期结束"
>
</el-date-picker>
</el-form-item>
<el-form-item
label=
"使用状态"
prop=
"useStatus"
>
<el-select
v-model=
"queryParams.useStatus"
placeholder=
"请选择使用状态"
clearable
>
<el-option
v-for=
"dict in dict.type.coupon_use_status"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"1.5"
>
<el-button
type=
"primary"
plain
icon=
"el-icon-plus"
size=
"mini"
@
click=
"handleAdd"
v-hasPermi=
"['system:coupon:add']"
>
新增
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"success"
plain
icon=
"el-icon-edit"
size=
"mini"
:disabled=
"single"
@
click=
"handleUpdate"
v-hasPermi=
"['system:coupon:edit']"
>
修改
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"danger"
plain
icon=
"el-icon-delete"
size=
"mini"
:disabled=
"multiple"
@
click=
"handleDelete"
v-hasPermi=
"['system:coupon:remove']"
>
删除
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"warning"
plain
icon=
"el-icon-download"
size=
"mini"
@
click=
"handleExport"
v-hasPermi=
"['system:coupon:export']"
>
导出
</el-button>
</el-col>
<right-toolbar
:showSearch
.
sync=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
<el-table
v-loading=
"loading"
:data=
"couponList"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"优惠券名称"
align=
"center"
prop=
"name"
/>
<el-table-column
label=
"优惠券类型"
align=
"center"
prop=
"couponType"
>
<template
slot-scope=
"scope"
>
<dict-tag
:options=
"dict.type.store_coupon_type"
:value=
"scope.row.couponType"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"时长"
align=
"center"
prop=
"duration"
/>
<el-table-column
label=
"平台类型"
align=
"center"
prop=
"platformType"
>
<
template
slot-scope=
"scope"
>
<dict-tag
:options=
"dict.type.store_platform_type"
:value=
"scope.row.platformType"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"订单类型"
align=
"center"
prop=
"orderType"
>
<
template
slot-scope=
"scope"
>
<dict-tag
:options=
"dict.type.store_order_type"
:value=
"scope.row.orderType"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"套餐"
align=
"center"
prop=
"packageId"
>
<
template
slot-scope=
"scope"
>
<div
v-if=
"scope.row.packageId"
style=
"display: flex;flex-wrap: wrap;width: 100%;"
>
<dict-tag
:options=
"packList"
:value=
"scope.row.packageId"
/>
</div>
</
template
>
</el-table-column>
<el-table-column
label=
"有效期开始"
align=
"center"
prop=
"startDate"
width=
"180"
>
<
template
slot-scope=
"scope"
>
<span>
{{
parseTime
(
scope
.
row
.
startDate
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"有效期结束"
align
=
"center"
prop
=
"endDate"
width
=
"180"
>
<
template
slot
-
scope
=
"scope"
>
<
span
>
{{
parseTime
(
scope
.
row
.
endDate
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"数量"
align
=
"center"
prop
=
"number"
/>
<
el
-
table
-
column
label
=
"备注"
align
=
"center"
prop
=
"remark"
/>
<
el
-
table
-
column
label
=
"操作"
align
=
"center"
class
-
name
=
"small-padding fixed-width"
>
<
template
slot
-
scope
=
"scope"
>
<
el
-
button
size
=
"mini"
type
=
"text"
icon
=
"el-icon-edit"
@
click
=
"handleUpdate(scope.row)"
v
-
hasPermi
=
"['system:coupon:edit']"
>
修改
<
/el-button
>
<
el
-
button
size
=
"mini"
type
=
"text"
icon
=
"el-icon-delete"
@
click
=
"handleDelete(scope.row)"
v
-
hasPermi
=
"['system:coupon:remove']"
>
删除
<
/el-button
>
<
/template
>
<
/el-table-column
>
<
/el-table
>
<
pagination
v
-
show
=
"total>0"
:
total
=
"total"
:
page
.
sync
=
"queryParams.pageNum"
:
limit
.
sync
=
"queryParams.pageSize"
@
pagination
=
"getList"
/>
<!--
添加或修改优惠券对话框
-->
<
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
=
"name"
>
<
el
-
input
v
-
model
=
"form.name"
placeholder
=
"请输入优惠券名称"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"优惠券类型"
prop
=
"couponType"
>
<
el
-
select
v
-
model
=
"form.couponType"
placeholder
=
"请选择优惠券类型"
>
<
el
-
option
v
-
for
=
"dict in dict.type.duration_coupon_type"
:
key
=
"dict.value"
:
label
=
"dict.label"
:
value
=
"parseInt(dict.value)"
><
/el-option
>
<
/el-select
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"时长"
prop
=
"duration"
>
<
el
-
input
-
number
v
-
model
=
"form.duration"
:
min
=
"0"
:
max
=
"24"
placeholder
=
"请输入时长"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"平台类型"
prop
=
"platformType"
>
<
el
-
select
v
-
model
=
"form.platformType"
placeholder
=
"请选择第三方平台类型"
>
<
el
-
option
v
-
for
=
"dict in dict.type.store_platform_type"
:
key
=
"dict.value"
:
label
=
"dict.label"
:
value
=
"parseInt(dict.value)"
><
/el-option
>
<
/el-select
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"订单类型"
prop
=
"orderType"
>
<
el
-
select
v
-
model
=
"form.orderType"
placeholder
=
"请选择订单类型"
>
<
el
-
option
v
-
for
=
"dict in dict.type.store_order_type"
:
key
=
"dict.value"
:
label
=
"dict.label"
:
value
=
"dict.value"
><
/el-option
>
<
/el-select
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"套餐"
prop
=
"packageId"
>
<
el
-
select
v
-
model
=
"form.packageId"
placeholder
=
"请选择套餐"
>
<
el
-
option
v
-
for
=
"dict in packList"
:
key
=
"dict.value"
:
label
=
"dict.label"
:
value
=
"dict.value"
><
/el-option
>
<
/el-select
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"有效期开始"
prop
=
"startDate"
>
<
el
-
date
-
picker
clearable
v
-
model
=
"form.startDate"
type
=
"date"
value
-
format
=
"yyyy-MM-dd"
placeholder
=
"请选择有效期开始"
>
<
/el-date-picker
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"有效期结束"
prop
=
"endDate"
>
<
el
-
date
-
picker
clearable
v
-
model
=
"form.endDate"
type
=
"date"
value
-
format
=
"yyyy-MM-dd"
placeholder
=
"请选择有效期结束"
>
<
/el-date-picker
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"数量"
prop
=
"number"
>
<
el
-
input
-
number
v
-
model
=
"form.number"
:
min
=
"0"
:
max
=
"9999"
label
=
"优惠卷数量"
/>
<!--
<
el
-
input
v
-
model
=
"form.number"
type
=
"textarea"
placeholder
=
"请输入数量"
/>-->
<
/el-form-item
>
<
el
-
form
-
item
label
=
"备注"
prop
=
"remark"
>
<
el
-
input
v
-
model
=
"form.remark"
type
=
"textarea"
placeholder
=
"请输入内容"
/>
<
/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
{
listDuration
,
getCoupon
,
delCoupon
,
addCoupon
,
updateCoupon
}
from
"@/api/system/coupon"
;
import
{
query
}
from
'@/api/system/pack'
export
default
{
name
:
"Coupon"
,
dicts
:
[
'store_coupon_type'
,
'store_type'
,
'store_room_type'
,
'store_platform_type'
,
'duration_coupon_type'
,
'store_order_type'
],
data
()
{
return
{
// 遮罩层
loading
:
true
,
// 选中数组
ids
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 显示搜索条件
showSearch
:
true
,
// 总条数
total
:
0
,
storeType
:
[],
roomType
:
[],
// 优惠券表格数据
couponList
:
[],
packList
:
[],
// 弹出层标题
title
:
""
,
// 是否显示弹出层
open
:
false
,
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
name
:
null
,
couponType
:
null
,
duration
:
null
,
minPrice
:
null
,
subPrice
:
null
,
useStatus
:
null
,
platformType
:
null
,
startDate
:
null
,
endDate
:
null
,
}
,
// 表单参数
form
:
{
}
,
// 表单校验
rules
:
{
name
:
[
{
required
:
true
,
message
:
"优惠券名称不能为空"
,
trigger
:
"blur"
}
],
couponType
:
[
{
required
:
true
,
message
:
"优惠券类型不能为空"
,
trigger
:
"change"
}
],
duration
:
[
{
required
:
true
,
message
:
"时长不能为空"
,
trigger
:
"blur"
}
],
}
}
;
}
,
created
()
{
this
.
getList
();
this
.
onPackList
();
}
,
methods
:
{
onChangeStoreType
(
e
)
{
console
.
log
(
e
)
this
.
form
.
storeType
=
e
.
join
()
}
,
onChangeRoomType
(
e
)
{
console
.
log
(
e
)
this
.
form
.
roomType
=
e
.
join
()
}
,
/** 查询优惠券列表 */
getList
()
{
this
.
loading
=
true
;
listDuration
(
this
.
queryParams
).
then
(
response
=>
{
this
.
couponList
=
response
.
rows
;
this
.
total
=
response
.
total
;
this
.
loading
=
false
;
}
);
}
,
onPackList
()
{
query
().
then
(
res
=>
{
this
.
packList
=
res
.
data
.
map
(
obj
=>
{
return
{
...
obj
,
raw
:
{
dictSort
:
1
,
dictValue
:
"1"
,
listClass
:
"primary"
,
cssClass
:
''
}
,
value
:
obj
.
id
.
toString
(),
label
:
obj
.
name
,
}
}
)
this
.
$forceUpdate
();
this
.
getList
();
}
)
}
,
// 取消按钮
cancel
()
{
this
.
open
=
false
;
this
.
reset
();
}
,
// 表单重置
reset
()
{
this
.
form
=
{
id
:
null
,
name
:
null
,
couponType
:
null
,
duration
:
null
,
minPrice
:
null
,
subPrice
:
null
,
platform
:
null
,
platformType
:
null
,
startDate
:
null
,
endDate
:
null
,
createBy
:
null
,
createTime
:
null
,
updateBy
:
null
,
updateTime
:
null
,
remark
:
null
}
;
this
.
resetForm
(
"form"
);
}
,
/** 搜索按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
;
this
.
getList
();
}
,
/** 重置按钮操作 */
resetQuery
()
{
this
.
resetForm
(
"queryForm"
);
this
.
handleQuery
();
}
,
// 多选框选中数据
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
}
,
/** 新增按钮操作 */
handleAdd
()
{
this
.
reset
();
this
.
open
=
true
;
this
.
title
=
"添加优惠券"
;
}
,
/** 修改按钮操作 */
handleUpdate
(
row
)
{
this
.
reset
();
const
id
=
row
.
id
||
this
.
ids
getCoupon
(
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
if
(
this
.
form
.
storeType
)
{
this
.
storeType
=
this
.
form
.
storeType
.
split
(
","
)
}
if
(
this
.
form
.
roomType
)
{
this
.
roomType
=
this
.
form
.
roomType
.
split
(
","
)
}
this
.
open
=
true
;
this
.
title
=
"修改优惠券"
;
}
);
}
,
/** 提交按钮 */
submitForm
()
{
this
.
$refs
[
"form"
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
this
.
form
.
id
!=
null
)
{
updateCoupon
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"修改成功"
);
this
.
open
=
false
;
this
.
getList
();
}
);
}
else
{
addCoupon
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"新增成功"
);
this
.
open
=
false
;
this
.
getList
();
}
);
}
}
}
);
}
,
/** 删除按钮操作 */
handleDelete
(
row
)
{
const
ids
=
row
.
id
||
this
.
ids
;
this
.
$modal
.
confirm
(
'是否确认删除优惠券编号为"'
+
ids
+
'"的数据项?'
).
then
(
function
()
{
return
delCoupon
(
ids
);
}
).
then
(()
=>
{
this
.
getList
();
this
.
$modal
.
msgSuccess
(
"删除成功"
);
}
).
catch
(()
=>
{
}
);
}
,
/** 导出按钮操作 */
handleExport
()
{
this
.
download
(
'system/coupon/export'
,
{
...
this
.
queryParams
}
,
`coupon_${new Date().getTime()
}
.xlsx`
)
}
}
}
;
<
/script
>
src/views/system/coupon/index.vue
View file @
062283b4
...
...
@@ -116,12 +116,25 @@
<dict-tag
:options=
"dict.type.store_coupon_type"
:value=
"scope.row.couponType"
/>
</
template
>
</el-table-column>
<
el-table-column
label=
"时长"
align=
"center"
prop=
"duration"
/
>
<
!-- <el-table-column label="时长" align="center" prop="duration" />--
>
<el-table-column
label=
"平台类型"
align=
"center"
prop=
"platformType"
>
<
template
slot-scope=
"scope"
>
<dict-tag
:options=
"dict.type.store_platform_type"
:value=
"scope.row.platformType"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"订单类型"
align=
"center"
prop=
"orderType"
>
<
template
slot-scope=
"scope"
>
<dict-tag
:options=
"dict.type.store_order_type"
:value=
"scope.row.orderType"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"套餐"
align=
"center"
prop=
"packageId"
>
<
template
slot-scope=
"scope"
>
<div
v-if=
"scope.row.packageId"
style=
"display: flex;flex-wrap: wrap;width: 100%;"
>
<dict-tag
:options=
"packList"
:value=
"scope.row.packageId"
/>
</div>
</
template
>
</el-table-column>
<el-table-column
label=
"优惠金额"
align=
"center"
prop=
"subPrice"
/>
<el-table-column
label=
"有效期开始"
align=
"center"
prop=
"startDate"
width=
"180"
>
<
template
slot-scope=
"scope"
>
<span>
{{
parseTime
(
scope
.
row
.
startDate
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/span
>
...
...
@@ -172,16 +185,16 @@
<
el
-
form
-
item
label
=
"优惠券类型"
prop
=
"couponType"
>
<
el
-
select
v
-
model
=
"form.couponType"
placeholder
=
"请选择优惠券类型"
>
<
el
-
option
v
-
for
=
"dict in dict.type.coupon_type"
v
-
for
=
"dict in dict.type.c
ash_c
oupon_type"
:
key
=
"dict.value"
:
label
=
"dict.label"
:
value
=
"parseInt(dict.value)"
><
/el-option
>
<
/el-select
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"时长"
prop
=
"duration"
>
<
el
-
input
-
number
v
-
model
=
"form.duration"
:
min
=
"0"
:
max
=
"24"
placeholder
=
"请输入时长"
/
>
<
/el-form-item
>
<
!--
<
el
-
form
-
item
label
=
"时长"
prop
=
"duration"
>--
>
<!--
<
el
-
input
-
number
v
-
model
=
"form.duration"
:
min
=
"0"
:
max
=
"24"
placeholder
=
"请输入时长"
/>--
>
<
!--
<
/el-form-item>--
>
<
el
-
form
-
item
label
=
"平台类型"
prop
=
"platformType"
>
<
el
-
select
v
-
model
=
"form.platformType"
placeholder
=
"请选择第三方平台类型"
>
<
el
-
option
...
...
@@ -192,6 +205,29 @@
><
/el-option
>
<
/el-select
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"订单类型"
prop
=
"orderType"
>
<
el
-
select
v
-
model
=
"form.orderType"
placeholder
=
"请选择订单类型"
>
<
el
-
option
v
-
for
=
"dict in dict.type.store_order_type"
:
key
=
"dict.value"
:
label
=
"dict.label"
:
value
=
"dict.value"
><
/el-option
>
<
/el-select
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"套餐"
prop
=
"packageId"
>
<
el
-
select
v
-
model
=
"form.packageId"
placeholder
=
"请选择套餐"
>
<
el
-
option
v
-
for
=
"dict in packList"
:
key
=
"dict.value"
:
label
=
"dict.label"
:
value
=
"dict.value"
><
/el-option
>
<
/el-select
>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"优惠金额"
prop
=
"subPrice"
>
<
el
-
input
-
number
v
-
model
=
"form.subPrice"
:
min
=
"0"
:
max
=
"9999"
label
=
"请输入优惠金额"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"有效期开始"
prop
=
"startDate"
>
<
el
-
date
-
picker
clearable
v
-
model
=
"form.startDate"
...
...
@@ -226,11 +262,12 @@
<
/template
>
<
script
>
import
{
listCoupon
,
getCoupon
,
delCoupon
,
addCoupon
,
updateCoupon
}
from
"@/api/system/coupon"
;
import
{
listGroup
,
getCoupon
,
delCoupon
,
addCoupon
,
updateCoupon
}
from
"@/api/system/coupon"
;
import
{
query
}
from
'@/api/system/pack'
export
default
{
name
:
"Coupon"
,
dicts
:
[
'store_coupon_type'
,
'store_type'
,
'store_room_type'
,
'store_platform_type'
,
'c
oupon
_type'
],
dicts
:
[
'store_coupon_type'
,
'store_type'
,
'store_room_type'
,
'store_platform_type'
,
'c
ash_coupon_type'
,
'store_order
_type'
],
data
()
{
return
{
// 遮罩层
...
...
@@ -249,6 +286,7 @@ export default {
roomType
:
[],
// 优惠券表格数据
couponList
:
[],
packList
:
[],
// 弹出层标题
title
:
""
,
// 是否显示弹出层
...
...
@@ -271,6 +309,10 @@ export default {
form
:
{
}
,
// 表单校验
rules
:
{
subPrice
:
[
//只保留2位小数
{
pattern
:
/^
(([
1-9
]
{1
}
\d
*
)
|
(
0{1
}
))(\.\d
{0,2
}
)?
$/
,
message
:
"请输入正确的优惠金额"
,
trigger
:
"blur"
}
],
name
:
[
{
required
:
true
,
message
:
"优惠券名称不能为空"
,
trigger
:
"blur"
}
],
...
...
@@ -285,6 +327,7 @@ export default {
}
,
created
()
{
this
.
getList
();
this
.
onPackList
();
}
,
methods
:
{
onChangeStoreType
(
e
){
...
...
@@ -299,12 +342,31 @@ export default {
/** 查询优惠券列表 */
getList
()
{
this
.
loading
=
true
;
list
Coupon
(
this
.
queryParams
).
then
(
response
=>
{
list
Group
(
this
.
queryParams
).
then
(
response
=>
{
this
.
couponList
=
response
.
rows
;
this
.
total
=
response
.
total
;
this
.
loading
=
false
;
}
);
}
,
onPackList
()
{
query
().
then
(
res
=>
{
this
.
packList
=
res
.
data
.
map
(
obj
=>
{
return
{
...
obj
,
raw
:
{
dictSort
:
1
,
dictValue
:
"1"
,
listClass
:
"primary"
,
cssClass
:
''
}
,
value
:
obj
.
id
.
toString
(),
label
:
obj
.
name
,
}
}
)
this
.
$forceUpdate
();
this
.
getList
();
}
)
}
,
// 取消按钮
cancel
()
{
this
.
open
=
false
;
...
...
@@ -359,6 +421,8 @@ export default {
const
id
=
row
.
id
||
this
.
ids
getCoupon
(
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
form
.
orderType
=
response
.
data
.
orderType
.
toString
();
this
.
form
.
packageId
=
response
.
data
.
packageId
.
toString
();
if
(
this
.
form
.
storeType
){
this
.
storeType
=
this
.
form
.
storeType
.
split
(
","
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment