feat(shop): 新增客户跟进记录功能
- 新增客户跟进记录模型定义 - 实现客户跟进记录的增删改查接口 - 在客户详情页添加跟进记录提交功能 -优化文章列表组件的UI展示效果 - 调整分享功能回调参数处理方式
This commit is contained in:
105
src/api/shop/shopDealerRecord/index.ts
Normal file
105
src/api/shop/shopDealerRecord/index.ts
Normal file
@@ -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<ApiResult<PageResult<ShopDealerRecord>>>(
|
||||||
|
'/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<ApiResult<ShopDealerRecord[]>>(
|
||||||
|
'/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<ApiResult<unknown>>(
|
||||||
|
'/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<ApiResult<unknown>>(
|
||||||
|
'/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<ApiResult<unknown>>(
|
||||||
|
'/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<ApiResult<unknown>>(
|
||||||
|
'/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<ApiResult<ShopDealerRecord>>(
|
||||||
|
'/shop/shop-dealer-record/' + id
|
||||||
|
);
|
||||||
|
if (res.code === 0 && res.data) {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.message));
|
||||||
|
}
|
||||||
39
src/api/shop/shopDealerRecord/model/index.ts
Normal file
39
src/api/shop/shopDealerRecord/model/index.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
@@ -1,15 +1,25 @@
|
|||||||
import {Image, Cell} from '@nutui/nutui-react-taro'
|
import {Image, Cell} from '@nutui/nutui-react-taro'
|
||||||
|
import {View, Text} from '@tarojs/components'
|
||||||
import Taro from '@tarojs/taro'
|
import Taro from '@tarojs/taro'
|
||||||
|
|
||||||
const ArticleList = (props: any) => {
|
const ArticleList = (props: any) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={'px-3'}>
|
<View className={'px-3'}>
|
||||||
{props.data.map((item, index) => {
|
{props.data.map((item: any, index: number) => {
|
||||||
return (
|
return (
|
||||||
<Cell
|
<Cell
|
||||||
title={item.title}
|
title={
|
||||||
|
<View>
|
||||||
|
<View className="text-base font-medium mb-1">{item.title}</View>
|
||||||
|
{item.comments && (
|
||||||
|
<Text className="text-sm text-gray-500 leading-relaxed">
|
||||||
|
{item.comments}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
}
|
||||||
extra={
|
extra={
|
||||||
<Image src={item.image} mode={'aspectFit'} lazyLoad={false} width={100} height="100"/>
|
<Image src={item.image} mode={'aspectFit'} lazyLoad={false} width={100} height="100"/>
|
||||||
}
|
}
|
||||||
@@ -18,7 +28,7 @@ const ArticleList = (props: any) => {
|
|||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</div>
|
</View>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,11 +53,11 @@ function Category() {
|
|||||||
return {
|
return {
|
||||||
title: `${nav?.categoryName}_九运售电云`,
|
title: `${nav?.categoryName}_九运售电云`,
|
||||||
path: `/shop/category/index?id=${categoryId}`,
|
path: `/shop/category/index?id=${categoryId}`,
|
||||||
success: function (res) {
|
success: function () {
|
||||||
console.log('分享成功', res);
|
console.log('分享成功');
|
||||||
},
|
},
|
||||||
fail: function (res) {
|
fail: function () {
|
||||||
console.log('分享失败', res);
|
console.log('分享失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
import FixedButton from "@/components/FixedButton";
|
import FixedButton from "@/components/FixedButton";
|
||||||
import navTo from "@/utils/common";
|
import navTo from "@/utils/common";
|
||||||
import {pageShopDealerApply, removeShopDealerApply, updateShopDealerApply} from "@/api/shop/shopDealerApply";
|
import {pageShopDealerApply, removeShopDealerApply, updateShopDealerApply} from "@/api/shop/shopDealerApply";
|
||||||
|
import {addShopDealerRecord} from "@/api/shop/shopDealerRecord";
|
||||||
|
|
||||||
// 扩展User类型,添加客户状态和保护天数
|
// 扩展User类型,添加客户状态和保护天数
|
||||||
interface CustomerUser extends UserType {
|
interface CustomerUser extends UserType {
|
||||||
@@ -73,6 +74,12 @@ const CustomerIndex = () => {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (res.confirm && res.content !== undefined) {
|
if (res.confirm && res.content !== undefined) {
|
||||||
try {
|
try {
|
||||||
|
// 添加跟进记录
|
||||||
|
await addShopDealerRecord({
|
||||||
|
dealerId: customer.userId,
|
||||||
|
// @ts-ignore
|
||||||
|
content: res.content.trim()
|
||||||
|
})
|
||||||
// 更新跟进情况
|
// 更新跟进情况
|
||||||
await updateShopDealerApply({
|
await updateShopDealerApply({
|
||||||
...customer,
|
...customer,
|
||||||
|
|||||||
Reference in New Issue
Block a user