Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7d60b5a6
authored
Sep 06, 2024
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【代码优化】商城:拼团装修重构
parent
a2091df2
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
28 deletions
+11
-28
src/api/mall/promotion/combination/combinationActivity.ts
+3
-6
src/components/DiyEditor/components/mobile/PromotionCombination/index.vue
+4
-14
src/components/DiyEditor/components/mobile/PromotionCombination/property.vue
+0
-1
src/components/DiyEditor/index.vue
+1
-6
src/views/mall/product/spu/components/SpuShowcase.vue
+2
-0
src/views/mall/promotion/combination/components/CombinationShowcase.vue
+1
-1
No files found.
src/api/mall/promotion/combination/combinationActivity.ts
View file @
7d60b5a6
...
@@ -17,9 +17,6 @@ export interface CombinationActivityVO {
...
@@ -17,9 +17,6 @@ export interface CombinationActivityVO {
status
?:
number
status
?:
number
limitDuration
?:
number
limitDuration
?:
number
products
:
CombinationProductVO
[]
products
:
CombinationProductVO
[]
spuName
?:
string
picUrl
?:
string
marketPrice
?:
number
}
}
// 拼团活动所需属性
// 拼团活动所需属性
...
@@ -39,7 +36,7 @@ export interface SpuExtension extends Spu {
...
@@ -39,7 +36,7 @@ export interface SpuExtension extends Spu {
}
}
// 查询拼团活动列表
// 查询拼团活动列表
export
const
getCombinationActivityPage
=
async
(
params
)
=>
{
export
const
getCombinationActivityPage
=
async
(
params
:
any
)
=>
{
return
await
request
.
get
({
url
:
'/promotion/combination-activity/page'
,
params
})
return
await
request
.
get
({
url
:
'/promotion/combination-activity/page'
,
params
})
}
}
...
@@ -48,8 +45,8 @@ export const getCombinationActivity = async (id: number) => {
...
@@ -48,8 +45,8 @@ export const getCombinationActivity = async (id: number) => {
return
await
request
.
get
({
url
:
'/promotion/combination-activity/get?id='
+
id
})
return
await
request
.
get
({
url
:
'/promotion/combination-activity/get?id='
+
id
})
}
}
//
查询拼团活动详情列表
//
获得拼团活动列表,基于活动编号数组
export
const
getCombinationActivity
DetailList
=
(
ids
:
number
[])
=>
{
export
const
getCombinationActivity
ListByIds
=
(
ids
:
number
[])
=>
{
return
request
.
get
({
url
:
`/promotion/combination-activity/list-by-ids?ids=
${
ids
}
`
})
return
request
.
get
({
url
:
`/promotion/combination-activity/list-by-ids?ids=
${
ids
}
`
})
}
}
...
...
src/components/DiyEditor/components/mobile/PromotionCombination/index.vue
View file @
7d60b5a6
...
@@ -136,30 +136,20 @@ watch(
...
@@ -136,30 +136,20 @@ watch(
// 新添加的拼团组件,是没有活动ID的
// 新添加的拼团组件,是没有活动ID的
const
activityIds
=
props
.
property
.
activityIds
const
activityIds
=
props
.
property
.
activityIds
// 检查活动ID的有效性
// 检查活动ID的有效性
if
(
if
(
Array
.
isArray
(
activityIds
)
&&
activityIds
.
length
>
0
)
{
Array
.
isArray
(
activityIds
)
&&
activityIds
.
length
>
0
&&
activityIds
.
every
((
item
)
=>
item
!=
null
)
)
{
// 获取拼团活动详情列表
// 获取拼团活动详情列表
combinationActivityList
.
value
=
combinationActivityList
.
value
=
await
CombinationActivityApi
.
getCombinationActivity
DetailList
(
activityIds
)
await
CombinationActivityApi
.
getCombinationActivity
ListByIds
(
activityIds
)
// 清空之前的数据,防止有重复
// 获取拼团活动的 SPU 详情列表
spuIdList
.
value
=
[]
spuList
.
value
=
[]
spuList
.
value
=
[]
// 生成有效的 spuId 列表
spuIdList
.
value
=
combinationActivityList
.
value
spuIdList
.
value
=
combinationActivityList
.
value
.
map
((
activity
)
=>
activity
.
spuId
)
.
map
((
activity
)
=>
activity
.
spuId
)
.
filter
((
spuId
):
spuId
is
number
=>
typeof
spuId
===
'number'
)
.
filter
((
spuId
):
spuId
is
number
=>
typeof
spuId
===
'number'
)
// 如果存在有效的 spuId,调用 API 获取详细信息
if
(
spuIdList
.
value
.
length
>
0
)
{
if
(
spuIdList
.
value
.
length
>
0
)
{
spuList
.
value
=
await
ProductSpuApi
.
getSpuDetailList
(
spuIdList
.
value
)
spuList
.
value
=
await
ProductSpuApi
.
getSpuDetailList
(
spuIdList
.
value
)
}
else
{
console
.
warn
(
'没有用于获取详细信息的有效 spuId。'
)
}
}
// 更新 SPU 的最低价格
// 更新 SPU 的最低价格
combinationActivityList
.
value
.
forEach
((
activity
)
=>
{
combinationActivityList
.
value
.
forEach
((
activity
)
=>
{
activity
.
products
.
forEach
((
product
)
=>
{
activity
.
products
.
forEach
((
product
)
=>
{
...
...
src/components/DiyEditor/components/mobile/PromotionCombination/property.vue
View file @
7d60b5a6
...
@@ -158,7 +158,6 @@ onMounted(async () => {
...
@@ -158,7 +158,6 @@ onMounted(async () => {
status
:
CommonStatusEnum
.
ENABLE
status
:
CommonStatusEnum
.
ENABLE
})
})
activityList
.
value
=
list
activityList
.
value
=
list
console
.
log
(
'formDa'
,
props
)
})
})
</
script
>
</
script
>
...
...
src/components/DiyEditor/index.vue
View file @
7d60b5a6
...
@@ -151,13 +151,8 @@
...
@@ -151,13 +151,8 @@
class=
"m-[calc(0px-var(--el-card-padding))]"
class=
"m-[calc(0px-var(--el-card-padding))]"
view-class=
"p-[var(--el-card-padding)] p-b-[calc(var(--el-card-padding)+var(--el-card-padding))] property"
view-class=
"p-[var(--el-card-padding)] p-b-[calc(var(--el-card-padding)+var(--el-card-padding))] property"
>
>
<!--这里的 key 使用时间戳是为了保证每次点击组件都进行刷新-->
<component
<component
:key=
"
:key=
"selectedComponent?.uid || selectedComponent?.id"
selectedComponent?.uid ||
selectedComponent?.id + new Date().getTime() ||
new Date().getTime().toString()
"
:is=
"selectedComponent?.id + 'Property'"
:is=
"selectedComponent?.id + 'Property'"
v-model=
"selectedComponent.property"
v-model=
"selectedComponent.property"
/>
/>
...
...
src/views/mall/product/spu/components/SpuShowcase.vue
View file @
7d60b5a6
...
@@ -85,6 +85,7 @@ const openSpuTableSelect = () => {
...
@@ -85,6 +85,7 @@ const openSpuTableSelect = () => {
/**
/**
* 选择商品后触发
* 选择商品后触发
*
* @param spus 选中的商品列表
* @param spus 选中的商品列表
*/
*/
const
handleSpuSelected
=
(
spus
:
ProductSpuApi
.
Spu
|
ProductSpuApi
.
Spu
[])
=>
{
const
handleSpuSelected
=
(
spus
:
ProductSpuApi
.
Spu
|
ProductSpuApi
.
Spu
[])
=>
{
...
@@ -94,6 +95,7 @@ const handleSpuSelected = (spus: ProductSpuApi.Spu | ProductSpuApi.Spu[]) => {
...
@@ -94,6 +95,7 @@ const handleSpuSelected = (spus: ProductSpuApi.Spu | ProductSpuApi.Spu[]) => {
/**
/**
* 删除商品
* 删除商品
*
* @param index 商品索引
* @param index 商品索引
*/
*/
const
handleRemoveSpu
=
(
index
:
number
)
=>
{
const
handleRemoveSpu
=
(
index
:
number
)
=>
{
...
...
src/views/mall/promotion/combination/components/CombinationShowcase.vue
View file @
7d60b5a6
...
@@ -81,7 +81,7 @@ watch(
...
@@ -81,7 +81,7 @@ watch(
Activitys
.
value
.
length
===
0
||
Activitys
.
value
.
length
===
0
||
Activitys
.
value
.
some
((
combinationActivity
)
=>
!
ids
.
includes
(
combinationActivity
.
id
!
))
Activitys
.
value
.
some
((
combinationActivity
)
=>
!
ids
.
includes
(
combinationActivity
.
id
!
))
)
{
)
{
Activitys
.
value
=
await
CombinationActivityApi
.
getCombinationActivity
DetailList
(
ids
)
Activitys
.
value
=
await
CombinationActivityApi
.
getCombinationActivity
ListByIds
(
ids
)
}
}
},
},
{
immediate
:
true
}
{
immediate
:
true
}
...
...
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