Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-outbound
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 5e5ca3c8
authored
Jan 15, 2024
by
王志慧
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'v3.24.0_wzh' into v3.24.0
2 parents
023ff59d
9e212c6f
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1208 additions
and
144 deletions
package.json
src/api/modules/redenvelope.js
src/assets/icon-edit.png
src/common/constant.js
src/views/redEnvelope/components/RedEnvelopeConfig/FreeAdd.vue
src/views/redEnvelope/components/RedEnvelopeConfig/OffAdd.vue
src/views/redEnvelope/components/RedEnvelopeConfig/add.vue
src/views/redEnvelope/components/RedEnvelopeConfig/index.vue
package.json
View file @
5e5ca3c
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
"lint"
:
"vue-cli-service lint"
"lint"
:
"vue-cli-service lint"
},
},
"dependencies"
:
{
"dependencies"
:
{
"bignumber.js"
:
"^9.1.1"
,
"china-area-data"
:
"^5.0.1"
,
"china-area-data"
:
"^5.0.1"
,
"core-js"
:
"^3.4.4"
,
"core-js"
:
"^3.4.4"
,
"dayjs"
:
"^1.10.7"
,
"dayjs"
:
"^1.10.7"
,
...
...
src/api/modules/redenvelope.js
View file @
5e5ca3c
import
{
http
}
from
'@/main'
import
{
http
}
from
'@/main'
const
url
=
'/rop-scrm-marketing/router'
const
url
=
'/rop-scrm-marketing/router'
export
default
{
export
default
{
/**获取红包配置列表 */
/**获取红包配置列表 */
getRedEnvelopeConfigList
(
params
)
{
getRedEnvelopeConfigList
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.page'
params
.
method
=
'marketing.api.activityRedEnvelope.page'
return
http
({
return
http
({
url
,
url
,
...
@@ -11,7 +10,7 @@ export default {
...
@@ -11,7 +10,7 @@ export default {
})
})
},
},
/**获取红包活动列表 */
/**获取红包活动列表 */
getRedEnvelopeActivityList
(
params
)
{
getRedEnvelopeActivityList
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.merchant.list'
params
.
method
=
'marketing.api.activityRedEnvelope.merchant.list'
return
http
({
return
http
({
url
,
url
,
...
@@ -20,7 +19,7 @@ export default {
...
@@ -20,7 +19,7 @@ export default {
},
},
/**获取所属渠道列表 */
/**获取所属渠道列表 */
getRedEnvelopeMerchantList
(
params
)
{
getRedEnvelopeMerchantList
(
params
)
{
params
.
method
=
'scrm.api.carlife.merchant.listWithPageByCurMerchant'
params
.
method
=
'scrm.api.carlife.merchant.listWithPageByCurMerchant'
params
.
pageSize
=
params
.
pageSize
||
50
params
.
pageSize
=
params
.
pageSize
||
50
return
http
({
return
http
({
...
@@ -28,9 +27,26 @@ export default {
...
@@ -28,9 +27,26 @@ export default {
data
:
params
data
:
params
})
})
},
},
/*获取模板 */
getRedEnvelopeTemplateList
(
params
)
{
params
.
method
=
'marketing.api.self.red.envelope.template.page'
params
.
pageSize
=
params
.
pageSize
||
10000
return
http
({
url
,
data
:
params
})
},
//获取优惠券
getCouponList
(
params
)
{
params
.
method
=
'scrm.api.coupon.equity.list.merchant'
params
.
pageSize
=
params
.
pageSize
||
1000
return
http
({
url
:
'/rop-scrm-coupon/router'
,
data
:
params
})
},
/**查询红包活动详情 */
/**查询红包活动详情 */
getRedEnvelopeActivityDetail
(
params
)
{
getRedEnvelopeActivityDetail
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.findOne'
params
.
method
=
'marketing.api.activityRedEnvelope.findOne'
return
http
({
return
http
({
url
,
url
,
...
@@ -39,7 +55,7 @@ export default {
...
@@ -39,7 +55,7 @@ export default {
},
},
/** 新建红包活动接口 */
/** 新建红包活动接口 */
createActivityRedEnvelope
(
params
)
{
createActivityRedEnvelope
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.create'
params
.
method
=
'marketing.api.activityRedEnvelope.create'
return
http
({
return
http
({
url
,
url
,
...
@@ -48,7 +64,7 @@ export default {
...
@@ -48,7 +64,7 @@ export default {
},
},
/** 更新红包活动 */
/** 更新红包活动 */
updateActivityRedEnvelope
(
params
)
{
updateActivityRedEnvelope
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.update'
params
.
method
=
'marketing.api.activityRedEnvelope.update'
return
http
({
return
http
({
url
,
url
,
...
@@ -59,7 +75,7 @@ export default {
...
@@ -59,7 +75,7 @@ export default {
* /新建活动文件校验上传文件接口
* /新建活动文件校验上传文件接口
*/
*/
createCheckFile
(
params
)
{
createCheckFile
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.createCheckFile'
params
.
method
=
'marketing.api.activityRedEnvelope.createCheckFile'
return
http
({
return
http
({
url
,
url
,
...
@@ -71,7 +87,7 @@ export default {
...
@@ -71,7 +87,7 @@ export default {
* /编辑活动文件校验上传文件接口
* /编辑活动文件校验上传文件接口
*/
*/
updateCheckFile
(
params
)
{
updateCheckFile
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.updateCheckFile'
params
.
method
=
'marketing.api.activityRedEnvelope.updateCheckFile'
return
http
({
return
http
({
url
,
url
,
...
@@ -80,7 +96,7 @@ export default {
...
@@ -80,7 +96,7 @@ export default {
},
},
/** 红包配置列表导出 */
/** 红包配置列表导出 */
exportActivityRedEnvelope
(
params
)
{
exportActivityRedEnvelope
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.export'
params
.
method
=
'marketing.api.activityRedEnvelope.export'
return
http
({
return
http
({
url
,
url
,
...
@@ -89,7 +105,7 @@ export default {
...
@@ -89,7 +105,7 @@ export default {
},
},
/** 查询红包链接详情 */
/** 查询红包链接详情 */
getActivityRedEnvelopeLinkDetailPage
(
params
)
{
getActivityRedEnvelopeLinkDetailPage
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.linkDetailPage'
params
.
method
=
'marketing.api.activityRedEnvelope.linkDetailPage'
return
http
({
return
http
({
url
,
url
,
...
@@ -97,10 +113,9 @@ export default {
...
@@ -97,10 +113,9 @@ export default {
})
})
},
},
/**获取红包记录列表 */
/**获取红包记录列表 */
getRedEnvelopeRecordList
(
params
)
{
getRedEnvelopeRecordList
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.record.page'
params
.
method
=
'marketing.api.activityRedEnvelope.record.page'
return
http
({
return
http
({
url
,
url
,
...
@@ -110,7 +125,7 @@ export default {
...
@@ -110,7 +125,7 @@ export default {
/**
/**
* /校验中奖记录导入
* /校验中奖记录导入
*/
*/
checkImport
(
params
)
{
checkImport
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.winningRecord.checkImport'
params
.
method
=
'marketing.api.activityRedEnvelope.winningRecord.checkImport'
return
http
({
return
http
({
url
,
url
,
...
@@ -118,7 +133,7 @@ export default {
...
@@ -118,7 +133,7 @@ export default {
})
})
},
},
/** 导入中奖记录 */
/** 导入中奖记录 */
importRedEnvelopeRecord
(
params
)
{
importRedEnvelopeRecord
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.winningRecord.import'
params
.
method
=
'marketing.api.activityRedEnvelope.winningRecord.import'
return
http
({
return
http
({
url
,
url
,
...
@@ -128,7 +143,7 @@ export default {
...
@@ -128,7 +143,7 @@ export default {
// 提现记录分页列表
// 提现记录分页列表
getRedEnvelopeWithdraw
(
params
)
{
getRedEnvelopeWithdraw
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.cash.out.record.page'
params
.
method
=
'marketing.api.activityRedEnvelope.cash.out.record.page'
return
http
({
return
http
({
url
,
url
,
...
@@ -136,14 +151,14 @@ export default {
...
@@ -136,14 +151,14 @@ export default {
})
})
},
},
exportRedEnvelopeWithdraw
(
params
)
{
exportRedEnvelopeWithdraw
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.cash.out.record.export'
params
.
method
=
'marketing.api.activityRedEnvelope.cash.out.record.export'
return
http
({
return
http
({
url
,
url
,
data
:
params
data
:
params
})
})
},
},
exportRedEnvelopeRecord
(
params
)
{
exportRedEnvelopeRecord
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.record.export'
params
.
method
=
'marketing.api.activityRedEnvelope.record.export'
return
http
({
return
http
({
url
,
url
,
...
@@ -152,7 +167,7 @@ export default {
...
@@ -152,7 +167,7 @@ export default {
},
},
// 获取白名单列表
// 获取白名单列表
getWhiteListPage
(
params
){
getWhiteListPage
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.whiteList.page'
params
.
method
=
'marketing.api.activityRedEnvelope.whiteList.page'
return
http
({
return
http
({
url
,
url
,
...
@@ -160,7 +175,7 @@ export default {
...
@@ -160,7 +175,7 @@ export default {
})
})
},
},
// 校验红包活动白名单导入
// 校验红包活动白名单导入
checkImportWhiteList
(
params
){
checkImportWhiteList
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.whiteList.checkImport'
params
.
method
=
'marketing.api.activityRedEnvelope.whiteList.checkImport'
return
http
({
return
http
({
url
,
url
,
...
@@ -168,7 +183,7 @@ export default {
...
@@ -168,7 +183,7 @@ export default {
})
})
},
},
// 红包活动白名单导入
// 红包活动白名单导入
whiteListImport
(
params
){
whiteListImport
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.whiteList.import'
params
.
method
=
'marketing.api.activityRedEnvelope.whiteList.import'
return
http
({
return
http
({
url
,
url
,
...
@@ -176,7 +191,7 @@ export default {
...
@@ -176,7 +191,7 @@ export default {
})
})
},
},
whiteListDelete
(
params
){
whiteListDelete
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.whiteList.delete'
params
.
method
=
'marketing.api.activityRedEnvelope.whiteList.delete'
return
http
({
return
http
({
url
,
url
,
...
@@ -185,7 +200,7 @@ export default {
...
@@ -185,7 +200,7 @@ export default {
},
},
// 展示记录列表
// 展示记录列表
displayListApi
(
params
){
displayListApi
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.show.record.page'
params
.
method
=
'marketing.api.activityRedEnvelope.show.record.page'
return
http
({
return
http
({
url
,
url
,
...
@@ -194,7 +209,7 @@ export default {
...
@@ -194,7 +209,7 @@ export default {
},
},
// 展示记录导出
// 展示记录导出
displayExportApi
(
params
){
displayExportApi
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.show.record.export'
params
.
method
=
'marketing.api.activityRedEnvelope.show.record.export'
return
http
({
return
http
({
url
,
url
,
...
@@ -202,7 +217,7 @@ export default {
...
@@ -202,7 +217,7 @@ export default {
})
})
},
},
// 抽奖记录列表
// 抽奖记录列表
drawListApi
(
params
){
drawListApi
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.lottery.draw.record.page'
params
.
method
=
'marketing.api.activityRedEnvelope.lottery.draw.record.page'
return
http
({
return
http
({
url
,
url
,
...
@@ -211,7 +226,7 @@ export default {
...
@@ -211,7 +226,7 @@ export default {
},
},
// 导出红包抽奖记录
// 导出红包抽奖记录
drawExportApi
(
params
){
drawExportApi
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.lottery.draw.record.export'
params
.
method
=
'marketing.api.activityRedEnvelope.lottery.draw.record.export'
return
http
({
return
http
({
url
,
url
,
...
@@ -219,7 +234,7 @@ export default {
...
@@ -219,7 +234,7 @@ export default {
})
})
},
},
// 中奖记录列表
// 中奖记录列表
winningListApi
(
params
){
winningListApi
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.winning.record.page'
params
.
method
=
'marketing.api.activityRedEnvelope.winning.record.page'
return
http
({
return
http
({
url
,
url
,
...
@@ -227,7 +242,7 @@ export default {
...
@@ -227,7 +242,7 @@ export default {
})
})
},
},
// 导出中奖记录列表
// 导出中奖记录列表
winningExportApi
(
params
){
winningExportApi
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.winning.record.export'
params
.
method
=
'marketing.api.activityRedEnvelope.winning.record.export'
return
http
({
return
http
({
url
,
url
,
...
@@ -235,7 +250,7 @@ export default {
...
@@ -235,7 +250,7 @@ export default {
})
})
},
},
// 实物奖品核销列表
// 实物奖品核销列表
winningGoodsApi
(
params
){
winningGoodsApi
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.winning.goods.record.page'
params
.
method
=
'marketing.api.activityRedEnvelope.winning.goods.record.page'
return
http
({
return
http
({
url
,
url
,
...
@@ -243,7 +258,7 @@ export default {
...
@@ -243,7 +258,7 @@ export default {
})
})
},
},
// 实物奖品核销导出
// 实物奖品核销导出
winningGoodsExportApi
(
params
){
winningGoodsExportApi
(
params
)
{
params
.
method
=
'marketing.api.activityRedEnvelope.winning.goods.record.export'
params
.
method
=
'marketing.api.activityRedEnvelope.winning.goods.record.export'
return
http
({
return
http
({
url
,
url
,
...
@@ -298,4 +313,3 @@ export default {
...
@@ -298,4 +313,3 @@ export default {
})
})
}
}
}
}
src/assets/icon-edit.png
0 → 100644
View file @
5e5ca3c
420 Bytes
src/common/constant.js
View file @
5e5ca3c
// 新值,旧值,整数部分位数,小数部分位数,最小值,最大值,规则
// 新值,旧值,整数部分位数,小数部分位数,最小值,最大值,规则
function
limitPrice
(
newValue
,
oldValue
,
intergerDigit
,
pointDigit
,
minValue
,
maxValue
,
regRule
)
{
function
limitPrice
(
newValue
,
oldValue
,
intergerDigit
,
pointDigit
,
minValue
,
maxValue
,
regRule
)
{
/* eslint-disable */
/* eslint-disable */
var
reg
=
{
var
reg
=
{
priceReg
:
/^
\d[\d\.]
*$/
,
priceReg
:
/^
\d[\d\.]
*$/
,
...
@@ -76,14 +76,15 @@ const statusList = [
...
@@ -76,14 +76,15 @@ const statusList = [
}
}
]
]
//会员订单类型字典
//会员订单类型字典
const
orderTypesList
=
[{
const
orderTypesList
=
[
{
confId
:
1
,
confId
:
1
,
confName
:
'套餐'
confName
:
'套餐'
},
},
{
{
confId
:
2
,
confId
:
2
,
confName
:
'会员卡'
confName
:
'会员卡'
}
}
]
]
const
orderStatusList
=
[
const
orderStatusList
=
[
// 2: '待收货',
// 2: '待收货',
...
@@ -110,45 +111,48 @@ const orderStatusList = [
...
@@ -110,45 +111,48 @@ const orderStatusList = [
{
{
confId
:
6
,
confId
:
6
,
confName
:
'已退款'
confName
:
'已退款'
}
,
}
]
]
const
serviceStatusList
=
[{
const
serviceStatusList
=
[
{
confId
:
1
,
confId
:
1
,
confName
:
'未生效'
confName
:
'未生效'
},
},
{
{
confId
:
2
,
confId
:
2
,
confName
:
'生效中'
confName
:
'生效中'
},
},
{
{
confId
:
3
,
confId
:
3
,
confName
:
'已失效'
confName
:
'已失效'
}
}
]
]
const
memberTypeList
=
[{
const
memberTypeList
=
[
{
confId
:
1
,
confId
:
1
,
confName
:
'正式会员'
confName
:
'正式会员'
},
},
{
{
confId
:
2
,
confId
:
2
,
confName
:
'试用会员'
confName
:
'试用会员'
}
}
]
]
const
stateList
=
[{
const
stateList
=
[
{
confId
:
0
,
confId
:
0
,
confName
:
'待上架'
confName
:
'待上架'
},
},
{
{
confId
:
1
,
confId
:
1
,
confName
:
'在售中'
confName
:
'在售中'
},
},
{
{
confId
:
2
,
confId
:
2
,
confName
:
'已下架'
confName
:
'已下架'
},
}
]
]
function
getExplorer
()
{
function
getExplorer
()
{
var
ua
=
navigator
.
userAgent
.
toLocaleLowerCase
()
var
ua
=
navigator
.
userAgent
.
toLocaleLowerCase
()
var
browserType
=
null
var
browserType
=
null
if
(
ua
.
match
(
/msie/
)
!=
null
||
ua
.
match
(
/trident/
)
!=
null
)
{
if
(
ua
.
match
(
/msie/
)
!=
null
||
ua
.
match
(
/trident/
)
!=
null
)
{
...
@@ -173,7 +177,7 @@ function getExplorer () {
...
@@ -173,7 +177,7 @@ function getExplorer () {
return
browserType
return
browserType
}
}
function
exportFn
(
url
)
{
function
exportFn
(
url
)
{
let
browserType
=
getExplorer
()
let
browserType
=
getExplorer
()
if
(
browserType
==
'QQ'
)
{
if
(
browserType
==
'QQ'
)
{
window
.
open
(
url
)
window
.
open
(
url
)
...
@@ -200,7 +204,7 @@ const transformData = (data, childrenDepth) => {
...
@@ -200,7 +204,7 @@ const transformData = (data, childrenDepth) => {
for
(
let
i
=
0
;
i
<
childrenDepth
;
i
++
)
{
for
(
let
i
=
0
;
i
<
childrenDepth
;
i
++
)
{
const
label
=
levels
[
i
],
const
label
=
levels
[
i
],
value
=
label
,
value
=
label
,
existingOption
=
currentLevel
&&
currentLevel
.
find
(
(
option
)
=>
option
.
label
===
label
)
existingOption
=
currentLevel
&&
currentLevel
.
find
(
option
=>
option
.
label
===
label
)
if
(
existingOption
)
{
if
(
existingOption
)
{
if
(
i
===
childrenDepth
-
1
)
continue
if
(
i
===
childrenDepth
-
1
)
continue
if
(
existingOption
.
children
)
currentLevel
=
existingOption
.
children
if
(
existingOption
.
children
)
currentLevel
=
existingOption
.
children
...
@@ -217,7 +221,7 @@ const transformData = (data, childrenDepth) => {
...
@@ -217,7 +221,7 @@ const transformData = (data, childrenDepth) => {
})
})
return
result
return
result
}
}
const
checkSpace
=
(
rule
,
value
,
callback
,
target
)
=>
{
const
checkSpace
=
(
rule
,
value
,
callback
,
target
)
=>
{
const
{
field
,
message
}
=
rule
const
{
field
,
message
}
=
rule
if
(
!
value
)
callback
(
new
Error
(
message
))
if
(
!
value
)
callback
(
new
Error
(
message
))
else
if
(
!
value
.
trim
())
callback
(
new
Error
(
rule
.
message
))
else
if
(
!
value
.
trim
())
callback
(
new
Error
(
rule
.
message
))
...
@@ -226,20 +230,11 @@ const checkSpace = (rule, value, callback,target ) => {
...
@@ -226,20 +230,11 @@ const checkSpace = (rule, value, callback,target ) => {
callback
()
callback
()
}
}
}
}
export
{
limitPrice
,
orderManageStatusList
,
orderSourceList
,
deliveryTypeList
,
statusList
,
serviceStatusList
,
memberTypeList
,
stateList
,
orderTypesList
,
orderStatusList
,
exportFn
,
getExplorer
,
activityStatusList
,
transformData
,
checkSpace
}
\ No newline at end of file
\ No newline at end of file
const
awardType
=
[
{
confId
:
0
,
confName
:
'红包'
},
{
confId
:
1
,
confName
:
'实物'
},
{
confId
:
2
,
confName
:
'优惠券'
},
{
confId
:
3
,
confName
:
'谢谢惠顾'
}
]
export
{
awardType
,
limitPrice
,
orderManageStatusList
,
orderSourceList
,
deliveryTypeList
,
statusList
,
serviceStatusList
,
memberTypeList
,
stateList
,
orderTypesList
,
orderStatusList
,
exportFn
,
getExplorer
,
activityStatusList
,
transformData
,
checkSpace
}
src/views/redEnvelope/components/RedEnvelopeConfig/FreeAdd.vue
0 → 100644
View file @
5e5ca3c
<
template
>
<div
class=
"add-wrap"
>
<div
class=
"header"
>
<div
class=
"step"
>
<div
class=
"baseinfo"
>
<div
:class=
"['circular',
{ circularAct: activePage == '1' }]" v-if="activePage == 1">1
</div>
<div
:class=
"['circular',
{ circularTick: activePage == '2' }]" v-else>√
</div>
<span
class=
"text"
>
基本信息
</span>
</div>
<div
class=
"horizontalLine"
></div>
<div
class=
"baseinfo"
>
<div
:class=
"['circular',
{ circularAct: activePage == '2' }]">2
</div>
<span
class=
"text"
>
直播间配置
</span>
</div>
</div>
</div>
<div
class=
"container gl-form-page"
>
<div
v-show=
"activePage == 1"
>
<el-form
ref=
"configRef"
label-width=
"154px"
:rules=
"configRules"
:model=
"configForm"
>
<el-form-item
label=
"活动名称:"
prop=
"activityName"
class=
"m-t-20"
>
<el-input
:size=
"size"
v-model=
"configForm.activityName"
placeholder=
"请输入"
maxlength=
"25"
:disabled=
"disabled"
></el-input>
</el-form-item>
<el-form-item
label=
"所属渠道:"
prop=
"merchantId"
class=
"m-t-20"
>
<el-select
:size=
"size"
v-model=
"configForm.merchantId"
placeholder=
"请选择"
:disabled=
"disabled"
filterable
remote
:remote-method=
"remoteMethod"
v-reachbottom=
"onReachBottom"
@
focus=
"selectFocus"
:loading=
"loading"
>
<el-option
v-for=
"item in merchantObj.data"
:key=
"item.confId"
:label=
"item.confName"
:value=
"item.confId"
></el-option>
<template
v-if=
"merchantObj.nothing"
>
<div
class=
"nothing"
>
到底了!
</div>
</
template
>
</el-select>
</el-form-item>
<el-form-item
label=
"活动时间:"
prop=
"activityTime"
class=
"m-t-20"
>
<el-date-picker
:size=
"size"
v-model=
"configForm.activityTime"
type=
"daterange"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
:picker-options=
"afterRangePickerOptions"
></el-date-picker>
</el-form-item>
<el-form-item
label=
"活动形式:"
prop=
"activityType"
class=
"m-t-20"
>
<el-radio-group
:size=
"size"
v-model=
"configForm.activityType"
style=
"width: 400px"
:disabled=
"disabled"
>
<el-radio
:label=
"0"
>
随机红包
</el-radio>
<el-radio
:label=
"1"
>
九宫格
</el-radio>
<el-radio
:label=
"2"
>
翻牌
</el-radio>
<el-radio
:label=
"3"
>
大转盘
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"活动模版:"
prop=
"templateId"
class=
"m-t-20"
>
<el-select
:size=
"size"
v-model=
"configForm.templateId"
placeholder=
"请选择"
:disabled=
"disabled"
filterable
remote
@
focus=
"selectFocus"
:loading=
"loading"
>
<el-option
v-for=
"item in templateList"
:key=
"item.id"
:label=
"item.templateName"
:value=
"item.id"
></el-option>
</el-select>
</el-form-item>
</el-form>
</div>
<div
v-show=
"activePage == 2"
class=
"award-wrap"
>
<el-form
ref=
"configSecondRef"
label-width=
"154px"
:rules=
"configRules"
:model=
"configForm"
>
<el-form-item
label=
"活动奖项:"
prop=
"awardList"
class=
"m-t-20"
>
<GLTable
ref=
"orderRef"
:tableData=
"configForm.awardList"
:noDataImg=
"url"
:tableParams=
"tableParams"
:hasPage=
"false"
>
<!-- 奖项类型 -->
<
template
slot=
"type"
slot-scope=
"scope"
>
<el-form-item
style=
"margin-bottom: 0px"
:prop=
"'awardList.' + scope.index + '.type'"
:rules=
"configRules.type"
>
<el-select
style=
"width: 100%"
v-model=
"scope.scope.type"
placeholder=
"请选择"
@
change=
"changeLine(scope.scope, scope.index)"
>
<el-option
v-for=
"item in awardType"
:key=
"item.confId"
:label=
"item.confName"
:value=
"item.confId"
></el-option>
</el-select>
</el-form-item>
</
template
>
<!-- 奖项名称 -->
<
template
slot=
"name"
slot-scope=
"scope"
>
<template
v-if=
"configForm.awardList[scope.index].type == 2"
>
<!-- :红包、实物、谢谢惠顾时,为输入框 优惠券,为下拉框 -->
<el-form-item
style=
"margin-bottom: 0px"
:prop=
"'awardList.' + scope.index + '.couponId'"
:rules=
"configRules.couponId"
>
<el-select
style=
"width: 100%"
v-model=
"scope.scope.couponId"
placeholder=
"请选择"
>
<el-option
v-for=
"item in couponList"
:key=
"item.id"
:label=
"item.goodsName"
:value=
"item.id"
></el-option>
</el-select>
</el-form-item>
</
template
>
<
template
v-else
>
<el-form-item
style=
"margin-bottom: 0px"
:prop=
"'awardList.' + scope.index + '.name'"
:rules=
"configRules.name"
>
<el-input
v-model=
"scope.scope.name"
placeholder=
"请输入"
maxlength=
"20"
></el-input>
</el-form-item>
</
template
>
</template>
<!-- 单个金额/元 -->
<
template
slot=
"amount"
slot-scope=
"scope"
>
<template
v-if=
"configForm.awardList[scope.index].type == 0"
>
<el-form-item
style=
"margin-bottom: 0px"
:prop=
"'awardList.' + scope.index + '.amount'"
:rules=
"configRules.amount"
>
<el-input
v-model=
"scope.scope.amount"
placeholder=
"请输入"
@
blur=
"handleCalculate(scope.scope, 'amount')"
></el-input>
</el-form-item>
</
template
>
<span
v-else
>
--
</span>
</template>
<!-- 总共数量 -->
<
template
slot=
"total"
slot-scope=
"scope"
>
<el-form-item
style=
"margin-bottom: 0px"
:prop=
"'awardList.' + scope.index + '.total'"
:rules=
"configRules.total"
>
<el-input
v-model=
"scope.scope.total"
placeholder=
"请输入"
@
blur=
"handleCalculate(scope.scope, 'total')"
></el-input>
</el-form-item>
</
template
>
<!-- 中奖概率 -->
<
template
slot=
"probability"
slot-scope=
"scope"
>
<el-form-item
style=
"margin-bottom: 0px"
:prop=
"'awardList.' + scope.index + '.probability'"
>
<el-input
v-model=
"scope.scope.probability"
placeholder=
"请输入"
disabled
></el-input>
</el-form-item>
</
template
>
<!-- 奖品图标 -->
<
template
slot=
"picture"
slot-scope=
"scope"
>
<template
v-if=
"configForm.awardList[scope.index].type == 1"
>
<el-form-item
style=
"margin-bottom: 0px"
:prop=
"'awardList.' + scope.index + '.picture'"
>
<div
class=
"upload-img"
>
<i
class=
"el-icon-plus avatar-uploader-desc-icon"
></i>
<input
type=
"file"
ref=
"uploadImg"
class=
"upload-img"
style=
"opacity: 0"
accept=
".jpg, .jpeg, .png"
@
change=
"e => handleImgChange(e, scope.index)"
/>
<div
class=
"select-upload-img"
v-if=
"configForm.awardList[scope.index].picture"
>
<img
:src=
"configForm.awardList[scope.index].picture"
class=
"avatar"
/>
<img
src=
"@/assets/icon-edit.png"
class=
"icon-edit"
/>
</div>
</div>
</el-form-item>
</
template
>
</template>
<div
class=
"table-btns"
slot=
"auth-button"
slot-scope=
"scope"
>
<el-button
type=
"text"
@
click=
"handleDelete(scope.index)"
>
删除
</el-button>
</div>
</GLTable>
</el-form-item>
<div
class=
"add-line"
@
click=
"addLine"
>
<i
class=
"el-icon-circle-plus-outline"
></i>
新增一项
</div>
<div
class=
"paying"
>
已设置:
<span
class=
"num"
>
{{ configForm.awardsConfig.awardsTotal }}
</span>
个奖项,
<span
class=
"num"
>
{{ configForm.awardsConfig.redEnvelopesTotal }}
</span>
个红包,金额
<span
class=
"num"
>
{{ configForm.awardsConfig.amountTotal }}
</span>
元
<span
class=
"btn"
>
合算
</span>
</div>
<el-form-item
label=
"限制条件:"
class=
"m-t-20"
>
<el-switch
v-model=
"configForm.limiting"
active-color=
"#5850ff"
></el-switch>
</el-form-item>
<div
class=
"limit-container"
v-if=
"configForm.limiting"
>
一个账户(open ID)每个活动最多扫码次数为
<el-input-number
v-model=
"configForm.awardsConfig.limitTimes"
size=
"small"
controls-position=
"right"
@
change=
"handleChange"
:min=
"1"
></el-input-number>
次,超出该数量提示
<el-form-item
prop=
"awardsConfig.msg"
class=
"limit-msg"
>
<el-input
v-model=
"configForm.awardsConfig.msg"
maxlength=
"20"
show-word-limit
placeholder=
"请输入"
></el-input>
</el-form-item>
</div>
</el-form>
</div>
</div>
<GLFooter>
<el-button
@
click=
"handleClose"
>
{{ activePage == 2 ? '上一步' : '取消' }}
</el-button>
<el-button
type=
"primary"
@
click=
"handleConfirm(activePage == 2 ? 'next' : 'last')"
>
{{ activePage == 1 ? '下一步' : '提交' }}
</el-button>
</GLFooter>
</div>
</template>
<
script
type=
'text/ecmascript-6'
>
import
BigNumber
from
'bignumber.js'
export
const
afterRangePickerOptions
=
{
disabledDate
(
date
)
{
const
yesterday
=
new
Date
(
new
Date
().
setDate
(
new
Date
().
getDate
()
-
1
))
if
(
date
<
yesterday
)
{
return
true
}
return
false
}
}
export
const
checkPrice
=
(
rule
,
value
,
callback
)
=>
{
if
(
isNaN
(
value
))
{
callback
(
new
Error
(
'请输入数字值'
))
}
else
{
if
(
value
<=
0.1
||
value
>
9999.99
)
{
callback
(
new
Error
(
'仅支持输入0.1~9999.99'
))
}
else
{
callback
()
}
}
}
import
commonFun
from
'../common/fun.js'
import
*
as
dayjs
from
'dayjs'
import
{
getMerchantListMixin
}
from
'@/mixins'
import
{
awardType
}
from
'@/common/constant'
export
default
{
mixins
:
[
getMerchantListMixin
],
name
:
''
,
props
:
{
editObj
:
{
type
:
Object
,
default
:
()
=>
{}
}
},
data
()
{
return
{
activePage
:
1
,
templateList
:
[],
couponList
:
[],
afterRangePickerOptions
,
disabled
:
false
,
configForm
:
{
id
:
this
.
$route
.
query
.
id
,
activityName
:
''
,
merchantId
:
''
,
activityTime
:
''
,
activityType
:
0
,
templateId
:
''
,
limiting
:
true
,
awardsConfig
:
{
limitTimes
:
1
,
msg
:
''
,
redEnvelopesTotal
:
0
,
amountTotal
:
0
,
awardsTotal
:
0
},
awardList
:
[{
type
:
''
,
name
:
''
,
amount
:
''
,
total
:
''
,
probability
:
''
,
picture
:
''
,
couponId
:
''
}]
},
configRules
:
{
activityName
:
[
{
required
:
true
,
message
:
'请输入活动名称'
,
trigger
:
'blur'
}
],
merchantId
:
[
{
required
:
true
,
message
:
'请选择所属渠道'
,
trigger
:
'blur'
}
],
templateId
:
[
{
required
:
true
,
message
:
'请选择活动模版'
,
trigger
:
'blur'
}
],
activityTime
:
[
{
required
:
true
,
message
:
'请输入活动时间'
,
trigger
:
'blur'
}
],
activityType
:
[
{
required
:
true
}
],
exportUrl
:
[
{
required
:
true
,
message
:
'请导入链接'
}
],
type
:
[{
required
:
true
,
message
:
'请选择奖项类型'
,
trigger
:
'change'
}],
name
:
[{
required
:
true
,
message
:
'奖项名称不能为空'
,
trigger
:
'blur'
}],
couponId
:
[{
required
:
true
,
message
:
'奖项名称不能为空'
,
trigger
:
'change'
}],
amount
:
[
{
required
:
true
,
message
:
'请输入金额'
,
trigger
:
'blur'
},
{
validator
:
checkPrice
,
trigger
:
'blur'
}
],
total
:
[
{
required
:
true
,
message
:
'请输入金额'
,
trigger
:
'blur'
},
{
validator
:
checkPrice
,
trigger
:
'blur'
}
],
'awardsConfig.msg'
:
[{
required
:
true
,
message
:
'请输入限制条件'
,
trigger
:
'blur'
}]
},
tableParams
:
{
tableOption
:
true
,
tableColumns
:
[
{
label
:
'奖项类型'
,
prop
:
'type'
,
addHtml
:
'type'
},
{
label
:
'奖项名称'
,
addHtml
:
'name'
,
prop
:
'name'
},
{
label
:
'单个金额/元'
,
prop
:
'amount'
,
addHtml
:
'amount'
},
{
label
:
'总共数量'
,
prop
:
'total'
,
addHtml
:
'total'
},
{
label
:
'中奖概率'
,
prop
:
'probability'
,
addHtml
:
'probability'
},
{
label
:
'奖品图片'
,
prop
:
'picture'
,
addHtml
:
'picture'
}
]
},
awardType
,
fileName
:
''
,
fileError
:
''
,
result
:
''
}
},
watch
:
{
'configForm.awardList'
:
{
handler
(
newVal
,
oldVal
)
{
this
.
handleStatistics
()
},
deep
:
true
}
},
mounted
()
{
this
.
getRedEnvelopeTemplateList
()
this
.
getCouponList
()
if
(
this
.
configForm
.
id
)
this
.
getRedEnvelopeActivityDetail
()
},
methods
:
{
changeLine
(
data
,
index
)
{
this
.
configForm
.
awardList
[
index
]
=
{
type
:
data
.
type
,
name
:
''
,
amount
:
''
,
total
:
''
,
probability
:
''
,
picture
:
''
,
couponId
:
''
}
this
.
$set
(
this
.
configForm
.
awardList
,
index
,
this
.
configForm
.
awardList
[
index
])
},
async
getRedEnvelopeActivityDetail
()
{
let
{
id
}
=
this
.
configForm
try
{
const
{
configForm
}
=
this
,
res
=
await
this
.
$apis
.
redenvelope
.
getRedEnvelopeActivityDetail
({
id
}),
merchantId
=
String
(
res
.
merchantId
)
this
.
configForm
=
{
...
configForm
,
activityName
:
res
.
activityName
,
activityType
:
res
.
activityType
,
merchantId
,
templateId
:
res
.
redEnvelopeTemplate
.
id
,
activityTime
:
[
dayjs
(
res
.
activityStartTime
).
toDate
(),
dayjs
(
res
.
activityEndTime
).
toDate
()],
awardList
:
res
.
awardsConfig
.
awardList
,
limiting
:
this
.
configForm
.
awardsConfig
.
limitTimes
!=
0
?
true
:
false
,
awardsConfig
:
res
.
awardsConfig
}
this
.
merchantObj
.
data
=
[
{
confId
:
merchantId
,
confName
:
res
.
merchantName
}
]
this
.
disabled
=
true
console
.
log
(
this
.
configForm
,
'this.configForm'
)
}
catch
(
error
)
{
this
.
$message
.
error
(
error
)
}
},
getRedEnvelopeTemplateList
()
{
let
params
=
{
pageSize
:
10000
,
pageNum
:
1
}
this
.
$apis
.
redenvelope
.
getRedEnvelopeTemplateList
(
params
).
then
(
res
=>
{
this
.
templateList
=
res
.
data
})
},
getCouponList
()
{
let
params
=
{
pageSize
:
10000
,
pageNum
:
1
}
this
.
$apis
.
redenvelope
.
getCouponList
(
params
).
then
(
res
=>
{
console
.
log
(
res
)
this
.
couponList
=
res
.
list
})
},
handleClose
()
{
if
(
this
.
activePage
==
2
)
{
this
.
activePage
=
1
return
}
this
.
$router
.
push
(
'/redEnvelope/index'
)
},
async
handleConfirm
(
val
)
{
if
(
this
.
activePage
==
1
)
{
this
.
result
=
await
this
.
$refs
.
configRef
.
validate
()
}
console
.
log
(
this
.
result
)
if
(
this
.
result
)
{
this
.
activePage
=
2
}
console
.
log
(
val
,
this
.
activePage
,
val
==
'next'
&&
this
.
activePage
==
2
)
if
(
val
==
'next'
&&
this
.
activePage
==
2
)
{
this
.
$refs
.
configSecondRef
.
validate
(
async
valid
=>
{
console
.
log
(
valid
)
if
(
valid
)
{
try
{
const
{
configForm
,
merchantObj
}
=
this
let
params
=
this
.
$common
.
utils
.
deepClone
(
configForm
),
targetName
=
params
.
id
?
'updateActivityRedEnvelope'
:
'createActivityRedEnvelope'
params
.
sourceType
=
0
params
.
activityStartTime
=
dayjs
(
params
.
activityTime
[
0
]).
format
(
'YYYY-MM-DD'
)
params
.
activityEndTime
=
dayjs
(
params
.
activityTime
[
1
]).
format
(
'YYYY-MM-DD'
)
params
.
merchantName
=
merchantObj
.
data
.
find
(
e
=>
e
.
confId
==
params
.
merchantId
).
confName
Object
.
assign
(
params
.
awardsConfig
,
{
awardList
:
params
.
awardList
})
// console.log(this.handleStatistics())
// Object.assign(params.awardsConfig, this.handleStatistics())
if
(
!
params
.
limiting
)
{
params
.
awardsConfig
.
limitTimes
=
0
}
delete
params
.
limiting
delete
params
.
activityTime
delete
params
.
awardList
console
.
log
(
params
,
'params'
)
const
res
=
await
this
.
$apis
.
redenvelope
[
targetName
](
params
)
if
(
res
)
{
this
.
$message
({
message
:
params
.
id
?
'编辑成功'
:
'创建成功'
,
type
:
'success'
})
this
.
$router
.
push
(
'/redEnvelope/index'
)
}
else
throw
params
.
id
?
'编辑失败'
:
'创建失败'
}
catch
(
error
)
{
this
.
$message
.
error
(
error
)
}
}
})
}
},
handleStatistics
()
{
let
params
=
{
redEnvelopesTotal
:
0
,
amountTotal
:
0
,
awardsTotal
:
this
.
configForm
.
awardList
.
length
}
this
.
configForm
.
awardList
.
forEach
(
item
=>
{
if
(
item
.
type
==
0
)
{
params
.
redEnvelopesTotal
+=
1
if
(
item
.
amount
&&
item
.
total
)
params
.
amountTotal
+=
item
.
amount
*
item
.
total
}
})
Object
.
assign
(
this
.
configForm
.
awardsConfig
,
params
)
},
handleAvatarSuccess
(
res
,
file
)
{
this
.
imageUrl
=
URL
.
createObjectURL
(
file
.
raw
)
},
handleImgChange
(
e
,
index
)
{
console
.
log
(
e
,
index
)
this
.
$notify
({
title
:
'提示'
,
message
:
'图片上传中,请稍后'
})
var
file
=
e
.
srcElement
.
files
[
0
]
var
reader
=
new
FileReader
()
// 默认1MB
const
limitSize
=
10
const
isLt
=
file
.
size
/
1024
/
1024
<
limitSize
if
(
!
isLt
)
{
this
.
$message
.
error
(
'上传图片大小不能超过'
+
limitSize
+
'MB!'
)
return
true
}
reader
.
readAsDataURL
(
file
)
reader
.
onload
=
e
=>
{
const
imgFile
=
e
.
target
.
result
const
arrBase64
=
imgFile
.
split
(
','
)
const
splitStr
=
file
.
name
.
split
(
'.'
)
const
fileUrl
=
splitStr
[
splitStr
.
length
-
1
]
+
'@'
+
arrBase64
[
1
]
this
.
$apis
.
common
.
pictureUpload
({
file
:
fileUrl
,
compress
:
0
}).
then
(
res
=>
{
if
(
res
)
{
this
.
$notify
({
title
:
'提示'
,
message
:
'图片上传成功'
,
type
:
'success'
})
console
.
log
(
res
)
this
.
configForm
.
awardList
[
index
].
picture
=
res
console
.
log
(
this
.
configForm
.
awardList
)
}
e
.
target
.
value
=
''
this
.
$refs
.
uploadImg
.
value
=
''
})
}
},
handleCalculate
(
data
,
key
)
{
if
(
key
==
'amount'
)
{
data
[
key
]
=
data
[
key
]
?
new
BigNumber
(
data
[
key
]).
dp
(
2
).
toNumber
()
:
''
return
}
if
(
key
==
'total'
)
{
data
[
key
]
=
data
[
key
]
?
new
BigNumber
(
data
[
key
]).
dp
(
0
).
toNumber
()
:
''
}
this
.
calculateProbability
()
},
calculateProbability
()
{
let
totalNum
=
0
this
.
configForm
.
awardList
.
forEach
(
item
=>
{
totalNum
+=
item
.
total
})
this
.
configForm
.
awardList
.
forEach
(
item
=>
{
console
.
log
(
item
)
item
.
probability
=
new
BigNumber
(
item
.
total
).
div
(
totalNum
).
times
(
100
).
dp
(
2
).
toNumber
()
})
},
handleDelete
(
index
)
{
if
(
this
.
configForm
.
awardList
.
length
==
1
)
return
this
.
configForm
.
awardList
.
splice
(
index
,
1
)
},
addLine
()
{
this
.
configForm
.
awardList
.
push
({
type
:
''
,
name
:
''
,
amount
:
''
,
total
:
''
,
probability
:
''
,
picture
:
''
,
couponId
:
''
})
}
}
}
</
script
>
<
style
scoped
lang=
'scss'
>
.add-wrap
{
padding-top
:
16px
;
}
.header
{
display
:
flex
;
justify-content
:
center
;
.step
{
width
:
30%
;
display
:
flex
;
align-items
:
center
;
//
min-width
:
;
.horizontalLine
{
height
:
1px
;
//
width
:
30%
;
background
:
#c6c6c6
;
margin
:
0
15px
;
flex-basis
:
30%
;
}
.baseinfo
{
flex-basis
:
20%
;
//
display
:
flex
;
line-height
:
32px
;
white-space
:
nowrap
;
.text
{
margin-left
:
8px
;
font-size
:
16px
;
color
:
rgba
(
0
,
0
,
0
,
0.85
);
white-space
:
nowrap
;
}
.circular
{
width
:
32px
;
height
:
32px
;
border-radius
:
50%
;
border
:
1px
solid
#c6c6c6
;
color
:
#c6c6c6
;
text-align
:
center
;
line-height
:
32px
;
display
:
inline-block
;
}
.circularAct
{
background
:
#5850ff
;
border
:
none
;
color
:
#ffffff
;
}
.circularTick
{
border
:
1px
solid
#5850ff
;
color
:
#5850ff
;
}
}
}
}
.container
{
padding
:
32px
20px
;
background
:
#ffffff
;
border-radius
:
0
4px
4px
4px
;
margin
:
16px
;
}
.activity-link
{
display
:
flex
;
width
:
500px
;
.upload-btn
{
position
:
relative
;
width
:
110px
;
height
:
32px
;
.el-button--small
{
width
:
100%
;
height
:
100%
;
}
input
{
cursor
:
pointer
;
position
:
absolute
;
height
:
100%
;
width
:
100%
;
top
:
0px
;
left
:
0px
;
font-size
:
0px
;
}
}
a
,
.error
{
margin-left
:
8px
;
color
:
#5850ff
;
font-size
:
14px
;
cursor
:
pointer
;
}
.file-info
{
margin-left
:
8px
;
.el-icon-success
{
margin-left
:
8px
;
color
:
#67c23a
;
}
.el-icon-error
{
margin-left
:
8px
;
color
:
red
;
}
}
}
.nothing
{
font-size
:
14px
;
padding
:
0
20px
;
white-space
:
nowrap
;
color
:
#606266
;
height
:
34px
;
line-height
:
34px
;
text-align
:
center
;
}
.award-wrap
{
/deep/.el-form-item__content
{
width
:
auto
;
}
/
deep
/
.el-form
.el-input
{
width
:
100%
;
}
}
.upload-img
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
background
:
rgba
(
0
,
0
,
0
,
0.04
);
border
:
1px
dashed
rgba
(
0
,
0
,
0
,
0.15
);
border-radius
:
4px
;
width
:
36px
;
height
:
36px
;
input
{
position
:
absolute
;
width
:
36px
;
height
:
36px
;
z-index
:
999
;
}
}
.avatar
{
width
:
36px
;
height
:
36px
;
position
:
absolute
;
z-index
:
99
;
opacity
:
0.4
;
}
.select-upload-img
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
position
:
absolute
;
width
:
36px
;
height
:
36px
;
background
:
#00000080
;
.icon-edit
{
width
:
16px
;
height
:
16px
;
}
}
.add-line
{
display
:
flex
;
align-items
:
center
;
font-size
:
12px
;
color
:
#5850ff
;
margin-left
:
154px
;
width
:
76px
;
i
{
font-size
:
20px
;
margin-right
:
6px
;
}
}
.paying
{
min-width
:
924px
;
height
:
58px
;
background
:
#f9f9f9
;
line-height
:
58px
;
font-size
:
14px
;
color
:
#333333
;
margin
:
10px
0
0
154px
;
padding
:
0
16px
;
box-sizing
:
border-box
;
.num
{
color
:
#eb4e4e
;
}
.btn
{
padding
:
0
8px
;
line-height
:
26px
;
border
:
1px
solid
#5850ff
;
border-radius
:
4px
;
color
:
#5850ff
;
margin-left
:
8px
;
}
}
.limit-container
{
margin-left
:
154px
;
display
:
flex
;
font-size
:
14px
;
color
:
#333333
;
align-items
:
center
;
white-space
:
nowrap
;
.el-input
{
width
:
284px
!important
;
height
:
32px
;
margin-left
:
4px
;
/deep/
.el-input__inner
{
height
:
32px
;
}
}
.el-input-number
{
margin
:
0
4px
;
}
.limit-msg
{
/deep/
.el-form-item__content
{
margin-left
:
0
!important
;
}
}
}
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/redEnvelope/components/RedEnvelopeConfig/OffAdd.vue
0 → 100644
View file @
5e5ca3c
<
template
>
<div
class=
"add-wrap"
>
<div
class=
"container gl-form-page"
>
<el-form
ref=
"configRef"
label-width=
"154px"
:rules=
"configRules"
:model=
"configForm"
>
<el-form-item
label=
"活动名称:"
prop=
"activityName"
class=
"m-t-20"
>
<el-input
:size=
"size"
v-model=
"configForm.activityName"
placeholder=
"请输入"
maxlength=
"25"
:disabled=
"disabled"
></el-input>
</el-form-item>
<el-form-item
label=
"所属渠道:"
prop=
"merchantId"
class=
"m-t-20"
>
<el-select
:size=
"size"
v-model=
"configForm.merchantId"
placeholder=
"请选择"
:disabled=
"disabled"
filterable
remote
:remote-method=
"remoteMethod"
v-reachbottom=
"onReachBottom"
@
focus=
"selectFocus"
:loading=
"loading"
>
<el-option
v-for=
"item in merchantObj.data"
:key=
"item.confId"
:label=
"item.confName"
:value=
"item.confId"
></el-option>
<template
v-if=
"merchantObj.nothing"
>
<div
class=
"nothing"
>
到底了!
</div>
</
template
>
</el-select>
</el-form-item>
<el-form-item
label=
"活动时间:"
prop=
"activityTime"
class=
"m-t-20"
>
<el-date-picker
:size=
"size"
v-model=
"configForm.activityTime"
type=
"daterange"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
:picker-options=
"afterRangePickerOptions"
></el-date-picker>
</el-form-item>
<el-form-item
label=
"活动形式:"
prop=
"activityType"
class=
"m-t-20"
>
<el-radio-group
:size=
"size"
v-model=
"configForm.activityType"
style=
"width: 400px"
:disabled=
"disabled"
>
<el-radio
:label=
"0"
>
随机红包
</el-radio>
<el-radio
:label=
"1"
>
九宫格
</el-radio>
<el-radio
:label=
"2"
>
翻牌
</el-radio>
<el-radio
:label=
"3"
>
大转盘
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"导入链接:"
prop=
"exportUrl"
class=
"m-t-20"
>
<div
class=
"activity-link"
>
<div
class=
"upload-btn"
>
<el-button
size=
"small"
>
<i
class=
"el-icon-plus"
></i>
上传文件
</el-button>
<input
type=
"file"
style=
"opacity: 0"
ref=
"file"
accept=
"*"
@
change=
"uploadFile"
/>
</div>
<a
href=
"https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/红包链接.xlsx"
target=
"_blank"
>
下载导入模板
</a>
<
template
v-if=
"configForm.exportUrl"
>
<div
class=
"file-info flex"
>
{{
fileName
}}
<div
class=
"el-icon-success"
></div>
</div>
</
template
>
<
template
v-if=
"fileError"
>
<div
class=
"file-info flex error"
>
<a
:href=
"fileError"
target=
"_blank"
>
下载失败列表
</a>
<div
class=
"el-icon-error"
></div>
</div>
</
template
>
</div>
</el-form-item>
</el-form>
</div>
<GLFooter>
<el-button
@
click=
"handleClose"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handleConfirm"
>
提交
</el-button>
</GLFooter>
</div>
</template>
<
script
type=
'text/ecmascript-6'
>
export
const
afterRangePickerOptions
=
{
disabledDate
(
date
)
{
const
yesterday
=
new
Date
(
new
Date
().
setDate
(
new
Date
().
getDate
()
-
1
))
if
(
date
<
yesterday
)
{
return
true
}
return
false
}
}
import
commonFun
from
'../common/fun.js'
import
*
as
dayjs
from
'dayjs'
import
{
getMerchantListMixin
}
from
'@/mixins'
export
default
{
mixins
:
[
getMerchantListMixin
],
name
:
''
,
props
:
{
editObj
:
{
type
:
Object
,
default
:
()
=>
{}
}
},
data
()
{
return
{
id
:
this
.
$route
.
query
.
id
,
afterRangePickerOptions
,
disabled
:
false
,
configForm
:
{
activityName
:
''
,
merchantId
:
''
,
activityTime
:
''
,
activityType
:
0
,
exportUrl
:
''
},
configRules
:
{
activityName
:
[
{
required
:
true
,
message
:
'请输入活动名称'
,
trigger
:
'blur'
}
],
merchantId
:
[
{
required
:
true
,
message
:
'请选择所属渠道'
,
trigger
:
'blur'
}
],
activityTime
:
[
{
required
:
true
,
message
:
'请输入活动时间'
,
trigger
:
'blur'
}
],
activityType
:
[
{
required
:
true
}
],
exportUrl
:
[
{
required
:
true
,
message
:
'请导入链接'
}
]
},
fileName
:
''
,
fileError
:
''
}
},
created
()
{
if
(
this
.
id
)
this
.
getRedEnvelopeActivityDetail
()
},
methods
:
{
async
getRedEnvelopeActivityDetail
()
{
let
{
id
}
=
this
try
{
const
{
configForm
}
=
this
,
res
=
await
this
.
$apis
.
redenvelope
.
getRedEnvelopeActivityDetail
({
id
}),
merchantId
=
String
(
res
.
merchantId
)
this
.
configForm
=
{
...
configForm
,
activityName
:
res
.
activityName
,
activityType
:
res
.
activityType
,
merchantId
,
activityTime
:
[
dayjs
(
res
.
activityStartTime
).
toDate
(),
dayjs
(
res
.
activityEndTime
).
toDate
()],
id
}
this
.
merchantObj
.
data
=
[
{
confId
:
merchantId
,
confName
:
res
.
merchantName
}
]
this
.
disabled
=
true
this
.
configRules
.
exportUrl
[
0
].
required
=
false
}
catch
(
error
)
{
this
.
$message
.
error
(
error
)
}
},
handleClose
()
{
// this.configForm = this.$options.data.call(this).configForm
// this.disabled = false
// this.fileError = ''
// this.$refs.configRef.resetFields()
// this.merchantObj.data = []
// this.$emit('update:editObj', {})
this
.
$router
.
push
(
'/redEnvelope/index'
)
},
handleConfirm
()
{
this
.
$refs
.
configRef
.
validate
(
async
valid
=>
{
if
(
valid
)
{
try
{
const
{
configForm
,
merchantObj
}
=
this
let
params
=
this
.
$common
.
utils
.
deepClone
(
configForm
),
targetName
=
params
.
id
?
'updateActivityRedEnvelope'
:
'createActivityRedEnvelope'
params
.
sourceType
=
1
params
.
activityStartTime
=
dayjs
(
params
.
activityTime
[
0
]).
format
(
'YYYY-MM-DD'
)
params
.
activityEndTime
=
dayjs
(
params
.
activityTime
[
1
]).
format
(
'YYYY-MM-DD'
)
params
.
merchantName
=
merchantObj
.
data
.
find
(
e
=>
e
.
confId
==
params
.
merchantId
).
confName
delete
params
.
activityTime
console
.
log
(
JSON
.
parse
(
JSON
.
stringify
(
params
)))
const
res
=
await
this
.
$apis
.
redenvelope
[
targetName
](
params
)
if
(
res
)
{
this
.
$message
({
message
:
params
.
id
?
'编辑成功'
:
'创建成功'
,
type
:
'success'
})
this
.
handleClose
()
}
else
throw
params
.
id
?
'编辑失败'
:
'创建失败'
}
catch
(
error
)
{
this
.
$message
.
error
(
error
)
}
}
})
},
async
uploadFile
(
e
)
{
const
{
id
}
=
this
.
configForm
,
target
=
id
?
'updateCheckFile'
:
'createCheckFile'
try
{
const
{
url
,
name
}
=
await
commonFun
.
uploadFile
(
e
,
this
),
params
=
{
exportUrl
:
url
}
if
(
id
)
params
.
id
=
id
this
.
$refs
.
file
.
value
=
''
const
res
=
await
this
.
$apis
.
redenvelope
[
target
](
params
)
if
(
res
)
{
if
(
res
.
totalCount
==
0
||
res
.
failCount
>
0
)
{
this
.
fileError
=
res
.
errorUrl
this
.
$message
.
error
(
'红包链接导入失败'
)
this
.
configForm
.
exportUrl
=
''
return
}
this
.
$message
({
message
:
'导入成功'
,
type
:
'success'
})
this
.
fileError
=
''
this
.
configForm
.
exportUrl
=
url
this
.
fileName
=
name
}
}
catch
(
error
)
{
console
.
log
(
error
)
if
(
error
)
this
.
$message
.
error
(
error
)
this
.
$refs
.
file
.
value
=
''
}
}
}
}
</
script
>
<
style
scoped
lang=
'scss'
>
.container
{
padding
:
32px
20px
;
background
:
#ffffff
;
border-radius
:
0
4px
4px
4px
;
margin
:
16px
;
}
.activity-link
{
display
:
flex
;
width
:
500px
;
.upload-btn
{
position
:
relative
;
width
:
110px
;
height
:
32px
;
.el-button--small
{
width
:
100%
;
height
:
100%
;
}
input
{
cursor
:
pointer
;
position
:
absolute
;
height
:
100%
;
width
:
100%
;
top
:
0px
;
left
:
0px
;
font-size
:
0px
;
}
}
a
,
.error
{
margin-left
:
8px
;
color
:
#5850ff
;
font-size
:
14px
;
cursor
:
pointer
;
}
.file-info
{
margin-left
:
8px
;
.el-icon-success
{
margin-left
:
8px
;
color
:
#67c23a
;
}
.el-icon-error
{
margin-left
:
8px
;
color
:
red
;
}
}
}
.nothing
{
font-size
:
14px
;
padding
:
0
20px
;
white-space
:
nowrap
;
color
:
#606266
;
height
:
34px
;
line-height
:
34px
;
text-align
:
center
;
}
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/redEnvelope/components/RedEnvelopeConfig/add.vue
0 → 100644
View file @
5e5ca3c
<
template
>
<div>
<div
class=
"tabs"
>
<GLTabs
v-model=
"currentComponent"
:tabPaneList=
"tabPaneList"
@
tab-click=
"handleClick"
></GLTabs>
<component
:is=
"currentComponent"
ref=
"componentRef"
></component>
</div>
</div>
</
template
>
<
script
>
export
default
{
components
:
{
FreeInnovate
:
()
=>
import
(
'./FreeAdd.vue'
),
OffshoreProcurement
:
()
=>
import
(
'./OffAdd.vue'
)
},
data
()
{
return
{
currentComponent
:
''
,
sourceType
:
this
.
$route
.
query
.
sourceType
,
tabPaneList
:
[
{
label
:
'自研红包'
,
name
:
'FreeInnovate'
},
{
label
:
'外采红包'
,
name
:
'OffshoreProcurement'
}
]
}
},
created
()
{
this
.
currentComponent
=
this
.
sourceType
==
1
?
'OffshoreProcurement'
:
'FreeInnovate'
},
methods
:
{
handleClick
()
{}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/redEnvelope/components/RedEnvelopeConfig/index.vue
View file @
5e5ca3c
<
template
>
<
template
>
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"sticky"
>
<div
class=
"sticky"
>
<GLCombiForm
<GLCombiForm
ref=
"showSearch"
:rowNumber=
"1"
:formObj=
"searchForm"
:formData=
"searchFormData"
@
handleOk=
"handleSearch"
@
handleRest=
"handleReset"
></GLCombiForm>
ref=
"showSearch"
:rowNumber=
"1"
:formObj=
"searchForm"
:formData=
"searchFormData"
@
handleOk=
"handleSearch"
@
handleRest=
"handleReset"
></GLCombiForm>
<div
class=
"sticky-btns"
>
<div
class=
"sticky-btns"
>
<div
class=
"btns"
>
<div
class=
"btns"
>
<el-button
<el-button
type=
"default"
plain
@
click=
"showEditFun"
>
新建
</el-button>
type=
"default"
<el-button
type=
"default"
@
click=
"handleExport"
>
导出
</el-button>
plain
@
click=
"showEditFun"
>
新建
</el-button>
<el-button
type=
"default"
@
click=
"handleExport"
>
导出
</el-button>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"tabelList"
>
<div
class=
"tabelList"
>
<div
class=
"table-title"
>
红包配置列表
</div>
<div
class=
"table-title"
>
红包配置列表
</div>
<GLTable
<GLTable
ref=
"listRef"
:getListApi=
"getListApi"
:searchForm=
"tableSearchForm"
:noDataImg=
"url"
:tableParams=
"tableParams"
:pageConf=
"pageConf"
>
ref=
"listRef"
<span
slot=
"auth-button"
slot-scope=
"scope"
>
:getListApi=
"getListApi"
<GLTableButton
:buttonList=
"tableButtonList"
:buttonItem=
"scope.scope"
:buttonNum=
"3"
></GLTableButton>
:searchForm=
"tableSearchForm"
:noDataImg=
"url"
:tableParams=
"tableParams"
:pageConf=
"pageConf"
>
<span
slot=
"auth-button"
slot-scope=
"scope"
>
<GLTableButton
:buttonList=
"tableButtonList"
:buttonItem=
"scope.scope"
:buttonNum=
"3"
></GLTableButton>
</span>
</span>
</GLTable>
</GLTable>
</div>
</div>
...
@@ -50,7 +22,6 @@
...
@@ -50,7 +22,6 @@
<transition
name=
"fade"
>
<transition
name=
"fade"
>
<whiteList
v-if=
"whiteListObj.show"
:whiteListObj
.
sync=
"whiteListObj"
:key=
"whiteListKey"
></whiteList>
<whiteList
v-if=
"whiteListObj.show"
:whiteListObj
.
sync=
"whiteListObj"
:key=
"whiteListKey"
></whiteList>
</transition>
</transition>
</div>
</div>
</
template
>
</
template
>
...
@@ -60,12 +31,12 @@ import * as dayjs from 'dayjs'
...
@@ -60,12 +31,12 @@ import * as dayjs from 'dayjs'
import
linkDetail
from
'./linkDetail.vue'
import
linkDetail
from
'./linkDetail.vue'
import
edit
from
'./edit.vue'
import
edit
from
'./edit.vue'
import
whiteList
from
'./whiteList'
import
whiteList
from
'./whiteList'
import
{
exportFn
,
activityStatusList
}
from
'@/common/constant'
import
{
exportFn
,
activityStatusList
}
from
'@/common/constant'
export
default
{
export
default
{
components
:
{
linkDetail
,
edit
,
whiteList
},
components
:
{
linkDetail
,
edit
,
whiteList
},
name
:
'RedEnvelopeConfig'
,
name
:
'RedEnvelopeConfig'
,
data
()
{
data
()
{
return
{
return
{
url
,
url
,
whiteListKey
:
0
,
whiteListKey
:
0
,
...
@@ -110,11 +81,11 @@ export default {
...
@@ -110,11 +81,11 @@ export default {
optionList
:
[
optionList
:
[
{
text
:
'全部'
,
id
:
''
},
{
text
:
'全部'
,
id
:
''
},
{
text
:
'外采'
,
id
:
'1'
},
{
text
:
'外采'
,
id
:
'1'
},
{
text
:
'自研'
,
id
:
'0'
}
,
{
text
:
'自研'
,
id
:
'0'
}
],
],
optionId
:
'id'
,
optionId
:
'id'
,
optionLabel
:
'text'
optionLabel
:
'text'
}
,
}
],
],
getListApi
:
this
.
$apis
.
redenvelope
.
getRedEnvelopeConfigList
,
getListApi
:
this
.
$apis
.
redenvelope
.
getRedEnvelopeConfigList
,
tableParams
:
{
tableParams
:
{
...
@@ -136,14 +107,14 @@ export default {
...
@@ -136,14 +107,14 @@ export default {
prop
:
'questionCount'
,
prop
:
'questionCount'
,
minWidth
:
100
,
minWidth
:
100
,
formatter
:
cell
=>
{
formatter
:
cell
=>
{
return
cell
.
activityStartTime
?
`
${
dayjs
(
cell
.
activityStartTime
).
format
(
'YYYY/MM/DD'
)}
-
${
dayjs
(
cell
.
activityEndTime
).
format
(
'YYYY/MM/DD'
)}
`
:
''
return
cell
.
activityStartTime
?
`
${
dayjs
(
cell
.
activityStartTime
).
format
(
'YYYY/MM/DD'
)}
-
${
dayjs
(
cell
.
activityEndTime
).
format
(
'YYYY/MM/DD'
)}
`
:
''
}
}
},
},
{
{
label
:
'创建类型'
,
label
:
'创建类型'
,
minWidth
:
100
,
minWidth
:
100
,
formatter
:
cell
=>
{
formatter
:
cell
=>
{
return
{
'0'
:
'自研'
,
'1'
:
'外采'
}[
cell
.
createdSource
]
return
{
0
:
'自研'
,
1
:
'外采'
}[
cell
.
createdSource
]
}
}
},
},
{
{
...
@@ -155,13 +126,11 @@ export default {
...
@@ -155,13 +126,11 @@ export default {
label
:
'红包链接总数'
,
label
:
'红包链接总数'
,
prop
:
'amount'
,
prop
:
'amount'
,
minWidth
:
150
minWidth
:
150
},
},
{
{
label
:
'已用总数'
,
label
:
'已用总数'
,
prop
:
'usedAmount'
,
prop
:
'usedAmount'
,
minWidth
:
100
minWidth
:
100
},
},
{
{
label
:
'可用总数'
,
label
:
'可用总数'
,
...
@@ -172,7 +141,7 @@ export default {
...
@@ -172,7 +141,7 @@ export default {
label
:
'状态'
,
label
:
'状态'
,
prop
:
'activityStatusStr'
,
prop
:
'activityStatusStr'
,
minWidth
:
100
minWidth
:
100
}
,
}
]
]
},
},
// 表格按钮
// 表格按钮
...
@@ -181,7 +150,7 @@ export default {
...
@@ -181,7 +150,7 @@ export default {
type
:
'el-button'
,
type
:
'el-button'
,
name
:
'编辑'
,
name
:
'编辑'
,
attrs
:
{
attrs
:
{
type
:
'text'
,
type
:
'text'
},
},
listeners
:
{
listeners
:
{
click
:
row
=>
this
.
showEditFun
(
row
)
click
:
row
=>
this
.
showEditFun
(
row
)
...
@@ -191,7 +160,7 @@ export default {
...
@@ -191,7 +160,7 @@ export default {
type
:
'el-button'
,
type
:
'el-button'
,
name
:
'链接详情'
,
name
:
'链接详情'
,
attrs
:
{
attrs
:
{
type
:
'text'
,
type
:
'text'
},
},
listeners
:
{
listeners
:
{
click
:
row
=>
this
.
jumpDetail
(
row
)
click
:
row
=>
this
.
jumpDetail
(
row
)
...
@@ -201,7 +170,7 @@ export default {
...
@@ -201,7 +170,7 @@ export default {
type
:
'el-button'
,
type
:
'el-button'
,
name
:
'白名单'
,
name
:
'白名单'
,
attrs
:
{
attrs
:
{
type
:
'text'
,
type
:
'text'
},
},
listeners
:
{
listeners
:
{
click
:
row
=>
this
.
whiteList
(
row
)
click
:
row
=>
this
.
whiteList
(
row
)
...
@@ -214,11 +183,9 @@ export default {
...
@@ -214,11 +183,9 @@ export default {
tableSearchForm
:
{}
tableSearchForm
:
{}
}
}
},
},
mounted
()
{
mounted
()
{},
},
methods
:
{
methods
:
{
getParams
()
{
getParams
()
{
const
searchForm
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
searchForm
))
const
searchForm
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
searchForm
))
if
(
searchForm
.
activityTime
)
{
if
(
searchForm
.
activityTime
)
{
searchForm
.
activityStartTime
=
dayjs
(
this
.
searchForm
.
activityTime
[
0
]).
format
(
'YYYY-MM-DD'
)
searchForm
.
activityStartTime
=
dayjs
(
this
.
searchForm
.
activityTime
[
0
]).
format
(
'YYYY-MM-DD'
)
...
@@ -227,50 +194,60 @@ export default {
...
@@ -227,50 +194,60 @@ export default {
delete
searchForm
.
activityTime
delete
searchForm
.
activityTime
return
searchForm
return
searchForm
},
},
handleSearch
()
{
handleSearch
()
{
this
.
tableSearchForm
=
this
.
getParams
()
this
.
tableSearchForm
=
this
.
getParams
()
this
.
$refs
.
listRef
.
refreshTable
()
this
.
$refs
.
listRef
.
refreshTable
()
},
},
handleReset
()
{
handleReset
()
{
this
.
searchForm
=
this
.
$options
.
data
.
call
(
this
).
searchForm
this
.
searchForm
=
this
.
$options
.
data
.
call
(
this
).
searchForm
this
.
handleSearch
()
this
.
handleSearch
()
},
},
jumpDetail
(
e
)
{
jumpDetail
(
e
)
{
this
.
linkDetailObj
=
{
this
.
linkDetailObj
=
{
show
:
true
,
show
:
true
,
id
:
e
.
id
id
:
e
.
id
}
}
},
},
whiteList
(
e
)
{
whiteList
(
e
)
{
this
.
whiteListKey
++
;
// 更改key值,强制Vue重新渲染whiteList组件
this
.
whiteListKey
++
// 更改key值,强制Vue重新渲染whiteList组件
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
whiteListObj
=
{
this
.
whiteListObj
=
{
show
:
true
,
show
:
true
,
id
:
e
.
id
id
:
e
.
id
}
;
}
}
,
);
// 延迟100毫秒,您可以根据需要调整这个值
}
)
// 延迟100毫秒,您可以根据需要调整这个值
},
},
showEditFun
(
e
)
{
showEditFun
(
e
)
{
this
.
editObj
=
{
// this.editObj = {
show
:
true
,
// show: true,
title
:
e
.
id
?
'编辑'
:
'新建'
,
// title: e.id ? '编辑' : '新建',
id
:
e
.
id
||
''
// id: e.id || ''
// }
this
.
$router
.
push
({
path
:
`/redEnvelope/components/RedEnvelopeConfig/add`
,
query
:{
id
:
e
.
id
,
sourceType
:
e
.
sourceType
}
}
})
},
},
handleExport
()
{
handleExport
()
{
this
.
$apis
.
redenvelope
.
exportActivityRedEnvelope
({
this
.
$apis
.
redenvelope
.
exportActivityRedEnvelope
({
...
this
.
getParams
(),
...
this
.
getParams
(),
...
this
.
$refs
.
listRef
.
page
...
this
.
$refs
.
listRef
.
page
}).
then
(
res
=>
{
})
.
then
(
res
=>
{
exportFn
(
res
)
exportFn
(
res
)
})
})
}
,
}
}
}
}
}
</
script
>
</
script
>
<
style
scoped
lang=
'scss'
>
<
style
scoped
lang=
'scss'
>
.fade-enter-active
,
.fade-leave-active
{
.fade-enter-active
,
.fade-leave-active
{
transition
:
opacity
0.1s
;
transition
:
opacity
0.1s
;
}
}
.fade-enter
,
.fade-leave-to
/* .fade-leave-active in <2.1.8 */
{
.fade-enter
,
.fade-leave-to
/* .fade-leave-active in <2.1.8 */
{
...
...
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