Merge branch 'master' of gitee.com:yudaocode/yudao-ui-admin-vue3 into preschooler
commit
db75640167
|
@ -50,6 +50,8 @@ export interface Spu {
|
|||
giveIntegral?: number // 赠送积分
|
||||
virtualSalesCount?: number // 虚拟销量
|
||||
price?: number // 商品价格
|
||||
combinationPrice?: number // 商品拼团价格
|
||||
seckillPrice?: number // 商品秒杀价格
|
||||
salesCount?: number // 商品销量
|
||||
marketPrice?: number // 市场价
|
||||
costPrice?: number // 成本价
|
||||
|
|
|
@ -24,6 +24,7 @@ export interface SeckillActivityVO {
|
|||
// 秒杀活动所需属性
|
||||
export interface SeckillProductVO {
|
||||
skuId: number
|
||||
spuId: number
|
||||
seckillPrice: number
|
||||
stock: number
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
class="text-12px"
|
||||
:style="{ color: property.fields.price.color }"
|
||||
>
|
||||
¥{{ spu.price }}
|
||||
¥{{ fenToYuan(spu.combinationPrice || spu.price || 0) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -66,6 +66,9 @@
|
|||
import { PromotionCombinationProperty } from './config'
|
||||
import * as ProductSpuApi from '@/api/mall/product/spu'
|
||||
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' })
|
||||
|
@ -80,6 +83,13 @@ watch(
|
|||
const activity = await CombinationActivityApi.getCombinationActivity(props.property.activityId)
|
||||
if (!activity?.spuId) return
|
||||
spuList.value = [await ProductSpuApi.getSpu(activity.spuId)]
|
||||
// 循环活动信息,赋值拼团价格
|
||||
activity.products.forEach((product: CombinationProductVO) => {
|
||||
spuList.value.forEach((spu: Spu) => {
|
||||
// 商品原售价和拼团价,哪个便宜就赋值哪个
|
||||
spu.combinationPrice = Math.min(spu.combinationPrice || Infinity, product.combinationPrice) // 设置 SPU 的最低价格
|
||||
})
|
||||
})
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
class="text-12px"
|
||||
:style="{ color: property.fields.price.color }"
|
||||
>
|
||||
¥{{ spu.price }}
|
||||
¥{{ fenToYuan(spu.seckillPrice || spu.price || 0) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -66,6 +66,9 @@
|
|||
import { PromotionSeckillProperty } from './config'
|
||||
import * as ProductSpuApi from '@/api/mall/product/spu'
|
||||
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' })
|
||||
|
@ -80,6 +83,13 @@ watch(
|
|||
const activity = await SeckillActivityApi.getSeckillActivity(props.property.activityId)
|
||||
if (!activity?.spuId) return
|
||||
spuList.value = [await ProductSpuApi.getSpu(activity.spuId)]
|
||||
spuList.value = [await ProductSpuApi.getSpu(activity.spuId)]
|
||||
// 循环活动信息,赋值秒杀最低价格
|
||||
activity.products.forEach((product: SeckillProductVO) => {
|
||||
spuList.value.forEach((spu: Spu) => {
|
||||
spu.seckillPrice = Math.min(spu.seckillPrice || Infinity, product.seckillPrice) // 设置 SPU 的最低价格
|
||||
})
|
||||
})
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
|
|
|
@ -74,7 +74,7 @@ const inputRef = ref<any[]>([]) //标签输入框Ref
|
|||
const setInputRef = (el: any) => {
|
||||
if (el === null || typeof el === 'undefined') return
|
||||
// 如果不存在 id 相同的元素才添加
|
||||
if (!inputRef.value.some((item) => item.input?.attributes.id === el.input?.attributes.id)) {
|
||||
if (!inputRef.value.some((item) => item.inputRef?.attributes.id === el.inputRef?.attributes.id)) {
|
||||
inputRef.value.push(el)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue