Commit 6930beeb by wangzhihui

Merge branch 'SAAS+V5.8.4' of http://192.168.3.233:8090/saas_plus/dj-car-life-sy…

…stem into feature/584/wzh
2 parents d6ad5366 e36c0edb
Showing 55 changed files with 1657 additions and 305 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 再打开:正常全新加载
...@@ -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",
......
...@@ -66,12 +66,12 @@ ...@@ -66,12 +66,12 @@
" "
:src="require('@/assets/icon-edit2.png')" :src="require('@/assets/icon-edit2.png')"
@click="handleHeaderBatch(item)" /> @click="handleHeaderBatch(item)" />
<el-popover v-if="item.isPopConfig" <el-tooltip v-if="item.isPopConfig"
effect="dark"
placement="top-start" placement="top-start"
trigger="hover" :content="item.isPopConfig.text"
width="200" :open-delay="200"
:content="item.isPopConfig.text"> :popper-class="item.isPopConfig.popperClass || 'd2-table__header-tooltip'">
<template #reference>
<img style=" <img style="
cursor: pointer; cursor: pointer;
margin-left: 5px; margin-left: 5px;
...@@ -79,10 +79,8 @@ ...@@ -79,10 +79,8 @@
height: 13.33px; height: 13.33px;
vertical-align: middle; vertical-align: middle;
" "
:src="require('@/assets/mark.png')" /> :src="require('@/assets/mark.png')" />
</template> </el-tooltip>
</el-popover>
</template> </template>
<template v-for="(sub, sIndex) in item.children"> <template v-for="(sub, sIndex) in item.children">
<el-table-column :key="`sub-${index}-${sIndex}`" <el-table-column :key="`sub-${index}-${sIndex}`"
...@@ -206,12 +204,12 @@ ...@@ -206,12 +204,12 @@
vertical-align: middle;" vertical-align: middle;"
:src="require('@/assets/icon-edit2.png')" :src="require('@/assets/icon-edit2.png')"
@click="handleHeaderBatch(item)" /> @click="handleHeaderBatch(item)" />
<el-popover v-if="item.isPopConfig" <el-tooltip v-if="item.isPopConfig"
effect="dark"
placement="top-start" placement="top-start"
trigger="hover" :content="item.isPopConfig.text"
width="200" :open-delay="200"
:content="item.isPopConfig.text"> :popper-class="item.isPopConfig.popperClass || 'd2-table__header-tooltip'">
<template #reference>
<img style=" <img style="
cursor: pointer; cursor: pointer;
margin-left: 5px; margin-left: 5px;
...@@ -219,10 +217,8 @@ ...@@ -219,10 +217,8 @@
height: 13.33px; height: 13.33px;
vertical-align: middle; vertical-align: middle;
" "
:src="require('@/assets/mark.png')" /> :src="require('@/assets/mark.png')" />
</template> </el-tooltip>
</el-popover>
</template> </template>
<template #default="scope"> <template #default="scope">
<slot v-if="item.addHtml" <slot v-if="item.addHtml"
...@@ -869,4 +865,10 @@ export default { ...@@ -869,4 +865,10 @@ export default {
margin-bottom: 8px; margin-bottom: 8px;
} }
} }
.d2-table__header-tooltip {
max-width: 320px;
line-height: 20px;
white-space: normal;
}
</style> </style>
...@@ -19,7 +19,7 @@ export const routerName = { ...@@ -19,7 +19,7 @@ export const routerName = {
title: "订单列表", title: "订单列表",
authId: "90401", authId: "90401",
parentId: "904", parentId: "904",
cache: false cache: true
}, },
auth: [ auth: [
// 精品升级 // 精品升级
......
...@@ -72,7 +72,8 @@ ...@@ -72,7 +72,8 @@
placeholder="请选择延期截止时间" placeholder="请选择延期截止时间"
style="width: 100%" style="width: 100%"
type="date" type="date"
value-format="yyyy-MM-dd"> value-format="yyyy-MM-dd"
:picker-options="extensionDeadlinePickerOptions">
</el-date-picker> </el-date-picker>
<div class="form-tip"> <div class="form-tip">
根据异常类型默认延期3天,可修改 根据异常类型默认延期3天,可修改
...@@ -108,9 +109,9 @@ import { ...@@ -108,9 +109,9 @@ import {
approvePcAbnormalFlowDeclaration, approvePcAbnormalFlowDeclaration,
getPcAbnormalFlowDeclarationDetail, getPcAbnormalFlowDeclarationDetail,
} from "@/api/finance"; } from "@/api/finance";
import { afterRangePickerOptions } from "@/components/glsx-combi-form/common";
import { import {
getAbnormalTypeLabel, getAbnormalTypeLabel,
getApprovalStatusMeta,
getDefaultExtensionDate, getDefaultExtensionDate,
getDrawerMode, getDrawerMode,
mapApproveFormToApi, mapApproveFormToApi,
...@@ -171,6 +172,7 @@ export default { ...@@ -171,6 +172,7 @@ export default {
loading: false, loading: false,
submitting: false, submitting: false,
detailInfo: null, detailInfo: null,
extensionDeadlinePickerOptions: afterRangePickerOptions,
validateRemark, validateRemark,
validateExtension, validateExtension,
approveForm: { approveForm: {
...@@ -237,8 +239,8 @@ export default { ...@@ -237,8 +239,8 @@ export default {
key: "firstRoundStatusLabel", key: "firstRoundStatusLabel",
col: 12, col: 12,
className: (info) => { className: (info) => {
const meta = getApprovalStatusMeta(info.firstRoundStatusLabel); const meta = info.firstRoundStatusMeta;
return STATUS_COLOR_MAP[meta.spotClass] || STATUS_COLOR_MAP.ashSpot; return STATUS_COLOR_MAP[meta?.spotClass] || STATUS_COLOR_MAP.ashSpot;
}, },
}, },
{ title: "审批人", key: "firstRoundApprover", col: 12 }, { title: "审批人", key: "firstRoundApprover", col: 12 },
...@@ -255,8 +257,8 @@ export default { ...@@ -255,8 +257,8 @@ export default {
key: "secondRoundStatusLabel", key: "secondRoundStatusLabel",
col: 12, col: 12,
className: (info) => { className: (info) => {
const meta = getApprovalStatusMeta(info.secondRoundStatusLabel); const meta = info.secondRoundStatusMeta;
return STATUS_COLOR_MAP[meta.spotClass] || STATUS_COLOR_MAP.ashSpot; return STATUS_COLOR_MAP[meta?.spotClass] || STATUS_COLOR_MAP.ashSpot;
}, },
}, },
{ title: "审批人", key: "secondRoundApprover", col: 12 }, { title: "审批人", key: "secondRoundApprover", col: 12 },
......
/** 异常流水审批状态(Swagger AbnormalFlowApprovalStatus 1~5) */ /** 异常流水审批状态(Swagger AbnormalFlowApprovalStatus 1~5) */
import { Util } from "@/common/util"
function formatDate(val) {
return val ? Util.dateFormate(val, "YYYY-MM-DD HH:mm:ss") : "-"
}
function formatDelayDeadline(val) {
if (!val) {
return "-";
}
const str = String(val).trim();
const dateMatch = str.match(/^(\d{4}-\d{2}-\d{2})/);
if (dateMatch) {
return dateMatch[1];
}
return Util.dateFormate(val, "YYYY-MM-DD");
}
export const APPROVAL_STATUS = { export const APPROVAL_STATUS = {
WAIT_REGIONAL: 1, WAIT_REGIONAL: 1,
REGIONAL_REJECTED: 2, REGIONAL_REJECTED: 2,
...@@ -34,12 +52,44 @@ export const APPROVAL_STATUS_LIST = [ ...@@ -34,12 +52,44 @@ export const APPROVAL_STATUS_LIST = [
}, },
{ {
value: APPROVAL_STATUS.APPROVED, value: APPROVAL_STATUS.APPROVED,
label: "审批通过", label: "后台审批通过",
tagType: "success", tagType: "success",
spotClass: "greenSpot" spotClass: "greenSpot"
} }
] ]
/** 审批日志状态(同数值在不同 approvalSource 下含义不同) */
export const APPROVAL_LOG_STATUS_LIST = [
{
value: APPROVAL_STATUS.REGIONAL_REJECTED,
approvalSource: 0,
label: "区域经理审批驳回",
tagType: "danger",
spotClass: "redSpot",
},
{
value: APPROVAL_STATUS.WAIT_BACKEND,
approvalSource: 0,
label: "区域经理审批通过",
tagType: "success",
spotClass: "greenSpot",
},
{
value: APPROVAL_STATUS.BACKEND_REJECTED,
approvalSource: 1,
label: "后台审批驳回",
tagType: "danger",
spotClass: "redSpot",
},
{
value: APPROVAL_STATUS.APPROVED,
approvalSource: 1,
label: "后台审批通过",
tagType: "success",
spotClass: "greenSpot",
},
]
/** 异常类型(Swagger AbnormalFlowType) */ /** 异常类型(Swagger AbnormalFlowType) */
export const ABNORMAL_TYPE_LIST = [ export const ABNORMAL_TYPE_LIST = [
{ value: 1, label: "已付款未录单" }, { value: 1, label: "已付款未录单" },
...@@ -90,6 +140,38 @@ export function getApprovalStatusMeta(status) { ...@@ -90,6 +140,38 @@ export function getApprovalStatusMeta(status) {
return item || { label: "-", tagType: "info", spotClass: "ashSpot" } return item || { label: "-", tagType: "info", spotClass: "ashSpot" }
} }
export function getApprovalLogStatusMeta(status, approvalSource = 0) {
const normalized = normalizeStatus(status)
const source = String(approvalSource)
const item = APPROVAL_LOG_STATUS_LIST.find(
(s) => s.value === normalized && String(s.approvalSource) === source
)
return item || getApprovalStatusMeta(status)
}
function buildRoundStatusFields(statusLabel, statusMeta) {
return {
statusLabel,
statusMeta,
}
}
function buildRoundDisplayFromLog(log, approvalSource) {
if (!log) {
return null
}
const meta = getApprovalLogStatusMeta(
log.approvalStatus,
log.approvalSource ?? approvalSource
)
return {
...buildRoundStatusFields(meta.label, meta),
approver: log.operatorName || "-",
time: formatDate(log.createdDate),
remark: log.remark || "-",
}
}
export function getAbnormalTypeLabel(type) { export function getAbnormalTypeLabel(type) {
const item = ABNORMAL_TYPE_LIST.find( const item = ABNORMAL_TYPE_LIST.find(
(t) => t.value === Number(type) || t.label === type (t) => t.value === Number(type) || t.label === type
...@@ -127,22 +209,26 @@ function getLatestLog(logs, approvalSource) { ...@@ -127,22 +209,26 @@ function getLatestLog(logs, approvalSource) {
function getFirstRoundDisplay(approvalStatus, regionalLog) { function getFirstRoundDisplay(approvalStatus, regionalLog) {
const status = normalizeStatus(approvalStatus) const status = normalizeStatus(approvalStatus)
const pendingMeta = getApprovalStatusMeta(APPROVAL_STATUS.WAIT_REGIONAL)
const rejectedMeta = getApprovalStatusMeta(APPROVAL_STATUS.REGIONAL_REJECTED)
if (status === APPROVAL_STATUS.WAIT_REGIONAL) { if (status === APPROVAL_STATUS.WAIT_REGIONAL) {
return { return {
firstRoundStatusLabel: "待区域经理审批", firstRoundStatusLabel: pendingMeta.label,
firstRoundStatusMeta: pendingMeta,
firstRoundApprover: "-", firstRoundApprover: "-",
firstRoundTime: "-", firstRoundTime: "-",
firstRoundRemark: "-" firstRoundRemark: "-",
} }
} }
if (status === APPROVAL_STATUS.REGIONAL_REJECTED) { if (status === APPROVAL_STATUS.REGIONAL_REJECTED) {
const logDisplay = buildRoundDisplayFromLog(regionalLog, 0)
return { return {
firstRoundStatusLabel: regionalLog firstRoundStatusLabel: logDisplay?.statusLabel || rejectedMeta.label,
? getApprovalStatusMeta(regionalLog.approvalStatus).label firstRoundStatusMeta: logDisplay?.statusMeta || rejectedMeta,
: "区域经理审批驳回", firstRoundApprover: logDisplay?.approver || "-",
firstRoundApprover: regionalLog ? regionalLog.operatorName || "-" : "-", firstRoundTime: logDisplay?.time || "-",
firstRoundTime: regionalLog ? regionalLog.createdDate || "-" : "-", firstRoundRemark: logDisplay?.remark || "-",
firstRoundRemark: regionalLog ? regionalLog.remark || "-" : "-"
} }
} }
if ( if (
...@@ -150,63 +236,73 @@ function getFirstRoundDisplay(approvalStatus, regionalLog) { ...@@ -150,63 +236,73 @@ function getFirstRoundDisplay(approvalStatus, regionalLog) {
|| status === APPROVAL_STATUS.BACKEND_REJECTED || status === APPROVAL_STATUS.BACKEND_REJECTED
|| status === APPROVAL_STATUS.APPROVED || status === APPROVAL_STATUS.APPROVED
) { ) {
if (regionalLog) { const logDisplay = buildRoundDisplayFromLog(regionalLog, 0)
if (logDisplay) {
return { return {
firstRoundStatusLabel: getApprovalStatusMeta(regionalLog.approvalStatus).label, firstRoundStatusLabel: logDisplay.statusLabel,
firstRoundApprover: regionalLog.operatorName || "-", firstRoundStatusMeta: logDisplay.statusMeta,
firstRoundTime: regionalLog.createdDate || "-", firstRoundApprover: logDisplay.approver,
firstRoundRemark: regionalLog.remark || "-" firstRoundTime: logDisplay.time,
firstRoundRemark: logDisplay.remark,
} }
} }
return { return {
firstRoundStatusLabel: "-", firstRoundStatusLabel: "-",
firstRoundStatusMeta: { label: "-", tagType: "info", spotClass: "ashSpot" },
firstRoundApprover: "-", firstRoundApprover: "-",
firstRoundTime: "-", firstRoundTime: "-",
firstRoundRemark: "-" firstRoundRemark: "-",
} }
} }
if (regionalLog) { const logDisplay = buildRoundDisplayFromLog(regionalLog, 0)
if (logDisplay) {
return { return {
firstRoundStatusLabel: getApprovalStatusMeta(regionalLog.approvalStatus).label, firstRoundStatusLabel: logDisplay.statusLabel,
firstRoundApprover: regionalLog.operatorName || "-", firstRoundStatusMeta: logDisplay.statusMeta,
firstRoundTime: regionalLog.createdDate || "-", firstRoundApprover: logDisplay.approver,
firstRoundRemark: regionalLog.remark || "-" firstRoundTime: logDisplay.time,
firstRoundRemark: logDisplay.remark,
} }
} }
return { return {
firstRoundStatusLabel: "待区域经理审批", firstRoundStatusLabel: pendingMeta.label,
firstRoundStatusMeta: pendingMeta,
firstRoundApprover: "-", firstRoundApprover: "-",
firstRoundTime: "-", firstRoundTime: "-",
firstRoundRemark: "-" firstRoundRemark: "-",
} }
} }
function getSecondRoundDisplay(approvalStatus, hqLog) { function getSecondRoundDisplay(approvalStatus, hqLog) {
const status = normalizeStatus(approvalStatus) const status = normalizeStatus(approvalStatus)
const pendingMeta = getApprovalStatusMeta(APPROVAL_STATUS.WAIT_BACKEND)
if (status === APPROVAL_STATUS.WAIT_BACKEND) { if (status === APPROVAL_STATUS.WAIT_BACKEND) {
return { return {
secondRoundStatusLabel: "待后台审批", secondRoundStatusLabel: pendingMeta.label,
secondRoundStatusMeta: pendingMeta,
secondRoundApprover: "-", secondRoundApprover: "-",
secondRoundTime: "-", secondRoundTime: "-",
secondRoundRemark: "-", secondRoundRemark: "-",
extensionDeadline: "-"
} }
} }
if (hqLog) { const logDisplay = buildRoundDisplayFromLog(hqLog, 1)
if (logDisplay) {
return { return {
secondRoundStatusLabel: getApprovalStatusMeta(hqLog.approvalStatus).label, secondRoundStatusLabel: logDisplay.statusLabel,
secondRoundApprover: hqLog.operatorName || "-", secondRoundStatusMeta: logDisplay.statusMeta,
secondRoundTime: hqLog.createdDate || "-", secondRoundApprover: logDisplay.approver,
secondRoundRemark: hqLog.remark || "-", secondRoundTime: logDisplay.time,
extensionDeadline: "-" secondRoundRemark: logDisplay.remark,
} }
} }
const declarationMeta = getApprovalStatusMeta(status)
return { return {
secondRoundStatusLabel: getApprovalStatusMeta(status).label, secondRoundStatusLabel: declarationMeta.label,
secondRoundStatusMeta: declarationMeta,
secondRoundApprover: "-", secondRoundApprover: "-",
secondRoundTime: "-", secondRoundTime: "-",
secondRoundRemark: "-", secondRoundRemark: "-",
extensionDeadline: "-"
} }
} }
...@@ -216,7 +312,9 @@ function getSecondRoundDisplay(approvalStatus, hqLog) { ...@@ -216,7 +312,9 @@ function getSecondRoundDisplay(approvalStatus, hqLog) {
export function mapPcDeclarationDetail(apiData, rowData = {}) { export function mapPcDeclarationDetail(apiData, rowData = {}) {
const { tradeInfo = {}, declarationInfo = {}, approvalLogs = [] } = apiData || {} const { tradeInfo = {}, declarationInfo = {}, approvalLogs = [] } = apiData || {}
const approvalStatus = normalizeStatus( const approvalStatus = normalizeStatus(
rowData.declarationApprovalStatus ?? apiData?.declarationApprovalStatus rowData.declarationApprovalStatus
?? apiData?.declarationApprovalStatus
?? declarationInfo.approvalStatus
) )
const regionalLog = getLatestLog(approvalLogs, 0) const regionalLog = getLatestLog(approvalLogs, 0)
const hqLog = getLatestLog(approvalLogs, 1) const hqLog = getLatestLog(approvalLogs, 1)
...@@ -229,7 +327,7 @@ export function mapPcDeclarationDetail(apiData, rowData = {}) { ...@@ -229,7 +327,7 @@ export function mapPcDeclarationDetail(apiData, rowData = {}) {
notRefundedTotalPrice: notRefundedTotalPrice:
tradeInfo.notRefundedTotalPrice ?? rowData.notRefundedTotalPrice, tradeInfo.notRefundedTotalPrice ?? rowData.notRefundedTotalPrice,
posTrmNo: tradeInfo.posTrmNo || rowData.posTrmNo || "-", posTrmNo: tradeInfo.posTrmNo || rowData.posTrmNo || "-",
payDate: tradeInfo.payDate || rowData.payDate || "-", payDate: formatDate(tradeInfo.payDate || rowData.payDate),
yqMerchantName: yqMerchantName:
tradeInfo.yqMerchantName || rowData.yqMerchantName || rowData.merchantName || "-", tradeInfo.yqMerchantName || rowData.yqMerchantName || rowData.merchantName || "-",
payChannel: tradeInfo.payChannel || rowData.payChannel || "-", payChannel: tradeInfo.payChannel || rowData.payChannel || "-",
...@@ -251,7 +349,7 @@ export function mapPcDeclarationDetail(apiData, rowData = {}) { ...@@ -251,7 +349,7 @@ export function mapPcDeclarationDetail(apiData, rowData = {}) {
|| rowData.refundStatus || rowData.refundStatus
|| "-", || "-",
reporterName: declarationInfo.createdBy || "-", reporterName: declarationInfo.createdBy || "-",
reportTime: declarationInfo.createdDate || "-", reportTime: formatDate(declarationInfo.createdDate),
abnormalType: declarationInfo.abnormalType, abnormalType: declarationInfo.abnormalType,
abnormalTypeLabel: getAbnormalTypeLabel(declarationInfo.abnormalType), abnormalTypeLabel: getAbnormalTypeLabel(declarationInfo.abnormalType),
reportRemark: declarationInfo.remark || "-", reportRemark: declarationInfo.remark || "-",
...@@ -259,7 +357,8 @@ export function mapPcDeclarationDetail(apiData, rowData = {}) { ...@@ -259,7 +357,8 @@ export function mapPcDeclarationDetail(apiData, rowData = {}) {
approvalStatus, approvalStatus,
declarationId: rowData.declarationId, declarationId: rowData.declarationId,
...firstRound, ...firstRound,
...secondRound ...secondRound,
extensionDeadline: formatDelayDeadline(declarationInfo.delayDeadline),
} }
} }
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
</div> </div>
<div class="date-range"> <div class="date-range">
统计周期: 统计周期:
{{ routerInfo.startTime && routerInfo.startTime.split(" ")[0] }} 至 {{ formatDateTime(routerInfo.startTime, "YYYY-MM-DD") }} 至
{{ routerInfo.endTime && routerInfo.endTime.split(" ")[0] }} {{ formatDateTime(routerInfo.endTime, "YYYY-MM-DD") }}
</div> </div>
</div> </div>
</div> </div>
...@@ -457,7 +457,12 @@ export default { ...@@ -457,7 +457,12 @@ export default {
prop: "notRefundedTotalPrice", prop: "notRefundedTotalPrice",
formatter: (row) => "¥" + row.notRefundedTotalPrice formatter: (row) => "¥" + row.notRefundedTotalPrice
}, },
{ label: "支付时间", prop: "payDate", width: "160px" }, {
label: "支付时间",
prop: "payDate",
width: "160px",
formatter: (row) => this.formatDateTime(row.payDate)
},
{ label: "支付渠道", prop: "payChannel" }, { label: "支付渠道", prop: "payChannel" },
{ label: "收款来源", prop: "payType", addHtml: "payType" }, { label: "收款来源", prop: "payType", addHtml: "payType" },
{ label: "所属流量方", prop: "merchantName", width: "180px" }, { label: "所属流量方", prop: "merchantName", width: "180px" },
...@@ -491,9 +496,19 @@ export default { ...@@ -491,9 +496,19 @@ export default {
prop: "totalAmount", prop: "totalAmount",
formatter: (row) => "¥" + row.totalAmount formatter: (row) => "¥" + row.totalAmount
}, },
{ label: "订单时间", prop: "orderDate", width: "160px" }, {
label: "订单时间",
prop: "orderDate",
width: "160px",
formatter: (row) => this.formatDateTime(row.orderDate)
},
{ label: "交易参考号", prop: "tradeNo", width: "150px" }, { label: "交易参考号", prop: "tradeNo", width: "150px" },
{ label: "支付时间", prop: "payDate", width: "160px" }, {
label: "支付时间",
prop: "payDate",
width: "160px",
formatter: (row) => this.formatDateTime(row.payDate)
},
{ label: "支付方式", prop: "payType", addHtml: "payType" }, { label: "支付方式", prop: "payType", addHtml: "payType" },
{ label: "所属流量方", prop: "merchantName", width: "180px" }, { label: "所属流量方", prop: "merchantName", width: "180px" },
{ label: "所属园区店", prop: "yqMerchantName", width: "180px" }, { label: "所属园区店", prop: "yqMerchantName", width: "180px" },
...@@ -525,9 +540,19 @@ export default { ...@@ -525,9 +540,19 @@ export default {
prop: "totalAmount", prop: "totalAmount",
formatter: (row) => "¥" + row.totalAmount formatter: (row) => "¥" + row.totalAmount
}, },
{ label: "订单时间", prop: "orderDate", width: "160px" }, {
label: "订单时间",
prop: "orderDate",
width: "160px",
formatter: (row) => this.formatDateTime(row.orderDate)
},
{ label: "交易参考号", prop: "outTradeNo", width: "150px" }, { label: "交易参考号", prop: "outTradeNo", width: "150px" },
{ label: "支付时间", prop: "payDate", width: "160px" }, {
label: "支付时间",
prop: "payDate",
width: "160px",
formatter: (row) => this.formatDateTime(row.payDate)
},
{ label: "支付方式", prop: "payType", addHtml: "payType" }, { label: "支付方式", prop: "payType", addHtml: "payType" },
{ label: "所属流量方", prop: "merchantName", width: "180px" }, { label: "所属流量方", prop: "merchantName", width: "180px" },
{ label: "所属园区店", prop: "yqMerchantName", width: "180px" }, { label: "所属园区店", prop: "yqMerchantName", width: "180px" },
...@@ -592,6 +617,9 @@ export default { ...@@ -592,6 +617,9 @@ export default {
this.debouncedConfirmSubmit = debounce(this.handleConfirmSubmit, 300) this.debouncedConfirmSubmit = debounce(this.handleConfirmSubmit, 300)
}, },
methods: { methods: {
formatDateTime(val, format = "YYYY-MM-DD HH:mm:ss") {
return val ? Util.dateFormate(val, format) : "-"
},
async fetchStatData() { async fetchStatData() {
try { try {
const { merchantName, ...otherRouterInfo } = this.routerInfo const { merchantName, ...otherRouterInfo } = this.routerInfo
...@@ -793,19 +821,11 @@ export default { ...@@ -793,19 +821,11 @@ export default {
orderCode: row.orderCode orderCode: row.orderCode
}) })
let transDate = ""
let transTime = ""
if (res.transTime) {
const parts = res.transTime.split(" ")
if (parts.length > 0) transDate = parts[0]
if (parts.length > 1) transTime = parts[1]
}
this.viewData = { this.viewData = {
accName: res.accName, accName: res.accName,
bankAcc: res.bankAcc, bankAcc: res.bankAcc,
transDate: transDate, transDate: this.formatDateTime(res.transTime, "YYYY-MM-DD"),
transTime: transTime, transTime: this.formatDateTime(res.transTime, "HH:mm:ss"),
totalAmount: res.totalAmount, totalAmount: res.totalAmount,
oppAccName: res.oppAccName, oppAccName: res.oppAccName,
oppAccNo: res.oppAccNo, oppAccNo: res.oppAccNo,
......
...@@ -174,7 +174,7 @@ import { getSearchFormSchema, getTableColumnsSchema } from "./index.data.js"; ...@@ -174,7 +174,7 @@ import { getSearchFormSchema, getTableColumnsSchema } from "./index.data.js";
export default { export default {
// 需与路由 name 一致,d2admin keep-alive include 按路由名匹配 // 需与路由 name 一致,d2admin keep-alive include 按路由名匹配
name: "PackageManage", name: "packageManage",
components: { components: {
// ApplicableAreaSelect, // ApplicableAreaSelect,
BatchModifyPackageInventoryDialog, BatchModifyPackageInventoryDialog,
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
:key="form.categoryType" :key="form.categoryType"
v-model="form.goodsTypeGroupRelationList" v-model="form.goodsTypeGroupRelationList"
placeholder="请选择商品" placeholder="请选择商品"
style="width:390px" style="width:800px"
value-key="merchantGoodsCode" value-key="merchantGoodsCode"
disabled disabled
:fetch-api="fetchUpgradeGoodsList" :fetch-api="fetchUpgradeGoodsList"
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
ref="packageGoods" ref="packageGoods"
v-model="form.goodsTypeGroupRelationList" v-model="form.goodsTypeGroupRelationList"
placeholder="请选择套餐" placeholder="请选择套餐"
style="width:390px" style="width:800px"
value-key="packageCode" value-key="packageCode"
disabled disabled
:fetch-api="getPackagesGoodsList" :fetch-api="getPackagesGoodsList"
......
...@@ -316,7 +316,7 @@ export default { ...@@ -316,7 +316,7 @@ export default {
async postBaseForm() { async postBaseForm() {
await postReconciliationConfigBaseDetailApi({ await postReconciliationConfigBaseDetailApi({
businessCode: this.businessCode, businessCode: this.businessCode,
...pick(this.form, ["firstLineSunshineOnlinePointsFlag", "firstLineSunshine2OnlinePointsFlag"]), ...pick(this.form, ["firstLineSunshineOnlinePointsFlag", "firstLineSunshine2OnlinePointsFlag", "managementMarketingFeesPrerequisite", "firstLineSunshinePrerequisite"]),
}); });
}, },
async initSpecial() { async initSpecial() {
......
...@@ -139,7 +139,9 @@ ...@@ -139,7 +139,9 @@
</el-row> </el-row>
</el-form> </el-form>
<div class="actions-wrapper"> <div class="actions-wrapper">
<el-button type="text" @click="handleAppendProduct"> <el-button v-if="shelfModel === 2"
type="text"
@click="handleAppendProduct">
<span class="el-icon-plus" /> <span class="el-icon-plus" />
添加商品 添加商品
</el-button> </el-button>
...@@ -157,6 +159,7 @@ ...@@ -157,6 +159,7 @@
:merchant-id="merchantId" :merchant-id="merchantId"
:merchant-id-list="merchantIdList" :merchant-id-list="merchantIdList"
:product.sync="productList[index]" :product.sync="productList[index]"
:shelf-model="shelfModel"
:shelf-type="shelfType" :shelf-type="shelfType"
:show-gift-cost="false" :show-gift-cost="false"
:show-old-merchant-goods-code="false" :show-old-merchant-goods-code="false"
...@@ -217,6 +220,11 @@ export default { ...@@ -217,6 +220,11 @@ export default {
type: Number, type: Number,
default: 1, default: 1,
}, },
/** 1-特殊上架;2-常规上架 */
shelfModel: {
type: Number,
default: 1,
},
}, },
data() { data() {
return { return {
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<el-button icon="el-icon-plus" @click="handleSelectGoods"> <el-button icon="el-icon-plus" @click="handleSelectGoods">
选择商品 选择商品
</el-button> </el-button>
<el-button v-if="useRemoveBtn" <el-button v-if="useRemoveBtn && shelfModel === 2"
type="text" type="text"
@click="handleRemove"> @click="handleRemove">
删除 删除
...@@ -189,12 +189,12 @@ ...@@ -189,12 +189,12 @@
<el-col v-if="isMemberRightsUpgrade(baseSceneCode)" :span="12"> <el-col v-if="isMemberRightsUpgrade(baseSceneCode)" :span="12">
<el-form-item label="第三方成本/件:" <el-form-item label="第三方成本/件:"
prop="detailList[0].thirdPartyCost" prop="detailList[0].thirdPartyCost"
:rules="[{ required: true, message: '请输入第三方成本', trigger: 'blur' }]"> :rules="[{ required: isUpgradeProductCostStyleDefault(product.detailList[0].thirdPartyCostStyle) ? false : true, message: '请输入第三方成本', trigger: 'blur' }]">
<div class="form-item-append-fix"> <div class="form-item-append-fix">
<VenusNumberInput v-model="product.detailList[0].thirdPartyCost" <VenusNumberInput v-model="product.detailList[0].thirdPartyCost"
placeholder="请输入第三方成本" placeholder="请输入第三方成本"
:controls="false" :controls="false"
:disabled="isUpgradeProductCostStyleDefault(product.detailList[0].upgradeProductCostStyle) || isDirectOperation(product.detailList[0].supplyFlag)" :disabled="isUpgradeProductCostStyleDefault(product.detailList[0].thirdPartyCostStyle) || isDirectOperation(product.detailList[0].supplyFlag)"
:max="999999" :max="999999"
:min="0" :min="0"
:precision="2" /> :precision="2" />
...@@ -205,7 +205,7 @@ ...@@ -205,7 +205,7 @@
<el-col v-if="isQualityUpgrade(baseSceneCode)" :span="12"> <el-col v-if="isQualityUpgrade(baseSceneCode)" :span="12">
<el-form-item label="产品、升级成本:" <el-form-item label="产品、升级成本:"
prop="detailList[0].upgradeProductCost" prop="detailList[0].upgradeProductCost"
:rules="[{ required: true, message: '请输入产品、升级成本', trigger: 'blur' }]"> :rules="[{ required: isUpgradeProductCostStyleDefault(product.detailList[0].upgradeProductCostStyle) ? false : true, message: '请输入产品、升级成本', trigger: 'blur' }]">
<div class="form-item-append-fix"> <div class="form-item-append-fix">
<VenusNumberInput v-model="product.detailList[0].upgradeProductCost" <VenusNumberInput v-model="product.detailList[0].upgradeProductCost"
placeholder="请输入产品、升级成本" placeholder="请输入产品、升级成本"
...@@ -220,11 +220,12 @@ ...@@ -220,11 +220,12 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 精品升级:取upgradeProductCostStyle,与“产品、升级成本/件”有联动关系;会员权益:取thirdPartyCostStyle,与“第三方成本/件”有联动关系 -->
<el-col v-if="showUpgradeProductCostStyle" :span="12"> <el-col v-if="showUpgradeProductCostStyle" :span="12">
<el-form-item label="产品成本获取方式:" <el-form-item label="产品成本获取方式:"
prop="detailList[0].upgradeProductCostStyle" :prop="isQualityUpgrade(baseSceneCode) ? 'detailList[0].upgradeProductCostStyle' : 'detailList[0].thirdPartyCostStyle'"
:rules="[{ required: true, message: '请选择产品成本获取方式', trigger: 'change' }]"> :rules="[{ required: true, message: '请选择产品成本获取方式', trigger: 'change' }]">
<el-radio-group v-model="product.detailList[0].upgradeProductCostStyle" <el-radio-group v-model="productCostStyleValue"
@change="handleUpgradeProductCostStyleChange"> @change="handleUpgradeProductCostStyleChange">
<template v-for="item in options.productCostStyleOpt"> <template v-for="item in options.productCostStyleOpt">
<el-radio :key="item.value" <el-radio :key="item.value"
...@@ -323,6 +324,11 @@ export default { ...@@ -323,6 +324,11 @@ export default {
type: Number, type: Number,
default: 1, default: 1,
}, },
/** 1-特殊上架;2-常规上架 */
shelfModel: {
type: Number,
default: 1,
},
merchantIdList: { merchantIdList: {
type: Array, type: Array,
required: true, required: true,
...@@ -384,6 +390,20 @@ export default { ...@@ -384,6 +390,20 @@ export default {
}, },
computed: { computed: {
productCostStyleValue: {
get() {
return isQualityUpgrade(this.baseSceneCode)
? this.product.detailList[0].upgradeProductCostStyle
: this.product.detailList[0].thirdPartyCostStyle;
},
set(value) {
if (isQualityUpgrade(this.baseSceneCode)) {
this.product.detailList[0].upgradeProductCostStyle = value;
return;
}
this.product.detailList[0].thirdPartyCostStyle = value;
},
},
showUpgradeProductCostStyle() { showUpgradeProductCostStyle() {
// 未选择产品 不显示 // 未选择产品 不显示
if (!(this.product.upgradeGoodsId || this.product.detailList[0].upgradeGoodsId)) { if (!(this.product.upgradeGoodsId || this.product.detailList[0].upgradeGoodsId)) {
...@@ -436,7 +456,7 @@ export default { ...@@ -436,7 +456,7 @@ export default {
async fetchMerchantGoodsCode({ pageQuery }) { async fetchMerchantGoodsCode({ pageQuery }) {
const res = await postProductOldMerchantGoodsCodeList({ const res = await postProductOldMerchantGoodsCodeList({
...pageQuery, ...pageQuery,
merchantIds: Array.isArray(this.merchantId) ? this.merchantId : [this.merchantId], merchantIds: Array.isArray(this.merchantIdList) ? this.merchantIdList : [this.merchantId],
baseSceneCode: this.baseSceneCode, baseSceneCode: this.baseSceneCode,
goodsCode: pageQuery.searchValue, goodsCode: pageQuery.searchValue,
}); });
...@@ -472,7 +492,7 @@ export default { ...@@ -472,7 +492,7 @@ export default {
// 产品成本获取方式变动 更新成本 // 产品成本获取方式变动 更新成本
async updateCost() { async updateCost() {
// 如果是自定义成本带入方式 则 不更新成本 // 如果是自定义成本带入方式 则 不更新成本
if (isUpgradeProductCostStyleCustom(this.product?.detailList?.[0]?.upgradeProductCostStyle)) { if (isUpgradeProductCostStyleCustom(this.productCostStyleValue)) {
return; return;
} }
...@@ -489,15 +509,15 @@ export default { ...@@ -489,15 +509,15 @@ export default {
// 如果是会员权益升级场景 // 如果是会员权益升级场景
if (isMemberRightsUpgrade(this.baseSceneCode)) { if (isMemberRightsUpgrade(this.baseSceneCode)) {
this.product.detailList[0].thirdPartyCost = equityOperationCost ?? 0; this.product.detailList[0].thirdPartyCost = equityOperationCost;
} }
// 如果是精品升级场景 // 如果是精品升级场景
if (isQualityUpgrade(this.baseSceneCode)) { if (isQualityUpgrade(this.baseSceneCode)) {
this.product.detailList[0].upgradeProductCost = upgradeCost ?? 0; this.product.detailList[0].upgradeProductCost = upgradeCost;
// 如果 是否作为赠送产品 // 如果 是否作为赠送产品
if (this.product.detailList[0].isGiftCost === "Y") { if (this.product.detailList[0].isGiftCost === "Y") {
this.product.detailList[0].giftCost = upgradeCost ?? 0; this.product.detailList[0].giftCost = upgradeCost;
} }
} }
}, },
...@@ -524,7 +544,7 @@ export default { ...@@ -524,7 +544,7 @@ export default {
* 选择商品时 * 选择商品时
*/ */
async handleSelectGoodsConfirm(upgradeGoods) { async handleSelectGoodsConfirm(upgradeGoods) {
upgradeGoods.djCost = upgradeGoods.djCost ?? 0; // upgradeGoods.djCost = upgradeGoods.djCost ?? 0;
upgradeGoods.positionList = []; upgradeGoods.positionList = [];
if (upgradeGoods.position) { if (upgradeGoods.position) {
upgradeGoods.positionList = upgradeGoods.position.split(",").map(Number); upgradeGoods.positionList = upgradeGoods.position.split(",").map(Number);
......
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
:merchant-id-list="merchantIdList" :merchant-id-list="merchantIdList"
:packages="productDetail || { detailList: [] }" :packages="productDetail || { detailList: [] }"
:prefix="$data._prefix" :prefix="$data._prefix"
:shelf-model="shelfModel"
:shelf-type="shelfType" :shelf-type="shelfType"
@update:packages="handleComboUpdatePackages" /> @update:packages="handleComboUpdatePackages" />
</div> </div>
...@@ -263,11 +264,11 @@ export default { ...@@ -263,11 +264,11 @@ export default {
// 商品在这个层级依赖 // 商品在这个层级依赖
detail.upgradeGoodsId = detail.detailList[0].upgradeGoodsId; detail.upgradeGoodsId = detail.detailList[0].upgradeGoodsId;
// 若无嘀加成本则默认=0 // 若无嘀加成本则默认=0
if (detail?.detailList?.[0]?.upgradeGoods) { // if (detail?.detailList?.[0]?.upgradeGoods) {
if (!detail?.detailList?.[0]?.upgradeGoods?.djCost) { // if (!detail?.detailList?.[0]?.upgradeGoods?.djCost) {
detail.detailList[0].upgradeGoods.djCost = 0; // detail.detailList[0].upgradeGoods.djCost = 0;
} // }
} // }
// 5.8.6 若产品供应方=广联直营,则第三方成本默认=0且不可编辑 // 5.8.6 若产品供应方=广联直营,则第三方成本默认=0且不可编辑
if (detail?.detailList?.[0]?.supplyFlag === 1) { if (detail?.detailList?.[0]?.supplyFlag === 1) {
// 第三方成本 // 第三方成本
......
...@@ -254,12 +254,16 @@ export async function getProductDetailDescriptionSchema(shelfType) { ...@@ -254,12 +254,16 @@ export async function getProductDetailDescriptionSchema(shelfType) {
}, },
}, },
/**
* 精品升级:取upgradeProductCostStyle,与“产品、升级成本/件”有联动关系;
* 会员权益:取thirdPartyCostStyle,与“第三方成本/件”有联动关系
*/
{ {
name: "detailList.0.upgradeProductCostStyle", name: "detailList.0.upgradeProductCostStyle",
label: "产品成本获取方式", label: "产品成本获取方式",
col: 12, col: 12,
render(h, { data, schemaItem }) { render(h, { data, schemaItem }) {
const value = get(data, schemaItem.name); const value = get(data, isQualityUpgrade(data.baseSceneCode) ? schemaItem.name : "detailList.0.thirdPartyCostStyle");
const item = productCostStyleOpt.find(item => item.value === value); const item = productCostStyleOpt.find(item => item.value === value);
return h( return h(
"span", "span",
......
...@@ -54,6 +54,10 @@ export default { ...@@ -54,6 +54,10 @@ export default {
// merchantNames: "", // merchantNames: "",
// shelfType: 1, // shelfType: 1,
// } // }
shelfModel: {
type: Number,
default: 1,
},
formData: { formData: {
type: Object, type: Object,
required: true, required: true,
...@@ -147,7 +151,12 @@ export default { ...@@ -147,7 +151,12 @@ export default {
this.$message.error("请选择上架类型和业务场景"); this.$message.error("请选择上架类型和业务场景");
return; return;
} }
const params = { baseSceneCode, shelfType, method: "dj.api.create.business.approve.template.export" }; const params = {
baseSceneCode,
shelfType,
method: "dj.api.create.business.approve.template.export",
shelfModel: this.shelfModel,
};
const list = [ const list = [
...this.dowloadList, ...this.dowloadList,
{ {
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
ref="modifyRef" ref="modifyRef"
v-bind="$attrs" v-bind="$attrs"
:form-data="form" :form-data="form"
:shelf-model="shelfModel"
v-on="$listeners" /> v-on="$listeners" />
</div> </div>
<VenusDialog v-model="dialog.importProgress.show" <VenusDialog v-model="dialog.importProgress.show"
...@@ -55,6 +56,10 @@ export default { ...@@ -55,6 +56,10 @@ export default {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
shelfModel: {
type: Number,
default: 1,
},
baseSceneCode: { baseSceneCode: {
type: String, type: String,
default: undefined, default: undefined,
......
...@@ -83,7 +83,7 @@ export function getSelectFilterIds(baseSceneCode) { ...@@ -83,7 +83,7 @@ export function getSelectFilterIds(baseSceneCode) {
export function getTableFilterIds(baseSceneCode) { export function getTableFilterIds(baseSceneCode) {
const sceneTypeFilter = { const sceneTypeFilter = {
// 精品升级 // 精品升级
1: [1, 2, 3, 4, 301, 1300, 1301], 1: [1, 2, 3, 4, 1300, 1301],
// 会员升级权益 // 会员升级权益
0: [1, 2, 4, 701, 1300, 1301], 0: [1, 2, 4, 701, 1300, 1301],
}; };
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
<div v-loading="data.isProviderLoading" class="wrapper"> <div v-loading="data.isProviderLoading" class="wrapper">
<FormStep name="ProductImport" :on-submit="handleSubmitProductImport"> <FormStep name="ProductImport" :on-submit="handleSubmitProductImport">
<ShelfProductImport ref="shelfProductImportRef" <ShelfProductImport ref="shelfProductImportRef"
:shelf-model="shelfModel"
@handleNext="handleNextProductImport()" /> @handleNext="handleNextProductImport()" />
</FormStep> </FormStep>
<FormStep v-loading="data.isStepLoading" name="ProductConfirm"> <FormStep v-loading="data.isStepLoading" name="ProductConfirm">
......
...@@ -248,6 +248,7 @@ import { payType } from "@/common/constants.js" ...@@ -248,6 +248,7 @@ import { payType } from "@/common/constants.js"
// import { getOrderDetail } from '@api/order' // import { getOrderDetail } from '@api/order'
import dayjs from "dayjs" import dayjs from "dayjs"
import { getList, goodsOrderDetail } from "@api/order" import { getList, goodsOrderDetail } from "@api/order"
import { navigateBackFromOrderDetail } from "./utils/orderListNavigation"
export default { export default {
name: "CarDamageDetail", name: "CarDamageDetail",
components: { components: {
...@@ -378,16 +379,9 @@ export default { ...@@ -378,16 +379,9 @@ export default {
return sums return sums
}, },
handleClose() { handleClose() {
if (this.$route.params.from) { navigateBackFromOrderDetail(this.$router, this.close, {
// 从待补录订单列表跳转 fromSupplement: !!this.$route.params.from,
this.close({ tagName: "/orderSupplement" }) })
this.$router.push({ name: "orderSupplement" })
} else {
// 从订单列表跳转
this.close({ tagName: "/orderList" })
this.$router.push({ name: "orderList" })
}
this.close({ tagName: "/orderDetail" })
}, },
refund() { refund() {
......
...@@ -105,6 +105,11 @@ import { ...@@ -105,6 +105,11 @@ import {
orderSourceList, orderSourceList,
deliveryTypeList deliveryTypeList
} from "@/common/constants" } from "@/common/constants"
import { mapActions } from "vuex"
import {
navigateBackToOrderList,
ORDER_LIST_DETAIL_TAG_PATHS,
} from "./utils/orderListNavigation"
export default { export default {
name: "ConfigUpgradationDetail", name: "ConfigUpgradationDetail",
data() { data() {
...@@ -182,6 +187,7 @@ export default { ...@@ -182,6 +187,7 @@ export default {
}, },
methods: { methods: {
...mapActions({ close: "d2admin/page/close" }),
async getCrowdfundingOrderConfig() { async getCrowdfundingOrderConfig() {
const detailFormData = [ const detailFormData = [
{ {
...@@ -419,23 +425,9 @@ export default { ...@@ -419,23 +425,9 @@ export default {
this.imgVisible = !this.imgVisible this.imgVisible = !this.imgVisible
}, },
handleCancel() { handleCancel() {
if (this.routeInfo.orderType == 'integralShopping') { navigateBackToOrderList(this.$router, this.close, {
this.$router.push({ detailTagPath: ORDER_LIST_DETAIL_TAG_PATHS.configUpgradationDetail,
name: 'orderList',
params: {
tabPane: "5",
tabLabel: "integral-shopping"
}
}) })
} else {
this.$router.push({
name: 'orderList',
params: {
tabPane: "2",
tabLabel: "config-upgradation"
}
})
}
} }
} }
} }
......
...@@ -132,6 +132,11 @@ import { ...@@ -132,6 +132,11 @@ import {
orderSourceList, orderSourceList,
deliveryTypeList deliveryTypeList
} from "@/common/constants" } from "@/common/constants"
import { mapActions } from "vuex"
import {
navigateBackToOrderList,
ORDER_LIST_DETAIL_TAG_PATHS,
} from "./utils/orderListNavigation"
export default { export default {
name: "OrderDetail", name: "OrderDetail",
data() { data() {
...@@ -208,6 +213,7 @@ export default { ...@@ -208,6 +213,7 @@ export default {
}, },
methods: { methods: {
...mapActions({ close: "d2admin/page/close" }),
async getCrowdfundingOrderConfig() { async getCrowdfundingOrderConfig() {
const detailFormData = [ const detailFormData = [
{ {
...@@ -426,12 +432,8 @@ export default { ...@@ -426,12 +432,8 @@ export default {
this.previewImgUrl = url this.previewImgUrl = url
}, },
handleCancel() { handleCancel() {
this.$router.push({ navigateBackToOrderList(this.$router, this.close, {
name: 'orderList', detailTagPath: ORDER_LIST_DETAIL_TAG_PATHS.crowdfundDetail,
params: {
tabPane: "3",
tabLabel: "crowd-funding"
}
}) })
} }
} }
......
...@@ -547,6 +547,7 @@ import refundDetail from "./components/refundDetail.vue"; ...@@ -547,6 +547,7 @@ import refundDetail from "./components/refundDetail.vue";
import technicianDialog from "./components/technicianDialog"; import technicianDialog from "./components/technicianDialog";
// import signRefundDialog from './signRefundDialog' // import signRefundDialog from './signRefundDialog'
import remarkDialog from "./remarkDialog"; import remarkDialog from "./remarkDialog";
import { navigateBackFromOrderDetail } from "./utils/orderListNavigation";
export default { export default {
name: "OrderDetail", name: "OrderDetail",
...@@ -818,22 +819,9 @@ export default { ...@@ -818,22 +819,9 @@ export default {
return sums; return sums;
}, },
handleClose() { handleClose() {
if (this.$route.query.from) { navigateBackFromOrderDetail(this.$router, this.close, {
// 从待补录订单列表跳转 fromSupplement: !!this.$route.query.from,
this.close({ tagName: "/orderSupplement" });
this.$router.push({ name: "orderSupplement" });
} else {
// 从订单列表跳转
this.close({ tagName: "/orderList" });
this.$router.push({
name: "orderList",
params: {
tabPane: this.detail?.sceneType == 0 ? "4" : "1", // 根据不同场景订单返回到对应的tab页列表
tabLabel: this.detail?.sceneType == 0 ? "carDamage" : "order",
},
}); });
}
this.close({ tagName: "/orderDetail" });
}, },
// 添加选择退款明细弹窗 // 添加选择退款明细弹窗
......
...@@ -38,6 +38,8 @@ import { ...@@ -38,6 +38,8 @@ import {
buildSceneLeafItem, buildSceneLeafItem,
normalizeSceneResponse normalizeSceneResponse
} from "./orderListSceneMap.js" } from "./orderListSceneMap.js"
import { shouldReapplyRouteParams } from "./utils/orderListRouteGuard.js"
import { computeRouteParamPatch } from "./utils/orderListRouteParams.js"
/** 接口失败或无数据时的二级兜底(与原先静态一致) */ /** 接口失败或无数据时的二级兜底(与原先静态一致) */
const FALLBACK_LIGHT = [ const FALLBACK_LIGHT = [
...@@ -101,25 +103,9 @@ const LEGACY_LEAF_MATCH = { ...@@ -101,25 +103,9 @@ const LEGACY_LEAF_MATCH = {
"l-3-1": { tabName: "integralShopping" } "l-3-1": { tabName: "integralShopping" }
} }
/** 旧版 tabPane name -> 一级 + 二级;4 需保留原「不预选所属业务」 */
const LEGACY_TAB_PANE = {
1: { category: "light", leaf: "l-1-1" },
2: { category: "light", leaf: "l-1-2" },
3: { category: "light", leaf: "l-1-3" },
4: { category: "rights", leaf: "l-2-1", legacyRightsAll: true },
5: { category: "renewal", leaf: "l-3-1" }
}
const LEGACY_LABEL_TO_PANE = {
order: "1",
"config-upgradation": "2",
"crowd-funding": "3",
carDamage: "4",
"integral-shopping": "5"
}
export default { export default {
name: "OrderList", // 需与路由 name 一致,d2admin keep-alive include 按路由名匹配
name: "orderList",
components: { components: {
Order, Order,
CrowdFunding, CrowdFunding,
...@@ -232,14 +218,15 @@ export default { ...@@ -232,14 +218,15 @@ export default {
}, },
watch: { watch: {
$route: { $route: {
async handler(to) { async handler(to, from) {
if (to.name === "orderList" && to.params) { if (!shouldReapplyRouteParams(to, from)) {
return
}
this.applyRouteParams(to.params) this.applyRouteParams(to.params)
await this.loadScenesForCategory(this.activeCategory) await this.loadScenesForCategory(this.activeCategory)
this.pickLeafAfterLoad() this.pickLeafAfterLoad()
} }
} }
}
}, },
async mounted() { async mounted() {
this.applyRouteParams(this.$route.params) this.applyRouteParams(this.$route.params)
...@@ -329,27 +316,14 @@ export default { ...@@ -329,27 +316,14 @@ export default {
this.rightsFromLegacyTab4 = false this.rightsFromLegacyTab4 = false
}, },
applyRouteParams(params) { applyRouteParams(params) {
if (!params) return const patch = computeRouteParamPatch(params)
let pane = params.tabPane if (!patch) {
const label = params.tabLabel
if (pane == null || pane === "") {
if (
label != null
&& label !== ""
&& Object.prototype.hasOwnProperty.call(LEGACY_LABEL_TO_PANE, label)
) {
pane = LEGACY_LABEL_TO_PANE[label]
} else {
return return
} }
} this.activeCategory = patch.activeCategory
const key = String(pane) this.pendingLegacyLeaf = patch.pendingLegacyLeaf
const m = LEGACY_TAB_PANE[key] this.rightsFromLegacyTab4 = patch.rightsFromLegacyTab4
if (!m) return this.isApplyingRoute = patch.isApplyingRoute
this.isApplyingRoute = true
this.activeCategory = m.category
this.pendingLegacyLeaf = m.leaf
this.rightsFromLegacyTab4 = !!m.legacyRightsAll
this.$nextTick(() => { this.$nextTick(() => {
this.isApplyingRoute = false this.isApplyingRoute = false
}) })
......
export const ORDER_LIST_DETAIL_TAG_PATHS = {
orderDetail: "/orderDetail",
carDamageDetail: "/carDamageDetail",
crowdfundDetail: "/crowdfundDetail",
configUpgradationDetail: "/configUpgradationDetail",
};
/**
* 从订单列表相关详情返回列表(保留 keep-alive 缓存,不关闭列表 Tab)
* @param {import('vue-router').default} router
* @param {Function} close - d2admin/page/close
* @param {{ detailTagPath?: string }} [options]
*/
export function navigateBackToOrderList(router, close, options = {}) {
const { detailTagPath = ORDER_LIST_DETAIL_TAG_PATHS.orderDetail } = options;
close({ tagName: detailTagPath });
router.push({ name: "orderList" });
}
/**
* 从 orderDetail / carDamageDetail 返回
* @param {import('vue-router').default} router
* @param {Function} close
* @param {{ fromSupplement?: boolean, detailTagPath?: string }} [options]
*/
export function navigateBackFromOrderDetail(router, close, options = {}) {
const {
fromSupplement = false,
detailTagPath = ORDER_LIST_DETAIL_TAG_PATHS.orderDetail,
} = options;
if (fromSupplement) {
close({ tagName: "/orderSupplement" });
router.push({ name: "orderSupplement" });
} else {
router.push({ name: "orderList" });
}
close({ tagName: detailTagPath });
}
import { resolveTabPaneFromParams } from "./orderListRouteParams";
/** 订单列表相关详情页路由 name */
export const ORDER_LIST_DETAIL_ROUTE_NAMES = [
"orderDetail",
"carDamageDetail",
"crowdfundDetail",
"configUpgradationDetail",
];
/**
* @param {object} [route]
* @returns {boolean}
*/
export function isOrderListDetailRoute(route) {
return !!(route && ORDER_LIST_DETAIL_ROUTE_NAMES.includes(route.name));
}
/**
* 是否应在 $route 变化时重新 apply 路由参数并拉取场景
* @param {object} to
* @param {object} [from]
* @returns {boolean}
*/
export function shouldReapplyRouteParams(to, from) {
if (!to || to.name !== "orderList") {
return false;
}
if (from && isOrderListDetailRoute(from)) {
return false;
}
const query = to.query || {};
if (query.customerName || query.customerPhone) {
return true;
}
return resolveTabPaneFromParams(to.params || {}) != null;
}
/** 旧版 tabPane name -> 一级 + 二级;4 需保留原「不预选所属业务」 */
export const LEGACY_TAB_PANE = {
1: { category: "light", leaf: "l-1-1" },
2: { category: "light", leaf: "l-1-2" },
3: { category: "light", leaf: "l-1-3" },
4: { category: "rights", leaf: "l-2-1", legacyRightsAll: true },
5: { category: "renewal", leaf: "l-3-1" },
};
export const LEGACY_LABEL_TO_PANE = {
order: "1",
"config-upgradation": "2",
"crowd-funding": "3",
carDamage: "4",
"integral-shopping": "5",
};
/**
* 从路由 params 解析 tabPane 键
* @param {object} [params]
* @returns {string|null}
*/
export function resolveTabPaneFromParams(params) {
if (!params) {
return null;
}
let pane = params.tabPane;
const label = params.tabLabel;
if (pane == null || pane === "") {
if (
label != null
&& label !== ""
&& Object.prototype.hasOwnProperty.call(LEGACY_LABEL_TO_PANE, label)
) {
pane = LEGACY_LABEL_TO_PANE[label];
} else {
return null;
}
}
return String(pane);
}
/**
* 根据路由 params 计算 orderList 壳层应更新的状态片段
* @param {object} [params]
* @returns {object|null}
*/
export function computeRouteParamPatch(params) {
const key = resolveTabPaneFromParams(params);
if (!key) {
return null;
}
const mapping = LEGACY_TAB_PANE[key];
if (!mapping) {
return null;
}
return {
activeCategory: mapping.category,
pendingLegacyLeaf: mapping.leaf,
rightsFromLegacyTab4: !!mapping.legacyRightsAll,
isApplyingRoute: true,
};
}
const SALES_TYPE_MAP = {
0: "销售端引流 - 售前",
1: "门店引流 - 售后",
2: "自然到店",
3: "交付端引流 - 售前",
};
const ORDER_SOURCE_MAP = {
7: "系统导入",
12: "冀联小程序",
};
const CAR_DAMAGE_SALES_TYPE_MAP = {
0: "门店引流 - 售前",
1: "门店引流 - 售后",
2: "自然到店",
};
/**
* @param {string} [text]
* @param {number} [maxLen]
* @returns {string}
*/
export function truncateDisplay(text, maxLen = 10) {
if (!text) {
return "-";
}
return text.length > maxLen ? `${text.substring(0, maxLen)}...` : text;
}
/**
* @param {object} [item]
* @returns {string}
*/
export function getGoodsTypeName(item) {
const {
upgradeGoodsTypeName,
upgradeSecondaryGoodsTypeName,
upgradeThirdLevelGoodsTypeName,
} = item || {};
return [
upgradeGoodsTypeName,
upgradeSecondaryGoodsTypeName,
upgradeThirdLevelGoodsTypeName,
].filter(Boolean).join("-");
}
/**
* @param {object} item
* @param {Array<{ position: string|number, confName: string }>} positionTypeList
* @returns {object}
*/
export function mapSubOrderDisplayItem(item, positionTypeList) {
const goodsTypeFull = getGoodsTypeName(item);
const goodsNameFull = item.upgradeGoodsId
? (item.upgradeGoodsName || "-")
: (item.baseGoodsName || "-");
const unitPrice = item.upgradeGoodsId
? item.upgradePrice
: item.baseRetailPrice;
const salesPrice = item.upgradeGoodsId
? item.singleProductSalesPrice
: item.baseRetailPrice;
const finalUnitPrice = item.upgradeGoodsId
? item.singleProductFinalPrice
: item.baseRetailPrice;
const positionStr = positionTypeList?.filter(
sub => String(sub?.position) === String(item?.upgradeGoodsPosition),
)[0]?.confName || item.positionStr || "-";
return {
...item,
positionStr,
goodsNameFull,
goodsNameDisplay: truncateDisplay(goodsNameFull),
goodsTypeFull,
goodsTypeDisplay: truncateDisplay(goodsTypeFull),
unitPriceDisplay: unitPrice != null ? `¥ ${unitPrice}` : "-",
salesPriceDisplay: salesPrice != null ? `¥ ${salesPrice}` : "-",
finalUnitPriceDisplay: finalUnitPrice != null ? `¥ ${finalUnitPrice}` : "-",
numberDisplay: item.upgradeGoodsId ? String(item.number ?? "-") : "-",
discountDisplay: `¥${item.discountAmount || 0}`,
warrantyDisplay: item.upgradeWarrantyPeriod
? `${item.upgradeWarrantyPeriod}年`
: "无",
aliasDisplay: item.upgradeGoodsAlias || "-",
};
}
/**
* @param {object} row
* @param {object} ctx
* @param {object} ctx.maps
* @returns {object}
*/
export function mapOrderListRow(row, ctx) {
const {
statusOpts = {},
upgradeOpts = {},
profitAllocationStatusOpts = {},
invoiceStatusOpts = {},
saleFlagTextObj = {},
djOrderTypeMap = {},
auditStatusMap = {},
positionTypeList = [],
} = ctx.maps || {};
const subOrderDisplayList = (row.subOrderList || []).map(item =>
mapSubOrderDisplayItem(item, positionTypeList),
);
const packageNamesDisplay = (row.packageGoodsList || [])
.map(p => p.packageName)
.filter(Boolean)
.join("、");
const carParts = [
row.carBrand,
row.carChildsBrandName ? `-${row.carChildsBrandName}` : "",
row.carSeriesName ? `-${row.carSeriesName}` : "",
].filter(Boolean);
const carTypeDisplay = carParts.join("") || "-";
let refundDetailDisplay = "-";
if (row.status == 12) {
const typeLabel = row.refundType == "1" ? "退全款" : "退部分款";
refundDetailDisplay = `${typeLabel} ¥${row.refundAmount || 0}`;
}
const salesTypeNum = Number(row.salesType);
const salesTypeLabel = SALES_TYPE_MAP[salesTypeNum] !== undefined
? SALES_TYPE_MAP[salesTypeNum]
: "-";
return {
...row,
paySuccessDate: row.paySuccessDate || "",
subOrderDisplayList,
packageNamesDisplay: packageNamesDisplay || "-",
djOrderTypeLabel: row.djOrderType ? (djOrderTypeMap[row.djOrderType] || "-") : "-",
goodsOrderApplyStatusLabel: row.goodsOrderApplyStatus
? (auditStatusMap[row.goodsOrderApplyStatus] || "-")
: "-",
incorrectOrderCodeDisplay: row.incorrectOrderCode || "-",
customerSexLabel: row.customerSex == 1 ? "男" : "女",
carTypeDisplay,
upgradeFlagLabel: row.upgradeFlag
? (upgradeOpts[row.upgradeFlag] || "待升级")
: "待升级",
statusLabel: statusOpts[row.status] || "-",
profitAllocationStatusLabel:
profitAllocationStatusOpts[row.profitAllocationStatus] || "-",
invoiceStatusLabel: invoiceStatusOpts[row.invoiceStatus] || "-",
totalPriceDisplay: row.totalPrice != null ? `¥${row.totalPrice}` : "",
finalPriceDisplay: row.finalPrice != null ? `¥${row.finalPrice}` : "",
refundDetailDisplay,
directSalesFlagLabel: row.directSalesFlag != null
? (saleFlagTextObj[row.directSalesFlag] || "-")
: "-",
subShopMerchantNameDisplay: row.subShopMerchantName || "-",
orderSourceLabel: ORDER_SOURCE_MAP[row.source] || "小程序订单",
salesTypeLabel,
subOrderCount: subOrderDisplayList.length,
};
}
/**
* @param {object} opt
* @returns {string}
*/
function rightsSceneRowLabel(opt) {
if (!opt) return "-";
return opt.name || opt.subTypeName || opt.num || opt.baseSceneCode || "-";
}
/**
* @param {object} [row]
* @param {Array<object>} [sceneList]
* @returns {string}
*/
export function resolveRightsSceneLabel(row, sceneList) {
if (row == null) return "-";
const key = String(row.baseSceneCode == null ? "" : row.baseSceneCode).trim();
if (key) {
const list = sceneList || [];
const opt = list.find(
s => String((s && s.baseSceneCode) || "").trim() === key,
);
if (opt) return rightsSceneRowLabel(opt);
return key;
}
const nm = row.baseSceneName != null ? row.baseSceneName : row.sceneName;
if (nm != null && String(nm).trim() !== "") return String(nm).trim();
return "-";
}
/**
* @param {object} item
* @param {Array<{ position: string|number, confName: string }>} positionTypeList
* @returns {object}
*/
export function mapCarDamageSubOrderDisplayItem(item, positionTypeList) {
const base = mapSubOrderDisplayItem(item, positionTypeList);
const packageAliasFull = item.packageAlias || "";
const couponNameFull = item.coupon?.couponName || "";
return {
...base,
packageNameDisplay: item.packageName || "-",
packageAliasFull,
packageAliasDisplay: truncateDisplay(packageAliasFull),
couponCodeDisplay: item.coupon?.customerCouponCode || "-",
couponNameFull,
couponNameDisplay: couponNameFull ? truncateDisplay(couponNameFull) : "-",
couponAmountDisplay: item.coupon?.discountPrice != null
? String(item.coupon.discountPrice)
: "-",
};
}
/**
* @param {object} row
* @param {object} ctx
* @param {object} ctx.maps
* @returns {object}
*/
export function mapCarDamageListRow(row, ctx) {
const {
statusOpts = {},
upgradeOpts = {},
profitAllocationStatusOpts = {},
invoiceStatusOpts = {},
saleFlagTextObj = {},
djOrderTypeMap = {},
auditStatusMap = {},
positionTypeList = [],
rightsSceneListForSearch = [],
zyVoucherStatusOpts = {},
} = ctx.maps || {};
const subOrderDisplayList = (row.subOrderList || []).map(item =>
mapCarDamageSubOrderDisplayItem(item, positionTypeList),
);
const carParts = [
row.carBrand,
row.carChildsBrandName ? `-${row.carChildsBrandName}` : "",
row.carSeriesName ? `-${row.carSeriesName}` : "",
].filter(Boolean);
const carTypeDisplay = carParts.join("") || "-";
let refundDetailDisplay = "-";
if (row.status == 12) {
const typeLabel = row.refundType == "1" ? "退全款" : "退部分款";
refundDetailDisplay = `${typeLabel} ¥${row.refundAmount || 0}`;
}
const salesTypeNum = Number(row.salesType);
const salesTypeLabel = CAR_DAMAGE_SALES_TYPE_MAP[salesTypeNum] !== undefined
? CAR_DAMAGE_SALES_TYPE_MAP[salesTypeNum]
: "-";
let customerSexLabel = "-";
if (row.customerSex) {
customerSexLabel = row.customerSex == 1 ? "男" : "女";
}
return {
...row,
paySuccessDate: row.paySuccessDate || "",
subOrderDisplayList,
djOrderTypeLabel: row.djOrderType ? (djOrderTypeMap[row.djOrderType] || "-") : "-",
goodsOrderApplyStatusLabel: row.goodsOrderApplyStatus
? (auditStatusMap[row.goodsOrderApplyStatus] || "-")
: "-",
incorrectOrderCodeDisplay: row.incorrectOrderCode || "-",
rightsSceneDisplayLabel: resolveRightsSceneLabel(
row,
rightsSceneListForSearch,
),
customerSexLabel,
carTypeDisplay,
upgradeFlagLabel: row.upgradeFlag
? (upgradeOpts[row.upgradeFlag] || "待升级")
: "待升级",
statusLabel: statusOpts[row.status] || "-",
profitAllocationStatusLabel:
profitAllocationStatusOpts[row.profitAllocationStatus] || "-",
invoiceStatusLabel: invoiceStatusOpts[row.invoiceStatus] || "-",
zyVoucherStatusLabel: zyVoucherStatusOpts[row.zyVoucherStatus] || "-",
totalPriceDisplay: row.totalPrice != null ? `¥${row.totalPrice}` : "",
finalPriceDisplay: row.finalPrice != null ? `¥${row.finalPrice}` : "",
refundDetailDisplay,
directSalesFlagLabel: row.directSalesFlag != null
? (saleFlagTextObj[row.directSalesFlag] || "-")
: "-",
subShopMerchantNameDisplay: row.subShopMerchantName || "-",
orderSourceLabel: ORDER_SOURCE_MAP[row.source] || "小程序订单",
salesTypeLabel,
subOrderCount: subOrderDisplayList.length,
};
}
...@@ -10,8 +10,7 @@ export const JOURNAL_TABS = [ ...@@ -10,8 +10,7 @@ export const JOURNAL_TABS = [
{ key: "negotiation", label: "洽谈明细", journalType: 3 }, { key: "negotiation", label: "洽谈明细", journalType: 3 },
]; ];
export const BIZ_TYPE_TOOLTIP = export const BIZ_TYPE_TOOLTIP = "轻改:1.1精品升级、1.2次新车升配、1.3售后众筹;权益:2.1.1售前会员权益升级、2.1.2售后会员权益升级、2.3.1售前延保、2.3.2售后延保";
"场景所属业务大类,目前「轻改」包含「1.1精品升级、1.2次新车升配、1.3售后众筹」,「权益」包含「2.1.1售前会员权益升级、2.1.2售后会员权益升级、2.3.1售前延保、2.3.2售后延保」";
export const BIZ_TYPE_STYLE = { export const BIZ_TYPE_STYLE = {
1: { label: "轻改", bg: "#E8F3FF", color: "#1677FF" }, 1: { label: "轻改", bg: "#E8F3FF", color: "#1677FF" },
...@@ -33,12 +32,12 @@ export const LIST_API_MAP = { ...@@ -33,12 +32,12 @@ export const LIST_API_MAP = {
}; };
export function getTemplateTypeByTabKey(tabKey) { export function getTemplateTypeByTabKey(tabKey) {
const tab = JOURNAL_TABS.find((item) => item.key === tabKey); const tab = JOURNAL_TABS.find(item => item.key === tabKey);
return tab?.journalType ?? 1; return tab?.journalType ?? 1;
} }
export function getTabKeyByTemplateType(templateType) { export function getTabKeyByTemplateType(templateType) {
const tab = JOURNAL_TABS.find((item) => item.journalType === templateType); const tab = JOURNAL_TABS.find(item => item.journalType === templateType);
return tab?.key ?? "staffDaily"; return tab?.key ?? "staffDaily";
} }
...@@ -50,7 +49,10 @@ const bizTypeColumn = { ...@@ -50,7 +49,10 @@ const bizTypeColumn = {
minWidth: "100px", minWidth: "100px",
width: "100px", width: "100px",
addHtml: "bizType", addHtml: "bizType",
isPopConfig: { text: BIZ_TYPE_TOOLTIP }, isPopConfig: {
width: 320,
text: BIZ_TYPE_TOOLTIP,
},
}; };
function createDateTimeColumn(label, prop) { function createDateTimeColumn(label, prop) {
...@@ -58,7 +60,7 @@ function createDateTimeColumn(label, prop) { ...@@ -58,7 +60,7 @@ function createDateTimeColumn(label, prop) {
label, label,
prop, prop,
minWidth: "170px", minWidth: "170px",
formatter: (row) => formatJournalDateTime(row[prop]), formatter: row => formatJournalDateTime(row[prop]),
}; };
} }
...@@ -95,7 +97,7 @@ export const TABLE_COLUMNS_MAP = { ...@@ -95,7 +97,7 @@ export const TABLE_COLUMNS_MAP = {
label: "今日驻店人数", label: "今日驻店人数",
prop: "staffCount", prop: "staffCount",
width: "120px", width: "120px",
formatter: (row) => (row.staffCount != null ? `${row.staffCount}人` : "—"), formatter: row => (row.staffCount != null ? `${row.staffCount}人` : "—"),
}, },
createDateTimeColumn("最近保存时间", "lastSaveTime"), createDateTimeColumn("最近保存时间", "lastSaveTime"),
createDateTimeColumn("提交时间", "submitTime"), createDateTimeColumn("提交时间", "submitTime"),
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="first-box flex"> <div class="first-box flex">
<template v-for="(item, index) in fourFormObj"> <template v-for="(item, index) in fourFormObj">
<div class="item first-form-item" :key="index"> <div class="item first-form-item" :key="index">
<div class="label">{{ item.name }}:</div> <div :class="['label',{required:!isViewMode}]">{{ item.name }}:</div>
<template v-if="isViewMode">{{ getSelectText(item, componentData.pointsConfig) }}</template> <template v-if="isViewMode">{{ getSelectText(item, componentData.pointsConfig) }}</template>
<el-select :size="size" v-model="componentData.pointsConfig[item.key]" class="step-select" <el-select :size="size" v-model="componentData.pointsConfig[item.key]" class="step-select"
:disabled="disabled" v-else> :disabled="disabled" v-else>
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<div class="form-box"> <div class="form-box">
<template v-for="(item, index) in fourFormTwoObj"> <template v-for="(item, index) in fourFormTwoObj">
<el-form-item :label="item.name + ':'" :key="index" :prop="item.key"> <el-form-item :label="item.name + ':'" :key="index" :prop="isViewMode ? '' : (item.inputKey || item.key)">
<template v-if="item.type == 'addHtml'"> <template v-if="item.type == 'addHtml'">
{{ formateData(componentData.productCategoryRules[productCategoryIndex][item.key]) }} {{ formateData(componentData.productCategoryRules[productCategoryIndex][item.key]) }}
</template> </template>
...@@ -254,13 +254,13 @@ export default { ...@@ -254,13 +254,13 @@ export default {
getExpenseCategoryCalculateTypeOptions(targetType) { getExpenseCategoryCalculateTypeOptions(targetType) {
let options = []; let options = [];
if (targetType === 1) { if (targetType === 1) {
options = this.options.expenseCategoryOther; options = deepClone(this.options.expenseCategoryOther);
} }
if (targetType === 2) { if (targetType === 2) {
options = this.options.expenseCategoryServer; options = deepClone(this.options.expenseCategoryServer);
} }
if (targetType === 3) { if (targetType === 3) {
options = this.options.expenseCategoryDefault; options = deepClone(this.options.expenseCategoryDefault);
} }
options.forEach((item) => { options.forEach((item) => {
item.expenseCategoryCalculateType = String(item.expenseCategoryCalculateType); item.expenseCategoryCalculateType = String(item.expenseCategoryCalculateType);
...@@ -362,6 +362,9 @@ export default { ...@@ -362,6 +362,9 @@ export default {
color: #333333; color: #333333;
font-size: 14px; font-size: 14px;
}
.required{
&::before { &::before {
content: '*'; content: '*';
color: #F56C6C; color: #F56C6C;
......
...@@ -192,7 +192,7 @@ export default { ...@@ -192,7 +192,7 @@ export default {
watch: { watch: {
'infoForm.baseSceneCode': { 'infoForm.baseSceneCode': {
handler(val) { handler(val) {
if (this.options.sceneTypeOpts && this.options.sceneTypeOpts.length && val.length) { if (val.length) {
let { sceneFiles } = this.infoForm let { sceneFiles } = this.infoForm
this.infoForm.sceneFiles = val.map(baseSceneCode => { this.infoForm.sceneFiles = val.map(baseSceneCode => {
let file = sceneFiles.find(file => file.baseSceneCode == baseSceneCode) let file = sceneFiles.find(file => file.baseSceneCode == baseSceneCode)
......
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
expenseCategoryMap: { expenseCategoryMap: {
1: '流量费', 1: '流量费',
2: '服务商分润', 2: '服务商分润',
302: '资源费', 1301: '资源费',
1300: '其他费用', 1300: '其他费用',
3: '产品成本', 3: '产品成本',
4: '手续费', 4: '手续费',
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<div> <div>
<SplitPayment :disabled="disabled || isViewMode" :list="componentData.divisionRuleAutos" /> <SplitPayment :disabled="disabled || isViewMode" :list="componentData.divisionRuleAutos" />
<div class="item"> <div class="item">
<div class="label">流量方分账方:</div> <div :class="['label',{required:!isViewMode}]">流量方分账方:</div>
<template v-if="componentData.autoDivideConfig">
<template v-if="shelfType == 1"> <template v-if="shelfType == 1">
<template v-if="isViewMode"> <template v-if="isViewMode">
{{ componentData.autoDivideConfig.realityShopMerchantName || '-' }} {{ componentData.autoDivideConfig.realityShopMerchantName || '-' }}
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</template> </template>
<template v-else> <template v-else>
<template v-if="isViewMode"> <template v-if="isViewMode">
{{ getRealityShopLevelName(componentData.autoDivideConfig.realityShopLevel) }} {{ getRealityShopLevelName(componentData) }}
</template> </template>
<el-select v-else :size="size" v-model="componentData.autoDivideConfig.realityShopLevel" class="step-select"> <el-select v-else :size="size" v-model="componentData.autoDivideConfig.realityShopLevel" class="step-select">
<el-option v-for="item in options.realityShopLevelOptions" :key="item.realityShopLevel" <el-option v-for="item in options.realityShopLevelOptions" :key="item.realityShopLevel"
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
</el-option> </el-option>
</el-select> </el-select>
</template> </template>
</template>
</div> </div>
<div class="step-title flex"> <div class="step-title flex">
品类名称 品类名称
...@@ -43,7 +44,7 @@ ...@@ -43,7 +44,7 @@
<div class="form-box"> <div class="form-box">
<template v-for="(item, index) in threeFormObj"> <template v-for="(item, index) in threeFormObj">
<el-form-item :label="item.name + ':'" :key="index" :prop="item.inputKey || item.key"> <el-form-item :label="item.name + ':'" :key="index" :prop="isViewMode ? '' : (item.inputKey || item.key)">
<template v-if="item.type == 'addHtml'"> <template v-if="item.type == 'addHtml'">
<template v-if="item.htmlName == 'RemoteSelect'"> <template v-if="item.htmlName == 'RemoteSelect'">
<div class="remote-select"> <div class="remote-select">
...@@ -116,6 +117,7 @@ import { ...@@ -116,6 +117,7 @@ import {
otherSelectOptions, otherSelectOptions,
severSelectOptions, severSelectOptions,
} from "@/common/constant/merchant"; } from "@/common/constant/merchant";
import { deepClone } from "@/common/util";
import VenusNumberInput from "@/components/venusNumberInput/index.vue"; import VenusNumberInput from "@/components/venusNumberInput/index.vue";
import { realityShopLevelOptions } from "@/views/goods/shelfProduct/constant/index"; import { realityShopLevelOptions } from "@/views/goods/shelfProduct/constant/index";
import { getSingleRealityShopMerchantOptions, getProfitSharingBaseDetail } from "@/views/goods/shelfProduct/components/profitSharingConfig/hooks"; import { getSingleRealityShopMerchantOptions, getProfitSharingBaseDetail } from "@/views/goods/shelfProduct/components/profitSharingConfig/hooks";
...@@ -320,13 +322,13 @@ export default { ...@@ -320,13 +322,13 @@ export default {
getExpenseCategoryCalculateTypeOptions(targetType) { getExpenseCategoryCalculateTypeOptions(targetType) {
let options = []; let options = [];
if (targetType === 1) { if (targetType === 1) {
options = this.options.expenseCategoryOther; options = deepClone(this.options.expenseCategoryOther);
} }
if (targetType === 2) { if (targetType === 2) {
options = this.options.expenseCategoryServer; options = deepClone(this.options.expenseCategoryServer);
} }
if (targetType === 3) { if (targetType === 3) {
options = this.options.expenseCategoryDefault; options = deepClone(this.options.expenseCategoryDefault);
} }
options.forEach((item) => { options.forEach((item) => {
item.expenseCategoryCalculateType = String(item.expenseCategoryCalculateType); item.expenseCategoryCalculateType = String(item.expenseCategoryCalculateType);
...@@ -345,8 +347,9 @@ export default { ...@@ -345,8 +347,9 @@ export default {
const option = i.options.find(item => item.value === value), const option = i.options.find(item => item.value === value),
selectOptions = this.getExpenseCategoryCalculateTypeOptions(i.targetType), selectOptions = this.getExpenseCategoryCalculateTypeOptions(i.targetType),
selectValue = selectOptions.find(item => item.expenseCategoryCalculateType == data[i.selectKey]), selectValue = selectOptions.find(item => item.expenseCategoryCalculateType == data[i.selectKey]),
unit = [3, 10].includes(Number(data[i.selectKey])) ? '元' : '%' unit = [3, 10].includes(Number(data[i.selectKey])) ? '元' : '%',
return `${option?.label}&nbsp;&nbsp;&nbsp;&nbsp;${selectValue?.label}:${data[i.inputKey]}${unit}` label = selectValue?.label ? `${selectValue?.label}:` : ''
return `${option?.label || ''}&nbsp;&nbsp;&nbsp;&nbsp;${label}${data[i.inputKey] || ''}${data[i.inputKey] ? (unit || '') : ''}`
}, },
handleSelectChange(val, item) { handleSelectChange(val, item) {
this.componentData.productCategoryRules[this.productCategoryIndex][item.inputKey] = '' this.componentData.productCategoryRules[this.productCategoryIndex][item.inputKey] = ''
...@@ -419,7 +422,9 @@ export default { ...@@ -419,7 +422,9 @@ export default {
this.$set(this.componentData, 'autoDivideConfig', autoDivideConfig); this.$set(this.componentData, 'autoDivideConfig', autoDivideConfig);
}, },
getRealityShopLevelName(realityShopLevel) { getRealityShopLevelName(i) {
let realityShopLevel = i?.autoDivideConfig?.realityShopLevel
if(realityShopLevel == null || realityShopLevel == undefined || realityShopLevel == '') return '-'
return this.options.realityShopLevelOptions.find(item => item.realityShopLevel == realityShopLevel)?.realityShopLevelName || '-' return this.options.realityShopLevelOptions.find(item => item.realityShopLevel == realityShopLevel)?.realityShopLevelName || '-'
} }
} }
...@@ -463,6 +468,9 @@ export default { ...@@ -463,6 +468,9 @@ export default {
color: #333333; color: #333333;
}
.required {
&::before { &::before {
content: '*'; content: '*';
color: #F56C6C; color: #F56C6C;
......
...@@ -105,7 +105,7 @@ export default { ...@@ -105,7 +105,7 @@ export default {
if (val && val.length) { if (val && val.length) {
this.guaranteeConfigs = val this.guaranteeConfigs = val
} else { } else {
this.guaranteeConfigs = [{ if(!this.isViewMode) this.guaranteeConfigs = [{
guaranteeIndex: '', guaranteeIndex: '',
guaranteeStandard: null, guaranteeStandard: null,
compensationMode: 0 compensationMode: 0
...@@ -123,7 +123,6 @@ export default { ...@@ -123,7 +123,6 @@ export default {
guaranteeConfigs.map(item => { guaranteeConfigs.map(item => {
if(item.guaranteeIndex) includesConditionList.push(item.guaranteeIndex) if(item.guaranteeIndex) includesConditionList.push(item.guaranteeIndex)
}) })
console.log(includesConditionList)
return includesConditionList return includesConditionList
}, },
}, },
......
...@@ -156,9 +156,9 @@ export default { ...@@ -156,9 +156,9 @@ export default {
immediate: true immediate: true
}, },
'componentData.guaranteeStandard': { 'componentData.guaranteeStandard': {
handler(val) { handler(val, oldVal) {
if(val == oldVal) return
let { ladderConditions } = this let { ladderConditions } = this
if (!ladderConditions.length) {
ladderConditions.map(e => { ladderConditions.map(e => {
e.startValue = '' e.startValue = ''
e.endValue = '' e.endValue = ''
...@@ -166,7 +166,6 @@ export default { ...@@ -166,7 +166,6 @@ export default {
e.bError = false e.bError = false
}) })
this.$set(this, 'ladderConditions', ladderConditions) this.$set(this, 'ladderConditions', ladderConditions)
}
}, },
deep: true deep: true
}, },
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</div> </div>
<div class="step-content"> <div class="step-content">
<div :class="['step-title', { top54: trafficPartyConfigs.length > 1 }]">对账配置</div> <div :class="['step-title', { top54: trafficPartyConfigs.length > 1 }]">对账配置</div>
<StepFourForm :isViewMode="isViewMode" :currentItem="currentReconciliationSceneConfigs" /> <StepFourForm :isViewMode="isViewMode" :currentItem="currentReconciliationSceneConfigs" :baseSceneCode="baseSceneCode" />
</div> </div>
<div class="step-content"> <div class="step-content">
<div class="step-title ">操作记录</div> <div class="step-title ">操作记录</div>
...@@ -212,9 +212,9 @@ export default { ...@@ -212,9 +212,9 @@ export default {
baseSceneName: i.baseSceneName baseSceneName: i.baseSceneName
} }
i.trafficPartyDetails.map(item => { i.trafficPartyDetails.map(item => {
let label = `流量方:${item.trafficPartyName}`, let label = i.trafficPartyDetails.length > 1 ? `流量方:【${item.trafficPartyName}】` : '',
judgment = shelfType == 1 ? i.baseSceneCode != baseSceneCode : item.trafficPartyId != trafficPartyId judgment = shelfType == 1 ? i.baseSceneCode != baseSceneCode : item.trafficPartyId != trafficPartyId
if (shelfType == 1) label = `场景:${i.baseSceneName}` if (shelfType == 1 && trafficPartyConfigs.length > 1) label = `场景:【${i.baseSceneName}】`
if (judgment) { if (judgment) {
rulesKeys.map(key => { rulesKeys.map(key => {
if (item[key] === undefined || item[key] === null) { if (item[key] === undefined || item[key] === null) {
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<div class="detail-box view" v-loading="true"></div> <div class="detail-box view" v-loading="true"></div>
</template> </template>
<div class="fixed-btn-box flex"> <div class="fixed-btn-box flex">
<template v-if="buttonComplete">
<template v-if="pageComplete"> <template v-if="pageComplete">
<el-button v-if="pageType == 'audit' && step == 4" type="primary" @click="rejectDialogVisible = true" <el-button v-if="pageType == 'audit' && step == 4" type="primary" @click="rejectDialogVisible = true"
plain>驳回</el-button> plain>驳回</el-button>
...@@ -32,6 +33,7 @@ ...@@ -32,6 +33,7 @@
</template> </template>
<el-button v-if="!buttonLoading" @click="$router.go(-1)" plain type="info">{{ pageType == 'view' ? '返回' : '取消' <el-button v-if="!buttonLoading" @click="$router.go(-1)" plain type="info">{{ pageType == 'view' ? '返回' : '取消'
}}</el-button> }}</el-button>
</template>
</div> </div>
<el-dialog :close-on-click-modal="false" :show-close="false" title="提示" :visible.sync="dialogVisible" width="40%" <el-dialog :close-on-click-modal="false" :show-close="false" title="提示" :visible.sync="dialogVisible" width="40%"
...@@ -166,7 +168,8 @@ export default { ...@@ -166,7 +168,8 @@ export default {
buttonLoading: false, buttonLoading: false,
rejectDialogVisible: false, rejectDialogVisible: false,
rejectReason: '', rejectReason: '',
basicinformationData: {} basicinformationData: {},
buttonComplete:false
} }
}, },
watch: { watch: {
...@@ -221,6 +224,7 @@ export default { ...@@ -221,6 +224,7 @@ export default {
step = isPrevStep ? STEP - 1 : (updStep ? updStep + 1 : 2) step = isPrevStep ? STEP - 1 : (updStep ? updStep + 1 : 2)
this.basicinformationData = data this.basicinformationData = data
let basicinformationFormList = JSON.parse(basicApproveInfo) let basicinformationFormList = JSON.parse(basicApproveInfo)
this.buttonComplete = false
if (pageType != 'reapply') { if (pageType != 'reapply') {
if (pageType == 'view') { if (pageType == 'view') {
this.step = 2 this.step = 2
...@@ -280,6 +284,9 @@ export default { ...@@ -280,6 +284,9 @@ export default {
this.stepOneRef.init(shelfType, infoForm) this.stepOneRef.init(shelfType, infoForm)
}) })
} }
setTimeout(() => {
this.buttonComplete = true
}, 500)
}, },
...@@ -302,6 +309,7 @@ export default { ...@@ -302,6 +309,7 @@ export default {
} else this.pageComplete = true } else this.pageComplete = true
} else throw '获取模板信息失败' } else throw '获取模板信息失败'
this.buttonComplete = true
} catch (error) { } catch (error) {
this.$message.error(error) this.$message.error(error)
} }
...@@ -396,8 +404,7 @@ export default { ...@@ -396,8 +404,7 @@ export default {
if (params) this.$message.error(params) if (params) this.$message.error(params)
} }
}) })
} } else if (step == 3) {
else if (step == 3) {
this.stepThreeRef.validate(async (valid, params) => { this.stepThreeRef.validate(async (valid, params) => {
if (valid) { if (valid) {
params.businessCode = businessCode params.businessCode = businessCode
...@@ -480,13 +487,13 @@ export default { ...@@ -480,13 +487,13 @@ export default {
} }
.layout { .layout {
height: calc(100vh - 113px); height: calc(100vh - 124px);
// padding: 0 24px; // padding: 0 24px;
box-sizing: border-box; box-sizing: border-box;
.detail-box { .detail-box {
position: relative; position: relative;
height: calc(100% - 190px); height: calc(100% - 178px);
.detail { .detail {
height: 100%; height: 100%;
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<div slot="auth-button" <div slot="auth-button"
slot-scope="scope" slot-scope="scope"
class="btnClass"> class="btnClass">
<template v-if="scope.scope.payPlatform == 'ysepay'"> <template v-if="scope.scope.accountStatus != 1">
<auth-button slot="auth-button" <auth-button slot="auth-button"
:data="scope.scope" :data="scope.scope"
:show-btn-ids="['9061007']" /> :show-btn-ids="['9061007']" />
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
:data="scope.scope" :data="scope.scope"
:show-btn-ids="['9061008']" /> :show-btn-ids="['9061008']" />
<!-- 未签约 --> <!-- 未签约 -->
<auth-button v-if="scope.scope.withdrawSignStatus == 1" <auth-button v-if="scope.scope.withdrawSignStatus == 1 && scope.scope.payPlatform == 'allinpay'"
slot="auth-button" slot="auth-button"
:data="scope.scope" :data="scope.scope"
:show-btn-ids="['9061009']" /> :show-btn-ids="['9061009']" />
......
...@@ -2765,7 +2765,8 @@ export default { ...@@ -2765,7 +2765,8 @@ export default {
} }
::v-deep { ::v-deep {
.el-select__tags { .el-select__tags,
.el-cascader__tags {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
flex-wrap: nowrap; flex-wrap: nowrap;
...@@ -2775,10 +2776,19 @@ export default { ...@@ -2775,10 +2776,19 @@ export default {
align-items: center; align-items: center;
} }
} }
.el-cascader__tags {
.el-tag span {
display: inline-block;
max-width: 240px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.el-select__tags-text { .el-select__tags-text {
display: inline-block; display: inline-block;
max-width: 260px; max-width: 240px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
......
...@@ -61,13 +61,11 @@ ...@@ -61,13 +61,11 @@
]"> ]">
<el-cascader v-model="cascaderGoodsTypes" <el-cascader v-model="cascaderGoodsTypes"
placeholder="请选择品类" placeholder="请选择品类"
style="width: 320px" style="width: 370px"
clearable
collapse-tags collapse-tags
filterable filterable
:options="computedGoodsTypeTreeList" :options="computedGoodsTypeTreeList"
:props="cascaderProps" :props="cascaderProps"
:show-all-levels="false"
@change="onCascaderChange" /> @change="onCascaderChange" />
</el-form-item> </el-form-item>
<el-form-item v-show="classificationObj.categoryType == 2" <el-form-item v-show="classificationObj.categoryType == 2"
...@@ -307,18 +305,19 @@ export default { ...@@ -307,18 +305,19 @@ export default {
} }
}); });
// 1. 处理当前Tab已选路径(同一Tab内的禁用规则) // ⚠️ 同Tab内的禁用规则已注释:不再禁用祖先和后代节点,允许在同一Tab内自由选择
currentPaths.forEach((path) => { // // 1. 处理当前Tab已选路径(同一Tab内的禁用规则)
if (!path || !path.length) { // currentPaths.forEach((path) => {
return; // if (!path || !path.length) {
} // return;
// 禁用该路径的所有祖先(从第0个到倒数第2个) // }
for (let i = 0; i < path.length - 1; i++) { // // 禁用该路径的所有祖先(从第0个到倒数第2个)
shouldDisableValues.add(path[i]); // for (let i = 0; i < path.length - 1; i++) {
} // shouldDisableValues.add(path[i]);
// 禁用该路径的所有后代 // }
this.collectAllDescendantsByPath(tree, path, shouldDisableValues); // // 禁用该路径的所有后代
}); // this.collectAllDescendantsByPath(tree, path, shouldDisableValues);
// });
// 2. 处理其他Tab已选路径(跨Tab禁用规则) // 2. 处理其他Tab已选路径(跨Tab禁用规则)
// 规则:只禁用节点本身(防止重复),父级、子级、兄弟级都可以选 // 规则:只禁用节点本身(防止重复),父级、子级、兄弟级都可以选
......
...@@ -611,9 +611,35 @@ export default { ...@@ -611,9 +611,35 @@ export default {
}, },
/** /**
* 兜底标准输入(按指标类型应用不同规则) * 兜底标准输入(按指标类型应用不同规则)
* 当兜底标准修改时,检查阶梯模式区间,清空大于兜底标准的区间值
*/ */
handleStandardInput(value, item) { handleStandardInput(value, item) {
item.guaranteeStandard = this.formatDecimal(value, this.isRateIndicator(item.guaranteeIndex) ? { min: 0, max: 100, decimalPlaces: 2 } : { min: 0, max: 99999999, decimalPlaces: 2 }); item.guaranteeStandard = this.formatDecimal(value, this.isRateIndicator(item.guaranteeIndex) ? { min: 0, max: 100, decimalPlaces: 2 } : { min: 0, max: 99999999, decimalPlaces: 2 });
// 如果是阶梯模式,检查所有区间值是否大于兜底标准
if (item.compensationMode === 2 && item.ladderConditions && item.ladderConditions.length) {
const standard = Number.parseFloat(item.guaranteeStandard);
// 兜底标准被清空或无效,清空所有阶梯条件
if (Number.isNaN(standard) || standard <= 0 || item.guaranteeStandard === "") {
item.ladderConditions.forEach((ladder) => {
ladder.startValue = "";
ladder.endValue = "";
ladder.compensationAmount = "";
});
return;
}
// 兜底标准有效,清空大于兜底标准的区间值
item.ladderConditions.forEach((ladder) => {
const endValue = Number.parseFloat(ladder.endValue);
if (!Number.isNaN(endValue) && endValue > standard) {
// 清空大于兜底标准的区间值
ladder.startValue = "";
ladder.endValue = "";
ladder.compensationAmount = "";
}
});
}
}, },
/** /**
* 赔付金额输入(0-999999,小数点后 2 位) * 赔付金额输入(0-999999,小数点后 2 位)
...@@ -728,6 +754,14 @@ export default { ...@@ -728,6 +754,14 @@ export default {
callback(new Error("开始值必须小于结束值")); callback(new Error("开始值必须小于结束值"));
return; return;
} }
// 校验区间值不能大于兜底标准
const standard = Number.parseFloat(item.guaranteeStandard);
if (!Number.isNaN(standard) && standard > 0) {
if (startValue > standard) {
callback(new Error(`开始值不能大于兜底标准`));
return;
}
}
// 区间冲突校验:与其他区间是否有重叠 // 区间冲突校验:与其他区间是否有重叠
const conflict = this.checkLadderConflict(item, lIdx, startValue, endValue); const conflict = this.checkLadderConflict(item, lIdx, startValue, endValue);
if (conflict) { if (conflict) {
...@@ -758,6 +792,14 @@ export default { ...@@ -758,6 +792,14 @@ export default {
callback(new Error("结束值必须大于开始值")); callback(new Error("结束值必须大于开始值"));
return; return;
} }
// 校验区间值不能大于兜底标准
const standard = Number.parseFloat(item.guaranteeStandard);
if (!Number.isNaN(standard) && standard > 0) {
if (endValue > standard) {
callback(new Error(`结束值不能大于兜底标准`));
return;
}
}
// 区间冲突校验:与其他区间是否有重叠 // 区间冲突校验:与其他区间是否有重叠
const conflict = this.checkLadderConflict(item, lIdx, startValue, endValue); const conflict = this.checkLadderConflict(item, lIdx, startValue, endValue);
if (conflict) { if (conflict) {
......
...@@ -65,13 +65,11 @@ ...@@ -65,13 +65,11 @@
])"> ])">
<el-cascader v-model="cascaderGoodsTypes" <el-cascader v-model="cascaderGoodsTypes"
placeholder="请选择品类" placeholder="请选择品类"
style="width: 320px" style="width: 370px"
clearable
collapse-tags collapse-tags
filterable filterable
:options="computedGoodsTypeTreeList" :options="computedGoodsTypeTreeList"
:props="cascaderProps" :props="cascaderProps"
:show-all-levels="false"
@change="onCascaderChange" /> @change="onCascaderChange" />
</el-form-item> </el-form-item>
<el-form-item v-show="classificationObj.categoryType == 2" <el-form-item v-show="classificationObj.categoryType == 2"
...@@ -81,7 +79,7 @@ ...@@ -81,7 +79,7 @@
v-el-select-loadmore="interestsLoadmore" v-el-select-loadmore="interestsLoadmore"
placeholder="请选择商品" placeholder="请选择商品"
popper-class="class123" popper-class="class123"
style="width: 320px" style="width: 370px"
value-key="merchantGoodsCode" value-key="merchantGoodsCode"
collapse-tags collapse-tags
filterable filterable
...@@ -1214,18 +1212,19 @@ export default { ...@@ -1214,18 +1212,19 @@ export default {
} }
}); });
// 1. 处理当前Tab已选路径(同一Tab内的禁用规则) // ⚠️ 同Tab内的禁用规则已注释:不再禁用祖先和后代节点,允许在同一Tab内自由选择
currentPaths.forEach((path) => { // // 1. 处理当前Tab已选路径(同一Tab内的禁用规则)
if (!path || !path.length) { // currentPaths.forEach((path) => {
return; // if (!path || !path.length) {
} // return;
// 禁用该路径的所有祖先(从第0个到倒数第2个) // }
for (let i = 0; i < path.length - 1; i++) { // // 禁用该路径的所有祖先(从第0个到倒数第2个)
shouldDisableValues.add(path[i]); // for (let i = 0; i < path.length - 1; i++) {
} // shouldDisableValues.add(path[i]);
// 禁用该路径的所有后代 // }
this.collectAllDescendantsByPath(tree, path, shouldDisableValues); // // 禁用该路径的所有后代
}); // this.collectAllDescendantsByPath(tree, path, shouldDisableValues);
// });
// 2. 处理其他Tab已选路径(跨Tab禁用规则) // 2. 处理其他Tab已选路径(跨Tab禁用规则)
// 规则:只禁用节点本身(防止重复),父级、子级、兄弟级都可以选 // 规则:只禁用节点本身(防止重复),父级、子级、兄弟级都可以选
...@@ -2928,7 +2927,8 @@ export default { ...@@ -2928,7 +2927,8 @@ export default {
} }
::v-deep { ::v-deep {
.el-select__tags { .el-select__tags,
.el-cascader__tags {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
flex-wrap: nowrap; flex-wrap: nowrap;
...@@ -2938,10 +2938,19 @@ export default { ...@@ -2938,10 +2938,19 @@ export default {
align-items: center; align-items: center;
} }
} }
.el-cascader__tags {
.el-tag span {
display: inline-block;
max-width: 240px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.el-select__tags-text { .el-select__tags-text {
display: inline-block; display: inline-block;
max-width: 180px; max-width: 240px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
......
...@@ -167,6 +167,10 @@ import { ...@@ -167,6 +167,10 @@ import {
getStableReconciliationRuleId, getStableReconciliationRuleId,
mergeReconciliationRuleServerFields, mergeReconciliationRuleServerFields,
} from "./utils/reconciliationIncrementalRules"; } from "./utils/reconciliationIncrementalRules";
import {
getReconciliationRuleIndexForTab,
hasPhantomFullCategoryRuleSlot,
} from "./utils/reconciliationRuleTabIndex";
import { applyGoodsTypeGroupRelationBranches } from "./utils/reconciliationRuleBranches"; import { applyGoodsTypeGroupRelationBranches } from "./utils/reconciliationRuleBranches";
import { import {
fillDjGoodsTypeGroupRelations, fillDjGoodsTypeGroupRelations,
...@@ -475,20 +479,11 @@ export default { ...@@ -475,20 +479,11 @@ export default {
* 首条规则为特殊品类时 tab0「全部品类」仅占位,无对应规则行,返回 null(不可按 tab 下标写 rules[0])。 * 首条规则为特殊品类时 tab0「全部品类」仅占位,无对应规则行,返回 null(不可按 tab 下标写 rules[0])。
*/ */
reconciliationRuleIndexForTabIndex(tabIndex) { reconciliationRuleIndexForTabIndex(tabIndex) {
const rules = this.goodsTypeGroupReconciliationRules; return getReconciliationRuleIndexForTab(
if (!Array.isArray(rules) || !rules.length) { this.goodsTypeGroupReconciliationRules,
return tabIndex; tabIndex,
} this.getEffectivePhantomFullCategoryRuleRaw(),
if (rules[0]?.groupType == 1) { );
return tabIndex;
}
if (rules[0]?.groupType == 2) {
if (tabIndex <= 0) {
return null;
}
return tabIndex - 1;
}
return tabIndex;
}, },
/** /**
* live phantom 在 getEffectRule 末尾会清空;与基线比对、resolve、子组件 props 需回落 baseline.phantomFullCategoryRule。 * live phantom 在 getEffectRule 末尾会清空;与基线比对、resolve、子组件 props 需回落 baseline.phantomFullCategoryRule。
...@@ -520,7 +515,10 @@ export default { ...@@ -520,7 +515,10 @@ export default {
* tab0「全部品类」仅占位:首条接口规则为特殊品类时,tab0 无 goodsTypeGroupReconciliationRules 行。 * tab0「全部品类」仅占位:首条接口规则为特殊品类时,tab0 无 goodsTypeGroupReconciliationRules 行。
*/ */
hasPhantomFullCategoryTab() { hasPhantomFullCategoryTab() {
return this.reconciliationRuleIndexForTabIndex(0) == null; return hasPhantomFullCategoryRuleSlot(
this.goodsTypeGroupReconciliationRules,
this.getEffectivePhantomFullCategoryRuleRaw(),
);
}, },
/** /**
* 基线中与 Tab ti 对应的原始规则行(tab0 phantom 用 baseline.phantomFullCategoryRule,否则 rules[ruleIdx])。 * 基线中与 Tab ti 对应的原始规则行(tab0 phantom 用 baseline.phantomFullCategoryRule,否则 rules[ruleIdx])。
...@@ -1400,38 +1398,27 @@ export default { ...@@ -1400,38 +1398,27 @@ export default {
newActiveIndex -= 1; newActiveIndex -= 1;
} }
const goodsTypeGroupRules = this.getAllReconciliationParams();
const upgradeArr = []; const upgradeArr = [];
const packageArr = []; const packageArr = [];
const prevTabsMeta = this.editableTabs.map(t => ({ if (
classificationUserTouched: !!t.classificationUserTouched, ruleIdxRemoved != null
sessionAdded: !!t.sessionAdded, && ruleIdxRemoved < this.goodsTypeGroupReconciliationRules.length
})); ) {
this.editableTabs = []; this.goodsTypeGroupReconciliationRules.splice(ruleIdxRemoved, 1);
goodsTypeGroupRules.splice(removeIdx, 1); }
// this.$set(this.goodsTypeGroupReconciliationRules, goodsTypeGroupRules) tabs.splice(removeIdx, 1);
this.$nextTick(() => { tabs.forEach((tab, index) => {
this.goodsTypeGroupReconciliationRules = goodsTypeGroupRules; this.$set(tab, "title", index ? "特殊品类" + index : "全部品类");
this.$set(tab, "name", (index + 1).toString());
});
const typeList = goodsTypeGroupRules; newActiveIndex = Math.max(0, Math.min(newActiveIndex, tabs.length - 1));
const newLen = typeList.length; this.editableTabsValue = tabs[newActiveIndex].name;
newActiveIndex = Math.max(0, Math.min(newActiveIndex, newLen - 1));
this.editableTabsValue = (newActiveIndex + 1).toString();
typeList.forEach((item, index) => { this.goodsTypeGroupReconciliationRules.forEach((item) => {
const oldIdx = index < removeIdx ? index : index + 1;
const meta = prevTabsMeta[oldIdx];
const classificationUserTouched = !!(meta && meta.classificationUserTouched);
const sessionAdded = !!(meta && meta.sessionAdded);
this.editableTabs[index] = {
title: index ? "特殊品类" + index : "全部品类",
name: (index + 1).toString(),
classificationUserTouched,
sessionAdded,
};
applyGoodsTypeGroupRelationBranches( applyGoodsTypeGroupRelationBranches(
item, item,
this.goodsTypeGroupReconciliationRules[index], item,
upgradeArr, upgradeArr,
packageArr, packageArr,
); );
...@@ -1440,12 +1427,12 @@ export default { ...@@ -1440,12 +1427,12 @@ export default {
this.getSelectingListPackage(packageArr); this.getSelectingListPackage(packageArr);
this.rebuildCrossTabGoodsSelectionsFromRules(); this.rebuildCrossTabGoodsSelectionsFromRules();
this.bumpReconciliationInteractionEpoch(); this.bumpReconciliationInteractionEpoch();
// this.queryFeeCategoryByTypeFlow = deepClone(this.queryFeeCategoryByTypeFlow) await this.$nextTick();
this.$message({ this.$message({
type: "success", type: "success",
message: "删除成功!", message: "删除成功!",
}); });
}); return true;
}, },
deleteGoodsTypeItem(item) { deleteGoodsTypeItem(item) {
......
/**
* “全部品类”没有服务端规则行、但页面保留了草稿快照时,该 Tab 使用独立的 phantom 槽位。
* rules 为空时仍需保留此语义,否则删除最后一个特殊品类后会把全部品类草稿判成空槽位。
*/
export function hasPhantomFullCategoryRuleSlot(rules, phantomRule) {
const list = Array.isArray(rules) ? rules : [];
if (list[0]?.groupType == 1) {
return false;
}
if (list[0]?.groupType == 2) {
return true;
}
return !!(phantomRule && typeof phantomRule === "object");
}
/**
* 页面 Tab 下标转服务端规则数组下标。
* phantom 占用 Tab 0,但不占 rules 数组位置,因此特殊品类需向前偏移一位。
*/
export function getReconciliationRuleIndexForTab(
rules,
tabIndex,
phantomRule,
) {
if (!hasPhantomFullCategoryRuleSlot(rules, phantomRule)) {
return tabIndex;
}
if (tabIndex <= 0) {
return null;
}
return tabIndex - 1;
}
const {
getReconciliationRuleIndexForTab,
hasPhantomFullCategoryRuleSlot,
} = require("./reconciliationRuleTabIndex");
describe("对账规则 Tab 下标映射", () => {
const phantomRule = {
groupType: 1,
expenseCategoryRules: [ { expenseCategoryId: "flow" } ],
};
it("全部品类为占位草稿时,特殊品类从 rules[0] 开始映射", () => {
const rules = [
{ groupType: 2, groupDivisionRuleId: "special-1" },
{ groupType: 2, groupDivisionRuleId: "special-2" },
];
expect(hasPhantomFullCategoryRuleSlot(rules, phantomRule)).toBe(true);
expect(getReconciliationRuleIndexForTab(rules, 0, phantomRule)).toBeNull();
expect(getReconciliationRuleIndexForTab(rules, 1, phantomRule)).toBe(0);
expect(getReconciliationRuleIndexForTab(rules, 2, phantomRule)).toBe(1);
});
it("删除最后一个特殊品类后 rules 为空,仍保留全部品类占位草稿", () => {
const rules = [];
expect(hasPhantomFullCategoryRuleSlot(rules, phantomRule)).toBe(true);
expect(getReconciliationRuleIndexForTab(rules, 0, phantomRule)).toBeNull();
});
it("已有正式全部品类规则时,优先使用 rules[0]", () => {
const rules = [ { groupType: 1, groupDivisionRuleId: "full-1" } ];
expect(hasPhantomFullCategoryRuleSlot(rules, phantomRule)).toBe(false);
expect(getReconciliationRuleIndexForTab(rules, 0, phantomRule)).toBe(0);
});
it("规则和草稿都为空时,全部品类使用可写的 rules[0] 槽位", () => {
expect(hasPhantomFullCategoryRuleSlot([], null)).toBe(false);
expect(getReconciliationRuleIndexForTab([], 0, null)).toBe(0);
});
});
const {
resolveRightsSceneLabel,
mapCarDamageSubOrderDisplayItem,
mapCarDamageListRow,
} = require("@/views/orderManage/utils/orderListRowDisplay");
describe("carDamageListRowDisplay", () => {
describe("resolveRightsSceneLabel", () => {
const sceneList = [
{ baseSceneCode: "SC001", name: "场景一" },
];
it("matches scene from list by baseSceneCode", () => {
expect(resolveRightsSceneLabel({ baseSceneCode: "SC001" }, sceneList)).toBe("场景一");
});
it("falls back to baseSceneCode when not in list", () => {
expect(resolveRightsSceneLabel({ baseSceneCode: "SC999" }, sceneList)).toBe("SC999");
});
it("falls back to baseSceneName", () => {
expect(resolveRightsSceneLabel({ baseSceneName: "备用名称" }, sceneList)).toBe("备用名称");
});
it("returns dash for empty row", () => {
expect(resolveRightsSceneLabel(null, sceneList)).toBe("-");
});
});
describe("mapCarDamageSubOrderDisplayItem", () => {
it("precomputes package and coupon fields", () => {
const item = mapCarDamageSubOrderDisplayItem({
upgradeGoodsId: 1,
packageName: "权益套餐A",
packageAlias: "别名一二三四五六七八九十",
upgradeGoodsName: "商品名",
upgradePrice: 100,
singleProductSalesPrice: 90,
singleProductFinalPrice: 80,
number: 1,
discountAmount: 5,
upgradeWarrantyPeriod: 2,
upgradeGoodsAlias: "商品别名",
coupon: {
customerCouponCode: "CP001",
couponName: "满减券名称很长很长很长",
discountPrice: 10,
},
}, []);
expect(item.packageNameDisplay).toBe("权益套餐A");
expect(item.packageAliasDisplay).toBe("别名一二三四五六七八...");
expect(item.couponCodeDisplay).toBe("CP001");
expect(item.couponNameDisplay).toBe("满减券名称很长很长很...");
expect(item.couponAmountDisplay).toBe("10");
});
});
describe("mapCarDamageListRow", () => {
const maps = {
statusOpts: { 4: "已支付" },
upgradeOpts: { Y: "已升级" },
profitAllocationStatusOpts: { 1: "未分账" },
invoiceStatusOpts: { 1: "未开票" },
zyVoucherStatusOpts: { 1: "待上传" },
saleFlagTextObj: { 1: "直营" },
djOrderTypeMap: { 1: "普通" },
auditStatusMap: { 3: "已通过" },
positionTypeList: [],
rightsSceneListForSearch: [{ baseSceneCode: "SC001", name: "场景一" }],
};
it("maps car damage row with rights-specific labels", () => {
const row = mapCarDamageListRow({
djOrderType: 1,
goodsOrderApplyStatus: 3,
status: 4,
upgradeFlag: "Y",
profitAllocationStatus: 1,
invoiceStatus: 1,
zyVoucherStatus: 1,
directSalesFlag: 1,
salesType: 0,
source: 7,
baseSceneCode: "SC001",
subOrderList: [{ packageName: "套餐1", baseGoodsName: "商品A" }],
}, { maps });
expect(row.salesTypeLabel).toBe("门店引流 - 售前");
expect(row.rightsSceneDisplayLabel).toBe("场景一");
expect(row.zyVoucherStatusLabel).toBe("待上传");
expect(row.customerSexLabel).toBe("-");
expect(row.subOrderCount).toBe(1);
expect(row.subOrderDisplayList).toHaveLength(1);
});
it("maps customer sex when present", () => {
const row = mapCarDamageListRow({ customerSex: 2, subOrderList: [] }, { maps });
expect(row.customerSexLabel).toBe("女");
});
});
});
/**
* 权益列表表格性能相关静态指标(用于回归对比,非运行时 benchmark)
*/
const fs = require("fs");
const path = require("path");
const CAR_DAMAGE_VUE = fs.readFileSync(
path.resolve(__dirname, "../../../../src/views/orderManage/carDamage.vue"),
"utf8",
);
function countMatches(source, pattern) {
const matches = source.match(pattern);
return matches ? matches.length : 0;
}
describe("carDamagePerfMetrics", () => {
it("operation column should keep fixed right per product requirement", () => {
expect(CAR_DAMAGE_VUE).toMatch(
/<el-table-column[^>]*fixed="right"[^>]*label="操作"/,
);
});
it("operation buttons should remain separate auth-button entries", () => {
const operationSection = CAR_DAMAGE_VUE.match(
/<el-table-column[^>]*label="操作"[\s\S]*?<\/el-table-column>/,
);
expect(operationSection).toBeTruthy();
expect(operationSection[0]).toContain("auth-button");
expect(operationSection[0]).not.toContain("el-dropdown");
});
it("sub-order columns should be in expand row not main v-for columns", () => {
const mainSubOrderVFor = CAR_DAMAGE_VUE.match(
/<el-table-column[^>]*label="商品名称"[\s\S]*?v-for="\(item, index\) in scope\.row\.subOrderList"/,
);
expect(mainSubOrderVFor).toBeNull();
});
it("should use row display mapper in getList", () => {
expect(CAR_DAMAGE_VUE).toContain("mapCarDamageListRow");
});
it("page size max should be 20", () => {
expect(CAR_DAMAGE_VUE).toMatch(/:page-sizes="\[10,\s*20\]/);
});
it("expand area should use native table instead of nested el-table", () => {
expect(CAR_DAMAGE_VUE).not.toMatch(/<el-table :data="row\.subOrderDisplayList"/);
expect(CAR_DAMAGE_VUE).toContain("order-sub-goods-table");
});
it("should use accordion expand-row-keys", () => {
expect(CAR_DAMAGE_VUE).toContain(":expand-row-keys=\"expandedOrderCodes\"");
expect(CAR_DAMAGE_VUE).toContain("@expand-change=\"handleExpandChange\"");
expect(CAR_DAMAGE_VUE).toContain("handleExpandChange(row, expandedRows)");
});
it("main table has fewer columns than legacy ~50", () => {
const mainColumnCount = countMatches(CAR_DAMAGE_VUE, /<el-table-column/g);
expect(mainColumnCount).toBeLessThan(40);
expect(mainColumnCount).toBeGreaterThan(25);
});
});
const {
navigateBackToOrderList,
navigateBackFromOrderDetail,
ORDER_LIST_DETAIL_TAG_PATHS,
} = require("@/views/orderManage/utils/orderListNavigation");
describe("orderListNavigation", () => {
function createMocks() {
const close = jest.fn();
const router = { push: jest.fn() };
return { close, router };
}
describe("navigateBackToOrderList", () => {
it("closes only detail tab and pushes orderList without params", () => {
const { close, router } = createMocks();
navigateBackToOrderList(router, close, {
detailTagPath: ORDER_LIST_DETAIL_TAG_PATHS.crowdfundDetail,
});
expect(close).toHaveBeenCalledTimes(1);
expect(close).toHaveBeenCalledWith({
tagName: ORDER_LIST_DETAIL_TAG_PATHS.crowdfundDetail,
});
expect(router.push).toHaveBeenCalledWith({ name: "orderList" });
expect(router.push.mock.calls[0][0].params).toBeUndefined();
});
});
describe("navigateBackFromOrderDetail", () => {
it("closes only orderDetail and does not close orderList", () => {
const { close, router } = createMocks();
navigateBackFromOrderDetail(router, close);
expect(close).toHaveBeenCalledTimes(1);
expect(close).toHaveBeenCalledWith({
tagName: ORDER_LIST_DETAIL_TAG_PATHS.orderDetail,
});
expect(close).not.toHaveBeenCalledWith({ tagName: "/orderList" });
expect(router.push).toHaveBeenCalledWith({ name: "orderList" });
expect(router.push.mock.calls[0][0].params).toBeUndefined();
});
it("navigates back to orderSupplement when fromSupplement is true", () => {
const { close, router } = createMocks();
navigateBackFromOrderDetail(router, close, { fromSupplement: true });
expect(close).toHaveBeenCalledWith({ tagName: "/orderSupplement" });
expect(close).toHaveBeenCalledWith({
tagName: ORDER_LIST_DETAIL_TAG_PATHS.orderDetail,
});
expect(router.push).toHaveBeenCalledWith({ name: "orderSupplement" });
});
});
});
/**
* 精品列表表格性能相关静态指标(用于回归对比,非运行时 benchmark)
*/
const fs = require("fs");
const path = require("path");
const ORDER_VUE = fs.readFileSync(
path.resolve(__dirname, "../../../../src/views/orderManage/order.vue"),
"utf8",
);
function countMatches(source, pattern) {
const matches = source.match(pattern);
return matches ? matches.length : 0;
}
describe("orderListPerfMetrics", () => {
it("operation column should keep fixed right per product requirement", () => {
expect(ORDER_VUE).toMatch(
/<el-table-column[^>]*fixed="right"[^>]*label="操作"/,
);
});
it("operation buttons should remain separate auth-button entries", () => {
const operationSection = ORDER_VUE.match(
/<el-table-column[^>]*label="操作"[\s\S]*?<\/el-table-column>/,
);
expect(operationSection).toBeTruthy();
expect(operationSection[0]).toContain("auth-button");
expect(operationSection[0]).not.toContain("el-dropdown");
});
it("sub-order columns should be in expand row not main v-for columns", () => {
const mainSubOrderVFor = ORDER_VUE.match(
/<el-table-column[^>]*label="商品名称"[\s\S]*?v-for="\(item, index\) in scope\.row\.subOrderList"/,
);
expect(mainSubOrderVFor).toBeNull();
});
it("should use row display mapper in getList", () => {
expect(ORDER_VUE).toContain("mapOrderListRow");
});
it("page size max should be 20", () => {
expect(ORDER_VUE).toMatch(/:page-sizes="\[10,\s*20\]/);
});
it("expand area should use native table instead of nested el-table", () => {
expect(ORDER_VUE).not.toMatch(/<el-table :data="row\.subOrderDisplayList"/);
expect(ORDER_VUE).toContain("order-sub-goods-table");
});
it("should use accordion expand-row-keys", () => {
expect(ORDER_VUE).toContain(":expand-row-keys=\"expandedOrderCodes\"");
expect(ORDER_VUE).toContain("@expand-change=\"handleExpandChange\"");
expect(ORDER_VUE).toContain("handleExpandChange(row, expandedRows)");
});
it("main table has fewer columns than legacy ~45", () => {
const mainColumnCount = countMatches(ORDER_VUE, /<el-table-column/g);
expect(mainColumnCount).toBeLessThan(40);
expect(mainColumnCount).toBeGreaterThan(25);
});
});
const {
shouldReapplyRouteParams,
isOrderListDetailRoute,
ORDER_LIST_DETAIL_ROUTE_NAMES,
} = require("@/views/orderManage/utils/orderListRouteGuard");
describe("orderListRouteGuard", () => {
describe("isOrderListDetailRoute", () => {
it("recognizes order detail routes", () => {
expect(isOrderListDetailRoute({ name: "orderDetail" })).toBe(true);
expect(isOrderListDetailRoute({ name: "crowdfundDetail" })).toBe(true);
});
it("rejects non-detail routes", () => {
expect(isOrderListDetailRoute({ name: "customerList" })).toBe(false);
expect(isOrderListDetailRoute(null)).toBe(false);
});
});
describe("shouldReapplyRouteParams", () => {
it("returns false when returning from orderDetail without params", () => {
expect(
shouldReapplyRouteParams(
{ name: "orderList", params: {}, query: {} },
{ name: "orderDetail" },
),
).toBe(false);
});
it("returns true when customer list passes customer filter query", () => {
expect(
shouldReapplyRouteParams(
{
name: "orderList",
params: {},
query: { customerName: "张三" },
},
{ name: "customerList" },
),
).toBe(true);
});
it("returns true when deep link passes tabPane params", () => {
expect(
shouldReapplyRouteParams(
{ name: "orderList", params: { tabPane: "2" }, query: {} },
{ name: "dashboard" },
),
).toBe(true);
});
it("returns true on first navigation with tabPane params", () => {
expect(
shouldReapplyRouteParams(
{ name: "orderList", params: { tabPane: "1" }, query: {} },
undefined,
),
).toBe(true);
});
it("returns false for non-orderList target", () => {
expect(
shouldReapplyRouteParams(
{ name: "orderDetail", params: {}, query: {} },
{ name: "orderList" },
),
).toBe(false);
});
});
it("lists all order list detail route names", () => {
expect(ORDER_LIST_DETAIL_ROUTE_NAMES).toEqual(
expect.arrayContaining(["orderDetail", "configUpgradationDetail"]),
);
});
});
const {
LEGACY_TAB_PANE,
LEGACY_LABEL_TO_PANE,
resolveTabPaneFromParams,
computeRouteParamPatch,
} = require("@/views/orderManage/utils/orderListRouteParams");
describe("orderListRouteParams", () => {
describe("resolveTabPaneFromParams", () => {
it("maps tabPane 1 to pane key", () => {
expect(resolveTabPaneFromParams({ tabPane: "1" })).toBe("1");
});
it("maps tabLabel order to pane 1", () => {
expect(resolveTabPaneFromParams({ tabLabel: "order" })).toBe("1");
});
it("maps tabLabel integral-shopping to pane 5", () => {
expect(resolveTabPaneFromParams({ tabLabel: "integral-shopping" })).toBe("5");
});
it("returns null for empty params", () => {
expect(resolveTabPaneFromParams({})).toBeNull();
expect(resolveTabPaneFromParams(null)).toBeNull();
});
it("returns null for unknown tabPane", () => {
expect(resolveTabPaneFromParams({ tabPane: "99" })).toBe("99");
});
});
describe("computeRouteParamPatch", () => {
it("maps tabPane 1 to light category and l-1-1 leaf", () => {
expect(computeRouteParamPatch({ tabPane: "1" })).toEqual({
activeCategory: "light",
pendingLegacyLeaf: "l-1-1",
rightsFromLegacyTab4: false,
isApplyingRoute: true,
});
});
it("maps tabPane 4 with carDamage label to rights and legacyRightsAll", () => {
expect(computeRouteParamPatch({ tabPane: "4", tabLabel: "carDamage" })).toEqual({
activeCategory: "rights",
pendingLegacyLeaf: "l-2-1",
rightsFromLegacyTab4: true,
isApplyingRoute: true,
});
});
it("returns null for empty params", () => {
expect(computeRouteParamPatch({})).toBeNull();
});
it("returns null for unknown tabPane mapping", () => {
expect(computeRouteParamPatch({ tabPane: "99" })).toBeNull();
});
});
it("exports legacy maps for orderList shell", () => {
expect(LEGACY_TAB_PANE["1"].category).toBe("light");
expect(LEGACY_LABEL_TO_PANE.order).toBe("1");
});
});
const {
truncateDisplay,
getGoodsTypeName,
mapSubOrderDisplayItem,
mapOrderListRow,
} = require("@/views/orderManage/utils/orderListRowDisplay");
describe("orderListRowDisplay", () => {
describe("truncateDisplay", () => {
it("truncates long text", () => {
expect(truncateDisplay("abcdefghijklmnop", 10)).toBe("abcdefghij...");
});
it("returns dash for empty", () => {
expect(truncateDisplay("")).toBe("-");
});
});
describe("getGoodsTypeName", () => {
it("joins type names with dash", () => {
expect(getGoodsTypeName({
upgradeGoodsTypeName: "A",
upgradeSecondaryGoodsTypeName: "B",
})).toBe("A-B");
});
});
describe("mapSubOrderDisplayItem", () => {
it("precomputes display fields", () => {
const item = mapSubOrderDisplayItem({
upgradeGoodsId: 1,
upgradeGoodsName: "超长商品名称一二三四五六七八九十",
upgradePrice: 100,
singleProductSalesPrice: 90,
singleProductFinalPrice: 80,
number: 2,
discountAmount: 5,
upgradeWarrantyPeriod: 3,
upgradeGoodsAlias: "别名",
upgradeGoodsTypeName: "贴膜",
}, []);
expect(item.goodsNameDisplay).toBe("超长商品名称一二三四...");
expect(item.goodsTypeDisplay).toBe("贴膜");
expect(item.unitPriceDisplay).toBe("¥ 100");
expect(item.warrantyDisplay).toBe("3年");
});
});
describe("mapOrderListRow", () => {
const maps = {
statusOpts: { 4: "已支付" },
upgradeOpts: { Y: "已升级" },
profitAllocationStatusOpts: { 1: "未分账" },
invoiceStatusOpts: { 1: "未开票" },
saleFlagTextObj: { 1: "直营" },
djOrderTypeMap: { 1: "普通" },
auditStatusMap: { 3: "已通过" },
positionTypeList: [],
};
it("maps order row display labels", () => {
const row = mapOrderListRow({
djOrderType: 1,
goodsOrderApplyStatus: 3,
status: 4,
upgradeFlag: "Y",
profitAllocationStatus: 1,
invoiceStatus: 1,
directSalesFlag: 1,
salesType: 0,
source: 7,
subOrderList: [{ baseGoodsName: "商品A" }],
packageGoodsList: [{ packageName: "套餐1" }],
}, { maps });
expect(row.statusLabel).toBe("已支付");
expect(row.orderSourceLabel).toBe("系统导入");
expect(row.subOrderDisplayList).toHaveLength(1);
expect(row.packageNamesDisplay).toBe("套餐1");
});
});
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!