优化金额显示等

This commit is contained in:
liu
2026-08-29 13:52:57 +08:00
parent 2317c9d973
commit 130ef2c949
17 changed files with 93 additions and 159 deletions
+8 -5
View File
@@ -2,17 +2,15 @@ import { useCallback, useMemo, useState } from 'react'
import Taro, { useDidShow } from '@tarojs/taro'
import { View, Text, Image } from '@tarojs/components'
import { Grid, GridItem, Icon, Search, Swiper, SwiperItem } from '@antmjs/vantui'
import useAuthStore from '@/stores/auth/useAuthStore'
import useCartStore from '@/stores/cart/useCartStore'
import { getHomeConfigApi } from '@/services/home'
import type { HomeConfig } from '@/services/home'
import { getProductListApi } from '@/services/product'
import { getProductCover } from '@/types/product'
import type { Product, ProductCartPatch } from '@/types/product'
import PriceText from '@/components/PriceText'
import CartBall from '@/components/CartBall'
import CartStepper from '@/components/CartStepper'
import { formatSpec } from '@/utils/format'
import {formatRetailPrice, formatSpec} from '@/utils/format'
import './index.less'
/** 首页 → 商品页的本地存储传参 key(switchTab 无法带参) */
@@ -265,10 +263,15 @@ export default function IndexPage() {
/>
<View className='product-card__info'>
<Text className='product-card__name'>{product.name}</Text>
<Text className='product-card__spec'>{formatSpec(product.spec, product.unit)}</Text>
<View className='product-card__spec'>
{formatSpec(product.spec, product.unit)}{' '}
{product.price !== null && <>
{formatRetailPrice(product.price, product.spec)} {product.price_unit}
</>}
</View>
<View className='product-card__bottom'>
{product.price !== null ? (
<PriceText className='product-card__price' price={product.price} spec={product.spec} mode='block' />
<Text className='product-card__price'>{product.price}</Text>
) : (
<Text className='product-card__price product-card__price--none'></Text>
)}