refactor(customer): 优化客户数据查询和表单字段校验

- 移除新增客户页面对手机号的必填和格式校验
- 修改手机号字段标签为“手机号/微信号”,取消必填和长度限制
- 新增判断当前用户是否为超级管理员逻辑
- 抽取并统一构建客户查询参数方法,根据权限动态设置筛选条件
- 优化客户列表数据获取逻辑,支持超级管理员查看全部客户
- 调整依赖项,更新使用了新构建的查询参数函数
- 增强状态统计接口参数构建,统一调用参数生成函数
- 优化副作用 Hook 依赖,保证数据加载时机正确
This commit is contained in:
2026-06-04 15:21:56 +08:00
parent ca4f1c2a77
commit 812df56f8c
10 changed files with 425 additions and 311 deletions

View File

@@ -2,7 +2,7 @@ import {Cell} from '@nutui/nutui-react-taro'
import navTo from "@/utils/common";
import Taro from '@tarojs/taro'
import {View, Text} from '@tarojs/components'
import {ArrowRight, LogisticsError, Tips, Ask} from '@nutui/icons-react-taro'
import {ArrowRight, LogisticsError} from '@nutui/icons-react-taro'
import {useUser} from '@/hooks/useUser'
const UserCell = () => {
@@ -26,13 +26,36 @@ const UserCell = () => {
return (
<>
<View className={'px-4'}>
<View className={'p-4'}>
<Cell.Group divider={true} description={
<View style={{display: 'inline-flex', alignItems: 'center'}}>
<Text style={{marginTop: '12px'}}></Text>
</View>
}>
<Cell.Group divider={true}>
<Cell
className="nutui-cell-clickable"
title="后台管理"
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => Taro.reLaunch({url: '/pages/index/index'})}
/>
</Cell.Group>
<Cell.Group divider={true}>
<Cell
className="nutui-cell-clickable"
title="个人资料"
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => navTo('/user/profile/profile', true)}
/>
</Cell.Group>
<Cell.Group divider={true}>
<Cell
className="nutui-cell-clickable"
title="退出登录"
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={onLogout}
/>
</Cell.Group>
<Cell
className="nutui-cell-clickable"
style={{
@@ -81,62 +104,42 @@ const UserCell = () => {
{/* navTo('/user/userVerify/index', true)*/}
{/* }}*/}
{/*/>*/}
<Cell
className="nutui-cell-clickable"
title={
<View style={{display: 'inline-flex', alignItems: 'center'}}>
<Ask size={16}/>
<Text className={'pl-3 text-sm'}></Text>
</View>
}
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => {
navTo('/user/help/index')
}}
/>
<Cell
className="nutui-cell-clickable"
title={
<View style={{display: 'inline-flex', alignItems: 'center'}}>
<Tips size={16}/>
<Text className={'pl-3 text-sm'}></Text>
</View>
}
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => {
navTo('/user/about/index')
}}
/>
</Cell.Group>
<Cell.Group divider={true} description={
<View style={{display: 'inline-flex', alignItems: 'center'}}>
<Text style={{marginTop: '12px'}}></Text>
</View>
}>
<Cell
className="nutui-cell-clickable"
title="个人资料"
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => navTo('/user/profile/profile', true)}
/>
<Cell
className="nutui-cell-clickable"
title="返回首页"
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => Taro.reLaunch({url: '/pages/index/index'})}
/>
<Cell
className="nutui-cell-clickable"
title="退出登录"
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={onLogout}
/>
</Cell.Group>
{/* <Cell*/}
{/* className="nutui-cell-clickable"*/}
{/* title={*/}
{/* <View style={{display: 'inline-flex', alignItems: 'center'}}>*/}
{/* <Ask size={16}/>*/}
{/* <Text className={'pl-3 text-sm'}>常见问题</Text>*/}
{/* </View>*/}
{/* }*/}
{/* align="center"*/}
{/* extra={<ArrowRight color="#cccccc" size={18}/>}*/}
{/* onClick={() => {*/}
{/* navTo('/user/help/index')*/}
{/* }}*/}
{/* />*/}
{/* <Cell*/}
{/* className="nutui-cell-clickable"*/}
{/* title={*/}
{/* <View style={{display: 'inline-flex', alignItems: 'center'}}>*/}
{/* <Tips size={16}/>*/}
{/* <Text className={'pl-3 text-sm'}>关于我们</Text>*/}
{/* </View>*/}
{/* }*/}
{/* align="center"*/}
{/* extra={<ArrowRight color="#cccccc" size={18}/>}*/}
{/* onClick={() => {*/}
{/* navTo('/user/about/index')*/}
{/* }}*/}
{/* />*/}
{/*</Cell.Group>*/}
{/*<Cell.Group divider={true} description={*/}
{/* <View style={{display: 'inline-flex', alignItems: 'center'}}>*/}
{/* <Text style={{marginTop: '12px'}}>账号管理</Text>*/}
{/* </View>*/}
{/*}>*/}
{/*</Cell.Group>*/}
</View>
</>
)