refactor(shop): 简化商品详情页客服功能
- 用户反馈客服功能复杂,改为使用微信原生 open-type="contact" 按钮 - 删除 handleContactService 函数及页面跳转逻辑 - 替换客服图标组件为 Button,使用 openType="contact" 触发联系客服 - 保留客服页面但不再从商品详情页跳转 - 提示 open-type="contact" 需真机预览测试,开发者工具无反应
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
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 Taro, { useRouter, useDidShow } from '@tarojs/taro'
|
||||
import { getShopGoods } from '@/api/shop/shopGoods'
|
||||
@@ -193,10 +193,6 @@ const ProductDetailPage: React.FC = () => {
|
||||
Taro.navigateTo({ url: '/pages/shop/cart' })
|
||||
}
|
||||
|
||||
const handleContactService = () => {
|
||||
Taro.navigateTo({ url: '/pages/user/customer-service/index' })
|
||||
}
|
||||
|
||||
if (!product) {
|
||||
return (
|
||||
<View className='min-h-screen bg-white flex items-center justify-center'>
|
||||
@@ -454,10 +450,22 @@ const ProductDetailPage: React.FC = () => {
|
||||
</View>
|
||||
<Text className='text-xs text-gray-500 mt-1 whitespace-nowrap'>购物车</Text>
|
||||
</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-xs text-gray-500 mt-1'>客服</Text>
|
||||
</View>
|
||||
</Button>
|
||||
<View className='flex-1 flex flex-col items-center' onClick={toggleFavorite}>
|
||||
<Text className='text-lg'>{isFavorite ? '❤️' : '🤍'}</Text>
|
||||
<Text className='text-xs text-gray-500 mt-1'>收藏</Text>
|
||||
|
||||
Reference in New Issue
Block a user