diff --git a/openspec/changes/add-asset-wallet-auto-renewal-config/tasks.md b/openspec/changes/add-asset-wallet-auto-renewal-config/tasks.md index 2f92633..a93055b 100644 --- a/openspec/changes/add-asset-wallet-auto-renewal-config/tasks.md +++ b/openspec/changes/add-asset-wallet-auto-renewal-config/tasks.md @@ -1,27 +1,27 @@ # Tasks: 资产钱包自动续费配置 ## 1. 类型与 API -- [ ] 1.1 新增 `src/types/api/assetWallet.ts`:`AssetAutoRenewalConfig`(`enabled`/`enabled_name`/`scope`/`scope_name`/`package_ids`/`days_before_expiry`/`config_version`/`updater`/`updated_at`)、`UpdateAssetAutoRenewalConfigRequest`(`enabled`/`scope`/`package_ids`/`days_before_expiry`)等类型 -- [ ] 1.2 `src/types/api/index.ts` 导出新类型 -- [ ] 1.3 新增 `src/api/modules/assetWallet.ts`: +- [x] 1.1 新增 `src/types/api/assetWallet.ts`:`AssetAutoRenewalConfig`(`enabled`/`enabled_name`/`scope`/`scope_name`/`package_ids`/`days_before_expiry`/`config_version`/`updater`/`updated_at`)、`UpdateAssetAutoRenewalConfigRequest`(`enabled`/`scope`/`package_ids`/`days_before_expiry`)等类型 +- [x] 1.2 `src/types/api/index.ts` 导出新类型 +- [x] 1.3 新增 `src/api/modules/assetWallet.ts`: - `getAutoRenewalConfig`:`GET /api/admin/asset-auto-renewal-config` - `saveAutoRenewalConfig`:`PUT /api/admin/asset-auto-renewal-config` -- [ ] 1.4 `src/api/modules/index.ts` 导出新服务 +- [x] 1.4 `src/api/modules/index.ts` 导出新服务 ## 2. 配置页面 -- [ ] 2.1 `src/router/routesAlias.ts` 新增资产钱包自动续费配置路由别名,`src/router/routes/asyncRoutes.ts` 在设置下注册路由与菜单(仅超级管理员与平台账号可见) -- [ ] 2.2 新增 `src/views/settings/asset-wallet-auto-renewal/index.vue`:读取配置并展示总开关、适用范围、指定主套餐、统一到期前天数、配置版本、最近保存操作者与时间 -- [ ] 2.3 实现保存表单:总开关(0/1)、适用范围(all/specified)、到期前天数(1–90 校验);指定范围时主套餐多选仅支持当前可售主套餐且非空 -- [ ] 2.4 保存成功后使用响应刷新 `config_version`、`updater`、`updated_at`,不做新增/删除记录操作 +- [x] 2.1 `src/router/routesAlias.ts` 新增资产钱包自动续费配置路由别名,`src/router/routes/asyncRoutes.ts` 在设置下注册路由与菜单(仅超级管理员与平台账号可见) +- [x] 2.2 新增 `src/views/settings/asset-wallet-auto-renewal/index.vue`:读取配置并展示总开关、适用范围、指定主套餐、统一到期前天数、配置版本、最近保存操作者与时间(含 `enabled_name`/`scope_name`) +- [x] 2.3 实现保存表单:总开关(0/1)、适用范围(all/specified)、到期前天数(1–90 校验);指定范围时主套餐多选仅支持当前可售主套餐且非空 +- [x] 2.4 保存成功后使用响应刷新 `config_version`、`updater`、`updated_at`,不做新增/删除记录操作 ## 3. 通知适配 -- [ ] 3.1 确认 `src/utils/business/notificationNavigation.ts` 白名单包含 `iot_card` 与 `device`,目标可用时跳转资产详情 -- [ ] 3.2 确认 `src/components/core/layouts/art-notification/index.vue` 的 `expiry` 分类可展示 `asset.auto_renewal.failed`,`available=false` 时只显示正文不跳转 -- [ ] 3.3 确认该类型通知计入未读数与分类汇总 +- [x] 3.1 确认 `src/utils/business/notificationNavigation.ts` 白名单包含 `iot_card` 与 `device`,目标可用时跳转资产详情 +- [x] 3.2 确认 `src/components/core/layouts/art-notification/index.vue` 的 `expiry` 分类可展示 `asset.auto_renewal.failed`,`available=false` 时只显示正文不跳转 +- [x] 3.3 确认该类型通知计入未读数与分类汇总 ## 4. Verification -- [ ] 4.1 验证 GET/PUT 字段传递与参数校验(enabled、scope、package_ids、days_before_expiry) -- [ ] 4.2 验证指定范围时 package_ids 非空且仅可售主套餐 -- [ ] 4.3 验证通知类型展示、目标跳转与不可用目标处理 -- [ ] 4.4 验证非超级管理员/平台账号访问的 403 处理 -- [ ] 4.5 运行 lint、类型检查与构建 +- [x] 4.1 验证 GET/PUT 字段传递与参数校验(enabled、scope、package_ids、days_before_expiry) +- [x] 4.2 验证指定范围时 package_ids 非空且仅可售主套餐 +- [x] 4.3 验证通知类型展示、目标跳转与不可用目标处理 +- [x] 4.4 验证非超级管理员/平台账号访问的 403 处理 +- [x] 4.5 运行 lint、类型检查与构建 diff --git a/openspec/changes/add-polling-priority-queue/tasks.md b/openspec/changes/add-polling-priority-queue/tasks.md index dbb4aa1..ef594db 100644 --- a/openspec/changes/add-polling-priority-queue/tasks.md +++ b/openspec/changes/add-polling-priority-queue/tasks.md @@ -1,30 +1,30 @@ # Tasks: 轮询管理 - 优先队列 ## 1. 类型 -- [ ] 1.1 新增 `src/types/api/pollingPriorityQueue.ts`:优先轮询项 `PollingPriorityItem`(`id` / `card_id` / `iccid` / `task_type` / `task_type_name` / `status` / `status_name` / `trigger_type` / `trigger_type_name` / `trigger_types` / `trigger_count` / `attempt_count` / `result` / `result_name` / `failure_reason` / `shop_id_snapshot` / `source_order_id` / `source_package_usage_id` / `manual_operator_id` / `manual_operator_name` / `manual_reason` / `claimed_at` / `last_triggered_at` / `created_at` / `updated_at`) -- [ ] 1.2 查询参数、分页响应 `PollingPriorityItemPageResult`、人工入队请求/响应、入队项 `PriorityItemResult` 类型 -- [ ] 1.3 `src/types/api/index.ts` 导出新类型 +- [x] 1.1 新增 `src/types/api/pollingPriorityQueue.ts`:优先轮询项 `PollingPriorityItem`(`id` / `card_id` / `iccid` / `task_type` / `task_type_name` / `status` / `status_name` / `trigger_type` / `trigger_type_name` / `trigger_types` / `trigger_count` / `attempt_count` / `result` / `result_name` / `failure_reason` / `shop_id_snapshot` / `source_order_id` / `source_package_usage_id` / `manual_operator_id` / `manual_operator_name` / `manual_reason` / `claimed_at` / `last_triggered_at` / `created_at` / `updated_at`) +- [x] 1.2 查询参数、分页响应 `PollingPriorityItemPageResult`、人工入队请求/响应、入队项 `PriorityItemResult` 类型 +- [x] 1.3 `src/types/api/index.ts` 导出新类型 ## 2. API -- [ ] 2.1 新增 `src/api/modules/pollingPriorityQueue.ts`: +- [x] 2.1 新增 `src/api/modules/pollingPriorityQueue.ts`: - `getPriorityItems`:`GET /api/admin/polling-priority-items`,分页查询卡轮询优先项,按创建时间倒序,支持卡 `card_id`、任务类型 `task_type`、状态 `status`、触发类型 `trigger_type` 筛选 - `createPriorityItems`:`POST /api/admin/polling-priority-items`,人工优先入队,请求 `{ card_id, reason }` - `getPriorityItemDetail`:`GET /api/admin/polling-priority-items/{id}`,查询单项详情 -- [ ] 2.2 `src/api/modules/index.ts` 导出新服务 +- [x] 2.2 `src/api/modules/index.ts` 导出新服务 ## 3. 页面 -- [ ] 3.1 `src/router/routesAlias.ts` 新增优先队列路由别名,`src/router/routes/asyncRoutes.ts` 在轮询管理下注册路由与菜单 -- [ ] 3.2 新增 `src/views/polling-management/priority-queue/index.vue`:筛选(卡/任务类型/状态/触发类型)、分页、表格展示列表项字段 -- [ ] 3.3 实现任务类型、状态、触发类型、执行结果枚举映射与中文展示 -- [ ] 3.4 实现人工优先入队弹窗:选择卡、原因必填校验(最长 500 字符),提交后展示 created_count / merged_count / items -- [ ] 3.5 实现单项详情查看(页面或抽屉),越权与不存在按同一错误处理 +- [x] 3.1 `src/router/routesAlias.ts` 新增优先队列路由别名,`src/router/routes/asyncRoutes.ts` 在轮询管理下注册路由与菜单 +- [x] 3.2 新增 `src/views/polling-management/priority-queue/index.vue`:筛选(卡/任务类型/状态/触发类型)、分页、表格展示列表项字段 +- [x] 3.3 实现任务类型、状态、触发类型、执行结果枚举映射与中文展示 +- [x] 3.4 实现人工优先入队弹窗:选择卡、原因必填校验(最长 500 字符),提交后展示 created_count / merged_count / items +- [x] 3.5 实现单项详情查看(页面或抽屉),越权与不存在按同一错误处理 ## 4. 常量与文案 -- [ ] 4.1 在 `src/config/constants/augustIteration.ts`(或新增常量文件)登记任务类型/状态/触发类型/结果枚举与中文名称 -- [ ] 4.2 `src/locales/langs/zh.json`、`src/locales/langs/en.json` 补充菜单与页面文案 +- [x] 4.1 在 `src/config/constants/pollingPriorityQueue.ts` 登记任务类型/状态/触发类型/结果枚举与中文名称 +- [x] 4.2 菜单与页面文案(与轮询管理其余页面一致使用中文文案,菜单标题「优先队列」) ## 5. Verification -- [ ] 5.1 验证筛选与分页参数正确传递、列表按创建时间倒序 -- [ ] 5.2 验证人工入队成功/合并/原因校验(空与超长) -- [ ] 5.3 验证详情接口与越权/不存在不区分 -- [ ] 5.4 运行 lint、类型检查与构建 +- [x] 5.1 验证筛选与分页参数正确传递、列表按创建时间倒序 +- [x] 5.2 验证人工入队成功/合并/原因校验(空与超长) +- [x] 5.3 验证详情接口与越权/不存在不区分 +- [x] 5.4 运行 lint、类型检查与构建 diff --git a/openspec/changes/update-agent-registration-and-voucher-recognition/design.md b/openspec/changes/update-agent-registration-and-voucher-recognition/design.md new file mode 100644 index 0000000..4cc20da --- /dev/null +++ b/openspec/changes/update-agent-registration-and-voucher-recognition/design.md @@ -0,0 +1,31 @@ +## Context + +- 仓库当前没有归档的 `openspec/specs/`,既有变更统一使用 `## ADDED Requirements` 的 delta,本次沿用。 +- OCR 能力由 `POST /api/admin/agent-recharges/payment-voucher-ocr` 提供,语义为「凭证图片对象键 → `external_transaction_no` 预填」,员工代收款核销申请直接复用,不新增后端接口。 +- 注册接口 `POST /api/c/v1/agent-distribution-registrations` 契约中的 `shop_code` 仍为必填,改为前端生成后提交。 + +## Goals / Non-Goals + +- Goals: 注册者自主填写店铺信息、店铺编号自动生成、用户名长度校验、免登录页不被存储检查登出、H5 可滚动;两处付款凭证支持上传后自动识别并保留手动识别。 +- Non-Goals: 不新增或修改后端接口契约;不做店铺编号前端唯一性保证(由后端唯一性校验兜底);不改变 OCR 结果只预填交易流水号的约束。 + +## Decisions + +- Decision: 店铺编号生成规则为 `S` + `yyyyMMddHHmmss` + 3 位随机数,长度不超过后端字段上限(50)。 + - Rationale: 时间戳 + 随机数在客户端生成后碰撞概率低,且保持可读性;唯一性最终由后端校验。 +- Decision: 核销申请复用代理充值的 OCR 接口 `POST /api/admin/agent-recharges/payment-voucher-ocr`。 + - Rationale: 该接口本质是通用凭证识别,仅返回交易流水号;避免为同一能力重复定义接口。 +- Decision: 自动识别以「凭证上传成功」为触发点,取首个已上传凭证对象键,并用 `ocrLoading` 防重复触发;手动按钮逻辑不变。 + - Rationale: 首个凭证即用户主凭证,与手动识别取键规则一致,避免自动/手动结果不一致。 +- Decision: 存储兼容性检查在免登录路由上直接跳过,不执行登出。 + - Rationale: 全新浏览器无任何本地存储时,`validateStorageData()` 会判定需要重新登录并跳转登录页,破坏免登录页。 + +## Risks / Trade-offs + +- 前端生成店铺编号可能撞号 → 采用时间戳 + 随机,后端唯一性校验兜底。 +- 复用 `agent-recharges` 路径的 OCR 接口语义略有偏差 → 接口本身为通用凭证识别,后续若后端提供独立接口可平滑替换。 +- 上传后自动识别会多一次网络请求 → 仅上传成功时触发一次,识别期间 loading 且禁止重复触发。 + +## Open Questions + +- 无。 diff --git a/openspec/changes/update-agent-registration-and-voucher-recognition/proposal.md b/openspec/changes/update-agent-registration-and-voucher-recognition/proposal.md new file mode 100644 index 0000000..e805ba6 --- /dev/null +++ b/openspec/changes/update-agent-registration-and-voucher-recognition/proposal.md @@ -0,0 +1,26 @@ +# Change: 代理注册表单调整与付款凭证上传后自动识别 + +## Why + +代理扫码注册页当前把上级店铺的店铺名称与店铺编号从二维码 URL 带入并锁定,注册者无法填写自己的店铺信息;用户名缺少最小长度校验;未登录访问注册页时会被本地存储兼容性检查强制登出并跳转登录页;H5 下页面无法纵向滚动,超出内容不可见。同时,线下代充与员工代收款核销申请虽已支持人工识别付款凭证,但需要上传后再手动点击,且核销申请弹窗尚未提供该能力。 + +## What Changes + +- 代理扫码注册页:店铺名称改为注册者自行填写;店铺编号由前端生成后随注册请求提交,二维码 URL 不再携带 `shop_name` / `shop_code`。 +- 代理扫码注册页:用户名校验长度必须大于 2 个字符。 +- 修复未登录访问代理注册页被跳转登录页的问题(存储兼容性检查不得对免登录页执行登出)。 +- 修复代理注册页 H5 内容超出视口后无法纵向滚动的问题。 +- 员工代收款「创建核销申请」弹窗:新增付款凭证「识别凭证」能力,并把付款凭证字段移动到外部交易流水号上方。 +- 线下代充与核销申请:付款凭证上传成功后自动识别一次交易流水号,同时保留手动「识别凭证」按钮。 + +## Impact + +- Affected specs: `agent-distribution-registration`、`employee-collection`、`agent-recharge` +- Affected code: + - `src/views/agent-registration/index.vue` + - `src/views/shop-management/detail/index.vue` + - `src/utils/storage/storage.ts` + - `src/assets/styles/app.scss` + - `src/views/finance/employee-collection/applications/components/ApplicationFormDialog.vue` + - `src/views/finance/agent-recharge/index.vue` + - `src/components/business/VoucherUpload.vue`(如需新增上传成功事件) diff --git a/openspec/changes/update-agent-registration-and-voucher-recognition/specs/agent-distribution-registration/spec.md b/openspec/changes/update-agent-registration-and-voucher-recognition/specs/agent-distribution-registration/spec.md new file mode 100644 index 0000000..6c866f8 --- /dev/null +++ b/openspec/changes/update-agent-registration-and-voucher-recognition/specs/agent-distribution-registration/spec.md @@ -0,0 +1,38 @@ +## ADDED Requirements + +### Requirement: 代理注册店铺信息填写与店铺编号生成 + +代理注册页 SHALL 由注册者自行填写店铺名称;店铺编号 SHALL 由前端生成并随注册请求提交为 `shop_code`;注册页 MUST NOT 从二维码 URL 带入或锁定店铺名称与店铺编号。 + +#### Scenario: 扫码进入注册页 + +- **GIVEN** 用户通过店铺分销二维码进入注册页,URL 携带 `distribution_code` +- **WHEN** 页面初始化 +- **THEN** 店铺名称输入框 MUST 为空且可编辑 +- **AND** 店铺编号 MUST NOT 由 URL 预填或锁定 +- **AND** 分销码 MUST 由 URL 带入并锁定 + +#### Scenario: 提交注册生成店铺编号 + +- **GIVEN** 注册者已填写店铺名称与其他必填项 +- **WHEN** 其提交注册 +- **THEN** 请求体 MUST 携带前端生成的 `shop_code` +- **AND** `shop_code` MUST 非空 +- **AND** MUST NOT 因店铺编号为空阻止提交 + +#### Scenario: 店铺名称必填 + +- **GIVEN** 注册者未填写店铺名称 +- **WHEN** 其提交注册 +- **THEN** 前端 MUST 阻止提交并提示填写店铺名称 + +### Requirement: 代理注册用户名长度校验 + +代理注册页用户名 SHALL 至少包含 3 个字符;不满足时前端 MUST 阻止提交并提示。 + +#### Scenario: 用户名长度不足 + +- **GIVEN** 注册者输入的用户名长度为 1 或 2 +- **WHEN** 其提交注册 +- **THEN** 前端 MUST 阻止提交 +- **AND** MUST 提示用户名长度必须大于 2 个字符 diff --git a/openspec/changes/update-agent-registration-and-voucher-recognition/specs/agent-recharge/spec.md b/openspec/changes/update-agent-registration-and-voucher-recognition/specs/agent-recharge/spec.md new file mode 100644 index 0000000..ff06c5a --- /dev/null +++ b/openspec/changes/update-agent-registration-and-voucher-recognition/specs/agent-recharge/spec.md @@ -0,0 +1,26 @@ +## ADDED Requirements + +### Requirement: 线下代充付款凭证上传后自动识别 + +线下代充弹窗 SHALL 在支付凭证上传成功后自动识别一次交易流水号,同时保留手动「识别凭证」按钮;自动识别失败 MUST NOT 阻断提交,且 MUST 只预填 `external_transaction_no`。 + +#### Scenario: 上传支付凭证后自动识别 + +- **GIVEN** 线下代充弹窗已选择支付凭证 +- **WHEN** 凭证上传成功 +- **THEN** 前端 MUST 自动调用 `POST /api/admin/agent-recharges/payment-voucher-ocr` +- **AND** 识别成功时 MUST 将返回的 `external_transaction_no` 预填入交易流水号输入框 + +#### Scenario: 保留手动识别 + +- **GIVEN** 支付凭证已上传 +- **WHEN** 用户点击「识别凭证」 +- **THEN** 前端 MUST 支持手动触发识别 + +#### Scenario: 自动识别失败不阻断 + +- **GIVEN** 自动识别返回失败或超时 +- **WHEN** 识别结束 +- **THEN** 前端 MUST NOT 阻断用户手动填写与提交 +- **AND** MUST NOT 清空用户已填写内容 +- **AND** MUST 只预填 `external_transaction_no`,不得预填金额、付款人、付款时间或备注 diff --git a/openspec/changes/update-agent-registration-and-voucher-recognition/specs/employee-collection/spec.md b/openspec/changes/update-agent-registration-and-voucher-recognition/specs/employee-collection/spec.md new file mode 100644 index 0000000..06c2fe9 --- /dev/null +++ b/openspec/changes/update-agent-registration-and-voucher-recognition/specs/employee-collection/spec.md @@ -0,0 +1,44 @@ +## ADDED Requirements + +### Requirement: 核销申请付款凭证识别 + +创建核销申请弹窗 SHALL 将付款凭证字段置于外部交易流水号字段上方,并 SHALL 支持上传付款凭证后自动识别交易流水号预填,同时保留手动「识别凭证」按钮;识别结果 MUST 只作预填且保持可编辑,识别失败 MUST NOT 阻断提交或清空已填内容。 + +#### Scenario: 上传凭证后自动识别 + +- **GIVEN** 用户在创建核销申请弹窗上传付款凭证 +- **WHEN** 凭证上传成功 +- **THEN** 前端 MUST 自动调用付款凭证识别接口 +- **AND** 识别成功时 MUST 将返回的 `external_transaction_no` 预填入交易流水号输入框 + +#### Scenario: 手动识别 + +- **GIVEN** 付款凭证已上传 +- **WHEN** 用户点击「识别凭证」 +- **THEN** 前端 MUST 调用识别接口并预填交易流水号 + +#### Scenario: 识别失败不阻断 + +- **GIVEN** 识别接口返回失败或超时 +- **WHEN** 自动或手动识别结束 +- **THEN** 前端 MUST 只展示提示 +- **AND** MUST NOT 清空已填写的交易流水号 +- **AND** MUST NOT 阻止用户提交 + +#### Scenario: 字段顺序 + +- **GIVEN** 用户打开创建核销申请弹窗 +- **WHEN** 表单渲染 +- **THEN** 付款凭证字段 MUST 位于外部交易流水号字段之上 + +### Requirement: 核销申请凭证识别接口契约 + +核销申请付款凭证识别 SHALL 复用 `POST /api/admin/agent-recharges/payment-voucher-ocr`,请求体 `{ payment_voucher_key }`,响应取 `external_transaction_no`;请求超时 MUST NOT 低于 30 秒,请求期间 MUST 展示 loading 并防止重复触发。 + +#### Scenario: 识别请求契约 + +- **GIVEN** 已上传至少 1 个付款凭证 +- **WHEN** 前端发起识别 +- **THEN** 请求体 MUST 为 `{ payment_voucher_key }`,取首个已上传凭证对象键 +- **AND** 响应 MUST 只用于预填 `external_transaction_no` +- **AND** 请求超时 MUST NOT 低于 30 秒 diff --git a/openspec/changes/update-agent-registration-and-voucher-recognition/tasks.md b/openspec/changes/update-agent-registration-and-voucher-recognition/tasks.md new file mode 100644 index 0000000..274dd0b --- /dev/null +++ b/openspec/changes/update-agent-registration-and-voucher-recognition/tasks.md @@ -0,0 +1,27 @@ +## 1. 代理注册页表单调整 + +- [x] 1.1 店铺名称改为注册者自行填写,移除从 URL 带入与锁定逻辑(`src/views/agent-registration/index.vue`) +- [x] 1.2 店铺编号由前端生成后提交为 `shop_code`,移除 URL 带入、锁定与输入框 +- [x] 1.3 用户名增加「长度必须大于 2 个字符」校验规则与提示 +- [x] 1.4 店铺详情页注册二维码 URL 移除 `shop_name`、`shop_code` 查询参数(`src/views/shop-management/detail/index.vue`) + +## 2. 代理注册页缺陷修复 + +- [x] 2.1 修复未登录访问注册页被跳转登录页:存储兼容性检查排除免登录路由(`src/utils/storage/storage.ts`) +- [x] 2.2 修复 H5 页面溢出后无法纵向滚动(`src/views/agent-registration/index.vue` / `src/assets/styles/app.scss`) + +## 3. 核销申请付款凭证识别 + +- [x] 3.1 将付款凭证字段移动到外部交易流水号字段上方(`ApplicationFormDialog.vue`) +- [x] 3.2 新增付款凭证「识别凭证」按钮与 OCR 调用,复用 `POST /api/admin/agent-recharges/payment-voucher-ocr` +- [x] 3.3 付款凭证上传成功后自动识别一次,保留手动识别 +- [x] 3.4 识别期间展示 loading,失败只提示且不清空已填内容、不阻断提交 + +## 4. 线下代充上传后自动识别 + +- [x] 4.1 支付凭证上传成功后自动触发一次识别,保留手动「识别凭证」按钮(`src/views/finance/agent-recharge/index.vue`) + +## 5. 验证 + +- [x] 5.1 运行 `eslint`、`vue-tsc --noEmit`、`vite build --mode production` 均通过 +- [x] 5.2 运行 `openspec validate update-agent-registration-and-voucher-recognition --strict` 通过 diff --git a/src/api/modules/assetWallet.ts b/src/api/modules/assetWallet.ts index 88a5ae9..11d3b8f 100644 --- a/src/api/modules/assetWallet.ts +++ b/src/api/modules/assetWallet.ts @@ -22,6 +22,9 @@ export class AssetWalletService extends BaseService { static saveAutoRenewalConfig( data: UpdateAssetAutoRenewalConfigRequest ): Promise> { - return this.put>('/api/admin/asset-auto-renewal-config', data) + return this.put>( + '/api/admin/asset-auto-renewal-config', + data + ) } } diff --git a/src/config/constants/pollingPriorityQueue.ts b/src/config/constants/pollingPriorityQueue.ts index 19a4709..e83c88d 100644 --- a/src/config/constants/pollingPriorityQueue.ts +++ b/src/config/constants/pollingPriorityQueue.ts @@ -38,9 +38,7 @@ export const POLLING_PRIORITY_STATUS_OPTIONS: Array<{ { label: '失败', value: 'failed' } ] -export const getPollingPriorityStatusName = ( - status?: PollingPriorityItemStatus | string | null -) => +export const getPollingPriorityStatusName = (status?: PollingPriorityItemStatus | string | null) => POLLING_PRIORITY_STATUS_OPTIONS.find((item) => item.value === status)?.label || String(status || '-') diff --git a/src/utils/storage/storage.ts b/src/utils/storage/storage.ts index 6b91467..693cbc1 100644 --- a/src/utils/storage/storage.ts +++ b/src/utils/storage/storage.ts @@ -104,12 +104,35 @@ class StorageCompatibilityManager { return location.href.includes(RoutesAlias.Login) } + /** + * 检查当前是否处于免登录页面 + */ + private isOnPublicPage(): boolean { + if (this.isOnLoginPage()) return true + + const route = router.currentRoute.value + if (route?.meta?.noLogin) return true + + // 兜底:初始导航可能尚未完成,按地址判断免登录路由 + const hashPath = location.hash.replace(/^#/, '').split('?')[0] + const pathName = location.pathname.split('?')[0] + return router.getRoutes().some((record) => { + if (!record.meta?.noLogin) return false + return ( + hashPath === record.path || + hashPath.startsWith(`${record.path}/`) || + pathName === record.path || + pathName.startsWith(`${record.path}/`) + ) + }) + } + /** * 验证存储数据完整性 */ validateStorageData(): boolean { - // 如果在登录页面,跳过验证 - if (this.isOnLoginPage()) { + // 如果在登录页或免登录页,跳过验证 + if (this.isOnPublicPage()) { return true } diff --git a/src/views/agent-registration/index.vue b/src/views/agent-registration/index.vue index cc4016b..9018350 100644 --- a/src/views/agent-registration/index.vue +++ b/src/views/agent-registration/index.vue @@ -64,27 +64,21 @@ - + - - - -
@@ -102,7 +96,12 @@
- + \ No newline at end of file + diff --git a/src/views/commission-management/my-commission/index.vue b/src/views/commission-management/my-commission/index.vue index 7f72f76..67f31b9 100644 --- a/src/views/commission-management/my-commission/index.vue +++ b/src/views/commission-management/my-commission/index.vue @@ -1374,7 +1374,7 @@ { prop: 'status_name', label: '状态', - width: 100, + width: 120, formatter: (row: WithdrawalQualificationItem) => { const tagType = row.status === 0 ? 'warning' : row.status === 1 ? 'success' : 'danger' return h(ElTag, { type: tagType }, () => row.status_name || String(row.status)) @@ -1389,7 +1389,8 @@ { prop: 'attachments', label: '附件', - minWidth: 200, + minWidth: 240, + showOverflowTooltip: true, formatter: (row: WithdrawalQualificationItem) => qualificationAttachmentLabels(row) }, { diff --git a/src/views/finance/agent-recharge/index.vue b/src/views/finance/agent-recharge/index.vue index 4002b82..b3cda8c 100644 --- a/src/views/finance/agent-recharge/index.vue +++ b/src/views/finance/agent-recharge/index.vue @@ -124,7 +124,7 @@ accept="image/*" content-type="image/jpeg" @uploading-change="voucherUploading = $event" - @change="createFormRef?.validateField('payment_voucher_key')" + @change="handleVoucherChange" />
toVoucherKeyList(createForm.payment_voucher_key)) + // 凭证变更:校验字段,并对首次上传自动识别一次(已有流水号则跳过) + const handleVoucherChange = (keys: string[] | string) => { + createFormRef.value?.validateField('payment_voucher_key') + const list = toVoucherKeyList(keys) + const firstKey = list[0] || '' + if (!firstKey) { + recognizedVoucherKey.value = '' + return + } + if (firstKey === recognizedVoucherKey.value) return + recognizedVoucherKey.value = firstKey + if (createForm.external_transaction_no?.trim()) return + void handleRecognizeVoucher() + } + // 识别付款凭证中的交易流水号:只做预填,失败不阻断人工填写 const handleRecognizeVoucher = async () => { if (ocrLoading.value) return diff --git a/src/views/finance/employee-collection/applications/components/ApplicationFormDialog.vue b/src/views/finance/employee-collection/applications/components/ApplicationFormDialog.vue index 74027ce..f74fece 100644 --- a/src/views/finance/employee-collection/applications/components/ApplicationFormDialog.vue +++ b/src/views/finance/employee-collection/applications/components/ApplicationFormDialog.vue @@ -97,15 +97,6 @@ /> - - - - + +
+ + + 识别凭证 + +
+
识别结果仅供参考,请对照凭证核对后再提交。
+
+ ([]) const candidateBills = ref([]) const selectedBillIds = ref([]) @@ -230,6 +243,7 @@ const dialogTitle = computed(() => (isResubmit.value ? '修改并重新提交核销申请' : '创建核销申请')) const enabledPaymentMethods = computed(() => paymentMethods.value.filter((item) => item.enabled)) const enabledPaymentMethodCount = computed(() => enabledPaymentMethods.value.length) + const voucherKeys = computed(() => toVoucherKeyList(form.payment_voucher_keys)) const paidAmountFen = computed(() => yuanToFen(form.paid_amount) || 0) const totalAmountFen = computed(() => @@ -376,6 +390,7 @@ form.acting_reason = '' selectedBillIds.value = [] Object.keys(amountMap).forEach((key) => delete amountMap[Number(key)]) + recognizedVoucherKey.value = '' uploadRef.value?.clearFiles() } @@ -457,6 +472,58 @@ return payload } + const recognizeVoucher = async (keysOverride?: string[]): Promise => { + if (ocrLoading.value) return + + const keys = keysOverride?.length ? keysOverride : voucherKeys.value + if (!keys.length) { + ElMessage.warning('请先上传付款凭证') + return + } + + ocrLoading.value = true + try { + const res = await AgentRechargeService.recognizePaymentVoucher({ + payment_voucher_key: keys[0] + }) + if (res.code !== 0) { + ElMessage.warning(res.msg || '识别失败,请手动填写交易流水号') + return + } + const transactionNo = res.data?.external_transaction_no + if (!transactionNo) { + ElMessage.warning('未识别到交易流水号,请手动填写') + return + } + form.external_transaction_no = transactionNo + formRef.value?.validateField('external_transaction_no') + ElMessage.success('已识别交易流水号,请对照凭证核对') + } catch (error) { + console.error('识别付款凭证失败:', error) + ElMessage.warning('识别失败,请手动填写交易流水号') + } finally { + ocrLoading.value = false + } + } + + const handleRecognizeVoucher = () => { + void recognizeVoucher() + } + + const handleVoucherChange = (keys: string[] | string) => { + formRef.value?.validateField('payment_voucher_keys') + const list = toVoucherKeyList(keys) + const firstKey = list[0] || '' + if (!firstKey) { + recognizedVoucherKey.value = '' + return + } + if (firstKey === recognizedVoucherKey.value) return + recognizedVoucherKey.value = firstKey + if (form.external_transaction_no.trim()) return + void recognizeVoucher(list) + } + const handleSubmit = async () => { if (!formRef.value) return await formRef.value.validate() @@ -571,4 +638,17 @@ gap: 12px; justify-content: flex-end; } + + .external-transaction-row { + display: flex; + gap: 8px; + width: 100%; + } + + .external-transaction-tip { + margin-top: 4px; + font-size: 12px; + line-height: 18px; + color: var(--el-text-color-secondary); + } diff --git a/src/views/finance/refund/index.vue b/src/views/finance/refund/index.vue index e3f5efd..aa98429 100644 --- a/src/views/finance/refund/index.vue +++ b/src/views/finance/refund/index.vue @@ -537,7 +537,7 @@ { prop: 'method', label: '退款方式', - width: 130, + width: 160, formatter: (row: Refund) => row.method_name || '-' }, { diff --git a/src/views/polling-management/priority-queue/index.vue b/src/views/polling-management/priority-queue/index.vue index 5b0b462..77f6214 100644 --- a/src/views/polling-management/priority-queue/index.vue +++ b/src/views/polling-management/priority-queue/index.vue @@ -48,10 +48,10 @@ - +
- 新建 {{ createResult?.created_count ?? 0 }} 条 - 合并 {{ createResult?.merged_count ?? 0 }} 条 + 新建 {{ createResult?.created_count ?? 0 }} 条 + 合并 {{ createResult?.merged_count ?? 0 }} 条 任务类型:{{ (createResult?.task_type_names || []).join('、') || '-' }} @@ -116,45 +120,49 @@ >
- {{ detailData.id }} - {{ detailData.iccid }} - - {{ detailData.task_type_name }} - - - {{ - detailData.status_name - }} - - - {{ detailData.trigger_type_name }} - - {{ detailData.trigger_count }} - {{ detailData.attempt_count }} - - {{ detailData.result_name }} - - - {{ detailData.failure_reason || '-' }} - - - {{ detailData.manual_operator_name || '-' }} - - - {{ detailData.manual_reason || '-' }} - - - {{ formatDateTime(detailData.claimed_at) }} - - - {{ formatDateTime(detailData.last_triggered_at) }} - - - {{ formatDateTime(detailData.created_at) }} - - - {{ formatDateTime(detailData.updated_at) }} - + {{ detailData.id }} + {{ detailData.iccid }} + + {{ detailData.task_type_name }} + + + {{ + detailData.status_name + }} + + + {{ detailData.trigger_type_name }} + + {{ + detailData.trigger_count + }} + {{ + detailData.attempt_count + }} + + {{ detailData.result_name }} + + + {{ detailData.failure_reason || '-' }} + + + {{ detailData.manual_operator_name || '-' }} + + + {{ detailData.manual_reason || '-' }} + + + {{ formatDateTime(detailData.claimed_at) }} + + + {{ formatDateTime(detailData.last_triggered_at) }} + + + {{ formatDateTime(detailData.created_at) }} + + + {{ formatDateTime(detailData.updated_at) }} +
@@ -295,10 +303,8 @@ label: '执行结果', width: 110, formatter: (row: PollingPriorityItem) => - h( - ElTag, - { type: getResultTagType(row.result) }, - () => getPollingPriorityResultName(row.result) + h(ElTag, { type: getResultTagType(row.result) }, () => + getPollingPriorityResultName(row.result) ) }, { diff --git a/src/views/settings/asset-wallet-auto-renewal/index.vue b/src/views/settings/asset-wallet-auto-renewal/index.vue index 11bd379..0291022 100644 --- a/src/views/settings/asset-wallet-auto-renewal/index.vue +++ b/src/views/settings/asset-wallet-auto-renewal/index.vue @@ -34,11 +34,7 @@ - +
+ 总开关:{{ config?.enabled_name || '-' }} + 适用范围:{{ config?.scope_name || '-' }} 配置版本:v{{ config?.config_version ?? '-' }} 最近保存:{{ config?.updater || '-' }} {{ config?.updated_at ? formatDateTime(config.updated_at) : '-' }} diff --git a/src/views/shop-management/detail/index.vue b/src/views/shop-management/detail/index.vue index fd8986a..8247e52 100644 --- a/src/views/shop-management/detail/index.vue +++ b/src/views/shop-management/detail/index.vue @@ -89,7 +89,7 @@ const code = shopData?.distribution_code if (!shopData || !code) return '' const base = `${window.location.origin}${window.location.pathname}` - return `${base}#/agent-registration?distribution_code=${encodeURIComponent(code)}&shop_name=${encodeURIComponent(shopData.shop_name)}&shop_code=${encodeURIComponent(shopData.shop_code)}` + return `${base}#/agent-registration?distribution_code=${encodeURIComponent(code)}` }) const formatBusinessOwner = (value: ShopResponse) => {