File tree Expand file tree Collapse file tree 4 files changed +25
-2
lines changed
components/DiyEditor/components/mobile Expand file tree Collapse file tree 4 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ export interface Spu {
50
50
giveIntegral ?: number // 赠送积分
51
51
virtualSalesCount ?: number // 虚拟销量
52
52
price ?: number // 商品价格
53
+ combinationPrice ?: number // 商品拼团价格
54
+ seckillPrice ?: number // 商品秒杀价格
53
55
salesCount ?: number // 商品销量
54
56
marketPrice ?: number // 市场价
55
57
costPrice ?: number // 成本价
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export interface SeckillActivityVO {
24
24
// 秒杀活动所需属性
25
25
export interface SeckillProductVO {
26
26
skuId : number
27
+ spuId : number
27
28
seckillPrice : number
28
29
stock : number
29
30
}
Original file line number Diff line number Diff line change 54
54
class =" text-12px"
55
55
:style =" { color: property.fields.price.color }"
56
56
>
57
- ¥{{ spu.price }}
57
+ ¥{{ fenToYuan( spu.combinationPrice || spu. price || 0) }}
58
58
</span >
59
59
</div >
60
60
</div >
66
66
import { PromotionCombinationProperty } from ' ./config'
67
67
import * as ProductSpuApi from ' @/api/mall/product/spu'
68
68
import * as CombinationActivityApi from ' @/api/mall/promotion/combination/combinationActivity'
69
+ import {Spu } from " @/api/mall/product/spu" ;
70
+ import {CombinationProductVO } from " @/api/mall/promotion/combination/combinationActivity" ;
71
+ import {fenToYuan } from " @/utils" ;
69
72
70
73
/** 拼团 */
71
74
defineOptions ({ name: ' PromotionCombination' })
@@ -80,6 +83,13 @@ watch(
80
83
const activity = await CombinationActivityApi .getCombinationActivity (props .property .activityId )
81
84
if (! activity ?.spuId ) return
82
85
spuList .value = [await ProductSpuApi .getSpu (activity .spuId )]
86
+ // 循环活动信息,赋值拼团价格
87
+ activity .products .forEach ((product : CombinationProductVO ) => {
88
+ spuList .value .forEach ((spu : Spu ) => {
89
+ // 商品原售价和拼团价,哪个便宜就赋值哪个
90
+ spu .combinationPrice = Math .min (spu .combinationPrice || Infinity , product .combinationPrice ); // 设置 SPU 的最低价格
91
+ })
92
+ });
83
93
},
84
94
{
85
95
immediate: true ,
Original file line number Diff line number Diff line change 54
54
class =" text-12px"
55
55
:style =" { color: property.fields.price.color }"
56
56
>
57
- ¥{{ spu.price }}
57
+ ¥{{ fenToYuan( spu.seckillPrice || spu. price || 0) }}
58
58
</span >
59
59
</div >
60
60
</div >
66
66
import { PromotionSeckillProperty } from ' ./config'
67
67
import * as ProductSpuApi from ' @/api/mall/product/spu'
68
68
import * as SeckillActivityApi from ' @/api/mall/promotion/seckill/seckillActivity'
69
+ import {Spu } from " @/api/mall/product/spu" ;
70
+ import {SeckillProductVO } from " @/api/mall/promotion/seckill/seckillActivity" ;
71
+ import {fenToYuan } from " @/utils" ;
69
72
70
73
/** 秒杀 */
71
74
defineOptions ({ name: ' PromotionSeckill' })
@@ -80,6 +83,13 @@ watch(
80
83
const activity = await SeckillActivityApi .getSeckillActivity (props .property .activityId )
81
84
if (! activity ?.spuId ) return
82
85
spuList .value = [await ProductSpuApi .getSpu (activity .spuId )]
86
+ spuList .value = [await ProductSpuApi .getSpu (activity .spuId )]
87
+ // 循环活动信息,赋值秒杀最低价格
88
+ activity .products .forEach ((product : SeckillProductVO ) => {
89
+ spuList .value .forEach ((spu : Spu ) => {
90
+ spu .seckillPrice = Math .min (spu .seckillPrice || Infinity , product .seckillPrice ); // 设置 SPU 的最低价格
91
+ })
92
+ });
83
93
},
84
94
{
85
95
immediate: true ,
You can’t perform that action at this time.
0 commit comments