File tree Expand file tree Collapse file tree 6 files changed +11
-28
lines changed
api/mall/promotion/combination
components/mobile/PromotionCombination
promotion/combination/components Expand file tree Collapse file tree 6 files changed +11
-28
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,6 @@ export interface CombinationActivityVO {
17
17
status ?: number
18
18
limitDuration ?: number
19
19
products : CombinationProductVO [ ]
20
- spuName ?: string
21
- picUrl ?: string
22
- marketPrice ?: number
23
20
}
24
21
25
22
// 拼团活动所需属性
@@ -39,7 +36,7 @@ export interface SpuExtension extends Spu {
39
36
}
40
37
41
38
// 查询拼团活动列表
42
- export const getCombinationActivityPage = async ( params ) => {
39
+ export const getCombinationActivityPage = async ( params : any ) => {
43
40
return await request . get ( { url : '/promotion/combination-activity/page' , params } )
44
41
}
45
42
@@ -48,8 +45,8 @@ export const getCombinationActivity = async (id: number) => {
48
45
return await request . get ( { url : '/promotion/combination-activity/get?id=' + id } )
49
46
}
50
47
51
- // 查询拼团活动详情列表
52
- export const getCombinationActivityDetailList = ( ids : number [ ] ) => {
48
+ // 获得拼团活动列表,基于活动编号数组
49
+ export const getCombinationActivityListByIds = ( ids : number [ ] ) => {
53
50
return request . get ( { url : `/promotion/combination-activity/list-by-ids?ids=${ ids } ` } )
54
51
}
55
52
Original file line number Diff line number Diff line change @@ -136,30 +136,20 @@ watch(
136
136
// 新添加的拼团组件,是没有活动ID的
137
137
const activityIds = props .property .activityIds
138
138
// 检查活动ID的有效性
139
- if (
140
- Array .isArray (activityIds ) &&
141
- activityIds .length > 0 &&
142
- activityIds .every ((item ) => item != null )
143
- ) {
139
+ if (Array .isArray (activityIds ) && activityIds .length > 0 ) {
144
140
// 获取拼团活动详情列表
145
141
combinationActivityList .value =
146
- await CombinationActivityApi .getCombinationActivityDetailList (activityIds )
142
+ await CombinationActivityApi .getCombinationActivityListByIds (activityIds )
147
143
148
- // 清空之前的数据,防止有重复
149
- spuIdList .value = []
144
+ // 获取拼团活动的 SPU 详情列表
150
145
spuList .value = []
151
-
152
- // 生成有效的 spuId 列表
153
146
spuIdList .value = combinationActivityList .value
154
147
.map ((activity ) => activity .spuId )
155
148
.filter ((spuId ): spuId is number => typeof spuId === ' number' )
156
-
157
- // 如果存在有效的 spuId,调用 API 获取详细信息
158
149
if (spuIdList .value .length > 0 ) {
159
150
spuList .value = await ProductSpuApi .getSpuDetailList (spuIdList .value )
160
- } else {
161
- console .warn (' 没有用于获取详细信息的有效 spuId。' )
162
151
}
152
+
163
153
// 更新 SPU 的最低价格
164
154
combinationActivityList .value .forEach ((activity ) => {
165
155
activity .products .forEach ((product ) => {
Original file line number Diff line number Diff line change @@ -158,7 +158,6 @@ onMounted(async () => {
158
158
status: CommonStatusEnum .ENABLE
159
159
})
160
160
activityList .value = list
161
- console .log (' formDa' , props )
162
161
})
163
162
</script >
164
163
Original file line number Diff line number Diff line change 151
151
class =" m-[calc(0px-var(--el-card-padding))]"
152
152
view-class =" p-[var(--el-card-padding)] p-b-[calc(var(--el-card-padding)+var(--el-card-padding))] property"
153
153
>
154
- <!-- 这里的 key 使用时间戳是为了保证每次点击组件都进行刷新-->
155
154
<component
156
- :key ="
157
- selectedComponent?.uid ||
158
- selectedComponent?.id + new Date().getTime() ||
159
- new Date().getTime().toString()
160
- "
155
+ :key =" selectedComponent?.uid || selectedComponent?.id"
161
156
:is =" selectedComponent?.id + 'Property'"
162
157
v-model =" selectedComponent.property"
163
158
/>
Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ const openSpuTableSelect = () => {
85
85
86
86
/**
87
87
* 选择商品后触发
88
+ *
88
89
* @param spus 选中的商品列表
89
90
*/
90
91
const handleSpuSelected = (spus : ProductSpuApi .Spu | ProductSpuApi .Spu []) => {
@@ -94,6 +95,7 @@ const handleSpuSelected = (spus: ProductSpuApi.Spu | ProductSpuApi.Spu[]) => {
94
95
95
96
/**
96
97
* 删除商品
98
+ *
97
99
* @param index 商品索引
98
100
*/
99
101
const handleRemoveSpu = (index : number ) => {
Original file line number Diff line number Diff line change 81
81
Activitys .value .length === 0 ||
82
82
Activitys .value .some ((combinationActivity ) => ! ids .includes (combinationActivity .id ! ))
83
83
) {
84
- Activitys .value = await CombinationActivityApi .getCombinationActivityDetailList (ids )
84
+ Activitys .value = await CombinationActivityApi .getCombinationActivityListByIds (ids )
85
85
}
86
86
},
87
87
{ immediate: true }
You can’t perform that action at this time.
0 commit comments