Skip to content

Commit db75640

Browse files
author
preschooler
committed
Merge branch 'master' of gitee.com:yudaocode/yudao-ui-admin-vue3 into preschooler
2 parents bd88d29 + 13b630b commit db75640

File tree

5 files changed

+26
-3
lines changed

5 files changed

+26
-3
lines changed

src/api/mall/product/spu.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export interface Spu {
5050
giveIntegral?: number // 赠送积分
5151
virtualSalesCount?: number // 虚拟销量
5252
price?: number // 商品价格
53+
combinationPrice?: number // 商品拼团价格
54+
seckillPrice?: number // 商品秒杀价格
5355
salesCount?: number // 商品销量
5456
marketPrice?: number // 市场价
5557
costPrice?: number // 成本价

src/api/mall/promotion/seckill/seckillActivity.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface SeckillActivityVO {
2424
// 秒杀活动所需属性
2525
export interface SeckillProductVO {
2626
skuId: number
27+
spuId: number
2728
seckillPrice: number
2829
stock: number
2930
}

src/components/DiyEditor/components/mobile/PromotionCombination/index.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
class="text-12px"
5555
:style="{ color: property.fields.price.color }"
5656
>
57-
¥{{ spu.price }}
57+
¥{{ fenToYuan(spu.combinationPrice || spu.price || 0) }}
5858
</span>
5959
</div>
6060
</div>
@@ -66,6 +66,9 @@
6666
import { PromotionCombinationProperty } from './config'
6767
import * as ProductSpuApi from '@/api/mall/product/spu'
6868
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'
6972
7073
/** 拼团 */
7174
defineOptions({ name: 'PromotionCombination' })
@@ -80,6 +83,13 @@ watch(
8083
const activity = await CombinationActivityApi.getCombinationActivity(props.property.activityId)
8184
if (!activity?.spuId) return
8285
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+
})
8393
},
8494
{
8595
immediate: true,

src/components/DiyEditor/components/mobile/PromotionSeckill/index.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
class="text-12px"
5555
:style="{ color: property.fields.price.color }"
5656
>
57-
¥{{ spu.price }}
57+
¥{{ fenToYuan(spu.seckillPrice || spu.price || 0) }}
5858
</span>
5959
</div>
6060
</div>
@@ -66,6 +66,9 @@
6666
import { PromotionSeckillProperty } from './config'
6767
import * as ProductSpuApi from '@/api/mall/product/spu'
6868
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'
6972
7073
/** 秒杀 */
7174
defineOptions({ name: 'PromotionSeckill' })
@@ -80,6 +83,13 @@ watch(
8083
const activity = await SeckillActivityApi.getSeckillActivity(props.property.activityId)
8184
if (!activity?.spuId) return
8285
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+
})
8393
},
8494
{
8595
immediate: true,

src/views/mall/product/spu/form/ProductAttributes.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const inputRef = ref<any[]>([]) //标签输入框Ref
7474
const setInputRef = (el: any) => {
7575
if (el === null || typeof el === 'undefined') return
7676
// 如果不存在 id 相同的元素才添加
77-
if (!inputRef.value.some((item) => item.input?.attributes.id === el.input?.attributes.id)) {
77+
if (!inputRef.value.some((item) => item.inputRef?.attributes.id === el.inputRef?.attributes.id)) {
7878
inputRef.value.push(el)
7979
}
8080
}

0 commit comments

Comments
 (0)