商品浏览页构建前最后一次更新

This commit is contained in:
2026-08-02 00:21:54 +08:00
parent d37a93ab9e
commit e423ab2d73
146 changed files with 3449 additions and 1342 deletions
+15 -11
View File
@@ -1,8 +1,9 @@
import { View, Text, ScrollView } from '@tarojs/components'
import { View, Text, ScrollView, Image } from '@tarojs/components'
import Taro from '@tarojs/taro'
import { useState, useEffect } from 'react'
import './index.scss'
import { getOrderList, type OrderItem } from '../../utils/store'
import { PRODUCT_ICON_MAP } from '../../utils/productConfig'
import ThemeToggle from '../../components/ThemeToggle'
import { useThemeContext } from '../../context/ThemeContext'
import LoginGuard from '../../components/LoginGuard'
@@ -87,7 +88,7 @@ export default function OrdersPage() {
<View
key={tab.code}
className={`tab-item ${activeTab === tab.code ? 'active' : ''}`}
onClick={() => setActiveTab(tab.code)}
onTap={() => setActiveTab(tab.code)}
>
<Text className='tab-label'>{tab.label}</Text>
{activeTab === tab.code && <View className='tab-underline' />}
@@ -100,8 +101,11 @@ export default function OrdersPage() {
<ScrollView className='orders-list' scrollY>
{filteredOrders.map((order) => {
const status = STATUS_MAP[order.statusCode] || STATUS_MAP.pending
const iconSrc = order.productIcon?.startsWith('/icon/')
? order.productIcon
: '/icon/四角星.png'
return (
<View key={order.id} className='order-card dashed-card' onClick={() => goDetail(order)}>
<View key={order.id} className='order-card dashed-card' onTap={() => goDetail(order)}>
<View className='star-badge' />
<View className='order-header'>
<Text className='order-date'>{order.date}</Text>
@@ -109,7 +113,7 @@ export default function OrdersPage() {
</View>
<View className='order-body'>
<View className='order-icon-wrapper'>
<Text className='order-icon'>{order.productIcon}</Text>
<Image className='order-icon-img' src={iconSrc} mode='aspectFit' />
</View>
<View className='order-info'>
<Text className='order-product'>{order.productName}</Text>
@@ -135,25 +139,25 @@ export default function OrdersPage() {
)}
{order.statusCode === 'shipping' && (
<>
<View className='btn-outline order-btn' onClick={(e) => { e.stopPropagation(); Taro.showToast({ title: '查看物流', icon: 'none' }) }}>
<View className='btn-outline order-btn' onTap={(e) => { e.stopPropagation(); Taro.showToast({ title: '查看物流', icon: 'none' }) }}>
<Text></Text>
</View>
<View className='btn-gradient order-btn' onClick={(e) => { e.stopPropagation(); Taro.showToast({ title: '确认收货', icon: 'none' }) }}>
<View className='btn-gradient order-btn' onTap={(e) => { e.stopPropagation(); Taro.showToast({ title: '确认收货', icon: 'none' }) }}>
<Text></Text>
</View>
</>
)}
{order.statusCode === 'done' && (
<>
<View className='btn-outline order-btn' onClick={(e) => { e.stopPropagation(); Taro.showToast({ title: '申请售后', icon: 'none' }) }}>
<View className='btn-outline order-btn' onTap={(e) => { e.stopPropagation(); Taro.showToast({ title: '申请售后', icon: 'none' }) }}>
<Text></Text>
</View>
<View className='btn-gradient order-btn' onClick={(e) => { e.stopPropagation(); Taro.showToast({ title: '再来一单', icon: 'none' }) }}>
<View className='btn-gradient order-btn' onTap={(e) => { e.stopPropagation(); Taro.showToast({ title: '再来一单', icon: 'none' }) }}>
<Text></Text>
</View>
</>
)}
<View className='btn-outline order-btn' onClick={(e) => { e.stopPropagation(); goDetail(order) }}>
<View className='btn-outline order-btn' onTap={(e) => { e.stopPropagation(); goDetail(order) }}>
<Text></Text>
</View>
</View>
@@ -164,10 +168,10 @@ export default function OrdersPage() {
{filteredOrders.length === 0 && (
<View className='empty-state'>
<Text className='empty-icon'>📦</Text>
<Image className='empty-icon-img' src='/icon/包裹.png' mode='aspectFit' />
<Text className='empty-text'></Text>
<Text className='empty-sub'></Text>
<View className='btn-gradient' onClick={() => Taro.switchTab({ url: '/pages/index/index' })}>
<View className='btn-gradient' onTap={() => Taro.switchTab({ url: '/pages/index/index' })}>
<Text></Text>
</View>
</View>