From b7e8d52cf0b665a5c2e700cf954d2fb65b123c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Sat, 4 Oct 2025 17:23:13 +0800 Subject: [PATCH] =?UTF-8?q?feat(shop):=20=E6=96=B0=E5=A2=9E=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E8=B7=9F=E8=BF=9B=E8=AE=B0=E5=BD=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增客户跟进记录模型定义 - 实现客户跟进记录的增删改查接口 - 在客户详情页添加跟进记录提交功能 -优化文章列表组件的UI展示效果 - 调整分享功能回调参数处理方式 --- src/api/shop/shopDealerRecord/index.ts | 105 +++++++++++++++++++ src/api/shop/shopDealerRecord/model/index.ts | 39 +++++++ src/cms/category/components/ArticleList.tsx | 18 +++- src/cms/category/index.tsx | 8 +- src/dealer/customer/index.tsx | 7 ++ 5 files changed, 169 insertions(+), 8 deletions(-) create mode 100644 src/api/shop/shopDealerRecord/index.ts create mode 100644 src/api/shop/shopDealerRecord/model/index.ts diff --git a/src/api/shop/shopDealerRecord/index.ts b/src/api/shop/shopDealerRecord/index.ts new file mode 100644 index 0000000..160ac75 --- /dev/null +++ b/src/api/shop/shopDealerRecord/index.ts @@ -0,0 +1,105 @@ +import request from '@/utils/request'; +import type { ApiResult, PageResult } from '@/api'; +import type { ShopDealerRecord, ShopDealerRecordParam } from './model'; + +/** + * 分页查询客户跟进情况 + */ +export async function pageShopDealerRecord(params: ShopDealerRecordParam) { + const res = await request.get>>( + '/shop/shop-dealer-record/page', + { + params + } + ); + if (res.code === 0) { + return res.data; + } + return Promise.reject(new Error(res.message)); +} + +/** + * 查询客户跟进情况列表 + */ +export async function listShopDealerRecord(params?: ShopDealerRecordParam) { + const res = await request.get>( + '/shop/shop-dealer-record', + { + params + } + ); + if (res.code === 0 && res.data) { + return res.data; + } + return Promise.reject(new Error(res.message)); +} + +/** + * 添加客户跟进情况 + */ +export async function addShopDealerRecord(data: ShopDealerRecord) { + const res = await request.post>( + '/shop/shop-dealer-record', + data + ); + if (res.code === 0) { + return res.message; + } + return Promise.reject(new Error(res.message)); +} + +/** + * 修改客户跟进情况 + */ +export async function updateShopDealerRecord(data: ShopDealerRecord) { + const res = await request.put>( + '/shop/shop-dealer-record', + data + ); + if (res.code === 0) { + return res.message; + } + return Promise.reject(new Error(res.message)); +} + +/** + * 删除客户跟进情况 + */ +export async function removeShopDealerRecord(id?: number) { + const res = await request.del>( + '/shop/shop-dealer-record/' + id + ); + if (res.code === 0) { + return res.message; + } + return Promise.reject(new Error(res.message)); +} + +/** + * 批量删除客户跟进情况 + */ +export async function removeBatchShopDealerRecord(data: (number | undefined)[]) { + const res = await request.del>( + '/shop/shop-dealer-record/batch', + { + data + } + ); + if (res.code === 0) { + return res.message; + } + return Promise.reject(new Error(res.message)); +} + +/** + * 根据id查询客户跟进情况 + */ +export async function getShopDealerRecord(id: number) { + const res = await request.get>( + '/shop/shop-dealer-record/' + id + ); + if (res.code === 0 && res.data) { + return res.data; + } + return Promise.reject(new Error(res.message)); +} diff --git a/src/api/shop/shopDealerRecord/model/index.ts b/src/api/shop/shopDealerRecord/model/index.ts new file mode 100644 index 0000000..c32e9a7 --- /dev/null +++ b/src/api/shop/shopDealerRecord/model/index.ts @@ -0,0 +1,39 @@ +import type { PageParam } from '@/api'; + +/** + * 客户跟进情况 + */ +export interface ShopDealerRecord { + // ID + id?: number; + // 上级id, 0是顶级 + parentId?: number; + // 客户ID + dealerId?: number; + // 内容 + content?: string; + // 用户ID + userId?: number; + // 排序(数字越小越靠前) + sortNumber?: number; + // 备注 + comments?: string; + // 状态, 0待处理, 1已完成 + status?: number; + // 是否删除, 0否, 1是 + deleted?: number; + // 租户id + tenantId?: number; + // 创建时间 + createTime?: string; + // 修改时间 + updateTime?: string; +} + +/** + * 客户跟进情况搜索条件 + */ +export interface ShopDealerRecordParam extends PageParam { + id?: number; + keywords?: string; +} diff --git a/src/cms/category/components/ArticleList.tsx b/src/cms/category/components/ArticleList.tsx index 3f46857..ffe5d29 100644 --- a/src/cms/category/components/ArticleList.tsx +++ b/src/cms/category/components/ArticleList.tsx @@ -1,15 +1,25 @@ import {Image, Cell} from '@nutui/nutui-react-taro' +import {View, Text} from '@tarojs/components' import Taro from '@tarojs/taro' const ArticleList = (props: any) => { return ( <> -
- {props.data.map((item, index) => { + + {props.data.map((item: any, index: number) => { return ( + {item.title} + {item.comments && ( + + {item.comments} + + )} + + } extra={ } @@ -18,7 +28,7 @@ const ArticleList = (props: any) => { /> ) })} -
+ ) } diff --git a/src/cms/category/index.tsx b/src/cms/category/index.tsx index 7ba9010..abc216f 100644 --- a/src/cms/category/index.tsx +++ b/src/cms/category/index.tsx @@ -53,11 +53,11 @@ function Category() { return { title: `${nav?.categoryName}_九运售电云`, path: `/shop/category/index?id=${categoryId}`, - success: function (res) { - console.log('分享成功', res); + success: function () { + console.log('分享成功'); }, - fail: function (res) { - console.log('分享失败', res); + fail: function () { + console.log('分享失败'); } }; }); diff --git a/src/dealer/customer/index.tsx b/src/dealer/customer/index.tsx index 14ec7dd..4aaaa26 100644 --- a/src/dealer/customer/index.tsx +++ b/src/dealer/customer/index.tsx @@ -15,6 +15,7 @@ import { import FixedButton from "@/components/FixedButton"; import navTo from "@/utils/common"; import {pageShopDealerApply, removeShopDealerApply, updateShopDealerApply} from "@/api/shop/shopDealerApply"; +import {addShopDealerRecord} from "@/api/shop/shopDealerRecord"; // 扩展User类型,添加客户状态和保护天数 interface CustomerUser extends UserType { @@ -73,6 +74,12 @@ const CustomerIndex = () => { // @ts-ignore if (res.confirm && res.content !== undefined) { try { + // 添加跟进记录 + await addShopDealerRecord({ + dealerId: customer.userId, + // @ts-ignore + content: res.content.trim() + }) // 更新跟进情况 await updateShopDealerApply({ ...customer,