Commit a34172d5 by 李伟康

refactor(src/views/earlyWarningManager/strategyAnalysis/index.vue): 优化策略分析表格格式化逻辑

1. 解构cellValue提取strategyType和strategyTarget简化代码
2. 根据strategyType区分触客率和转化率的格式化规则
3. 调整客单价和转化率的展示判断逻辑
1 parent 91fdaa12
...@@ -511,15 +511,21 @@ export default { ...@@ -511,15 +511,21 @@ export default {
minWidth: 160, minWidth: 160,
formatter: (cellValue) => { formatter: (cellValue) => {
let businessType = this.currentTab.value; let businessType = this.currentTab.value;
if (cellValue.strategyTarget == "-" || cellValue.strategyTarget == null || cellValue.strategyTarget == undefined || cellValue.strategyTarget == "") { const { strategyType, strategyTarget } = cellValue;
if (strategyTarget == "-" || strategyTarget == null || strategyTarget == undefined || strategyTarget == "") {
return "-"; return "-";
} }
let text = ""; let text = "";
if (businessType == 2) { if (strategyType == 12) {
text = `平均客单价${cellValue.strategyTarget}`; text = `触客率${strategyTarget}%`;
} else { } else {
text = `转化率${cellValue.strategyTarget}%`; if (businessType == 2) {
text = `平均客单价${strategyTarget}`;
} else {
text = `转化率${strategyTarget}%`;
}
} }
return text; return text;
}, },
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!