Compare commits
4 Commits
099855e121
...
1c7f35b40f
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c7f35b40f | |||
| a2009c8cea | |||
| 2ff740fb07 | |||
| b5f66017cf |
@@ -35,5 +35,5 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"lastUpdated": 1776330360601
|
||||
"lastUpdated": 1776332994640
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
## Grid.tsx 硬编码改造 (13:48)
|
||||
- 将首页4个功能按钮从后端接口请求改为硬编码
|
||||
- 菜单项:我要推荐、客户列表、邀请好友、个人中心
|
||||
- 菜单项:推荐客户、客户列表、邀请好友、个人中心
|
||||
- 图片使用OSS直链,避免接口延迟
|
||||
- 对应页面路径保持不变
|
||||
|
||||
|
||||
@@ -2,22 +2,22 @@
|
||||
export const ENV_CONFIG = {
|
||||
// 开发环境
|
||||
development: {
|
||||
// API_BASE_URL: 'https://mp-api.websoft.top/api',
|
||||
API_BASE_URL: 'http://127.0.0.1:9200/api',
|
||||
API_BASE_URL: 'https://cms-api.websoft.top/api',
|
||||
// API_BASE_URL: 'http://127.0.0.1:9200/api',
|
||||
APP_NAME: '开发环境',
|
||||
DEBUG: 'true',
|
||||
},
|
||||
// 生产环境
|
||||
production: {
|
||||
// API_BASE_URL: 'https://mp-api.websoft.top/api',
|
||||
API_BASE_URL: 'http://127.0.0.1:9200/api',
|
||||
API_BASE_URL: 'https://cms-api.websoft.top/api',
|
||||
// API_BASE_URL: 'http://127.0.0.1:9200/api',
|
||||
APP_NAME: '南南佐顿门窗',
|
||||
DEBUG: 'false',
|
||||
},
|
||||
// 测试环境
|
||||
test: {
|
||||
// API_BASE_URL: 'https://mp-api.websoft.top/api',
|
||||
API_BASE_URL: 'http://127.0.0.1:9200/api',
|
||||
API_BASE_URL: 'https://cms-api.websoft.top/api',
|
||||
// API_BASE_URL: 'http://127.0.0.1:9200/api',
|
||||
APP_NAME: '测试环境',
|
||||
DEBUG: 'true',
|
||||
}
|
||||
|
||||
@@ -66,4 +66,5 @@ export interface ShopDealerApplyParam extends PageParam {
|
||||
userId?: number;
|
||||
keywords?: string;
|
||||
applyStatus?: number; // 申请状态筛选 (10待审核 20审核通过 30驳回)
|
||||
receptionistId?: number; // 接待人员用户ID(用于查询分配给自己的客户)
|
||||
}
|
||||
|
||||
1549
src/dealer/customer/add-bak.tsx
Normal file
1549
src/dealer/customer/add-bak.tsx
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
import {useState, useEffect, useCallback, useRef} from 'react'
|
||||
import {useState, useEffect, useCallback} from 'react'
|
||||
import {View, Text} from '@tarojs/components'
|
||||
import Taro, {useDidShow} from '@tarojs/taro'
|
||||
import {Loading, InfiniteLoading, Empty, Space, Tabs, TabPane, Tag, Button, SearchBar} from '@nutui/nutui-react-taro'
|
||||
@@ -33,24 +33,10 @@ const CustomerIndex = () => {
|
||||
const [page, setPage] = useState(1)
|
||||
const [hasMore, setHasMore] = useState(true)
|
||||
|
||||
// 非分销商不允许查看客户列表
|
||||
const {user, hasRole, loading: userLoading} = useUser()
|
||||
// 管理员允许查看全部;普通分销商仅查看自己
|
||||
const isAdminUser = user?.isAdmin === true
|
||||
const canView = hasRole('dealer') || isAdminUser
|
||||
// 权限检查:只要登录就能查看客户列表
|
||||
const {user, loading: userLoading} = useUser()
|
||||
const roleCheckFinished = !userLoading
|
||||
const noPermissionShownRef = useRef(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (!roleCheckFinished || canView) return
|
||||
if (noPermissionShownRef.current) return
|
||||
noPermissionShownRef.current = true
|
||||
Taro.showToast({
|
||||
title: '没有查看权限',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}, [roleCheckFinished, canView])
|
||||
const isLoggedIn = roleCheckFinished && user !== null
|
||||
|
||||
// Tab配置
|
||||
const tabList = getStatusOptions();
|
||||
@@ -201,14 +187,13 @@ const CustomerIndex = () => {
|
||||
const currentUserId = Number(Taro.getStorageSync('UserId')) || user?.userId || 0;
|
||||
|
||||
// 构建API参数,根据状态筛选
|
||||
// 查看自己提交的(userId)或分配给自己的(receptionistId)的客户
|
||||
const params: any = {
|
||||
type: 4,
|
||||
page: currentPage
|
||||
page: currentPage,
|
||||
userId: currentUserId,
|
||||
receptionistId: currentUserId
|
||||
};
|
||||
// 非管理员:只看自己添加的客户
|
||||
if (!isAdminUser && currentUserId > 0) {
|
||||
params.userId = currentUserId;
|
||||
}
|
||||
const applyStatus = mapCustomerStatusToApplyStatus(statusFilter || activeTab);
|
||||
if (applyStatus !== undefined) {
|
||||
params.applyStatus = applyStatus;
|
||||
@@ -251,7 +236,7 @@ const CustomerIndex = () => {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [activeTab, page, isAdminUser, user?.userId]);
|
||||
}, [activeTab, page, user?.userId]);
|
||||
|
||||
const reloadMore = async () => {
|
||||
if (loading || !hasMore) return; // 防止重复加载
|
||||
@@ -300,11 +285,11 @@ const CustomerIndex = () => {
|
||||
const fetchStatusCounts = useCallback(async () => {
|
||||
try {
|
||||
const currentUserId = Number(Taro.getStorageSync('UserId')) || user?.userId || 0;
|
||||
const baseParams: any = {type: 4};
|
||||
// 非管理员:只统计自己添加的客户
|
||||
if (!isAdminUser && currentUserId > 0) {
|
||||
baseParams.userId = currentUserId;
|
||||
}
|
||||
const baseParams: any = {
|
||||
type: 4,
|
||||
userId: currentUserId,
|
||||
receptionistId: currentUserId
|
||||
};
|
||||
|
||||
// 并行获取各状态的数量
|
||||
const [allRes, pendingRes, signedRes, cancelledRes] = await Promise.all([
|
||||
@@ -323,7 +308,7 @@ const CustomerIndex = () => {
|
||||
} catch (error) {
|
||||
console.error('获取状态统计失败:', error);
|
||||
}
|
||||
}, [isAdminUser, user?.userId]);
|
||||
}, [user?.userId]);
|
||||
|
||||
const getStatusCounts = () => statusCounts;
|
||||
|
||||
@@ -364,22 +349,22 @@ const CustomerIndex = () => {
|
||||
|
||||
// 初始化统计数据
|
||||
useEffect(() => {
|
||||
if (!roleCheckFinished || !canView) return;
|
||||
if (!isLoggedIn) return;
|
||||
fetchStatusCounts().then();
|
||||
}, [roleCheckFinished, canView]);
|
||||
}, [isLoggedIn]);
|
||||
|
||||
// 当activeTab变化时重新获取数据
|
||||
useEffect(() => {
|
||||
if (!roleCheckFinished || !canView) return;
|
||||
if (!isLoggedIn) return;
|
||||
setList([]); // 清空列表
|
||||
setPage(1); // 重置页码
|
||||
setHasMore(true); // 重置加载状态
|
||||
fetchCustomerData(activeTab, true);
|
||||
}, [activeTab, roleCheckFinished, canView]);
|
||||
}, [activeTab, isLoggedIn]);
|
||||
|
||||
// 监听页面显示,当从其他页面返回时刷新数据
|
||||
useDidShow(() => {
|
||||
if (!roleCheckFinished || !canView) return;
|
||||
if (!isLoggedIn) return;
|
||||
// 刷新当前tab的数据和统计信息
|
||||
setList([]);
|
||||
setPage(1);
|
||||
@@ -593,10 +578,11 @@ const CustomerIndex = () => {
|
||||
);
|
||||
}
|
||||
|
||||
if (!canView) {
|
||||
// 未登录时显示提示
|
||||
if (!isLoggedIn) {
|
||||
return (
|
||||
<View className="bg-white flex flex-col items-center justify-center p-4">
|
||||
<Empty description="没有查看权限"/>
|
||||
<Empty description="请先登录"/>
|
||||
<Button
|
||||
size="small"
|
||||
style={{marginTop: '12px'}}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "推荐客户赚佣金"
|
||||
}
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '推荐客户赚佣金'
|
||||
})
|
||||
|
||||
@@ -52,7 +52,7 @@ const highlightItems = [
|
||||
{
|
||||
icon: <Star size={22} color="#ffffff" />,
|
||||
title: '真实口碑',
|
||||
description: '5000+家庭选择,98%满意度,支持老房换窗与整屋升级。'
|
||||
description: '10万+家庭选择,98%满意度,支持老房换窗与整屋升级。'
|
||||
}
|
||||
]
|
||||
|
||||
@@ -220,15 +220,15 @@ const BrochurePage: React.FC = () => {
|
||||
|
||||
<View className="brochure-page__stats">
|
||||
<View className="brochure-page__stat">
|
||||
<Text className="brochure-page__stat-value">10年</Text>
|
||||
<Text className="brochure-page__stat-label">质保承诺</Text>
|
||||
<Text className="brochure-page__stat-value">20年</Text>
|
||||
<Text className="brochure-page__stat-label">质保承诺(整窗)</Text>
|
||||
</View>
|
||||
<View className="brochure-page__stat">
|
||||
<Text className="brochure-page__stat-value">15年</Text>
|
||||
<Text className="brochure-page__stat-label">安装经验</Text>
|
||||
</View>
|
||||
<View className="brochure-page__stat">
|
||||
<Text className="brochure-page__stat-value">5000+</Text>
|
||||
<Text className="brochure-page__stat-value">10万+</Text>
|
||||
<Text className="brochure-page__stat-label">家庭选择</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -14,7 +14,7 @@ interface MenuItem {
|
||||
const menuList: MenuItem[] = [
|
||||
{
|
||||
id: 1,
|
||||
title: '我要推荐',
|
||||
title: '推荐客户',
|
||||
icon: 'https://oss.wsdns.cn/20260330/5f54527123864193b0a2078f812b117f.png?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90',
|
||||
path: '/dealer/customer/add'
|
||||
},
|
||||
|
||||
@@ -12,8 +12,8 @@ const TrustSection: React.FC = () => {
|
||||
{
|
||||
icon: <ShieldCheck size={28} color="#ffffff" />,
|
||||
title: '品质保障',
|
||||
highlight: '10年',
|
||||
description: '质保承诺',
|
||||
highlight: '20年',
|
||||
description: '质保承诺(整窗)',
|
||||
subDescription: '德国进口五金配件',
|
||||
bg: 'linear-gradient(135deg, #3b82f6, #2563eb)',
|
||||
},
|
||||
@@ -30,7 +30,7 @@ const TrustSection: React.FC = () => {
|
||||
title: '客户好评',
|
||||
highlight: '98%',
|
||||
description: '满意度',
|
||||
subDescription: '5000+家庭信赖之选',
|
||||
subDescription: '10万+家庭信赖之选',
|
||||
bg: 'linear-gradient(135deg, #f59e0b, #d97706)',
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user