Commit 8f985ee4 by wangzhihui

Merge branch 'SAAS+V5.8.3_wzh' of http://192.168.3.233:8090/saas_plus/dj-car-lif…

…e-system into SAAS+V5.8.3_wzh
2 parents 51d6bfc5 15e2b919
Showing 123 changed files with 3723 additions and 375 deletions
...@@ -126,3 +126,91 @@ test.afterAll(async () => { ...@@ -126,3 +126,91 @@ test.afterAll(async () => {
2. **每个 test 开头做 `goto`** 导航到目标页面,用 URL 导航来隔离 test 间状态 2. **每个 test 开头做 `goto`** 导航到目标页面,用 URL 导航来隔离 test 间状态
3. **afterAll 关闭 context**,避免资源泄漏 3. **afterAll 关闭 context**,避免资源泄漏
4. URL 提取为常量(如 `BASE_URL`),方便切换测试环境 4. URL 提取为常量(如 `BASE_URL`),方便切换测试环境
---
## 6. 旧后台项目 E2E 稳定性经验
适用于本项目这类 `Vue2 + Element UI + D2Admin` 的后台页面。
### 页面就绪判断
不要只等待路由切换完成,也不要只依赖固定 `waitForTimeout`。
推荐组合:
1. 等关键接口返回
2. 等页面核心容器可见
3. 等表单控件或表格真实渲染完成
例如新增/编辑页如果依赖元数据接口,必须先等真实接口返回,再继续执行后续步骤。
### 选择器策略
#### 1. 表格操作列
Element UI 表格和 D2Admin 表格可能存在 fixed 列副本、隐藏节点、slot 包装节点。
因此:
- 不要默认认为 `getByRole()` 一定稳定
- 优先在“当前行的操作列作用域”内定位
- 优先点击真实可见的 `button`
- 如果组件渲染结构复杂,可在受控范围内做 DOM fallback
#### 2. 弹窗套弹窗
不要只靠“包含某段文本”来区分外层弹窗和内层弹窗。
推荐组合:
1. 先记录当前可见弹窗数量
2. 点击后等待可见弹窗数量增加
3. 用二级弹窗专属根节点或专属内容区定位
如果详情弹窗有独立根 class,应优先以该 class 作为锚点。
#### 3. 文本定位
在旧项目里,按钮和表格操作列经常是复杂 slot 渲染,文本选择器通常比过度依赖语义角色更稳定。
但前提是:
- 文案必须以真实页面为准
- 不要只照测试用例文档写死文案
- 文案更新后要同步维护测试
### 断言策略
- 优先断言稳定的内容区、根容器、业务字段
- 少依赖容易变化的局部 DOM 结构
- 如果标题节点不稳定,可以断言整个弹窗包含标题文本和专属内容区同时存在
### 调试顺序
推荐顺序:
1. 先定向跑失败用例
2. 再看失败截图和 trace
3. 根据真实 DOM 和真实文案修正选择器
4. 最后全量回归
不要在定位未收敛时反复全量跑整个文件。
### 真实环境约束
- E2E 默认优先走真实接口和真实链路
- 如果页面依赖真实环境数据,测试里要显式写明依赖项
- 对固定数据依赖要用常量集中管理,方便替换和排查
例如:
```js
const RECORD_DETAIL_STRATEGY_NAME = "测试发送策略";
```
### 实操原则
- 先保证流程稳定,再考虑写法优雅
- 先最小改动,再逐步增强健壮性
- 每次修复后先做定向验证,再做整文件回归
...@@ -40,3 +40,4 @@ yarn-error.log* ...@@ -40,3 +40,4 @@ yarn-error.log*
# test # test
/playwright/ /playwright/
/testCase/
{
"mcpServers": {
"codegraph": {
"type": "stdio",
"command": "codegraph",
"args": [
"serve",
"--mcp"
]
}
}
}
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"vetur.validation.template": false, "vetur.validation.template": false,
"vetur.validation.script": false, "vetur.validation.script": false,
"vetur.validation.style": true, "vetur.validation.style": true,
"vetur.useWorkspaceDependencies": true,
"vetur.ignoreProjectWarning": false, "vetur.ignoreProjectWarning": false,
"vetur.experimental.templateInterpolationService": false, "vetur.experimental.templateInterpolationService": false,
"editor.defaultFormatter": "dbaeumer.vscode-eslint", "editor.defaultFormatter": "dbaeumer.vscode-eslint",
......
...@@ -13,30 +13,46 @@ RUN apt-get update && apt-get install -y \ ...@@ -13,30 +13,46 @@ RUN apt-get update && apt-get install -y \
jq \ jq \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# 创建用户(uid=1000)
RUN useradd -m -u 1000 -s /bin/bash claude
# 切换到 claude 用户
USER claude
ENV HOME=/home/claude
# Volta # Volta
ENV VOLTA_HOME=/root/.volta ENV VOLTA_HOME=/home/claude/.volta
ENV PATH=$VOLTA_HOME/bin:$PATH ENV PATH=${VOLTA_HOME}/bin:${PATH}
# 安装 Volta
RUN curl https://get.volta.sh | bash RUN curl https://get.volta.sh | bash
# 安装 Node
# 安装 Node14
RUN volta install node@14 RUN volta install node@14
# 默认 Node22
RUN volta install node@22 RUN volta install node@22
# 安装 Claude Code
# Claude Code
RUN npm install -g @anthropic-ai/claude-code RUN npm install -g @anthropic-ai/claude-code
# 触发一次 claude 命令让它生成初始的 ~/.claude.json(如果它还没生成的话) # 初始化 Claude 配置
# 并使用 jq 安全地注入 hasCompletedOnboarding 字段,不破坏原有内容 RUN mkdir -p /home/claude/.claude && \
RUN mkdir -p /root && \ echo '{}' > /home/claude/.claude.json && \
touch /root/.claude.json && \ jq '. + {"hasCompletedOnboarding": true}' \
(echo '{}' > /root/.claude.json) && \ /home/claude/.claude.json \
jq '. + {"hasCompletedOnboarding": true}' /root/.claude.json > /root/.claude.json.tmp && \ > /home/claude/.claude.json.tmp && \
mv /root/.claude.json.tmp /root/.claude.json mv /home/claude/.claude.json.tmp /home/claude/.claude.json
# ==========================
# 最后统一修正权限
# ==========================
USER root
RUN chown -R 1000:1000 /home/claude
# 恢复默认运行用户
USER claude
WORKDIR /workspace WORKDIR /workspace
CMD ["/bin/bash"] CMD ["/bin/bash"]
services: services:
ai-worker: ai-worker:
# user: "1000:1000"
build: build:
context: . context: .
dockerfile: ../build/Dockerfile.unit.test dockerfile: ../build/Dockerfile.unit.test
container_name: ai-worker container_name: ai-worker
working_dir: /workspace working_dir: /workspace
volumes: volumes:
- ./workspace:/workspace - npm-cache:/home/jdkapp/.npm
# npm 缓存
- npm-cache:/home/claude/.npm
# Claude 登录状态
- claude-cache:/home/claude/.claude/projects
# Volta 缓存(node、npm)
- volta-cache:/home/claude/.volta
environment: environment:
- ANTHROPIC_AUTH_TOKEN - ANTHROPIC_AUTH_TOKEN
- GIT_AUTHOR_NAME=AI-BOT
- GIT_AUTHOR_EMAIL=ai-bot@didihu.com.cn
- GIT_COMMITTER_NAME=AI-BOT
- GIT_COMMITTER_EMAIL=ai-bot@didihu.com.cn
- AI_GITLAB_TOKEN
- ANTHROPIC_BASE_URL=https://dashscope.aliyuncs.com/apps/anthropic - ANTHROPIC_BASE_URL=https://dashscope.aliyuncs.com/apps/anthropic
- ANTHROPIC_MODEL=qwen3.5-plus - ANTHROPIC_MODEL=qwen3.5-plus
- ANTHROPIC_SMALL_FAST_MODEL=qwen3.5-flash - ANTHROPIC_SMALL_FAST_MODEL=qwen3.5-flash
...@@ -17,6 +29,15 @@ services: ...@@ -17,6 +29,15 @@ services:
- ANTHROPIC_DEFAULT_SONNET_MODEL=qwen3.5-plus - ANTHROPIC_DEFAULT_SONNET_MODEL=qwen3.5-plus
- ANTHROPIC_DEFAULT_OPUS_MODEL=qwen3.5-plus - ANTHROPIC_DEFAULT_OPUS_MODEL=qwen3.5-plus
- CLAUDE_CODE_SUBAGENT_MODEL=qwen3.5-plus - CLAUDE_CODE_SUBAGENT_MODEL=qwen3.5-plus
# 保持容器在前台常驻,防止执行完立刻退出崩溃
command: sh -c "tail -f /dev/null" command: >
sh -c '
git config --global credential.helper store &&
echo "http://oauth2:$${AI_GITLAB_TOKEN}@gitlab.test.glsx.com.cn" > ~/.git-credentials &&
tail -f /dev/null
'
restart: unless-stopped restart: unless-stopped
volumes:
npm-cache:
claude-cache:
volta-cache:
...@@ -164,4 +164,37 @@ export default antfu({ ...@@ -164,4 +164,37 @@ export default antfu({
*/ */
html: true, html: true,
}, },
}, {
files: ["**/*.spec.js", "**/*.integration.spec.js"],
languageOptions: {
globals: {
jest: "readonly",
describe: "readonly",
it: "readonly",
test: "readonly",
expect: "readonly",
beforeEach: "readonly",
afterEach: "readonly",
beforeAll: "readonly",
afterAll: "readonly",
require: "readonly",
module: "readonly",
process: "readonly",
window: "readonly",
document: "readonly",
navigator: "readonly",
location: "readonly",
URL: "readonly",
Blob: "readonly",
File: "readonly",
FormData: "readonly",
MessageEvent: "readonly",
localStorage: "readonly",
sessionStorage: "readonly",
setTimeout: "readonly",
clearTimeout: "readonly",
setInterval: "readonly",
clearInterval: "readonly",
},
},
}); });
...@@ -15,6 +15,7 @@ module.exports = { ...@@ -15,6 +15,7 @@ module.exports = {
], ],
moduleNameMapper: { moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1", "^@/(.*)$": "<rootDir>/src/$1",
"^@api/(.*)$": "<rootDir>/src/api/$1",
"\\.css$": "jest-transform-stub", "\\.css$": "jest-transform-stub",
"^@/plugin/d2admin/(.*)$": "<rootDir>/jest.mocks/d2admin.js", "^@/plugin/d2admin/(.*)$": "<rootDir>/jest.mocks/d2admin.js",
"^@/assets/svg-icons/index.js$": "<rootDir>/jest.mocks/svg-icons-index.js", "^@/assets/svg-icons/index.js$": "<rootDir>/jest.mocks/svg-icons-index.js",
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
"private": true, "private": true,
"scripts": { "scripts": {
"备注": "去掉nomock配置命令", "备注": "去掉nomock配置命令",
"serve": "vue-cli-service serve", "serve": "set NODE_OPTIONS=--max-old-space-size=4096&& vue-cli-service serve",
"start": "set NODE_OPTIONS=--openssl-legacy-provider && npm run serve", "start": "npm run serve",
"dev": "set NODE_OPTIONS=--openssl-legacy-provider && npm run serve", "dev": "npm run serve",
"build": "vue-cli-service build --no-module", "build": "vue-cli-service build --no-module",
"build:nomock": "vue-cli-service build --mode nomock", "build:nomock": "vue-cli-service build --mode nomock",
"lint": "vue-cli-service lint --fix", "lint": "vue-cli-service lint --fix",
......
import request from "./request";
import RequestMethods from "./request.methods";
/** 查询客户画像 */
export function queryCustomerPortrait(data = {}) {
data.method = "dj.api.customer.profile";
data.id = data.id ?? data.customerId;
return request(data, RequestMethods.POST);
}
/** 查询客户群关联 */
export function queryCustomerGroups(data = {}) {
data.method = "dj.api.customer.groupAssoc";
data.id = data.id ?? data.customerId;
return request(data, RequestMethods.POST);
}
import request from "./request";
import RequestMethods from "./request.methods";
// 获取营销活动列表数据
export function getMarketingActivityList(data) {
data.method = `dj.api.marketing.activity.page`;
return request(data, RequestMethods.POST);
}
// 获取营销活动详情(基础信息)
export function getMarketingActivityDetail(data) {
data.method = `dj.api.marketing.activity.detail`;
return request(data, RequestMethods.POST);
}
// 获取营销活动详情(适用门店)
export function getMarketingActivityStores(data) {
data.method = `dj.api.marketing.activity.stores`;
return request(data, RequestMethods.POST);
}
// 获取营销活动详情(适用车系)
export function getMarketingActivityCarSeries(data) {
data.method = `dj.api.marketing.activity.carSeries`;
return request(data, RequestMethods.POST);
}
// 获取营销活动详情(商品/套餐)
export function getMarketingActivityProducts(data) {
data.method = `dj.api.marketing.activity.products`;
return request(data, RequestMethods.POST);
}
// 获取营销活动详情(操作日志)
export function getMarketingActivityLogs(data) {
data.method = `dj.api.marketing.activity.logs`;
return request(data, RequestMethods.POST);
}
// 创建营销活动
export function addMarketingActivity(data) {
data.method = `dj.api.marketing.activity.create`;
return request(data, RequestMethods.POST);
}
// 编辑营销活动
export function editMarketingActivity(data) {
data.method = `dj.api.marketing.activity.update`;
return request(data, RequestMethods.POST);
}
// 获取活动标签列表数据
export function getActivityTagList(data) {
data.method = `dj.api.marketing.tag.list`;
return request(data, RequestMethods.POST);
}
// 新增活动标签数据
export function addActivityTag(data) {
data.method = `dj.api.marketing.tag.create`;
return request(data, RequestMethods.POST);
}
// 重命名活动标签
export function updateActivityTag(data) {
data.method = "dj.api.marketing.tag.rename";
return request(data, RequestMethods.POST);
}
// 删除活动标签数据
export function deleteActivityTag(data) {
data.method = `dj.api.marketing.tag.delete`;
return request(data, RequestMethods.POST);
}
// 根据门店列表获取车系数据
export function getCarDataByMerchant(data) {
data.method = `dj.api.smartcarlife.common.merchant.carseries.list`;
return request(data, RequestMethods.POST);
}
// 根据门店列表获取套餐数据
export function getPackageListByMerchant(data) {
data.method = `dj.api.marketing.package.page`;
return request(data, RequestMethods.POST);
}
// 根据套餐获取套餐内子商品数据
export function getGoodsDataByPackage(data) {
data.method = `dj.api.marketing.package.items`;
return request(data, RequestMethods.POST);
}
// 根据门店列表获取商品数据
export function getGoodsListByMerchant(data) {
data.method = `dj.api.marketing.goods.page`;
return request(data, RequestMethods.POST);
}
// 根据商品/套餐查询适用门店数据
export function getMerchantByGoodsOrPackage(data) {
data.method = `dj.api.marketing.goods.stores`;
return request(data, RequestMethods.POST);
}
// 删除营销活动
export function deleteMarketingActivity(data) {
data.method = `dj.api.marketing.activity.delete`;
return request(data, RequestMethods.POST);
}
// 暂停营销活动
export function pauseMarketingActivity(data) {
data.method = `dj.api.marketing.activity.pause`;
return request(data, RequestMethods.POST);
}
// 恢复营销活动
export function resumeMarketingActivity(data) {
data.method = `dj.api.marketing.activity.resume`;
return request(data, RequestMethods.POST);
}
// 延期营销活动
export function extendMarketingActivity(data) {
data.method = `dj.api.marketing.activity.extend`;
return request(data, RequestMethods.POST);
}
// 下线营销活动
export function offlineMarketingActivity(data) {
data.method = `dj.api.marketing.activity.cease`;
return request(data, RequestMethods.POST);
}
...@@ -112,9 +112,33 @@ export function onlinePaymentDetailPage(data) { ...@@ -112,9 +112,33 @@ export function onlinePaymentDetailPage(data) {
} }
/** /**
* 分页查询银盛线上对账单汇总-分账记录
*/
export function onlineDivisionMonthTotalPage(data) {
data.method = "dj.api.smartcarlife.onlineStatementAccount.divisionMonthTotalPage";
return request(data, "post");
}
/**
* 分页查询银盛线上对账单汇总-收款记录 * 分页查询银盛线上对账单汇总-收款记录
*/ */
export function onlinePaymentMonthTotalPage(data) { export function onlinePaymentMonthTotalPage(data) {
data.method = "dj.api.smartcarlife.onlineStatementAccount.paymentMonthTotalPage"; data.method = "dj.api.smartcarlife.onlineStatementAccount.paymentMonthTotalPage";
return request(data, "post"); return request(data, "post");
} }
/**
* 查询银盛线上对账单收款统计信息
*/
export function paymentCountTotal(data) {
data.method = "dj.api.smartcarlife.onlineStatementAccount.paymentCountTotal";
return request(data, "post");
}
/**
* 查询银盛线上对账单分账统计记录
*/
export function divisionCountTotal(data) {
data.method = "dj.api.smartcarlife.onlineStatementAccount.divisionCountTotal";
return request(data, "post");
}
...@@ -101,3 +101,21 @@ export function linkMerchant(data) { ...@@ -101,3 +101,21 @@ export function linkMerchant(data) {
data.method = `dj.staff.api.recruitment.demand.link.merchant`; data.method = `dj.staff.api.recruitment.demand.link.merchant`;
return request(data); return request(data);
} }
// 试岗计划审批(通过/驳回)
export function trialOnboardingApproval(data) {
data.method = `dj.staff.api.recruitment.trial.onboarding.approval`;
return request(data);
}
// 试岗门店列表
export function getTrialOnboardingStoreList(data) {
data.method = `dj.staff.api.recruitment.demand.store.list`;
return request(data);
}
// 招聘需求业务场景列表
export function getRecruitmentDemandSubSceneList(data) {
data.method = `dj.staff.api.recruitment.demand.sub.scene.list`;
return request(data);
}
\ No newline at end of file \ No newline at end of file
...@@ -21,7 +21,9 @@ function request( ...@@ -21,7 +21,9 @@ function request(
) { ) {
// 兼容线上dj和scrm appkey和secret不一样的情况 // 兼容线上dj和scrm appkey和secret不一样的情况
let apiName = ""; let apiName = "";
if (params.method.includes("dj.api.smartcarlife")) { if (params.method.includes("dj.api.smartcarlife.sop.strategy")) {
apiName = "strategy";
} else if (params.method.includes("dj.api.smartcarlife")) {
apiName = "dj"; apiName = "dj";
} else if (params.method.includes("dj.api.script")) { } else if (params.method.includes("dj.api.script")) {
apiName = "script"; apiName = "script";
...@@ -45,6 +47,8 @@ function request( ...@@ -45,6 +47,8 @@ function request(
} else if (params.method.includes("merchants.api.open.createMerchantWithPermissions")) { } else if (params.method.includes("merchants.api.open.createMerchantWithPermissions")) {
/** 开放平台创建商户 — 与同网关 oaapproval 一致,使用 axios_oaapproval / baseURL */ /** 开放平台创建商户 — 与同网关 oaapproval 一致,使用 axios_oaapproval / baseURL */
apiName = "oaapproval"; apiName = "oaapproval";
} else if (params.method.includes("dj.api.marketing")) {
apiName = "strategy";
} else { } else {
// console.log(params.method.split(".api")) // console.log(params.method.split(".api"))
apiName = params.method.split(".api")[0]; apiName = params.method.split(".api")[0];
......
import request from "./request";
import RequestMethods from "./request.methods";
const METHOD_PREFIX = "dj.api.strategy.tag.";
/** 查询标签类别树 */
export function queryTagCategoryTree(data = {}) {
data.method = `${METHOD_PREFIX}category.tree`;
return request(data, RequestMethods.POST);
}
/** 查询可新增子级的分类列表 */
export function queryTagCategoryLeafList(data = {}) {
data.method = `${METHOD_PREFIX}category.leaf.list`;
return request(data, RequestMethods.POST);
}
/** 创建标签类别 */
export function createTagCategory(data = {}) {
data.method = `${METHOD_PREFIX}category.create`;
return request(data, RequestMethods.POST);
}
/** 编辑标签类别 */
export function updateTagCategory(data = {}) {
data.method = `${METHOD_PREFIX}category.update`;
return request(data, RequestMethods.POST);
}
/** 分页查询标签维度列表 */
export function queryTagDimension(data = {}) {
data.method = `${METHOD_PREFIX}dimension.query`;
return request(data, RequestMethods.POST);
}
/** 获取新增维度时可选的分类列表 */
export function queryTagDimensionCategoryOptions(data = {}) {
data.method = `${METHOD_PREFIX}dimension.category.options`;
return request(data, RequestMethods.POST);
}
/**
* 查询标签维度详情
* @param {Object} data categoryId — 参数名沿用后端,实际传维度 ID
*/
export function queryTagDimensionDetail(data = {}) {
data.method = `${METHOD_PREFIX}dimension.detail`;
return request(data, RequestMethods.POST);
}
/** 创建标签维度 */
export function createTagDimension(data = {}) {
data.method = `${METHOD_PREFIX}dimension.create`;
return request(data, RequestMethods.POST);
}
/** 编辑标签维度 */
export function updateTagDimension(data = {}) {
data.method = `${METHOD_PREFIX}dimension.update`;
return request(data, RequestMethods.POST);
}
/** 分页查询枚举值列表 */
export function pageTagEnum(data = {}) {
data.method = `${METHOD_PREFIX}enum.page`;
return request(data, RequestMethods.POST);
}
/** 创建标签枚举值 */
export function createTagEnum(data = {}) {
data.method = `${METHOD_PREFIX}enum.create`;
return request(data, RequestMethods.POST);
}
/** 编辑标签枚举值 */
export function updateTagEnum(data = {}) {
data.method = `${METHOD_PREFIX}enum.update`;
return request(data, RequestMethods.POST);
}
...@@ -1984,7 +1984,7 @@ export const goodsAuditStatusList = [ ...@@ -1984,7 +1984,7 @@ export const goodsAuditStatusList = [
}, },
{ {
confId: "2", confId: "2",
confLabel: "线上运营待审批", confLabel: "运营待审批",
}, },
{ {
confId: "3", confId: "3",
...@@ -2083,6 +2083,16 @@ export const trialStatusOpt = [ ...@@ -2083,6 +2083,16 @@ export const trialStatusOpt = [
confValue: "无试岗", confValue: "无试岗",
}, },
]; ];
export const approvalStatusOpt=[
{
confId: 0,
confValue: "待审批",
},
{
confId: 1,
confValue: "已审批",
},
]
export const connectionFlagOptMap = { export const connectionFlagOptMap = {
true: "#2CCA74", true: "#2CCA74",
false: "#EB4E4E", false: "#EB4E4E",
......
...@@ -4,17 +4,17 @@ ...@@ -4,17 +4,17 @@
export const beforeRangePickerOptions = { export const beforeRangePickerOptions = {
disabledDate(date) { disabledDate(date) {
if (date > new Date()) { if (date > new Date()) {
return true return true;
} }
return false return false;
} },
} };
export const afterRangePickerOptions = { export const afterRangePickerOptions = {
disabledDate(date) { disabledDate(date) {
const yesterday = new Date(new Date().setDate(new Date().getDate() - 1)) const yesterday = new Date(new Date().setDate(new Date().getDate() - 1));
if (date < yesterday) { if (date < yesterday) {
return true return true;
}
return false
} }
} return false;
},
};
<template> <template>
<el-dialog ref="elDialog" <el-dialog ref="elDialog"
v-bind="$attrs" v-bind="$attrs"
:visible.sync="innerVisible"
:width="computedWidth"
:fullscreen="innerFullscreen"
:custom-class="dialogCustomClass" :custom-class="dialogCustomClass"
:fullscreen="innerFullscreen"
:show-close="false" :show-close="false"
:visible.sync="innerVisible"
:width="computedWidth"
v-on="$listeners" v-on="$listeners"
@open="handleOpen"> @open="handleOpen">
<!-- Title slot wrapper for fullscreen support --> <!-- Title slot wrapper for fullscreen support -->
...@@ -18,15 +18,15 @@ ...@@ -18,15 +18,15 @@
<div class="venus-dialog-actions"> <div class="venus-dialog-actions">
<!-- Fullscreen toggle button --> <!-- Fullscreen toggle button -->
<button v-if="allowFullscreen" <button v-if="allowFullscreen"
type="button"
class="venus-dialog-action-btn" class="venus-dialog-action-btn"
type="button"
@click="toggleFullscreen"> @click="toggleFullscreen">
<i :class="innerFullscreen ? 'el-icon-crop' : 'el-icon-full-screen'"></i> <i :class="innerFullscreen ? 'el-icon-crop' : 'el-icon-full-screen'"></i>
</button> </button>
<!-- Custom Close button --> <!-- Custom Close button -->
<button v-if="showClose" <button v-if="showClose"
type="button"
class="venus-dialog-action-btn" class="venus-dialog-action-btn"
type="button"
@click="handleClose"> @click="handleClose">
<i class="el-icon-close"></i> <i class="el-icon-close"></i>
</button> </button>
...@@ -145,6 +145,9 @@ export default { ...@@ -145,6 +145,9 @@ export default {
computedHeight() { computedHeight() {
return this.formatSize(this.height); return this.formatSize(this.height);
}, },
computedTop() {
return this.formatSize(this.$attrs.top);
},
innerVisible: { innerVisible: {
get() { get() {
return this.visible; return this.visible;
...@@ -258,12 +261,15 @@ export default { ...@@ -258,12 +261,15 @@ export default {
// Calculate vertical center // Calculate vertical center
const screenHeight = document.body.clientHeight; const screenHeight = document.body.clientHeight;
// Calculate top offset for centering dragDom.style.marginTop = "0";
if (this.computedTop) {
dragDom.style.top = this.computedTop;
} else {
// el-dialog default has margin-top: 15vh, we need to override it to center vertically // el-dialog default has margin-top: 15vh, we need to override it to center vertically
const topOffset = Math.max(0, (screenHeight - dragDomHeight) / 2); const topOffset = Math.max(0, (screenHeight - dragDomHeight) / 2);
dragDom.style.marginTop = "0";
dragDom.style.top = `${topOffset}px`; dragDom.style.top = `${topOffset}px`;
} }
}
}); });
}, },
toggleFullscreen() { toggleFullscreen() {
......
/**
* @param {Array} arr 原数组
* @param {number} fromIndex 原下标
* @param {number} toIndex 目标下标
* @returns {Array} 新数组,不修改原数组
*/
export function moveItem(arr, fromIndex, toIndex) {
if (fromIndex === toIndex)
return [...arr];
// 先拷贝一份新数组
const newArr = [...arr];
// 取出并删除原位置元素
const item = newArr.splice(fromIndex, 1)[0];
// 插入到目标位置
newArr.splice(toIndex, 0, item);
return newArr;
}
...@@ -10,3 +10,17 @@ export function readFileAsDataURL(file) { ...@@ -10,3 +10,17 @@ export function readFileAsDataURL(file) {
}; };
}); });
} }
const IMAGE_EXTENSIONS = ["jpg", "jpeg", "png", "gif", "webp", "bmp", "svg", "ico"];
/**
* 根据文件后缀判断是否为图片
* @param {string} fileName - 文件名
* @returns {boolean}
*/
export function isImageFile(fileName) {
if (!fileName || typeof fileName !== "string")
return false;
const ext = fileName.split(".").pop()?.toLowerCase();
return IMAGE_EXTENSIONS.includes(ext);
}
const _import = require("@/libs/util.import." + process.env.NODE_ENV) const _import = require("@/libs/util.import." + process.env.NODE_ENV);
export const routerName = { export const routerName = {
902: { 902: {
path: "/flowManage", path: "/flowManage",
...@@ -7,8 +7,8 @@ export const routerName = { ...@@ -7,8 +7,8 @@ export const routerName = {
title: "流量管理", title: "流量管理",
authId: "902", authId: "902",
parentId: "1", parentId: "1",
cache: false cache: false,
} },
}, },
90201: { 90201: {
path: "/customerList", path: "/customerList",
...@@ -17,7 +17,7 @@ export const routerName = { ...@@ -17,7 +17,7 @@ export const routerName = {
title: "客户列表", title: "客户列表",
authId: "90201", authId: "90201",
parentId: "902", parentId: "902",
cache: false cache: false,
}, },
auth: [ auth: [
{ {
...@@ -26,10 +26,49 @@ export const routerName = { ...@@ -26,10 +26,49 @@ export const routerName = {
label: "导出", label: "导出",
category: "Button", category: "Button",
type: "primary", type: "primary",
handle: "handleExport" handle: "handleExport",
} },
{
authId: "9020102",
parentId: "90201",
label: "客户画像",
handle: "handleViewPortrait",
addRoutePath: [
{
authId: "90205",
name: "客户画像",
parentId: "90201",
},
],
},
{
authId: "9020103",
parentId: "90201",
label: "群关联",
handle: "handleViewGroups",
addRoutePath: [
{
authId: "90206",
name: "群关联",
parentId: "90201",
},
],
},
{
authId: "9020104",
parentId: "90201",
label: "订单信息",
handle: "handleViewOrders",
// addRoutePath: [
// {
// authId: "90401",
// name: "订单列表",
// parentId: "904",
// },
// ],
},
], ],
component: _import("customer/customerList") component: _import("customer/customerList"),
}, },
90202: { 90202: {
path: "/recordList", path: "/recordList",
...@@ -38,7 +77,7 @@ export const routerName = { ...@@ -38,7 +77,7 @@ export const routerName = {
title: "预录信息", title: "预录信息",
authId: "90202", authId: "90202",
parentId: "902", parentId: "902",
cache: false cache: false,
}, },
auth: [ auth: [
{ {
...@@ -53,9 +92,9 @@ export const routerName = { ...@@ -53,9 +92,9 @@ export const routerName = {
{ {
authId: "901", authId: "901",
name: "预录客户", name: "预录客户",
parentId: "90202" parentId: "90202",
} },
] ],
}, },
{ {
authId: "9020202", authId: "9020202",
...@@ -63,7 +102,7 @@ export const routerName = { ...@@ -63,7 +102,7 @@ export const routerName = {
label: "一键导入", label: "一键导入",
category: "Button", category: "Button",
type: "primary", type: "primary",
handle: "handleImport" handle: "handleImport",
}, },
{ {
authId: "9020203", authId: "9020203",
...@@ -74,12 +113,12 @@ export const routerName = { ...@@ -74,12 +113,12 @@ export const routerName = {
{ {
authId: "901", authId: "901",
name: "预录客户", name: "预录客户",
parentId: "90202" parentId: "90202",
} },
] ],
} },
], ],
component: _import("customer/recordList") component: _import("customer/recordList"),
}, },
90203: { 90203: {
...@@ -89,14 +128,14 @@ export const routerName = { ...@@ -89,14 +128,14 @@ export const routerName = {
title: "邀约管理", title: "邀约管理",
authId: "90203", authId: "90203",
parentId: "902", parentId: "902",
cache: false cache: false,
}, },
auth: [ auth: [
{ {
authId: "9020301", authId: "9020301",
parentId: "90203", parentId: "90203",
label: "再次电联", label: "再次电联",
handle: "handleMoreCall" handle: "handleMoreCall",
// ruleObj: { // ruleObj: {
// attr: 'status', // attr: 'status',
// rule: { // rule: {
...@@ -109,40 +148,66 @@ export const routerName = { ...@@ -109,40 +148,66 @@ export const routerName = {
authId: "9020302", authId: "9020302",
parentId: "90203", parentId: "90203",
label: "取消预约", label: "取消预约",
handle: "handleCancel" handle: "handleCancel",
}, },
{ {
authId: "9020303", authId: "9020303",
parentId: "90203", parentId: "90203",
label: "更新备注", label: "更新备注",
handle: "handleUpdateRemark" handle: "handleUpdateRemark",
}, },
{ {
authId: "9020304", authId: "9020304",
parentId: "90203", parentId: "90203",
label: "修改时间", label: "修改时间",
handle: "handleChangeTime" handle: "handleChangeTime",
}, },
{ {
authId: "9020305", authId: "9020305",
parentId: "90203", parentId: "90203",
label: "电联一下", label: "电联一下",
handle: "handleCall" handle: "handleCall",
}, },
{ {
authId: "9020306", authId: "9020306",
parentId: "90203", parentId: "90203",
label: "预约时间", label: "预约时间",
handle: "handleAppoint" handle: "handleAppoint",
}, },
{ {
authId: "9020307", authId: "9020307",
parentId: "90203", parentId: "90203",
label: "更新备注", label: "更新备注",
handle: "handleUpdateRemark" handle: "handleUpdateRemark",
} },
], ],
component: _import("customer/invitation") component: _import("customer/invitation"),
},
90205: {
path: "/customerPortrait",
name: "customerPortrait",
meta: {
title: "客户画像",
authId: "90205",
parentId: "90201",
cache: false,
sideHidden: true,
activePath: "/customerList",
},
component: _import("customer/portrait/index"),
},
90206: {
path: "/customerGroupRel",
name: "customerGroupRel",
meta: {
title: "群关联",
authId: "90206",
parentId: "90201",
cache: false,
sideHidden: true,
activePath: "/customerList",
},
component: _import("customer/groupRel/index"),
}, },
901: { 901: {
path: "/editCustomer", path: "/editCustomer",
...@@ -153,10 +218,10 @@ export const routerName = { ...@@ -153,10 +218,10 @@ export const routerName = {
parentId: "90202", parentId: "90202",
cache: false, cache: false,
sideHidden: false, sideHidden: false,
activePath: "/recordList" activePath: "/recordList",
},
component: _import("customer/editCustomer"),
}, },
component: _import("customer/editCustomer") };
}
}
// { routerName } // { routerName }
...@@ -854,7 +854,7 @@ export const routerName = { ...@@ -854,7 +854,7 @@ export const routerName = {
path: "/ysprepaymentManage", path: "/ysprepaymentManage",
name: "ysprepaymentManage", name: "ysprepaymentManage",
meta: { meta: {
title: "银盛线上对账单", title: "银盛线上对账单(广联)",
authId: "90517", authId: "90517",
parentId: "905", parentId: "905",
cache: false, cache: false,
......
const _import = require("@/libs/util.import." + process.env.NODE_ENV) const _import = require("@/libs/util.import." + process.env.NODE_ENV);
export const routerName = { export const routerName = {
922: { 922: {
path: "/marketingManagement", path: "/marketingManagement",
...@@ -8,7 +8,7 @@ export const routerName = { ...@@ -8,7 +8,7 @@ export const routerName = {
authId: "922", authId: "922",
parentId: "1", parentId: "1",
cache: false, cache: false,
} },
}, },
92201: { 92201: {
path: "/marketingActivity", path: "/marketingActivity",
...@@ -32,9 +32,9 @@ export const routerName = { ...@@ -32,9 +32,9 @@ export const routerName = {
{ {
authId: "92202", authId: "92202",
name: "新增活动", name: "新增活动",
parentId: "92201" parentId: "92201",
} },
] ],
}, },
{ {
authId: "9220102", authId: "9220102",
...@@ -45,11 +45,11 @@ export const routerName = { ...@@ -45,11 +45,11 @@ export const routerName = {
{ {
authId: "92203", authId: "92203",
name: "订单详情", name: "订单详情",
parentId: "92201" parentId: "92201",
} },
] ],
}, },
] ],
}, },
92202: { 92202: {
path: "/addMarketingActivity", path: "/addMarketingActivity",
...@@ -62,7 +62,7 @@ export const routerName = { ...@@ -62,7 +62,7 @@ export const routerName = {
sideHidden: true, sideHidden: true,
activePath: "/marketingActivity", activePath: "/marketingActivity",
}, },
component: _import("marketingManagement/marketingActivity/addMarketingActivity") component: _import("marketingManagement/marketingActivity/addMarketingActivity"),
}, },
92203: { 92203: {
path: "/viewMarketingActivity", path: "/viewMarketingActivity",
...@@ -82,6 +82,7 @@ export const routerName = { ...@@ -82,6 +82,7 @@ export const routerName = {
parentId: "92203", parentId: "92203",
label: "编辑", label: "编辑",
category: "Button", category: "Button",
type: "primary",
handle: "handleEdit", handle: "handleEdit",
}, },
{ {
...@@ -95,32 +96,108 @@ export const routerName = { ...@@ -95,32 +96,108 @@ export const routerName = {
authId: "9220105", authId: "9220105",
parentId: "92203", parentId: "92203",
label: "暂停", label: "暂停",
handle: "handleToggleStatus", category: "Button",
handle: "handlePause",
}, },
{ {
authId: "9220106", authId: "9220106",
parentId: "92203", parentId: "92203",
label: "恢复", label: "恢复",
handle: "handleToggleStatus" category: "Button",
type: "primary",
handle: "handleResume",
}, },
{ {
authId: "9220107", authId: "9220107",
parentId: "92203", parentId: "92203",
label: "延期", label: "延期",
handle: "handleDelay", category: "Button",
handle: "handleOpenDelay",
}, },
{ {
authId: "9220108", authId: "9220108",
parentId: "92203", parentId: "92203",
label: "下线", label: "下线",
category: "Button",
type: "danger",
handle: "handleOffline", handle: "handleOffline",
}, },
{ {
authId: "9220109", authId: "9220109",
parentId: "92203", parentId: "92203",
category: "Button",
type: "primary",
label: "再次创建", label: "再次创建",
handle: "handleRecreate" handle: "handleRecreate",
} },
] ],
} },
}
92210: {
path: "/marketing-push-strategy",
name: "marketingPushStrategy",
meta: {
title: "营销推送策略",
authId: "92210",
parentId: "922",
cache: false,
},
component: _import("marketingManagement/marketingPushStrategy/views/table/index"),
auth: [
{
authId: "9221001",
parentId: "92210",
label: "新增策略",
category: "Button",
type: "primary",
handle: "handleModify",
addRoutePath: [
{
authId: "9221010",
name: "新增策略",
parentId: "92210",
},
],
},
{
authId: "9221002",
parentId: "92210",
label: "执行记录",
handle: "handleRecord",
},
{
authId: "9221003",
parentId: "92210",
label: "修改",
handle: "handleModify",
addRoutePath: [
{
authId: "9221010",
name: "修改策略",
parentId: "92210",
},
],
},
{
authId: "9221004",
parentId: "92210",
label: "删除",
handle: "handleDelete",
},
],
},
9221010: {
path: "/marketing-push-strategy/modify",
name: "marketingPushStrategyModify",
meta: {
title: "新增策略",
authId: "9221010",
parentId: "92210",
cache: false,
sideHidden: true,
activePath: "/marketing-push-strategy",
},
component: _import("marketingManagement/marketingPushStrategy/views/modify/index"),
},
};
const _import = require("@/libs/util.import." + process.env.NODE_ENV);
export const routerName = {
923: {
path: "/tagManagement",
name: "tagManagementGroup",
meta: {
title: "标签管理",
authId: "923",
parentId: "1",
cache: false,
},
},
92301: {
path: "/tagManagementList",
name: "tagManagement",
meta: {
title: "标签管理",
authId: "92301",
parentId: "923",
cache: false,
},
addRoutePath: [
{
authId: "92302",
name: "维护枚举值",
parentId: "92301",
},
],
auth: [
{
authId: "9230101",
parentId: "92301",
label: "新增子分类",
category: "Button",
type: "primary",
handle: "handleAddCategory",
},
{
authId: "9230102",
parentId: "92301",
label: "新增标签维度",
category: "Button",
type: "primary",
handle: "handleAddDimension",
},
{
authId: "9230103",
parentId: "92301",
label: "编辑",
handle: "handleEditCategory",
},
{
authId: "9230104",
parentId: "92301",
label: "新增枚举",
handle: "handleAddEnum",
},
{
authId: "9230105",
parentId: "92301",
label: "编辑",
handle: "handleEditDimension",
},
{
authId: "9230106",
parentId: "92301",
label: "编辑枚举",
handle: "handleEditEnum",
},
{
authId: "9230108",
parentId: "92301",
label: "维护枚举值",
handle: "handleMaintainEnum",
addRoutePath: [
{
authId: "92302",
name: "维护枚举值",
parentId: "92301",
},
],
},
],
component: _import("tagCustomerManagement/tagManagement/index"),
},
92302: {
path: "/tagEnumMaintain",
name: "tagEnumMaintain",
meta: {
title: "维护枚举值",
authId: "92302",
parentId: "92301",
cache: false,
sideHidden: true,
activePath: "/tagManagementList",
},
auth: [
{
authId: "9230104",
parentId: "92302",
label: "新增枚举值",
category: "Button",
type: "primary",
handle: "handleAddEnum",
},
{
authId: "9230106",
parentId: "92302",
label: "编辑枚举",
handle: "handleEditEnum",
},
],
component: _import("tagCustomerManagement/tagManagement/enumMaintain/index"),
},
};
<template>
<section class="detail-card">
<h3 class="detail-card__title">
基础信息
</h3>
<el-row :gutter="16">
<el-col
v-for="item in fieldList"
:key="item.prop"
class="detail-row"
:span="item.span || 8"
>
<span class="detail-label">{{ item.label }}:</span>
<span class="detail-value">{{ displayInfo[item.prop] || "-" }}</span>
</el-col>
</el-row>
</section>
</template>
<script>
import { CUSTOMER_STATUS_LIST, mapBasicInfoFromRow } from "../utils/customerSnapshot";
export default {
name: "CustomerBasicInfoCard",
props: {
customerRow: {
type: Object,
default: () => ({}),
},
basicInfo: {
type: Object,
default: () => ({}),
},
statusList: {
type: Array,
default: () => CUSTOMER_STATUS_LIST,
},
},
computed: {
displayInfo() {
const fromRow = mapBasicInfoFromRow(this.customerRow, this.statusList);
if (this.basicInfo && Object.keys(this.basicInfo).length) {
return {
...fromRow,
...this.basicInfo,
// 客户分类、客户状态仅来自列表行数据,详情接口不返回
customerCategory: fromRow.customerCategory,
customerStatus: fromRow.customerStatus,
};
}
return fromRow;
},
fieldList() {
return [
{ label: "客户姓名", prop: "customerName" },
{ label: "手机号", prop: "mobile" },
{ label: "客户分类", prop: "customerCategory" },
{ label: "品牌车型", prop: "carModel" },
{ label: "客户状态", prop: "customerStatus" },
{ label: "服务时间", prop: "serviceTime" },
{ label: "备注", prop: "remark", span: 24 },
{ label: "流量来源", prop: "trafficSource" },
{ label: "推荐人", prop: "referrer" },
{ label: "园区店", prop: "parkStore" },
{ label: "转化专员", prop: "conversionStaff" },
{ label: "群关联信息", prop: "groupRelInfo" },
{ label: "创建方式", prop: "createMethod" },
{ label: "创建时间", prop: "createTime" },
{ label: "交车时间", prop: "deliveryTime" },
];
},
},
};
</script>
<style lang="scss" scoped>
.detail-card {
background: #fff;
border-radius: 4px;
padding: 16px 20px 8px;
margin-bottom: 12px;
&__title {
margin: 0 0 16px;
padding-left: 10px;
border-left: 3px solid #409eff;
font-size: 14px;
font-weight: 600;
color: #303133;
line-height: 20px;
}
}
.detail-row {
margin-bottom: 14px;
font-size: 14px;
line-height: 22px;
}
.detail-label {
color: #606266;
}
.detail-value {
color: #303133;
word-break: break-all;
}
</style>
<template>
<d2-container v-loading="pageLoading" class="customer-group-rel-page">
<div class="page-content">
<CustomerBasicInfoCard :basic-info="groupData.basicInfo"
:customer-row="customerRow" />
<section class="detail-card">
<h3 class="detail-card__title">
群关联
</h3>
<div v-for="item in groupFieldList"
:key="item.prop"
class="field-row">
<span class="field-label">{{ item.label }}:</span>
<span class="field-value">{{ displayGroupInfo[item.prop] || "-" }}</span>
</div>
</section>
<div class="footer-actions">
<el-button size="medium"
type="primary"
@click="handleBack">
返回
</el-button>
</div>
</div>
</d2-container>
</template>
<script>
import { queryCustomerGroups } from "@api/customerDetail";
import CustomerBasicInfoCard from "../components/CustomerBasicInfoCard.vue";
import { loadCustomerSnapshot, mapGroupAssocResponse, resolveCustomerRowFromRoute } from "../utils/customerSnapshot";
export default {
name: "CustomerGroupRel",
components: { CustomerBasicInfoCard },
data() {
return {
pageLoading: false,
customerId: "",
customerRow: {},
groupData: {
basicInfo: {},
groupRelStatus: "",
groupName: "",
groupMemberCustomer: "",
},
};
},
computed: {
groupFieldList() {
return [
{ label: "群关联状态", prop: "groupRelStatus" },
{ label: "群名称", prop: "groupName" },
{ label: "群成员-客户", prop: "groupMemberCustomer" },
];
},
displayGroupInfo() {
return {
groupRelStatus: this.groupData.groupRelStatus || "未关联",
groupName: this.groupData.groupName || "",
groupMemberCustomer: this.groupData.groupMemberCustomer || "",
};
},
},
created() {
this.customerId = this.$route.query.customerId;
if (!this.customerId) {
this.$message.warning("缺少客户参数");
this.$router.back();
return;
}
this.customerRow = resolveCustomerRowFromRoute(
this.$route,
loadCustomerSnapshot(),
);
this.loadGroupInfo();
},
methods: {
async loadGroupInfo() {
this.pageLoading = true;
try {
const res = await queryCustomerGroups({
id: this.customerId,
});
this.applyGroupData(mapGroupAssocResponse(res || {}, this.customerRow));
} catch (err) {
this.$message.error(err.message || "加载群关联失败");
this.applyGroupData(mapGroupAssocResponse({}, this.customerRow));
} finally {
this.pageLoading = false;
}
},
applyGroupData(res) {
this.groupData = {
basicInfo: res.basicInfo || {},
groupRelStatus: res.groupRelStatus || "未关联",
groupName: res.groupName || "",
groupMemberCustomer: res.groupMemberCustomer || "",
};
},
handleBack() {
this.$router.push({ name: "customerList" });
},
},
};
</script>
<style lang="scss" scoped>
.customer-group-rel-page {
::v-deep .d2-container-full__body {
padding: 0 !important;
background: #f0f2f5;
}
.page-content {
width: 100%;
box-sizing: border-box;
padding: 12px 20px 32px;
}
.detail-card {
background: #fff;
border: 1px solid #ebeef5;
border-radius: 4px;
padding: 16px 20px;
margin-bottom: 12px;
&__title {
margin: 0 0 16px;
padding-left: 10px;
border-left: 3px solid #409eff;
font-size: 14px;
font-weight: 600;
color: #303133;
line-height: 20px;
}
}
.field-row {
display: flex;
align-items: flex-start;
margin-bottom: 14px;
font-size: 14px;
line-height: 22px;
&:last-child {
margin-bottom: 0;
}
}
.field-label {
flex-shrink: 0;
min-width: 110px;
color: #606266;
}
.field-value {
flex: 1;
color: #303133;
word-break: break-all;
}
.footer-actions {
margin-top: 8px;
padding: 16px 0 8px;
text-align: center;
}
}
</style>
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
<p>今日邀约详情</p> <p>今日邀约详情</p>
</div> </div>
<div class="appoint-table-content"> <div class="appoint-table-content">
<table <table cellpadding="0"
cellpadding="0"
cellspacing="0"> cellspacing="0">
<tr class="appoint-table-header"> <tr class="appoint-table-header">
<td>邀约时间</td> <td>邀约时间</td>
...@@ -14,26 +13,24 @@ ...@@ -14,26 +13,24 @@
<td>服务状态</td> <td>服务状态</td>
</tr> </tr>
<template v-if="detailData.length"> <template v-if="detailData.length">
<tr <tr v-for="(item, index) in detailData"
v-for="(item, index) in detailData"
:key="index"> :key="index">
<td>{{ item.time }}</td> <td>{{ item.time }}</td>
<td class="flex"> <td class="flex">
<img <img class="detail-header"
class="detail-header"
:src="item.info.sex === 1 ? './images/header-man-grey.png' : './images/header-woman.png'"> :src="item.info.sex === 1 ? './images/header-man-grey.png' : './images/header-woman.png'">
<template class="detail-info"> <template class="detail-info">
<p>{{ item.info.name }}</p> <p>{{ item.info.name }}</p>
<p>{{ item.info.project }}</p> <p>{{ item.info.project }}</p>
</template> </template>
<template class="detail-phone"> <template class="detail-phone">
<p <p v-show="!item.info.phone"
class="secret-phone" class="secret-phone">
v-show="!item.info.phone">
<span class="one-tip">手机号码已加密</span> <span class="one-tip">手机号码已加密</span>
<span <span class="two-tip"
class="two-tip" @click="handleGetPhone(item, index)">
@click="handleGetPhone(item, index)">获取虚拟手机号</span> 获取虚拟手机号
</span>
</p> </p>
<p v-show="item.info.phone"> <p v-show="item.info.phone">
{{ item.info.phone }} {{ item.info.phone }}
...@@ -57,126 +54,132 @@ ...@@ -57,126 +54,132 @@
<script> <script>
export default { export default {
name: 'AppointTable', name: "AppointTable",
data() { data() {
return { return {
hoursList: [ hoursList: [
{ hour: '9:00' }, { hour: '10:00' }, { hour: "9:00" },
{ hour: '11:00' }, { hour: '12:00' }, { hour: "10:00" },
{ hour: '13:00' }, { hour: '14:00' }, { hour: "11:00" },
{ hour: '15:00' }, { hour: '16:00' }, { hour: "12:00" },
{ hour: '17:00' }, { hour: '18:00' }], { hour: "13:00" },
{ hour: "14:00" },
{ hour: "15:00" },
{ hour: "16:00" },
{ hour: "17:00" },
{ hour: "18:00" },
],
detailData: [{ detailData: [{
time: '上午9:00', time: "上午9:00",
info: { info: {
header: '', header: "",
name: '张三', name: "张三",
// 1 - 男; 2 - 女 // 1 - 男; 2 - 女
sex: 1, sex: 1,
project: '预约项目', project: "预约项目",
phone: '' phone: "",
}, },
// 0 - 未到店; 1 - 完成服务 // 0 - 未到店; 1 - 完成服务
status: 0 status: 0,
}, { }, {
time: '上午9:00', time: "上午9:00",
info: { info: {
header: '', header: "",
name: '张兰', name: "张兰",
sex: 2, sex: 2,
project: '预约项目', project: "预约项目",
phone: '' phone: "",
}, },
// 0 - 未到店; 1 - 完成服务 // 0 - 未到店; 1 - 完成服务
status: 1 status: 1,
}, { }, {
time: '上午10:00', time: "上午10:00",
info: { info: {
header: '', header: "",
name: '张一二', name: "张一二",
sex: 1, sex: 1,
project: '预约项目', project: "预约项目",
phone: '' phone: "",
}, },
// 0 - 未到店; 1 - 完成服务 // 0 - 未到店; 1 - 完成服务
status: 0 status: 0,
}, { }, {
time: '上午10:00', time: "上午10:00",
info: { info: {
header: '', header: "",
name: '张一二', name: "张一二",
sex: 1, sex: 1,
project: '预约项目', project: "预约项目",
phone: '' phone: "",
}, },
// 0 - 未到店; 1 - 完成服务 // 0 - 未到店; 1 - 完成服务
status: 0 status: 0,
}, { }, {
time: '上午10:00', time: "上午10:00",
info: { info: {
header: '', header: "",
name: '张一二', name: "张一二",
sex: 1, sex: 1,
project: '预约项目', project: "预约项目",
phone: '' phone: "",
}, },
// 0 - 未到店; 1 - 完成服务 // 0 - 未到店; 1 - 完成服务
status: 0 status: 0,
}, { }, {
time: '上午10:00', time: "上午10:00",
info: { info: {
header: '', header: "",
name: '张一二', name: "张一二",
sex: 1, sex: 1,
project: '预约项目', project: "预约项目",
phone: '' phone: "",
}, },
// 0 - 未到店; 1 - 完成服务 // 0 - 未到店; 1 - 完成服务
status: 0 status: 0,
}, { }, {
time: '上午10:00', time: "上午10:00",
info: { info: {
header: '', header: "",
name: '张一二', name: "张一二",
sex: 1, sex: 1,
project: '预约项目', project: "预约项目",
phone: '' phone: "",
}, },
// 0 - 未到店; 1 - 完成服务 // 0 - 未到店; 1 - 完成服务
status: 0 status: 0,
}, { }, {
time: '上午10:00', time: "上午10:00",
info: { info: {
header: '', header: "",
name: '张一二', name: "张一二",
sex: 1, sex: 1,
project: '预约项目', project: "预约项目",
phone: '' phone: "",
}, },
// 0 - 未到店; 1 - 完成服务 // 0 - 未到店; 1 - 完成服务
status: 0 status: 0,
}] }],
} };
}, },
mounted() { }, mounted() { },
methods: { methods: {
handleGetPhone(targetItem, targetIndex) { handleGetPhone(targetItem, targetIndex) {
this.$confirm('客户手机号码已加密,是否获取虚拟号码?', '提示', { this.$confirm("客户手机号码已加密,是否获取虚拟号码?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning",
}).then(() => { }).then(() => {
this.detailData[targetIndex].info.phone = '13088889999' this.detailData[targetIndex].info.phone = "13088889999";
}).catch(err => { }).catch((err) => {
console.log(err) console.log(err);
}) });
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.appoint-table { .appoint-table {
width: 49%; width: 49%;
...@@ -245,7 +248,7 @@ export default { ...@@ -245,7 +248,7 @@ export default {
} }
.two-tip { .two-tip {
color: #ffffff; color: #ffffff;
background-color: #4ECB73; background-color: #4ecb73;
} }
} }
.secret-phone:hover { .secret-phone:hover {
......
...@@ -14,34 +14,36 @@ ...@@ -14,34 +14,36 @@
</div> </div>
<p class="date-y-line" /> <p class="date-y-line" />
</template> </template>
<el-button icon="el-icon-d-arrow-left" <el-button class="arrow-left-icon"
icon="el-icon-d-arrow-left"
type="text" type="text"
class="arrow-left-icon"
:disabled="currentWeek === 1" :disabled="currentWeek === 1"
@click="handleWeek(false)" /> @click="handleWeek(false)" />
<template> <template>
<div class="date-picker"> <div class="date-picker">
<div class="wrapper" <div v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)"
v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)" :key="index"
:key="index"> class="wrapper">
<span> <span>
<p v-for="(info, infoIndex) in appointData[index].infoList" <p v-for="(info, infoIndex) in appointData[index].infoList"
:key="infoIndex"> :key="infoIndex">
<el-popover placement="bottom-start" <el-popover open-delay="600"
placement="bottom-start"
title="" title=""
width="200"
open-delay="600"
trigger="hover" trigger="hover"
width="200"
:disabled="info.status === 0"> :disabled="info.status === 0">
<div> <div>
<p>1、客户姓名,时间,项目</p> <p>1、客户姓名,时间,项目</p>
<p>2、客户姓名,时间,项目</p> <p>2、客户姓名,时间,项目</p>
<p>余位数:8</p> <p>余位数:8</p>
</div> </div>
<el-button :class="{'col-width': true, 'hour-template': true, 'status-full': info.status === 2, 'status-remain': info.status === 1 }" <el-button slot="reference"
slot="reference" class="col-width hour-template"
:class="{ 'status-full': info.status === 2, 'status-remain': info.status === 1 }"
@click="handleAppoint(item, infoIndex)"> @click="handleAppoint(item, infoIndex)">
{{ appointStatusList[info.status] }}</el-button> {{ appointStatusList[info.status] }}
</el-button>
</el-popover> </el-popover>
</p> </p>
</span> </span>
...@@ -49,13 +51,14 @@ ...@@ -49,13 +51,14 @@
</div> </div>
<p class="date-x-line" /> <p class="date-x-line" />
<div class="date-picker"> <div class="date-picker">
<div class="wrapper" <div v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)"
v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)" :key="index"
:key="index"> class="wrapper">
<el-button type="text" <el-button class="date-btn col-width"
:class="{'date-btn': true, 'col-width': true, 'active': item.active}" type="text"
:class="{ active: item.active }"
@click="handleSelectDate(index)"> @click="handleSelectDate(index)">
<p>{{ item.date.split('/')[1] + '.' + item.date.split('/')[2] }}</p> <p>{{ `${item.date.split('/')[1]}.${item.date.split('/')[2]}` }}</p>
<p>{{ weekList[item.week] }}</p> <p>{{ weekList[item.week] }}</p>
</el-button> </el-button>
</div> </div>
...@@ -70,38 +73,39 @@ ...@@ -70,38 +73,39 @@
</template> </template>
<script> <script>
import { appointDays } from '@/common/format' import { appointDays } from "@/common/format";
export default { export default {
name: 'TimeDate', name: "TimeDate",
props: {
appointData: {
type: Array,
default: () => [],
},
hoursList: {
type: Array,
default: () => [],
},
},
data() { data() {
return { return {
// 7天为一个周期,预约时间为35天,一共5个周期,当前周期 // 7天为一个周期,预约时间为35天,一共5个周期,当前周期
currentWeek: 1, currentWeek: 1,
// 日期 // 日期
dateIndex: 0, dateIndex: 0,
weekList: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], weekList: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
dateList: new Array(appointDays).fill(null).map((item, index) => { dateList: new Array(appointDays).fill(null).map((item, index) => {
var date = new Date(new Date().setDate(new Date().getDate() + index)) let date = new Date(new Date().setDate(new Date().getDate() + index));
return { return {
date: date.toLocaleDateString(), date: date.toLocaleDateString(),
week: date.getDay(), week: date.getDay(),
active: !index active: !index,
} };
}), }),
// 时间 // 时间
appointStatusList: ['空', '余', '满'] appointStatusList: ["空", "余", "满"],
} };
},
props: {
appointData: {
type: Array,
default: () => []
},
hoursList: {
type: Array,
default: () => []
}
}, },
mounted() { }, mounted() { },
...@@ -117,12 +121,12 @@ export default { ...@@ -117,12 +121,12 @@ export default {
// this.$emit('handleAppoint', { date: date.date, hour: this.hoursList[hourIndex].hour }) // this.$emit('handleAppoint', { date: date.date, hour: this.hoursList[hourIndex].hour })
}, },
handleWeek(isAdd) { handleWeek(isAdd) {
isAdd ? this.currentWeek++ : this.currentWeek-- isAdd ? this.currentWeek++ : this.currentWeek--;
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./css/timeDateStyle.scss"; @import "./css/timeDateStyle.scss";
</style> </style>
<template>
<d2-container v-loading="pageLoading" class="customer-portrait-page">
<div class="page-content">
<CustomerBasicInfoCard :basic-info="portraitData.basicInfo"
:customer-row="customerRow" />
<section class="detail-card">
<h3 class="detail-card__title">
消费力标签({{ consumptionScore }}分)
</h3>
<template v-if="consumptionDimensions.length">
<div v-for="(dimension, index) in consumptionDimensions"
:key="`consumption-${index}`"
class="field-row">
<span class="field-label">{{ dimension.dimensionName }}:</span>
<div class="tag-list">
<template v-if="dimension.tags.length">
<el-tag v-for="(tag, tagIndex) in dimension.tags"
:key="`consumption-tag-${index}-${tagIndex}`"
class="tag-item"
size="small">
{{ tag }}
</el-tag>
</template>
<span v-else class="empty-text">-</span>
</div>
</div>
</template>
<div v-else class="field-row">
<span class="empty-text">-</span>
</div>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
产品标签({{ productScore }}分)
</h3>
<template v-if="productDimensions.length">
<div v-for="(dimension, index) in productDimensions"
:key="`product-${index}`"
class="field-row">
<span class="field-label">{{ dimension.dimensionName }}:</span>
<div class="tag-list">
<template v-if="dimension.tags.length">
<el-tag v-for="(tag, tagIndex) in dimension.tags"
:key="`product-tag-${index}-${tagIndex}`"
class="tag-item"
size="small">
{{ tag }}
</el-tag>
</template>
<span v-else class="empty-text">-</span>
</div>
</div>
</template>
<div v-else class="field-row">
<span class="empty-text">-</span>
</div>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
行为标签({{ behaviorScore }}分)
</h3>
<el-table class="behavior-table"
size="small"
border
:data="behaviorTagList">
<el-table-column align="center"
label="序号"
type="index"
width="60" />
<el-table-column align="center"
label="标签维度"
min-width="200"
prop="dimensionName" />
<el-table-column align="center"
label="枚举值"
min-width="120">
<template #default="scope">
<el-tag v-if="scope.row.enumName"
class="tag-item"
size="small">
{{ scope.row.enumName }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column align="left"
label="依据"
min-width="320"
prop="basis">
<template #default="scope">
<span class="basis-text">{{ scope.row.basis || "-" }}</span>
</template>
</el-table-column>
</el-table>
</section>
<div class="footer-actions">
<el-button size="medium"
type="primary"
@click="handleBack">
返回
</el-button>
</div>
</div>
</d2-container>
</template>
<script>
import { queryCustomerPortrait } from "@api/customerDetail";
import CustomerBasicInfoCard from "../components/CustomerBasicInfoCard.vue";
import {
loadCustomerSnapshot,
mapProfileResponse,
resolveCustomerRowFromRoute,
} from "../utils/customerSnapshot";
export default {
name: "CustomerPortrait",
components: { CustomerBasicInfoCard },
data() {
return {
pageLoading: false,
customerId: "",
customerRow: {},
portraitData: {
basicInfo: {},
consumptionScore: 0,
consumptionDimensions: [],
productScore: 0,
productDimensions: [],
behaviorScore: 0,
behaviorTagList: [],
},
};
},
computed: {
consumptionScore() {
return this.portraitData.consumptionScore || 0;
},
productScore() {
return this.portraitData.productScore || 0;
},
behaviorScore() {
return this.portraitData.behaviorScore || 0;
},
consumptionDimensions() {
return this.portraitData.consumptionDimensions || [];
},
productDimensions() {
return this.portraitData.productDimensions || [];
},
behaviorTagList() {
return this.portraitData.behaviorTagList || [];
},
},
created() {
this.customerId = this.$route.query.customerId;
if (!this.customerId) {
this.$message.warning("缺少客户参数");
this.$router.back();
return;
}
this.customerRow = resolveCustomerRowFromRoute(
this.$route,
loadCustomerSnapshot(),
);
this.loadPortrait();
},
methods: {
async loadPortrait() {
this.pageLoading = true;
try {
const res = await queryCustomerPortrait({
id: this.customerId,
});
this.applyPortraitData(
mapProfileResponse(res || {}, this.customerRow),
);
} catch (err) {
this.$message.error(err.message || "加载客户画像失败");
this.applyPortraitData(
mapProfileResponse({}, this.customerRow),
);
} finally {
this.pageLoading = false;
}
},
applyPortraitData(res) {
this.portraitData = {
basicInfo: res.basicInfo || {},
consumptionScore: res.consumptionScore || 0,
consumptionDimensions: res.consumptionDimensions || [],
productScore: res.productScore || 0,
productDimensions: res.productDimensions || [],
behaviorScore: res.behaviorScore || 0,
behaviorTagList: res.behaviorTagList || [],
};
},
handleBack() {
this.$router.push({ name: "customerList" });
},
},
};
</script>
<style lang="scss" scoped>
.customer-portrait-page {
::v-deep .d2-container-full__body {
padding: 0 !important;
background: #f0f2f5;
}
.page-content {
width: 100%;
box-sizing: border-box;
padding: 12px 20px 32px;
}
.detail-card {
background: #fff;
border: 1px solid #ebeef5;
border-radius: 4px;
padding: 16px 20px;
margin-bottom: 12px;
&__title {
margin: 0 0 16px;
padding-left: 10px;
border-left: 3px solid #409eff;
font-size: 14px;
font-weight: 600;
color: #303133;
line-height: 20px;
}
}
.field-row {
display: flex;
align-items: flex-start;
margin-bottom: 12px;
font-size: 14px;
line-height: 22px;
&:last-child {
margin-bottom: 0;
}
}
.field-label {
flex-shrink: 0;
min-width: 90px;
color: #606266;
}
.tag-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
flex: 1;
}
.tag-item {
background: #ecf5ff;
border-color: #d9ecff;
color: #409eff;
&--plain {
background: #f4f4f5;
border-color: #e9e9eb;
color: #909399;
}
}
.empty-text {
color: #909399;
}
.behavior-table {
width: 100%;
}
.basis-text {
display: inline-block;
word-break: break-all;
white-space: pre-wrap;
line-height: 20px;
color: #606266;
}
.footer-actions {
margin-top: 8px;
padding: 16px 0 8px;
text-align: center;
}
}
</style>
const SNAPSHOT_KEY = "customerDetailSnapshot";
export const CUSTOMER_STATUS_LIST = [
{ confId: 1, confLabel: "待跟进" },
{ confId: 2, confLabel: "已升级" },
{ confId: 3, confLabel: "战败" },
{ confId: 4, confLabel: "已退款" },
];
export function saveCustomerSnapshot(row) {
if (!row) {
return;
}
try {
sessionStorage.setItem(SNAPSHOT_KEY, JSON.stringify(row));
} catch (err) {
// ignore quota errors
}
}
export function loadCustomerSnapshot() {
try {
const raw = sessionStorage.getItem(SNAPSHOT_KEY);
return raw ? JSON.parse(raw) : {};
} catch (err) {
return {};
}
}
/** 合并列表行快照与路由参数,客户分类仅来自列表数据 */
export function resolveCustomerRowFromRoute(route = {}, snapshotRow = {}) {
const row = { ...snapshotRow };
if (route.query && route.query.customerClass) {
row.customerClass = route.query.customerClass;
}
if (route.query && route.query.customerStatus !== undefined && route.query.customerStatus !== "") {
row.customerStatus = route.query.customerStatus;
}
return row;
}
function formatDateValue(value) {
if (!value) {
return "";
}
return new Date(value).toLocaleDateString();
}
export function formatCarModel(row = {}) {
const carModel = (row.carModel || "").trim();
if (carModel) {
return carModel;
}
const parts = [row.carBrand, row.carSeriesName, row.carTypeName]
.map(item => (item || "").trim())
.filter(Boolean);
return parts.length ? parts.join("-") : "";
}
export function formatCarModelForList(row = {}) {
const value = formatCarModel(row);
return value || "";
}
export function formatListPhone(row = {}) {
return row.customerPhone || row.mobile || row.phone || row.phoneNumber || "";
}
export function formatCustomerClass(row = {}) {
const customerClass = row.customerClass || row.customerCategory;
if (!customerClass) {
return "";
}
const normalized = String(customerClass).trim().toUpperCase();
if (normalized === "A" || normalized === "A类") {
return "A类";
}
if (normalized === "B" || normalized === "B类") {
return "B类";
}
if (normalized === "C" || normalized === "C类") {
return "C类";
}
return String(customerClass);
}
export function formatGroupStatus(row = {}) {
if (row.groupStatus === true || row.groupStatus === "已关联") {
return "已关联";
}
return "未关联";
}
export function formatDeliveryTime(row = {}) {
const time = row.deliveryDate;
return formatDateValue(time);
}
export function formatRecorder(row = {}) {
return row.userName || row.advanceUserName || row.createdBy || "";
}
export function formatReferrer(row = {}) {
return row.referrerName
|| row.employeeName
|| (row.order && row.order.employeeName)
|| "";
}
export function formatCustomerStatus(row = {}, statusList = CUSTOMER_STATUS_LIST) {
const customerStatus = row.customerStatus;
if (customerStatus == null || customerStatus === "") {
return "-";
}
const matched = statusList.find(item => Number(item.confId) === Number(customerStatus));
return matched ? matched.confLabel : "-";
}
export function formatServiceTime(row = {}) {
const time = row.order && row.order.installUpgradeTime;
if (!time) {
return "-";
}
return new Date(time).toLocaleDateString();
}
export function formatRemark(row = {}) {
if (!row.order) {
return "无";
}
if (row.order.upgradeFlag === "N") {
return row.order.customer
? (row.order.customer.refusalReason || "无")
: "无";
}
return row.order.remark || "无";
}
export function formatSource(row = {}) {
const source = row.order ? row.order.source : row.source;
if (source === 3) {
return "现场升级";
}
if (source === 5) {
return "核销抵扣";
}
return "系统录入";
}
export function formatCreateTime(row = {}) {
if (!row.createdDate) {
return "";
}
return formatDateValue(row.createdDate);
}
export function mapBasicInfoFromRow(row = {}, statusList = CUSTOMER_STATUS_LIST) {
const deliveryTime = formatDeliveryTime(row);
const referrer = formatReferrer(row);
const recorder = formatRecorder(row);
return {
customerName: row.customerName || "-",
mobile: formatListPhone(row) || "-",
customerCategory: formatCustomerClass(row) || "-",
carModel: formatCarModel(row) || "-",
customerStatus: formatCustomerStatus(row, statusList),
serviceTime: formatServiceTime(row),
remark: formatRemark(row),
trafficSource: row.merchantName || "-",
referrer: referrer || "-",
parkStore: row.yqMerchantName || "-",
conversionStaff: (row.order && row.order.sellerName) || "-",
groupRelInfo: formatGroupStatus(row),
createMethod: formatSource(row),
createTime: formatCreateTime(row) || "-",
deliveryTime: deliveryTime || "-",
recorder: recorder || "-",
};
}
function buildProfileCarModel(res = {}) {
const carModel = (res.carModel || "").trim();
if (carModel) {
return carModel;
}
const parts = [res.carBrand, res.carSeriesName]
.map(item => (item || "").trim())
.filter(Boolean);
return parts.length ? parts.join("-") : "";
}
export function mapProfileResponse(res = {}, snapshotRow = {}) {
const snapshotBasic = mapBasicInfoFromRow(snapshotRow);
const deliveryTime = res.deliveryDate
? formatDateValue(res.deliveryDate)
: snapshotBasic.deliveryTime;
const basicInfo = {
...snapshotBasic,
customerName: res.customerName || snapshotBasic.customerName,
mobile: res.customerPhone || snapshotBasic.mobile,
carModel: buildProfileCarModel(res) || snapshotBasic.carModel,
trafficSource: res.merchantName || snapshotBasic.trafficSource,
deliveryTime: deliveryTime || "-",
// 客户分类、客户状态仅来自列表接口,详情接口不返回
customerCategory: snapshotBasic.customerCategory,
customerStatus: snapshotBasic.customerStatus,
};
const consumptionTag = res.consumptionTag || {};
const productTag = res.productTag || {};
const behaviorTag = res.behaviorTag || {};
const consumptionDimensions = (consumptionTag.dimensions || []).map(dimension => ({
dimensionName: dimension.dimensionName || "-",
tags: (dimension.enumValues || []).map(item => item.enumName).filter(Boolean),
}));
const productDimensions = [];
const dealTags = (productTag.dealEnumValues || [])
.map(item => item.enumName)
.filter(Boolean);
if (dealTags.length) {
productDimensions.push({ dimensionName: "已成交品类", tags: dealTags });
}
const noDealTags = (productTag.noDealEnumValues || [])
.map(item => item.enumName)
.filter(Boolean);
if (noDealTags.length) {
productDimensions.push({ dimensionName: "未成交品类", tags: noDealTags });
}
const behaviorTagList = [];
(behaviorTag.dimensions || []).forEach((dimension) => {
(dimension.enumValues || []).forEach((enumValue) => {
behaviorTagList.push({
dimensionName: dimension.dimensionName || "-",
enumName: enumValue.enumName || "",
basis: enumValue.scoreBasis || "",
});
});
});
return {
basicInfo,
consumptionScore: consumptionTag.totalScore || 0,
consumptionDimensions,
productScore: productTag.totalScore || 0,
productDimensions,
behaviorScore: behaviorTag.totalScore || 0,
behaviorTagList,
};
}
export function mapGroupAssocResponse(res = {}, snapshotRow = {}) {
const snapshotBasic = mapBasicInfoFromRow(snapshotRow);
const groupRelStatus = res.groupStatus || "未关联";
const basicInfo = {
...snapshotBasic,
customerName: res.customerName || snapshotBasic.customerName,
mobile: res.customerPhone || snapshotBasic.mobile,
// 客户分类、客户状态仅来自列表接口,详情接口不返回
customerCategory: snapshotBasic.customerCategory,
customerStatus: snapshotBasic.customerStatus,
// 接口返回后同步基础信息中的群关联状态
groupRelInfo: groupRelStatus,
};
return {
basicInfo,
groupRelStatus,
groupName: res.qwGroupName || "",
groupMemberCustomer: res.wxName || "",
};
}
...@@ -101,6 +101,16 @@ import multipleMixin from "./multipleMixin"; ...@@ -101,6 +101,16 @@ import multipleMixin from "./multipleMixin";
export default { export default {
name: "MultipleRecording", name: "MultipleRecording",
mixins: [multipleMixin], mixins: [multipleMixin],
props: {
/**
* biz: 业务类型
* 1.延保 2.轻改 3.权益 4.二手车
*/
biz: {
type: Number,
default: 1,
},
},
data() { data() {
return { return {
dialogConfig: { dialogConfig: {
...@@ -183,6 +193,14 @@ export default { ...@@ -183,6 +193,14 @@ export default {
mounted() { mounted() {
}, },
methods: { methods: {
beforeSearchFn() {
// 1.延保 2.轻改 3.权益 4.二手车 延保和权益都传1
return new Promise((resolve) => {
this.searchFormSearch = this.getParams();
this.searchFormSearch.businessType = this.biz == 3 ? 1 : this.biz;
resolve();
});
},
getParams() { getParams() {
let params = this.deepClone(this.searchForm); let params = this.deepClone(this.searchForm);
if (params.receptionDate) { if (params.receptionDate) {
......
...@@ -149,6 +149,7 @@ ...@@ -149,6 +149,7 @@
@dialogClose="staffTag1Visible = false"> @dialogClose="staffTag1Visible = false">
</MultipleStaff> </MultipleStaff>
<MultipleRecording ref="recordingTagRef" <MultipleRecording ref="recordingTagRef"
:biz="biz"
:choose-data="formData.recordingList" :choose-data="formData.recordingList"
:visible="recordingTagVisible" :visible="recordingTagVisible"
@choose="formatMultipleList($event, 'recordingList')" @choose="formatMultipleList($event, 'recordingList')"
......
...@@ -230,7 +230,7 @@ export default { ...@@ -230,7 +230,7 @@ export default {
formatter: row => formatThousand(row.dayEndBalance), formatter: row => formatThousand(row.dayEndBalance),
}, },
{ {
label: "待补录订单", label: "待补录未分账订单",
prop: "waitInputMoney", prop: "waitInputMoney",
minWidth: "90px", minWidth: "90px",
formatter: row => formatThousand(row.waitInputMoney), formatter: row => formatThousand(row.waitInputMoney),
...@@ -391,11 +391,11 @@ export default { ...@@ -391,11 +391,11 @@ export default {
}); });
}, },
handleOnlineDetail(row) { handleOnlineDetail(row) {
const { merchantId, merchantName, yqMerchantId, yqMerchantName } = row; const { yqMerchantId, yqMerchantName } = row;
const { startTradeTime: startTime, endTradeTime: endTime } = this.getParams(); const { startTradeTime: startTime, endTradeTime: endTime } = this.getParams();
this.$router.push({ this.$router.push({
name: "ysprepaymentDetail", name: "ysprepaymentDetail",
params: { merchantId, merchantName, yqMerchantId, yqMerchantName, startTime, endTime }, params: { yqMerchantId, yqMerchantName, startTime, endTime },
}); });
}, },
handleExport() { handleExport() {
......
...@@ -14,16 +14,24 @@ function getFirstValue(row, props) { ...@@ -14,16 +14,24 @@ function getFirstValue(row, props) {
const textFormatter = props => row => getFirstValue(row, props) || "-"; const textFormatter = props => row => getFirstValue(row, props) || "-";
const amountFormatter = props => row => formatThousand(getFirstValue(row, props)); const amountFormatter = props => row => formatThousand(getFirstValue(row, props));
const tradeDetailFormatter = prop => row => row.tradeDetail?.[prop] || "-"; const tradeDetailFormatter = prop => row => row.tradeDetail?.[prop] || "-";
const typeObj = {
1: "平台方",
2: "服务商",
3: "门店",
4: "平台方",
};
export const ONLINE_DETAIL_TAB = { export const ONLINE_DETAIL_TAB = {
SUMMARY_COLLECTION: "summery-collection", SUMMARY_COLLECTION: "summery-collection",
DETAIL_COLLECTION: "detail-collection", DETAIL_COLLECTION: "detail-collection",
SUMMARY_ALLOCATION: "summery_allocation",
DETAIL_ALLOCATION: "detail-allocation", DETAIL_ALLOCATION: "detail-allocation",
}; };
export const ONLINE_DETAIL_TABLE_COLUMNS = { export const ONLINE_DETAIL_TABLE_COLUMNS = {
// 汇总-收款 // 汇总-收款
[ONLINE_DETAIL_TAB.SUMMARY_COLLECTION]: [ [ONLINE_DETAIL_TAB.SUMMARY_COLLECTION]: {
tableColumns: [
{ {
label: "收款月份", label: "收款月份",
prop: "tradeMonth", prop: "tradeMonth",
...@@ -42,18 +50,42 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = { ...@@ -42,18 +50,42 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = {
prop: "realityPlatformMerchantName", prop: "realityPlatformMerchantName",
}, },
{ {
label: "业务", label: "轻改",
prop: "businessType", prop: "lightChangeAmount",
formatter: amountFormatter(["lightChangeAmount"]),
}, },
{ {
label: "收款金额", label: "权益",
prop: "equityAmount",
formatter: amountFormatter(["equityAmount"]),
},
{
label: "延保",
prop: "extendedWarrantyAmount",
formatter: amountFormatter(["extendedWarrantyAmount"]),
},
{
label: "待补录已分账订单",
prop: "waitInputtedAmount",
formatter: amountFormatter(["waitInputtedAmount"]),
},
{
label: "待补录未分账订单",
prop: "waitInputtedNotDivisionAmount",
formatter: amountFormatter(["waitInputtedNotDivisionAmount"]),
},
{
label: "收款金额总计",
prop: "tradeAmount", prop: "tradeAmount",
minWidth: 90, minWidth: 90,
formatter: amountFormatter(["tradeAmount"]), formatter: amountFormatter(["tradeAmount"]),
}, },
], ],
tableSummary: ["lightChangeAmount", "equityAmount", "extendedWarrantyAmount", "waitInputtedAmount", "waitInputtedNotDivisionAmount", "tradeAmount"],
},
// 明细-收款 // 明细-收款
[ONLINE_DETAIL_TAB.DETAIL_COLLECTION]: [ [ONLINE_DETAIL_TAB.DETAIL_COLLECTION]: {
tableColumns: [
{ {
label: "收款时间", label: "收款时间",
prop: "tradeTime", prop: "tradeTime",
...@@ -62,14 +94,17 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = { ...@@ -62,14 +94,17 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = {
}, },
{ {
label: "园区店名", label: "园区店名",
minWidth: 120,
prop: "yqMerchantName", prop: "yqMerchantName",
}, },
{ {
label: "门店名称", label: "门店名称",
minWidth: 120,
prop: "merchantName", prop: "merchantName",
}, },
{ {
label: "收入所属公司", label: "收入所属公司",
minWidth: 120,
prop: "realityPlatformMerchantName", prop: "realityPlatformMerchantName",
}, },
{ {
...@@ -103,8 +138,103 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = { ...@@ -103,8 +138,103 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = {
minWidth: 120, minWidth: 120,
}, },
], ],
tableSummary: ["tradeAmount", "serviceCharge"],
},
// 汇总-分账
[ONLINE_DETAIL_TAB.SUMMARY_ALLOCATION]: {
tableColumns: [
{
label: "到账月份",
prop: "estimatedArrivalMonth",
minWidth: 120,
formatter: tradeDetailFormatter(["estimatedArrivalMonth"]),
},
{
label: "园区店名",
prop: "yqMerchantName",
minWidth: 120,
formatter: tradeDetailFormatter(["yqMerchantName"]),
},
{
label: "门店名称",
prop: "merchantName",
minWidth: 140,
formatter: tradeDetailFormatter(["merchantName"]),
},
{
label: "收入所属公司",
prop: "realityPlatformMerchantName",
minWidth: 140,
formatter: tradeDetailFormatter(["realityPlatformMerchantName"]),
},
{
label: "分账对象",
prop: "realityMerchantName",
minWidth: 140,
},
{
label: "分账对象类型",
prop: "targetMerchantType",
minWidth: 120,
formatter: (row) => {
return typeObj[row?.targetMerchantType] || "-";
},
},
{
label: "轻改",
prop: "lightChangeAmount",
minWidth: 90,
formatter: amountFormatter(["lightChangeAmount"]),
},
{
label: "权益",
prop: "equityAmount",
minWidth: 90,
formatter: amountFormatter(["equityAmount"]),
},
{
label: "延保",
prop: "extendedWarrantyAmount",
minWidth: 90,
formatter: amountFormatter(["extendedWarrantyAmount"]),
},
{
label: "待补录已分账订单",
minWidth: 100,
prop: "waitInputtedAmount",
formatter: amountFormatter(["waitInputtedAmount"]),
},
{
label: "分账金额合计",
prop: "divisionMoney",
minWidth: 110,
formatter: amountFormatter(["divisionMoney"]),
},
{
label: "分账手续费",
prop: "serviceCharge",
minWidth: 100,
formatter: amountFormatter(["serviceCharge"]),
},
{
label: "分账类型",
prop: "divisionFlag",
minWidth: 120,
formatter: tradeDetailFormatter("divisionFlag"),
},
],
tableSummary: [
"lightChangeAmount",
"equityAmount",
"extendedWarrantyAmount",
"waitInputtedAmount",
"divisionMoney",
"serviceCharge",
],
},
// 明细-分账 // 明细-分账
[ONLINE_DETAIL_TAB.DETAIL_ALLOCATION]: [ [ONLINE_DETAIL_TAB.DETAIL_ALLOCATION]: {
tableColumns: [
{ {
label: "分账日期", label: "分账日期",
prop: "divisionDate", prop: "divisionDate",
...@@ -163,12 +293,6 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = { ...@@ -163,12 +293,6 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = {
prop: "targetMerchantType", prop: "targetMerchantType",
minWidth: 120, minWidth: 120,
formatter: (row) => { formatter: (row) => {
const typeObj = {
1: "平台方",
2: "服务商",
3: "门店",
4: "平台方",
};
return typeObj[row?.targetMerchantType] || "-"; return typeObj[row?.targetMerchantType] || "-";
}, },
}, },
...@@ -208,5 +332,13 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = { ...@@ -208,5 +332,13 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = {
minWidth: 120, minWidth: 120,
formatter: tradeDetailFormatter("divisionFlag"), formatter: tradeDetailFormatter("divisionFlag"),
}, },
{
label: "实际分账园区店",
prop: "realityDivisionYqMerchantName",
minWidth: 120,
formatter: tradeDetailFormatter("realityDivisionYqMerchantName"),
},
], ],
tableSummary: ["divisionMoney", "serviceCharge"],
},
}; };
const mockDivisionCountTotal = jest.fn();
const mockPaymentCountTotal = jest.fn();
jest.mock("@api/prepaymentManage", () => ({
divisionCountTotal: mockDivisionCountTotal,
onlineDivisionDetailPage: jest.fn(),
onlineDivisionMonthTotalPage: jest.fn(),
onlinePaymentDetailPage: jest.fn(),
onlinePaymentMonthTotalPage: jest.fn(),
paymentCountTotal: mockPaymentCountTotal,
}), { virtual: true });
jest.mock("@/mixins/reportTrackPageMixin", () => ({}));
const { shallowMount } = require("@vue/test-utils");
const OnlineDetail = require("./onlineDetail.vue").default;
const { ONLINE_DETAIL_TAB } = require("./onlineDetail.constant");
describe("onlineDetail summary", () => {
let wrapper;
const mountComponent = () => {
wrapper = shallowMount(OnlineDetail, {
mocks: {
$route: {
params: {
yqMerchantId: "merchant-1",
},
},
$router: {
push: jest.fn(),
},
$store: {
state: {
d2admin: {
user: {
dowloadList: [],
},
},
},
dispatch: jest.fn(),
},
},
stubs: [
"d2-container",
"el-tabs",
"el-tab-pane",
"d2-table-header",
"d2-table",
"el-button",
],
});
};
beforeEach(() => {
jest.clearAllMocks();
mockDivisionCountTotal.mockResolvedValue({
lightChangeAmount: 1000,
equityAmount: 2000,
extendedWarrantyAmount: 3000,
});
mockPaymentCountTotal.mockResolvedValue({});
mountComponent();
});
afterEach(() => {
wrapper && wrapper.destroy();
});
it("loads summary data before table search", async () => {
wrapper.setData({
activeName: ONLINE_DETAIL_TAB.SUMMARY_ALLOCATION,
});
await wrapper.vm.beforeSearchFn();
expect(mockPaymentCountTotal).toHaveBeenCalledWith({
yqMerchantId: "merchant-1",
});
expect(wrapper.vm.summaries).toEqual({});
});
it("returns summary row synchronously from cached summary data", () => {
wrapper.setData({
activeName: ONLINE_DETAIL_TAB.SUMMARY_ALLOCATION,
summaries: {
lightChangeAmount: 1000,
equityAmount: 2000,
extendedWarrantyAmount: 3000,
},
});
const result = wrapper.vm.getSummaries({
columns: [
{ property: "ownSerialNum" },
{ property: "lightChangeAmount" },
{ property: "equityAmount" },
{ property: "extendedWarrantyAmount" },
],
});
expect(Array.isArray(result)).toBe(true);
expect(result).toEqual(["合计", "1,000.00", "2,000.00", "3,000.00"]);
});
});
...@@ -18,11 +18,13 @@ ...@@ -18,11 +18,13 @@
</div> </div>
</d2-table-header> </d2-table-header>
<d2-table ref="usedCarFundWarningManageTable" <d2-table :key="tableKey"
:key="tableKey" ref="usedCarFundWarningManageTable"
show-summary
:before-search-fn="beforeSearchFn" :before-search-fn="beforeSearchFn"
:get-list-api="getListApi" :get-list-api="getListApi"
:search-form="searchFormSearch" :search-form="searchFormSearch"
:summary-method="getSummaries"
:table-params="tableParams"> :table-params="tableParams">
</d2-table> </d2-table>
</div> </div>
...@@ -35,17 +37,26 @@ ...@@ -35,17 +37,26 @@
</template> </template>
<script> <script>
import { onlineDivisionDetailPage, onlinePaymentDetailPage, onlinePaymentMonthTotalPage } from "@api/prepaymentManage"; import { divisionCountTotal, onlineDivisionDetailPage, onlineDivisionMonthTotalPage, onlinePaymentDetailPage, onlinePaymentMonthTotalPage, paymentCountTotal } from "@api/prepaymentManage";
import { mapActions, mapState } from "vuex"; import { mapActions, mapState } from "vuex";
import { formatThousand } from "@/common/format";
import reportTrackPageMixin from "@/mixins/reportTrackPageMixin"; import reportTrackPageMixin from "@/mixins/reportTrackPageMixin";
import { ONLINE_DETAIL_TAB, ONLINE_DETAIL_TABLE_COLUMNS } from "./onlineDetail.constant"; import { ONLINE_DETAIL_TAB, ONLINE_DETAIL_TABLE_COLUMNS } from "./onlineDetail.constant";
const ONLINE_DETAIL_API_MAP = { const ONLINE_DETAIL_API_MAP = {
[ONLINE_DETAIL_TAB.SUMMARY_COLLECTION]: onlinePaymentMonthTotalPage, [ONLINE_DETAIL_TAB.SUMMARY_COLLECTION]: onlinePaymentMonthTotalPage,
[ONLINE_DETAIL_TAB.DETAIL_COLLECTION]: onlinePaymentDetailPage, [ONLINE_DETAIL_TAB.DETAIL_COLLECTION]: onlinePaymentDetailPage,
[ONLINE_DETAIL_TAB.SUMMARY_ALLOCATION]: onlineDivisionMonthTotalPage,
[ONLINE_DETAIL_TAB.DETAIL_ALLOCATION]: onlineDivisionDetailPage, [ONLINE_DETAIL_TAB.DETAIL_ALLOCATION]: onlineDivisionDetailPage,
}; };
const TOTAL_API_MAP = {
[ONLINE_DETAIL_TAB.SUMMARY_COLLECTION]: paymentCountTotal,
[ONLINE_DETAIL_TAB.DETAIL_COLLECTION]: paymentCountTotal,
[ONLINE_DETAIL_TAB.SUMMARY_ALLOCATION]: divisionCountTotal,
[ONLINE_DETAIL_TAB.DETAIL_ALLOCATION]: divisionCountTotal,
};
export default { export default {
name: "UsedCarPaymentManage", name: "UsedCarPaymentManage",
components: { components: {
...@@ -65,6 +76,10 @@ export default { ...@@ -65,6 +76,10 @@ export default {
name: ONLINE_DETAIL_TAB.DETAIL_COLLECTION, name: ONLINE_DETAIL_TAB.DETAIL_COLLECTION,
}, },
{ {
label: "汇总-分账",
name: ONLINE_DETAIL_TAB.SUMMARY_ALLOCATION,
},
{
label: "明细-分账", label: "明细-分账",
name: ONLINE_DETAIL_TAB.DETAIL_ALLOCATION, name: ONLINE_DETAIL_TAB.DETAIL_ALLOCATION,
}, },
...@@ -77,9 +92,10 @@ export default { ...@@ -77,9 +92,10 @@ export default {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000), btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: "list", listName: "list",
tableOption: false, tableOption: false,
tableColumns: ONLINE_DETAIL_TABLE_COLUMNS[ONLINE_DETAIL_TAB.SUMMARY_COLLECTION], tableColumns: ONLINE_DETAIL_TABLE_COLUMNS[ONLINE_DETAIL_TAB.SUMMARY_COLLECTION].tableColumns,
}, },
detailInfo: {}, detailInfo: {},
summaries: {},
}; };
}, },
computed: { computed: {
...@@ -87,11 +103,10 @@ export default { ...@@ -87,11 +103,10 @@ export default {
dowloadList: state => state.d2admin.user.dowloadList, dowloadList: state => state.d2admin.user.dowloadList,
}), }),
routerInfo() { routerInfo() {
console.log(this.$route.params);
return this.$route.params; return this.$route.params;
}, },
}, },
mounted() { created() {
this.searchFormSearch = { this.searchFormSearch = {
...this.routerInfo, ...this.routerInfo,
}; };
...@@ -103,11 +118,8 @@ export default { ...@@ -103,11 +118,8 @@ export default {
close: "d2admin/page/close", close: "d2admin/page/close",
}), }),
...mapActions("d2admin/user", ["actionSetDownloadList"]), ...mapActions("d2admin/user", ["actionSetDownloadList"]),
beforeSearchFn() { async beforeSearchFn() {
return new Promise((resolve) => { await this.getSummaryData();
// this.searchFormSearch = this.getParams()
resolve();
});
}, },
goBack() { goBack() {
this.$router.push({ this.$router.push({
...@@ -118,10 +130,11 @@ export default { ...@@ -118,10 +130,11 @@ export default {
return this.searchFormSearch; return this.searchFormSearch;
}, },
handleClick() { handleClick() {
this.summaries = {};
this.getListApi = ONLINE_DETAIL_API_MAP[this.activeName]; this.getListApi = ONLINE_DETAIL_API_MAP[this.activeName];
this.tableParams = { this.tableParams = {
...this.tableParams, ...this.tableParams,
tableColumns: ONLINE_DETAIL_TABLE_COLUMNS[this.activeName], tableColumns: ONLINE_DETAIL_TABLE_COLUMNS[this.activeName].tableColumns,
}; };
this.tableKey = this.activeName; this.tableKey = this.activeName;
}, },
...@@ -147,6 +160,31 @@ export default { ...@@ -147,6 +160,31 @@ export default {
]; ];
this.actionSetDownloadList({ list, type: "dowloadList" }); this.actionSetDownloadList({ list, type: "dowloadList" });
}, },
async getSummaryData() {
const res = await TOTAL_API_MAP[this.activeName]({ ...this.getParams() });
this.summaries = res || {};
},
getSummaries(param) {
const { columns } = param;
const { summaries } = this;
const sums = [];
const keyList = ONLINE_DETAIL_TABLE_COLUMNS[this.activeName].tableSummary;
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = "合计";
return;
}
const key = column.property;
if (keyList.includes(key)) {
const value = summaries[key];
sums[index]
= value != null || value != undefined ? formatThousand(value) : 0;
} else {
sums[index] = "";
}
});
return sums;
},
}, },
}; };
</script> </script>
......
...@@ -2,57 +2,45 @@ ...@@ -2,57 +2,45 @@
<template> <template>
<d2-dialog btn-ok-label="确定" <d2-dialog btn-ok-label="确定"
class="relateStore" class="relateStore"
width="70%"
:is-visible.sync="relateStoreVisible" :is-visible.sync="relateStoreVisible"
:title="title" :title="title"
width="70%"
@closeDialog="handleRelateStoreClose" @closeDialog="handleRelateStoreClose"
@confirmDialog="handleRelateStoreConfirm"> @confirmDialog="handleRelateStoreConfirm">
<slot /> <slot />
<el-row class="tableCon"> <el-row class="tableCon">
<div class="tableBox left"> <div class="tableBox left">
<el-table ref="seletingTable" <el-table ref="seletingTable"
border
class="table" class="table"
:data="selectingData"
height="464px" height="464px"
border
:data="selectingData"
@select="handleChange" @select="handleChange"
@select-all="handleAll"> @select-all="handleAll">
<el-table-column align="center" <el-table-column align="center"
type="selection" type="selection"
width="55" /> width="55" />
<el-table-column align="center" <template v-for="(item, index) in tablecolumnList">
label="门店名称" <el-table-column v-if="tableHeadItems.includes(item.label)"
prop="merchantName"> :key="index"
</el-table-column> align="center"
<el-table-column align="center" :label="item.label"
label="门店地址" :prop="item.prop">
prop="merchantAddress">
</el-table-column>
<el-table-column align="center"
label="门店商户号"
prop="merchantId">
</el-table-column>
<el-table-column align="center"
label="服务对接"
prop="yqMerchantName">
</el-table-column>
<el-table-column align="center"
label="服务对接商户号"
prop="yqMerchantId">
</el-table-column> </el-table-column>
</template>
</el-table> </el-table>
<el-pagination background <el-pagination layout="total, prev, pager, next"
background
small
:current-page.sync="currentPage" :current-page.sync="currentPage"
layout="total, prev, pager, next"
:page-size="pageSize" :page-size="pageSize"
small
:total="total" :total="total"
@current-change="handleCurrentChange" /> @current-change="handleCurrentChange" />
</div> </div>
<el-table border <el-table class="tableBox table"
class="tableBox table" height="464px"
:data="selectedData" border
height="464px"> :data="selectedData">
<el-table-column align="center" <el-table-column align="center"
label="门店名称" label="门店名称"
prop="merchantName"> prop="merchantName">
...@@ -114,11 +102,42 @@ export default { ...@@ -114,11 +102,42 @@ export default {
default: false, default: false,
}, },
selectedSceneType: { selectedSceneType: {
type: String type: String,
} },
page: {
type: String,
default: "",
},
tableHeadItems: {
type: Array,
default: () => {
return ["门店名称", "门店地址", "门店商户号", "服务对接", "服务对接商户号"];
},
},
}, },
data() { data() {
return { return {
tablecolumnList: [{
label: "门店名称",
prop: "merchantName",
align: "center",
}, {
label: "门店地址",
prop: "merchantAddress",
align: "center",
}, {
label: "门店商户号",
prop: "merchantId",
align: "center",
}, {
label: "服务对接",
prop: "yqMerchantName",
align: "center",
}, {
label: "服务对接商户号",
prop: "yqMerchantId",
align: "center",
}],
selectedData: [], selectedData: [],
selectingData: [], selectingData: [],
// 分页 // 分页
...@@ -147,7 +166,7 @@ export default { ...@@ -147,7 +166,7 @@ export default {
currentPage: this.currentPage, currentPage: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize,
baseSceneCode: this.selectedBaseSceneCode, baseSceneCode: this.selectedBaseSceneCode,
queryMerchantAddr: true queryMerchantAddr: true,
}).then((res) => { }).then((res) => {
res?.list?.forEach((val) => { res?.list?.forEach((val) => {
// 账户中心门店返回商户号字段是merchantNo // 账户中心门店返回商户号字段是merchantNo
......
<template>
<div class="detail-table">
<!-- 表头 -->
<div class="table-header">
<span class="th th-expand"></span>
<span class="th th-index">排序</span>
<span class="th th-name" style="display: flex;flex-flow: row;align-items: center !important;">
选项卡名称
<el-tooltip content="在展业助手App中对外展示的套餐或商品名称" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-tabDescription">
选项卡描述
<el-tooltip content="在展业助手App中对外展示的套餐或商品描述" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-price">现售价</span>
<span class="th th-min">最低售价</span>
<span class="th th-discount">优惠价(元)</span>
<span class="th th-incentive">销售激励(元)</span>
<span class="th th-main">是否主推</span>
<span class="th th-img">
预览主图
<el-tooltip content="页面展示主图,建议尺寸 750×420px" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-thumb">
预览小图
<el-tooltip content="列表中展示的缩略图,建议尺寸 200×200px" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-detail">
内容详图
<el-tooltip content="商品或套餐详情展示的内容长图" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
</div>
<!-- 数据行 -->
<div v-for="(item, index) in list"
:key="index"
class="table-item">
<!-- 主行 -->
<div class="table-row"
:class="{ 'is-expanded': expandedRows.includes(index) }">
<span class="td td-expand">
<i v-if="item.productType == 0 && item.packageItems && item.packageItems.length"
class="expand-icon"
:class="[expandedRows.includes(index) ? 'el-icon-arrow-down' : 'el-icon-arrow-right']"
@click="toggleExpand(index)" />
</span>
<span class="td td-index">{{ index + 1 }}</span>
<span class="td td-name">
<span>{{ item.tabName }}</span>
<div class="sub-text">{{ item.packageCode }}</div>
</span>
<span class="td td-tabDescription">{{ item.tabDescription || '-' }}</span>
<span class="td td-price">{{ priceFilter(item.currentPrice) }}</span>
<span class="td td-min">{{ priceFilter(item.minimumPrice) }}</span>
<span class="td td-discount">{{ priceFilter(item.discountPrice) }}</span>
<span class="td td-incentive">{{ priceFilter(item.salesIncentive) }}</span>
<span class="td td-main">{{ item.isMainPush == 1 ? '是' : '否' }}</span>
<span class="td td-img">
<el-image v-if="item.mainImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.mainImageUrl]"
:src="item.mainImageUrl" />
<span v-else>-</span>
</span>
<span class="td td-thumb">
<el-image v-if="item.thumbImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.thumbImageUrl]"
:src="item.thumbImageUrl" />
<span v-else>-</span>
</span>
<span class="td td-detail">
<el-image v-if="item.detailImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.detailImageUrl]"
:src="item.detailImageUrl" />
<span v-else>-</span>
</span>
</div>
<!-- 子商品展开区(仅套餐类型) -->
<div v-if="(item.productType == 0) && (item.packageItems && item.packageItems.length) && expandedRows.includes(index)"
class="sub-table-wrapper">
<div class="sub-table-header">
<span class="sh-col sh-col-name">产品名称</span>
<span class="sh-col sh-col-name">商品别名</span>
<span class="sh-col sh-col-id">产品ID</span>
<span class="sh-col sh-col-price">现售价</span>
<span class="sh-col sh-col-min">最低售价</span>
<span class="sh-col sh-col-discount">优惠价</span>
</div>
<div v-for="(sub, subIdx) in item.packageItems"
:key="subIdx"
class="sub-table-row">
<span class="sc sc-name">{{ sub.goodsName || '-' }}</span>
<span class="sc sc-name">{{ sub.goodsAlias || '-' }}</span>
<span class="sc sc-id">{{ sub.upgradeProductId || '-' }}</span>
<span class="sc sc-price">{{ priceFilter(sub.currentPrice) }}</span>
<span class="sc sc-min">{{ priceFilter(sub.minimumPrice) }}</span>
<span class="sc sc-discount">{{ priceFilter(sub.discountPrice) }}</span>
</div>
</div>
</div>
<div v-if="!list.length" class="table-empty">
暂无数据
</div>
</div>
</template>
<script>
export default {
name: "MixedDetailTable",
props: {
list: {
type: Array,
default: () => [],
},
},
data() {
return {
expandedRows: [],
};
},
methods: {
priceFilter(num) {
const pow = 10 ** 2;
if (this.filterEmpty(num))
return "-";
return `¥${(Math.round(num * pow) / pow).toFixed(2)}`;
},
filterEmpty(data) {
return (data ?? "") === "";
},
toggleExpand(key) {
const idx = this.expandedRows.indexOf(key);
if (idx > -1) {
this.expandedRows.splice(idx, 1);
} else {
this.expandedRows.push(key);
}
},
},
};
</script>
<style lang="scss" scoped>
.detail-table {
border: 1px solid #ebeef5;
font-size: 13px;
max-height: 500px;
overflow: auto;
}
// 表头
.table-header {
display: flex;
align-items: center;
background-color: #f5f7fa;
border-bottom: 1px solid #ebeef5;
min-width: 1340px;
.th {
padding: 10px 8px;
box-sizing: border-box;
color: #909399;
font-weight: 500;
display: flex;
align-items: center;
flex-shrink: 0;
}
}
// 数据行
.table-item {
border-bottom: 1px solid #ebeef5;
}
.table-row {
display: flex;
align-items: center;
min-width: 1340px;
padding: 8px 0;
background-color: #fff;
&:hover {
background-color: #f5f7fa;
}
&.is-expanded {
background-color: #ecf5ff;
}
}
.td {
padding: 0 8px;
display: flex;
align-items: center;
box-sizing: border-box;
flex-shrink: 0;
}
// 列宽定义(比 package 多一列 type)
.td-expand,
.th-expand {
width: 36px;
justify-content: center;
}
.td-index,
.th-index {
width: 50px;
justify-content: center;
color: #606266;
}
.td-type,
.th-type {
width: 80px;
justify-content: center;
}
.th-name,
.td-name {
min-width: 180px;
flex: 2;
flex-direction: column;
align-items: flex-start !important;
}
.th-tabDescription,
.td-tabDescription {
word-break: break-all;
min-width: 160px;
flex: 1.5;
}
.th-store,
.td-store {
width: 90px;
justify-content: center;
}
.th-price,
.td-price {
width: 90px;
color: #606266;
}
.th-min,
.td-min {
width: 90px;
color: #606266;
}
.th-discount,
.td-discount {
width: 120px;
}
.th-incentive,
.td-incentive {
width: 120px;
}
.th-main,
.td-main {
width: 80px;
justify-content: center;
}
.th-img,
.td-img {
width: 100px;
justify-content: center;
}
.th-thumb,
.td-thumb {
width: 100px;
justify-content: center;
}
.th-detail,
.td-detail {
width: 100px;
justify-content: center;
}
// 子元素样式
.sub-text {
margin-top: 4px;
font-size: 12px;
color: #c0c4cc;
}
.header-tip {
color: #c0c4cc;
cursor: pointer;
margin-left: 4px;
font-size: 12px;
}
.expand-icon {
cursor: pointer;
color: #909399;
font-size: 12px;
&:hover {
color: #409eff;
}
}
.thumb-img {
width: 60px;
height: 60px;
border-radius: 4px;
}
// 子商品表格
.sub-table-wrapper {
border: 1px solid #ebeef5;
padding: 8px 20px 8px 80px;
background-color: #fafafa;
}
.sub-table-header {
display: flex;
align-items: center;
background-color: #f5f7fa;
border: 1px solid #e4e7ed;
min-width: 700px;
.sh-col {
padding: 8px 10px;
color: #909399;
font-weight: 500;
font-size: 12px;
flex-shrink: 0;
}
}
.sub-table-row {
display: flex;
align-items: center;
border-bottom: 1px solid #ebeef5;
min-width: 700px;
.sc {
padding: 8px 10px;
font-size: 12px;
flex-shrink: 0;
}
}
.sh-col-name,
.sc-name {
min-width: 160px;
flex: 2;
}
.sh-col-id,
.sc-id {
width: 160px;
text-align: center;
}
.sh-col-price,
.sc-price {
width: 100px;
text-align: center;
}
.sh-col-min,
.sc-min {
width: 100px;
text-align: center;
}
.sh-col-discount,
.sc-discount {
width: 120px;
text-align: center;
}
.table-empty {
text-align: center;
padding: 30px;
color: #c0c4cc;
}
</style>
<template>
<div class="detail-table">
<!-- 表头 -->
<div class="table-header">
<span class="th th-expand"></span>
<span class="th th-index">排序</span>
<span class="th th-name">
选项卡名称
<el-tooltip content="在展业助手App中对外展示的套餐或商品名称" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-tabDescription">
选项卡描述
<el-tooltip content="在展业助手App中对外展示的套餐或商品描述" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-price">现售价</span>
<span class="th th-min">最低售价</span>
<span class="th th-discount">优惠价(元)</span>
<span class="th th-incentive">销售激励(元)</span>
<span class="th th-main">是否主推</span>
<span class="th th-img">
预览主图
<el-tooltip content="页面展示主图,建议尺寸 750×420px" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-thumb">
预览小图
<el-tooltip content="列表中展示的缩略图,建议尺寸 200×200px" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-detail">
内容详图
<el-tooltip content="商品或套餐详情展示的内容长图" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
</div>
<!-- 数据行 -->
<div v-for="(item, index) in list"
:key="item.id || index"
class="table-item">
<!-- 主行 -->
<div class="table-row"
:class="{ 'is-expanded': expandedRows.includes(item.id || index) }">
<span class="td td-expand">
<i v-if="item.packageItems && item.packageItems.length"
class="expand-icon"
:class="[expandedRows.includes(item.id || index) ? 'el-icon-arrow-down' : 'el-icon-arrow-right']"
@click="toggleExpand(item.id || index)" />
</span>
<span class="td td-index">{{ index + 1 }}</span>
<span class="td td-name">
<span>{{ item.tabName }}</span>
<div class="sub-text">{{ item.packageCode }}</div>
</span>
<span class="td td-tabDescription">{{ item.tabDescription || '-' }}</span>
<span class="td td-price">{{ priceFilter(item.currentPrice) }}</span>
<span class="td td-min">{{ priceFilter(item.minimumPrice) }}</span>
<span class="td td-discount">{{ priceFilter(item.discountPrice) }}</span>
<span class="td td-incentive">{{ priceFilter(item.salesIncentive) }}</span>
<span class="td td-main">{{ item.isMainPush == 1 ? '是' : '否' }}</span>
<span class="td td-img">
<el-image v-if="item.mainImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.mainImageUrl]"
:src="item.mainImageUrl" />
<span v-else>-</span>
</span>
<span class="td td-thumb">
<el-image v-if="item.thumbImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.thumbImageUrl]"
:src="item.thumbImageUrl" />
<span v-else>-</span>
</span>
<span class="td td-detail">
<el-image v-if="item.detailImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.detailImageUrl]"
:src="item.detailImageUrl" />
<span v-else>-</span>
</span>
</div>
<!-- 子商品展开区 -->
<div v-if="(item.packageItems && item.packageItems.length) && expandedRows.includes(item.id || index)"
class="sub-table-wrapper">
<div class="sub-table-header">
<span class="sh-col sh-col-name">产品名称</span>
<span class="sh-col sh-col-name">商品别名</span>
<span class="sh-col sh-col-id">产品ID</span>
<span class="sh-col sh-col-price">现售价</span>
<span class="sh-col sh-col-min">最低售价</span>
<span class="sh-col sh-col-discount">优惠价</span>
</div>
<div v-for="(sub, subIdx) in item.packageItems"
:key="subIdx"
class="sub-table-row">
<span class="sc sc-name">{{ sub.goodsName || '-' }}</span>
<span class="sc sc-name">{{ sub.goodsAlias || '-' }}</span>
<span class="sc sc-id">{{ sub.upgradeProductId || '-' }}</span>
<span class="sc sc-price">{{ priceFilter(sub.currentPrice) }}</span>
<span class="sc sc-min">{{ priceFilter(sub.minimumPrice) }}</span>
<span class="sc sc-discount">{{ priceFilter(sub.discountPrice) }}</span>
</div>
</div>
</div>
<div v-if="!list.length" class="table-empty">
暂无数据
</div>
</div>
</template>
<script>
export default {
name: "PackageDetailTable",
props: {
list: {
type: Array,
default: () => [],
},
},
data() {
return {
expandedRows: [],
};
},
methods: {
priceFilter(num) {
const pow = 10 ** 2;
if (this.filterEmpty(num))
return "-";
return `¥${(Math.round(num * pow) / pow).toFixed(2)}`;
},
filterEmpty(data) {
return (data ?? "") === "";
},
toggleExpand(key) {
const idx = this.expandedRows.indexOf(key);
if (idx > -1) {
this.expandedRows.splice(idx, 1);
} else {
this.expandedRows.push(key);
}
},
},
};
</script>
<style lang="scss" scoped>
.detail-table {
border: 1px solid #ebeef5;
font-size: 13px;
max-height: 500px;
overflow: auto;
}
// 表头
.table-header {
display: flex;
align-items: center;
background-color: #f5f7fa;
border-bottom: 1px solid #ebeef5;
min-width: 1300px;
.th {
padding: 10px 8px;
box-sizing: border-box;
color: #909399;
font-weight: 500;
display: flex;
align-items: center;
flex-shrink: 0;
}
}
// 数据行
.table-item {
border-bottom: 1px solid #ebeef5;
}
.table-row {
display: flex;
align-items: center;
min-width: 1300px;
padding: 8px 0;
background-color: #fff;
&:hover {
background-color: #f5f7fa;
}
&.is-expanded {
background-color: #ecf5ff;
}
}
.td {
padding: 0 8px;
display: flex;
align-items: center;
box-sizing: border-box;
flex-shrink: 0;
}
// 列宽定义(和新增页保持一致)
.td-expand,
.th-expand {
width: 36px;
justify-content: center;
flex-shrink: 0;
}
.td-index,
.th-index {
width: 50px;
justify-content: center;
flex-shrink: 0;
color: #606266;
}
.th-name,
.td-name {
min-width: 180px;
flex: 2;
align-items: flex-start;
}
.td-name {
flex-flow: column;
}
.th-tabDescription,
.td-tabDescription {
word-break: break-all;
min-width: 160px;
flex: 1.5;
}
.th-store,
.td-store {
width: 90px;
justify-content: center;
flex-shrink: 0;
}
.th-price,
.td-price {
width: 90px;
flex-shrink: 0;
color: #606266;
}
.th-min,
.td-min {
width: 90px;
flex-shrink: 0;
color: #606266;
}
.th-discount,
.td-discount {
width: 120px;
flex-shrink: 0;
}
.th-incentive,
.td-incentive {
width: 120px;
flex-shrink: 0;
}
.th-main,
.td-main {
width: 80px;
justify-content: center;
flex-shrink: 0;
}
.th-img,
.td-img {
width: 100px;
justify-content: center;
flex-shrink: 0;
}
.th-thumb,
.td-thumb {
width: 100px;
justify-content: center;
flex-shrink: 0;
}
.th-detail,
.td-detail {
width: 100px;
justify-content: center;
flex-shrink: 0;
}
// 子元素样式
.sub-text {
margin-top: 4px;
font-size: 12px;
color: #c0c4cc;
}
.header-tip {
color: #c0c4cc;
cursor: pointer;
margin-left: 4px;
font-size: 12px;
}
.expand-icon {
cursor: pointer;
color: #909399;
font-size: 12px;
transition: transform 0.2s;
&:hover {
color: #409eff;
}
}
.thumb-img {
width: 60px;
height: 60px;
border-radius: 4px;
}
// 子商品表格
.sub-table-wrapper {
border: 1px solid #ebeef5;
padding: 8px 20px 8px 80px;
background-color: #fafafa;
}
.sub-table-header {
display: flex;
align-items: center;
background-color: #f5f7fa;
border: 1px solid #e4e7ed;
min-width: 700px;
.sh-col {
padding: 8px 10px;
color: #909399;
font-weight: 500;
font-size: 12px;
flex-shrink: 0;
}
}
.sub-table-row {
display: flex;
align-items: center;
border-bottom: 1px solid #ebeef5;
min-width: 700px;
.sc {
padding: 8px 10px;
font-size: 12px;
flex-shrink: 0;
}
}
.sh-col-name,
.sc-name {
min-width: 160px;
flex: 2;
}
.sh-col-id,
.sc-id {
width: 160px;
text-align: center;
}
.sh-col-price,
.sc-price {
width: 100px;
text-align: center;
}
.sh-col-min,
.sc-min {
width: 100px;
text-align: center;
}
.sh-col-discount,
.sc-discount {
width: 120px;
text-align: center;
}
.table-empty {
text-align: center;
padding: 30px;
color: #c0c4cc;
}
</style>
<template>
<div class="detail-table">
<!-- 表头 -->
<div class="table-header">
<span class="th th-index">排序</span>
<span class="th th-name">
选项卡名称
<el-tooltip content="在展业助手App中对外展示的套餐或商品名称" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-tabDescription">
选项卡描述
<el-tooltip content="在展业助手App中对外展示的套餐或商品描述" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-price">现售价</span>
<span class="th th-min">最低售价</span>
<span class="th th-discount">优惠价(元)</span>
<span class="th th-incentive">销售激励(元)</span>
<span class="th th-main">是否主推</span>
<span class="th th-img">
预览主图
<el-tooltip content="页面展示主图,建议尺寸 750×420px" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-thumb">
预览小图
<el-tooltip content="列表中展示的缩略图,建议尺寸 200×200px" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-detail">
内容详图
<el-tooltip content="商品或套餐详情展示的内容长图" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
</div>
<!-- 数据行 -->
<div v-for="(item, index) in list"
:key="item.id || index"
class="table-row">
<span class="td td-index">{{ index + 1 }}</span>
<span class="td td-name">
<span>{{ item.tabName }}</span>
<div class="sub-text">{{ item.goodsCode }}</div>
</span>
<span class="td td-tabDescription">{{ item.tabDescription || '-' }}</span>
<span class="td td-price">{{ priceFilter(item.currentPrice) }}</span>
<span class="td td-min">{{ priceFilter(item.minimumPrice) }}</span>
<span class="td td-discount">{{ priceFilter(item.discountPrice) }}</span>
<span class="td td-incentive">{{ priceFilter(item.salesIncentive) }}</span>
<span class="td td-main">{{ item.isMainPush == 1 ? '是' : '否' }}</span>
<span class="td td-img">
<el-image v-if="item.mainImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.mainImageUrl]"
:src="item.mainImageUrl" />
<span v-else>-</span>
</span>
<span class="td td-thumb">
<el-image v-if="item.thumbImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.thumbImageUrl]"
:src="item.thumbImageUrl" />
<span v-else>-</span>
</span>
<span class="td td-detail">
<el-image v-if="item.detailImageUrl"
class="thumb-img"
fit="cover"
:preview-src-list="[item.detailImageUrl]"
:src="item.detailImageUrl" />
<span v-else>-</span>
</span>
</div>
<div v-if="!list.length" class="table-empty">
暂无数据
</div>
</div>
</template>
<script>
export default {
name: "ProductDetailTable",
props: {
list: {
type: Array,
default: () => [],
},
},
methods: {
priceFilter(num) {
const pow = 10 ** 2;
if (this.filterEmpty(num))
return "-";
return `¥${(Math.round(num * pow) / pow).toFixed(2)}`;
},
filterEmpty(data) {
return (data ?? "") === "";
},
},
};
</script>
<style lang="scss" scoped>
.detail-table {
border: 1px solid #ebeef5;
font-size: 13px;
max-height: 500px;
overflow: auto;
}
// 表头
.table-header {
display: flex;
align-items: center;
background-color: #f5f7fa;
border-bottom: 1px solid #ebeef5;
min-width: 1260px;
.th {
padding: 10px 8px;
box-sizing: border-box;
color: #909399;
font-weight: 500;
display: flex;
align-items: center;
flex-shrink: 0;
}
}
// 数据行
.table-row {
display: flex;
align-items: center;
min-width: 1260px;
padding: 8px 0;
background-color: #fff;
border-bottom: 1px solid #ebeef5;
&:hover {
background-color: #f5f7fa;
}
}
.td {
padding: 0 8px;
display: flex;
align-items: center;
box-sizing: border-box;
flex-shrink: 0;
}
// 列宽定义
.td-index,
.th-index {
width: 50px;
justify-content: center;
color: #606266;
}
.th-name,
.td-name {
min-width: 180px;
flex: 2;
align-items: flex-start;
}
.td-name {
flex-flow: column;
}
.th-tabDescription,
.td-tabDescription {
word-break: break-all;
min-width: 160px;
flex: 1.5;
}
.th-store,
.td-store {
width: 90px;
justify-content: center;
}
.th-price,
.td-price {
width: 90px;
color: #606266;
}
.th-min,
.td-min {
width: 90px;
color: #606266;
}
.th-discount,
.td-discount {
width: 120px;
}
.th-incentive,
.td-incentive {
width: 120px;
}
.th-main,
.td-main {
width: 80px;
justify-content: center;
}
.th-img,
.td-img {
width: 100px;
justify-content: center;
}
.th-thumb,
.td-thumb {
width: 100px;
justify-content: center;
}
.th-detail,
.td-detail {
width: 100px;
justify-content: center;
}
.sub-text {
margin-top: 4px;
font-size: 12px;
color: #c0c4cc;
}
.header-tip {
color: #c0c4cc;
cursor: pointer;
margin-left: 4px;
font-size: 12px;
}
.thumb-img {
width: 60px;
height: 60px;
border-radius: 4px;
}
.table-empty {
text-align: center;
padding: 30px;
color: #c0c4cc;
}
</style>
<!-- 销售门店列表弹窗 --> <!-- 销售门店列表弹窗 -->
<template> <template>
<el-dialog :visible.sync="dialogVisible" title="相关门店列表" width="600px" :close-on-click-modal="false" append-to-body @close="handleClose"> <el-dialog title="相关门店列表"
width="600px"
append-to-body
:close-on-click-modal="false"
:visible.sync="dialogVisible"
@close="handleClose">
<div class="store-list-dialog"> <div class="store-list-dialog">
<el-table :data="storeList" border size="mini" max-height="400"> <el-table max-height="400"
<el-table-column label="门店名称" prop="merchantName" min-width="150" /> size="mini"
<el-table-column label="门店商户号" prop="merchantId" width="120" /> border
<el-table-column label="门店地址" prop="address" min-width="200" show-overflow-tooltip /> :data="storeList">
<el-table-column label="门店名称"
min-width="150"
prop="merchantName" />
<el-table-column label="门店商户号"
prop="merchantId"
width="120" />
<el-table-column label="门店地址"
min-width="200"
prop="merchantAddress"
show-overflow-tooltip />
</el-table> </el-table>
</div> </div>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button size="mini" @click="handleClose">关 闭</el-button> <el-button size="mini" @click="handleClose">
关 闭
</el-button>
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { getMerchantByGoodsOrPackage } from "@/api/marketingActivity";
export default { export default {
name: 'StoreListDialog', name: "StoreListDialog",
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
default: false default: false,
},
storeRow: {
type: Object,
default: () => {},
},
merchantList: {
type: Array,
default: () => [],
}, },
storeList: {
type: Array
}
}, },
data() { data() {
return {} return {
storeList: [],
};
}, },
computed: { computed: {
dialogVisible: { dialogVisible: {
get() { get() {
return this.visible return this.visible;
}, },
set(val) { set(val) {
this.$emit('update:visible', val) this.$emit("update:visible", val);
} },
},
},
watch: {
visible(val) {
if (val) {
this.getMerchantData();
} }
}, },
},
methods: { methods: {
getMerchantData() {
const params = {
goodsCode: this.storeRow.goodsCode,
packageCode: this.storeRow.packageId,
activityId: this.storeRow?.activityId,
merchantIds: this.merchantList?.map((val) => {
return val.merchantId;
}),
};
getMerchantByGoodsOrPackage(params).then((res) => {
this.storeList = res || [];
});
},
handleClose() { handleClose() {
this.dialogVisible = false this.dialogVisible = false;
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
<!-- 管理活动标签弹窗 --> <!-- 管理活动标签弹窗 -->
<template> <template>
<el-dialog title="设置活动标签" :visible.sync="dialogVisible" width="500px" append-to-body custom-class="tag-manage-dialog"> <el-dialog custom-class="tag-manage-dialog"
<el-table :data="tagTableData" border size="small"> title="设置活动标签"
width="500px"
append-to-body
:visible.sync="dialogVisible">
<el-table size="small"
style="max-height: 55vh;overflow-y: auto;"
border
:data="tagTableData">
<el-table-column label="标签名称" prop="label"> <el-table-column label="标签名称" prop="label">
<template #default="scope"> <template #default="scope">
<el-input v-if="scope.row.editing" v-model="scope.row.editLabel" size="mini" maxlength="10" @keyup.enter.native="confirmEdit(scope.row)" /> <el-input v-if="scope.row.editing"
<span v-else>{{ scope.row.label }}</span> v-model.trim="scope.row.editLabel"
maxlength="10"
size="mini"
@keyup.enter.native="confirmEdit(scope.row)" />
<span v-else>{{ scope.row.tagName }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="160" align="center"> <el-table-column align="center"
label="操作"
width="160">
<template #default="scope"> <template #default="scope">
<template v-if="scope.row.editing"> <template v-if="scope.row.editing">
<el-button type="text" size="mini" @click="confirmEdit(scope.row)">确认</el-button> <el-button size="mini"
<el-button type="text" size="mini" @click="cancelEdit(scope.row)">取消</el-button> type="text"
@click="confirmEdit(scope.row)">
确认
</el-button>
<el-button size="mini"
type="text"
@click="cancelEdit(scope.row)">
取消
</el-button>
</template> </template>
<template v-else> <template v-else>
<el-button type="text" size="mini" @click="startEdit(scope.row)">重命名</el-button> <el-button size="mini"
<el-button type="text" size="mini" style="color: #f56c6c" @click="handleDeleteTag(scope.row)">删除</el-button> type="text"
@click="startEdit(scope.row)">
重命名
</el-button>
<el-button size="mini"
style="color: #f56c6c"
type="text"
@click="handleDeleteTag(scope.row)">
删除
</el-button>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -24,7 +54,9 @@ ...@@ -24,7 +54,9 @@
<!-- 新增标签按钮 --> <!-- 新增标签按钮 -->
<div v-if="!showAddInput" class="tag-add-btn-wrap"> <div v-if="!showAddInput" class="tag-add-btn-wrap">
<el-button class="add-tag-btn" size="small" @click="showAddInput = true"> <el-button class="add-tag-btn"
size="small"
@click="showAddInput = true">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
新增标签 新增标签
</el-button> </el-button>
...@@ -32,155 +64,158 @@ ...@@ -32,155 +64,158 @@
<!-- 新增标签输入行 --> <!-- 新增标签输入行 -->
<div v-if="showAddInput" class="tag-add-row"> <div v-if="showAddInput" class="tag-add-row">
<el-input v-model="newTagName" placeholder="请输入标签名称" size="small" maxlength="10" style="width: 200px; margin-right: 8px" @keyup.enter.native="handleAddTag" /> <el-input v-model.trim="newTagName"
<el-button type="primary" size="small" @click="handleAddTag">确认</el-button> maxlength="10"
<el-button size="small" @click="cancelAdd">取消</el-button> placeholder="请输入标签名称"
size="small"
style="width: 200px; margin-right: 8px"
@keyup.enter.native="handleAddTag" />
<el-button size="small"
type="primary"
@click="handleAddTag">
确认
</el-button>
<el-button size="small" @click="cancelAdd">
取消
</el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { addActivityTag, deleteActivityTag, getActivityTagList, updateActivityTag } from "@/api/marketingActivity";
export default { export default {
name: 'TagManageDialog', name: "TagManageDialog",
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
// 初始标签列表 // 初始标签列表
tagList: { tagList: {
type: Array, type: Array,
default: () => [] default: () => [],
} },
}, },
data() { data() {
return { return {
tagTableData: [], tagTableData: [],
newTagName: '', newTagName: "",
showAddInput: false showAddInput: false,
} };
}, },
computed: { computed: {
dialogVisible: { dialogVisible: {
get() { get() {
return this.visible return this.visible;
}, },
set(val) { set(val) {
this.$emit('update:visible', val) this.$emit("update:visible", val);
} },
} },
}, },
watch: { watch: {
visible(val) { visible(val) {
if (val) { if (val) {
this.initTableData() this.initTableData();
} }
},
tagList(val) {
if (val) {
this.initTableData();
} }
}, },
},
methods: { methods: {
// 初始化表格数据 // 初始化表格数据
initTableData() { initTableData() {
this.showAddInput = false this.showAddInput = false;
this.newTagName = '' this.newTagName = "";
this.tagTableData = this.tagList.map(item => ({ this.tagTableData = this.tagList.map(item => ({
...item, ...item,
editing: false, editing: false,
editLabel: '' editLabel: "",
})) }));
}, },
// 开始编辑 // 开始编辑
startEdit(row) { startEdit(row) {
row.editing = true row.editing = true;
row.editLabel = row.label row.editLabel = row.tagName;
}, },
// 确认编辑 // 确认编辑
confirmEdit(row) { confirmEdit(row) {
if (!row.editLabel.trim()) { if (!row.editLabel.trim()) {
this.$message.warning('标签名称不能为空') this.$message.warning("标签名称不能为空");
return return;
}
// 检查是否重复
const isDuplicate = this.tagTableData.some(item => item.label === row.editLabel.trim() && item.value !== row.value)
if (isDuplicate) {
this.$message.warning('标签名称已存在')
return
} }
row.label = row.editLabel.trim() updateActivityTag({ tagId: row.tagId, tagName: row.editLabel }).then(() => {
row.editing = false row.label = row.editLabel.trim();
this.$message.success('修改成功') row.editing = false;
this.emitChange() this.$message.success("修改成功");
this.emitChange();
});
}, },
// 取消编辑 // 取消编辑
cancelEdit(row) { cancelEdit(row) {
row.editing = false row.editing = false;
row.editLabel = '' row.editLabel = "";
}, },
// 删除标签 // 删除标签
handleDeleteTag(row) { handleDeleteTag(row) {
this.$confirm(`确定删除标签"${row.label}"吗?`, '提示', { this.$confirm("确认删除标签?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning",
}) }).then(() => {
.then(() => { deleteActivityTag({ tagId: row.tagId }).then((res) => {
this.tagTableData = this.tagTableData.filter(item => item.value !== row.value) this.$message.success("删除成功");
this.$message.success('删除成功') this.emitChange();
this.emitChange() });
}) });
.catch(() => {})
}, },
// 新增标签 // 新增标签
handleAddTag() { handleAddTag() {
if (!this.newTagName.trim()) { if (!this.newTagName.trim()) {
this.$message.warning('请输入标签名称') this.$message.warning("请输入标签名称");
return return;
}
// 检查是否重复
if (this.tagTableData.some(item => item.label === this.newTagName.trim())) {
this.$message.warning('标签名称已存在')
return
} }
const newId = String(Date.now()) addActivityTag({ tagName: this.newTagName }).then((res) => {
this.tagTableData.push({ this.newTagName = "";
label: this.newTagName.trim(), this.showAddInput = false;
value: newId, this.$message.success("添加成功");
editing: false, this.emitChange();
editLabel: '' });
})
this.newTagName = ''
this.showAddInput = false
this.$message.success('添加成功')
this.emitChange()
}, },
// 取消新增 // 取消新增
cancelAdd() { cancelAdd() {
this.newTagName = '' this.newTagName = "";
this.showAddInput = false this.showAddInput = false;
}, },
// 触发变更事件 // 触发变更事件
emitChange() { emitChange() {
// 获取列表
getActivityTagList({}).then((res) => {
this.$emit( this.$emit(
'change', "change",
this.tagTableData.map(item => ({ res || [],
label: item.label, );
value: item.value });
})) },
) },
} };
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
import request from "@api/request";
import RequestMethods from "@/api/request.methods";
const path = "dj.api.smartcarlife.sop.strategy.";
// 查询策略列表
export function getList(data) {
data.method = `${path}list`;
return request(data);
}
// 查询策略详情
export function getMarketingPushStrategyDetailApi(data) {
data.method = `${path}query`;
return request(data, "post");
}
// 创建策略
export function createStrategy(data) {
data.method = `${path}create`;
return request(data, "post");
}
// 修改策略
export function updateStrategy(data) {
data.method = `${path}update`;
return request(data, "post");
}
// 启停策略
export function statusStrategy(data) {
data.method = `${path}status`;
return request(data, "post");
}
// 删除策略
export function deleteStrategy(data) {
data.method = `${path}delete`;
return request(data, "post");
}
// 策略任务确认(支持批量)
export function confirmStrategy(data) {
data.method = `${path}confirm`;
return request(data, "post");
}
// 查询策略执行记录列表
export function recordsStrategy(data) {
data.method = `${path}records`;
return request(data, "post");
}
// 查询策略执行详情(含快照)
export function recordDetail(data) {
data.method = `${path}record.detail`;
return request(data, "post");
}
// 元数据查询接口
export function getMetaData(data) {
data.method = `${path}meta`;
return request(data, "post");
}
export function getMetaOptionsApi(data = {}) {
data.method = "dj.api.smartcarlife.sop.strategy.meta";
return request(data, RequestMethods.POST);
}
const mockRequest = jest.fn();
const mockRequestMethods = { POST: "POST", GET: "GET" };
jest.mock("@/api/request", () => mockRequest);
jest.mock("@/api/request.methods", () => mockRequestMethods);
const {
getList,
getMarketingPushStrategyDetailApi,
createStrategy,
updateStrategy,
statusStrategy,
deleteStrategy,
confirmStrategy,
recordsStrategy,
recordDetail,
getMetaData,
getMetaOptionsApi,
} = require("./index.js");
describe("marketingPushStrategy api/index.js", () => {
beforeEach(() => {
jest.clearAllMocks();
});
it("getList 应追加 list 方法名并走默认请求方式", async () => {
const params = { pageNo: 1 };
mockRequest.mockResolvedValue({ list: [] });
await getList(params);
expect(mockRequest).toHaveBeenCalledWith({
pageNo: 1,
method: "dj.api.smartcarlife.sop.strategy.list",
});
});
it("详情与创建更新相关接口应使用 post", async () => {
mockRequest.mockResolvedValue({});
await getMarketingPushStrategyDetailApi({ strategyId: 1 });
await createStrategy({ strategyName: "A" });
await updateStrategy({ strategyId: 1 });
await statusStrategy({ strategyId: 1, status: 1 });
await deleteStrategy({ strategyId: 1 });
await confirmStrategy({ strategyIds: [1] });
await recordsStrategy({ strategyId: 1 });
await recordDetail({ recordId: 1 });
await getMetaData({});
expect(mockRequest.mock.calls).toEqual([
[{ strategyId: 1, method: "dj.api.smartcarlife.sop.strategy.query" }, "post"],
[{ strategyName: "A", method: "dj.api.smartcarlife.sop.strategy.create" }, "post"],
[{ strategyId: 1, method: "dj.api.smartcarlife.sop.strategy.update" }, "post"],
[{ strategyId: 1, status: 1, method: "dj.api.smartcarlife.sop.strategy.status" }, "post"],
[{ strategyId: 1, method: "dj.api.smartcarlife.sop.strategy.delete" }, "post"],
[{ strategyIds: [1], method: "dj.api.smartcarlife.sop.strategy.confirm" }, "post"],
[{ strategyId: 1, method: "dj.api.smartcarlife.sop.strategy.records" }, "post"],
[{ recordId: 1, method: "dj.api.smartcarlife.sop.strategy.record.detail" }, "post"],
[{ method: "dj.api.smartcarlife.sop.strategy.meta" }, "post"],
]);
});
it("getMetaOptionsApi 应默认空对象并使用 RequestMethods.POST", async () => {
mockRequest.mockResolvedValue({});
await getMetaOptionsApi();
await getMetaOptionsApi({ bizType: 1 });
expect(mockRequest.mock.calls).toEqual([
[
{ method: "dj.api.smartcarlife.sop.strategy.meta" },
mockRequestMethods.POST,
],
[
{ bizType: 1, method: "dj.api.smartcarlife.sop.strategy.meta" },
mockRequestMethods.POST,
],
]);
});
});
import { createLocalVue, shallowMount } from "@vue/test-utils";
jest.mock("@/views/marketingManagement/marketingPushStrategy/components/messageType", () => ({
name: "MessageType",
render(h) {
return h("div");
},
}));
const { MessageTypeEnum } = require("../../constant/index.js");
const ActionsItem = require("./index.vue").default;
describe("marketingPushStrategy components/actionsItem", () => {
const localVue = createLocalVue();
let wrapper;
function createWrapper(item = {}) {
wrapper = shallowMount(ActionsItem, {
localVue,
propsData: {
propPrefix: "branches[0].actions[0]",
options: {
messageVariables: [],
},
item: {
actionType: 1,
targetGroupType: 1,
messageType: MessageTypeEnum.VARIABLE_TEXT,
content: "",
medias: [],
pageTitle: "",
pageDesc: "",
bgColor: "",
materialJson: [],
intervalPx: undefined,
...item,
},
},
stubs: {
"el-button": true,
"el-form-item": true,
"el-select": true,
"el-option": true,
"el-radio-group": true,
"el-radio": true,
},
});
return wrapper;
}
function getErrorMessages(callback) {
return callback.mock.calls
.map(call => call[0])
.filter(arg => arg instanceof Error)
.map(error => error.message);
}
afterEach(() => {
if (wrapper) {
wrapper.destroy();
}
jest.clearAllMocks();
});
it("文本消息缺少内容时应报错", () => {
createWrapper({ messageType: MessageTypeEnum.VARIABLE_TEXT, content: "" });
const callback = jest.fn();
wrapper.vm.validateMessageType({}, undefined, callback);
expect(getErrorMessages(callback)).toContain("请输入消息内容");
});
it("图片消息缺少素材时应报错", () => {
createWrapper({ messageType: MessageTypeEnum.VARIABLE_IMAGE, medias: [] });
const callback = jest.fn();
wrapper.vm.validateMessageType({}, undefined, callback);
expect(getErrorMessages(callback)).toContain("请上传消息图片");
});
it("网页消息配置不完整时应报错", () => {
createWrapper({
messageType: MessageTypeEnum.VARIABLE_WEBPAGE,
pageTitle: "",
pageDesc: "",
bgColor: "",
materialJson: [],
intervalPx: undefined,
});
const callback = jest.fn();
wrapper.vm.validateMessageType({}, undefined, callback);
expect(getErrorMessages(callback)).toEqual(expect.arrayContaining([
"请编辑网页内容",
"网页内容的素材不可为空",
]));
});
it("合法配置应最终回调通过", () => {
createWrapper({
messageType: MessageTypeEnum.VARIABLE_VIDEO,
medias: [{ mediaUrl: "https://video.test/1.mp4" }],
});
const callback = jest.fn();
wrapper.vm.validateMessageType({}, undefined, callback);
expect(callback).toHaveBeenLastCalledWith();
});
it("应透传动作类型、消息类型和删除事件", () => {
createWrapper();
wrapper.vm.handleActionTypeChange(2);
wrapper.vm.handleMessageTypeChange({ messageType: 3 });
wrapper.vm.handleRemoveActions();
expect(wrapper.emitted("input")[0]).toEqual([
expect.objectContaining({ actionType: 2 }),
]);
expect(wrapper.emitted("input")[1]).toEqual([{ messageType: 3 }]);
expect(wrapper.emitted("remove")).toHaveLength(1);
});
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!