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
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
456 additions
and
145 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
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<GLButton
type=
"primary"
size=
"small"
@
click=
"handleEdit('add',
{})" fn="新增">新增
</GLButton>
<GLButton
type=
"primary"
size=
"small"
@
click=
"handleEdit('add',
{})" fn="新增">新增
</GLButton>
</div>
</div>
<el-tabs
v-model=
"activeName"
type=
"card"
@
tab-click=
"handle
Search
"
>
<el-tabs
v-model=
"activeName"
type=
"card"
@
tab-click=
"handle
TabChange
"
>
<el-tab-pane
label=
"店面列表"
name=
"storeList"
>
<el-tab-pane
label=
"店面列表"
name=
"storeList"
>
<store-list
ref=
"storeList"
:parent-search-form=
"parentSearchForm"
/>
<store-list
ref=
"storeList"
:parent-search-form=
"parentSearchForm"
/>
</el-tab-pane>
</el-tab-pane>
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
</el-tabs>
</el-tabs>
<!-- 店面列表 - 表格区域 开始 -->
<!-- 店面列表 - 表格区域 开始 -->
<GLTable
v-show=
"activeName == 'storeList'"
ref=
"storeRef"
:getListApi=
"getListApi"
:noDataImg=
"url"
:searchForm=
"searchForm"
:tableParams=
"tableParams"
:pageConf=
"pageConf"
:beforeSearchFn=
"beforeSearchFn"
@
setTableFinishFun=
"setTableFinishFun"
>
<GLTable
v-show=
"activeName == 'storeList'"
ref=
"storeRef"
:getListApi=
"getListApi"
:noDataImg=
"url"
:searchForm=
"searchForm"
:tableParams=
"tableParams"
:pageConf=
"pageConf"
:beforeSearchFn=
"beforeSearchFn"
@
setTableFinishFun=
"setTableFinishFun"
@
sortChange=
"sortChange"
>
<div
class=
"table-btns"
slot=
"auth-button"
slot-scope=
"scope"
>
<div
class=
"table-btns"
slot=
"auth-button"
slot-scope=
"scope"
>
<GLTableButton
:buttonList=
"tableButtonList"
:buttonItem=
"scope.scope"
:buttonNum=
"3"
></GLTableButton>
<GLTableButton
:buttonList=
"tableButtonList"
:buttonItem=
"scope.scope"
:buttonNum=
"3"
></GLTableButton>
</div>
</div>
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
<!-- 表格区域 end -->
<!-- 表格区域 end -->
<!-- 领用明细 - 表格区域 开始 -->
<!-- 领用明细 - 表格区域 开始 -->
<GLTable
v-show=
"activeName == 'couponsDetail'"
ref=
"
storeRef"
:getListApi=
"getListApi"
:noDataImg=
"url"
:searchForm=
"searchForm"
:tableParams=
"tableParams"
:pageConf=
"pageConf"
:beforeSearchFn=
"beforeSearchFn"
@
setTableFinishFun=
"setTableFinishFun
"
></GLTable>
<GLTable
v-show=
"activeName == 'couponsDetail'"
ref=
"
detailRef"
:getListApi=
"getDetailListApi"
:noDataImg=
"url"
:searchForm=
"searchForm"
:tableParams=
"detailTableParams"
:pageConf=
"pageConf"
:beforeSearchFn=
"beforeSearchFn"
@
setTableFinishFun=
"setTableFinishFun"
@
sortChange=
"detailSortChange
"
></GLTable>
<!-- 表格区域 end -->
<!-- 表格区域 end -->
</div>
</div>
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
import
url
from
'@/assets/empty.png'
import
url
from
'@/assets/empty.png'
import
constData
from
'./constant/data'
import
constData
from
'./constant/data'
import
editCouponsDialog
from
'./components/editCouponsDialog'
import
editCouponsDialog
from
'./components/editCouponsDialog'
import
{
getOptionsList
}
from
'@/utils/index'
import
*
as
dayjs
from
'dayjs'
// import baseList from './constant/baseList'
// import baseList from './constant/baseList'
export
default
{
export
default
{
name
:
'coupons'
,
name
:
'coupons'
,
...
@@ -54,10 +56,107 @@ export default {
...
@@ -54,10 +56,107 @@ export default {
},
},
couponInfo
:
null
,
couponInfo
:
null
,
searchFormData
:
constData
.
couponsObj
.
searchFormData
,
searchFormData
:
constData
.
couponsObj
.
searchFormData
,
sortObj
:
{
amount
:
{
ascending
:
1
,
descending
:
2
},
allowance
:
{
ascending
:
3
,
descending
:
4
},
getAmount
:
{
ascending
:
5
,
descending
:
6
},
usedAmount
:
{
ascending
:
7
,
descending
:
8
}
},
detailSortObj
:
{
createdDate
:
{
descending
:
0
,
ascending
:
1
},
usedTime
:
{
ascending
:
2
,
descending
:
3
}
},
// 表格
// 表格
getListApi
:
this
.
$apis
.
coupons
.
getListApi
,
getListApi
:
this
.
$apis
.
coupons
.
getListApi
,
tableParams
:
constData
.
couponsObj
.
tableParams
,
tableParams
:
{
// pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
needUnique
:
true
,
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
listName
:
'list'
,
tableOption
:
true
,
tableColumns
:
[
{
label
:
'批次号'
,
prop
:
'merchantCouponCode'
},
{
label
:
'礼券名称'
,
prop
:
'couponName'
},
{
label
:
'类型'
,
prop
:
'couponTypeName'
,
formatter
:
cellValue
=>
{
return
cellValue
.
couponInfo
?.
couponTypeName
||
''
}
},
{
label
:
'区域'
,
prop
:
'region'
,
formatter
:
cellValue
=>
{
return
cellValue
.
yqMerchantInfo
?.
region
||
''
}
},
{
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'
,
formatter
:
cellValue
=>
{
return
{
Y
:
'启用'
,
N
:
'停用'
}[
cellValue
.
enabledFlag
]
}
}
]
},
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'currentPage'
,
totalCount
:
'total'
},
// 表格按钮
// 表格按钮
tableButtonList
:
[
tableButtonList
:
[
{
{
...
@@ -67,11 +166,8 @@ export default {
...
@@ -67,11 +166,8 @@ export default {
type
:
'text'
,
type
:
'text'
,
fn
:
'编辑'
fn
:
'编辑'
},
},
// condition: row => {
// return row.goodsStatus
// },
listeners
:
{
listeners
:
{
click
:
row
=>
this
.
handleEdit
(
'
detail
'
,
row
)
click
:
row
=>
this
.
handleEdit
(
'
edit
'
,
row
)
}
}
},
},
{
{
...
@@ -81,9 +177,23 @@ export default {
...
@@ -81,9 +177,23 @@ export default {
type
:
'text'
,
type
:
'text'
,
fn
:
'停用'
fn
:
'停用'
},
},
// condition: row => {
condition
:
row
=>
{
// return !row.goodsStatus
return
row
.
enabledFlag
==
'Y'
// },
},
listeners
:
{
click
:
row
=>
this
.
handleStop
(
row
)
}
},
{
type
:
'GLButton'
,
name
:
'启用'
,
attrs
:
{
type
:
'text'
,
fn
:
'启用'
},
condition
:
row
=>
{
return
row
.
enabledFlag
==
'N'
},
listeners
:
{
listeners
:
{
click
:
row
=>
this
.
handleStop
(
row
)
click
:
row
=>
this
.
handleStop
(
row
)
}
}
...
@@ -103,13 +213,101 @@ export default {
...
@@ -103,13 +213,101 @@ export default {
}
}
}
}
],
],
// 领用详情
getDetailListApi
:
this
.
$apis
.
coupons
.
getDetailListApi
,
detailTableParams
:
{
listName
:
'list'
,
tableColumns
:
[
{
label
:
'领用时间'
,
prop
:
'createdDate'
,
sortable
:
'custom'
,
width
:
'160px'
,
formatter
:
cellValue
=>
{
return
dayjs
(
cellValue
.
createdDate
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
}
},
{
label
:
'车主姓名'
,
prop
:
'customerName'
},
{
label
:
'手机号'
,
prop
:
'customerPhone'
,
width
:
'120px'
},
{
label
:
'礼券名称'
,
prop
:
'couponName'
},
{
label
:
'门店名称'
,
prop
:
'merchantName'
,
formatter
:
cellValue
=>
{
return
cellValue
.
merchantName
+
' - '
+
cellValue
.
yqMerchantName
}
},
{
label
:
'发券人'
,
prop
:
'employeeName'
,
optionConfig
:
{
searchItemName
:
'employeeNameList'
,
optionId
:
'confId'
,
optionLabel
:
'confValue'
}
// optionList: []
},
{
label
:
'核销状态'
,
prop
:
'usedFlag'
,
width
:
'100px'
,
formatter
:
(
cellValue
)
=>
{
return
{
N
:
'待核销'
,
Y
:
'已核销'
}[
cellValue
.
usedFlag
]
},
optionConfig
:
{
searchItemName
:
'usedFlagList'
,
optionId
:
'confId'
,
optionLabel
:
'confValue'
}
// optionList: [{ confValue: '待核销', confId: 'N' }, { confValue: '已核销', confId: 'Y' }]
},
{
label
:
'核销人'
,
prop
:
'sellerName'
// optionConfig: {
// searchItemName: 'sellerNameList',
// optionId: 'confId',
// optionLabel: 'confValue'
// }
// optionList: []
},
{
label
:
'核销时间'
,
prop
:
'usedTime'
,
sortable
:
'custom'
,
width
:
'160px'
,
formatter
:
cellValue
=>
{
return
cellValue
.
usedTime
?
dayjs
(
cellValue
.
usedTime
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
''
}
}]
},
// 新增
// 新增
couponsVisible
:
false
,
couponsVisible
:
false
,
// 基本数据
// 基本数据
baseData
:
{
baseData
:
{
productTypeList
:
[],
typeList
:
[],
brandList
:
[]
enabledFlagList
:
[
// statusList: baseList.statusList
{
confLabel
:
'启用'
,
confId
:
'Y'
},
{
confLabel
:
'停用'
,
confId
:
'N'
}
],
usedFlagList
:
[
{
confLabel
:
'待核销'
,
confId
:
'N'
},
{
confLabel
:
'已核销'
,
confId
:
'Y'
}
],
sellerNameList
:
[]
},
},
imgVisible
:
false
,
imgVisible
:
false
,
previewImgUrl
:
''
previewImgUrl
:
''
...
@@ -117,9 +315,32 @@ export default {
...
@@ -117,9 +315,32 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
$utils
.
getOptionsList
(
this
,
'searchFormData'
)
getOptionsList
(
this
,
'searchFormData'
,
false
)
this
.
getTypeList
()
this
.
getDistinctColum
()
},
},
methods
:
{
methods
:
{
getTypeList
()
{
this
.
$apis
.
coupons
.
getTypeList
({}).
then
(
res
=>
{
this
.
baseData
.
typeList
=
res
getOptionsList
(
this
,
'searchFormData'
,
false
,
'couponTypeList'
)
})
},
getDistinctColum
()
{
// columType属性类型(1:发券人;2:转化人)
this
.
$apis
.
coupons
.
getDistinctColum
({
columType
:
2
,
currentPage
:
1
,
pageSize
:
100
}).
then
(
res
=>
{
console
.
log
(
res
)
let
_list
=
[]
res
.
forEach
(
item
=>
{
_list
.
push
({
confId
:
item
,
confName
:
item
})
})
this
.
baseData
.
sellerNameList
=
_list
getOptionsList
(
this
,
'searchFormData'
,
false
,
'sellerNameList'
)
})
},
/** 二次确认封装 */
/** 二次确认封装 */
secondConfirm
(
that
,
title
,
txt
,
apiModule
,
apiName
,
apiParams
,
type
=
'warning'
,
fn
)
{
secondConfirm
(
that
,
title
,
txt
,
apiModule
,
apiName
,
apiParams
,
type
=
'warning'
,
fn
)
{
that
.
$confirm
(
txt
,
title
,
{
that
.
$confirm
(
txt
,
title
,
{
...
@@ -128,34 +349,69 @@ export default {
...
@@ -128,34 +349,69 @@ export default {
type
,
type
,
callback
:
action
=>
{
callback
:
action
=>
{
if
(
action
==
'confirm'
)
{
if
(
action
==
'confirm'
)
{
//
that.$apis[apiModule][apiName](apiParams).then(res => {
that
.
$apis
[
apiModule
][
apiName
](
apiParams
).
then
(
res
=>
{
//
that.$message({
that
.
$message
({
//
message: res.code == '0' ? '操作成功' : res.message,
message
:
res
.
code
==
'0'
?
'操作成功'
:
res
.
message
,
//
type: res.code == '0' ? 'success' : 'error'
type
:
res
.
code
==
'0'
?
'success'
:
'error'
//
})
})
//
if (res.code == '0') {
if
(
res
.
code
==
'0'
)
{
//
fn && fn()
fn
&&
fn
()
//
that.handleSearch()
that
.
handleSearch
()
//
}
}
//
})
})
}
}
}
}
})
})
},
},
changeFormAttr
(
formName
,
attrName
,
labelList
,
attrValue
)
{
console
.
log
(
this
[
formName
])
labelList
.
forEach
(
item
=>
{
let
idx
=
this
[
formName
].
findIndex
(
k
=>
k
.
label
==
item
)
this
[
formName
][
idx
][
attrName
]
=
attrValue
})
},
// tab切换
handleTabChange
()
{
let
storeAttrList
=
[
'状态'
]
let
couponAttrList
=
[
'发券人'
,
'核销状态'
,
'核销人'
]
this
.
changeFormAttr
(
'searchFormData'
,
'isHide'
,
storeAttrList
,
this
.
activeName
!=
'storeList'
)
this
.
changeFormAttr
(
'searchFormData'
,
'isHide'
,
couponAttrList
,
this
.
activeName
!=
'couponsDetail'
)
this
.
handleReset
()
},
// 停用
// 停用
handleStop
(
row
)
{
handleStop
(
row
)
{
this
.
secondConfirm
(
this
,
'停用提示'
,
'是否停用该礼券?'
)
console
.
log
(
row
)
let
params
=
{
id
:
row
.
id
,
enabledFlag
:
row
.
enabledFlag
===
'Y'
?
'N'
:
'Y'
}
let
txt
=
row
.
enabledFlag
===
'Y'
?
'停用'
:
'启用'
this
.
secondConfirm
(
this
,
txt
+
'提示'
,
'是否'
+
txt
+
'该礼券?'
,
'coupons'
,
'updateCouponApi'
,
params
)
},
},
// 删除
// 删除
handleDelete
(
info
)
{
handleDelete
(
row
)
{
this
.
secondConfirm
(
this
,
'删除提示'
,
'是否确认删除该礼券?'
)
this
.
secondConfirm
(
this
,
'删除提示'
,
'是否确认删除该礼券?'
)
console
.
log
(
info
)
},
// 排序
sortChange
({
col
,
prop
,
order
})
{
this
.
searchForm
.
orderByType
=
this
.
sortObj
[
prop
][
order
]
this
.
handleSearch
()
},
// 领用明细-排序
detailSortChange
({
col
,
prop
,
order
})
{
this
.
searchForm
.
orderByType
=
this
.
detailSortObj
[
prop
][
order
]
this
.
handleSearch
()
},
},
handleSearch
()
{
handleSearch
()
{
this
.
$refs
.
storeRef
.
refreshTable
()
let
refName
=
this
.
activeName
==
'storeList'
?
'storeRef'
:
'detailRef'
this
.
$refs
[
refName
].
refreshTable
()
},
},
handleReset
()
{
handleReset
()
{
...
...
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