feat(user): 新增收货地址管理及售后申请页面

- 新增地址类型定义,增强前端地址数据结构
- 新增地址编辑页面,支持地址智能识别和定位选点功能
- 地址编辑支持省市区选择及默认地址设置
- 新增地址列表页面,支持地址展示、删除、编辑和选择功能
- 实现售后申请页面,支持选择售后类型和退款原因
- 售后申请支持商品选择、退款金额计算和凭证上传
- 新增售后详情页面,支持售后状态展示及申请取消
- 优化页面加载和用户交互体验,增加错误提示和权限处理
This commit is contained in:
2026-07-01 12:11:56 +08:00
parent bf6ed504cc
commit 1fa58040f3
636 changed files with 58878 additions and 716 deletions

View File

@@ -0,0 +1,116 @@
import React, { useEffect, useState } from 'react'
import { View, Text, ScrollView, Image } from '@tarojs/components'
import Taro from '@tarojs/taro'
import { useUser } from '@/hooks/useUser'
import { pageShopPointsProduct } from '@/api/shop/shopPointsProduct'
import type { ShopPointsProduct } from '@/api/shop/shopPointsProduct/model'
import { getUserPointsInfo, type UserPointsInfo } from '@/api/system/user/points'
import EmptyState from '@/components/common/EmptyState'
const PointsPage: React.FC = () => {
const { user } = useUser()
const [pointsInfo, setPointsInfo] = useState<UserPointsInfo>({ points: 0, totalEarned: 0, totalUsed: 0, expiringSoon: 0 })
const [hotProducts, setHotProducts] = useState<ShopPointsProduct[]>([])
const [loading, setLoading] = useState(true)
useEffect(() => {
// 获取当前用户真实积分
getUserPointsInfo()
.then(data => setPointsInfo(data))
.catch(err => console.error('获取积分信息失败:', err))
pageShopPointsProduct({ page: 1, limit: 4, isHot: 1, status: 1 })
.then(res => setHotProducts(res?.list || []))
.catch(() => {})
.finally(() => setLoading(false))
}, [])
return (
<ScrollView scrollY className='min-h-screen bg-gray-50'>
{/* 积分卡片 */}
<View className='mx-3 mt-3 p-4 rounded-xl' style={{ background: 'linear-gradient(135deg, #0e932e, #16a34a)' }}>
<Text className='text-white text-sm opacity-80 block mb-1'></Text>
<Text className='text-white text-3xl font-bold block'>{pointsInfo.points}</Text>
<View className='flex gap-3 mt-4'>
<View
className='flex-1 py-2 rounded-full text-center'
style={{ backgroundColor: 'rgba(255,255,255,0.2)' }}
onClick={() => Taro.navigateTo({ url: '/pages/points/signin' })}
>
<Text className='text-white text-sm'></Text>
</View>
<View
className='flex-1 py-2 rounded-full text-center'
style={{ backgroundColor: 'rgba(255,255,255,0.2)' }}
onClick={() => Taro.navigateTo({ url: '/pages/user/points-record' })}
>
<Text className='text-white text-sm'></Text>
</View>
</View>
</View>
{/* 热门兑换 */}
<View className='mx-3 mt-4'>
<View className='flex justify-between items-center mb-3'>
<Text className='text-base font-medium text-gray-800'></Text>
<Text
className='text-xs text-gray-400'
onClick={() => Taro.navigateTo({ url: '/pages/points/product-list/index' })}
>{`查看更多 >`}</Text>
</View>
{!loading && hotProducts.length === 0 ? (
<EmptyState text='暂无热门商品' />
) : (
<View className='grid grid-cols-2 gap-2'>
{loading
? [1, 2, 3, 4].map(i => (
<View key={i} className='bg-white rounded-lg overflow-hidden'>
<View className='w-full aspect-square bg-gray-100' />
<View className='p-2'>
<View className='h-4 bg-gray-100 rounded mb-2' />
<View className='h-3 bg-gray-100 rounded w-16' />
</View>
</View>
))
: hotProducts.map(item => (
<View
key={item.id}
className='bg-white rounded-lg overflow-hidden'
onClick={() => Taro.navigateTo({ url: `/pages/points/product-detail?id=${item.id}` })}
>
<View className='w-full aspect-square bg-orange-50 flex items-center justify-center overflow-hidden'>
{item.productImage ? (
<Image src={item.productImage} className='w-full h-full' mode='aspectFill' />
) : (
<Text className='text-xs text-gray-300'></Text>
)}
</View>
<View className='p-2'>
<Text className='text-sm text-gray-700 truncate block'>{item.productName}</Text>
<View className='flex items-center gap-1 mt-1'>
<Text className='text-sm font-bold text-orange-500'>{item.pointsPrice || 0}</Text>
{Number(item.moneyPrice) > 0 && (
<Text className='text-xs text-gray-400'>+¥{item.moneyPrice}</Text>
)}
</View>
</View>
</View>
))}
</View>
)}
</View>
{/* 积分订单入口 */}
<View
className='mx-3 mt-4 mb-4 bg-white rounded-lg p-4 flex justify-between items-center'
onClick={() => Taro.navigateTo({ url: '/pages/order-list' })}
>
<Text className='text-sm text-gray-700'></Text>
<Text className='text-gray-400 text-sm'>{'>'}</Text>
</View>
</ScrollView>
)
}
export default PointsPage