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
5ad9460a
Commit
5ad9460a
authored
Jul 26, 2022
by
lixiaomin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改优惠券
parent
60410311
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
92 deletions
+116
-92
src/api/coupon/coupon.js
+18
-2
src/views/coupon/coupon/giveCoupon.vue
+68
-63
src/views/coupon/coupon/index.vue
+30
-27
No files found.
src/api/coupon/coupon.js
View file @
5ad9460a
...
...
@@ -29,10 +29,26 @@ export function updateClass(data) {
}
// 删除
export
function
delC
lass
(
id
)
{
export
function
delC
oupon
(
id
)
{
return
request
({
url
:
"/
system/category
/"
+
id
,
url
:
"/
coupon
/"
+
id
,
method
:
"delete"
,
});
}
// 下架
export
function
offlineCoupon
(
id
)
{
return
request
({
url
:
"/coupon/offline/"
+
id
,
method
:
"get"
,
});
}
// 上架
export
function
onlineCoupon
(
id
)
{
return
request
({
url
:
"/coupon/online/"
+
id
,
method
:
"get"
,
});
}
src/views/coupon/coupon/giveCoupon.vue
View file @
5ad9460a
<
template
>
<div
class=
"app-container"
>
<el-dialog
:visible
.
sync=
"giveOpen"
width=
"1000px"
append-to-body
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:inline=
"true"
label-width=
"68px"
>
<el-form-item
label=
"手机号"
prop=
"
name
"
>
<el-input
v-model=
"queryParams.
name"
placeholder=
"
手机号"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
<el-form
:model=
"queryParams"
size=
"small"
:inline=
"true"
label-width=
"68px"
>
<el-form-item
label=
"手机号"
prop=
"
userInfo
"
>
<el-input
v-model=
"queryParams.
userInfo"
placeholder=
"请输入
手机号"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<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
v-for=
"item in
options
"
:key=
"item.
value
"
:label=
"item.
label
"
:value=
"item.
value
"
>
v-for=
"item in
couponList
"
:key=
"item.
id
"
:label=
"item.
name
"
:value=
"item.
id
"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
v-hasPermi=
"['coupon:coupon:query']"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<el-table
v-loading=
"loading"
:data=
"userList"
>
<el-table-column
label=
"用户"
align=
"center"
prop=
"name"
/>
<el-table-column
label=
"手机号"
align=
"center"
prop=
"code"
/>
<el-table-column
label=
"订单量"
align=
"center"
prop=
"remarks"
/>
<el-table-column
label=
"总金额"
align=
"center"
prop=
"goodsCount"
/>
<el-table-column
label=
"已取消"
align=
"center"
prop=
"goodsCount"
/>
<el-table-column
label=
"取消金额"
align=
"center"
prop=
"goodsCount"
/>
<el-table-column
label=
"已退款"
align=
"center"
prop=
"goodsCount"
/>
<el-table-column
label=
"退款金额"
align=
"center"
prop=
"goodsCount"
/>
<el-table-column
label=
"最近订单时间"
align=
"center"
prop=
"goodsCount"
/>
<el-table-column
label=
"注册时间"
align=
"center"
prop=
"goodsCount"
/>
<el-table-column
label=
"来源"
align=
"center"
prop=
"state"
>
<el-table
v-loading=
"loading"
:data=
"customerList"
>
<el-table-column
label=
"用户"
align=
"center"
prop=
"userName"
>
<template
slot-scope=
"scope"
>
<span
v-if=
"scope.row.state == 1"
>
启用
</span>
<span
v-if=
"scope.row.state == 2"
>
停用
</span>
<a
myattr=
"mcv"
v-hasPermi=
"['system:customer:view']"
>
<span
@
click=
"getDetial(scope.row)"
style=
"color: blue"
>
{{
scope
.
row
.
userName
}}
</span>
</a>
</
template
>
</el-table-column>
<el-table-column
label=
"手机号"
align=
"center"
prop=
"phoneNumber"
/>
<el-table-column
label=
"订单量"
align=
"center"
prop=
"orderCount"
/>
<el-table-column
label=
"总金额"
align=
"center"
prop=
"amount"
/>
<el-table-column
label=
"已取消"
align=
"center"
prop=
"cancelCount"
/>
<el-table-column
label=
"取消金额"
align=
"center"
prop=
"cancelAmount"
/>
<el-table-column
label=
"已退款"
align=
"center"
prop=
"refundCount"
/>
<el-table-column
label=
"退款金额"
align=
"center"
prop=
"refundAmount"
/>
<el-table-column
label=
"最近订单时间"
align=
"center"
prop=
"lastOrderDate"
/>
<el-table-column
label=
"注册时间"
align=
"center"
prop=
"createDate"
/>
<el-table-column
label=
"来源"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<span
v-if=
"scope.row.source=='3'"
>
小程序
</span>
<span
v-if=
"scope.row.source=='12'"
>
点单屏
</span>
</
template
>
</el-table-column>
</el-table>
<div
slot=
"footer"
class=
"dialog-footer"
style=
"text-align: center;"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确定
</el-button>
<pagination
v-show=
"total > 0"
:total=
"total"
:page
.
sync=
"queryParams.pageNum"
:limit
.
sync=
"queryParams.pageSize"
@
pagination=
"getList"
/>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
赠送
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
</div>
</el-dialog>
...
...
@@ -47,67 +59,60 @@
</template>
<
script
>
import
{
listClass
,
getClass
,
delClass
,
addClass
,
updateClass
,
turnList
}
from
"@/api/coupon/couponType"
;
import
{
listCustomer
}
from
"@/api/system/customer"
;
import
{
listCoupon
}
from
"@/api/coupon/coupon"
;
export
default
{
name
:
"Class"
,
data
()
{
return
{
// 遮罩层
loading
:
tru
e
,
loading
:
fals
e
,
// 总条数
total
:
0
,
// 表格数据
userList
:
[],
// 弹出层标题
title
:
""
,
// 是否显示弹出层
giveOpen
:
false
,
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
name
:
null
,
state
:
null
},
options
:
[{
value
:
'1'
,
label
:
'满减券'
},
{
value
:
'2'
,
label
:
'折扣券'
}],
customerList
:[],
couponList
:[]
};
},
created
()
{
//this.get
List();
this
.
getCoupon
List
();
},
methods
:
{
/** 搜索按钮操作 */
handleQuery
()
{
this
.
getList
();
},
/** 重置按钮操作 */
resetQuery
()
{
this
.
queryParams
.
name
=
null
;
this
.
queryParams
.
state
=
null
;
this
.
handleQuery
();
},
/** 查询列表 */
getList
()
{
this
.
giveOpen
=
true
;
this
.
giveOpen
=
true
;
},
/** 查询优惠券列表 */
getCouponList
()
{
listCoupon
({
pageNum
:
1
,
pageSize
:
100000
,
state
:
1
}).
then
((
response
)
=>
{
if
(
response
.
code
==
200
){
this
.
couponList
=
response
.
rows
;
}
});
},
/** 搜索按钮操作 */
handleQuery
()
{
if
(
this
.
queryParams
.
userInfo
==
null
){
this
.
$message
.
error
(
"请输入手机号"
);
return
;
}
if
(
this
.
queryParams
.
userInfo
.
length
!=
11
){
this
.
$message
.
error
(
"请输入11位手机号"
);
return
;
}
this
.
loading
=
true
;
listClass
(
this
.
queryParams
).
then
((
response
)
=>
{
// this.userList = response.rows;
// this.total = response.total;
listCustomer
(
this
.
queryParams
).
then
((
response
)
=>
{
if
(
response
.
code
==
"200"
){
this
.
customerList
=
response
.
rows
;
this
.
total
=
response
.
total
;
this
.
loading
=
false
;
}
});
},
// 取消按钮
...
...
src/views/coupon/coupon/index.vue
View file @
5ad9460a
...
...
@@ -36,21 +36,25 @@
<a
@
click=
"handleUpdate(scope.row)"
style=
"color: blue"
>
{{
scope
.
row
.
name
}}
</a>
</
template
>
</el-table-column>
<el-table-column
label=
"类别"
align=
"center"
prop=
"code"
/>
<el-table-column
label=
"券价值"
align=
"center"
prop=
"remarks"
/>
<el-table-column
label=
"类别"
align=
"center"
prop=
"typeDesc"
/>
<el-table-column
label=
"券价值"
align=
"center"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
ruleDesc
}}{{
scope
.
row
.
ruleName
}}
</
template
>
</el-table-column>
<el-table-column
label=
"使用范围"
align=
"center"
prop=
"goodsCount"
/>
<el-table-column
label=
"时效"
align=
"center"
prop=
"goodsCount"
/>
<el-table-column
label=
"状态"
align=
"center"
prop=
"state"
>
<el-table-column
label=
"时效"
align=
"center"
width=
"300"
>
<
template
slot-scope=
"scope"
>
<
span
v-if=
"scope.row.state == 1"
>
启用
</span
>
<
span
v-if=
"scope.row.state == 2"
>
停用
</span>
<
p>
{{
formateTime
(
scope
.
row
.
useStartTime
)
}}
—
{{
formateTime
(
scope
.
row
.
useEndTime
)
}}
</p
>
<
p
v-show=
"scope.row.relativeTime!=''"
>
{{
scope
.
row
.
relativeTime
}}
日内有效
</p>
</
template
>
</el-table-column>
<el-table-column
label=
"状态"
align=
"center"
prop=
"stateDesc"
/>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<
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=
"['coupon:coupon:restart']"
>
下线
</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=
"['coupon:coupon:stop']"
>
上线
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row)"
v-hasPermi=
"['coupon:coupon:remove']"
>
删除
</el-button>
...
...
@@ -183,9 +187,7 @@
</template>
<
script
>
import
{
addCoupon
,
listCoupon
}
from
"@/api/coupon/coupon"
;
import
{
addCoupon
,
listCoupon
,
offlineCoupon
,
onlineCoupon
,
delCoupon
}
from
"@/api/coupon/coupon"
;
import
{
getCouCategoryList
}
from
"@/api/coupon/couponType"
;
import
GiveCoupon
from
'./giveCoupon.vue'
;
import
{
listClass
}
from
"@/api/system/category"
;
...
...
@@ -276,6 +278,11 @@ export default {
this
.
getCityList
();
},
methods
:
{
formateTime
(
val
){
let
index
=
val
.
lastIndexOf
(
":"
);
val
=
val
.
substring
(
0
,
index
);
return
val
;
},
/** 查询商品分类列表 */
getCategoryList
()
{
listClass
({
pageNum
:
1
,
pageSize
:
10000
,
state
:
1
}).
then
((
response
)
=>
{
...
...
@@ -438,20 +445,20 @@ export default {
/** 启用、禁用按钮操作 */
handleStatus
(
row
,
tag
)
{
let
mess
=
""
;
let
sta
=
""
;
if
(
tag
==
'1'
){
mess
=
"启用"
;
sta
=
"1"
;
mess
=
"下线"
;
}
else
if
(
tag
==
'2'
){
mess
=
"停用"
;
sta
=
"2"
;
mess
=
"上线"
;
}
this
.
$modal
.
confirm
(
'是否确认'
+
mess
+
'该数据项?'
)
.
then
(
function
()
{
return
updateClass
({
id
:
row
.
id
,
state
:
sta
});
})
.
then
((
response
)
=>
{
if
(
tag
==
"1"
){
return
offlineCoupon
(
row
.
id
);
}
else
if
(
tag
==
"2"
){
return
onlineCoupon
(
row
.
id
);
}
}).
then
((
response
)
=>
{
if
(
response
.
code
=
"200"
){
this
.
getList
();
this
.
$modal
.
msgSuccess
(
''
+
mess
+
'成功'
);
...
...
@@ -563,20 +570,16 @@ export default {
},
/** 删除按钮操作 */
handleDelete
(
row
)
{
if
(
row
.
state
==
"1"
){
this
.
$message
.
error
(
"停用状态才能删除!"
);
return
;
}
const
ids
=
row
.
id
||
this
.
ids
;
this
.
$modal
.
confirm
(
'是否确
认删除分类编码为'
+
row
.
code
+
'的数据项?
'
)
.
confirm
(
'是否确
定删除?
'
)
.
then
(
function
()
{
return
delC
lass
(
ids
);
return
delC
oupon
(
row
.
id
);
})
.
then
((
response
)
=>
{
console
.
log
(
"response"
,
response
);
if
(
response
.
code
==
"200"
){
this
.
getList
();
this
.
$modal
.
msgSuccess
(
"删除成功"
);
}
})
.
catch
(()
=>
{
});
},
...
...
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