diff --git a/src/api/shop/shopDealerApply/model/index.ts b/src/api/shop/shopDealerApply/model/index.ts
index 3370cde..3187633 100644
--- a/src/api/shop/shopDealerApply/model/index.ts
+++ b/src/api/shop/shopDealerApply/model/index.ts
@@ -8,8 +8,6 @@ export interface ShopDealerApply {
applyId?: number;
// 用户ID
userId?: number;
- // 昵称
- nickname?: string;
// 姓名
realName?: string;
// 分销商名称
@@ -46,6 +44,10 @@ export interface ShopDealerApply {
expirationTime?: string;
// 备注
comments?: string;
+ // 昵称
+ nickName?: string;
+ // 推荐人名称
+ refereeName?: string;
}
/**
diff --git a/src/dealer/customer/index.tsx b/src/dealer/customer/index.tsx
index 39b2f25..85c8d5f 100644
--- a/src/dealer/customer/index.tsx
+++ b/src/dealer/customer/index.tsx
@@ -2,7 +2,7 @@ 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} from '@nutui/nutui-react-taro'
-import {Phone} from '@nutui/icons-react-taro'
+import {Phone, AngleDoubleLeft} from '@nutui/icons-react-taro'
import type {ShopDealerApply, ShopDealerApply as UserType} from "@/api/shop/shopDealerApply/model";
import {
CustomerStatus,
@@ -60,6 +60,51 @@ const CustomerIndex = () => {
});
};
+ // 编辑跟进情况
+ const editComments = (customer: CustomerUser) => {
+ Taro.showModal({
+ title: '编辑跟进情况',
+ editable: true,
+ placeholderText: '请输入跟进情况',
+ content: customer.comments || '',
+ success: async (res) => {
+ if (res.confirm && res.content !== undefined) {
+ try {
+ // 更新跟进情况
+ await updateShopDealerApply({
+ ...customer,
+ comments: res.content.trim()
+ });
+
+ Taro.showToast({
+ title: '更新成功',
+ icon: 'success'
+ });
+
+ // 刷新列表
+ setList([]);
+ setPage(1);
+ setHasMore(true);
+ fetchCustomerData(activeTab, true);
+ } catch (error) {
+ console.error('更新跟进情况失败:', error);
+ Taro.showToast({
+ title: '更新失败,请重试',
+ icon: 'error'
+ });
+ }
+ }
+ }
+ });
+ };
+
+ // 检查是否有编辑权限
+ const canEditComments = (customer: CustomerUser): boolean => {
+ const currentUserId = Taro.getStorageSync('UserId');
+ // 只有客户的报备人可以编辑跟进情况
+ return customer.userId === currentUserId;
+ };
+
// 计算剩余保护天数(基于过期时间)
const calculateProtectDays = (expirationTime?: string, applyTime?: string): number => {
try {
@@ -321,7 +366,7 @@ const CustomerIndex = () => {
}}>联系电话:{customer.mobile}
{
e.stopPropagation();
@@ -339,9 +384,6 @@ const CustomerIndex = () => {
- {/* 显示 comments 字段 */}
- 跟进情况:{customer.comments || '暂无'}编辑
- {customer.userId && 报备人:{ customer?.nickname }}
添加时间:{customer.createTime}
@@ -350,7 +392,7 @@ const CustomerIndex = () => {
{/* 保护天数显示 */}
{customer.applyStatus === 10 && (
-
+
保护期:
{customer.protectDays && customer.protectDays > 0 ? (
{
)}
)}
+
+
+ 报备人:{customer?.nickName}
+
+ {customer?.refereeName}
+
+
+ {/* 显示 comments 字段 */}
+
+ 跟进情况:{customer.comments || '暂无'}
+ {canEditComments(customer) && (
+ {
+ e.stopPropagation();
+ editComments(customer);
+ }}
+ >
+ 编辑
+
+ )}
+
diff --git a/src/dealer/customer/trading.tsx b/src/dealer/customer/trading.tsx
index f5bb0a5..0ef4c71 100644
--- a/src/dealer/customer/trading.tsx
+++ b/src/dealer/customer/trading.tsx
@@ -1,4 +1,4 @@
-import {useState, useEffect, useCallback} from 'react'
+import {useState, useCallback} from 'react'
import {View, Text} from '@tarojs/components'
import Taro from '@tarojs/taro'
import {Loading, InfiniteLoading, Empty, Space, SearchBar} from '@nutui/nutui-react-taro'
@@ -88,13 +88,15 @@ const CustomerTrading = () => {
return list;
};
- // 初始化数据
- useEffect(() => {
- fetchCustomerData(true).then();
- }, []);
-
// 搜索处理函数
const handleSearch = (keyword: string) => {
+ if(keyword.length < 3){
+ Taro.showToast({
+ title: '请输入至少3个字符',
+ icon: 'none'
+ });
+ return;
+ }
setSearchValue(keyword);
setList([]);
setPage(1);
@@ -190,7 +192,6 @@ const CustomerTrading = () => {
setSearchValue(value)}
onSearch={(value) => handleSearch(value)}
onClear={() => handleClearSearch()}
/>