优化金额显示等
This commit is contained in:
+10
-10
@@ -6,8 +6,7 @@ import useAuthStore from '@/stores/auth/useAuthStore'
|
||||
import useCartStore from '@/stores/cart/useCartStore'
|
||||
import { createOrderApi } from '@/services/order'
|
||||
import { getStoreInfoApi } from '@/services/store'
|
||||
import PriceText from '@/components/PriceText'
|
||||
import { formatSpec } from '@/utils/format'
|
||||
import {formatRetailPrice, formatSpec} from '@/utils/format'
|
||||
import type { CartItem } from '@/types/cart'
|
||||
import type { StoreDetail } from '@/types/store'
|
||||
import './index.less'
|
||||
@@ -159,7 +158,7 @@ export default function CartPage() {
|
||||
if (submitting) return
|
||||
setSubmitting(true)
|
||||
try {
|
||||
const res = await createOrderApi({
|
||||
await createOrderApi({
|
||||
items: purchasable.map(item => ({
|
||||
product_id: item.product_id,
|
||||
quantity: Number(qtyMap[item.id] ?? item.quantity),
|
||||
@@ -221,13 +220,12 @@ export default function CartPage() {
|
||||
<Text className='cart-item__name'>{item.name}</Text>
|
||||
{item.status === 0 && <Text className='cart-item__invalid-tag'>已失效</Text>}
|
||||
</View>
|
||||
<Text className='cart-item__spec'>{formatSpec(item.spec, item.unit)}</Text>
|
||||
<Text className='cart-item__spec'>
|
||||
{formatSpec(item.spec, item.unit)}{' '}
|
||||
单价:{formatRetailPrice(item.price, item.spec)} {item.price_unit}
|
||||
</Text>
|
||||
<View className='cart-item__bottom'>
|
||||
{item.price !== null ? (
|
||||
<PriceText className='cart-item__price' price={item.price} spec={item.spec} mode='block' />
|
||||
) : (
|
||||
<Text className='cart-item__price cart-item__price--none'>价格待定</Text>
|
||||
)}
|
||||
<Text className='cart-item__price'>¥{item.price}</Text>
|
||||
{item.status === 1 ? (
|
||||
<Stepper
|
||||
value={displayQty(item)}
|
||||
@@ -252,6 +250,8 @@ export default function CartPage() {
|
||||
))
|
||||
)}
|
||||
|
||||
<View style={{ height: 100 }}></View>
|
||||
|
||||
{loggedIn && hasInvalid && (
|
||||
<View className='cart-invalid-hint'>
|
||||
<Text>部分商品已下架或未设置您所在等级的价格,不可下单</Text>
|
||||
@@ -262,7 +262,7 @@ export default function CartPage() {
|
||||
{loggedIn && items.length > 0 && (
|
||||
<View className='cart-footer'>
|
||||
<View className='cart-footer__total'>
|
||||
<Text className='cart-footer__label'>合计(可购{totalQuantity}件)</Text>
|
||||
<Text className='cart-footer__label'>合计{totalQuantity}件</Text>
|
||||
<Text className='cart-footer__amount'>¥{totalAmount}</Text>
|
||||
</View>
|
||||
<Button type='danger' className='cart-footer__submit' onClick={handleOrderTap}>
|
||||
|
||||
Reference in New Issue
Block a user