【功能修复】修复装修页面的拼团价格和秒杀价格

pull/501/head
卢越 2024-08-16 13:49:08 +08:00
parent d3f38c690e
commit 3b445d031f
4 changed files with 32 additions and 2 deletions

View File

@ -50,6 +50,8 @@ export interface Spu {
giveIntegral?: number // 赠送积分 giveIntegral?: number // 赠送积分
virtualSalesCount?: number // 虚拟销量 virtualSalesCount?: number // 虚拟销量
price?: number // 商品价格 price?: number // 商品价格
combinationPrice?: number // 商品拼团价格
seckillPrice?: number // 商品秒杀价格
salesCount?: number // 商品销量 salesCount?: number // 商品销量
marketPrice?: number // 市场价 marketPrice?: number // 市场价
costPrice?: number // 成本价 costPrice?: number // 成本价

View File

@ -24,6 +24,7 @@ export interface SeckillActivityVO {
// 秒杀活动所需属性 // 秒杀活动所需属性
export interface SeckillProductVO { export interface SeckillProductVO {
skuId: number skuId: number
spuId: number
seckillPrice: number seckillPrice: number
stock: number stock: number
} }

View File

@ -54,7 +54,7 @@
class="text-12px" class="text-12px"
:style="{ color: property.fields.price.color }" :style="{ color: property.fields.price.color }"
> >
{{ spu.price }} {{ fenToYuan(spu.combinationPrice || spu.price || 0) }}
</span> </span>
</div> </div>
</div> </div>
@ -66,6 +66,9 @@
import { PromotionCombinationProperty } from './config' import { PromotionCombinationProperty } from './config'
import * as ProductSpuApi from '@/api/mall/product/spu' import * as ProductSpuApi from '@/api/mall/product/spu'
import * as CombinationActivityApi from '@/api/mall/promotion/combination/combinationActivity' import * as CombinationActivityApi from '@/api/mall/promotion/combination/combinationActivity'
import {Spu} from "@/api/mall/product/spu";
import {CombinationProductVO} from "@/api/mall/promotion/combination/combinationActivity";
import {fenToYuan} from "@/utils";
/** 拼团 */ /** 拼团 */
defineOptions({ name: 'PromotionCombination' }) defineOptions({ name: 'PromotionCombination' })
@ -80,6 +83,16 @@ watch(
const activity = await CombinationActivityApi.getCombinationActivity(props.property.activityId) const activity = await CombinationActivityApi.getCombinationActivity(props.property.activityId)
if (!activity?.spuId) return if (!activity?.spuId) return
spuList.value = [await ProductSpuApi.getSpu(activity.spuId)] spuList.value = [await ProductSpuApi.getSpu(activity.spuId)]
//
activity.products.forEach((product: CombinationProductVO) => {
spuList.value.forEach((spu: Spu) => {
// SpuId
if (spu.id === product.spuId) {
// 便
spu.combinationPrice = Math.min(spu.price || 0, product.combinationPrice); // SPU
}
})
});
}, },
{ {
immediate: true, immediate: true,

View File

@ -54,7 +54,7 @@
class="text-12px" class="text-12px"
:style="{ color: property.fields.price.color }" :style="{ color: property.fields.price.color }"
> >
{{ spu.price }} {{ fenToYuan(spu.seckillPrice || spu.price || 0) }}
</span> </span>
</div> </div>
</div> </div>
@ -66,6 +66,9 @@
import { PromotionSeckillProperty } from './config' import { PromotionSeckillProperty } from './config'
import * as ProductSpuApi from '@/api/mall/product/spu' import * as ProductSpuApi from '@/api/mall/product/spu'
import * as SeckillActivityApi from '@/api/mall/promotion/seckill/seckillActivity' import * as SeckillActivityApi from '@/api/mall/promotion/seckill/seckillActivity'
import {Spu} from "@/api/mall/product/spu";
import {SeckillProductVO} from "@/api/mall/promotion/seckill/seckillActivity";
import {fenToYuan} from "@/utils";
/** 秒杀 */ /** 秒杀 */
defineOptions({ name: 'PromotionSeckill' }) defineOptions({ name: 'PromotionSeckill' })
@ -80,6 +83,17 @@ watch(
const activity = await SeckillActivityApi.getSeckillActivity(props.property.activityId) const activity = await SeckillActivityApi.getSeckillActivity(props.property.activityId)
if (!activity?.spuId) return if (!activity?.spuId) return
spuList.value = [await ProductSpuApi.getSpu(activity.spuId)] spuList.value = [await ProductSpuApi.getSpu(activity.spuId)]
spuList.value = [await ProductSpuApi.getSpu(activity.spuId)]
//
activity.products.forEach((product: SeckillProductVO) => {
spuList.value.forEach((spu: Spu) => {
// SpuId
if (spu.id === product.spuId) {
// 便
spu.seckillPrice = Math.min(spu.price || 0, product.seckillPrice); // SPU
}
})
});
}, },
{ {
immediate: true, immediate: true,