Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c5a7d058
authored
Jun 01, 2023
by
dhb52
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: 添加VO
parent
c3b0403a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
18 deletions
+64
-18
src/api/mall/product/spu.ts
+5
-0
src/api/mall/promotion/coupon.ts
+3
-3
src/api/mall/promotion/couponTemplate.ts
+32
-9
src/utils/constants.ts
+18
-0
src/views/mall/promotion/couponTemplate/index.vue
+6
-6
No files found.
src/api/mall/product/spu.ts
View file @
c5a7d058
...
...
@@ -90,3 +90,8 @@ export const deleteSpu = (id: number) => {
export
const
exportSpu
=
async
(
params
)
=>
{
return
await
request
.
download
({
url
:
'/product/spu/export'
,
params
})
}
// 获得商品 SPU 精简列表
export
const
getSpuSimpleList
=
async
()
=>
{
return
request
.
get
({
url
:
'/product/spu/get-simple-list'
})
}
src/api/mall/promotion/coupon.ts
View file @
c5a7d058
import
request
from
'@/config/axios'
// 删除优惠劵
export
function
deleteCoupon
(
id
)
{
export
const
deleteCoupon
=
async
(
id
:
number
)
=>
{
return
request
.
delete
({
url
:
`/promotion/coupon/delete?id=
${
id
}
`
})
}
// 获得优惠劵分页
export
function
getCouponPage
(
query
)
{
export
const
getCouponPage
=
async
(
params
:
PageParam
)
=>
{
return
request
.
get
({
url
:
'/promotion/coupon/page'
,
params
:
query
params
:
params
})
}
src/api/mall/promotion/couponTemplate.ts
View file @
c5a7d058
import
request
from
'@/config/axios'
export
interface
CouponTemplateVO
{
id
:
number
name
:
string
status
:
number
totalCount
:
number
takeLimitCount
:
number
takeType
:
number
usePrice
:
number
productScope
:
number
productSpuIds
:
string
validityType
:
number
validStartTime
:
Date
validEndTime
:
Date
fixedStartTerm
:
number
fixedEndTerm
:
number
discountType
:
number
discountPercent
:
number
discountPrice
:
number
discountLimitPrice
:
number
takeCount
:
number
useCount
:
number
}
// 创建优惠劵模板
export
function
createCouponTemplate
(
data
)
{
export
function
createCouponTemplate
(
data
:
CouponTemplateVO
)
{
return
request
.
post
({
url
:
'/promotion/coupon-template/create'
,
data
:
data
...
...
@@ -9,7 +32,7 @@ export function createCouponTemplate(data) {
}
// 更新优惠劵模板
export
function
updateCouponTemplate
(
data
)
{
export
function
updateCouponTemplate
(
data
:
CouponTemplateVO
)
{
return
request
.
put
({
url
:
'/promotion/coupon-template/update'
,
data
:
data
...
...
@@ -17,7 +40,7 @@ export function updateCouponTemplate(data) {
}
// 更新优惠劵模板的状态
export
function
updateCouponTemplateStatus
(
id
,
status
)
{
export
function
updateCouponTemplateStatus
(
id
:
number
,
status
:
[
0
,
1
]
)
{
const
data
=
{
id
,
status
...
...
@@ -29,32 +52,32 @@ export function updateCouponTemplateStatus(id, status) {
}
// 删除优惠劵模板
export
function
deleteCouponTemplate
(
id
)
{
export
function
deleteCouponTemplate
(
id
:
number
)
{
return
request
.
delete
({
url
:
'/promotion/coupon-template/delete?id='
+
id
})
}
// 获得优惠劵模板
export
function
getCouponTemplate
(
id
)
{
export
function
getCouponTemplate
(
id
:
number
)
{
return
request
.
get
({
url
:
'/promotion/coupon-template/get?id='
+
id
})
}
// 获得优惠劵模板分页
export
function
getCouponTemplatePage
(
query
)
{
export
function
getCouponTemplatePage
(
params
:
PageParam
)
{
return
request
.
get
({
url
:
'/promotion/coupon-template/page'
,
params
:
query
params
:
params
})
}
// 导出优惠劵模板 Excel
export
function
exportCouponTemplateExcel
(
query
)
{
export
function
exportCouponTemplateExcel
(
params
:
PageParam
)
{
return
request
.
get
({
url
:
'/promotion/coupon-template/export-excel'
,
params
:
query
,
params
:
params
,
responseType
:
'blob'
})
}
src/utils/constants.ts
View file @
c5a7d058
...
...
@@ -222,6 +222,24 @@ export const PayRefundStatusEnum = {
}
/**
* 商品 SPU 状态
*/
export
const
ProductSpuStatusEnum
=
{
RECYCLE
:
{
status
:
-
1
,
name
:
'回收站'
},
DISABLE
:
{
status
:
0
,
name
:
'下架'
},
ENABLE
:
{
status
:
1
,
name
:
'上架'
}
}
/**
* 优惠劵模板的有限期类型的枚举
*/
export
const
CouponTemplateValidityTypeEnum
=
{
...
...
src/views/mall/promotion/couponTemplate/index.vue
View file @
c5a7d058
...
...
@@ -491,7 +491,7 @@ const handleAdd = () => {
}
/** 修改按钮操作 */
const
handleUpdate
=
async
(
row
)
=>
{
const
handleUpdate
=
async
(
row
:
any
)
=>
{
reset
()
const
id
=
row
.
id
try
{
...
...
@@ -558,7 +558,7 @@ const submitForm = async () => {
}
/** 优惠劵模板状态修改 */
const
handleStatusChange
=
async
(
row
)
=>
{
const
handleStatusChange
=
async
(
row
:
any
)
=>
{
// 此时,row 已经变成目标状态了,所以可以直接提交请求和提示
let
text
=
row
.
status
===
CommonStatusEnum
.
ENABLE
?
'启用'
:
'停用'
...
...
@@ -574,7 +574,7 @@ const handleStatusChange = async (row) => {
}
/** 删除按钮操作 */
const
handleDelete
=
async
(
row
)
=>
{
const
handleDelete
=
async
(
row
:
any
)
=>
{
const
id
=
row
.
id
try
{
await
message
.
confirm
(
'是否确认删除优惠劵编号为"'
+
id
+
'"的数据项?'
)
...
...
@@ -583,7 +583,7 @@ const handleDelete = async (row) => {
}
// 格式化【优惠金额/折扣】
const
discountFormat
=
(
row
)
=>
{
const
discountFormat
=
(
row
:
any
)
=>
{
if
(
row
.
discountType
===
PromotionDiscountTypeEnum
.
PRICE
.
type
)
{
return
`¥
${(
row
.
discountPrice
/
100.0
).
toFixed
(
2
)}
`
}
...
...
@@ -594,7 +594,7 @@ const discountFormat = (row) => {
}
// 格式化【领取上限】
const
takeLimitCountFormat
=
(
row
)
=>
{
const
takeLimitCountFormat
=
(
row
:
any
)
=>
{
if
(
row
.
takeLimitCount
===
-
1
)
{
return
'无领取限制'
}
...
...
@@ -602,7 +602,7 @@ const takeLimitCountFormat = (row) => {
}
// 格式化【有效期限】
const
validityTypeFormat
=
(
row
)
=>
{
const
validityTypeFormat
=
(
row
:
any
)
=>
{
if
(
row
.
validityType
===
CouponTemplateValidityTypeEnum
.
DATE
.
type
)
{
return
`
${
formatDate
(
row
.
validStartTime
)}
至
${
formatDate
(
row
.
validEndTime
)}
`
}
...
...
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