Commit ac1ca9e5 by 前端

Merge branch 'develop' into 'master'

上线合并

See merge request !927
2 parents 4891d282 93a8f5e8
Showing 398 changed files with 3993 additions and 387 deletions
# 订单列表横向滚动卡顿 — 原因分析与优化
## 问题页面
- [`src/views/orderManage/order.vue`](../src/views/orderManage/order.vue)(1.1 精品升级)
- [`src/views/orderManage/carDamage.vue`](../src/views/orderManage/carDamage.vue)(2.1 会员权益 / 2.3 延保,共用同一列表组件)
## 根因(按影响排序)
1. **超宽表格(~45–50 列)+ `fixed="right"` 操作列** — Element UI 固定列双份 DOM,横滚时 layout/sync 成本高(主因)
2. **10+ 列对 `subOrderList` 嵌套 `v-for`** — 每行数千 DOM 节点
3. **30+ 列自定义 slot** — 无法走简单文本渲染
4. **`el-tooltip` 行内实例** — 商品名称/类目/套餐别名列
5. **模板内重复调用 `getGoodsTypeName`(4 次/格)**
6. **操作列多个 `auth-button`** + fixed 叠加
## 已实施优化
### 精品(order.vue)
| 阶段 | 改动 | 文件 |
|------|------|------|
| 保留 | **操作列 `fixed="right"`**(产品要求) | order.vue |
| 保留 | 操作按钮全部平铺 `auth-button`,不收进下拉 | order.vue |
| P0 | `getList` 预计算展示字段 | `utils/orderListRowDisplay.js` |
| P0 | 分页上限改为 20 | order.vue |
| P1 | 子商品 10 列收入展开行 | order.vue |
| P1b | 展开区改用**原生 table**(替代嵌套 el-table) | order.vue |
| P1b | 展开区 `overflow-x: auto` 独立横滚 | order.vue |
| P1b | **手风琴单展开**(`expand-row-keys`) | order.vue |
### 权益(carDamage.vue)
| 阶段 | 改动 | 文件 |
|------|------|------|
| 保留 | **操作列 `fixed="right"`** | carDamage.vue |
| 保留 | 操作按钮全部平铺 `auth-button`(9040132–9040135、9040147、9040148) | carDamage.vue |
| P0 | `getList` 预计算展示字段(`mapCarDamageListRow`) | `utils/orderListRowDisplay.js` |
| P0 | 分页上限改为 20 | carDamage.vue |
| P1 | 子商品 **14 列**收入展开行(含套餐、优惠券) | carDamage.vue |
| P1b | 展开区原生 table + 独立横滚 | carDamage.vue |
| P1b | 手风琴单展开 | carDamage.vue |
| 保留 | 权益特有主表列:第三方订单号、展业场景、交易参考号、上传协议 | carDamage.vue |
## 静态指标(优化后)
| 指标 | 精品 order.vue | 权益 carDamage.vue |
|------|----------------|-------------------|
| 主表列数 | ~33 | ~35 |
| 子商品展示 | 展开行原生 table(10 列) | 展开行原生 table(14 列) |
| 展开模式 | 同时仅 1 行展开 | 同时仅 1 行展开 |
| 操作列 fixed | **是(保留)** | **是(保留)** |
| 操作按钮 | 全部平铺,无 dropdown | 全部平铺,无 dropdown |
| pageSize 上限 | 20 | 20 |
## 展开行卡顿说明
展开后若使用嵌套 `el-table`,会与父表 `fixed="right"` 叠加导致横滚再次变卡。已通过原生 table + 展开区独立滚动 + 手风琴模式缓解。
## 后续可选(未实施)
- 列显示配置(用户自选可见列)
- 虚拟滚动 PoC(P2)
> 说明:操作列固定会带来一定横滚成本,通过子商品展开行 + 预计算字段等其他优化抵消大部分 DOM 压力。
## 验收指标
- 横滚 FPS ≥ 50(10 行、默认列)
- scroll 长任务 < 50ms
- 主表 DOM 节点降 40%+(展开行收起时)
# 订单列表筛选/分页状态记忆
## 背景
订单列表(`orderList`)包含多个子 Tab(精品升级、升配、众筹、权益、延保、积分商城)。用户从列表进入详情再返回时,原先会丢失筛选条件、分页位置和表格数据。
## 根因
1. 路由 `orderList` 的 `meta.cache: false`,页面不在 `keep-alive` 中
2. 组件 `name` 与路由 `name` 不一致(`OrderList` vs `orderList`)
3. 详情页返回时 `close({ tagName: "/orderList" })` 主动销毁列表 Tab
4. 壳层 `$route` watcher 在详情返回时重复 `loadScenesForCategory`
## 方案
**keep-alive + 导航修复**(不改 `d2-table`)
- 开启 `orderList` 路由 `cache: true`
- 壳层组件 `name` 改为 `orderList`(与路由一致)
- 详情返回仅关闭详情 Tab,不关闭列表 Tab,不带 `tabPane` params
- `shouldReapplyRouteParams` 守卫:从详情返回时跳过路由参数重放
- **不在 `activated` 中刷新列表**(满足返回不重新请求)
## 涉及文件
| 文件 | 说明 |
|------|------|
| `src/router/modules/904_orderManagement.js` | `cache: true` |
| `src/views/orderManage/orderList.vue` | 壳层 name、routeGuard |
| `src/views/orderManage/order.vue` | 子组件改名 `OrderLightUpgrade` |
| `src/views/orderManage/utils/orderListRouteParams.js` | 路由参数解析 |
| `src/views/orderManage/utils/orderListRouteGuard.js` | 是否重放路由参数 |
| `src/views/orderManage/utils/orderListNavigation.js` | 统一返回导航 |
| 详情页 4 个 | 使用统一导航工具 |
## 流程
```
列表筛选/翻页 → 进详情(列表 deactivated 缓存)
→ 返回(仅关详情 Tab,push orderList)
→ 列表 activated 恢复,不触发 getList/refreshTable
```
## 手工回归清单
对**每个子 Tab**执行:
1. 设置 2+ 筛选条件 → 查询 → 翻到第 2 页
2. 进入详情 → 返回
3. 断言:筛选值、页码、表格行数据与离开前一致;Network 无新列表接口
4. 断言:一级/二级 Tab 与离开前一致
5. 主动切换二级 Tab 再切回 → 子列表应重新加载
6. 客户列表带 `customerName`/`customerPhone` 跳转 → 自动填充并查询
7. `updateRefesh` 全局刷新 → 列表仍触发刷新
8. 右键 Tab「重新加载」→ 恢复初始状态
9. 从 `orderSupplement` 进详情再返回 → 仍回补录页
## 不在范围
- `orderSupplement`、施工单、退款审核等其它页面
- `d2-table` 组件改动
- 浏览器刷新后状态保留(Phase 2 sessionStorage)
## 风险
- 详情页改单后列表可能过期:后续可用 `updateRefesh` 或 `refresh=1` query 处理
- 用户手动关闭列表 Tab 再打开:正常全新加载
# ROP 接口对接指南
本文档沉淀门店工作汇报(dailyReport)联调经验,供后续新接口快速对接复用。
## 1. 工具与模块
| 能力 | 路径 / 命令 |
|------|-------------|
| ROP 客户端(Node/脚本/集成测) | [`src/libs/rop/`](../../src/libs/rop/) |
| apiName 统一解析 | [`src/libs/rop/resolveApiName.js`](../../src/libs/rop/resolveApiName.js) |
| 签名(浏览器与 Node 共用) | [`src/libs/rop/signCore.js`](../../src/libs/rop/signCore.js) |
| Swagger 契约解析 | [`src/libs/rop/swaggerInspect.js`](../../src/libs/rop/swaggerInspect.js) |
| 契约 diff | [`src/libs/rop/contractDiff.js`](../../src/libs/rop/contractDiff.js) |
| Swagger 快照 | [`src/libs/rop/__snapshots__/smartcarlife.swagger.json`](../../src/libs/rop/__snapshots__/smartcarlife.swagger.json) |
| 脚手架 CLI | `npm run rop:swagger -- [--prefix\|--method] --out <dir> [--dry-run] [--force] [--contracts-only]` |
| 一键导入 CLI | `npm run rop:import -- --method <method> [--dry-run] [--force] [--json]` |
| 聊天导入 | [ROP_CHAT_IMPORT.md](./ROP_CHAT_IMPORT.md)(自然语言触发,读 [SKILL.md](../skills/rop-api-import/SKILL.md)) |
| 拉取快照 | `npm run rop:swagger:fetch` |
| 契约校验 | `npm run rop:contract:check` |
| 一键验证 | `npm run rop:verify` |
| 冒烟示例 | `npm run api:smoke:journal` |
| 冒烟模板 | [`scripts/rop-api-smoke.template.js`](../../scripts/rop-api-smoke.template.js) |
| Jest 测试辅助 | [`tests/helpers/ropTestClient.js`](../../tests/helpers/ropTestClient.js) |
浏览器内请求仍使用 [`src/api/request.js`](../../src/api/request.js)(内部已复用 `resolveApiName`),**不要**在 Vue 页面直接引用 `ropClient`。
---
## 2. 拉取 Swagger
**正确地址**(本项目 ROP):
```text
{host}/rop-dj-smartcarlife/swagger-rop/api-docs
```
不要使用 `/v3/api-docs`。
开发环境示例:
```text
http://dj.dev.glsx.com.cn/rop-dj-smartcarlife/swagger-rop/api-docs
```
接口路径约定:
```text
/router/{method}/1.0.0 → POST
```
### 契约更新流程
后端发版或联调前:
```bash
npm run rop:swagger:fetch
git diff src/libs/rop/__snapshots__/smartcarlife.swagger.json
npm run rop:contract:check
```
提交快照 diff,便于团队感知契约变更。
---
## 3. 读契约(ROP 特点)
1. **请求参数多为 query**,不是 JSON body(与常见 OpenAPI 不同)
2. **响应**为 `RopResponse<T>`,浏览器 axios 拦截器已解包 `data`(见 `baseConfig.axios.result`)
3. **列表**常为 `RpcPagination<T>`:`list / total / pageNum / pageSize`
4. `sessionId` 由 [`request.js`](../../src/api/request.js) 自动注入,adapter **不需要**处理
### 脚手架生成契约
省略 `--swagger` 时默认读取本地快照。
**单接口:**
```bash
npm run rop:swagger -- \
--method dj.api.smartcarlife.dailyReport.overview.page \
--feature journalRecord \
--out src/api/adapters/journalRecord \
--dry-run
```
**按前缀批量:**
```bash
npm run rop:swagger -- \
--prefix dj.api.smartcarlife.dailyReport \
--out src/api/adapters/journalRecord \
--contracts-only
```
`--contracts-only` 仅生成 `__contracts__`,不覆盖已有 adapter 实现文件。
生成物:
```text
src/api/adapters/{feature}/
build{Method}Params.js # 含 @typedef JSDoc
map{Method}Response.js
__contracts__/{method}.contract.json
__contracts__/{method}.contract.md
```
去掉 `--dry-run` 后落盘。已存在文件默认 **skip**(加 `--force` 才覆盖)。`--feature` 仅打印 mock 模板提示,不自动改已有 mock 文件;新建 mock 可加 `--mock`。
---
## 3.1 新接口 5 分钟上手
1. `npm run rop:swagger -- --prefix <prefix> --out src/api/adapters/{feature} --contracts-only --dry-run` 核对契约
2. 生成 adapter 模板或手工编写,补业务映射
3. `src/api/{feature}.js` 接入 `request` + adapter + mock
4. 复制 [`rop-api-smoke.template.js`](../../scripts/rop-api-smoke.template.js) 写冒烟脚本
5. `npm run rop:verify`(单测 + 契约校验 + 冒烟)通过后再测页面
---
## 4. Adapter 三层约定
以 [`src/api/adapters/journalRecord/`](../../src/api/adapters/journalRecord/) 为范本:
| 层级 | 命名 | 职责 |
|------|------|------|
| 请求 | `buildXxxParams(uiParams)` | 页面/表格筛选 → ROP 请求字段 |
| 行映射 | `mapXxxRow(dto)` | 单行 DTO → 表格列字段 |
| 分页 | `mapXxxPageResponse(res)` | 分页响应 → d2-table 结构 |
### UI 与 API 字段不一致
在 **adapter** 处理,例如:
- 下拉存 `staffUuid`,接口要 `staffName` → 在 `beforeSearchFn` 解析姓名后传入 `buildOverviewParams`
- `sceneType`(0 权益 / 1 轻改)→ `bizType` / `bizTypeName` → [`mapSceneType.js`](../../src/api/adapters/journalRecord/mapSceneType.js)
---
## 5. API 层(`src/api/*.js`)
```js
// 模式
export function getXxx(data) {
if (USE_MOCK) return loadMock().then(m => m.mockXxx(data));
const payload = { ...buildXxxParams(data), method: `${path}xxx.yyy` };
return request(payload, RequestMethods.POST).then(mapXxxPageResponse);
}
```
Mock 开关:`VUE_APP_{FEATURE}_MOCK=true` 时启用(参考 `VUE_APP_JOURNAL_MOCK` / `VUE_APP_ABNORMAL_FLOW_MOCK`),默认走真实接口。
---
## 6. Mock 规范
[`journalRecord.mock.js`](../../src/api/journalRecord.mock.js):
1. Mock 原始数据使用 **Swagger 字段名**(如 `sceneType`、`onBreak`、`createdDate`)
2. 必须经 **同一套 adapter** 输出,保证 Mock / 真实接口行为一致
3. 不要在 mock 里写 UI 字段名(如 `bizTypeName`),除非 adapter 不再转换
---
## 7. Node 客户端用法
```js
const { createLoggedInClient } = require("../src/libs/rop/ropClient");
async function main() {
const client = await createLoggedInClient({
userName: "glsadmin",
password: "123456",
apiName: "dj", // 可选,默认 dj
});
const data = await client.callSmartcarlife("dailyReport.overview.page", {
currentPage: 1,
pageSize: 10,
templateType: 1,
reportDate: "2026-07-16",
});
console.log(data.total, data.list?.length);
}
```
环境变量:
| 变量 | 说明 |
|------|------|
| `ROP_TEST_USER` / `ROP_TEST_PASSWORD` | 集成测试账号 |
| `ROP_SWAGGER_URL` | 拉取快照 / `--online` 校验时的 Swagger 地址 |
| `VUE_APP_CONFIG_CENTER_URL` | 配置中心;失败回退 `baseConfig.develop.json` |
| `ROP_INTEGRATION=1` | 开启集成测试(默认 skip) |
---
## 8. 联调 Checklist
- [ ] `npm run rop:swagger:fetch` 更新快照(或确认本地快照可用)
- [ ] `npm run rop:swagger -- ... --dry-run` 核对参数/响应
- [ ] 编写/补全 `src/api/adapters/{feature}/` adapters
- [ ] `src/api/*.js` 接入 request + adapter
- [ ] Mock 数据对齐 Swagger 字段
- [ ] `.env.development`:默认不开启 `VUE_APP_USE_DEVELOP_AXIOS`(配置中心成功则用返回配置);确认未设置 feature mock 开关(或 `VUE_APP_*_MOCK` 非 `true`)
- [ ] `npm run rop:contract:check` 契约基线通过
- [ ] `npm run api:smoke:journal`(或对应冒烟脚本)通过
- [ ] 浏览器登录验证页面
---
## 9. 附录:dailyReport 接口索引
| method | adapter 请求 | adapter 响应 |
|--------|-------------|--------------|
| `dailyReport.merchant.list` | (API 层补分页) | `mapMerchantList.js` |
| `dailyReport.overview.page` | `buildOverviewParams.js` | `mapOverviewRow.js` |
| `dailyReport.detail.select` | `buildDetailSelectParams` in `mapDetailResponse.js` | `mapDetailResponse.js` |
| `merchant.staff.list` | `merchantId` | `mapMerchantStaffList.js` |
契约文件见 [`__contracts__/`](../../src/api/adapters/journalRecord/__contracts__/)。
### overview.page 请求参数
`currentPage`, `pageSize`, `merchantId`, `staffName`, `reportDate`, `templateType`
### overview 列表关键响应字段
`sceneType`, `onBreak`, `createdDate`, `reportStatus`, `staffName`, `merchantName`
### detail.select
请求:`id`(必填)
响应:`jsonContent` + 基础元信息
---
## 10. 测试策略
| 类型 | 做法 |
|------|------|
| adapter 单测 | 直接 import 纯函数,传入 fixture DTO |
| API 层单测 | `jest.mock('@/api/request')`(见 [JEST_TESTING.md](../rules/JEST_TESTING.md)) |
| 契约校验 | `npm run rop:contract:check`(对比快照与 `__contracts__`) |
| 集成测 | `tests/helpers/ropTestClient.js` + `ROP_INTEGRATION=1` |
| 冒烟脚本 | `scripts/*-smoke.js` 调用 `createLoggedInClient` |
---
## 11. 复用验收清单
新 feature 接入完成后,逐项确认:
- [ ] `npm run rop:swagger -- ... --contracts-only` 生成并提交 `__contracts__`
- [ ] adapter 单测通过(至少覆盖请求映射 + 行映射)
- [ ] `npm run rop:contract:check` 通过
- [ ] `npm run api:smoke:{feature}` 或 `npm run rop:verify` exit 0
- [ ] `.env.development` 未误开 `VUE_APP_USE_DEVELOP_AXIOS=true`(除非个人本地需强制 dev 网关),未误开 feature mock(`VUE_APP_*_MOCK=true`)
- [ ] 浏览器页面可访问(需账号具备对应菜单权限)
- [ ] 脚手架未误覆盖已有 adapter(默认 skip;必要时才用 `--force`)
**一键验证命令**:
```bash
npm run rop:verify
```
包含 ROP 单测 + 契约校验 + dailyReport 冒烟,用于确认工具链本身可复用。
---
## 12. 聊天导入
在 Cursor 聊天框用自然语言导入单接口,详见 [ROP_CHAT_IMPORT.md](./ROP_CHAT_IMPORT.md)。
Agent 规程:[`/.ai/skills/rop-api-import/SKILL.md`](../skills/rop-api-import/SKILL.md)
```text
导入接口 dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve(总部运营审批流水报备)
```
流程:dry-run 预览 → 用户确认 → `rop:import` 落盘 → `rop:contract:check`。
# ROP 聊天导入
在 Cursor 聊天框用自然语言导入 ROP 接口,基于本地 Swagger 快照自动生成分层 adapter 并迁移已有 API 函数。
Agent 规程见 [/.ai/skills/rop-api-import/SKILL.md](../skills/rop-api-import/SKILL.md)。
---
## 快速开始
在 Cursor 聊天输入:
```text
导入接口 dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve(总部运营审批流水报备)
```
Agent 将:
1. 从本地 Swagger 快照解析契约(`src/libs/rop/__snapshots__/smartcarlife.swagger.json`)
2. 执行 `npm run rop:import -- ... --dry-run --json` 展示预览
3. 等你回复「确认导入」后落盘
4. 运行 `npm run rop:contract:check` 校验
等价终端命令:
```bash
# 预览
npm run rop:import -- "导入接口 dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve" --dry-run
# 落盘
npm run rop:import -- --method dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve
# 校验
npm run rop:contract:check
```
---
## 流程图
```mermaid
sequenceDiagram
participant User as 用户
participant Agent as Cursor_Agent
participant CLI as rop_import
participant Swagger as 本地快照
User->>Agent: 导入接口 dj.api...
Agent->>CLI: --dry-run --json
CLI->>Swagger: buildContract
CLI-->>Agent: 导入报告
Agent->>User: 预览 + 询问确认
User->>Agent: 确认导入
Agent->>CLI: 正式导入 --json
Agent->>CLI: rop:contract:check
Agent->>User: 汇总结果
```
---
## 与 rop:swagger 的区别
| 维度 | `rop:swagger` | `rop:import`(聊天导入) |
|------|---------------|--------------------------|
| 用途 | 批量生成契约/adapter 模板 | 单接口导入 + 迁移已有 API |
| 自然语言 | 不支持 | 支持 |
| API 文件改写 | 不处理 | 自动 migrateApiFile |
| 聊天场景 | 不适合 | **推荐** |
---
## 导入产出
```text
src/api/adapters/{feature}/
build{Method}Params.js
map{Method}Response.js
__contracts__/{method}.contract.json
__contracts__/{method}.contract.md
```
若 `src/api/*.js` 中已有引用该 method 的 `export function`,将自动迁移为 adapter 模式(函数名不变,Vue 通常无需修改)。
---
## 常见问题
### method 在 Swagger 中找不到
本地快照过旧,先更新:
```bash
npm run rop:swagger:fetch
```
### 文件显示 skipped
默认不覆盖已有契约/adapter。需要覆盖时:
```bash
npm run rop:import -- --method <method> --force
```
### 没有已有 API 函数
`rop:import` 不会自动新建 `export function`,需在 `src/api/*.js` 手工补充,模式见 [ROP_API_INTEGRATION.md](./ROP_API_INTEGRATION.md) §5。
### Mock 未自动迁移
目前仅 `abnormalFlow.mock.js` 支持自动迁移,其他 feature 需手工改 mock。
---
## 验收 checklist
- [ ] 聊天输入 method,Agent 先 dry-run 不写文件
- [ ] 确认后落盘,`rop-import.report.json` 生成
- [ ] `npm run rop:contract:check` 通过
- [ ] Swagger 缺失时提示 `rop:swagger:fetch`
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
* 优先复用现有 API * 优先复用现有 API
* 使用项目已有 axios 封装 * 使用项目已有 axios 封装
* 保持统一错误处理 * 保持统一错误处理
* 新接口对接流程、Swagger 脚手架、adapter 约定见 [ROP 接口对接指南](../docs/ROP_API_INTEGRATION.md)
不要直接创建新的请求框架。 不要直接创建新的请求框架。Node/脚本/集成测试使用 `src/libs/rop/`,浏览器仍走 `src/api/request.js`。
# ESLint 代码格式规范
生成或修改代码时**必须**符合项目 [`eslint.config.js`](../../eslint.config.js)(基于 `@antfu/eslint-config`),不得依赖用户手动 fix。
## 核心规则
| 类别 | 规则 | 要求 |
|------|------|------|
| JS 基础 | `stylistic/quotes` | 双引号 `"` |
| JS 基础 | `stylistic/semi` | 语句末尾分号 |
| JS 基础 | `array-bracket-spacing` | `[ "a", "b" ]` 括号内空格 |
| JS 基础 | `curly` | `if/for` 等必须写 `{}` |
| JS 基础 | `style/brace-style` | 1tbs(`else` 与 `}` 同行) |
| JS 缩进 | `stylistic/indent` | **Tab** 缩进(script / style 段) |
| Vue 结构 | `vue/block-order` | `template` → `script` → `style` |
| Vue 模板 | `vue/html-indent` | 2 空格缩进 |
| Vue 模板 | `vue/max-attributes-per-line` | 多行标签每行 1 个属性;单行最多 2 个 |
| Vue 模板 | `vue/attributes-order` | 指令 / 绑定 / 静态属性 / 事件 固定顺序 |
| Vue 模板 | `vue/first-attribute-linebreak` | 多行标签时,首属性紧跟标签名 |
| Vue 模板 | `vue/html-closing-bracket-newline` | 闭合括号不换行 |
| Vue 模板 | `vue/multiline-html-element-content-newline` | 多行元素内容前后换行 |
## Vue 属性顺序(速记)
```text
v-for / v-if / v-show → ref / key → v-model → v-xxx → id / class / style → :prop → @event
```
同组内按字母序(`vue/attributes-order` 的 `alphabetical: true`)。
## 模板示例
```vue
<!-- 正确:首属性同行,v-if 在 class 前,多行每行一个属性 -->
<div v-if="visible"
class="section-block">
<!-- 错误:v-if 在 class 后、同一行两个属性 -->
<div class="section-block" v-if="visible">
<!-- 正确:多行文本元素内容换行 -->
<div class="section-title">
区域经理审批
</div>
<!-- 正确:与同模块一致,组件非自闭合 -->
<detailComp
:config-data="flowInfoConfig"
:detail-info="detailInfo"
label-width="120px"
></detailComp>
```
## 与同目录文件对齐
- 新增 `.vue` 前先阅读同目录已有文件(如 `index.vue`、`detail.vue`)
- 模板段 2 空格;script / style 段 Tab
- 组件标签写法与同模块保持一致(如 `detailComp` 用 `></detailComp>`)
- import 顺序:上级目录模块先于同级模块(`../constants/...` 先于 `./detailComp.vue`)
## 完成前自检
1. 对照同目录 `.vue` 文件的写法
2. 多行标签不超过 1 属性/行
3. 条件指令(`v-if` / `v-loading`)写在静态 `class` 之前
4. 字符串双引号、数组括号内加空格、语句加分号
5. `if` 单行返回也写 `{}`
6. 不引入未使用的 import
7. 修改完成后对 touched files 执行 linter 检查,消除 ESLint 诊断
## 参考文件
- 配置:[`eslint.config.js`](../../eslint.config.js)
- 抽屉示例:[`src/views/financeManage/components/TmplDrawer.vue`](../../src/views/financeManage/components/TmplDrawer.vue)
- 详情页示例:[`src/views/financeManage/exceptionOrderManage/detail.vue`](../../src/views/financeManage/exceptionOrderManage/detail.vue)
...@@ -9,6 +9,8 @@ npm run lint ...@@ -9,6 +9,8 @@ npm run lint
npm run test:unit npm run test:unit
``` ```
AI 修改代码后,应对 touched files 消除 ESLint 诊断(IDE linter 或 `npm run lint`),避免提交前才暴露格式问题。格式细则见 [ESLINT.md](./ESLINT.md)。
### 开发性能与主题预研 ### 开发性能与主题预研
详见 [`.ai/docs/DEV_PERF_AND_THEME_RESEARCH.md`](../docs/DEV_PERF_AND_THEME_RESEARCH.md)(`npm run serve` 慢/OOM、懒加载开关、Element 主题静态化等方案的预研与后续落地顺序)。 详见 [`.ai/docs/DEV_PERF_AND_THEME_RESEARCH.md`](../docs/DEV_PERF_AND_THEME_RESEARCH.md)(`npm run serve` 慢/OOM、懒加载开关、Element 主题静态化等方案的预研与后续落地顺序)。
......
...@@ -13,7 +13,10 @@ ...@@ -13,7 +13,10 @@
"Bash(volta install:*)", "Bash(volta install:*)",
"Bash(where:*)", "Bash(where:*)",
"Bash(volta list:*)", "Bash(volta list:*)",
"Bash(rm:*)" "Bash(rm:*)",
"Bash(npm run rop:import:*)",
"Bash(npm run rop:contract:check:*)",
"Bash(npm run rop:swagger:fetch:*)"
] ]
} }
} }
---
name: rop-api-import
description: >-
从 Cursor 聊天导入 ROP 接口。当用户说「导入接口」「对接接口」「ROP 导入」或消息含
dj.api.smartcarlife.* 时使用。基于本地 Swagger 快照执行 npm run rop:import,
先 dry-run 预览,用户确认后再落盘。
---
# ROP 聊天导入
详细说明见 [ROP_CHAT_IMPORT.md](../../docs/ROP_CHAT_IMPORT.md)。
## 触发条件
满足**任一**即执行本 skill:
| 类型 | 模式 |
|------|------|
| 动词 | `导入接口`、`对接接口`、`ROP 导入`、`swagger 导入` |
| method | 文本含 `dj.api.smartcarlife.` |
| 组合 | `导入` + `dj.api.*` |
**不触发:** 仅讨论字段、仅问接口用法、无导入意图。
## 工作流(必须按顺序)
### 1. 解析 method
从用户原文提取 `dj.api.smartcarlife.*`。用户若指定 `--api` / `--feature`,保留给 CLI。
### 2. dry-run 预览(不落盘)
```bash
npm run rop:import -- "<用户原文或 method>" --dry-run --json
```
解析 stdout JSON,按下方模板回复用户。
### 3. 等待确认
仅当用户明确回复「确认导入」「落盘」「继续」后进入步骤 4。
用户回复「取消」则结束,不执行落盘。
用户明确说「跳过预览直接导入」时,可跳过 dry-run,但仍需告知将写入哪些文件。
### 4. 正式落盘
```bash
npm run rop:import -- --method <method> --json
```
若用户要求覆盖已有文件,加 `--force` 并二次确认。
### 5. 契约校验
```bash
npm run rop:contract:check
```
将结果汇总给用户。
## dry-run 回复模板
```markdown
## ROP 接口导入预览
| 项 | 值 |
|----|-----|
| 接口 | `<method>` |
| 说明 | <summary> |
| Feature | <feature> |
| API 文件 | <apiFile> |
| 已有函数 | <existingFunction 或「无,需手工补 export」> |
**请求参数:** <name* 表示必填,逗号分隔>
**响应:** <responseRoot> <pagination 时标注 (pagination)>
**文件计划:**
- <status>: <path>(逐项列出 files 数组)
数据源:本地 Swagger 快照 `src/libs/rop/__snapshots__/smartcarlife.swagger.json`
确认后我将执行落盘并运行 `npm run rop:contract:check`。回复「确认导入」继续,或「取消」放弃。
```
## 落盘完成回复模板
```markdown
## 导入完成
- 文件变更:(按 files 数组列出 status + path)
- 契约校验:<通过 / 失败及原因>
**后续建议:**
1. 检查 adapter 内字段映射是否符合页面需求
2. 关闭 feature mock 后浏览器验证页面
```
## 错误处理
| 错误 | Agent 动作 |
|------|-----------|
| 未找到 method | 请用户提供完整 `dj.api.smartcarlife.*` |
| Swagger 中未找到 method | 建议 `npm run rop:swagger:fetch` 后重试 dry-run |
| 仅支持 dj.api.smartcarlife.* | 检查 method 拼写 |
| files 多为 skipped | 说明默认不覆盖;覆盖需 `--force` |
| rop:contract:check 失败 | 展示失败信息,建议检查契约 diff |
| 无 existingFunction | 提示在 `src/api/*.js` 手工补 export,参考 [ROP_API_INTEGRATION.md](../../docs/ROP_API_INTEGRATION.md) §5 |
## 禁止事项
- 不要手写 adapter 替代 CLI(CLI 失败且用户明确要求手工补除外)
- 不要在 Vue 页面引用 `ropClient`
- 不要未经确认直接落盘(用户明确跳过预览除外)
- 不要误用 `rop:swagger`;聊天导入默认走 `rop:import`
- 不要修改 `src/libs/rop/__snapshots__/` 快照内容
## 能力边界
- Mock 迁移目前仅支持 `abnormalFlow.mock.js`
- 无已有 API 函数时不自动新建 `export function`
- 默认不覆盖已有 adapter/契约文件
[mcp_servers.codegraph]
command = "codegraph"
args = [
"serve",
"--mcp",
]
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
body {
margin:0;
background: #fafafa;
}
.swagger-ui .topbar .download-url-wrapper{
display: none;
}
</style>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
<defs>
<symbol viewBox="0 0 20 20" id="unlocked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
</symbol>
<symbol viewBox="0 0 20 20" id="locked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="close">
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow">
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow-down">
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
</symbol>
<symbol viewBox="0 0 24 24" id="jump-to">
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
</symbol>
<symbol viewBox="0 0 24 24" id="expand">
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
</symbol>
</defs>
</svg>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js"> </script>
<script src="./swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function() {
// Build a system
const ui = SwaggerUIBundle({
url: window.location.href.replace(/swagger-ui\/v3\/index.html/, "swagger-rop/api-docs"),
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
window.ui = ui
}
</script>
</body>
</html>
...@@ -4,4 +4,8 @@ ...@@ -4,4 +4,8 @@
# VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS # VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
VUE_APP_REPO=http://192.168.3.171:7300/mock/5be17454f31545347559d499/config VUE_APP_REPO=http://192.168.3.171:7300/mock/5be17454f31545347559d499/config
VUE_APP_CONFIG_CENTER_URL=https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config # 配置中心地址继承 .env 中的 VUE_APP_CONFIG_CENTER_URL(config-center-backend)
# 配置中心成功时直接使用返回的环境配置(测试/正式);不可用时回退 baseConfig.develop.json
# 若需强制本地 dev 网关,在 .env.development.local 设 VUE_APP_USE_DEVELOP_AXIOS=true
# 门店工作汇报:默认走真实 dailyReport 接口;本地需 Mock 时设 VUE_APP_JOURNAL_MOCK=true
...@@ -42,3 +42,6 @@ yarn-error.log* ...@@ -42,3 +42,6 @@ yarn-error.log*
# test # test
/playwright/ /playwright/
/testCase/ /testCase/
# ROP import runtime report
rop-import.report.json
...@@ -14,12 +14,10 @@ ...@@ -14,12 +14,10 @@
"explorer.compactFolders": false, "explorer.compactFolders": false,
"scm.compactFolders": false, "scm.compactFolders": false,
"problems.decorations.enabled": false, "problems.decorations.enabled": false,
"vetur.validation.template": false, // Vue - Official:仅保留高亮/补全/跳转,关闭内置格式化
"vetur.validation.script": false, "vue.format.script.enabled": false,
"vetur.validation.style": true, "vue.format.template.enabled": false,
"vetur.useWorkspaceDependencies": true, "vue.format.style.enabled": false,
"vetur.ignoreProjectWarning": false,
"vetur.experimental.templateInterpolationService": false,
"editor.defaultFormatter": "dbaeumer.vscode-eslint", "editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true, "editor.formatOnSave": true,
"search.exclude": { "search.exclude": {
...@@ -45,9 +43,10 @@ ...@@ -45,9 +43,10 @@
"[typescriptreact]": { "[typescriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint" "editor.defaultFormatter": "dbaeumer.vscode-eslint"
}, },
// Vue // Vue:格式化走 ESLint,不走 Vue - Official
"[vue]": { "[vue]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint" "editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true
}, },
// JSON // JSON
"[json]": { "[json]": {
...@@ -116,6 +115,9 @@ ...@@ -116,6 +115,9 @@
"explorer.fileNesting.enabled": true, "explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false, "explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": { "explorer.fileNesting.patterns": {
"*.js": "$(capture).spec.js, $(capture).test.js" "*.js": "$(capture).spec.js, $(capture).test.js",
".env": ".env.*, .env.nomock, .env.local, .env.development, .env.production, .env.test, .env.staging",
"eslint.config.js": ".editorconfig"
} }
} }
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
请优先阅读: 请优先阅读:
- /.ai/rules/ 目录下的文件 - /.ai/rules/ 目录下的文件
- /.ai/rules/ESLINT.md(代码格式,生成代码必遵)
- ROP 聊天导入:/.ai/skills/rop-api-import/SKILL.md、/.ai/docs/ROP_CHAT_IMPORT.md
- 开发性能 / Element 主题预研:/.ai/docs/DEV_PERF_AND_THEME_RESEARCH.md - 开发性能 / Element 主题预研:/.ai/docs/DEV_PERF_AND_THEME_RESEARCH.md
## 项目概述 ## 项目概述
...@@ -137,6 +139,16 @@ export default {}; ...@@ -137,6 +139,16 @@ export default {};
--- ---
## 代码格式(ESLint)
生成或修改代码**必须**符合 [`eslint.config.js`](eslint.config.js),细则见 [`.ai/rules/ESLINT.md`](.ai/rules/ESLINT.md)。
* 不得依赖用户手动 fix;写代码时按 ESLINT.md 执行
* 修改完成后对 touched files 检查 linter,消除 ESLint 诊断
* 若与同目录旧文件缩进不一致,以 ESLint 规则 + 同模块现有文件为准
---
## 错误处理 ## 错误处理
用户操作失败时: 用户操作失败时:
......
/**
* E2E 登录辅助(Vuex 内存登录态)
*
* 本项目路由守卫依赖 store 内存,不能用 storageState 跨 context。
* 新用例请在 beforeAll 中调用 createLoggedInPage,整文件复用返回的 page。
*/
export function getBaseUrl() {
return (process.env.BASE_URL || "http://192.168.1.146:8080/dj-carlife-web/").replace(
/\/$/,
"",
);
}
export async function login(page, {
account = "glsadmin",
password = "123456",
} = {}) {
const baseUrl = getBaseUrl();
await page.goto(`${baseUrl}/#/login`);
await page.getByPlaceholder("账户").fill(account);
await page.getByPlaceholder("密码").fill(password);
await page.getByRole("button", { name: "登录" }).click();
await page.waitForURL(/#\/index/);
await page.waitForLoadState("networkidle");
}
/**
* 创建已登录的共享 page(beforeAll 调用一次即可)
* @returns {Promise<import('@playwright/test').Page>}
*/
export async function createLoggedInPage(browser, options = {}) {
const context = await browser.newContext();
const page = await context.newPage();
page.setDefaultTimeout(options.timeout || 10000);
page.setDefaultNavigationTimeout(options.navigationTimeout || 30000);
await login(page, options);
return page;
}
import path from "node:path"; import path from "path";
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { createLoggedInPage, getBaseUrl } from "./helpers/auth.js";
const BASE_URL = (process.env.BASE_URL || "http://192.168.1.146:8080/dj-carlife-web/").replace(/\/$/, ""); const BASE_URL = getBaseUrl();
const IMAGE_FIXTURE = path.resolve(process.cwd(), "public", "header-man.jpg"); const IMAGE_FIXTURE = path.resolve(process.cwd(), "public", "header-man.jpg");
const LOGIN_ACCOUNT = "glsadmin"; const LOGIN_ACCOUNT = "glsadmin";
...@@ -41,15 +42,6 @@ async function waitForModifyPageReady(page) { ...@@ -41,15 +42,6 @@ async function waitForModifyPageReady(page) {
}, null, { timeout: 60000 }); }, null, { timeout: 60000 });
} }
async function login(page) {
await page.goto(`${BASE_URL}/#/login`);
await page.getByPlaceholder("账户").fill(LOGIN_ACCOUNT);
await page.getByPlaceholder("密码").fill(LOGIN_PASSWORD);
await page.getByRole("button", { name: "登录" }).click();
await page.waitForURL(/#\/index/);
await waitForNetworkStable(page);
}
async function gotoStrategyList(page) { async function gotoStrategyList(page) {
await page.goto(`${BASE_URL}/#/marketing-push-strategy`); await page.goto(`${BASE_URL}/#/marketing-push-strategy`);
await waitForNetworkStable(page); await waitForNetworkStable(page);
...@@ -205,11 +197,13 @@ test.describe.serial("营销推送策略 E2E", () => { ...@@ -205,11 +197,13 @@ test.describe.serial("营销推送策略 E2E", () => {
let editedStrategyName = ""; let editedStrategyName = "";
test.beforeAll(async ({ browser }) => { test.beforeAll(async ({ browser }) => {
const context = await browser.newContext(); sharedPage = await createLoggedInPage(browser, {
sharedPage = await context.newPage(); account: LOGIN_ACCOUNT,
sharedPage.setDefaultTimeout(20000); password: LOGIN_PASSWORD,
sharedPage.setDefaultNavigationTimeout(60000); timeout: 20000,
await login(sharedPage); navigationTimeout: 60000,
});
await sharedPage.waitForTimeout(500);
}); });
test.afterAll(async () => { test.afterAll(async () => {
......
...@@ -15,32 +15,19 @@ ...@@ -15,32 +15,19 @@
*/ */
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { createLoggedInPage, getBaseUrl } from "./helpers/auth.js";
const BASE_URL = "http://192.168.1.146:8080/dj-carlife-web"; const BASE_URL = getBaseUrl();
test.describe("任务中心 (Task Center)", () => { test.describe("任务中心 (Task Center)", () => {
let sharedPage; let sharedPage;
// 全局前置:只运行一次,登录后共享 page // 全局前置:只运行一次,登录后共享 page(Vuex 内存态)
test.beforeAll(async ({ browser }) => { test.beforeAll(async ({ browser }) => {
const context = await browser.newContext(); sharedPage = await createLoggedInPage(browser);
sharedPage = await context.newPage();
// 执行登录
await sharedPage.goto(`${BASE_URL}/#/login`);
await sharedPage.getByPlaceholder("账户").fill("glsadmin");
await sharedPage.getByPlaceholder("密码").fill("123456");
await sharedPage.getByRole("button", { name: "登录" }).click();
await sharedPage.waitForURL(/#\/index/);
await sharedPage.waitForLoadState("networkidle");
console.log("登录完成"); console.log("登录完成");
}); });
// 每个 test 复用共享 page,设置默认超时
test.beforeEach(async () => {
sharedPage.setDefaultTimeout(10000);
sharedPage.setDefaultNavigationTimeout(30000);
});
// 全部测试结束后清理 // 全部测试结束后清理
test.afterAll(async () => { test.afterAll(async () => {
await sharedPage.context().close(); await sharedPage.context().close();
......
...@@ -27,7 +27,7 @@ export default antfu({ ...@@ -27,7 +27,7 @@ export default antfu({
"array-bracket-spacing": ["error", "always"], "array-bracket-spacing": ["error", "always"],
}, },
rules: { rules: {
"unicorn/prefer-node-protocol":"off", "unicorn/prefer-node-protocol": "off",
"curly": ["error", "all"], "curly": ["error", "all"],
"vue/no-deprecated-slot-attribute": "off", "vue/no-deprecated-slot-attribute": "off",
"vue/no-deprecated-v-on-native-modifier": "off", "vue/no-deprecated-v-on-native-modifier": "off",
...@@ -54,6 +54,8 @@ export default antfu({ ...@@ -54,6 +54,8 @@ export default antfu({
"vue/no-mutating-props": "off", "vue/no-mutating-props": "off",
"vue/no-deprecated-filter": "off", "vue/no-deprecated-filter": "off",
"vue/no-v-for-template-key-on-child": "off", "vue/no-v-for-template-key-on-child": "off",
// 关闭:强制组件 name 使用 PascalCase(由于 keep-alive 需要组件 name 与路由 name 一致,路由多为小写)
"vue/component-definition-name-casing": "off",
// 强制:Vue 多行 HTML 元素的内容前后必须换行 // 强制:Vue 多行 HTML 元素的内容前后必须换行
"vue/multiline-html-element-content-newline": [ "vue/multiline-html-element-content-newline": [
"error", "error",
......
...@@ -31,6 +31,7 @@ module.exports = { ...@@ -31,6 +31,7 @@ module.exports = {
testMatch: [ testMatch: [
"**/*.spec.js", "**/*.spec.js",
"**/*.integration.spec.js", "**/*.integration.spec.js",
"tests/**/*.spec.js",
], ],
testURL: "http://localhost/", testURL: "http://localhost/",
testEnvironment: "jsdom", testEnvironment: "jsdom",
......
This diff could not be displayed because it is too large.
...@@ -10,6 +10,12 @@ ...@@ -10,6 +10,12 @@
"build": "vue-cli-service build --no-module", "build": "vue-cli-service build --no-module",
"build:nomock": "vue-cli-service build --mode nomock", "build:nomock": "vue-cli-service build --mode nomock",
"lint": "vue-cli-service lint --fix", "lint": "vue-cli-service lint --fix",
"api:smoke:journal": "node scripts/journalRecord.api-smoke.js",
"rop:swagger": "node scripts/rop-swagger-scaffold.js",
"rop:swagger:fetch": "node scripts/rop-swagger-fetch.js",
"rop:contract:check": "node scripts/rop-contract-diff.js",
"rop:import": "node scripts/rop-import.js",
"rop:verify": "npm run test:unit -- tests/unit/libs/rop tests/unit/api/adapters/journalRecord && npm run rop:contract:check && npm run api:smoke:journal",
"report": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --report", "report": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --report",
"test:unit": "vue-cli-service test:unit" "test:unit": "vue-cli-service test:unit"
}, },
...@@ -20,9 +26,10 @@ ...@@ -20,9 +26,10 @@
"@sentry/vue": "^7.3.0", "@sentry/vue": "^7.3.0",
"ali-oss": "^6.22.0", "ali-oss": "^6.22.0",
"axios": "^0.18.0", "axios": "^0.18.0",
"baseline-browser-mapping": "^2.10.42",
"better-scroll": "^1.15.2", "better-scroll": "^1.15.2",
"bignumber.js": "^9.1.1", "bignumber.js": "^9.1.1",
"caniuse-lite": "^1.0.30001763", "caniuse-lite": "^1.0.30001803",
"core-js": "^3.8.3", "core-js": "^3.8.3",
"dayjs": "^1.8.12", "dayjs": "^1.8.12",
"default-passive-events": "^2.0.0", "default-passive-events": "^2.0.0",
......
...@@ -14,7 +14,8 @@ import { defineConfig, devices } from "@playwright/test"; ...@@ -14,7 +14,8 @@ import { defineConfig, devices } from "@playwright/test";
import dayjs from "dayjs"; import dayjs from "dayjs";
// 生成时间戳,用于报告和结果目录 // 生成时间戳,用于报告和结果目录
const timestamp = dayjs().format("YYYY-MM-DD HH:mm:ss"); // Windows 路径不能含冒号;报告/结果目录用安全时间戳
const timestamp = dayjs().format("YYYY-MM-DD_HH-mm-ss");
export default defineConfig({ export default defineConfig({
// 测试文件位置 // 测试文件位置
......
/**
* dailyReport 接口冒烟测试
* 用法: npm run api:smoke:journal
*/
const { createLoggedInClient } = require("../src/libs/rop/ropClient");
async function main() {
const client = await createLoggedInClient();
console.log("axios.baseURL:", client.config.baseURL);
console.log("axios.appkey:", client.config.appkey);
console.log("env:", client.config.env);
const merchantData = await client.callSmartcarlife("dailyReport.merchant.list", {
currentPage: 1,
pageSize: 10,
});
console.log(" merchant.list total:", merchantData?.total, "listLen:", merchantData?.list?.length);
const reportDate = new Date().toISOString().slice(0, 10);
const tabs = [
["staffDaily", 1],
["storeDaily", 2],
["negotiation", 3],
];
let fallbackMerchantId = merchantData?.list?.[0]?.merchantId;
for (const [tabKey, templateType] of tabs) {
const overviewData = await client.callSmartcarlife("dailyReport.overview.page", {
currentPage: 1,
pageSize: 10,
templateType,
reportDate,
});
console.log(`[OK] dailyReport.overview.page (${tabKey}) total:`, overviewData?.total);
if (!fallbackMerchantId && overviewData?.list?.[0]?.merchantId) {
fallbackMerchantId = overviewData.list[0].merchantId;
}
const firstId = overviewData?.list?.[0]?.id;
if (firstId) {
const detailData = await client.callSmartcarlife("dailyReport.detail.select", { id: firstId });
console.log(` detail ${tabKey} id=${firstId} jsonContent=`, !!detailData?.jsonContent);
}
}
if (fallbackMerchantId) {
const staffData = await client.callSmartcarlife("merchant.staff.list", {
merchantId: fallbackMerchantId,
});
const staffLen = Array.isArray(staffData) ? staffData.length : staffData?.list?.length;
console.log(`[OK] merchant.staff.list merchantId=${fallbackMerchantId} len=`, staffLen);
} else {
console.log("[SKIP] merchant.staff.list: 无可用 merchantId");
}
console.log("\nAll dailyReport smoke tests passed.");
}
main().catch((error) => {
console.error("\nSmoke test failed:", error.message);
process.exit(1);
});
/**
* ROP 接口冒烟模板(复制后改名使用)
*
* 1. 复制为 scripts/{feature}.api-smoke.js
* 2. 替换 METHOD_SUFFIX / PARAMS / 日志标签
* 3. package.json 增加 "api:smoke:{feature}": "node scripts/{feature}.api-smoke.js"
*/
const { createLoggedInClient } = require("../src/libs/rop/ropClient");
// TODO: 改为真实接口后缀,如 dailyReport.overview.page
const METHOD_SUFFIX = "your.api.suffix";
// TODO: 按 Swagger 契约填写请求参数
const PARAMS = {
currentPage: 1,
pageSize: 10,
};
async function main() {
const client = await createLoggedInClient();
console.log("axios.baseURL:", client.config.baseURL);
const data = await client.callSmartcarlife(METHOD_SUFFIX, PARAMS);
console.log(`[OK] ${METHOD_SUFFIX}`, {
isArray: Array.isArray(data),
total: data?.total,
listLen: Array.isArray(data) ? data.length : data?.list?.length,
});
console.log("\nSmoke test passed.");
}
main().catch((error) => {
console.error("\nSmoke test failed:", error.message);
process.exit(1);
});
#!/usr/bin/env node
/**
* 校验已跟踪 contract 与 Swagger 快照是否一致
*
* 默认离线模式(读本地快照):
* npm run rop:contract:check
*
* 对比线上与快照差异后校验:
* npm run rop:contract:check -- --online
*/
const {
loadSwagger,
DEFAULT_SWAGGER_SNAPSHOT,
} = require("../src/libs/rop/swaggerInspect");
const {
findTrackedContracts,
diffSnapshotWithTracked,
diffOnlineSnapshot,
} = require("../src/libs/rop/contractDiff");
const DEFAULT_ONLINE_URL = process.env.ROP_SWAGGER_URL
|| "http://dj.dev.glsx.com.cn/rop-dj-smartcarlife/swagger-rop/api-docs";
function parseArgs(argv) {
const args = {};
for (let i = 2; i < argv.length; i += 1) {
const key = argv[i];
if (!key.startsWith("--")) {
continue;
}
const name = key.slice(2);
const value = argv[i + 1];
if (value && !value.startsWith("--")) {
args[name] = value;
i += 1;
} else {
args[name] = true;
}
}
return args;
}
function printReport(title, report) {
console.log(`\n=== ${title} ===`);
if (report.checked != null) {
console.log(`Checked: ${report.checked}`);
}
if (report.added?.length) {
console.log("Added methods:", report.added.slice(0, 5).join(", "), report.added.length > 5 ? "..." : "");
}
if (report.removed?.length) {
console.log("Removed methods:", report.removed.slice(0, 5).join(", "), report.removed.length > 5 ? "..." : "");
}
report.warnings?.forEach((message) => console.warn("WARN:", message));
report.errors?.forEach((message) => console.error("ERROR:", message));
}
async function main() {
const args = parseArgs(process.argv);
const snapshotPath = args.snapshot || DEFAULT_SWAGGER_SNAPSHOT;
const tracked = findTrackedContracts();
if (!tracked.length) {
console.warn("No tracked contracts found under src/api/adapters/**/__contracts__");
process.exit(0);
}
const snapshot = await loadSwagger(snapshotPath);
let errors = [];
let warnings = [];
if (args.online) {
const onlineUrl = args.url || DEFAULT_ONLINE_URL;
const online = await loadSwagger(onlineUrl);
const onlineReport = diffOnlineSnapshot(snapshot, online);
printReport("Online vs Snapshot", onlineReport);
warnings = warnings.concat(onlineReport.warnings || []);
}
const trackedReport = diffSnapshotWithTracked(snapshot, tracked);
printReport("Tracked Contracts vs Snapshot", trackedReport);
errors = errors.concat(trackedReport.errors || []);
warnings = warnings.concat(trackedReport.warnings || []);
if (errors.length) {
console.error(`\nContract check failed with ${errors.length} error(s).`);
process.exit(1);
}
console.log(`\nContract check passed (${tracked.length} tracked, ${warnings.length} warning(s)).`);
}
main().catch((error) => {
console.error("Contract check failed:", error.message);
process.exit(1);
});
#!/usr/bin/env node
/**
* ROP 接口一键导入(契约 + adapter + 迁移已有 API)
*
* npm run rop:import -- --method dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve
* npm run rop:import -- --method ... --dry-run
*/
const { runImport, extractMethodFromText } = require("../src/libs/rop/ropImport");
function parseArgs(argv) {
const args = {};
for (let i = 2; i < argv.length; i += 1) {
const key = argv[i];
if (!key.startsWith("--")) {
if (!args._text) {
args._text = key;
} else {
args._text += ` ${key}`;
}
continue;
}
const name = key.slice(2);
const value = argv[i + 1];
if (value && !value.startsWith("--")) {
args[name] = value;
i += 1;
} else {
args[name] = true;
}
}
return args;
}
function printReport(report) {
console.log("\n=== ROP Import Report ===");
console.log("Method:", report.method);
if (report.summary) {
console.log("Summary:", report.summary);
}
console.log("Feature:", report.feature);
console.log("API file:", report.apiFile);
if (report.existingFunction) {
console.log("Migrated function:", report.existingFunction);
}
console.log("Request:", report.requestParams.map((p) => `${p.name}${p.required ? "*" : ""}`).join(", "));
console.log("Response:", report.responseRoot, report.pagination ? "(pagination)" : "");
console.log("\nFiles:");
report.files.forEach((item) => {
console.log(`- ${item.status}: ${item.path}`);
});
console.log("\nNext steps:");
report.nextSteps.forEach((step) => console.log(`- ${step}`));
if (report.reportPath) {
console.log("\nReport:", report.reportPath);
}
}
const USAGE = "Usage: npm run rop:import -- --method <dj.api.smartcarlife.*> "
+ "[--feature name] [--api finance] [--dry-run] [--force] [--json]";
async function runCli(argv, deps = {}) {
const runImportFn = deps.runImport || runImport;
const extractFn = deps.extractMethodFromText || extractMethodFromText;
const args = parseArgs(argv);
const method = args.method || extractFn(args._text || "");
if (!method) {
const error = new Error(USAGE);
error.code = "USAGE";
throw error;
}
const report = await runImportFn({
method,
feature: args.feature,
api: args.api,
dryRun: !!args["dry-run"],
force: !!args.force,
swagger: args.swagger,
});
return { report, json: !!args.json };
}
async function main() {
const { report, json } = await runCli(process.argv);
if (json) {
console.log(JSON.stringify(report, null, 2));
} else {
printReport(report);
}
}
if (require.main === module) {
main().catch((error) => {
console.error("Import failed:", error.message);
if (error.cause?.message) {
console.error("Cause:", error.cause.message);
}
process.exit(error.code === "USAGE" ? 1 : 1);
});
}
module.exports = {
parseArgs,
printReport,
runCli,
USAGE,
};
#!/usr/bin/env node
/**
* 拉取 ROP Swagger 契约快照
*
* 示例:
* npm run rop:swagger:fetch
* npm run rop:swagger:fetch -- --url http://dj.dev.glsx.com.cn/rop-dj-smartcarlife/swagger-rop/api-docs
*/
const fs = require("fs");
const path = require("path");
const { loadSwagger, countRouterMethods } = require("../src/libs/rop/swaggerInspect");
const DEFAULT_URL = process.env.ROP_SWAGGER_URL
|| "http://dj.dev.glsx.com.cn/rop-dj-smartcarlife/swagger-rop/api-docs";
const DEFAULT_OUT = path.join(
__dirname,
"../src/libs/rop/__snapshots__/smartcarlife.swagger.json",
);
function parseArgs(argv) {
const args = {};
for (let i = 2; i < argv.length; i += 1) {
const key = argv[i];
if (!key.startsWith("--")) {
continue;
}
const name = key.slice(2);
const value = argv[i + 1];
if (value && !value.startsWith("--")) {
args[name] = value;
i += 1;
} else {
args[name] = true;
}
}
return args;
}
async function main() {
const args = parseArgs(process.argv);
const url = args.url || DEFAULT_URL;
const out = path.resolve(args.out || DEFAULT_OUT);
const swagger = await loadSwagger(url);
const methodCount = countRouterMethods(swagger);
ensureDir(path.dirname(out));
fs.writeFileSync(out, `${JSON.stringify(swagger, null, 2)}\n`, "utf8");
console.log("Fetched:", url);
console.log("Wrote:", out);
console.log("Router methods:", methodCount);
}
function ensureDir(dir) {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}
}
main().catch((error) => {
console.error("Fetch failed:", error.message);
process.exit(1);
});
#!/usr/bin/env node
/**
* ROP Swagger 契约查阅 + adapter 脚手架
*
* 示例:
* node scripts/rop-swagger-scaffold.js \
* --prefix dj.api.smartcarlife.dailyReport \
* --out src/api/adapters/journalRecord
*
* node scripts/rop-swagger-scaffold.js \
* --method dj.api.smartcarlife.dailyReport.overview.page \
* --out src/api/adapters/journalRecord
*/
const fs = require("fs");
const path = require("path");
const {
loadSwagger,
buildContract,
formatContractMarkdown,
buildParamsTemplate,
buildResponseTemplate,
buildMockStub,
toMethodFileName,
methodSuffixToPascal,
listMethodsByPrefix,
DEFAULT_SWAGGER_SNAPSHOT,
} = require("../src/libs/rop/swaggerInspect");
function parseArgs(argv) {
const args = {};
for (let i = 2; i < argv.length; i += 1) {
const key = argv[i];
if (!key.startsWith("--")) {
continue;
}
const name = key.slice(2);
const value = argv[i + 1];
if (value && !value.startsWith("--")) {
args[name] = value;
i += 1;
} else {
args[name] = true;
}
}
return args;
}
function ensureDir(dir) {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}
}
function writeFileSafe(filePath, content, { dryRun, force }) {
if (dryRun) {
console.log(`\n--- ${filePath} ---\n${content}`);
return "wrote";
}
if (fs.existsSync(filePath) && !force) {
console.warn("Skipped (exists, use --force to overwrite):", filePath);
return "skipped";
}
ensureDir(path.dirname(filePath));
fs.writeFileSync(filePath, content, "utf8");
console.log("Wrote:", filePath);
return "wrote";
}
function scaffoldMethod(swaggerDoc, method, out, feature, writeOpts) {
const contract = buildContract(swaggerDoc, method);
const pascal = methodSuffixToPascal(method);
const methodFile = toMethodFileName(method);
const adaptersDir = path.resolve(out);
const contractsDir = path.join(adaptersDir, "__contracts__");
const paramsFile = path.join(adaptersDir, `build${pascal}Params.js`);
const responseFile = path.join(adaptersDir, `map${pascal}Response.js`);
const contractJson = path.join(contractsDir, `${methodFile}.contract.json`);
const contractMd = path.join(contractsDir, `${methodFile}.contract.md`);
const results = {
method,
files: [],
};
results.files.push(writeFileSafe(contractJson, `${JSON.stringify(contract, null, 2)}\n`, writeOpts));
results.files.push(writeFileSafe(contractMd, `${formatContractMarkdown(contract)}\n`, writeOpts));
if (!writeOpts.contractsOnly) {
results.files.push(writeFileSafe(paramsFile, buildParamsTemplate(contract), writeOpts));
results.files.push(writeFileSafe(responseFile, buildResponseTemplate(contract), writeOpts));
}
if (feature && !writeOpts.contractsOnly) {
const mockPath = path.resolve("src/api", `${feature}.mock.js`);
const fnName = `mock${pascal}`;
const mockStub = buildMockStub(contract, feature);
console.log(`\nMock 提示: 请在 src/api/${feature}.mock.js 中手动添加 ${fnName}`);
console.log("参考模板:");
console.log(mockStub.trim());
if (mockFlag(writeOpts) && !writeOpts.dryRun) {
if (fs.existsSync(mockPath)) {
console.warn("Mock 文件已存在,未自动修改:", mockPath);
} else {
const mockContent = `function delay(result, ms = 300) {
\treturn new Promise((resolve) => {
\t\tsetTimeout(() => resolve(result), ms);
\t});
}
${mockStub}`;
writeFileSafe(mockPath, mockContent, writeOpts);
}
}
}
return results;
}
function mockFlag(writeOpts) {
return !!writeOpts.mock;
}
function summarizeRow(results) {
const wrote = results.files.filter((s) => s === "wrote").length;
const skipped = results.files.filter((s) => s === "skipped").length;
return { wrote, skipped, failed: 0 };
}
async function main() {
const args = parseArgs(process.argv);
const {
swagger,
method,
prefix,
feature,
out,
"dry-run": dryRunFlag,
force: forceFlag,
mock: mockFlagArg,
"contracts-only": contractsOnlyFlag,
} = args;
if (!out || (!method && !prefix)) {
console.error(
"Usage: node scripts/rop-swagger-scaffold.js "
+ "--out <adapterDir> (--method <rop.method> | --prefix <rop.prefix>) "
+ "[--swagger <url|path>] [--feature name] [--dry-run] [--force] [--mock] [--contracts-only]",
);
process.exit(1);
}
if (method && prefix) {
console.error("Error: --method and --prefix are mutually exclusive");
process.exit(1);
}
const swaggerSource = swagger || DEFAULT_SWAGGER_SNAPSHOT;
const writeOpts = {
dryRun: !!dryRunFlag,
force: !!forceFlag,
mock: !!mockFlagArg,
contractsOnly: !!contractsOnlyFlag,
};
const swaggerDoc = await loadSwagger(swaggerSource);
const methods = method ? [method] : listMethodsByPrefix(swaggerDoc, prefix);
if (!methods.length) {
console.error(prefix ? `No methods found for prefix: ${prefix}` : `Method not found: ${method}`);
process.exit(1);
}
console.log(`Swagger: ${swaggerSource}`);
console.log(`Methods: ${methods.length}`);
const summary = [];
methods.forEach((item) => {
try {
const result = scaffoldMethod(swaggerDoc, item, out, feature, writeOpts);
const row = summarizeRow(result);
summary.push({ method: item, ...row });
console.log("\nContract summary:", item);
const contract = buildContract(swaggerDoc, item);
console.log("Request params:", contract.request.parameters.map((p) => p.name).join(", "));
console.log("Response root:", contract.response.rootType);
if (contract.response.pagination) {
console.log("Pagination:", contract.response.pagination.type);
}
} catch (error) {
console.error(`Failed: ${item} - ${error.message}`);
summary.push({ method: item, wrote: 0, skipped: 0, failed: 1 });
}
});
console.log("\n=== Summary ===");
console.log("method | wrote | skipped | failed");
summary.forEach((row) => {
console.log(`${row.method} | ${row.wrote} | ${row.skipped} | ${row.failed}`);
});
if (summary.some((row) => row.failed > 0)) {
process.exit(1);
}
}
main().catch((error) => {
console.error("Scaffold failed:", error.message);
process.exit(1);
});
/**
* 本地验证:洽谈明细 subform v2 格式归一化与回显
* 运行: node scripts/verify-journal-subform-echo.mjs
*/
const EMPTY_TEXT = "—";
function getSubformTemplate(field = {}) {
const children = field.children;
if (Array.isArray(children) && children.length) {
return Array.isArray(children[0]) ? children[0] : children;
}
if (Array.isArray(field.origin_children) && field.origin_children.length) {
return field.origin_children;
}
return [];
}
function extractSubformRowData(rowEntry, subformKey) {
if (!rowEntry || typeof rowEntry !== "object") {
return {};
}
if (subformKey && rowEntry[subformKey] && typeof rowEntry[subformKey] === "object") {
return rowEntry[subformKey];
}
return rowEntry;
}
function hasSubformRowData(value) {
if (!Array.isArray(value) || !value.length) {
return false;
}
return value.some((row) => Array.isArray(row) && row.length);
}
function normalizeSubformField(field = {}) {
if (field.type !== "subform") {
return field;
}
const template = getSubformTemplate(field);
let value = field.value;
if (!hasSubformRowData(value) && Array.isArray(field.childrenValue) && field.childrenValue.length) {
value = field.childrenValue.map((rowEntry) => {
const rowData = extractSubformRowData(rowEntry, field.key);
return template.map((col) => ({
...col,
value: rowData[col.key],
}));
});
}
return {
...field,
children: template.length ? [ template ] : field.children,
value,
};
}
function isLabelValueObject(raw) {
return raw != null && typeof raw === "object" && !Array.isArray(raw) && "text" in raw;
}
function formatCarBrandValue(raw) {
if (raw == null || raw === "") {
return EMPTY_TEXT;
}
if (typeof raw === "object") {
if (raw.displayText) {
return raw.displayText;
}
const parts = [
raw.vehicleBrandName,
raw.vehicleSubBrandName,
raw.vehicleSeriesName,
raw.vehicleShapeName,
].filter((part) => part != null && part !== "");
return parts.length ? parts.join(" / ") : EMPTY_TEXT;
}
return String(raw);
}
function resolveLabelValueRaw(raw, type) {
if (!isLabelValueObject(raw)) {
return raw;
}
if (raw.text != null && raw.text !== "") {
return raw.text;
}
if (type === "carBrandSelect" && raw.value != null) {
return formatCarBrandValue(raw.value);
}
if (raw.value != null && raw.value !== "") {
return raw.value;
}
return raw;
}
function formatEchoValue(field = {}) {
const { type } = field;
const raw = field.value;
if (raw == null || raw === "") {
return EMPTY_TEXT;
}
if (type === "select" || type === "radio") {
const displayRaw = resolveLabelValueRaw(raw, type);
if (displayRaw !== raw) {
return String(displayRaw);
}
return String(raw);
}
if (type === "carBrandSelect") {
const displayRaw = resolveLabelValueRaw(raw, type);
if (displayRaw !== raw) {
return String(displayRaw);
}
return formatCarBrandValue(raw);
}
if (type === "numberInput") {
const unit = field.unit ? String(field.unit) : "";
return `${raw}${unit}`;
}
return String(raw);
}
function buildSubformTable(field = {}) {
const template = getSubformTemplate(field);
const rowFieldsList = Array.isArray(field.value) ? field.value : [];
const rows = rowFieldsList.map((rowFields) => {
const row = {};
const cells = Array.isArray(rowFields) ? rowFields : [];
cells.forEach((cell) => {
if (cell?.key) {
row[cell.key] = formatEchoValue(cell);
}
});
return row;
});
return { columns: template, rows };
}
const subform = normalizeSubformField({
label: "洽谈明细 (轻改)",
key: "F3-4",
type: "subform",
origin_children: [
{ label: "洽谈日期", key: "F3-4-1", type: "date" },
{ label: "驻店人员", key: "F3-4-2", type: "select" },
{ label: "销售/交付/SA", key: "F3-4-4", type: "select" },
{ label: "车型配置", key: "F3-4-7", type: "carBrandSelect" },
{ label: "窗膜金额", key: "F3-4-13", type: "numberInput", unit: "元" },
],
childrenValue: [
{
"F3-4": {
"F3-4-1": "2026-07-20",
"F3-4-2": { text: "小王", value: "staff-id" },
"F3-4-4": { text: "7Na", value: "sa-id" },
"F3-4-7": {
text: "鸿蒙智行-AITO 问界-问界M7",
value: { vehicleBrandName: "鸿蒙智行" },
},
"F3-4-13": 1,
},
},
],
});
const table = buildSubformTable(subform);
const row = table.rows[0] || {};
const checks = [
[ "children columns", subform.children?.[0]?.length, 5 ],
[ "value rows", subform.value?.length, 1 ],
[ "F3-4-1", row["F3-4-1"], "2026-07-20" ],
[ "F3-4-2", row["F3-4-2"], "小王" ],
[ "F3-4-4", row["F3-4-4"], "7Na" ],
[ "F3-4-7", row["F3-4-7"], "鸿蒙智行-AITO 问界-问界M7" ],
[ "F3-4-13", row["F3-4-13"], "1元" ],
];
let failed = false;
checks.forEach(([ label, actual, expected ]) => {
const ok = actual === expected;
console.log(`${ok ? "OK" : "FAIL"} ${label}:`, actual);
if (!ok) {
failed = true;
}
});
process.exit(failed ? 1 : 0);
import { mapAbnormalFlowDeclarationApproveResponse } from "./adapters/abnormalFlowDeclaration/mapAbnormalFlowDeclarationApproveResponse";
import { mapAbnormalFlowDeclarationDetailResponse } from "./adapters/abnormalFlowDeclaration/mapAbnormalFlowDeclarationDetailResponse";
function delay(result, ms = 300) {
return new Promise((resolve) => {
setTimeout(() => resolve(result), ms);
});
}
function delayReject(error, ms = 300) {
return new Promise((_, reject) => {
setTimeout(() => reject(error), ms);
});
}
function paginate(list, params = {}) {
const { currentPage = 1, pageSize = 10 } = params;
const start = (currentPage - 1) * pageSize;
return {
list: list.slice(start, start + pageSize),
total: list.length,
pageNum: currentPage,
pageSize,
};
}
function buildTradeFields(item) {
return {
tradeNo: item.tradeNo,
totalPrice: item.totalPrice,
notRefundedTotalPrice: item.notRefundedTotalPrice,
payDate: item.payDate,
payChannel: item.payChannel,
payType: item.payType,
posTrmNo: item.posTrmNo,
merchantName: item.merchantName,
yqMerchantName: item.yqMerchantName,
distributionStatus: item.distributionStatus,
refundStatus: item.refundStatus,
};
}
function buildListItem(item) {
const row = {
...buildTradeFields(item),
declarationId: item.declarationId,
declarationApprovalStatus: item.declarationApprovalStatus,
};
return row;
}
function createMockItem(config) {
return {
merchantId: config.merchantId || "44211349",
merchantName: config.merchantName || "深圳龙观汽车科技有限公司",
tradeNo: config.tradeNo,
totalPrice: config.totalPrice,
notRefundedTotalPrice: config.notRefundedTotalPrice,
payDate: config.payDate || "2026-05-03 21:10:12",
payChannel: config.payChannel || "微信支付",
payType: config.payType || "1",
posTrmNo: config.posTrmNo || "T00123456",
yqMerchantName: config.yqMerchantName || "深圳龙观园区店",
distributionStatus: config.distributionStatus || "1",
refundStatus: config.refundStatus || "0",
declarationId: config.declarationId,
declarationApprovalStatus: config.declarationApprovalStatus,
abnormalType: config.abnormalType || "1",
remark: config.remark || "客户已付款,系统暂未录单,请审批。",
createdBy: config.createdBy || "张三",
createdDate: config.createdDate || "2026-05-03 21:10:12",
voucherImageUrls: config.voucherImageUrls || [
"https://via.placeholder.com/120x120.png?text=voucher1",
],
approvalLogs: config.approvalLogs || [],
};
}
const mockDeclarationStore = [
createMockItem({
declarationId: 1001,
declarationApprovalStatus: 1,
tradeNo: "TX20260503001",
totalPrice: 1280,
notRefundedTotalPrice: 1280,
approvalLogs: [],
}),
createMockItem({
declarationId: 1002,
declarationApprovalStatus: 2,
tradeNo: "TX20260503002",
totalPrice: 2560,
notRefundedTotalPrice: 2000,
remark: "凭证不完整,区域经理驳回。",
approvalLogs: [
{
approvalStatus: "2",
operatorName: "李四",
createdDate: "2026-05-03 22:00:00",
remark: "请补充支付凭证后重新报备。",
approvalSource: "0",
},
],
}),
createMockItem({
declarationId: 1003,
declarationApprovalStatus: 3,
tradeNo: "TX20260503003",
totalPrice: 3680,
notRefundedTotalPrice: 3680,
remark: "客户通过微信线上已付款,但未在系统录单。",
approvalLogs: [
{
approvalStatus: "3",
operatorName: "李四",
createdDate: "2026-05-03 21:30:10",
remark: "情况属实,同意总部运营进一步审核。",
approvalSource: "0",
},
],
}),
createMockItem({
declarationId: 1004,
declarationApprovalStatus: 4,
tradeNo: "TX20260503004",
totalPrice: 980,
notRefundedTotalPrice: 980,
approvalLogs: [
{
approvalStatus: "3",
operatorName: "李四",
createdDate: "2026-05-03 21:30:10",
remark: "情况属实,同意总部运营进一步审核。",
approvalSource: "0",
},
{
approvalStatus: "4",
operatorName: "王五",
createdDate: "2026-05-04 10:00:00",
remark: "材料不完整,予以驳回。",
approvalSource: "1",
},
],
}),
createMockItem({
declarationId: 1005,
declarationApprovalStatus: 5,
tradeNo: "TX20260503005",
totalPrice: 5200,
notRefundedTotalPrice: 5200,
approvalLogs: [
{
approvalStatus: "3",
operatorName: "李四",
createdDate: "2026-05-03 21:30:10",
remark: "情况属实,同意总部运营进一步审核。",
approvalSource: "0",
},
{
approvalStatus: "5",
operatorName: "王五",
createdDate: "2026-05-04 10:00:00",
remark: "同意延期观察。",
approvalSource: "1",
},
],
}),
createMockItem({
declarationId: null,
declarationApprovalStatus: null,
tradeNo: "TX20260503006",
totalPrice: 1500,
notRefundedTotalPrice: 1500,
}),
createMockItem({
declarationId: null,
declarationApprovalStatus: null,
tradeNo: "TX20260503007",
totalPrice: 880,
notRefundedTotalPrice: 880,
}),
createMockItem({
declarationId: 1006,
declarationApprovalStatus: 3,
tradeNo: "TX20260503008",
totalPrice: 1999,
notRefundedTotalPrice: 1999,
abnormalType: "6",
remark: "支付金额与订单金额不一致。",
approvalLogs: [
{
approvalStatus: "3",
operatorName: "赵六",
createdDate: "2026-05-05 09:15:00",
remark: "已核实,转总部审批。",
approvalSource: "0",
},
],
}),
];
function findStoreItem(id) {
return mockDeclarationStore.find(
(item) => item.declarationId != null && String(item.declarationId) === String(id),
);
}
function filterList() {
// mock 不按路由 merchantId 过滤,避免与固定测试数据不一致导致空列表
return [...mockDeclarationStore];
}
export function mockAbnormalPaymentDetailPage(data = {}) {
const filtered = filterList(data);
const page = paginate(filtered.map(buildListItem), data);
return delay(page);
}
export function mockPcAbnormalFlowDeclarationDetail(data = {}) {
const item = findStoreItem(data.id);
if (!item) {
return delayReject(new Error("报备记录不存在"));
}
return delay(mapAbnormalFlowDeclarationDetailResponse({
tradeInfo: buildTradeFields(item),
declarationInfo: {
abnormalType: item.abnormalType,
remark: item.remark,
createdBy: item.createdBy,
createdDate: item.createdDate,
voucherImageUrls: item.voucherImageUrls,
},
approvalLogs: item.approvalLogs || [],
}));
}
export function mockApprovePcAbnormalFlowDeclaration(data = {}) {
const item = findStoreItem(data.id);
if (!item) {
return delayReject(new Error("报备记录不存在"));
}
const approvalStatus = String(data.approvalStatus);
item.declarationApprovalStatus = Number(approvalStatus);
if (!Array.isArray(item.approvalLogs)) {
item.approvalLogs = [];
}
item.approvalLogs.push({
approvalStatus,
operatorName: "总部运营",
createdDate: new Date().toISOString().slice(0, 19).replace("T", " "),
remark: data.remark || "",
approvalSource: "1",
});
return delay(mapAbnormalFlowDeclarationApproveResponse(true));
}
{
"method": "dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve",
"route": "/router/dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve/1.0.0",
"summary": "总部运营审批流水报备",
"request": {
"parameters": [
{
"name": "id",
"in": "query",
"type": "Integer",
"required": true,
"description": "异常流水报备记录ID"
},
{
"name": "approvalStatus",
"in": "query",
"type": "Byte",
"required": true,
"description": "审批状态(4-后台审批驳回 5-审批通过)"
},
{
"name": "remark",
"in": "query",
"type": "String",
"required": false,
"description": "审批备注"
},
{
"name": "delayDeadline",
"in": "query",
"type": "Date",
"required": false,
"description": "延期截止时间"
},
{
"name": "sessionId",
"in": "query",
"type": "string",
"required": true,
"description": "会话ID"
}
]
},
"response": {
"fields": [
{
"name": "code",
"type": "string",
"description": "响应状态(0:成功;1:失败)",
"required": false
},
{
"name": "errId",
"type": "string",
"description": "错误码",
"required": false
},
{
"name": "message",
"type": "string",
"description": "错误描述",
"required": false
},
{
"name": "data",
"type": "boolean",
"description": "成功返回数据",
"required": false
}
],
"pagination": null,
"rootType": "RopResponse<Boolean>"
}
}
# dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve
> 总部运营审批流水报备
## Request
| 参数 | 位置 | 类型 | 必填 | 说明 |
|------|------|------|------|------|
| id | query | Integer | 是 | 异常流水报备记录ID |
| approvalStatus | query | Byte | 是 | 审批状态(4-后台审批驳回 5-审批通过) |
| remark | query | String | 否 | 审批备注 |
| delayDeadline | query | Date | 否 | 延期截止时间 |
| sessionId | query | string | 是 | 会话ID |
## Response
| 字段 | 类型 | 说明 |
|------|------|------|
| code | string | 响应状态(0:成功;1:失败) |
| errId | string | 错误码 |
| message | string | 错误描述 |
| data | boolean | 成功返回数据 |
{
"method": "dj.api.smartcarlife.pc.abnormalFlowDeclaration.detail",
"route": "/router/dj.api.smartcarlife.pc.abnormalFlowDeclaration.detail/1.0.0",
"summary": "查询异常流水报备详情",
"request": {
"parameters": [
{
"name": "id",
"in": "query",
"type": "Integer",
"required": true,
"description": "异常流水报备记录ID"
},
{
"name": "sessionId",
"in": "query",
"type": "string",
"required": true,
"description": "会话ID"
}
]
},
"response": {
"fields": [
{
"name": "code",
"type": "string",
"description": "响应状态(0:成功;1:失败)",
"required": false
},
{
"name": "errId",
"type": "string",
"description": "错误码",
"required": false
},
{
"name": "message",
"type": "string",
"description": "错误描述",
"required": false
},
{
"name": "data",
"type": "AbnormalFlowDeclarationDetailDTO",
"description": "成功返回数据",
"required": false
},
{
"name": "data.tradeInfo",
"type": "AbnormalPaymentDetailListDTO",
"description": "流水信息",
"required": false
},
{
"name": "data.declarationInfo",
"type": "AbnormalFlowDeclarationInfoDTO",
"description": "报备信息",
"required": false
},
{
"name": "data.approvalLogs",
"type": "array<AbnormalFlowApprovalLogItemDTO>",
"description": "审批日志列表",
"required": false
}
],
"pagination": null,
"rootType": "RopResponse<AbnormalFlowDeclarationDetailDTO>"
}
}
# dj.api.smartcarlife.pc.abnormalFlowDeclaration.detail
> 查询异常流水报备详情
## Request
| 参数 | 位置 | 类型 | 必填 | 说明 |
|------|------|------|------|------|
| id | query | Integer | 是 | 异常流水报备记录ID |
| sessionId | query | string | 是 | 会话ID |
## Response
| 字段 | 类型 | 说明 |
|------|------|------|
| code | string | 响应状态(0:成功;1:失败) |
| errId | string | 错误码 |
| message | string | 错误描述 |
| data | AbnormalFlowDeclarationDetailDTO | 成功返回数据 |
| data.tradeInfo | AbnormalPaymentDetailListDTO | 流水信息 |
| data.declarationInfo | AbnormalFlowDeclarationInfoDTO | 报备信息 |
| data.approvalLogs | array<AbnormalFlowApprovalLogItemDTO> | 审批日志列表 |
/**
* @typedef {Object} AbnormalFlowDeclarationApproveParams
* @property {number} id - 异常流水报备记录ID
* @property {string} approvalStatus - 审批状态(4-后台审批驳回 5-审批通过)
* @property {string} remark [optional] - 审批备注
* @property {string} delayDeadline [optional] - 延期截止时间
*/
/**
* @typedef {Object} AbnormalFlowDeclarationApproveRow
* @property {string} errId - 错误码
* @property {boolean} data - 成功返回数据
*/
/**
* UI/表格参数 → dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve 请求体
* @param {AbnormalFlowDeclarationApproveParams} [params]
* @returns {AbnormalFlowDeclarationApproveParams}
* @see __contracts__/dj_api_smartcarlife_pc_abnormalFlowDeclaration_approve.contract.md
*/
export function buildAbnormalFlowDeclarationApproveParams(params = {}) {
const payload = {};
if (params.id != null && params.id !== "") {
payload.id = params.id;
}
if (params.approvalStatus != null && params.approvalStatus !== "") {
payload.approvalStatus = params.approvalStatus;
}
if (params.remark != null && params.remark !== "") {
payload.remark = params.remark;
}
if (params.delayDeadline != null && params.delayDeadline !== "") {
payload.delayDeadline = params.delayDeadline;
}
return payload;
}
export default buildAbnormalFlowDeclarationApproveParams;
/**
* @typedef {Object} AbnormalFlowDeclarationDetailParams
* @property {number} id - 异常流水报备记录ID
*/
/**
* @typedef {Object} AbnormalFlowDeclarationDetailRow
* @property {string} errId - 错误码
* @property {string} data - 成功返回数据
*/
/**
* UI/表格参数 → dj.api.smartcarlife.pc.abnormalFlowDeclaration.detail 请求体
* @param {AbnormalFlowDeclarationDetailParams} [params]
* @returns {AbnormalFlowDeclarationDetailParams}
* @see __contracts__/dj_api_smartcarlife_pc_abnormalFlowDeclaration_detail.contract.md
*/
export function buildAbnormalFlowDeclarationDetailParams(params = {}) {
const payload = {};
if (params.id != null && params.id !== "") {
payload.id = params.id;
}
return payload;
}
export default buildAbnormalFlowDeclarationDetailParams;
/**
* @typedef {Object} AbnormalFlowDeclarationApproveParams
* @property {number} id - 异常流水报备记录ID
* @property {string} approvalStatus - 审批状态(4-后台审批驳回 5-审批通过)
* @property {string} remark [optional] - 审批备注
* @property {string} delayDeadline [optional] - 延期截止时间
*/
/**
* @typedef {Object} AbnormalFlowDeclarationApproveRow
* @property {string} errId - 错误码
* @property {boolean} data - 成功返回数据
*/
/**
* dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve 响应 → 页面数据
* @param {*} [res]
* @returns {*}
* @see __contracts__/dj_api_smartcarlife_pc_abnormalFlowDeclaration_approve.contract.md
*/
export function mapAbnormalFlowDeclarationApproveResponse(res = {}) {
return res;
}
export default mapAbnormalFlowDeclarationApproveResponse;
/**
* @typedef {Object} AbnormalFlowDeclarationDetailParams
* @property {number} id - 异常流水报备记录ID
*/
/**
* @typedef {Object} AbnormalFlowDeclarationDetailRow
* @property {string} errId - 错误码
* @property {string} data - 成功返回数据
*/
/**
* dj.api.smartcarlife.pc.abnormalFlowDeclaration.detail 响应 → 页面数据
* @param {*} [res]
* @returns {*}
* @see __contracts__/dj_api_smartcarlife_pc_abnormalFlowDeclaration_detail.contract.md
*/
export function mapAbnormalFlowDeclarationDetailResponse(res = {}) {
return res;
}
export default mapAbnormalFlowDeclarationDetailResponse;
{
"method": "dj.api.smartcarlife.dailyReport.detail.select",
"route": "/router/dj.api.smartcarlife.dailyReport.detail.select/1.0.0",
"summary": "门店工作汇报(日报)详情查询",
"request": {
"parameters": [
{
"name": "id",
"in": "query",
"type": "integer",
"required": true,
"description": "日报记录ID"
},
{
"name": "sessionId",
"in": "query",
"type": "string",
"required": true,
"description": "会话ID"
}
]
},
"response": {
"fields": [
{
"name": "code",
"type": "string",
"description": "响应状态(0:成功;1:失败)",
"required": false
},
{
"name": "errId",
"type": "string",
"description": "错误码",
"required": false
},
{
"name": "message",
"type": "string",
"description": "错误描述",
"required": false
},
{
"name": "data",
"type": "DailyReportDetailResponse",
"description": "成功返回数据",
"required": false
},
{
"name": "data.merchantId",
"type": "integer:int32",
"description": "4s店商户号",
"required": false
},
{
"name": "data.merchantName",
"type": "string",
"description": "4s店商户名称",
"required": false
},
{
"name": "data.staffName",
"type": "string",
"description": "驻店员工",
"required": false
},
{
"name": "data.staffUuid",
"type": "string",
"description": "驻店员工uuid",
"required": false
},
{
"name": "data.sceneType",
"type": "string:byte",
"description": "业务场景(0:权益,1:轻改)",
"required": false
},
{
"name": "data.reportStatus",
"type": "integer:int32",
"description": "填报状态:0=草稿,1=已提交",
"required": false
},
{
"name": "data.reportDate",
"type": "string",
"description": "日期(yyyy-MM-dd)",
"required": false
},
{
"name": "data.jsonContent",
"type": "string",
"description": "填报内容",
"required": false
}
],
"pagination": null,
"rootType": "RopResponse<DailyReportDetailResponse>"
}
}
# dj.api.smartcarlife.dailyReport.detail.select
> 门店工作汇报(日报)详情查询
## Request
| 参数 | 位置 | 类型 | 必填 | 说明 |
|------|------|------|------|------|
| id | query | integer | 是 | 日报记录ID |
| sessionId | query | string | 是 | 会话ID |
## Response
| 字段 | 类型 | 说明 |
|------|------|------|
| code | string | 响应状态(0:成功;1:失败) |
| errId | string | 错误码 |
| message | string | 错误描述 |
| data | DailyReportDetailResponse | 成功返回数据 |
| data.merchantId | integer:int32 | 4s店商户号 |
| data.merchantName | string | 4s店商户名称 |
| data.staffName | string | 驻店员工 |
| data.staffUuid | string | 驻店员工uuid |
| data.sceneType | string:byte | 业务场景(0:权益,1:轻改) |
| data.reportStatus | integer:int32 | 填报状态:0=草稿,1=已提交 |
| data.reportDate | string | 日期(yyyy-MM-dd) |
| data.jsonContent | string | 填报内容 |
{
"method": "dj.api.smartcarlife.dailyReport.merchant.list",
"route": "/router/dj.api.smartcarlife.dailyReport.merchant.list/1.0.0",
"summary": "新版本日报填报门店列表查询",
"request": {
"parameters": [
{
"name": "currentPage",
"in": "query",
"type": "int",
"required": false,
"description": "当前页码"
},
{
"name": "pageSize",
"in": "query",
"type": "int",
"required": false,
"description": "每页条数"
},
{
"name": "merchantName",
"in": "query",
"type": "string",
"required": false,
"description": "商户名称"
}
]
},
"response": {
"fields": [
{
"name": "code",
"type": "string",
"description": "响应状态(0:成功;1:失败)",
"required": false
},
{
"name": "errId",
"type": "string",
"description": "错误码",
"required": false
},
{
"name": "message",
"type": "string",
"description": "错误描述",
"required": false
},
{
"name": "data",
"type": "RpcPagination<DailyReportWhiteListMerchantResponse>",
"description": "成功返回数据",
"required": false
},
{
"name": "data.pageNum",
"type": "integer:int32",
"description": "",
"required": false
},
{
"name": "data.pageSize",
"type": "integer:int32",
"description": "",
"required": false
},
{
"name": "data.startRow",
"type": "integer:int64",
"description": "",
"required": false
},
{
"name": "data.endRow",
"type": "integer:int64",
"description": "",
"required": false
},
{
"name": "data.total",
"type": "integer:int64",
"description": "",
"required": false
},
{
"name": "data.pages",
"type": "integer:int32",
"description": "",
"required": false
},
{
"name": "data.list",
"type": "array<DailyReportWhiteListMerchantResponse>",
"description": "",
"required": false
},
{
"name": "data.condition",
"type": "DailyReportWhiteListMerchantResponse",
"description": "",
"required": false
},
{
"name": "data.needCount",
"type": "boolean",
"description": "",
"required": false
}
],
"pagination": {
"wrapper": "RopResponse<RpcPagination<DailyReportWhiteListMerchantResponse>>",
"type": "RpcPagination<DailyReportWhiteListMerchantResponse>",
"fields": [
"pageNum",
"pageSize",
"total",
"list"
]
},
"rootType": "RopResponse<RpcPagination<DailyReportWhiteListMerchantResponse>>"
}
}
# dj.api.smartcarlife.dailyReport.merchant.list
> 新版本日报填报门店列表查询
## Request
| 参数 | 位置 | 类型 | 必填 | 说明 |
|------|------|------|------|------|
| currentPage | query | int | 否 | 当前页码 |
| pageSize | query | int | 否 | 每页条数 |
| merchantName | query | string | 否 | 商户名称 |
## Response
分页: `RpcPagination<DailyReportWhiteListMerchantResponse>` (pageNum, pageSize, total, list)
| 字段 | 类型 | 说明 |
|------|------|------|
| code | string | 响应状态(0:成功;1:失败) |
| errId | string | 错误码 |
| message | string | 错误描述 |
| data | RpcPagination<DailyReportWhiteListMerchantResponse> | 成功返回数据 |
| data.pageNum | integer:int32 | |
| data.pageSize | integer:int32 | |
| data.startRow | integer:int64 | |
| data.endRow | integer:int64 | |
| data.total | integer:int64 | |
| data.pages | integer:int32 | |
| data.list | array<DailyReportWhiteListMerchantResponse> | |
| data.condition | DailyReportWhiteListMerchantResponse | |
| data.needCount | boolean | |
{
"method": "dj.api.smartcarlife.dailyReport.overview.page",
"route": "/router/dj.api.smartcarlife.dailyReport.overview.page/1.0.0",
"summary": "门店工作汇报(日报)列表查询",
"request": {
"parameters": [
{
"name": "currentPage",
"in": "query",
"type": "int",
"required": false,
"description": "当前页码"
},
{
"name": "pageSize",
"in": "query",
"type": "int",
"required": false,
"description": "每页条数"
},
{
"name": "merchantId",
"in": "query",
"type": "integer",
"required": false,
"description": "商户ID"
},
{
"name": "staffName",
"in": "query",
"type": "string",
"required": false,
"description": "驻店员工"
},
{
"name": "reportDate",
"in": "query",
"type": "string",
"required": false,
"description": "日期(yyyy-MM-dd)"
},
{
"name": "templateType",
"in": "query",
"type": "byte",
"required": false,
"description": "模板类型:1=驻店日报,2=门店日报,3=洽谈明细"
},
{
"name": "sessionId",
"in": "query",
"type": "string",
"required": true,
"description": "会话ID"
}
]
},
"response": {
"fields": [
{
"name": "code",
"type": "string",
"description": "响应状态(0:成功;1:失败)",
"required": false
},
{
"name": "errId",
"type": "string",
"description": "错误码",
"required": false
},
{
"name": "message",
"type": "string",
"description": "错误描述",
"required": false
},
{
"name": "data",
"type": "RpcPagination<DailyReportOverviewResponse>",
"description": "成功返回数据",
"required": false
},
{
"name": "data.pageNum",
"type": "integer:int32",
"description": "",
"required": false
},
{
"name": "data.pageSize",
"type": "integer:int32",
"description": "",
"required": false
},
{
"name": "data.startRow",
"type": "integer:int64",
"description": "",
"required": false
},
{
"name": "data.endRow",
"type": "integer:int64",
"description": "",
"required": false
},
{
"name": "data.total",
"type": "integer:int64",
"description": "",
"required": false
},
{
"name": "data.pages",
"type": "integer:int32",
"description": "",
"required": false
},
{
"name": "data.list",
"type": "array<DailyReportOverviewResponse>",
"description": "",
"required": false
},
{
"name": "data.condition",
"type": "DailyReportOverviewResponse",
"description": "",
"required": false
},
{
"name": "data.needCount",
"type": "boolean",
"description": "",
"required": false
}
],
"pagination": {
"wrapper": "RopResponse<RpcPagination<DailyReportOverviewResponse>>",
"type": "RpcPagination<DailyReportOverviewResponse>",
"fields": [
"pageNum",
"pageSize",
"total",
"list"
]
},
"rootType": "RopResponse<RpcPagination<DailyReportOverviewResponse>>"
}
}
# dj.api.smartcarlife.dailyReport.overview.page
> 门店工作汇报(日报)列表查询
## Request
| 参数 | 位置 | 类型 | 必填 | 说明 |
|------|------|------|------|------|
| currentPage | query | int | 否 | 当前页码 |
| pageSize | query | int | 否 | 每页条数 |
| merchantId | query | integer | 否 | 商户ID |
| staffName | query | string | 否 | 驻店员工 |
| reportDate | query | string | 否 | 日期(yyyy-MM-dd) |
| templateType | query | byte | 否 | 模板类型:1=驻店日报,2=门店日报,3=洽谈明细 |
| sessionId | query | string | 是 | 会话ID |
## Response
分页: `RpcPagination<DailyReportOverviewResponse>` (pageNum, pageSize, total, list)
| 字段 | 类型 | 说明 |
|------|------|------|
| code | string | 响应状态(0:成功;1:失败) |
| errId | string | 错误码 |
| message | string | 错误描述 |
| data | RpcPagination<DailyReportOverviewResponse> | 成功返回数据 |
| data.pageNum | integer:int32 | |
| data.pageSize | integer:int32 | |
| data.startRow | integer:int64 | |
| data.endRow | integer:int64 | |
| data.total | integer:int64 | |
| data.pages | integer:int32 | |
| data.list | array<DailyReportOverviewResponse> | |
| data.condition | DailyReportOverviewResponse | |
| data.needCount | boolean | |
{
"method": "dj.api.smartcarlife.merchant.staff.list",
"route": "/router/dj.api.smartcarlife.merchant.staff.list/1.0.0",
"summary": "根据4s店或者园区店查询员工信息",
"request": {
"parameters": [
{
"name": "merchantId",
"in": "query",
"type": "integer",
"required": false,
"description": "4s店商户号"
},
{
"name": "yqMerchantId",
"in": "query",
"type": "integer",
"required": false,
"description": "园区店店商户号"
}
]
},
"response": {
"fields": [
{
"name": "code",
"type": "string",
"description": "响应状态(0:成功;1:失败)",
"required": false
},
{
"name": "errId",
"type": "string",
"description": "错误码",
"required": false
},
{
"name": "message",
"type": "string",
"description": "错误描述",
"required": false
},
{
"name": "data",
"type": "array<ServiceStaffRopResponse>",
"description": "成功返回数据",
"required": false
},
{
"name": "data[].id",
"type": "integer:int32",
"description": "",
"required": false
},
{
"name": "data[].merchantNo",
"type": "integer:int32",
"description": "员工所在商户号",
"required": false
},
{
"name": "data[].merchantName",
"type": "string",
"description": "员工所在商户名",
"required": false
},
{
"name": "data[].staffName",
"type": "string",
"description": "员工姓名",
"required": false
},
{
"name": "data[].staffPhone",
"type": "string",
"description": "员工手机号",
"required": false
},
{
"name": "data[].departmentName",
"type": "string",
"description": "员工所属部门",
"required": false
},
{
"name": "data[].visibleMerchantNo",
"type": "string",
"description": "员工可见4s店",
"required": false
},
{
"name": "data[].visibleMerchantList",
"type": "array<MerchantNoNameRpcResponse>",
"description": "员工可见列表",
"required": false
},
{
"name": "data[].weChatAvatarUrl",
"type": "string",
"description": "微信头像",
"required": false
},
{
"name": "data[].staffUuid",
"type": "string",
"description": "员工uuid",
"required": false
},
{
"name": "data[].visualType",
"type": "integer:int32",
"description": "可见范围:0全部客户: 1:部分可见",
"required": false
},
{
"name": "data[].createdDate",
"type": "string",
"description": "",
"required": false
},
{
"name": "data[].staffBusinessType",
"type": "string:byte",
"description": "员工类型 0-驻店 1-技师",
"required": false
},
{
"name": "data[].staffLabel",
"type": "string",
"description": "员工开通业务场景标签",
"required": false
},
{
"name": "data[].auditStatus",
"type": "integer:int32",
"description": "审核状态 0:待审核 1:审核通过 2:已驳回",
"required": false
},
{
"name": "data[].merchantBrandCars",
"type": "string",
"description": "",
"required": false
},
{
"name": "data[].merchantBrandMain",
"type": "string",
"description": "",
"required": false
}
],
"pagination": null,
"rootType": "RopResponse<List<ServiceStaffRopResponse>>"
}
}
# dj.api.smartcarlife.merchant.staff.list
> 根据4s店或者园区店查询员工信息
## Request
| 参数 | 位置 | 类型 | 必填 | 说明 |
|------|------|------|------|------|
| merchantId | query | integer | 否 | 4s店商户号 |
| yqMerchantId | query | integer | 否 | 园区店店商户号 |
## Response
| 字段 | 类型 | 说明 |
|------|------|------|
| code | string | 响应状态(0:成功;1:失败) |
| errId | string | 错误码 |
| message | string | 错误描述 |
| data | array<ServiceStaffRopResponse> | 成功返回数据 |
| data[].id | integer:int32 | |
| data[].merchantNo | integer:int32 | 员工所在商户号 |
| data[].merchantName | string | 员工所在商户名 |
| data[].staffName | string | 员工姓名 |
| data[].staffPhone | string | 员工手机号 |
| data[].departmentName | string | 员工所属部门 |
| data[].visibleMerchantNo | string | 员工可见4s店 |
| data[].visibleMerchantList | array<MerchantNoNameRpcResponse> | 员工可见列表 |
| data[].weChatAvatarUrl | string | 微信头像 |
| data[].staffUuid | string | 员工uuid |
| data[].visualType | integer:int32 | 可见范围:0全部客户: 1:部分可见 |
| data[].createdDate | string | |
| data[].staffBusinessType | string:byte | 员工类型 0-驻店 1-技师 |
| data[].staffLabel | string | 员工开通业务场景标签 |
| data[].auditStatus | integer:int32 | 审核状态 0:待审核 1:审核通过 2:已驳回 |
| data[].merchantBrandCars | string | |
| data[].merchantBrandMain | string | |
import { getTemplateTypeByTabKey } from "@/views/residentManage/journalRecord/constants";
/**
* d2-table 查询参数 → dailyReport.overview.page 请求体
*/
export function buildOverviewParams(params = {}, activeTabKey = "staffDaily") {
const payload = {
templateType: getTemplateTypeByTabKey(activeTabKey),
reportDate: params.reportDate,
currentPage: params.currentPage,
pageSize: params.pageSize,
};
if (params.merchantId) {
payload.merchantId = params.merchantId;
}
if (params.staffName) {
payload.staffName = params.staffName;
}
return payload;
}
export default buildOverviewParams;
import { mapSceneType } from "./mapSceneType";
/**
* 详情路由 query → dailyReport.detail.select 请求体
*/
export function buildDetailSelectParams({ id } = {}) {
return { id };
}
/**
* dailyReport.detail.select 响应 → 详情页 detail 对象
*/
export function mapDetailResponse(res = {}, fallback = {}) {
const scene = mapSceneType(res.sceneType ?? fallback.sceneType);
return {
...res,
id: res.id ?? res.dailyReportRecordId ?? fallback.id,
staffName: res.staffName ?? fallback.staffName,
merchantName: res.merchantName ?? fallback.merchantName,
bizType: res.bizType ?? scene.bizType ?? fallback.bizType,
bizTypeName: res.bizTypeName || scene.bizTypeName || fallback.bizTypeName,
reportDate: res.reportDate ?? fallback.reportDate,
jsonContent: res.jsonContent,
fieldDataList: res.fieldDataList,
subformDataList: res.subformDataList,
reportTemplateId: res.reportTemplateId,
baseSceneCode: res.baseSceneCode,
sceneType: res.sceneType ?? fallback.sceneType,
schema: res.schema,
brandIds: res.brandIds ?? fallback.brandIds ?? [],
sceneList: res.sceneList ?? fallback.sceneList ?? [],
};
}
export default mapDetailResponse;
/**
* dailyReport.merchant.list 响应 → 门店下拉选项
*/
export function mapMerchantListResponse(res = {}) {
const list = Array.isArray(res.list) ? res.list : (Array.isArray(res) ? res : []);
return list.map((item) => ({
merchantId: item.merchantId ?? item.shopMerchantId,
merchantName: item.merchantName ?? item.shopMerchantName,
sceneType: item.sceneType,
}));
}
export default mapMerchantListResponse;
/**
* merchant.staff.list 响应 → 驻店人员下拉选项
*/
export function mapMerchantStaffListResponse(res = {}) {
const list = Array.isArray(res.list)
? res.list
: (Array.isArray(res.data) ? res.data : (Array.isArray(res) ? res : []));
return list.map((item) => ({
staffUuid: item.staffUuid ?? item.staffId ?? item.id,
staffName: item.staffName,
})).filter((item) => item.staffUuid);
}
export default mapMerchantStaffListResponse;
import { mapSceneType } from "./mapSceneType";
/**
* dailyReport.overview.page 行数据 → 表格行
*/
export function mapOverviewRow(row = {}) {
const scene = mapSceneType(row.sceneType);
const reportStatus = row.reportStatus;
const createdDate = row.createdDate ?? row.lastSaveTime ?? row.updatedDate;
return {
id: row.id ?? row.dailyReportRecordId,
staffName: row.staffName ?? row.staffname ?? "",
staffUuid: row.staffUuid,
merchantId: row.merchantId,
merchantName: row.merchantName,
bizType: row.bizType ?? scene.bizType,
bizTypeName: row.bizTypeName || scene.bizTypeName,
attendanceStatus: row.onBreak ?? row.attendanceStatus ?? row.attendanceStatusName,
staffCount: row.staffCount,
lastSaveTime: createdDate,
submitTime: reportStatus === 1 ? (row.submitTime ?? createdDate) : (row.submitTime || ""),
reportDate: row.reportDate,
templateType: row.templateType,
reportStatus,
};
}
export function mapOverviewPageResponse(res = {}) {
const list = Array.isArray(res.list) ? res.list.map(mapOverviewRow) : [];
return {
...res,
list,
pageNum: res.pageNum ?? res.currentPage,
};
}
export default mapOverviewRow;
/**
* Swagger sceneType(0:权益,1:轻改)→ 页面 bizType / bizTypeName
*/
const SCENE_TYPE_MAP = {
0: { bizType: 2, bizTypeName: "权益" },
1: { bizType: 1, bizTypeName: "轻改" },
"0": { bizType: 2, bizTypeName: "权益" },
"1": { bizType: 1, bizTypeName: "轻改" },
};
export function mapSceneType(sceneType) {
if (sceneType == null || sceneType === "") {
return { bizType: "", bizTypeName: "" };
}
return SCENE_TYPE_MAP[sceneType] || { bizType: sceneType, bizTypeName: "" };
}
export default mapSceneType;
...@@ -72,7 +72,6 @@ export function getGoodsInfoById(data) { ...@@ -72,7 +72,6 @@ export function getGoodsInfoById(data) {
data => data, data => data,
// 第二个函数:使用保持精度的解析 // 第二个函数:使用保持精度的解析
(data) => { (data) => {
console.log(data, typeof data);
if (typeof data === "string") { if (typeof data === "string") {
return parseKeepPrecision(data); return parseKeepPrecision(data);
} }
......
import request from "./request" import request from "./request";
import RequestMethods from "./request.methods" import RequestMethods from "./request.methods";
const path = "dj.api.smartcarlife.pos.trm." const path = "dj.api.smartcarlife.pos.trm.";
// 删除设备绑定 // 删除设备绑定
export function trmDelete(data) { export function trmDelete(data) {
data.method = `${path}delete` data.method = `${path}delete`;
return request(data) return request(data);
} }
// 查询设备详情 // 查询设备详情
export function trmDetail(data) { export function trmDetail(data) {
data.method = `${path}detail` data.method = `${path}detail`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 查询设备管理历史记录 // 查询设备管理历史记录
export function trmHistory(data) { export function trmHistory(data) {
data.method = `${path}history` data.method = `${path}history`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 设备信息查询列表 // 设备信息查询列表
export function trmList(data) { export function trmList(data) {
data.method = `dj.api.life.pos.trm.list` data.method = `dj.api.life.pos.trm.list`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 增加设备绑定 // 增加设备绑定
export function trmSave(data) { export function trmSave(data) {
data.method = `${path}save` data.method = `${path}save`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 更新设备绑定 // 更新设备绑定
export function trmUpdate(data) { export function trmUpdate(data) {
data.method = `${path}update` data.method = `${path}update`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 4s店列表 // 4s店列表
export function getShopMerchantList(data) { export function getShopMerchantList(data = {}) {
data.method = `dj.smartcarlife.api.shopMerchant.list` data.method = `dj.smartcarlife.api.shopMerchant.list`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
import request from './request' import request from "./request";
const path = 'dj.api.' const path = "dj.api.";
const path2 = 'dj.api.smartcarlife.' const path2 = "dj.api.smartcarlife.";
/** 获取园区店列表 - 园区店 */ /** 获取园区店列表 - 园区店 */
export function getParkStore(data) { export function getParkStore(data = {}) {
data.method = 'dj.smartcarlife.api.yqMerchant.list' data.method = "dj.smartcarlife.api.yqMerchant.list";
return request(data) return request(data);
} }
/** 获取园区店列表 - 流量来源 */ /** 获取园区店列表 - 流量来源 */
export function getServiceStore(data) { export function getServiceStore(data) {
data.method = `${path}servicemerchantref.list` data.method = `${path}servicemerchantref.list`;
return request(data) return request(data);
} }
/** 根据门店商户号获取员工列表 */ /** 根据门店商户号获取员工列表 */
export function getStaff(data) { export function getStaff(data) {
data.method = `${path}employee.getByMerchantId` data.method = `${path}employee.getByMerchantId`;
return request(data) return request(data);
} }
/** 获取车型车系 */ /** 获取车型车系 */
export function getCarInfo(data) { export function getCarInfo(data) {
data.method = `${path}car.series.list` data.method = `${path}car.series.list`;
return request(data) return request(data);
} }
/** 根据车系id获取车辆类型 */ /** 根据车系id获取车辆类型 */
export function getCarType(data) { export function getCarType(data) {
data.method = `${path}car.type.list` data.method = `${path}car.type.list`;
return request(data) return request(data);
} }
/** 根据门店商户号获取基础商品列表 */ /** 根据门店商户号获取基础商品列表 */
export function getGoods(data) { export function getGoods(data) {
data.method = `${path}basegoods.list` data.method = `${path}basegoods.list`;
return request(data) return request(data);
} }
/** 预录订单 */ /** 预录订单 */
export function addOrder(data) { export function addOrder(data) {
// data.method = `${path}order.advanceCreate` // data.method = `${path}order.advanceCreate`
data.method = `${path}order.advance.add` data.method = `${path}order.advance.add`;
return request(data, 'post') return request(data, "post");
} }
/** 预录订单 - 编辑 */ /** 预录订单 - 编辑 */
export function editOrder(data) { export function editOrder(data) {
data.method = `${path2}advanceOrder.update` data.method = `${path2}advanceOrder.update`;
return request(data, 'post') return request(data, "post");
} }
import request from "./request" import request from "./request"
import { mapAbnormalFlowDeclarationApproveResponse } from "./adapters/abnormalFlowDeclaration/mapAbnormalFlowDeclarationApproveResponse";
import { buildAbnormalFlowDeclarationApproveParams } from "./adapters/abnormalFlowDeclaration/buildAbnormalFlowDeclarationApproveParams";
import { mapAbnormalFlowDeclarationDetailResponse } from "./adapters/abnormalFlowDeclaration/mapAbnormalFlowDeclarationDetailResponse";
import { buildAbnormalFlowDeclarationDetailParams } from "./adapters/abnormalFlowDeclaration/buildAbnormalFlowDeclarationDetailParams";
import RequestMethods from "./request.methods"
const USE_ABNORMAL_FLOW_MOCK = process.env.VUE_APP_ABNORMAL_FLOW_MOCK === "true"
function loadAbnormalFlowMock() {
return import("./abnormalFlow.mock")
}
// const path = 'dj.api.' // const path = 'dj.api.'
const path2 = "dj.api.smartcarlife." const path2 = "dj.api.smartcarlife."
...@@ -95,11 +106,39 @@ export function getAbnormalOrderStat(data) { ...@@ -95,11 +106,39 @@ export function getAbnormalOrderStat(data) {
return request(data) return request(data)
} }
// dj.api.smartcarlife.abnormal.payment.detail.page/1.0.0 /**
// 异常流水明细列表 * 异常流水明细列表
* dj.api.smartcarlife.abnormal.payment.detail.page
* @param {Object} data
* @param {string} [data.startTime] 开始时间 yyyy-MM-dd HH:mm:ss
* @param {string} [data.endTime] 结束时间 yyyy-MM-dd HH:mm:ss
* @param {number} [data.merchantId] 商户号
* @param {string} [data.merchantName] 门店名称
* @param {number} [data.currentPage] 页码(d2-table 透传,Swagger 未声明)
* @param {number} [data.pageSize] 每页条数(d2-table 透传,Swagger 未声明)
* @returns {Promise<{ list: Array<{
* tradeNo: string,
* totalPrice: number,
* notRefundedTotalPrice: number,
* payDate: string,
* payChannel: string,
* payType: string,
* posTrmNo: string,
* merchantName: string,
* yqMerchantName: string,
* distributionStatus: string,
* refundStatus: string,
* declarationId: number,
* declarationApprovalStatus: string
* }>, pageNum: number, pageSize: number, total: number }>}
* declarationApprovalStatus: 1待区域经理审批 2区域经理驳回 3待后台审批 4后台驳回 5审批通过
*/
export function getAbnormalPaymentDetailPage(data) { export function getAbnormalPaymentDetailPage(data) {
if (USE_ABNORMAL_FLOW_MOCK) {
return loadAbnormalFlowMock().then((m) => m.mockAbnormalPaymentDetailPage(data))
}
data.method = "dj.api.smartcarlife.abnormal.payment.detail.page" data.method = "dj.api.smartcarlife.abnormal.payment.detail.page"
return request(data) return request(data, RequestMethods.POST)
} }
// dj.api.smartcarlife.pending.corporate.order.detail.page/1.0.0 // dj.api.smartcarlife.pending.corporate.order.detail.page/1.0.0
// 待确认对公订单明细列表 // 待确认对公订单明细列表
...@@ -131,3 +170,90 @@ export function getPendingCorporateOrderDetail(data) { ...@@ -131,3 +170,90 @@ export function getPendingCorporateOrderDetail(data) {
data.method = "dj.api.smartcarlife.pending.corporate.order.detail" data.method = "dj.api.smartcarlife.pending.corporate.order.detail"
return request(data) return request(data)
} }
/**
* 查询门店锁单配置
* dj.api.smartcarlife.shop.lock.config.get
* @param {Object} data
* @param {number} [data.merchantId] 门店 id
* @param {string} [data.merchantName] 门店名称
* @param {number|string} [data.storeType] 门店类型 0=4s店 1=园区店
* @param {string} [data.lockFlag] 是否开启锁单 Y=开启 N=关闭
* @returns {Promise<{
* id: number,
* merchantId: number,
* merchantName: string,
* storeType: string,
* lockFlag: string,
* createdBy: string,
* createdDate: string,
* updatedBy: string,
* updatedDate: string,
* deletedFlag: string,
* merchantIds: number[]
* }>}
*/
export function getShopLockConfig(data) {
data.method = "dj.api.smartcarlife.shop.lock.config.get"
return request(data, RequestMethods.POST)
}
/**
* 新增或修改门店锁单开关配置
* dj.api.smartcarlife.shop.lock.config.save
* @param {Object} data
* @param {number} [data.merchantId] 门店 id
* @param {string} [data.merchantName] 门店名称
* @param {number|string} [data.storeType] 门店类型 0=4s店 1=园区店
* @param {string} [data.lockFlag] 是否开启锁单 Y=开启 N=关闭
* @returns {Promise<boolean>}
*/
export function saveShopLockConfig(data) {
data.method = "dj.api.smartcarlife.shop.lock.config.save"
return request(data, RequestMethods.POST)
}
/**
* 查询异常流水报备详情(PC 总部运营)
* dj.api.smartcarlife.pc.abnormalFlowDeclaration.detail
* @param {Object} data
* @param {number} data.id 异常流水报备记录 ID(必填)
* @returns {Promise<{
* tradeInfo: Object,
* declarationInfo: {
* abnormalType: string,
* remark: string,
* createdBy: string,
* createdDate: string,
* voucherImageUrls: string[]
* },
* approvalLogs: Array<{
* approvalStatus: string,
* operatorName: string,
* createdDate: string,
* remark: string,
* approvalSource: string
* }>
* }>}
* approvalSource: 0=区域经理审批 1=总部运营
*/
export function getPcAbnormalFlowDeclarationDetail(data) {
if (USE_ABNORMAL_FLOW_MOCK) {
return loadAbnormalFlowMock().then((m) => m.mockPcAbnormalFlowDeclarationDetail(data));
}
const payload = {
...buildAbnormalFlowDeclarationDetailParams(data),
method: "dj.api.smartcarlife.pc.abnormalFlowDeclaration.detail",
};
return request(payload, RequestMethods.POST).then(mapAbnormalFlowDeclarationDetailResponse);
}
export function approvePcAbnormalFlowDeclaration(data) {
if (USE_ABNORMAL_FLOW_MOCK) {
return loadAbnormalFlowMock().then((m) => m.mockApprovePcAbnormalFlowDeclaration(data));
}
const payload = {
...buildAbnormalFlowDeclarationApproveParams(data),
method: "dj.api.smartcarlife.pc.abnormalFlowDeclaration.approve",
};
return request(payload, RequestMethods.POST).then(mapAbnormalFlowDeclarationApproveResponse);
}
...@@ -187,3 +187,15 @@ export function getOperationCost(data) { ...@@ -187,3 +187,15 @@ export function getOperationCost(data) {
data.method = 'dj.api.smartcarlife.merchantGoodsInfo.operationCost.calculate' data.method = 'dj.api.smartcarlife.merchantGoodsInfo.operationCost.calculate'
return request(data, "post") return request(data, "post")
} }
// 查询商品成本(默认带入产品成本)
export function queryMerchantGoodsCost(data) {
data.method = `dj.api.smartcarlife.merchantGoodsInfo.productCost.calculate`;
return request(data, "post");
}
// 校验门店省市是否在产品适用区域内
export function validateStoreRegion(data) {
data.method = `${path}merchantGoodsInfo.validateStoreRegion`;
return request(data, "post");
}
import request from "./request";
import RequestMethods from "./request.methods";
import { buildOverviewParams } from "./adapters/journalRecord/buildOverviewParams";
import { mapOverviewPageResponse } from "./adapters/journalRecord/mapOverviewRow";
import {
buildDetailSelectParams,
mapDetailResponse,
} from "./adapters/journalRecord/mapDetailResponse";
import { mapMerchantListResponse } from "./adapters/journalRecord/mapMerchantList";
import { mapMerchantStaffListResponse } from "./adapters/journalRecord/mapMerchantStaffList";
const path = "dj.api.smartcarlife.";
const USE_MOCK = process.env.VUE_APP_JOURNAL_MOCK === "true";
function loadMock() {
return import("./journalRecord.mock");
}
export function getDailyReportMerchantList(data = {}) {
const payload = {
currentPage: 1,
pageSize: 500,
...data,
};
if (USE_MOCK) {
return loadMock().then((m) => m.mockDailyReportMerchantList(payload));
}
payload.method = `${path}dailyReport.merchant.list`;
return request(payload, RequestMethods.POST).then(mapMerchantListResponse);
}
export function getDailyReportMerchantListPage(data = {}) {
const payload = {
currentPage: 1,
pageSize: 20,
...data,
};
if (USE_MOCK) {
return loadMock()
.then((m) => m.mockDailyReportMerchantList(payload))
.then((list) => ({
list,
total: list.length,
pages: 1,
pageNum: payload.currentPage,
}));
}
payload.method = `${path}dailyReport.merchant.list`;
return request(payload, RequestMethods.POST).then((res) => ({
list: mapMerchantListResponse(res),
total: res.total ?? 0,
pages: res.pages ?? 1,
pageNum: res.pageNum ?? payload.currentPage,
}));
}
export function getDailyReportMerchantStaffList(data = {}) {
if (USE_MOCK) {
return loadMock().then((m) => m.mockDailyReportMerchantStaffList(data));
}
const payload = {
...data,
method: `${path}merchant.staff.list`,
};
return request(payload, RequestMethods.POST).then(mapMerchantStaffListResponse);
}
export function getDailyReportOverviewPage(data = {}, activeTabKey = "staffDaily") {
if (USE_MOCK) {
return loadMock().then((m) => m.mockDailyReportOverviewPage({
...data,
...buildOverviewParams(data, activeTabKey),
}));
}
const payload = {
...buildOverviewParams(data, activeTabKey),
method: `${path}dailyReport.overview.page`,
};
return request(payload, RequestMethods.POST).then(mapOverviewPageResponse);
}
export function getDailyReportDetailSelect(data = {}) {
if (USE_MOCK) {
return loadMock().then((m) => m.mockDailyReportDetailSelect(data));
}
const payload = {
...buildDetailSelectParams(data),
method: `${path}dailyReport.detail.select`,
};
return request(payload, RequestMethods.POST).then((res) => mapDetailResponse(res, data));
}
import { buildJournalDetailJsonContent } from "../views/residentManage/journalRecord/fixtures/journalDetailEcho.sample.js";
import { mapOverviewPageResponse } from "./adapters/journalRecord/mapOverviewRow";
import { mapDetailResponse } from "./adapters/journalRecord/mapDetailResponse";
import { mapMerchantListResponse } from "./adapters/journalRecord/mapMerchantList";
import { mapMerchantStaffListResponse } from "./adapters/journalRecord/mapMerchantStaffList";
const MERCHANT_NAME = "深圳市鹏程汽车有限公司";
const STORE_LIST = [
{ merchantId: "1001", merchantName: MERCHANT_NAME, sceneType: 1 },
{ merchantId: "1002", merchantName: "广州天河汽车销售服务有限公司", sceneType: 1 },
{ merchantId: "1003", merchantName: "东莞南城汽车贸易有限公司", sceneType: 0 },
{ merchantId: "1004", merchantName: "佛山顺德智行汽车销售有限公司", sceneType: 1 },
{ merchantId: "1005", merchantName: "惠州惠城汽车服务有限公司", sceneType: 0 },
];
const STAFF_LIST = [
{ staffUuid: "staff-uuid-001", staffName: "袁春梅" },
{ staffUuid: "staff-uuid-002", staffName: "韩文" },
{ staffUuid: "staff-uuid-003", staffName: "刘明杰" },
{ staffUuid: "staff-uuid-004", staffName: "王芳" },
{ staffUuid: "staff-uuid-005", staffName: "张伟" },
{ staffUuid: "staff-uuid-006", staffName: "李娜" },
{ staffUuid: "staff-uuid-007", staffName: "陈静" },
{ staffUuid: "staff-uuid-008", staffName: "赵强" },
{ staffUuid: "staff-uuid-009", staffName: "孙丽" },
{ staffUuid: "staff-uuid-010", staffName: "周涛" },
];
function delay(result, ms = 300) {
return new Promise((resolve) => {
setTimeout(() => resolve(result), ms);
});
}
function paginate(list, params) {
const { currentPage = 1, pageSize = 10 } = params;
const start = (currentPage - 1) * pageSize;
return {
list: list.slice(start, start + pageSize),
total: list.length,
pageNum: currentPage,
pageSize,
};
}
function filterStaffList(list, params) {
let result = [ ...list ];
if (params.merchantId) {
result = result.filter((item) => item.merchantId === params.merchantId);
}
if (params.staffName) {
result = result.filter((item) => item.staffName === params.staffName);
}
return result;
}
function buildStaffDailyList(params) {
return STAFF_LIST.map((item, index) => ({
id: `staff-daily-${index + 1}`,
staffUuid: item.staffUuid,
staffName: item.staffName,
merchantId: STORE_LIST[index % STORE_LIST.length].merchantId,
merchantName: STORE_LIST[index % STORE_LIST.length].merchantName,
sceneType: index % 2 === 0 ? "1" : "0",
onBreak: index % 3 === 0 ? "调休" : "在岗",
createdDate: "2026-06-12 14:41:00",
reportStatus: 0,
reportDate: params.reportDate,
templateType: 1,
}));
}
function buildStoreDailyList(params) {
return STORE_LIST.map((store, index) => ({
id: `store-daily-${index + 1}`,
merchantId: store.merchantId,
merchantName: store.merchantName,
sceneType: String(store.sceneType),
staffCount: 3,
staffName: index % 3 === 0 ? "" : STAFF_LIST[index % STAFF_LIST.length].staffName,
createdDate: "2026-06-12 14:41:00",
reportStatus: index % 3 === 0 ? 0 : 1,
reportDate: params.reportDate,
templateType: 2,
}));
}
function buildNegotiationList(params) {
return STAFF_LIST.map((item, index) => ({
id: `negotiation-${index + 1}`,
staffUuid: item.staffUuid,
staffName: item.staffName,
merchantId: STORE_LIST[index % STORE_LIST.length].merchantId,
merchantName: STORE_LIST[index % STORE_LIST.length].merchantName,
sceneType: index % 2 === 0 ? "0" : "1",
onBreak: "在岗",
createdDate: "2026-06-12 14:41:00",
reportStatus: 1,
reportDate: params.reportDate,
templateType: 3,
}));
}
function buildDetailMeta(journalType, reportDate) {
const metaMap = {
staffDaily: {
journalType: "staffDaily",
staffName: "高思琪",
merchantName: MERCHANT_NAME,
sceneType: "1",
templateType: 1,
},
storeDaily: {
journalType: "storeDaily",
staffName: "",
merchantName: MERCHANT_NAME,
sceneType: "1",
templateType: 2,
},
negotiation: {
journalType: "negotiation",
staffName: "高思琪",
merchantName: MERCHANT_NAME,
sceneType: "0",
templateType: 3,
},
};
return {
...(metaMap[journalType] || metaMap.staffDaily),
reportDate: reportDate || "2026-03-30",
reportTemplateId: "mock-template-001",
baseSceneCode: 110201,
jsonContent: buildJournalDetailJsonContent(),
};
}
const DETAIL_MAP = {
"staff-daily-1": buildDetailMeta("staffDaily", "2026-03-30"),
"store-daily-1": buildDetailMeta("storeDaily", "2026-03-30"),
"negotiation-1": buildDetailMeta("negotiation", "2026-03-30"),
};
export function mockDailyReportMerchantList(params) {
return delay(mapMerchantListResponse({ list: STORE_LIST }));
}
export function mockDailyReportMerchantStaffList(params) {
let list = STAFF_LIST.map((item, index) => ({
...item,
merchantId: STORE_LIST[index % STORE_LIST.length].merchantId,
}));
if (params.merchantId) {
list = list.filter((item) => item.merchantId === params.merchantId);
}
return delay(mapMerchantStaffListResponse({ list }));
}
export function mockDailyReportOverviewPage(params) {
const { templateType } = params;
let list = [];
if (templateType === 1) {
list = filterStaffList(buildStaffDailyList(params), params);
} else if (templateType === 2) {
list = buildStoreDailyList(params);
if (params.merchantId) {
list = list.filter((item) => item.merchantId === params.merchantId);
}
} else if (templateType === 3) {
list = filterStaffList(buildNegotiationList(params), params);
} else {
list = filterStaffList(buildStaffDailyList(params), params);
}
return delay(mapOverviewPageResponse(paginate(list, params)));
}
export function mockDailyReportDetailSelect(params) {
const { id, journalType, reportDate } = params;
let detail = DETAIL_MAP[id];
if (!detail) {
detail = {
id,
...buildDetailMeta(journalType || "staffDaily", reportDate),
};
}
return delay(mapDetailResponse({ ...detail, id: id || detail.id }, params));
}
import { applyDivisionRuleTestGetMock } from "./mockDivisionRuleTestGetResponse";
/* /*
* @Author: 'wangzhihui' '1733904062@qq.com' * @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2025-09-01 15:41:23 * @Date: 2025-09-01 15:41:23
...@@ -8,7 +9,6 @@ ...@@ -8,7 +9,6 @@
*/ */
import request from "./request"; import request from "./request";
import RequestMethods from "./request.methods"; import RequestMethods from "./request.methods";
import { applyDivisionRuleTestGetMock } from "./mockDivisionRuleTestGetResponse";
const path = "dj.api."; const path = "dj.api.";
const path2 = "dj.api.smartcarlife."; const path2 = "dj.api.smartcarlife.";
...@@ -291,8 +291,8 @@ export function scenemerchantrefQueryServiceRefByShop(data) { ...@@ -291,8 +291,8 @@ export function scenemerchantrefQueryServiceRefByShop(data) {
// 获取商户财务设置进度 // 获取商户财务设置进度
export function divisionRuleTestGet(data) { export function divisionRuleTestGet(data) {
data.method = `${path2}divisionRuleTest.get`; data.method = `${path2}divisionRuleTest.get`;
return request(data, RequestMethods.POST).then((result) => return request(data, RequestMethods.POST).then(result =>
applyDivisionRuleTestGetMock(result) applyDivisionRuleTestGetMock(result),
); );
} }
...@@ -466,8 +466,8 @@ export function paymentChannelList(data = {}) { ...@@ -466,8 +466,8 @@ export function paymentChannelList(data = {}) {
* 获取对账配置所有品类列表 * 获取对账配置所有品类列表
*/ */
export function getReconciliationGoodsTypeListApi(data = {}) { export function getReconciliationGoodsTypeListApi(data = {}) {
data.method = data.method
"dj.api.create.business.approve.listReconciliationGoodsTypeGroup"; = "dj.api.create.business.approve.listReconciliationGoodsTypeGroup";
return request(data, RequestMethods.POST); return request(data, RequestMethods.POST);
} }
...@@ -479,3 +479,11 @@ export function getMerchantList(data) { ...@@ -479,3 +479,11 @@ export function getMerchantList(data) {
data.method = "dj.api.servicemerchantref.pageServiceMerchantRef"; data.method = "dj.api.servicemerchantref.pageServiceMerchantRef";
return request(data, RequestMethods.POST); return request(data, RequestMethods.POST);
} }
/**
* 查询兜底指标列表
*/
export function getBackstopList(data) {
data.method = "dj.api.oaapproval.store.approve.queryMetricConfigs";
return request(data, RequestMethods.POST);
}
import request from "./request" import request from "./request";
const path = "dj.api." const path = "dj.api.";
const path2 = "dj.smartcarlife.api." const path2 = "dj.smartcarlife.api.";
export function getList(data) { export function getList(data = {}) {
data.method = `${path}goodsinfo.page` data.method = `${path}goodsinfo.page`;
return request(data) return request(data);
} }
export function getType(data) { export function getType(data) {
data.method = `${path}goods.type.list` data.method = `${path}goods.type.list`;
return request(data) return request(data);
} }
// 添加产品 // 添加产品
export function addGoods(data) { export function addGoods(data) {
data.method = `${path}goodsinfo.add` data.method = `${path}goodsinfo.add`;
return request(data, "post") return request(data, "post");
} }
// 编辑产品 // 编辑产品
export function editGoods(data) { export function editGoods(data) {
data.method = `${path}goodsinfo.update` data.method = `${path}goodsinfo.update`;
return request(data, "post") return request(data, "post");
} }
// 判断产品是否可删除 // 判断产品是否可删除
export function checkDeleteGoods(data) { export function checkDeleteGoods(data) {
data.method = `${path2}goodsinfo.checkDeleteable` data.method = `${path2}goodsinfo.checkDeleteable`;
return request(data, "post") return request(data, "post");
} }
// 删除产品 // 删除产品
export function deleteGoods(data) { export function deleteGoods(data) {
data.method = `${path2}goodsinfo.delete` data.method = `${path2}goodsinfo.delete`;
return request(data, "post") return request(data, "post");
} }
// 导出产品 // 导出产品
export function exportGoodsList(data) { export function exportGoodsList(data) {
data.method = `${path}goodsinfo.export` data.method = `${path}goodsinfo.export`;
return request(data, "post") return request(data, "post");
} }
// 获取场景下类目 // 获取场景下类目
export function getProductTypeBySceneId(data) { export function getProductTypeBySceneId(data) {
data.method = `${path}goodsCategoryConfiguration.queryGoodsCategoryBySceneId` data.method = `${path}goodsCategoryConfiguration.queryGoodsCategoryBySceneId`;
return request(data, "post") return request(data, "post");
} }
// 获取品牌方/供应方 // 获取品牌方/供应方
export function getBrandSupplyMerchant(data) { export function getBrandSupplyMerchant(data) {
data.method = `${path}goods.type.queryGoodsRelatedParty` data.method = `${path}goods.type.queryGoodsRelatedParty`;
return request(data, "post") return request(data, "post");
} }
// 新增供应方 // 新增供应方
export function addBrandSupplyMerchant(data) { export function addBrandSupplyMerchant(data) {
data.method = `${path}goods.type.addGoodsRelatedParty` data.method = `${path}goods.type.addGoodsRelatedParty`;
return request(data, "post") return request(data, "post");
} }
// 编辑/删除供应方 // 编辑/删除供应方
export function editBrandSupplyMerchant(data) { export function editBrandSupplyMerchant(data) {
data.method = `${path}goods.type.editGoodsRelatedParty` data.method = `${path}goods.type.editGoodsRelatedParty`;
return request(data, "post") return request(data, "post");
} }
// 获取素材详情 // 获取素材详情
export function getProductInfo(data) { export function getProductInfo(data) {
data.method = `${path}goodsinfo.get.byId` data.method = `${path}goodsinfo.get.byId`;
return request(data, "post") return request(data, "post");
} }
// 获取三级全部类目 // 获取三级全部类目
export function getAllCategory(data) { export function getAllCategory(data = {}) {
data.method = `${path}goodsCategoryConfiguration.page.new` data.method = `${path}goodsCategoryConfiguration.page.new`;
return request(data, "post") return request(data, "post");
} }
...@@ -164,6 +164,10 @@ export function getUpgradeProductList(data) { ...@@ -164,6 +164,10 @@ export function getUpgradeProductList(data) {
data.method = `${path}productManager.listUpgradeGoodsWithPage`; data.method = `${path}productManager.listUpgradeGoodsWithPage`;
return request(data, "post"); return request(data, "post");
} }
export function getUpgradeProductListV2(data) {
data.method = `dj.api.smartcarlife.productManager.listUpgradeGoodsWithPage.v2`;
return request(data, "post");
}
// 根据id查询商品详情 // 根据id查询商品详情
export function getBaseGoodsById(data) { export function getBaseGoodsById(data) {
...@@ -225,6 +229,24 @@ export function importBatchEditSKU(data) { ...@@ -225,6 +229,24 @@ export function importBatchEditSKU(data) {
return request(data, "post", ["file"]); return request(data, "post", ["file"]);
} }
// 批量新增SPU/SKU权益/延保导入
export function importBatchAddSPUOrSKUExtension(data) {
data.method = "dj.api.smartcarlife.productManager.yanbao.spu.sku.batch.add.import";
return request(data, "post", ["file"]);
}
// 批量新增SKU权益/延保导入
export function importBatchAddSKUExtension(data) {
data.method = "dj.api.smartcarlife.productManager.yanbao.sku.batch.add.import";
return request(data, "post", ["file"]);
}
// 批量修改SKU权益/延保导入
export function importBatchEditSKUExtension(data) {
data.method = "dj.api.smartcarlife.productManager.yanbao.sku.batch.update.import";
return request(data, "post", ["file"]);
}
// 获取供应商数据 // 获取供应商数据
export function getGoodsProviderList(data) { export function getGoodsProviderList(data) {
data.method = "dj.api.smartcarlife.goodsProvider.page"; data.method = "dj.api.smartcarlife.goodsProvider.page";
...@@ -244,13 +266,13 @@ export function editGoodsProvider(data) { ...@@ -244,13 +266,13 @@ export function editGoodsProvider(data) {
} }
// 获取省市两级数据 // 获取省市两级数据
export function getAreaDataList(data) { export function getAreaDataList(data = {}) {
data.method = "dj.api.smartcarlife.map.districts.provinceCity"; data.method = "dj.api.smartcarlife.map.districts.provinceCity";
return request(data); return request(data);
} }
// 获取业务场景数据 // 获取业务场景数据
export function getBaseSceneCodeList(data) { export function getBaseSceneCodeList(data = {}) {
data.method = "dj.api.smartcarlife.scene.getScenesByParams"; data.method = "dj.api.smartcarlife.scene.getScenesByParams";
return request(data); return request(data);
} }
...@@ -118,4 +118,10 @@ export function getTrialOnboardingStoreList(data) { ...@@ -118,4 +118,10 @@ export function getTrialOnboardingStoreList(data) {
export function getRecruitmentDemandSubSceneList(data) { export function getRecruitmentDemandSubSceneList(data) {
data.method = `dj.staff.api.recruitment.demand.sub.scene.list`; data.method = `dj.staff.api.recruitment.demand.sub.scene.list`;
return request(data); return request(data);
}
// 潜在客户列表
export function getPotentialCustomersList(data) {
data.method = `dj.api.smartcarlife.sale.potentialCustomers.page`;
return request(data);
} }
\ No newline at end of file \ No newline at end of file
...@@ -11,6 +11,7 @@ import { baseConfig } from "@/main"; ...@@ -11,6 +11,7 @@ import { baseConfig } from "@/main";
// import axios from "@/plugin/axios" // import axios from "@/plugin/axios"
import axios from "@/plugin/axios/index_code"; import axios from "@/plugin/axios/index_code";
import RequestMethods from "./request.methods"; import RequestMethods from "./request.methods";
import resolveApiName, { getAxiosConfigKey, getSignWay } from "./resolveApiName";
import sign from "./sign"; import sign from "./sign";
function request( function request(
...@@ -19,65 +20,11 @@ function request( ...@@ -19,65 +20,11 @@ function request(
noSignAttr = [], noSignAttr = [],
options = {}, options = {},
) { ) {
// 兼容线上dj和scrm appkey和secret不一样的情况 const apiName = resolveApiName(params.method);
let apiName = "";
if (params.method.includes("dj.api.smartcarlife.sop.strategy")) {
apiName = "strategy";
} else if (params.method.includes("dj.api.smartcarlife")) {
apiName = "dj";
} else if (params.method.includes("dj.api.script")) {
apiName = "script";
} else if (params.method.includes("dj.staff.api")) {
apiName = "staff";
} else if (params.method.includes("dj.smartcarlife.stock")) {
apiName = "dj.smartcarlife";
} else if (params.method.includes("risk.manage.api")) {
apiName = "riskmanage";
} else if (params.method.includes("dj.api.strategy")) {
apiName = "strategy";
} else if (params.method.includes("dj.api.supervisor")) {
apiName = "supervisor";
} else if (params.method.includes("dj.pad.api")) {
// rop-dj-pad 等方法名含 dj.pad,split(".api") 会得到 dj.pad 无 mapping;签名与 appKey 沿用 dj
apiName = "dj";
} else if (params.method.includes("dj.api.oaapproval")) {
apiName = "oaapproval";
} else if (params.method.includes("dj.api.taskcenter")) {
apiName = "taskcenter";
} else if (params.method.includes("merchants.api.open.createMerchantWithPermissions")) {
/** 开放平台创建商户 — 与同网关 oaapproval 一致,使用 axios_oaapproval / baseURL */
apiName = "oaapproval";
} else if (params.method.includes("dj.api.marketing")) {
apiName = "strategy";
} else {
// console.log(params.method.split(".api"))
apiName = params.method.split(".api")[0];
}
// console.log("params.method", params.method)
// console.log("apiName", apiName)
// 为空报错
if (!apiName) { if (!apiName) {
throw new Error("apiName is null"); throw new Error("apiName is null");
} }
const mappingName = { const baseApiName = getAxiosConfigKey(apiName);
"dj.smartcarlife": "axios",
"dj": "axios",
"scrm": "axios2",
"merchants": "axios3",
"reportExport": "axios4",
"glsx.accounts.biz.common.pictureUpload": "common",
"clue": "axios5",
"dj.businessSchool": "axios6",
"script": "axios7",
"staff": "axios9",
"riskmanage": "axios10",
"strategy": "axios_strategy",
"supervisor": "axios_supervisor",
"oaapproval": "axios_oaapproval",
"taskcenter": "axiosTaskCenter",
};
const baseApiName = mappingName[apiName];
// console.log(baseApiName, "baseApiName") // console.log(baseApiName, "baseApiName")
// params.appKey = baseConfig[baseApiName].appkey // params.appKey = baseConfig[baseApiName].appkey
if (baseApiName == "common") { if (baseApiName == "common") {
...@@ -102,29 +49,15 @@ function request( ...@@ -102,29 +49,15 @@ function request(
/** /**
* 调后端接口,请使用以下代码。 * 调后端接口,请使用以下代码。
*/ */
const signWay = {
"dj.smartcarlife": "sha1",
"dj": "sha1",
"scrm": "sha1",
"glsx": "md5",
"glsx.accounts.biz.common.pictureUpload": "md5",
"clue": "sha1",
"script": "sha1",
"staff": "sha1",
"riskmanage": "sha1",
"oaapproval": "sha1",
"taskcenter": "sha1",
};
// console.log(signWay[apiName], "baseApiName")
const secret = baseConfig[baseApiName].secret; const secret = baseConfig[baseApiName].secret;
const CancelToken = axiosPackage.CancelToken; const CancelToken = axiosPackage.CancelToken;
let reqData let reqData
= method === RequestMethods.POST = method === RequestMethods.POST
? { ? {
baseURL: "/", baseURL: "/",
data: sign(params, noSignAttr, secret, signWay[apiName]), data: sign(params, noSignAttr, secret, getSignWay(apiName)),
} }
: { params: sign(params, noSignAttr, secret, signWay[apiName]) }; : { params: sign(params, noSignAttr, secret, getSignWay(apiName)) };
reqData = Object.assign(reqData, options, {}); reqData = Object.assign(reqData, options, {});
// 请求进度 // 请求进度
...@@ -146,8 +79,9 @@ function request( ...@@ -146,8 +79,9 @@ function request(
method, method,
...reqData, ...reqData,
}; };
if (options.returnAll) if (options.returnAll) {
axiosParams.headers = { "return-all": true }; axiosParams.headers = { "return-all": true };
}
return axios(axiosParams); return axios(axiosParams);
/** /**
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
* @Date: 2019-08-26 18:02:41 * @Date: 2019-08-26 18:02:41
* @Last Modified by: chenwq * @Last Modified by: chenwq
* @Last Modified time: 2021-06-30 14:30:41 * @Last Modified time: 2021-06-30 14:30:41
*
* 注意:apiName 规则为 request.js 的子集,仅覆盖 dj / split(".api")。
* 主请求请使用 request.js;本文件供 index_code 插件专用。
*/ */
import axios from "@/plugin/axios/index_code" import axios from "@/plugin/axios/index_code"
......
export {
resolveApiName as default,
resolveApiName,
getAxiosConfigKey,
getSignWay,
} from "@/libs/rop/resolveApiName";
...@@ -22,8 +22,8 @@ export function potentialCustomersDetail(data) { ...@@ -22,8 +22,8 @@ export function potentialCustomersDetail(data) {
// 潜客核验详情(含 merchantInfo) // 潜客核验详情(含 merchantInfo)
export function potentialCustomersVerificationDetail(data) { export function potentialCustomersVerificationDetail(data) {
data.method = data.method
"dj.api.smartcarlife.sale.potentialCustomers.verificationDetail"; = "dj.api.smartcarlife.sale.potentialCustomers.verificationDetail";
return request(data, "post"); return request(data, "post");
} }
...@@ -35,15 +35,15 @@ export function bind4SStore(data) { ...@@ -35,15 +35,15 @@ export function bind4SStore(data) {
// 潜客信息核验提交(dj.api.smartcarlife.sale.potentialCustomers.submitVerification) // 潜客信息核验提交(dj.api.smartcarlife.sale.potentialCustomers.submitVerification)
export function potentialCustomersInfoVerify(data) { export function potentialCustomersInfoVerify(data) {
data.method = data.method
"dj.api.smartcarlife.sale.potentialCustomers.submitVerification"; = "dj.api.smartcarlife.sale.potentialCustomers.submitVerification";
return request(data, "post"); return request(data, "post");
} }
// 潜客新建商户 — 校验商户名称是否与账户中心重复 // 潜客新建商户 — 校验商户名称是否与账户中心重复
export function potentialCustomersCheckMerchantName(data) { export function potentialCustomersCheckMerchantName(data) {
data.method = data.method
"dj.api.smartcarlife.sale.potentialCustomers.checkMerchantName"; = "dj.api.smartcarlife.sale.potentialCustomers.checkMerchantName";
// data.method = "dj.api.smartcarlife.sale.potentialCustomers.infoVerify"; // data.method = "dj.api.smartcarlife.sale.potentialCustomers.infoVerify";
return request(data, "post"); return request(data, "post");
} }
...@@ -82,7 +82,7 @@ export function closeStorePage(data) { ...@@ -82,7 +82,7 @@ export function closeStorePage(data) {
data.method = "dj.api.smartcarlife.sale.closeStore.page"; data.method = "dj.api.smartcarlife.sale.closeStore.page";
return request(data, "post"); return request(data, "post");
} }
//是否关店 // 是否关店
export function closeStoreConfirm(data) { export function closeStoreConfirm(data) {
data.method = "dj.api.smartcarlife.sale.closeStore.confirm"; data.method = "dj.api.smartcarlife.sale.closeStore.confirm";
return request(data, "post"); return request(data, "post");
...@@ -125,6 +125,43 @@ export function storeApproveQueryDetail(data) { ...@@ -125,6 +125,43 @@ export function storeApproveQueryDetail(data) {
data.method = "dj.api.oaapproval.store.approve.queryDetail"; data.method = "dj.api.oaapproval.store.approve.queryDetail";
return request(data, "post"); return request(data, "post");
} }
/**
* 查询兜底指标列表
*/
export function storeApproveQueryMetricConfigs(data) {
data.method = "dj.api.oaapproval.store.approve.queryMetricConfigs";
return request(data, "post");
}
/**
* 编辑流量方确认(含兜底配置)
*/
export function storeApproveEditTrafficParty(data) {
data.method = "dj.api.oaapproval.store.approve.editTrafficParty";
return request(data, "post", ["file"], {
returnAll: true,
});
}
/**
* 编辑分账配置
*/
export function storeApproveEditDivisionConfig(data) {
data.method = "dj.api.oaapproval.store.approve.editDivisionConfig";
return request(data, "post", ["file"], {
returnAll: true,
});
}
/**
* 编辑对账配置
*/
export function storeApproveEditReconciliationConfig(data) {
data.method = "dj.api.oaapproval.store.approve.editReconciliationConfig";
return request(data, "post", ["file"], {
returnAll: true,
});
}
/** /**
* 编辑门店上架审批单 * 编辑门店上架审批单
...@@ -168,3 +205,18 @@ export function qyMerchantPageList(data = {}) { ...@@ -168,3 +205,18 @@ export function qyMerchantPageList(data = {}) {
data.method = "dj.smartcarlife.api.qyMerchant.pageList"; data.method = "dj.smartcarlife.api.qyMerchant.pageList";
return request(data, "post"); return request(data, "post");
} }
/**
* 潜客编辑关联商户
*/
export function potentialCustomersEditMerchant(data) {
data.method = "merchants.api.oaapproval.merchant.update";
return request(data, "post");
}
/**
* 潜客获取详情信息
*/
export function potentialCustomerDetail(data) {
data.method = "merchants.api.oaapproval.merchant.detail";
return request(data, "post");
}
import request from "./request" import request from "./request";
import RequestMethods from "./request.methods" import RequestMethods from "./request.methods";
const path = "dj.api.smarcarlife."
const path = "dj.api.smarcarlife.";
export function getList(data) { export function getList(data) {
data.method = `${path}construction.item.page`
return request(data, RequestMethods.POST)
}
\ No newline at end of file \ No newline at end of file
data.method = `${path}construction.item.page`;
return request(data, RequestMethods.POST);
}
...@@ -4,60 +4,4 @@ ...@@ -4,60 +4,4 @@
* @Last Modified by: chenwq * @Last Modified by: chenwq
* @Last Modified time: 2021-06-18 10:04:32 * @Last Modified time: 2021-06-18 10:04:32
*/ */
import sha1 from "sha1" export { default } from "@/libs/rop/signCore";
import md5 from "md5"
import qs from "qs"
import { deepClone } from "@/common/util"
const sign = (params, noSignAttr = [], secret, way = "sha1") => {
// console.log(way, "way")
delete params.sign
var objStr = qs.stringify(deepClone(params), {
arrayFormat: "indices",
allowDots: true,
encodeValuesOnly: true
})
var objVal = objStr.split("&")
var realObj = {}
objVal.forEach((item) => {
const idx = item.indexOf("=")
realObj[item.split("=")[0]] = decodeURIComponent(item.slice(idx + 1))
})
// console.log(realObj)
const keys = Object.keys(realObj).sort()
var str = []
var obj = null
for (const key in realObj) {
obj = realObj[key]
if (obj === null) {
obj = ""
} else if (typeof obj === "object") {
obj = JSON.stringify(obj)
}
realObj[key] = obj
}
keys.forEach((e) => {
!noSignAttr.includes(e) && str.push(e + realObj[e])
})
// realObj.sign = sha1(secret + str.join("") + secret).toUpperCase()
const signObj = { sha1, md5 }
realObj.sign = signObj[way](secret + str.join("") + secret).toUpperCase()
return realObj
}
//精确计算2个数的加减运算
function add(num1, num2) {
var r1, r2, m
try {
r1 = num1.toString().split(".")[1].length
} catch (e) {
r1 = 0
}
try {
r2 = num2.toString().split(".")[1].length
} catch (e) {
r2 = 0
}
m = Math.pow(10, Math.max(r1, r2))
return (Math.round(num1 * m) + Math.round(num2 * m)) / m
}
export default sign
import request from "./request" import request from "./request";
import RequestMethods from "./request.methods" import RequestMethods from "./request.methods";
const path = "dj.smartcarlife.api." const path = "dj.smartcarlife.api.";
// 交易明细列表 // 交易明细列表
export function nbcbAccDetailPage(data) { export function nbcbAccDetailPage(data) {
data.method = `${path}nbcb.acc.detail.page` data.method = `${path}nbcb.acc.detail.page`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 财资数据筛选项列表 // 财资数据筛选项列表
export function nbcbAccDetailConfig(data) { export function nbcbAccDetailConfig(data) {
data.method = `${path}nbcb.acc.detail.config` data.method = `${path}nbcb.acc.detail.config`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 交易明细重取 // 交易明细重取
export function nbcbAccDetailRefetch(data) { export function nbcbAccDetailRefetch(data) {
data.method = `${path}nbcb.acc.detail.refetch` data.method = `${path}nbcb.acc.detail.refetch`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 批量同步交易明细 // 批量同步交易明细
export function nbcbAccDetailBatchSync(data) { export function nbcbAccDetailBatchSync(data) {
data.method = `${path}nbcb.acc.detail.batch.sync` data.method = `${path}nbcb.acc.detail.batch.sync`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 交易明细详情 // 交易明细详情
export function nbcbAccDetail(data) { export function nbcbAccDetail(data) {
data.method = `${path}nbcb.acc.detail` data.method = `${path}nbcb.acc.detail`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 交易明细关联回单pdf // 交易明细关联回单pdf
export function nbcbReceiptPdfUrl(data) { export function nbcbReceiptPdfUrl(data) {
data.method = `${path}nbcb.receipt.pdf.url` data.method = `${path}nbcb.receipt.pdf.url`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 批量打印 // 批量打印
export function batchPrinting(data) { export function batchPrinting(data) {
data.method = `${path}nbcb.acc.batch.printing` data.method = `${path}nbcb.acc.batch.printing`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 查询交易明细、回单文件解析任务结果(手动导入关联时使用,无任务id时会新建任务id) // 查询交易明细、回单文件解析任务结果(手动导入关联时使用,无任务id时会新建任务id)
export function getImportTask(data) { export function getImportTask(data) {
data.method = `${path}nbcb.acc.association.import.task` data.method = `${path}nbcb.acc.association.import.task`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 交易明细、回单关联 // 交易明细、回单关联
export function association(data) { export function association(data) {
data.method = `${path}nbcb.acc.association` data.method = `${path}nbcb.acc.association`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 同步保存交易明细、回单 关联记录 // 同步保存交易明细、回单 关联记录
export function saveAssociation(data) { export function saveAssociation(data) {
data.method = `${path}nbcb.acc.association.save` data.method = `${path}nbcb.acc.association.save`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 交易明细excel导入 // 交易明细excel导入
export function detailExcelImport(data) { export function detailExcelImport(data) {
data.method = `${path}nbcb.acc.detail.excel.import` data.method = `${path}nbcb.acc.detail.excel.import`;
return request(data, "post", ["file"]) return request(data, "post", ["file"]);
} }
// 回单文件导入(.pdf|.zip|.rar) // 回单文件导入(.pdf|.zip|.rar)
export function receiptImport(data) { export function receiptImport(data) {
data.method = `${path}nbcb.acc.receipt.import` data.method = `${path}nbcb.acc.receipt.import`;
return request(data, "post", ["file"]) return request(data, "post", ["file"]);
} }
// 批量同步电子回单到金蝶 // 批量同步电子回单到金蝶
export function receiptBatchSync(data) { export function receiptBatchSync(data) {
data.method = `${path}nbcb.acc.receipt.batch.sync` data.method = `${path}nbcb.acc.receipt.batch.sync`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
}
// 查询财资标签树
export function getDetailTagTree(data) {
data.method = `${path}nbcb.acc.detail.tag.tree`;
return request(data, RequestMethods.POST);
}
// 标签编辑保存预览
export function saveDetailTagPreview(data) {
data.method = "dj.smartcarlife.api.nbcb.acc.detail.tag.save.preview";
return request(data, RequestMethods.POST);
}
// 保存财资标签
export function saveDetailTag(data) {
data.method = "dj.smartcarlife.api.nbcb.acc.detail.tag.save";
return request(data, RequestMethods.POST);
}
// 标签删除预览
export function deleteDetailTagPreview(data) {
data.method = "dj.smartcarlife.api.nbcb.acc.detail.tag.delete.preview";
return request(data, RequestMethods.POST);
}
// 删除财资标签
export function deleteDetailTag(data) {
data.method = "dj.smartcarlife.api.nbcb.acc.detail.tag.delete";
return request(data, RequestMethods.POST);
}
// 财资明细打标签
export function bindDetailTag(data) {
data.method = "dj.smartcarlife.api.nbcb.acc.detail.tag.bind";
return request(data, RequestMethods.POST);
}
// 权限校验
export function checkPermission(data) {
data.method = "dj.smartcarlife.api.nbcb.acc.summary.report.download.preview";
return request(data, RequestMethods.POST);
} }
{
"env": "develop",
"axios": {
"baseURL": "http://dj.dev.glsx.com.cn/rop-dj-smartcarlife/router",
"appkey": "48e5e13229b82c1b4e6e8c96151f0637",
"secret": "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
"timeout": 50000,
"result": {
"data_key": "data",
"message_key": "message",
"code_key": "code",
"code_success_value": 0,
"code_error_value": -1,
"code_message_map": {}
}
}
}
...@@ -1245,6 +1245,7 @@ export const operationTypeOpt = [ ...@@ -1245,6 +1245,7 @@ export const operationTypeOpt = [
{ confId: 7, confValue: "推送回单" }, { confId: 7, confValue: "推送回单" },
{ confId: 8, confValue: "重推流水明细" }, { confId: 8, confValue: "重推流水明细" },
{ confId: 9, confValue: "重推回单" }, { confId: 9, confValue: "重推回单" },
{ confId: 10, confValue: "编辑自定义标签" },
]; ];
// 财资数据 操作项 // 财资数据 操作项
......
...@@ -490,6 +490,91 @@ export function getMonthDateRange(targetMonth) { ...@@ -490,6 +490,91 @@ export function getMonthDateRange(targetMonth) {
return { startDate, endDate }; return { startDate, endDate };
} }
export function getFallbackSettlementOptions() {
const options = [{ label: "每月最后1天", value: 0 }];
for (let day = 1; day <= 27; day += 1) {
options.push({ label: `每月${day}号`, value: day });
}
return options;
}
export function getSettlementPeriodRange(targetMonth, settlementDate = 0) {
const monthRange = getMonthDateRange(targetMonth);
if (!monthRange) return null;
const day = Number(settlementDate) || 0;
if (day <= 0) {
return {
startDate: monthRange.startDate,
fullEndDate: monthRange.endDate,
maxEndDate: monthRange.endDate,
};
}
const [yearStr, monthStr] = targetMonth.split("-");
const year = parseInt(yearStr, 10);
const month = parseInt(monthStr, 10);
const start = new Date(year, month - 2, day + 1);
const startDate = `${start.getFullYear()}-${String(start.getMonth() + 1).padStart(2, "0")}-${String(start.getDate()).padStart(2, "0")}`;
const fullEndDate = `${yearStr}-${monthStr.padStart(2, "0")}-${String(day).padStart(2, "0")}`;
return {
startDate,
fullEndDate,
maxEndDate: fullEndDate,
};
}
export function getSettlementPeriodPickerDefaultDate(targetMonth, settlementDate = 0) {
const { maxEndDate } = getSettlementPeriodRange(targetMonth, settlementDate) || {};
if (!maxEndDate) return null;
const [year, month, day] = maxEndDate.split("-").map(item => parseInt(item, 10));
return new Date(year, month - 1, day);
}
export function getEditablePeriodStartDateRange(targetMonth) {
if (!targetMonth) return null;
const [yearStr, monthStr] = targetMonth.split("-");
const year = parseInt(yearStr, 10);
const month = parseInt(monthStr, 10);
if (!year || !month) return null;
const minStart = new Date(year, month - 2, 2);
const minStartDate = `${minStart.getFullYear()}-${String(minStart.getMonth() + 1).padStart(2, "0")}-02`;
const maxStartDate = `${yearStr}-${monthStr.padStart(2, "0")}-01`;
return { minStartDate, maxStartDate };
}
export function getEditablePeriodStartPickerDefaultDate(targetMonth) {
const { minStartDate } = getEditablePeriodStartDateRange(targetMonth) || {};
if (!minStartDate) return null;
const [year, month, day] = minStartDate.split("-").map(item => parseInt(item, 10));
return new Date(year, month - 1, day);
}
export function getEditableSettlementPeriodRange(targetMonth, startDate) {
const monthRange = getMonthDateRange(targetMonth);
const startRange = getEditablePeriodStartDateRange(targetMonth);
if (!monthRange || !startRange || !startDate) return null;
if (startDate < startRange.minStartDate || startDate > startRange.maxStartDate) return null;
const [, , startDayStr] = startDate.split("-");
const startDay = parseInt(startDayStr, 10);
const monthLastDay = parseInt(monthRange.endDate.split("-")[2], 10);
const endDay = Math.min(startDay - 1, monthLastDay);
const fullEndDate = startDate === monthRange.startDate
? monthRange.endDate
: `${targetMonth}-${String(endDay).padStart(2, "0")}`;
return {
startDate,
fullEndDate,
maxEndDate: fullEndDate,
};
}
/** /**
* 解析归属周期展示字符串为 [startDate, endDate] * 解析归属周期展示字符串为 [startDate, endDate]
* 支持 2026/05/01-2026/05/15 与 2026-05-01-2026-05-15 * 支持 2026/05/01-2026/05/15 与 2026-05-01-2026-05-15
......
function tryParseJson(raw) {
if (typeof raw !== "string" || !raw.trim()) {
return null;
}
try {
return JSON.parse(raw);
} catch (error) {
return null;
}
}
/**
* 解析配置中心响应:支持 { code, data } 包装或直接返回配置体
* @param {*} response
* @returns {object|null}
*/
export function parseConfigCenterResponse(response) {
if (!response || typeof response !== "object") {
return null;
}
let payload = response;
if (response.code == "200" && response.data) {
payload = typeof response.data === "string"
? tryParseJson(response.data)
: response.data;
}
if (
payload
&& typeof payload === "object"
&& payload.axios?.baseURL
&& payload.axios?.appkey
) {
return payload;
}
return null;
}
export function mergeConfigTarget(target, source) {
if (!target || !source || typeof source !== "object") {
return target;
}
Object.keys(target).forEach((key) => {
delete target[key];
});
return Object.assign(target, source);
}
<template> <template>
<div class="d2-container-full"> <div class="d2-container-full">
<!-- <el-scrollbar> --> <!-- <el-scrollbar> -->
<div v-if="$slots.header" <div v-if="$slots.header"
ref="header" ref="header"
class="d2-container-full__header" class="d2-container-full__header"
:class="active ? 'active' : 'close'"> :class="active ? 'active' : 'close'">
<slot name="header" /> <slot name="header" />
<D2HeaderSwitch /> <D2HeaderSwitch />
</div> </div>
<div ref="body" <div ref="body"
class="d2-container-full__body"> class="d2-container-full__body">
<slot /> <slot />
</div>
<div v-if="$slots.footer"
ref="footer"
class="d2-container-full__footer">
<slot name="footer" />
</div>
<!-- </el-scrollbar> -->
</div> </div>
<div v-if="$slots.footer"
ref="footer"
class="d2-container-full__footer">
<slot name="footer" />
</div>
<!-- </el-scrollbar> -->
</div>
</template> </template>
<script> <script>
......
<template> <template>
<div v-if="show" class="d2-header-switch" :class="{ 'd2-header-switch--active': isActive }" @click="handleClick"> <div v-if="show"
<d2-el-icon :name="name" /> class="d2-header-switch"
<li :class="$store.state.d2admin.tsearch.active ? 'fa fa-compress' : 'fa fa-expand'" /> :class="{ 'd2-header-switch--active': isActive }"
</div> @click="handleClick">
</template> <d2-el-icon :name="name" />
<li :class="$store.state.d2admin.tsearch.active ? 'fa fa-compress' : 'fa fa-expand'" />
<script> </div>
import { mapMutations } from 'vuex' </template>
export default {
data() { <script>
return { import { mapMutations } from "vuex";
isActive: false,
path: '' export default {
} data() {
}, return {
computed: { isActive: false,
show() { path: "",
return true };
}, },
name() { computed: {
return this.$store.state.d2admin.tsearch.active ? 'top-right' : 'bottom-left' show() {
} return true;
}, },
mounted() { name() {
setTimeout(() => (this.isActive = true), 0) return this.$store.state.d2admin.tsearch.active ? "top-right" : "bottom-left";
}, },
methods: { },
...mapMutations('d2admin/tsearch', ['toggle']), mounted() {
// 点击按钮的时候跳转到源代码 setTimeout(() => (this.isActive = true), 0);
handleClick() { },
this.toggle() methods: {
} ...mapMutations("d2admin/tsearch", ["toggle"]),
} // 点击按钮的时候跳转到源代码
} handleClick() {
</script> this.toggle();
},
<style lang="scss" scoped> },
.d2-header-switch { };
$borderRadius: 30px; </script>
$paddingLR: 30px;
$paddingTB: 2px; <style lang="scss" scoped>
$fontSize: 12px; .d2-header-switch {
// $rightOuter: $paddingLR/2; $borderRadius: 30px;
$rightOuter: calc($paddingLR / 2); $paddingLR: 30px;
opacity: 0; $paddingTB: 2px;
position: absolute; $fontSize: 12px;
z-index: 2000; // $rightOuter: $paddingLR/2;
right: 20%; $rightOuter: calc($paddingLR / 2);
bottom: -17px; opacity: 0;
font-size: $fontSize; position: absolute;
line-height: $fontSize; z-index: 2000;
font-weight: bold; right: 20%;
border-radius: 0 0 $borderRadius $borderRadius; bottom: -17px;
padding: $paddingTB $paddingLR; font-size: $fontSize;
background-color: rgba(#fff, 1); line-height: $fontSize;
border: 1px solid #dcdfe6; font-weight: bold;
border-top: none; border-radius: 0 0 $borderRadius $borderRadius;
color: #606266; padding: $paddingTB $paddingLR;
transition: all 0.3s; background-color: rgba(#fff, 1);
@extend %unable-select; border: 1px solid #dcdfe6;
border-top: none;
&.d2-header-switch--active { color: #606266;
opacity: 1; transition: all 0.3s;
} @extend %unable-select;
}
</style> &.d2-header-switch--active {
opacity: 1;
}
}
</style>
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!