feat(dealer/customer): 更新客户跟进情况编辑功能
- 移除了编辑权限检查,现在所有用户都可以编辑跟进情况 - 优化了编辑跟进情况的交互,直接在原位置显示编辑按钮 - 添加了 TypeScript 类型忽略注释,解决类型检查问题
This commit is contained in:
@@ -64,15 +64,18 @@ const CustomerIndex = () => {
|
||||
const editComments = (customer: CustomerUser) => {
|
||||
Taro.showModal({
|
||||
title: '编辑跟进情况',
|
||||
// @ts-ignore
|
||||
editable: true,
|
||||
placeholderText: '请输入跟进情况',
|
||||
content: customer.comments || '',
|
||||
success: async (res) => {
|
||||
// @ts-ignore
|
||||
if (res.confirm && res.content !== undefined) {
|
||||
try {
|
||||
// 更新跟进情况
|
||||
await updateShopDealerApply({
|
||||
...customer,
|
||||
// @ts-ignore
|
||||
comments: res.content.trim()
|
||||
});
|
||||
|
||||
@@ -98,13 +101,6 @@ const CustomerIndex = () => {
|
||||
});
|
||||
};
|
||||
|
||||
// 检查是否有编辑权限
|
||||
const canEditComments = (customer: CustomerUser): boolean => {
|
||||
const currentUserId = Taro.getStorageSync('UserId');
|
||||
// 只有客户的报备人可以编辑跟进情况
|
||||
return customer.userId === currentUserId;
|
||||
};
|
||||
|
||||
// 计算剩余保护天数(基于过期时间)
|
||||
const calculateProtectDays = (expirationTime?: string, applyTime?: string): number => {
|
||||
try {
|
||||
@@ -421,17 +417,15 @@ const CustomerIndex = () => {
|
||||
{/* 显示 comments 字段 */}
|
||||
<Space className="flex items-center">
|
||||
<Text className="text-xs text-gray-500">跟进情况:{customer.comments || '暂无'}</Text>
|
||||
{canEditComments(customer) && (
|
||||
<Text
|
||||
className="text-xs text-blue-500 cursor-pointer"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
editComments(customer);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Text>
|
||||
)}
|
||||
<Text
|
||||
className="text-xs text-blue-500 cursor-pointer"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
editComments(customer);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Text>
|
||||
</Space>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user