index.data.js 7.52 KB
/**
 * 线索管理 - 搜索表单配置 & 表格列配置
 */
import { getShopMerchantList } from "@api/usedCarManagement";

/**
 * 客户意向等级
 */
export const customerIntentLevelList = [
	{ confId: "O", confValue: "O级:新车已定,旧车已签合同(客情回复,确认交车时间)" },
	{ confId: "H", confValue: "H级:新车已定,旧车已评估报价,客户正在对比价格(1日内跟进)" },
	{ confId: "A", confValue: "A级:客户新车基本看好,一周内会购车,旧车已评估报价(2日内跟进)" },
	{ confId: "B", confValue: "B级:新车车型基本看好,预计一个月内会购车,旧车还未确定是否置换(5天内跟进)" },
	{ confId: "C", confValue: "C级:客户新车还未确定车型,旧车未确定置换(10天内跟进)" },
	{ confId: "D", confValue: "D级:新车未看具体车型,短期内不打算换车,旧车大概看看(20天跟进)" },
];

/**
 * 客户意向等级完整描述映射
 */
export const customerIntentLevelMap = {
	O: "客情回复,确认交车时间",
	H: "1日内跟进",
	A: "2日内跟进",
	B: "5天内跟进",
	C: "10天内跟进",
	D: "20天跟进",
};

/**
 * 线索状态
 */
export const cluesStatusList = [
	{ confId: "1", confValue: "待跟进" },
	{ confId: "2", confValue: "跟进中" },
	{ confId: "3", confValue: "暂败" },
	{ confId: "4", confValue: "成功收车" },
];

/**
 * 跟进状态提示
 */
export const followTimeStatusList = [
	{ confId: "1", confValue: "临期" },
	{ confId: "2", confValue: "已超期" },
	{ confId: "0", confValue: "正常" },
];

/**
 * 录单人员类型
 */
export const enterTypeList = [
	{ confId: "1", confValue: "销售" },
	{ confId: "2", confValue: "评估师" },
];

/**
 * 获取表格列配置
 */
export async function getTableSchema() {
	return [
		{
			label: "线索 ID",
			prop: "cluesNo",
			width: "190",
			formatter: (cellValue) => {
				return cellValue.cluesNo || "-";
			},
		},
		{
			label: "录入时间",
			prop: "enterTime",
			width: "160",
			formatter: (cellValue) => {
				return cellValue.enterTime || "-";
			},
		},
		{
			label: "线索门店",
			prop: "sellerMerchantName",
			width: "180",
			formatter: (cellValue) => {
				return cellValue.sellerMerchantName || "-";
			},
		},
		{
			label: "推荐销售顾问",
			prop: "sellerName",
			width: "120",
			formatter: (cellValue) => {
				return cellValue.sellerName || "-";
			},
		},
		{
			label: "车主姓名",
			prop: "carOwnerName",
			width: "100",
			formatter: (cellValue) => {
				return cellValue.carOwnerName || "-";
			},
		},
		{
			label: "车主电话",
			prop: "carOwnerPhone",
			width: "120",
			formatter: (cellValue) => {
				return cellValue.carOwnerPhone || "-";
			},
		},
		{
			label: "评估品牌车型",
			prop: "carBrand",
			width: "180",
			formatter: (cellValue) => {
				const parts = [
					cellValue.carBrand,
					cellValue.carChildsBrandName,
					cellValue.carSeriesName,
					cellValue.carTypeName,
				].filter(Boolean);
				return parts.length > 0 ? parts.join("-") : "-";
			},
		},
		{
			label: "意向等级",
			prop: "customerIntentLevel",
			type: "slot",
			addHtml: "customerIntentLevel",
			width: "220",
		},
		{
			label: "线索状态",
			prop: "cluesStatus",
			width: "100",
			className: (cellValue) => {
				return {
					1: "c-blueSpot",
					2: "greenSpot",
					3: "redSpot",
					4: "c-purpleSpot",
				}[cellValue.cluesStatus];
			},
			formatter: (cellValue) => {
				return {
					1: "待跟进",
					2: "跟进中",
					3: "暂败",
					4: "成功收车",
				}[cellValue.cluesStatus];
			},
		},
		{
			label: "跟进状态",
			prop: "followUpStatus",
			width: "200",
			formatter: (cellValue) => {
				const statusMap = {
					1: "临期",
					2: "已超期",
				};
				return cellValue.followTimeStatus ? `${statusMap[cellValue.followTimeStatus]}` : "-";
			},
			className: (cellValue) => {
				return {
					2: "redSpot",
					1: "yellowSpot",
				}[cellValue.followTimeStatus];
			},
		},
		{
			label: "跟进内容",
			prop: "followRecordList",
			width: "200",
			addHtml: "followRecordList",
		},
		{
			label: "最后跟进时间",
			prop: "latestFollowTime",
			width: "160",
			formatter: (cellValue) => {
				return cellValue.latestFollowTime || "-";
			},
		},
		{
			label: "下一次跟进时间",
			prop: "nextFollowTime",
			width: "160",
			formatter: (cellValue) => {
				return cellValue.nextFollowTime || "-";
			},
		},
		{
			label: "录线索人员",
			prop: "enterType",
			width: "160",
			formatter: (cellValue) => {
				return cellValue.enterType == 1 ? "销售" : "评估师";
			},
		},
		{
			label: "评估师",
			prop: "conversionName",
			width: "120",
			formatter: (cellValue) => {
				return cellValue.conversionName || "-";
			},
		},
	];
}
export async function getSearchFromSchema(_refreshTableFn) {
	const refreshTableFn = typeof _refreshTableFn === "function" ? _refreshTableFn : () => {};

	// 获取门店列表
	const merchantRes = await getShopMerchantList({ currentPage: 1, pageSize: 9999 });
	return [
		{
			label: "线索 ID",
			name: "cluesNo",
			type: "input",
			isClear: true,
			keyFn: refreshTableFn,
			placeholder: "请输入线索ID",
		},
		{
			label: "车主姓名",
			name: "carOwnerName",
			type: "input",
			isClear: true,
			keyFn: refreshTableFn,
			placeholder: "请输入车主姓名",
		},
		{
			label: "车主电话",
			name: "carOwnerPhone",
			type: "input",
			isClear: true,
			keyFn: refreshTableFn,
			placeholder: "请输入车主电话",
		},
		{
			label: "线索门店名称",
			name: "sellerMerchantIdList",
			type: "select",
			optionList: merchantRes?.records || [],
			optionId: "sellerMerchantId",
			optionLabel: "sellerMerchantName",
			optionsName: "merchantList",
			multiple: true,
			collapseTags: true,
		},
		{
			label: "推荐销售顾问",
			name: "sellerName",
			type: "input",
			isClear: true,
			keyFn: refreshTableFn,
			placeholder: "请输入推荐销售顾问",
		},
		{
			label: "客户意向等级",
			name: "customerIntentLevelList",
			type: "select",
			optionList: customerIntentLevelList,
			optionId: "confId",
			optionLabel: "confValue",
			optionsName: "customerIntentLevelList",
			multiple: true,
			collapseTags: true,
		},
		// {
		// 	label: "线索状态",
		// 	name: "cluesStatusList",
		// 	type: "select",
		// 	optionList: cluesStatusList,
		// 	optionId: "confId",
		// 	optionLabel: "confValue",
		// 	optionsName: "cluesStatusList",
		// 	multiple: true,
		// 	collapseTags: true,
		// },
		{
			label: "跟进状态提示",
			name: "followTimeStatusList",
			type: "select",
			optionList: followTimeStatusList,
			optionId: "confId",
			optionLabel: "confValue",
			optionsName: "followTimeStatusList",
			multiple: true,
			collapseTags: true,
		},
		{
			label: "创建时间",
			name: "createTimeRange",
			type: "datePicker",
			isClear: true,
			pickerOptions: "rangePickerOptions",
		},
		{
			label: "最后跟进时间",
			name: "lastFollowUpTimeRange",
			type: "datePicker",
			isClear: true,
			pickerOptions: "rangePickerOptions",
		},
		{
			label: "评估师姓名",
			name: "conversionName",
			type: "input",
			isClear: true,
			keyFn: refreshTableFn,
			placeholder: "请输入评估师姓名",
		},
		{
			label: "录线索人员",
			name: "enterType",
			type: "select",
			optionList: enterTypeList,
			optionId: "confId",
			optionLabel: "confValue",
			optionsName: "enterTypeList",
		},
		{
			label: "评估品牌车型",
			name: "carModel",
			type: "input",
			isClear: true,
			keyFn: refreshTableFn,
			placeholder: "请输入品牌车型关键词",
		},
	];
}