Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-inventory
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2d61ecc5
authored
Apr 25, 2023
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
发券宝
1 parent
690665ed
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
170 additions
and
115 deletions
src/api/modules/coupons.js
src/utils/index.js
src/views/coupons/components/editCouponsDialog.vue
src/views/coupons/constant/data.js
src/views/coupons/index.vue
src/api/modules/coupons.js
View file @
2d61ecc
import
{
http
}
from
'@/main'
import
{
http
}
from
'@/main'
const
path
=
'dj.api.'
// const path = 'dj.api.'
const
path2
=
'dj.smartcarlife.api.'
// const path2 = 'dj.smartcarlife.api.'
// 查询优惠券列表
const
getListApi
=
params
=>
{
const
getListApi
=
params
=>
{
params
.
method
=
`scrm.api.shopmall.goods.page.curMerchant`
params
.
method
=
`scrm.api.boutiquecoupon.rop.router.twoCityTale`
params
.
routerMethod
=
`dj.api.life.merchant.coupon.list`
return
http
({
return
http
({
url
:
'rop-scrm-shopmall/router'
,
url
:
'rop-scrm-boutiquecoupon/router'
,
method
:
'GET'
,
method
:
'POST'
,
data
:
params
,
sign
:
true
})
}
// 领用明细 - 查询优惠券列表
const
getDetailListApi
=
params
=>
{
params
.
method
=
`scrm.api.boutiquecoupon.rop.router.twoCityTale`
params
.
routerMethod
=
`dj.api.life.customer.coupon.list`
return
http
({
url
:
'rop-scrm-boutiquecoupon/router'
,
method
:
'POST'
,
data
:
params
,
sign
:
true
})
}
const
getTypeList
=
params
=>
{
params
.
method
=
`scrm.api.boutiquecoupon.rop.router.twoCityTale`
params
.
routerMethod
=
`dj.api.goods.type.list`
return
http
({
url
:
'rop-scrm-boutiquecoupon/router'
,
method
:
'POST'
,
data
:
params
,
data
:
params
,
sign
:
true
sign
:
true
})
})
}
}
const
addCouponApi
=
params
=>
{
params
.
method
=
`scrm.api.boutiquecoupon.rop.router.twoCityTale`
params
.
routerMethod
=
`dj.api.life.coupon.info.add`
return
http
({
url
:
'rop-scrm-boutiquecoupon/router'
,
method
:
'POST'
,
data
:
params
,
sign
:
true
})
}
const
updateCouponApi
=
params
=>
{
params
.
method
=
`scrm.api.boutiquecoupon.rop.router.twoCityTale`
params
.
routerMethod
=
`dj.api.life.merchant.coupon.update`
return
http
({
url
:
'rop-scrm-boutiquecoupon/router'
,
method
:
'POST'
,
data
:
params
,
sign
:
true
,
returnAll
:
true
})
}
// 分页查找园区店
// 分页查找园区店
const
commodityAddSeviceMerchant
=
function
(
params
)
{
const
commodityAddSeviceMerchant
=
function
(
params
)
{
params
.
method
=
`dj.api.servicemerchantref.page`
params
.
method
=
`scrm.api.boutiquecoupon.rop.router.twoCityTale`
params
.
routerMethod
=
`dj.api.servicemerchantref.page`
return
http
({
return
http
({
url
:
'rop-scrm-
shopmall
/router'
,
url
:
'rop-scrm-
boutiquecoupon
/router'
,
method
:
'
GE
T'
,
method
:
'
POS
T'
,
data
:
params
,
data
:
params
,
sign
:
true
sign
:
true
})
})
}
}
const
getSimpleMerchantList
=
params
=>
{
// 获取核销人
params
.
method
=
'scrm.api.carlife.merchant.listWithPageSimpleByCurMerchant'
const
getDistinctColum
=
function
(
params
)
{
params
.
method
=
`scrm.api.boutiquecoupon.rop.router.twoCityTale`
params
.
routerMethod
=
`dj.api.life.customer.coupon.distinctColum`
return
http
({
return
http
({
url
:
'rop-scrm-
carlife
/router'
,
url
:
'rop-scrm-
boutiquecoupon
/router'
,
method
:
'POST'
,
method
:
'POST'
,
data
:
params
,
data
:
params
,
sign
:
true
sign
:
true
})
})
}
}
export
default
{
getListApi
,
commodityAddSeviceMerchant
,
getSimpleMerchantList
}
export
default
{
getListApi
,
getDetailListApi
,
getTypeList
,
addCouponApi
,
updateCouponApi
,
commodityAddSeviceMerchant
,
getDistinctColum
}
src/utils/index.js
View file @
2d61ecc
export
function
debounce
(
func
,
wait
=
200
)
{
export
function
debounce
(
func
,
wait
=
200
)
{
let
timeout
;
let
timeout
return
function
(
event
)
{
return
function
(
event
)
{
clearTimeout
(
timeout
)
clearTimeout
(
timeout
)
timeout
=
setTimeout
(()
=>
{
timeout
=
setTimeout
(()
=>
{
func
.
call
(
this
,
event
)
func
.
call
(
this
,
event
)
...
@@ -24,10 +24,41 @@ export function dateFormat(dateTime, format = 'YYYY-MM-DD HH:mm') {
...
@@ -24,10 +24,41 @@ export function dateFormat(dateTime, format = 'YYYY-MM-DD HH:mm') {
return
format
return
format
}
}
/**
/**
* 校验手机号码格式
* 校验手机号码格式
*/
*/
export
function
checkPhone
(
mobile
)
{
export
function
checkPhone
(
mobile
)
{
const
myreg
=
const
myreg
=
/^
(
13
[
0-9
]
|15
[
0-9
]
|16
[
0-9
]
|17
[
0-9
]
|18
[
0-9
]
|19
[
0-9
]
|14
[
0-9
])[
0-9
]{8}
$/
/^
(
13
[
0-9
]
|15
[
0-9
]
|16
[
0-9
]
|17
[
0-9
]
|18
[
0-9
]
|19
[
0-9
]
|14
[
0-9
])[
0-9
]{8}
$/
return
myreg
.
test
(
mobile
)
return
myreg
.
test
(
mobile
)
}
}
/**
* 用于glsx-combi-form的select写入options
* formName String FormData的属性名
* hasAll Boolean 是否需要添加“全部”属性
* refreshSigle String 更新特定的属性的options
*/
export
function
getOptionsList
(
that
,
formName
,
hasAll
=
true
,
refreshSigle
)
{
if
(
refreshSigle
)
{
var
item
=
that
[
formName
].
find
(
k
=>
k
.
name
==
refreshSigle
)
var
index
=
that
[
formName
].
findIndex
(
k
=>
k
.
name
==
refreshSigle
)
that
.
$set
(
that
[
formName
][
index
],
'optionList'
,
that
.
$common
.
utils
.
deepClone
(
that
.
baseData
[
item
.
optionsName
]))
if
(
hasAll
&&
that
.
baseData
[
item
.
optionsName
].
length
&&
that
.
baseData
[
item
.
optionsName
][
0
][
that
[
formName
][
index
].
optionLabel
]
!==
'全部'
)
{
const
temp
=
{}
temp
[
that
[
formName
][
index
].
optionId
]
=
''
temp
[
that
[
formName
][
index
].
optionLabel
]
=
'全部'
that
[
formName
][
index
].
optionList
.
unshift
(
temp
)
}
}
else
{
that
[
formName
].
forEach
((
item
,
index
)
=>
{
if
(
item
.
type
===
'select'
&&
that
.
baseData
[
item
.
optionsName
]?.
length
)
{
that
.
$set
(
that
[
formName
][
index
],
'optionList'
,
that
.
$common
.
utils
.
deepClone
(
that
.
baseData
[
item
.
optionsName
]))
if
(
hasAll
&&
that
.
baseData
[
item
.
optionsName
].
length
&&
that
.
baseData
[
item
.
optionsName
][
0
][
that
[
formName
][
index
].
optionLabel
]
!==
'全部'
)
{
const
temp
=
{}
temp
[
that
[
formName
][
index
].
optionId
]
=
''
temp
[
that
[
formName
][
index
].
optionLabel
]
=
'全部'
that
[
formName
][
index
].
optionList
.
unshift
(
temp
)
}
}
})
}
}
src/views/coupons/components/editCouponsDialog.vue
View file @
2d61ecc
...
@@ -79,6 +79,7 @@ export default {
...
@@ -79,6 +79,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
// userInfo: this.$store.state.d2admin.user.info,
// userInfo: this.$store.state.d2admin.user.info,
userInfo
:
this
.
$globalState
.
session
,
couponsForm
:
{
couponsForm
:
{
couponName
:
''
,
couponName
:
''
,
couponType
:
''
,
couponType
:
''
,
...
@@ -99,8 +100,8 @@ export default {
...
@@ -99,8 +100,8 @@ export default {
relateStoreVisible
:
false
,
relateStoreVisible
:
false
,
sourcePage
:
'coupons'
,
sourcePage
:
'coupons'
,
storeSelected
:
[],
storeSelected
:
[],
//
storeApi: this.$apis.coupons.commodityAddSeviceMerchant,
storeApi
:
this
.
$apis
.
coupons
.
commodityAddSeviceMerchant
,
storeApi
:
this
.
$apis
.
coupons
.
getSimpleMerchantList
,
//
storeApi: this.$apis.coupons.getSimpleMerchantList,
storeSearchForm
:
{
storeSearchForm
:
{
yqMerchantName
:
''
,
yqMerchantName
:
''
,
merchantName
:
''
merchantName
:
''
...
@@ -147,6 +148,7 @@ export default {
...
@@ -147,6 +148,7 @@ export default {
mounted
()
{
mounted
()
{
// this.getBaseData()
// this.getBaseData()
this
.
getTypeList
()
!
this
.
couponInfo
&&
(
this
.
couponsForm
.
remark
=
this
.
remarkTemp
)
!
this
.
couponInfo
&&
(
this
.
couponsForm
.
remark
=
this
.
remarkTemp
)
},
},
...
@@ -157,6 +159,11 @@ export default {
...
@@ -157,6 +159,11 @@ export default {
// async getBaseData() {
// async getBaseData() {
// this.baseData.productTypeList = JSON.parse(JSON.stringify((await this.get(BaseData.productType))
// this.baseData.productTypeList = JSON.parse(JSON.stringify((await this.get(BaseData.productType))
// },
// },
getTypeList
()
{
this
.
$apis
.
coupons
.
getTypeList
({}).
then
(
res
=>
{
this
.
baseData
.
productTypeList
=
res
})
},
validateAccount
(
rule
,
value
,
callback
)
{
validateAccount
(
rule
,
value
,
callback
)
{
value
<
this
.
couponInfo
.
amount
?
callback
(
new
Error
(
`数量不能小于
${
this
.
couponInfo
.
amount
}
张`
))
:
callback
()
value
<
this
.
couponInfo
.
amount
?
callback
(
new
Error
(
`数量不能小于
${
this
.
couponInfo
.
amount
}
张`
))
:
callback
()
},
},
...
@@ -215,11 +222,12 @@ export default {
...
@@ -215,11 +222,12 @@ export default {
},
},
handleAddConfirm
()
{
handleAddConfirm
()
{
// console.log(this.couponsForm.remark)
// console.log(this.couponsForm.remark)
console
.
log
(
this
.
userInfo
)
this
.
$refs
.
couponAddForm
.
validate
(
valid
=>
{
this
.
$refs
.
couponAddForm
.
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
var
params
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
couponsForm
))
var
params
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
couponsForm
))
params
.
couponTypeName
=
this
.
baseData
.
productTypeList
.
find
(
item
=>
item
.
goodsType
===
this
.
couponsForm
.
couponType
).
goodsTypeName
params
.
couponTypeName
=
this
.
baseData
.
productTypeList
.
find
(
item
=>
item
.
goodsType
===
this
.
couponsForm
.
couponType
).
goodsTypeName
params
.
createdBy
=
this
.
userInfo
.
detail
[
this
.
userInfo
.
merchantAccountLevel
==
4
?
'userName'
:
'merchantName'
]
params
.
createdBy
=
this
.
userInfo
.
accountName
if
(
this
.
couponInfo
)
{
if
(
this
.
couponInfo
)
{
// 编辑
// 编辑
...
@@ -240,13 +248,16 @@ export default {
...
@@ -240,13 +248,16 @@ export default {
})
})
})
})
}
}
// console.log(params)
console
.
log
(
params
)
// var apiName = this.couponInfo ? 'updateCouponApi' : 'addCouponApi'
var
apiName
=
this
.
couponInfo
?
'updateCouponApi'
:
'addCouponApi'
// api[apiName](params).then(res => {
this
.
$apis
.
coupons
[
apiName
](
params
).
then
(
res
=>
{
// this.notice.okTips()
this
.
$notify
({
// this.$emit('couponClose', true)
type
:
'success'
,
// this.$refs.couponAddForm && this.$refs.couponAddForm.resetFields()
title
:
res
.
message
||
'操作成功'
// })
})
this
.
$refs
.
couponAddForm
&&
this
.
$refs
.
couponAddForm
.
resetFields
()
this
.
$emit
(
'couponClose'
,
true
)
})
}
}
})
})
}
}
...
...
src/views/coupons/constant/data.js
View file @
2d61ecc
...
@@ -11,94 +11,57 @@ const couponsObj = {
...
@@ -11,94 +11,57 @@ const couponsObj = {
name
:
'merchantName'
,
name
:
'merchantName'
,
type
:
'input'
,
type
:
'input'
,
isClear
:
true
isClear
:
true
},
{
label
:
'类型'
,
name
:
'couponTypeList'
,
type
:
'select'
,
multiple
:
true
,
optionList
:
[],
optionId
:
'goodsType'
,
optionLabel
:
'goodsTypeName'
,
optionsName
:
'typeList'
},
{
label
:
'状态'
,
name
:
'enabledFlagList'
,
type
:
'select'
,
multiple
:
true
,
optionList
:
[],
optionId
:
'confId'
,
optionLabel
:
'confLabel'
,
optionsName
:
'enabledFlagList'
},
{
label
:
'发券人'
,
name
:
'employeeNameKeyword'
,
type
:
'input'
,
isClear
:
true
,
isHide
:
true
},
{
label
:
'核销状态'
,
name
:
'usedFlagList'
,
type
:
'select'
,
multiple
:
true
,
isHide
:
true
,
optionList
:
[],
optionId
:
'confId'
,
optionLabel
:
'confLabel'
,
optionsName
:
'usedFlagList'
},
{
label
:
'核销人'
,
name
:
'sellerNameList'
,
type
:
'select'
,
multiple
:
true
,
isHide
:
true
,
optionList
:
[],
optionId
:
'confId'
,
optionLabel
:
'confLabel'
,
optionsName
:
'sellerNameList'
}
}
],
]
tableParams
:
{
needUnique
:
true
,
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
listName
:
'list'
,
tableOption
:
true
,
tableColumns
:
[
{
label
:
'批次号'
,
prop
:
'merchantCouponCode'
},
{
label
:
'礼券名称'
,
parentProp
:
'couponInfo'
,
prop
:
'couponName'
},
{
label
:
'类型'
,
parentProp
:
'couponInfo'
,
prop
:
'couponTypeName'
,
optionConfig
:
{
searchItemName
:
'couponTypeList'
,
optionId
:
'goodsType'
,
optionLabel
:
'goodsTypeName'
}
// optionList: []
},
{
label
:
'区域'
,
parentProp
:
'yqMerchantInfo'
,
prop
:
'region'
,
optionConfig
:
{
searchItemName
:
'regionList'
,
optionId
:
'confKey'
,
optionLabel
:
'confValue'
}
// optionList: []
},
{
label
:
'门店名称'
,
prop
:
'merchantName'
,
formatter
:
cellValue
=>
{
return
cellValue
.
merchantName
+
' - '
+
cellValue
.
yqMerchantName
}
},
{
label
:
'总数'
,
prop
:
'amount'
,
sortable
:
'custom'
},
{
label
:
'余量'
,
prop
:
'allowance'
,
sortable
:
'custom'
,
formatter
:
cellValue
=>
{
return
cellValue
.
amount
-
cellValue
.
getAmount
}
},
{
label
:
'发放量'
,
prop
:
'getAmount'
,
sortable
:
'custom'
},
{
label
:
'核销量'
,
prop
:
'usedAmount'
,
sortable
:
'custom'
},
{
label
:
'状态'
,
prop
:
'enabledFlag'
,
optionConfig
:
{
searchItemName
:
'enabledFlagList'
,
optionId
:
'confId'
,
optionLabel
:
'confLabel'
},
// optionList: [{ confLabel: '启用', confId: 'Y' }, { confLabel: '停用', confId: 'N' }],
formatter
:
cellValue
=>
{
return
{
Y
:
'启用'
,
N
:
'停用'
}[
cellValue
.
enabledFlag
]
}
}
]
}
}
}
export
default
{
export
default
{
...
...
src/views/coupons/index.vue
View file @
2d61ecc
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
Attach a file
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 post a comment