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,123 @@
import React, { useState, useEffect } from 'react'
import { View, Text, ScrollView, Button, Image } from '@tarojs/components'
import Taro from '@tarojs/taro'
import { useUser } from '@/hooks/useUser'
import { useScrollHeight } from '@/hooks/useScrollHeight'
definePageConfig({
navigationBarTitleText: '分销推广',
})
const PromotionPage: React.FC = () => {
const { user, isLoggedIn } = useUser()
const [inviteCode, setInviteCode] = useState('')
const [inviteLink, setInviteLink] = useState('')
const [qrCodeUrl, setQrCodeUrl] = useState('')
const scrollHeight = useScrollHeight(44)
useEffect(() => {
if (!isLoggedIn) {
Taro.navigateTo({ url: '/passport/login' })
return
}
// 生成邀请码和链接
const code = (user?.userId || user?.id)?.toString() || Taro.getStorageSync('UserId')?.toString() || ''
setInviteCode(code)
setInviteLink(`https://shop-api.websoft.top/invite?ref=${code}`)
setQrCodeUrl(`https://shop-api.websoft.top/api/wx-login/getOrderQRCodeUnlimited/uid_${code}`)
}, [isLoggedIn, user])
const handleCopyLink = () => {
Taro.setClipboardData({
data: inviteLink,
success: () => {
Taro.showToast({ title: '链接已复制', icon: 'success' })
},
})
}
const handleShare = () => {
Taro.showToast({ title: '请点击右上角分享', icon: 'none' })
}
if (!isLoggedIn) {
return null
}
return (
<View className='min-h-screen bg-gray-50'>
<ScrollView scrollY style={{ height: scrollHeight }}>
{/* 推广卡片 */}
<View className='mx-3 mt-3 p-4 rounded-xl' style={{ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)' }}>
<Text className='text-white text-lg font-bold mb-1 block'>广</Text>
<Text className='text-white text-sm opacity-80 mb-3 block'></Text>
<View className='bg-white rounded-lg p-3 mb-3'>
<Text className='text-xs text-gray-500 mb-1 block'></Text>
<Text className='text-base font-bold text-gray-800'>{inviteCode}</Text>
</View>
{/* 邀请二维码 */}
{qrCodeUrl ? (
<View className='bg-white rounded-lg p-3 flex flex-col items-center'>
<Text className='text-xs text-gray-500 mb-2 block'></Text>
<Image
src={qrCodeUrl}
style={{ width: '180px', height: '180px' }}
mode='aspectFit'
/>
</View>
) : null}
</View>
{/* 推广链接 */}
<View className='mx-3 mt-3 p-4 bg-white rounded-lg'>
<Text className='text-sm font-medium text-gray-800 mb-2 block'>广</Text>
<View className='bg-gray-50 rounded-lg p-3 mb-3'>
<Text className='text-xs text-gray-600 break-all'>{inviteLink}</Text>
</View>
<View className='grid grid-cols-2 gap-2'>
<Button
className='rounded-full'
style={{ backgroundColor: '#0e932e' }}
onClick={handleCopyLink}
>
</Button>
<Button
className='rounded-full'
style={{ backgroundColor: '#1989fa' }}
onClick={handleShare}
>
</Button>
</View>
</View>
{/* 推广说明 */}
<View className='mx-3 mt-3 p-4 bg-white rounded-lg'>
<Text className='text-sm font-medium text-gray-800 mb-3 block'>广</Text>
<View className='flex items-start gap-2 mb-2'>
<Text className='text-green-500 mt-0'>1.</Text>
<Text className='text-sm text-gray-600 flex-1'></Text>
</View>
<View className='flex items-start gap-2 mb-2'>
<Text className='text-green-500 mt-0'>2.</Text>
<Text className='text-sm text-gray-600 flex-1'></Text>
</View>
<View className='flex items-start gap-2 mb-2'>
<Text className='text-green-500 mt-0'>3.</Text>
<Text className='text-sm text-gray-600 flex-1'></Text>
</View>
<View className='flex items-start gap-2'>
<Text className='text-green-500 mt-0'>4.</Text>
<Text className='text-sm text-gray-600 flex-1'></Text>
</View>
</View>
<View className='h-6' />
</ScrollView>
</View>
)
}
export default PromotionPage