Commit 428cf98e by 张立顺

Merge branch 'feature/zls' into 'SAAS+V5.8.5'

Feature/zls

See merge request !959
2 parents 702c46d5 09bb75b4
# 订单列表日报字段 Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 在订单管理的精品、权益订单列表展示中文日报标签和 `YYYY-MM-DD` 实际交付日期,并验证现有导出链路包含对应字段。
**Architecture:** 复用现有 `orderListRowDisplay.js` 行映射层,新增两个纯格式化函数并由精品、权益映射函数共同输出显示字段。两个 Vue 页面只增加表格列,不重复格式化;导出继续使用现有 Swagger 已支持的字段模板和异步导出接口。
**Tech Stack:** Vue 2.6、Element UI 2、JavaScript、dayjs、Jest、现有 ROP Swagger 工具链
## Global Constraints
- 保持 Vue 2 Options API,不引入 Composition API、`script setup` 或 TypeScript 改造。
- `customerTags` 最终必须显示中文;兼容中文原值及 Swagger 定义的数字编码。
- `actualDeliveryDate` 仅显示 `YYYY-MM-DD`。
- 两个字段插入“升级状态”之后,空值显示 `-`。
- 保留现有订单导出队列和接口,不新增请求框架或新 API。
- 修改代码必须符合 `eslint.config.js` 和 `.ai/rules/ESLINT.md`。
---
### Task 1: 共享日报字段格式化与行映射
**Files:**
- Create: `src/views/orderManage/utils/orderListRowDisplay.spec.js`
- Modify: `src/views/orderManage/utils/orderListRowDisplay.js`
**Interfaces:**
- Consumes: Swagger 字段 `customerTags: string|null`、`actualDeliveryDate: string|number|null`
- Produces: `formatCustomerTags(customerTags): string`、`formatActualDeliveryDate(actualDeliveryDate): string`、行字段 `customerTagsDisplay`、`actualDeliveryDateDisplay`
- [x] **Step 1: 写失败测试**
```js
import {
formatActualDeliveryDate,
formatCustomerTags,
mapCarDamageListRow,
mapOrderListRow,
} from "./orderListRowDisplay";
describe("订单列表日报字段显示", () => {
it("将数字日报标签转换为中文并保留中文标签", () => {
expect(formatCustomerTags("1,2,已交付引荐,5")).toBe("已触客,已拉群,已交付引荐,事故车客户");
});
it("将实际交付时间格式化为日期", () => {
expect(formatActualDeliveryDate(1786934049000)).toBe("2026-08-17");
});
it("空值显示横线", () => {
expect(formatCustomerTags(null)).toBe("-");
expect(formatActualDeliveryDate(null)).toBe("-");
});
it("精品和权益行映射输出相同日报字段", () => {
const row = { customerTags: "1,3", actualDeliveryDate: 1786934049000 };
expect(mapOrderListRow(row, { maps: {} })).toMatchObject({
customerTagsDisplay: "已触客,已交付引荐",
actualDeliveryDateDisplay: "2026-08-17",
});
expect(mapCarDamageListRow(row, { maps: {} })).toMatchObject({
customerTagsDisplay: "已触客,已交付引荐",
actualDeliveryDateDisplay: "2026-08-17",
});
});
});
```
- [x] **Step 2: 运行测试并确认因缺少导出函数失败**
Run: `npm run test:unit -- src/views/orderManage/utils/orderListRowDisplay.spec.js --runInBand`
Expected: FAIL,提示 `formatCustomerTags` 或 `formatActualDeliveryDate` 不是函数。
- [x] **Step 3: 实现最小格式化与映射**
```js
import dayjs from "dayjs";
const CUSTOMER_TAG_MAP = {
1: "已触客",
2: "已拉群",
3: "已交付引荐",
4: "首保维保客户",
5: "事故车客户",
};
export function formatCustomerTags(value) {
if (value == null || String(value).trim() === "") {
return "-";
}
return String(value)
.split(/[,,]/)
.map(item => item.trim())
.filter(Boolean)
.map(item => CUSTOMER_TAG_MAP[item] || item)
.join(",") || "-";
}
export function formatActualDeliveryDate(value) {
if (value == null || value === "") {
return "-";
}
const result = dayjs(value).format("YYYY-MM-DD");
return result === "Invalid Date" ? "-" : result;
}
```
在 `mapOrderListRow` 和 `mapCarDamageListRow` 返回值中加入:
```js
customerTagsDisplay: formatCustomerTags(row.customerTags),
actualDeliveryDateDisplay: formatActualDeliveryDate(row.actualDeliveryDate),
```
- [x] **Step 4: 运行定向测试并确认通过**
Run: `npm run test:unit -- src/views/orderManage/utils/orderListRowDisplay.spec.js --runInBand`
Expected: PASS。
### Task 2: 精品和权益列表增加两列
**Files:**
- Modify: `src/views/orderManage/order.vue`
- Modify: `src/views/orderManage/carDamage.vue`
**Interfaces:**
- Consumes: Task 1 生成的 `customerTagsDisplay`、`actualDeliveryDateDisplay`
- Produces: 两个订单列表在“升级状态”后展示“日报标签”和“实际交付日期”
- [x] **Step 1: 在两个列表加入字段列**
精品列表在升级状态列后加入:
```vue
<el-table-column align="center" label="日报标签" prop="customerTagsDisplay" show-overflow-tooltip width="180" />
<el-table-column align="center" label="实际交付日期" prop="actualDeliveryDateDisplay" width="120" />
```
权益列表按现有多行属性格式加入相同列与宽度。
- [x] **Step 2: 运行 Vue 模板差异检查与共享映射测试**
Run:
```powershell
npx eslint src/views/orderManage/order.vue src/views/orderManage/carDamage.vue -f json
npm run test:unit -- src/views/orderManage/utils/orderListRowDisplay.spec.js --runInBand
```
Expected: Vue 模板可解析;两个旧页面存在的历史诊断保持不扩散,本次新增列无 ESLint 诊断;共享映射测试 PASS。人工核对两个模板中字段均紧跟“升级状态”。
### Task 3: Swagger、导出和代码质量验证
**Files:**
- Verify: `src/api/order.js`
- Verify: `src/views/orderManage/order.vue`
- Verify: `src/views/orderManage/carDamage.vue`
**Interfaces:**
- Consumes: `dj.api.smartcarlife.ordermanage.page`、`ordermanage.export.head.template`、`ordermanage.export.async`
- Produces: 接口契约证据、导出表头验收结果、无 ESLint 诊断的最终改动
- [x] **Step 1: 读取线上 Swagger 契约**
Run:
```powershell
npm run rop:swagger -- --swagger http://dj.dev.glsx.com.cn/rop-dj-smartcarlife/swagger-rop/api-docs --method dj.api.smartcarlife.ordermanage.page --out src/api/adapters/orderManage --dry-run --contracts-only --json
```
Expected: `OrderManagePageResponse` 定义包含 `customerTags` 和 `actualDeliveryDate`。
- [x] **Step 2: 读取真实导出字段模板并核验权益实际导出**
Run: 使用 `src/libs/rop/ropClient.js` 登录开发环境,只输出 `customerTags` 和 `actualDeliveryDate` 两个模板项;按权益页面现有参数提交一条订单的异步导出,并使用电子表格工具读取表头。
Expected: 返回“日报标签/customerTags”和“实际交付日期/actualDeliveryDate”,权益实际导出表头也包含“日报标签”和“实际交付日期”。
- [x] **Step 3: 运行共享逻辑定向 ESLint**
Run:
```powershell
npx eslint src/views/orderManage/utils/orderListRowDisplay.js src/views/orderManage/utils/orderListRowDisplay.spec.js
```
Expected: exit code 0;页面新增列使用上一步确认过的无诊断格式。
- [x] **Step 4: 运行完整定向测试**
Run:
```powershell
npm run test:unit -- src/views/orderManage/utils/orderListRowDisplay.spec.js --runInBand
```
Expected: 全部 PASS,无新增错误或警告。
- [x] **Step 5: 检查改动范围并提交**
Run:
```powershell
git diff --check
git status --short
git diff -- src/views/orderManage/order.vue src/views/orderManage/carDamage.vue src/views/orderManage/utils/orderListRowDisplay.js src/views/orderManage/utils/orderListRowDisplay.spec.js
git add docs/superpowers/plans/2026-08-17-order-list-daily-fields.md src/views/orderManage/order.vue src/views/orderManage/carDamage.vue src/views/orderManage/utils/orderListRowDisplay.js src/views/orderManage/utils/orderListRowDisplay.spec.js
git commit -m "feat: 增加订单日报标签和实际交付日期"
```
Expected: 仅提交本功能计划、两个列表、共享映射和对应测试。
# 订单列表日报字段设计
## 目标
在订单管理的“精品订单”和“权益订单”列表中新增“日报标签”和“实际交付日期”,并确保现有订单导出支持这两个字段。
## 接口契约
线上 Swagger 接口 `dj.api.smartcarlife.ordermanage.page` 已提供:
- `customerTags`:日报标签。Swagger 描述为逗号分隔的标签编码,真实接口当前也可能直接返回逗号分隔的中文标签。
- `actualDeliveryDate`:客户实际交付日期,类型为 `date-time`,真实接口返回毫秒时间戳。
线上 Swagger 接口 `dj.api.smartcarlife.ordermanage.export.head.template` 已提供以下可选导出字段:
- `customerTags` / 日报标签
- `actualDeliveryDate` / 实际交付日期
精品和权益列表均调用现有 `dj.api.smartcarlife.ordermanage.export.async` 异步导出接口,不新增接口。
## 页面设计
在以下两个列表的“升级状态”之后依次插入:
1. 日报标签
2. 实际交付日期
涉及页面:
- `src/views/orderManage/order.vue`:精品订单
- `src/views/orderManage/carDamage.vue`:权益订单
空值统一显示 `-`。
## 数据映射
在 `src/views/orderManage/utils/orderListRowDisplay.js` 中集中处理显示值,供两个页面复用:
- `customerTagsDisplay`
- 中文标签原样展示。
- 数字编码按 `1=已触客`、`2=已拉群`、`3=已交付引荐`、`4=首保维保客户`、`5=事故车客户` 转成中文。
- 同时兼容英文逗号和中文逗号分隔。
- 未知值保留原文,避免丢失后端新增标签。
- `actualDeliveryDateDisplay`
- 有效时间统一格式化为 `YYYY-MM-DD`。
- 无效或空值显示 `-`。
## 导出设计
- 精品订单保留现有导出字段选择弹窗;后端模板返回的两个字段会出现在可选项中,用户勾选后随现有 `fieldList` 提交。
- 权益订单保留现有直接异步导出流程;不改变筛选参数和场景参数,由后端按已发布的导出字段定义生成文件。
- 验证阶段检查精品导出模板字段,并检查权益实际导出的 Excel 表头包含两个字段。
## 测试与验收
- 为共享行映射补充单元测试,覆盖中文标签、数字标签、空标签、时间戳日期和空日期。
- 运行订单行映射定向单测。
- 对修改文件运行 ESLint。
- 读取线上 Swagger 再次确认字段契约。
- 验证精品、权益列表字段顺序和空值展示。
- 验证导出文件包含“日报标签”和“实际交付日期”。
## 范围与风险
- 不新增接口,不调整筛选条件,不改订单详情。
- 不改 Vue 版本、组件体系或现有导出队列。
- Swagger 对 `customerTags` 的描述与真实返回形式存在差异,因此前端兼容编码和中文两种形式。
- 权益导出内容由后端异步生成;若运行环境尚未发布对应导出字段,前端列表仍可正常展示,但导出验收会明确报出后端环境差异。
......@@ -33,6 +33,41 @@ describe("purchase grounding form", () => {
expect(context.selectGoodsVisible).toBe(false);
});
it("shows the selected product purchase cost in the product details", () => {
const context = {
formData: {
purchaseCostType: 0,
purchasePrice: "",
upgradeGoods: {},
},
positionTypeList: [],
filterSpecsStr: jest.fn().mockReturnValue("黑色"),
filterEmpty: GroundingForm.methods.filterEmpty,
$set(target, key, value) {
target[key] = value;
},
handleSelectGoodsClose: jest.fn(),
};
context.syncAutomaticPurchasePrice = () => GroundingForm.methods.syncAutomaticPurchasePrice.call(context);
GroundingForm.methods.handleSelectGoodsConfirm.call(context, {
id: 10,
commodityCode: "UID-001",
position: "",
djCost: "",
purchaseCost: 28.6,
goodsInfo: {
goodsName: "测试系列",
goodsType: 3,
supplierCode: "SUP-001",
},
upgradeGoodsServiceItemsList: [],
carTypeConfigList: [],
});
expect(context.formData.upgradeGoods.purchasePrice).toBe(28.6);
});
it("rolls stores back when an invalid region confirmation is cancelled", async () => {
validateStoreRegion.mockResolvedValue({
allMatch: false,
......
......@@ -737,7 +737,7 @@ export default {
const success = (res) => {
_formData[targetItem.name][index].voucherFileUrl = res.aliyunAddress; // 文件地址
};
const fail = (err) => {
const fail = () => {
this.clearItem(targetItem, index); // 上传失败将内容清空 不删除数组 防止其它上传进度 找不到对应下标
};
this.handleOssUpload(fileInfo, fileName, success, fail);
......@@ -807,6 +807,7 @@ export default {
const shopType
= formData?.goodsType == 1 ? "1" : formData?.sceneType == 3 ? "2" : "";
const shopForm = deepClone(copyFormList[copyProductFormIndex].formBlock);
// 权益/延保类无升级成本,新增嘀加成本和第三方成本
const spliceForm
= shopType == "1"
? [
......@@ -827,9 +828,8 @@ export default {
"djCost",
"thirdPartyCost",
]
: // 权益/延保类 无升级成本 新增嘀加成本和第三方成本
this.equitySceneType.includes(formData?.goodsType)
|| this.extendedPosiType.includes(formData?.goodsType)
: this.equitySceneType.includes(formData?.goodsType)
|| this.extendedPosiType.includes(formData?.goodsType)
? [
"productType",
"warrantyType",
......@@ -1007,14 +1007,15 @@ export default {
.join("/")
: "",
specificationData: this.filterSpecsStr(_valueObj),
purchasePrice: _valueObj?.purchaseCost,
djCost: _valueObj?.djCost,
carTypeConfigName: _valueObj?.carTypeConfigList
?.map(item => item.seriesName)
.join("/"),
upgradeCommodityCode: _valueObj?.commodityCode,
}
; (_formData.goodsType = _valueObj?.goodsInfo?.goodsType),
(_formData.upgradeGoodsId = _valueObj.id);
};
_formData.goodsType = _valueObj?.goodsInfo?.goodsType;
_formData.upgradeGoodsId = _valueObj.id;
_formData.positionNamesArr = _positionNamesArr;
_formData.productType = []; // 切换上架商品 将服务类型清空
_formData.baseSupplyMode = ""; // 切换上架商品 将基础供货模式清空
......@@ -1189,7 +1190,7 @@ export default {
// 价格过滤
handleInput(e, item) {
e = e.replace(/[^\d.]/g, "");
let oldValue = `${this.formData["old" + item.name]}`;
const oldValue = `${this.formData["old" + item.name]}`;
this.$set(this.formData, `${item.name}`, limitPrice(e, oldValue, 6, 2, 0));
this.$set(this.formData, `old${item.name}`, this.formData[item.name]);
},
......@@ -1197,7 +1198,7 @@ export default {
selectAddAttr(value, targetItem) {
const _formData = this.formData;
if (targetItem.name == "merchantId") {
let _tempVal = targetItem.optionList.find(
const _tempVal = targetItem.optionList.find(
item => item.merchantId === value,
);
_formData.merchantName = _tempVal.merchantName;
......@@ -1242,12 +1243,9 @@ export default {
jumpScroll(idName) {
document.getElementById(idName).scrollIntoView();
},
filterEmpty(data) {
return (data ?? "") === "";
},
// 处理金额补零
priceFilter(num) {
let pow = 10 ** 2;
const pow = 10 ** 2;
if (this.filterEmpty(num)) {
return "-";
}
......@@ -1268,7 +1266,7 @@ export default {
if (valid) {
this.$emit("handleAddConfirm", { ...this.formData, num: e });
} else {
let needRuleList = Object.keys(options);
const needRuleList = Object.keys(options);
this.jumpScroll(needRuleList[0]);
return true;
}
......
......@@ -215,6 +215,15 @@
prop="upgradeFlagLabel"
width="100" />
<el-table-column align="center"
label="日报标签"
prop="customerTagsDisplay"
width="180"
show-overflow-tooltip />
<el-table-column align="center"
label="实际交付日期"
prop="actualDeliveryDateDisplay"
width="120" />
<el-table-column align="center"
label="订单状态"
prop="statusLabel"
width="100" />
......
......@@ -123,6 +123,15 @@
<el-table-column align="center" label="客户车型" prop="carTypeDisplay" show-overflow-tooltip width="200" />
<el-table-column align="center" label="客户车牌号" prop="plateNumber" width="110" />
<el-table-column align="center" label="升级状态" prop="upgradeFlagLabel" width="100" />
<el-table-column align="center"
label="日报标签"
prop="customerTagsDisplay"
width="180"
show-overflow-tooltip />
<el-table-column align="center"
label="实际交付日期"
prop="actualDeliveryDateDisplay"
width="120" />
<el-table-column align="center" label="订单状态" prop="statusLabel" width="100" />
<el-table-column align="center" label="分账状态" prop="profitAllocationStatusLabel" width="100" />
<el-table-column align="center" label="开票状态" prop="invoiceStatusLabel" width="100" />
......
import dayjs from "dayjs";
const CUSTOMER_TAG_MAP = {
1: "已触客",
2: "已拉群",
3: "已交付引荐",
4: "首保维保客户",
5: "事故车客户",
};
const SALES_TYPE_MAP = {
0: "销售端引流 - 售前",
1: "门店引流 - 售后",
......@@ -17,9 +27,37 @@ const CAR_DAMAGE_SALES_TYPE_MAP = {
};
/**
* @param {string|number|null|undefined} value
* @returns {string} 格式化后的中文标签
*/
export function formatCustomerTags(value) {
if (value == null || String(value).trim() === "") {
return "-";
}
return String(value)
.split(/[,,]/)
.map(item => item.trim())
.filter(Boolean)
.map(item => CUSTOMER_TAG_MAP[item] || item)
.join(",") || "-";
}
/**
* @param {string|number|null|undefined} value
* @returns {string} 格式化后的交付日期
*/
export function formatActualDeliveryDate(value) {
if (value == null || value === "") {
return "-";
}
const result = dayjs(value).format("YYYY-MM-DD");
return result === "Invalid Date" ? "-" : result;
}
/**
* @param {string} [text]
* @param {number} [maxLen]
* @returns {string}
* @returns {string} 截断后的展示文本
*/
export function truncateDisplay(text, maxLen = 10) {
if (!text) {
......@@ -30,7 +68,7 @@ export function truncateDisplay(text, maxLen = 10) {
/**
* @param {object} [item]
* @returns {string}
* @returns {string} 商品类目名称
*/
export function getGoodsTypeName(item) {
const {
......@@ -48,7 +86,7 @@ export function getGoodsTypeName(item) {
/**
* @param {object} item
* @param {Array<{ position: string|number, confName: string }>} positionTypeList
* @returns {object}
* @returns {object} 商品展示信息
*/
export function mapSubOrderDisplayItem(item, positionTypeList) {
const goodsTypeFull = getGoodsTypeName(item);
......@@ -91,7 +129,7 @@ export function mapSubOrderDisplayItem(item, positionTypeList) {
* @param {object} row
* @param {object} ctx
* @param {object} ctx.maps
* @returns {object}
* @returns {object} 精品订单行展示信息
*/
export function mapOrderListRow(row, ctx) {
const {
......@@ -122,8 +160,8 @@ export function mapOrderListRow(row, ctx) {
const carTypeDisplay = carParts.join("") || "-";
let refundDetailDisplay = "-";
if (row.status == 12) {
const typeLabel = row.refundType == "1" ? "退全款" : "退部分款";
if (Number(row.status) === 12) {
const typeLabel = String(row.refundType) === "1" ? "退全款" : "退部分款";
refundDetailDisplay = `${typeLabel} ¥${row.refundAmount || 0}`;
}
......@@ -135,6 +173,8 @@ export function mapOrderListRow(row, ctx) {
return {
...row,
paySuccessDate: row.paySuccessDate || "",
customerTagsDisplay: formatCustomerTags(row.customerTags),
actualDeliveryDateDisplay: formatActualDeliveryDate(row.actualDeliveryDate),
subOrderDisplayList,
packageNamesDisplay: packageNamesDisplay || "-",
djOrderTypeLabel: row.djOrderType ? (djOrderTypeMap[row.djOrderType] || "-") : "-",
......@@ -142,7 +182,7 @@ export function mapOrderListRow(row, ctx) {
? (auditStatusMap[row.goodsOrderApplyStatus] || "-")
: "-",
incorrectOrderCodeDisplay: row.incorrectOrderCode || "-",
customerSexLabel: row.customerSex == 1 ? "男" : "女",
customerSexLabel: Number(row.customerSex) === 1 ? "男" : "女",
carTypeDisplay,
upgradeFlagLabel: row.upgradeFlag
? (upgradeOpts[row.upgradeFlag] || "待升级")
......@@ -166,38 +206,46 @@ export function mapOrderListRow(row, ctx) {
/**
* @param {object} opt
* @returns {string}
* @returns {string} 权益场景名称
*/
function rightsSceneRowLabel(opt) {
if (!opt) return "-";
if (!opt) {
return "-";
}
return opt.name || opt.subTypeName || opt.num || opt.baseSceneCode || "-";
}
/**
* @param {object} [row]
* @param {Array<object>} [sceneList]
* @returns {string}
* @returns {string} 权益场景展示名称
*/
export function resolveRightsSceneLabel(row, sceneList) {
if (row == null) return "-";
if (row === null || row === undefined) {
return "-";
}
const key = String(row.baseSceneCode == null ? "" : row.baseSceneCode).trim();
if (key) {
const list = sceneList || [];
const opt = list.find(
s => String((s && s.baseSceneCode) || "").trim() === key,
);
if (opt) return rightsSceneRowLabel(opt);
if (opt) {
return rightsSceneRowLabel(opt);
}
return key;
}
const nm = row.baseSceneName != null ? row.baseSceneName : row.sceneName;
if (nm != null && String(nm).trim() !== "") return String(nm).trim();
if (nm !== null && nm !== undefined && String(nm).trim() !== "") {
return String(nm).trim();
}
return "-";
}
/**
* @param {object} item
* @param {Array<{ position: string|number, confName: string }>} positionTypeList
* @returns {object}
* @returns {object} 权益商品展示信息
*/
export function mapCarDamageSubOrderDisplayItem(item, positionTypeList) {
const base = mapSubOrderDisplayItem(item, positionTypeList);
......@@ -222,7 +270,7 @@ export function mapCarDamageSubOrderDisplayItem(item, positionTypeList) {
* @param {object} row
* @param {object} ctx
* @param {object} ctx.maps
* @returns {object}
* @returns {object} 权益订单行展示信息
*/
export function mapCarDamageListRow(row, ctx) {
const {
......@@ -250,8 +298,8 @@ export function mapCarDamageListRow(row, ctx) {
const carTypeDisplay = carParts.join("") || "-";
let refundDetailDisplay = "-";
if (row.status == 12) {
const typeLabel = row.refundType == "1" ? "退全款" : "退部分款";
if (Number(row.status) === 12) {
const typeLabel = String(row.refundType) === "1" ? "退全款" : "退部分款";
refundDetailDisplay = `${typeLabel} ¥${row.refundAmount || 0}`;
}
......@@ -262,12 +310,14 @@ export function mapCarDamageListRow(row, ctx) {
let customerSexLabel = "-";
if (row.customerSex) {
customerSexLabel = row.customerSex == 1 ? "男" : "女";
customerSexLabel = Number(row.customerSex) === 1 ? "男" : "女";
}
return {
...row,
paySuccessDate: row.paySuccessDate || "",
customerTagsDisplay: formatCustomerTags(row.customerTags),
actualDeliveryDateDisplay: formatActualDeliveryDate(row.actualDeliveryDate),
subOrderDisplayList,
djOrderTypeLabel: row.djOrderType ? (djOrderTypeMap[row.djOrderType] || "-") : "-",
goodsOrderApplyStatusLabel: row.goodsOrderApplyStatus
......
import {
formatActualDeliveryDate,
formatCustomerTags,
mapCarDamageListRow,
mapOrderListRow,
} from "./orderListRowDisplay";
describe("订单列表日报字段显示", () => {
it("将数字日报标签转换为中文并保留中文标签", () => {
expect(formatCustomerTags("1,2,已交付引荐,5"))
.toBe("已触客,已拉群,已交付引荐,事故车客户");
});
it("兼容中文逗号并保留未知标签", () => {
expect(formatCustomerTags("1,新增标签,3"))
.toBe("已触客,新增标签,已交付引荐");
});
it("将实际交付时间格式化为日期", () => {
expect(formatActualDeliveryDate(1786934049000)).toBe("2026-08-17");
});
it("空值和无效日期显示横线", () => {
expect(formatCustomerTags(null)).toBe("-");
expect(formatActualDeliveryDate(null)).toBe("-");
expect(formatActualDeliveryDate("invalid")).toBe("-");
});
it("精品和权益行映射输出相同日报字段", () => {
const row = {
actualDeliveryDate: 1786934049000,
customerTags: "1,3",
};
expect(mapOrderListRow(row, { maps: {} })).toMatchObject({
actualDeliveryDateDisplay: "2026-08-17",
customerTagsDisplay: "已触客,已交付引荐",
});
expect(mapCarDamageListRow(row, { maps: {} })).toMatchObject({
actualDeliveryDateDisplay: "2026-08-17",
customerTagsDisplay: "已触客,已交付引荐",
});
});
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!