Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
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
hooloo
web
soss
Commits
02eff0ae
Commit
02eff0ae
authored
Jul 23, 2022
by
lixiaomin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
联调优惠券类别
parent
1a31de34
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
110 deletions
+126
-110
src/api/coupon/couponType.js
+24
-31
src/views/coupon/couponCategory/index.vue
+101
-78
vue.config.js
+1
-1
No files found.
src/api/coupon/couponType.js
View file @
02eff0ae
import
request
from
"@/utils/request"
;
import
request
from
"@/utils/request"
;
// 查询列表
// 查询列表
export
function
listClass
(
query
)
{
export
function
getCouCategoryList
(
data
)
{
return
request
({
return
request
({
url
:
"/system/category/list"
,
url
:
"/coupon-category"
,
method
:
"get"
,
method
:
"post"
,
params
:
query
,
data
:
data
,
});
}
// 查询列表
export
function
getList
(
query
)
{
return
request
({
url
:
"/system/category/getList"
,
method
:
"get"
,
params
:
query
,
});
});
}
}
//
查询详细
//
新增
export
function
getClass
(
id
)
{
export
function
addCouCategory
(
data
)
{
return
request
({
return
request
({
url
:
"/system/category/"
+
id
,
url
:
"/coupon-category"
,
method
:
"get"
,
method
:
"put"
,
data
:
data
,
});
});
}
}
// 新增
// 新增
export
function
addClass
(
data
)
{
export
function
updateCouCategory
(
data
)
{
return
request
({
return
request
({
url
:
"/
system/category
"
,
url
:
"/
coupon-category/update
"
,
method
:
"post"
,
method
:
"post"
,
data
:
data
,
data
:
data
,
});
});
}
}
//
修改
//
删除
export
function
updateClass
(
data
)
{
export
function
delCouCategory
(
id
)
{
return
request
({
return
request
({
url
:
"/system/category"
,
url
:
"/coupon-category/"
+
id
,
method
:
"put"
,
method
:
"delete"
,
data
:
data
,
});
});
}
}
//
删除
//
下架
export
function
delClass
(
id
)
{
export
function
offlineCouCategory
(
id
)
{
return
request
({
return
request
({
url
:
"/
system/category
/"
+
id
,
url
:
"/
coupon-category/offline
/"
+
id
,
method
:
"
delete
"
,
method
:
"
get
"
,
});
});
}
}
//
查询排序列表
//
上架
export
function
turnList
(
query
)
{
export
function
onlineCouCategory
(
id
)
{
return
request
({
return
request
({
url
:
"/
system/category/turnOrder"
,
url
:
"/
coupon-category/online/"
+
id
,
method
:
"get"
,
method
:
"get"
,
params
:
query
,
});
});
}
}
src/views/coupon/coupon
Type
/index.vue
→
src/views/coupon/coupon
Category
/index.vue
View file @
02eff0ae
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:inline=
"true"
label-width=
"68px"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:inline=
"true"
label-width=
"100px"
>
<el-form-item
label=
"分类名称 "
prop=
"name"
>
<el-form-item
label=
"优惠券类别"
>
<el-input
v-model=
"queryParams.name"
placeholder=
"分类名称 "
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
<el-select
v-model=
"queryParams.name"
filterable
placeholder=
"请选择优惠券类别"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
>
<el-option
v-for=
"item in nameList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.name"
>
</el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
label=
"状态"
>
<el-form-item
label=
"状态"
>
<el-select
v-model=
"queryParams.state"
placeholder=
"请选择"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
>
<el-select
v-model=
"queryParams.state"
placeholder=
"请选择
状态
"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
>
<el-option
<el-option
v-for=
"item in options"
v-for=
"item in options"
:key=
"item.value"
:key=
"item.value"
...
@@ -15,14 +22,14 @@
...
@@ -15,14 +22,14 @@
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
v-hasPermi=
"['
system
:category:query']"
>
搜索
</el-button>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
v-hasPermi=
"['
coupon
:category:query']"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"1.5"
>
<el-col
:span=
"1.5"
>
<el-button
type=
"primary"
plain
icon=
"el-icon-plus"
size=
"mini"
@
click=
"handleAdd"
<el-button
type=
"primary"
plain
icon=
"el-icon-plus"
size=
"mini"
@
click=
"handleAdd"
v-hasPermi=
"['
system
:category:add']"
>
新增
</el-button>
v-hasPermi=
"['
coupon
:category:add']"
>
新增
</el-button>
</el-col>
</el-col>
</el-row>
</el-row>
...
@@ -32,23 +39,25 @@
...
@@ -32,23 +39,25 @@
<a
@
click=
"handleUpdate(scope.row)"
style=
"color: blue"
>
{{
scope
.
row
.
name
}}
</a>
<a
@
click=
"handleUpdate(scope.row)"
style=
"color: blue"
>
{{
scope
.
row
.
name
}}
</a>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"折扣形式"
align=
"center"
prop=
"
code
"
/>
<el-table-column
label=
"折扣形式"
align=
"center"
prop=
"
typeDesc
"
/>
<el-table-column
label=
"优惠券数量"
align=
"center"
prop=
"
remarks
"
/>
<el-table-column
label=
"优惠券数量"
align=
"center"
prop=
"
couponCnt
"
/>
<el-table-column
label=
"通用简述"
align=
"center"
prop=
"
goodsCount
"
/>
<el-table-column
label=
"通用简述"
align=
"center"
prop=
"
desc
"
/>
<el-table-column
label=
"状态"
align=
"center"
prop=
"state"
>
<el-table-column
label=
"状态"
align=
"center"
prop=
"state"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<span
v-if=
"scope.row.state == 1"
>
启用
</span>
<span
v-if=
"scope.row.state == 1"
>
生效中
</span>
<span
v-if=
"scope.row.state == 2"
>
停用
</span>
<span
v-if=
"scope.row.state == 2"
>
未生效
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<el-button
v-show=
"scope.row.state == 2"
size=
"mini"
type=
"text"
icon=
"el-icon-edit"
@
click=
"handleStatus(scope.row,'1')"
<el-button
v-show=
"scope.row.state == 1"
size=
"mini"
type=
"text"
icon=
"el-icon-edit"
@
click=
"handleStatus(scope.row,'1')"
v-hasPermi=
"['system:category:restart']"
>
下线
</el-button>
v-hasPermi=
"['coupon:category:off']"
>
下线
</el-button>
<el-button
v-show=
"scope.row.state == 1"
size=
"mini"
type=
"text"
icon=
"el-icon-edit"
@
click=
"handleStatus(scope.row,'2')"
<el-button
v-show=
"scope.row.state == 2"
size=
"mini"
type=
"text"
icon=
"el-icon-edit"
@
click=
"handleStatus(scope.row,'2')"
v-hasPermi=
"['system:category:stop']"
>
上线
</el-button>
v-hasPermi=
"['coupon:category:online']"
>
上线
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-edit"
@
click=
"handleUpdate(scope.row)"
v-hasPermi=
"['coupon:category:edit']"
>
编辑
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row)"
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row)"
v-hasPermi=
"['
system
:category:remove']"
>
删除
</el-button>
v-hasPermi=
"['
coupon
:category:remove']"
>
删除
</el-button>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -58,21 +67,21 @@
...
@@ -58,21 +67,21 @@
<el-dialog
:title=
"title"
:visible
.
sync=
"open"
width=
"500px"
append-to-body
>
<el-dialog
:title=
"title"
:visible
.
sync=
"open"
width=
"500px"
append-to-body
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"类别名"
prop=
"name"
>
<el-form-item
label=
"类别名"
prop=
"name"
>
<el-input
v-model=
"form.name"
placeholder=
"请输入类别名"
minlength=
"1"
maxlength=
"
100
"
/>
<el-input
v-model=
"form.name"
placeholder=
"请输入类别名"
minlength=
"1"
maxlength=
"
7
"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"类别"
prop=
"
nam
e"
>
<el-form-item
label=
"类别"
prop=
"
typ
e"
>
<el-radio-group
v-model=
"form.
nam
e"
>
<el-radio-group
v-model=
"form.
typ
e"
>
<el-radio
:label=
"
3
"
>
抵扣
</el-radio>
<el-radio
:label=
"
1
"
>
抵扣
</el-radio>
<el-radio
:label=
"
6
"
>
折扣
</el-radio>
<el-radio
:label=
"
2
"
>
折扣
</el-radio>
<el-radio
:label=
"
9"
>
面
单
</el-radio>
<el-radio
:label=
"
3"
>
免
单
</el-radio>
</el-radio-group>
</el-radio-group>
</el-form-item>
</el-form-item>
<el-form-item
label=
"通用简述"
prop=
"
remarks
"
>
<el-form-item
label=
"通用简述"
prop=
"
desc
"
>
<el-input
v-model=
"form.
remarks
"
type=
"textarea"
placeholder=
"请输入内容"
maxlength=
"17"
/>
<el-input
v-model=
"form.
desc
"
type=
"textarea"
placeholder=
"请输入内容"
maxlength=
"17"
/>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
v-hasPermi=
"['
system
:category:edit']"
>
确 定
</el-button>
<el-button
type=
"primary"
@
click=
"submitForm"
v-hasPermi=
"['
coupon
:category:edit']"
>
确 定
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
</div>
</div>
</el-dialog>
</el-dialog>
...
@@ -81,12 +90,8 @@
...
@@ -81,12 +90,8 @@
<
script
>
<
script
>
import
{
import
{
listClass
,
addCouCategory
,
updateCouCategory
,
getCouCategoryList
,
offlineCouCategory
,
onlineCouCategory
,
delCouCategory
getClass
,
delClass
,
addClass
,
updateClass
,
turnList
}
from
"@/api/coupon/couponType"
;
}
from
"@/api/coupon/couponType"
;
export
default
{
export
default
{
...
@@ -111,34 +116,49 @@ export default {
...
@@ -111,34 +116,49 @@ export default {
state
:
null
state
:
null
},
},
// 表单参数
// 表单参数
form
:
{},
form
:
{
id
:
null
,
name
:
null
,
type
:
null
,
desc
:
null
,
state
:
null
},
// 表单校验
// 表单校验
rules
:
{
rules
:
{
name
:
[{
required
:
true
,
message
:
"不能为空"
,
trigger
:
"blur"
}],
name
:
[{
required
:
true
,
message
:
"不能为空"
,
trigger
:
"blur"
}],
status
:
[{
required
:
true
,
message
:
"不能为空"
,
trigger
:
"blur"
}],
type
:
[{
required
:
true
,
message
:
"不能为空"
,
trigger
:
"blur"
}],
code
:
[{
required
:
true
,
message
:
"不能为空"
,
trigger
:
"blur"
}],
desc
:
[{
required
:
true
,
message
:
"不能为空"
,
trigger
:
"blur"
}]
createTime
:
[{
required
:
true
,
message
:
"不能为空"
,
trigger
:
"blur"
}],
},
},
options
:
[{
options
:
[{
value
:
null
,
value
:
null
,
label
:
'全部'
label
:
'全部'
},
{
},{
value
:
'1'
,
value
:
'1'
,
label
:
'
启用
'
label
:
'
生效中
'
},
{
},{
value
:
'2'
,
value
:
'2'
,
label
:
'
停用
'
label
:
'
未生效
'
}],
}],
nameList
:[]
};
};
},
},
created
()
{
created
()
{
this
.
getList
();
this
.
getList
();
this
.
getNameList
();
},
},
methods
:
{
methods
:
{
/** 查询列表 */
/** 查询列表 */
getNameList
()
{
getCouCategoryList
(
this
.
queryParams
).
then
((
response
)
=>
{
this
.
nameList
=
response
.
rows
;
});
},
/** 查询列表 */
getList
()
{
getList
()
{
this
.
loading
=
true
;
this
.
loading
=
true
;
listClass
(
this
.
queryParams
).
then
((
response
)
=>
{
getCouCategoryList
(
this
.
queryParams
).
then
((
response
)
=>
{
this
.
couponTypeList
=
response
.
rows
;
this
.
couponTypeList
=
response
.
rows
;
this
.
total
=
response
.
total
;
this
.
total
=
response
.
total
;
this
.
loading
=
false
;
this
.
loading
=
false
;
...
@@ -154,10 +174,8 @@ export default {
...
@@ -154,10 +174,8 @@ export default {
this
.
form
=
{
this
.
form
=
{
id
:
null
,
id
:
null
,
name
:
null
,
name
:
null
,
status
:
"0"
,
type
:
null
,
remarks
:
null
,
desc
:
null
,
code
:
null
,
createTime
:
null
,
};
};
},
},
/** 搜索按钮操作 */
/** 搜索按钮操作 */
...
@@ -174,27 +192,26 @@ export default {
...
@@ -174,27 +192,26 @@ export default {
/** 新增按钮操作 */
/** 新增按钮操作 */
handleAdd
()
{
handleAdd
()
{
this
.
reset
();
this
.
open
=
true
;
this
.
open
=
true
;
this
.
title
=
"新增类别"
;
this
.
title
=
"新增类别"
;
},
},
/**
启用、禁用
按钮操作 */
/**
上线、下线
按钮操作 */
handleStatus
(
row
,
tag
)
{
handleStatus
(
row
,
tag
)
{
let
mess
=
""
;
let
mess
=
""
;
let
sta
=
""
;
if
(
tag
==
'1'
){
if
(
tag
==
'1'
){
mess
=
"启用"
;
mess
=
"下线"
;
sta
=
"1"
;
}
else
if
(
tag
==
'2'
){
}
else
if
(
tag
==
'2'
){
mess
=
"停用"
;
mess
=
"上线"
;
sta
=
"2"
;
}
}
this
.
$modal
this
.
$modal
.
confirm
(
'是否确认'
+
mess
+
'该数据项?'
)
.
confirm
(
'是否确认'
+
mess
+
'该数据项?'
)
.
then
(
function
()
{
.
then
(
function
()
{
return
updateClass
({
id
:
row
.
id
,
state
:
sta
});
if
(
tag
==
"1"
){
})
return
offlineCouCategory
(
row
.
id
);
.
then
((
response
)
=>
{
}
else
if
(
tag
==
"2"
){
return
onlineCouCategory
(
row
.
id
);
}
}).
then
((
response
)
=>
{
if
(
response
.
code
=
"200"
){
if
(
response
.
code
=
"200"
){
this
.
getList
();
this
.
getList
();
this
.
$modal
.
msgSuccess
(
''
+
mess
+
'成功'
);
this
.
$modal
.
msgSuccess
(
''
+
mess
+
'成功'
);
...
@@ -206,12 +223,13 @@ export default {
...
@@ -206,12 +223,13 @@ export default {
/** 修改按钮操作 */
/** 修改按钮操作 */
handleUpdate
(
row
)
{
handleUpdate
(
row
)
{
this
.
reset
();
this
.
reset
();
const
id
=
row
.
id
||
this
.
ids
;
let
obj
=
Object
.
assign
({},
row
);
getClass
(
id
).
then
((
response
)
=>
{
this
.
form
.
id
=
obj
.
id
;
this
.
form
=
response
.
data
;
this
.
form
.
name
=
obj
.
name
;
this
.
open
=
true
;
this
.
form
.
type
=
obj
.
type
;
this
.
title
=
"修改商品分类"
;
this
.
form
.
desc
=
obj
.
desc
;
});
this
.
open
=
true
;
this
.
title
=
"修改类别"
;
},
},
/** 提交按钮 */
/** 提交按钮 */
submitForm
()
{
submitForm
()
{
...
@@ -219,19 +237,23 @@ export default {
...
@@ -219,19 +237,23 @@ export default {
if
(
valid
)
{
if
(
valid
)
{
if
(
this
.
form
.
id
!=
null
)
{
if
(
this
.
form
.
id
!=
null
)
{
if
(
this
.
form
.
state
==
"1"
){
if
(
this
.
form
.
state
==
"1"
){
this
.
$message
.
error
(
"
停用之后才可以修改
"
);
this
.
$message
.
error
(
"
修改类别需先下架类别!
"
);
return
;
return
;
}
}
updateClass
(
this
.
form
).
then
((
response
)
=>
{
updateCouCategory
(
this
.
form
).
then
((
response
)
=>
{
this
.
$modal
.
msgSuccess
(
"修改成功"
);
if
(
response
.
code
==
"200"
){
this
.
open
=
false
;
this
.
$modal
.
msgSuccess
(
"修改成功"
);
this
.
getList
();
this
.
open
=
false
;
this
.
getList
();
}
});
});
}
else
{
}
else
{
addClass
(
this
.
form
).
then
((
response
)
=>
{
addCouCategory
(
this
.
form
).
then
((
response
)
=>
{
this
.
$modal
.
msgSuccess
(
"新增成功"
);
if
(
response
.
code
==
"200"
){
this
.
open
=
false
;
this
.
$modal
.
msgSuccess
(
"新增成功"
);
this
.
getList
();
this
.
open
=
false
;
this
.
getList
();
}
});
});
}
}
}
}
...
@@ -240,19 +262,20 @@ export default {
...
@@ -240,19 +262,20 @@ export default {
/** 删除按钮操作 */
/** 删除按钮操作 */
handleDelete
(
row
)
{
handleDelete
(
row
)
{
if
(
row
.
state
==
"1"
){
if
(
row
.
state
==
"1"
){
this
.
$message
.
error
(
"
停用
状态才能删除!"
);
this
.
$message
.
error
(
"
未生效
状态才能删除!"
);
return
;
return
;
}
}
const
ids
=
row
.
id
||
this
.
ids
;
const
ids
=
row
.
id
;
this
.
$modal
this
.
$modal
.
confirm
(
'是否确
认删除分类编码为'
+
row
.
code
+
'的数据项?
'
)
.
confirm
(
'是否确
定删除?
'
)
.
then
(
function
()
{
.
then
(
function
()
{
return
delC
lass
(
ids
);
return
delC
ouCategory
(
ids
);
})
})
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
console
.
log
(
"response"
,
response
);
if
(
response
.
code
==
"200"
){
this
.
getList
();
this
.
getList
();
this
.
$modal
.
msgSuccess
(
"删除成功"
);
this
.
$modal
.
msgSuccess
(
"删除成功"
);
}
})
})
.
catch
(()
=>
{
});
.
catch
(()
=>
{
});
},
},
...
...
vue.config.js
View file @
02eff0ae
...
@@ -35,7 +35,7 @@ module.exports = {
...
@@ -35,7 +35,7 @@ module.exports = {
proxy
:
{
proxy
:
{
// detail: https://cli.vuejs.org/config/#devserver-proxy
// detail: https://cli.vuejs.org/config/#devserver-proxy
[
process
.
env
.
VUE_APP_BASE_API
]:
{
[
process
.
env
.
VUE_APP_BASE_API
]:
{
target
:
`http://140.143.224.240:809
1
`
,
target
:
`http://140.143.224.240:809
0
`
,
changeOrigin
:
true
,
changeOrigin
:
true
,
pathRewrite
:
{
pathRewrite
:
{
[
"^"
+
process
.
env
.
VUE_APP_BASE_API
]:
""
,
[
"^"
+
process
.
env
.
VUE_APP_BASE_API
]:
""
,
...
...
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