优化金额显示等
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// 购物车悬浮球:右下角,底部避让自定义 tabBar(110rpx + 安全区)
|
||||
.cart-ball {
|
||||
position: fixed;
|
||||
right: 24rpx;
|
||||
left: 24rpx;
|
||||
bottom: calc(150rpx + env(safe-area-inset-bottom));
|
||||
z-index: 998;
|
||||
display: flex;
|
||||
|
||||
@@ -15,13 +15,15 @@ interface PriceTextProps {
|
||||
* - block 独占一行(窄卡片:首页推荐、商品列表、购物车)
|
||||
*/
|
||||
mode?: 'inline' | 'block'
|
||||
/** 单位 */
|
||||
price_unit?: string | null
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品价格:售价 + 零售价标注(小字)
|
||||
* price=30、spec=15 → ¥30 零售价:¥2
|
||||
*/
|
||||
export default function PriceText({ price, spec, className, mode = 'inline' }: PriceTextProps) {
|
||||
export default function PriceText({ price, spec, className, mode = 'inline', price_unit }: PriceTextProps) {
|
||||
const retail = formatRetailPrice(price, spec)
|
||||
|
||||
// 窄卡片:大价格 / 零售价上下两行,避免与右侧按钮(+/步进器)挤压换行
|
||||
@@ -30,7 +32,7 @@ export default function PriceText({ price, spec, className, mode = 'inline' }: P
|
||||
<View className={`price-text ${className ?? ''}`}>
|
||||
<Text className='price-text__main'>¥{price}</Text>
|
||||
{retail !== null && (
|
||||
<Text className='price-text__retail'>单价:¥{retail}</Text>
|
||||
<Text className='price-text__retail'>单价:¥{retail} {price_unit}</Text>
|
||||
)}
|
||||
</View>
|
||||
)
|
||||
@@ -40,7 +42,7 @@ export default function PriceText({ price, spec, className, mode = 'inline' }: P
|
||||
<Text className={className}>
|
||||
¥{price}
|
||||
{retail !== null && (
|
||||
<Text className='price-text__retail price-text__retail--inline'>单价:¥{retail}</Text>
|
||||
<Text className='price-text__retail price-text__retail--inline'>单价:¥{retail} {price_unit}</Text>
|
||||
)}
|
||||
</Text>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user