refactor(shop): 简化商品详情页客服功能

- 用户反馈客服功能复杂,改为使用微信原生 open-type="contact" 按钮
- 删除 handleContactService 函数及页面跳转逻辑
- 替换客服图标组件为 Button,使用 openType="contact" 触发联系客服
- 保留客服页面但不再从商品详情页跳转
- 提示 open-type="contact" 需真机预览测试,开发者工具无反应
This commit is contained in:
2026-07-14 21:03:26 +08:00
parent 1bab629c83
commit 44b3cb10be
2 changed files with 22 additions and 7 deletions

View File

@@ -285,3 +285,10 @@ adapter `/list` 接口忽略分页,一次返回全部收藏;前端 `listShop
### 验证 ### 验证
- 全局搜索确认无其他 `useNavigate``useReachBottom` 引用 - 全局搜索确认无其他 `useNavigate``useReachBottom` 引用
- TypeScript 检查修改文件无错误 - TypeScript 检查修改文件无错误
### 客服功能简化21:00
- 用户反馈客服功能太复杂用不了,改为直接用微信原生 `open-type="contact"` 按钮
- `src/pages/shop/product-detail.tsx`:客服图标从 `View + onClick navigateTo` 改为 `Button openType="contact" sessionFrom="product_detail"`
- 删除了 `handleContactService` 函数和跳转到 `/pages/user/customer-service/index` 的逻辑
- **注意:`open-type="contact"` 必须真机预览测试,开发者工具中点击无反应**
- `pages/user/customer-service/index` 页面保留但不再从商品详情页跳转

View File

@@ -1,5 +1,5 @@
import React, { useState, useEffect, useRef } from 'react' import React, { useState, useEffect, useRef } from 'react'
import { View, Text, Image, ScrollView, Swiper, SwiperItem, RichText } from '@tarojs/components' import { View, Text, Image, ScrollView, Swiper, SwiperItem, RichText, Button } from '@tarojs/components'
import { Tag } from '@nutui/nutui-react-taro' import { Tag } from '@nutui/nutui-react-taro'
import Taro, { useRouter, useDidShow } from '@tarojs/taro' import Taro, { useRouter, useDidShow } from '@tarojs/taro'
import { getShopGoods } from '@/api/shop/shopGoods' import { getShopGoods } from '@/api/shop/shopGoods'
@@ -193,10 +193,6 @@ const ProductDetailPage: React.FC = () => {
Taro.navigateTo({ url: '/pages/shop/cart' }) Taro.navigateTo({ url: '/pages/shop/cart' })
} }
const handleContactService = () => {
Taro.navigateTo({ url: '/pages/user/customer-service/index' })
}
if (!product) { if (!product) {
return ( return (
<View className='min-h-screen bg-white flex items-center justify-center'> <View className='min-h-screen bg-white flex items-center justify-center'>
@@ -454,10 +450,22 @@ const ProductDetailPage: React.FC = () => {
</View> </View>
<Text className='text-xs text-gray-500 mt-1 whitespace-nowrap'></Text> <Text className='text-xs text-gray-500 mt-1 whitespace-nowrap'></Text>
</View> </View>
<View className='flex-1 flex flex-col items-center' onClick={handleContactService}> <Button
openType="contact"
sessionFrom="product_detail"
className='flex-1 flex flex-col items-center'
style={{
background: 'transparent',
border: 'none',
padding: '0',
margin: '0',
lineHeight: 'normal',
fontSize: 'inherit',
}}
>
<Text className='text-lg'>💬</Text> <Text className='text-lg'>💬</Text>
<Text className='text-xs text-gray-500 mt-1'></Text> <Text className='text-xs text-gray-500 mt-1'></Text>
</View> </Button>
<View className='flex-1 flex flex-col items-center' onClick={toggleFavorite}> <View className='flex-1 flex flex-col items-center' onClick={toggleFavorite}>
<Text className='text-lg'>{isFavorite ? '❤️' : '🤍'}</Text> <Text className='text-lg'>{isFavorite ? '❤️' : '🤍'}</Text>
<Text className='text-xs text-gray-500 mt-1'></Text> <Text className='text-xs text-gray-500 mt-1'></Text>