feat(dealer/team): 实现经销商团队多层级查看功能

- 添加层级栈管理,支持返回上一层功能
- 增加加载状态显示
- 优化团队成员列表展示,增加可查看下级成员的提示
- 添加返回上一层按钮
- 修复了一些与团队成员数据相关的小问题
This commit is contained in:
2025-09-05 23:36:13 +08:00
parent 408ff13590
commit 92662a869b
5 changed files with 169 additions and 87 deletions

View File

@@ -14,10 +14,10 @@ import {useUniversalScanner} from "@/components/UniversalScanner";
function UserCard() {
const {
user,
isAdmin,
isLoggedIn,
loginUser,
fetchUserInfo,
isAdmin,
getDisplayName,
getRoleName
} = useUser();
@@ -33,6 +33,7 @@ function UserCard() {
}
});
console.log(startScan, 'startScan')
useEffect(() => {
// Taro.getSetting获取用户的当前设置。返回值中只会出现小程序已经向用户请求过的权限。
Taro.getSetting({
@@ -189,7 +190,7 @@ function UserCard() {
)
}
<View className={'user-info flex flex-col px-2'}>
<View className={'py-1 text-black font-bold'}>{getDisplayName()}</View>
<View className={'py-1 text-black font-bold max-w-28'}>{getDisplayName()}</View>
{isLoggedIn ? (
<View className={'grade text-xs py-1'}>
<Tag type="success" round>
@@ -201,51 +202,12 @@ function UserCard() {
) : ''}
</View>
</View>
{isLoggedIn && (
<View
onClick={() => {
console.log('扫码按钮被点击了');
// 检查 Taro.scanCode 是否存在
if (typeof Taro.scanCode === 'function') {
console.log('Taro.scanCode 函数存在');
// 直接测试 Taro.scanCode
Taro.scanCode({
success: (res) => {
console.log('直接扫码成功:', res.result);
Taro.showModal({
title: '扫码成功',
content: res.result,
showCancel: false
});
},
fail: (err) => {
console.error('直接扫码失败:', err);
Taro.showModal({
title: '扫码失败',
content: `错误信息: ${JSON.stringify(err)}`,
showCancel: false
});
}
});
} else {
console.error('Taro.scanCode 函数不存在');
Taro.showModal({
title: '错误',
content: 'Taro.scanCode 函数不存在,请检查 Taro 版本',
showCancel: false
});
}
}}
className="p-2 bg-blue-100 rounded cursor-pointer"
>
<Scan className="text-blue-500" />
<View className={'gap-2 flex items-center'}>
{isAdmin() && <Scan className={'text-gray-900'} size={24} onClick={() => navTo('/user/store/verification', true)} />}
<View className={'mr-4 text-sm px-3 py-1 text-black border-gray-400 border-solid border-2 rounded-3xl'}
onClick={() => navTo('/user/profile/profile', true)}>
{'个人资料'}
</View>
)}
<View className={'mr-4 text-sm px-3 py-1 text-black border-gray-400 border-solid border-2 rounded-3xl'}
onClick={() => navTo('/user/profile/profile', true)}>
{'个人资料'}
</View>
</View>
<View className={'flex justify-around mt-1'}>