feat(dealer/customer): 更新客户跟进情况编辑功能

- 移除了编辑权限检查,现在所有用户都可以编辑跟进情况
- 优化了编辑跟进情况的交互,直接在原位置显示编辑按钮
- 添加了 TypeScript 类型忽略注释,解决类型检查问题
This commit is contained in:
2025-09-15 23:46:26 +08:00
parent c17957122e
commit 411e867fd6

View File

@@ -64,15 +64,18 @@ const CustomerIndex = () => {
const editComments = (customer: CustomerUser) => { const editComments = (customer: CustomerUser) => {
Taro.showModal({ Taro.showModal({
title: '编辑跟进情况', title: '编辑跟进情况',
// @ts-ignore
editable: true, editable: true,
placeholderText: '请输入跟进情况', placeholderText: '请输入跟进情况',
content: customer.comments || '', content: customer.comments || '',
success: async (res) => { success: async (res) => {
// @ts-ignore
if (res.confirm && res.content !== undefined) { if (res.confirm && res.content !== undefined) {
try { try {
// 更新跟进情况 // 更新跟进情况
await updateShopDealerApply({ await updateShopDealerApply({
...customer, ...customer,
// @ts-ignore
comments: res.content.trim() 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 => { const calculateProtectDays = (expirationTime?: string, applyTime?: string): number => {
try { try {
@@ -421,7 +417,6 @@ const CustomerIndex = () => {
{/* 显示 comments 字段 */} {/* 显示 comments 字段 */}
<Space className="flex items-center"> <Space className="flex items-center">
<Text className="text-xs text-gray-500">{customer.comments || '暂无'}</Text> <Text className="text-xs text-gray-500">{customer.comments || '暂无'}</Text>
{canEditComments(customer) && (
<Text <Text
className="text-xs text-blue-500 cursor-pointer" className="text-xs text-blue-500 cursor-pointer"
onClick={(e) => { onClick={(e) => {
@@ -431,7 +426,6 @@ const CustomerIndex = () => {
> >
</Text> </Text>
)}
</Space> </Space>
</View> </View>
</View> </View>