feat(dealer/customer): 更新客户跟进情况编辑功能
- 移除了编辑权限检查,现在所有用户都可以编辑跟进情况 - 优化了编辑跟进情况的交互,直接在原位置显示编辑按钮 - 添加了 TypeScript 类型忽略注释,解决类型检查问题
This commit is contained in:
@@ -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,17 +417,15 @@ 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) => {
|
e.stopPropagation();
|
||||||
e.stopPropagation();
|
editComments(customer);
|
||||||
editComments(customer);
|
}}
|
||||||
}}
|
>
|
||||||
>
|
编辑
|
||||||
编辑
|
</Text>
|
||||||
</Text>
|
|
||||||
)}
|
|
||||||
</Space>
|
</Space>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user