Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quantum-blocks
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
quantum-blocks
Commits
ce9d8020
Commit
ce9d8020
authored
May 04, 2023
by
徐光星
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 校验抢购活动和秒杀活动同渠道下多个活动ID的情况
parent
1b34c413
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
4 deletions
+68
-4
index.vue
...component/DynamicForm/component/SeckillSelector/index.vue
+34
-2
index.vue
...nt/DynamicForm/component/SnapUpActivitySelector/index.vue
+34
-2
No files found.
app/web/page/editor/component/DynamicForm/component/SeckillSelector/index.vue
View file @
ce9d8020
<
template
>
<div
class=
"seckillActivityContainer"
>
<Button
style=
"margin-bottom: 4px"
@
click=
"showRules"
>
规则说明
</Button>
<Button
style=
"margin-bottom: 4px"
@
click=
"showRules"
size=
"small"
>
规则说明
</Button>
<div>
<Button
style=
"margin-bottom: 4px"
type=
"primary"
@
click=
"openDialog"
>
填写活动ID
</Button>
</div>
...
...
@@ -72,15 +72,47 @@ export default {
console
.
log
(
'
get activity base info =
'
,
res
)
if
(
res
)
{
// 判断活动类型是否符合当前组件
const
invalidArr
=
res
.
filter
(
item
=>
!
item
.
activityTemplateType
||
(
item
.
activityTemplateType
&&
item
.
activityTemplateType
!=
1
)
)
if
(
invalidArr
.
length
)
{
let
ids
=
''
;
invalidArr
.
map
(
item
=>
{
ids
+=
`
${
item
.
id
}
,`
})
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
`以下活动id不符合当前活动
组件
:
${
ids
}
`
});
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
`以下活动id不符合当前活动
类型
:
${
ids
}
`
});
return
;
}
// 判断填入的活动ID是否存在重复的渠道ID的情况
const
normalKey
=
'
common
'
;
const
validArr
=
res
.
filter
(
item
=>
item
.
activityTemplateType
&&
item
.
activityTemplateType
==
1
);
const
channel2Id
=
{};
validArr
.
map
(
item
=>
{
if
(
item
.
kaChannelNo
)
{
if
(
channel2Id
[
item
.
kaChannelNo
])
{
const
arr
=
channel2Id
[
item
.
kaChannelNo
];
arr
.
push
(
item
.
id
);
channel2Id
[
item
.
kaChannelNo
]
=
arr
;
}
else
{
channel2Id
[
item
.
kaChannelNo
]
=
[
item
.
id
]
}
}
else
{
if
(
channel2Id
[
normalKey
])
{
const
arr
=
channel2Id
[
normalKey
];
arr
.
push
(
item
.
id
);
channel2Id
[
normalKey
]
=
channel2Id
[
normalKey
].
push
(
item
.
id
);
}
else
{
channel2Id
[
normalKey
]
=
[
item
.
id
]
}
}
return
item
;
})
console
.
log
(
channel2Id
,
'
channel2Id
'
)
for
(
let
i
in
channel2Id
)
{
if
(
channel2Id
[
i
].
length
>
1
)
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
`
${
i
==
'
common
'
?
'
通用渠道
'
:
'
渠道
'
+
i
}
存在重复的活动ID:
${
channel2Id
[
i
].
join
(
'
,
'
)}
`
});
return
;
}
}
}
this
.
showModal
=
false
;
this
.
activityInfoId
=
this
.
cacheId
;
...
...
app/web/page/editor/component/DynamicForm/component/SnapUpActivitySelector/index.vue
View file @
ce9d8020
...
...
@@ -3,7 +3,7 @@
<!--
<Select
v-model=
"activityInfoId"
filterable
>
<Option
v-for=
"item in list"
:value=
"item.id"
:key=
"item.id"
>
{{
`id ${item.id
}
- ${item.title
}
`
}}
<
/Option
>
<
/Select> --
>
<
Button
style
=
"
margin-bottom: 4px
"
@
click
=
"
showRules
"
>
规则说明
<
/Button
>
<
Button
style
=
"
margin-bottom: 4px
"
@
click
=
"
showRules
"
size
=
"
small
"
>
规则说明
<
/Button
>
<
div
>
<
Button
style
=
"
margin-bottom: 4px
"
type
=
"
primary
"
@
click
=
"
openDialog
"
>
填写活动
ID
<
/Button
>
<
/div
>
...
...
@@ -73,15 +73,47 @@ export default {
console
.
log
(
'
get activity base info =
'
,
res
)
if
(
res
)
{
// 判断活动类型是否符合当前组件
const
invalidArr
=
res
.
filter
(
item
=>
!
item
.
activityTemplateType
||
(
item
.
activityTemplateType
&&
item
.
activityTemplateType
!=
11
)
)
if
(
invalidArr
.
length
)
{
let
ids
=
''
;
invalidArr
.
map
(
item
=>
{
ids
+=
`${item.id
}
,`
}
)
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
`以下活动id不符合当前活动
组件
: ${ids
}
`
}
);
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
`以下活动id不符合当前活动
类型
: ${ids
}
`
}
);
return
;
}
// 判断填入的活动ID是否存在重复的渠道ID的情况
const
normalKey
=
'
common
'
;
const
validArr
=
res
.
filter
(
item
=>
item
.
activityTemplateType
&&
item
.
activityTemplateType
==
1
);
const
channel2Id
=
{
}
;
validArr
.
map
(
item
=>
{
if
(
item
.
kaChannelNo
)
{
if
(
channel2Id
[
item
.
kaChannelNo
])
{
const
arr
=
channel2Id
[
item
.
kaChannelNo
];
arr
.
push
(
item
.
id
);
channel2Id
[
item
.
kaChannelNo
]
=
arr
;
}
else
{
channel2Id
[
item
.
kaChannelNo
]
=
[
item
.
id
]
}
}
else
{
if
(
channel2Id
[
normalKey
])
{
const
arr
=
channel2Id
[
normalKey
];
arr
.
push
(
item
.
id
);
channel2Id
[
normalKey
]
=
channel2Id
[
normalKey
].
push
(
item
.
id
);
}
else
{
channel2Id
[
normalKey
]
=
[
item
.
id
]
}
}
return
item
;
}
)
console
.
log
(
channel2Id
,
'
channel2Id
'
)
for
(
let
i
in
channel2Id
)
{
if
(
channel2Id
[
i
].
length
>
1
)
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
`${i == 'common' ? '通用渠道' : '渠道' + i
}
存在重复的活动ID: ${channel2Id[i].join(',')
}
`
}
);
return
;
}
}
}
this
.
showModal
=
false
;
this
.
activityInfoId
=
this
.
cacheId
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment