Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 239fdaa8
authored
Aug 17, 2026
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 增加订单日报标签和实际交付日期
1 parent
8230dfd1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
343 additions
and
18 deletions
docs/superpowers/plans/2026-08-17-order-list-daily-fields.md
src/views/orderManage/carDamage.vue
src/views/orderManage/order.vue
src/views/orderManage/utils/orderListRowDisplay.js
src/views/orderManage/utils/orderListRowDisplay.spec.js
docs/superpowers/plans/2026-08-17-order-list-daily-fields.md
0 → 100644
View file @
239fdaa
# 订单列表日报字段 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: 仅提交本功能计划、两个列表、共享映射和对应测试。
src/views/orderManage/carDamage.vue
View file @
239fdaa
...
...
@@ -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"
/>
...
...
src/views/orderManage/order.vue
View file @
239fdaa
...
...
@@ -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"
/>
...
...
src/views/orderManage/utils/orderListRowDisplay.js
View file @
239fdaa
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
...
...
src/views/orderManage/utils/orderListRowDisplay.spec.js
0 → 100644
View file @
239fdaa
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
:
"已触客,已交付引荐"
,
});
});
});
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment