feat(user): 新增收货地址管理及售后申请页面
- 新增地址类型定义,增强前端地址数据结构 - 新增地址编辑页面,支持地址智能识别和定位选点功能 - 地址编辑支持省市区选择及默认地址设置 - 新增地址列表页面,支持地址展示、删除、编辑和选择功能 - 实现售后申请页面,支持选择售后类型和退款原因 - 售后申请支持商品选择、退款金额计算和凭证上传 - 新增售后详情页面,支持售后状态展示及申请取消 - 优化页面加载和用户交互体验,增加错误提示和权限处理
This commit is contained in:
@@ -85,15 +85,8 @@ const ProductDetailPage: React.FC = () => {
|
||||
setIsFavorite(true)
|
||||
Taro.showToast({ title: '收藏成功', icon: 'success' })
|
||||
}
|
||||
} catch (err: any) {
|
||||
// 接口报错时仍更新UI状态,避免状态不一致
|
||||
console.error('[ProductDetail] 收藏操作失败:', err?.message || err)
|
||||
if (isFavorite) {
|
||||
setIsFavorite(false)
|
||||
} else {
|
||||
setIsFavorite(true)
|
||||
}
|
||||
// 不再额外弹toast(handleError已经弹了后端返回的错误信息)
|
||||
} catch (e: any) {
|
||||
Taro.showToast({ title: e?.message || '操作失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,12 +158,10 @@ const ProductDetailPage: React.FC = () => {
|
||||
}
|
||||
|
||||
const handleGoCart = () => {
|
||||
// 购物车不是 tabBar 页面,使用 navigateTo;路径与 app.config.ts 中注册的 'pages/shop/cart' 对应
|
||||
Taro.navigateTo({ url: '/pages/shop/cart' })
|
||||
}
|
||||
|
||||
const handleContactService = () => {
|
||||
// 直接跳转到在线客服页面(已实现完整功能:微信客服按钮 + 历史消息 + 热线 + 微信留言)
|
||||
Taro.navigateTo({ url: '/pages/user/customer-service/index' })
|
||||
}
|
||||
|
||||
@@ -214,7 +205,6 @@ const ProductDetailPage: React.FC = () => {
|
||||
'<img src="$2" mode="widthFix" style="max-width:100%;display:block;" />'
|
||||
)
|
||||
// 兜底:如果内容里直接包含 http(s) 图片链接(非 img 标签包裹的),也尝试转成图片
|
||||
// 匹配独立的 https://xxx.jpg/png/gif 链接
|
||||
if (html.includes('http') && !html.includes('<img')) {
|
||||
html = html.replace(
|
||||
/(https?:\/\/[^\s\)]+\.(jpg|jpeg|png|gif|webp)(\?[^\s\)]*)?)/gi,
|
||||
@@ -229,44 +219,44 @@ const ProductDetailPage: React.FC = () => {
|
||||
<ScrollView scrollY style={{ height: scrollHeight }}>
|
||||
|
||||
{/* 图片轮播 */}
|
||||
<Swiper
|
||||
className='w-full'
|
||||
style={{ height: `${swiperHeight}px` }}
|
||||
indicatorDots
|
||||
indicatorColor='#e5e7eb'
|
||||
indicatorActiveColor='#0e932e'
|
||||
autoplay
|
||||
circular
|
||||
>
|
||||
{images.map((img, idx) => (
|
||||
<SwiperItem key={idx}>
|
||||
<Image
|
||||
className='w-full'
|
||||
style={{ display: 'block' }}
|
||||
src={img}
|
||||
mode='widthFix'
|
||||
onLoad={(e: any) => {
|
||||
// 根据第一张图片的实际宽高比动态设置 Swiper 高度
|
||||
if (idx === 0) {
|
||||
const { width, height } = e.detail
|
||||
if (width > 0) {
|
||||
const screenWidth = Taro.getSystemInfoSync().windowWidth
|
||||
setSwiperHeight(Math.round((height / width) * screenWidth))
|
||||
}
|
||||
}
|
||||
}}
|
||||
onClick={() => Taro.previewImage({ current: img, urls: images })}
|
||||
/>
|
||||
</SwiperItem>
|
||||
))}
|
||||
{images.length === 0 && (
|
||||
<SwiperItem>
|
||||
<View className='w-full h-full bg-gray-100 flex items-center justify-center'>
|
||||
<Text className='text-gray-300 text-sm'>暂无图片</Text>
|
||||
</View>
|
||||
</SwiperItem>
|
||||
)}
|
||||
</Swiper>
|
||||
<Swiper
|
||||
className='w-full'
|
||||
style={{ height: `${swiperHeight}px` }}
|
||||
indicatorDots
|
||||
indicatorColor='#e5e7eb'
|
||||
indicatorActiveColor='#0e932e'
|
||||
autoplay
|
||||
circular
|
||||
>
|
||||
{images.map((img, idx) => (
|
||||
<SwiperItem key={idx}>
|
||||
<Image
|
||||
className='w-full'
|
||||
style={{ display: 'block' }}
|
||||
src={img}
|
||||
mode='widthFix'
|
||||
onLoad={(e: any) => {
|
||||
// 根据第一张图片的实际宽高比动态设置 Swiper 高度
|
||||
if (idx === 0) {
|
||||
const { width, height } = e.detail
|
||||
if (width > 0) {
|
||||
const screenWidth = Taro.getSystemInfoSync().windowWidth
|
||||
setSwiperHeight(Math.round((height / width) * screenWidth))
|
||||
}
|
||||
}
|
||||
}}
|
||||
onClick={() => Taro.previewImage({ current: img, urls: images })}
|
||||
/>
|
||||
</SwiperItem>
|
||||
))}
|
||||
{images.length === 0 && (
|
||||
<SwiperItem>
|
||||
<View className='w-full h-full bg-gray-100 flex items-center justify-center'>
|
||||
<Text className='text-gray-300 text-sm'>暂无图片</Text>
|
||||
</View>
|
||||
</SwiperItem>
|
||||
)}
|
||||
</Swiper>
|
||||
|
||||
{/* 价格区域 */}
|
||||
<View className='bg-white p-4'>
|
||||
|
||||
Reference in New Issue
Block a user