Skip to content

Commit 078407f

Browse files
author
puhui999
committed
【功能优化】商城: 修复活动选择商品时 sku 价格显示不正确的问题
1 parent 70abc5f commit 078407f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/views/mall/promotion/components/SpuSelect.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ import { getPropertyList, PropertyAndValues, SkuList } from '@/views/mall/produc
115115
import { ElTable } from 'element-plus'
116116
import { dateFormatter } from '@/utils/formatTime'
117117
import { createImageViewer } from '@/components/ImageViewer'
118-
import { formatToFraction } from '@/utils'
118+
import { floatToFixed2, formatToFraction } from '@/utils'
119119
import { defaultProps, handleTree } from '@/utils/tree'
120120
121121
import * as ProductCategoryApi from '@/api/mall/product/category'
@@ -228,6 +228,13 @@ const expandChange = async (row: ProductSpuApi.Spu, expandedRows?: ProductSpuApi
228228
}
229229
// 获取 SPU 详情
230230
const res = (await ProductSpuApi.getSpu(row.id as number)) as ProductSpuApi.Spu
231+
res.skus?.forEach((item) => {
232+
item.price = floatToFixed2(item.price)
233+
item.marketPrice = floatToFixed2(item.marketPrice)
234+
item.costPrice = floatToFixed2(item.costPrice)
235+
item.firstBrokeragePrice = floatToFixed2(item.firstBrokeragePrice)
236+
item.secondBrokeragePrice = floatToFixed2(item.secondBrokeragePrice)
237+
})
231238
propertyList.value = getPropertyList(res)
232239
spuData.value = res
233240
isExpand.value = true

0 commit comments

Comments
 (0)