Commit 32b9f138 by 前端

Merge branch 'SAAS+V5.8.3.10' into 'develop'

上线合并

See merge request !826
2 parents ab7a367b ef753650
Showing 136 changed files with 3629 additions and 527 deletions
......@@ -9,6 +9,10 @@ npm run lint
npm run test:unit
```
### 开发性能与主题预研
详见 [`.ai/docs/DEV_PERF_AND_THEME_RESEARCH.md`](../docs/DEV_PERF_AND_THEME_RESEARCH.md)(`npm run serve` 慢/OOM、懒加载开关、Element 主题静态化等方案的预研与后续落地顺序)。
默认不要执行:
```bash
......
......@@ -126,3 +126,91 @@ test.afterAll(async () => {
2. **每个 test 开头做 `goto`** 导航到目标页面,用 URL 导航来隔离 test 间状态
3. **afterAll 关闭 context**,避免资源泄漏
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 = "测试发送策略";
```
### 实操原则
- 先保证流程稳定,再考虑写法优雅
- 先最小改动,再逐步增强健壮性
- 每次修复后先做定向验证,再做整文件回归
......@@ -38,5 +38,7 @@ yarn-error.log*
/.codegraph/
# test
/playwright/
/testCase/
{
"mcpServers": {
"codegraph": {
"type": "stdio",
"command": "codegraph",
"args": [
"serve",
"--mcp"
]
}
}
}
module.exports = {
plugins: {
// tailwindcss: {},
autoprefixer: {},
// "postcss-px-to-viewport": {
// unitToConvert: "rem", // 要转化的单位
// viewportWidth: 25, // UI设计稿的宽度
// unitPrecision: 6, // 转换后的精度,即小数点位数
// propList: ["*"], // 指定转换的css属性的单位,*代表全部css属性的单位都进行转换
// viewportUnit: "px", // 指定需要转换成的视窗单位,默认vw
// fontViewportUnit: "px", // 指定字体需要转换成的视窗单位,默认vw
// selectorBlackList: ["wrap"], // 指定不转换为视窗单位的类名,
// minPixelValue: 1, // 默认值1,小于或等于1px则不进行转换
// mediaQuery: true, // 是否在媒体查询的css代码中也进行转换,默认false
// replace: true, // 是否转换后直接更换属性值
// exclude: [/node_modules/], // 设置忽略文件,用正则做目录名匹配
// landscape: false // 是否处理横屏情况
// }
},
};
......@@ -2,8 +2,14 @@
"eslint.enable": true,
"eslint.format.enable": true,
"prettier.enable": false,
"i18n-ally.localesPaths": ["src/locales"],
"cSpell.words": ["vuex", "Cascader", "glsx"],
"i18n-ally.localesPaths": [
"src/locales"
],
"cSpell.words": [
"Cascader",
"glsx",
"vuex"
],
"workbench.tree.indent": 24,
"explorer.compactFolders": false,
"scm.compactFolders": false,
......@@ -11,14 +17,23 @@
"vetur.validation.template": false,
"vetur.validation.script": false,
"vetur.validation.style": true,
"vetur.useWorkspaceDependencies": true,
"vetur.ignoreProjectWarning": false,
"vetur.experimental.templateInterpolationService": false,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true,
"search.exclude": {
"**/coverage": true,
"**/dist": true,
"**/.git": true,
"**/node_modules": true
},
"search.useIgnoreFiles": true,
"search.useGlobalIgnoreFiles": true,
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
// JavaScript React(如果用 React)
// JavaScript React
"[javascriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
......@@ -34,7 +49,7 @@
"[vue]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
// JSON(普通)
// JSON
"[json]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
......@@ -60,37 +75,42 @@
"[markdown]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"editor.autoIndent": "full",
"editor.codeActionsOnSave": {
// "source.organizeImports": "explicit",
"source.fixAll.eslint": "explicit"
},
"editor.pasteAs.preferences": ["text.updateImports.jsts", "text"],
"editor.pasteAs.preferences": [
"text",
"text.updateImports.jsts"
],
"explorer.decorations.colors": false,
"eslint.validate": [
"astro",
"css",
"gql",
"graphql",
"html",
"javascript",
"javascriptreact",
"json",
"jsonc",
"vue",
"html",
"mjs",
"less",
"markdown",
"yaml",
"mjs",
"pcss",
"postcss",
"scss",
"svelte",
"toml",
"vue",
"xml",
"gql",
"graphql",
"astro",
"svelte",
"css",
"less",
"scss",
"pcss",
"postcss"
"yaml"
],
"javascript.preferences.importModuleSpecifier": "non-relative", // 优先使用 @/ 别名路径
"javascript.suggest.autoImports": true, // 确保这个是 true
// 优先使用 @/ 别名路径
"javascript.preferences.importModuleSpecifier": "non-relative",
// 确保这个是 true
"javascript.suggest.autoImports": true,
"vue.updateImportsOnFileMove.enabled": true,
"i18n-ally.sourceLanguage": "zh-chs",
"explorer.fileNesting.enabled": true,
......
......@@ -5,6 +5,7 @@
请优先阅读:
- /.ai/rules/ 目录下的文件
- 开发性能 / Element 主题预研:/.ai/docs/DEV_PERF_AND_THEME_RESEARCH.md
## 项目概述
......
......@@ -13,30 +13,46 @@ RUN apt-get update && apt-get install -y \
jq \
&& 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
ENV VOLTA_HOME=/root/.volta
ENV PATH=$VOLTA_HOME/bin:$PATH
ENV VOLTA_HOME=/home/claude/.volta
ENV PATH=${VOLTA_HOME}/bin:${PATH}
# 安装 Volta
RUN curl https://get.volta.sh | bash
# 安装 Node14
# 安装 Node
RUN volta install node@14
# 默认 Node22
RUN volta install node@22
# Claude Code
# 安装 Claude Code
RUN npm install -g @anthropic-ai/claude-code
# 触发一次 claude 命令让它生成初始的 ~/.claude.json(如果它还没生成的话)
# 并使用 jq 安全地注入 hasCompletedOnboarding 字段,不破坏原有内容
RUN mkdir -p /root && \
touch /root/.claude.json && \
(echo '{}' > /root/.claude.json) && \
jq '. + {"hasCompletedOnboarding": true}' /root/.claude.json > /root/.claude.json.tmp && \
mv /root/.claude.json.tmp /root/.claude.json
# 初始化 Claude 配置
RUN mkdir -p /home/claude/.claude && \
echo '{}' > /home/claude/.claude.json && \
jq '. + {"hasCompletedOnboarding": true}' \
/home/claude/.claude.json \
> /home/claude/.claude.json.tmp && \
mv /home/claude/.claude.json.tmp /home/claude/.claude.json
# ==========================
# 最后统一修正权限
# ==========================
USER root
RUN chown -R 1000:1000 /home/claude
# 恢复默认运行用户
USER claude
WORKDIR /workspace
CMD ["/bin/bash"]
services:
ai-worker:
# user: "1000:1000"
build:
context: .
dockerfile: ../build/Dockerfile.unit.test
container_name: ai-worker
working_dir: /workspace
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:
- 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_MODEL=qwen3.5-plus
- ANTHROPIC_SMALL_FAST_MODEL=qwen3.5-flash
......@@ -17,6 +29,15 @@ services:
- ANTHROPIC_DEFAULT_SONNET_MODEL=qwen3.5-plus
- ANTHROPIC_DEFAULT_OPUS_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
volumes:
npm-cache:
claude-cache:
volta-cache:
......@@ -27,6 +27,7 @@ export default antfu({
"array-bracket-spacing": ["error", "always"],
},
rules: {
"curly": ["error", "all"],
"vue/no-deprecated-slot-attribute": "off",
"vue/no-deprecated-v-on-native-modifier": "off",
"vue/no-deprecated-destroyed-lifecycle": "off",
......@@ -164,4 +165,37 @@ export default antfu({
*/
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 = {
],
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1",
"^@api/(.*)$": "<rootDir>/src/api/$1",
"\\.css$": "jest-transform-stub",
"^@/plugin/d2admin/(.*)$": "<rootDir>/jest.mocks/d2admin.js",
"^@/assets/svg-icons/index.js$": "<rootDir>/jest.mocks/svg-icons-index.js",
......
This diff could not be displayed because it is too large.
......@@ -4,9 +4,9 @@
"private": true,
"scripts": {
"备注": "去掉nomock配置命令",
"serve": "vue-cli-service serve",
"start": "set NODE_OPTIONS=--openssl-legacy-provider && npm run serve",
"dev": "set NODE_OPTIONS=--openssl-legacy-provider && npm run serve",
"serve": "set NODE_OPTIONS=--max-old-space-size=4096&& vue-cli-service serve",
"start": "npm run serve",
"dev": "npm run serve",
"build": "vue-cli-service build --no-module",
"build:nomock": "vue-cli-service build --mode nomock",
"lint": "vue-cli-service lint --fix",
......@@ -53,7 +53,7 @@
"sortablejs": "^1.15.6",
"svg-sprite-loader": "^6.0.11",
"ua-parser-js": "^0.7.19",
"vue": "^2.6.10",
"vue": "2.6.10",
"vue-lazyload": "^1.2.3",
"vue-router": "3.0.5",
"vuedraggable": "^2.24.3",
......@@ -92,7 +92,7 @@
"sass-loader": "^7.3.1",
"script-loader": "^0.7.2",
"speed-measure-webpack-plugin": "^1.5.0",
"vue-template-compiler": "^2.5.21",
"vue-template-compiler": "2.6.10",
"webpack": "^5.74.0"
},
"volta": {
......
......@@ -14,7 +14,7 @@ import { defineConfig, devices } from "@playwright/test";
import dayjs from "dayjs";
// 生成时间戳,用于报告和结果目录
const timestamp = dayjs().format("YYYY-MM-DD HH");
const timestamp = dayjs().format("YYYY-MM-DD HH:mm:ss");
export default defineConfig({
// 测试文件位置
......
import request from "./request";
/**
* 保持精度的 JSON 解析
* 解决 JavaScript Number 只能精确表示 15-17 位有效数字的问题
* 超过精度的数字(如后端返回的 20 位小数)会被自动截断
* 策略:用正则把超过 17 位有效数字的小数替换为字符串占位符,JSON.parse 后再还原
*/
function parseKeepPrecision(data) {
if (typeof data !== "string") {
return data;
}
try {
const precisionMap = {};
let counter = 0;
const processed = data.replace(
/("?[\w$]+"?\s*:\s*)(-?\d+\.\d{18,})/g,
(match, key, value) => {
const placeholder = `"__PRECISION_NUM_${counter}__"`;
precisionMap[counter] = value;
counter++;
return key + placeholder;
},
);
const result = JSON.parse(processed);
const restore = (obj) => {
if (Array.isArray(obj)) {
obj.forEach(restore);
} else if (obj && typeof obj === "object") {
Object.keys(obj).forEach((k) => {
if (typeof obj[k] === "string" && /^__PRECISION_NUM_(\d+)__$/.test(obj[k])) {
const idx = obj[k].match(/__PRECISION_NUM_(\d+)__/)[1];
obj[k] = precisionMap[idx];
} else if (obj[k] && typeof obj[k] === "object") {
restore(obj[k]);
}
});
}
};
restore(result);
return result;
} catch (e) {
return data;
}
}
const path = "dj.api.";
const path2 = "dj.smartcarlife.api.";
......@@ -18,7 +65,21 @@ export function commodityAddSeviceMerchant(data) {
// 根据基础商品Id查询商品
export function getGoodsInfoById(data) {
data.method = `${path}basegoods.get.byId`;
return request(data);
// 使用 transformResponse 选项,在 axios 默认 JSON.parse 之前先拿到原始字符串处理
return request(data, "post", [], {
transformResponse: [
// 第一个函数:返回原始字符串(覆盖 axios 默认的 JSON.parse)
data => data,
// 第二个函数:使用保持精度的解析
(data) => {
console.log(data, typeof data);
if (typeof data === "string") {
return parseKeepPrecision(data);
}
return data;
},
],
});
}
// 根据基础商品id获取分配门店列表 - 查看门店
......
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);
}
......@@ -2,6 +2,59 @@ import request from "./request";
const path = "dj.api.smartcarlife.";
/**
* 保持精度的 JSON 解析
* 解决 JavaScript Number 只能精确表示 15-17 位有效数字的问题
* 超过精度的数字(如后端返回的 20 位小数)会被自动截断
* 策略:用正则把超过 17 位有效数字的小数替换为字符串占位符,JSON.parse 后再还原
*/
function parseKeepPrecision(data) {
if (typeof data !== "string") {
return data;
}
try {
// 匹配超过 17 位有效数字的数字(包括小数)
// 例如: 1.54321543215432154321
const precisionMap = {};
let counter = 0;
// 匹配带小数点且有效位数 > 17 的数字
const processed = data.replace(
/("?[\w$]+"?\s*:\s*)(-?\d+\.\d{18,})/g,
(match, key, value) => {
const placeholder = `"__PRECISION_NUM_${counter}__"`;
precisionMap[counter] = value;
counter++;
return key + placeholder;
},
);
// 解析 JSON
const result = JSON.parse(processed);
// 递归还原高精度数字为字符串
const restore = (obj) => {
if (Array.isArray(obj)) {
obj.forEach(restore);
} else if (obj && typeof obj === "object") {
Object.keys(obj).forEach((k) => {
if (typeof obj[k] === "string" && /^__PRECISION_NUM_(\d+)__$/.test(obj[k])) {
const idx = obj[k].match(/__PRECISION_NUM_(\d+)__/)[1];
obj[k] = precisionMap[idx];
} else if (obj[k] && typeof obj[k] === "object") {
restore(obj[k]);
}
});
}
};
restore(result);
return result;
} catch (e) {
// 解析失败时返回原始数据
return data;
}
}
// 获取产品管理 列表数据
export function getProductManageList(data) {
data.method = `${path}productManager.page`;
......@@ -11,13 +64,39 @@ export function getProductManageList(data) {
// 获取产品管理列表 SPU 分页(否)
export function getProductManageListPageLimit(data) {
data.method = `${path}productManager.spu.page`;
return request(data);
// 使用 transformResponse 选项,在 axios 默认 JSON.parse 之前先拿到原始字符串处理
return request(data, "post", [], {
transformResponse: [
// 第一个函数:返回原始字符串(覆盖 axios 默认的 JSON.parse)
data => data,
// 第二个函数:使用保持精度的解析
(data) => {
if (typeof data === "string") {
return parseKeepPrecision(data);
}
return data;
},
],
});
}
// 获取产品管理列表 pageSku(是)
export function getProductManageListPageSku(data) {
data.method = `${path}productManager.pageSku`;
return request(data);
// 使用 transformResponse 选项,在 axios 默认 JSON.parse 之前先拿到原始字符串处理
return request(data, "post", [], {
transformResponse: [
// 第一个函数:返回原始字符串(覆盖 axios 默认的 JSON.parse)
data => data,
// 第二个函数:使用保持精度的解析
(data) => {
if (typeof data === "string") {
return parseKeepPrecision(data);
}
return data;
},
],
});
}
// 新增产品:所有参数转 json 字符串赋值到 requestJson
......@@ -89,13 +168,13 @@ export function getUpgradeProductList(data) {
// 根据id查询商品详情
export function getBaseGoodsById(data) {
data.method = "dj.api.basegoods.get.byId";
return request(data);
return request(data, "post");
}
// 分页查询 SKU 详情(商品名称/编码搜索)
export function getBaseGoodsSkuPageById(data) {
data.method = "dj.api.basegoods.get.sku.page.byId";
return request(data);
return request(data, "post");
}
// 分页查询基础商品操作日志
......@@ -119,7 +198,7 @@ export function getProductCatalogList(data) {
// 新增/编辑产品(产品清单)
export function addOrUpdateProductCatalog(data) {
data.method = "dj.api.smartcarlife.productTemplate.addOrUpdate";
return request(data, 'post');
return request(data, "post");
}
// 删除产品(产品清单)
......@@ -130,38 +209,38 @@ export function deleteProductCatalog(data) {
// 批量新增SPU/SKU导入
export function importBatchAddSPUOrSKU(data) {
data.method = "dj.api.smartcarlife.productManager.spu.sku.batch.add.import"
return request(data, "post", ["file"])
data.method = "dj.api.smartcarlife.productManager.spu.sku.batch.add.import";
return request(data, "post", ["file"]);
}
// 批量新增SKU导入
export function importBatchAddSKU(data) {
data.method = "dj.api.smartcarlife.productManager.sku.batch.add.import"
return request(data, "post", ["file"])
data.method = "dj.api.smartcarlife.productManager.sku.batch.add.import";
return request(data, "post", ["file"]);
}
// 批量修改SKU导入
export function importBatchEditSKU(data) {
data.method = "dj.api.smartcarlife.productManager.sku.batch.update.import"
return request(data, "post", ["file"])
data.method = "dj.api.smartcarlife.productManager.sku.batch.update.import";
return request(data, "post", ["file"]);
}
// 获取供应商数据
export function getGoodsProviderList(data) {
data.method = "dj.api.smartcarlife.goodsProvider.page"
return request(data)
data.method = "dj.api.smartcarlife.goodsProvider.page";
return request(data);
}
// 新增供应商
export function addGoodsProvider(data) {
data.method = "dj.api.smartcarlife.goodsProvider.insert"
return request(data)
data.method = "dj.api.smartcarlife.goodsProvider.insert";
return request(data);
}
// 编辑供应商
export function editGoodsProvider(data) {
data.method = "dj.api.smartcarlife.goodsProvider.update"
return request(data)
data.method = "dj.api.smartcarlife.goodsProvider.update";
return request(data);
}
// 获取省市两级数据
......
......@@ -101,3 +101,21 @@ export function linkMerchant(data) {
data.method = `dj.staff.api.recruitment.demand.link.merchant`;
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
......@@ -21,7 +21,9 @@ function request(
) {
// 兼容线上dj和scrm appkey和secret不一样的情况
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";
} else if (params.method.includes("dj.api.script")) {
apiName = "script";
......@@ -45,6 +47,8 @@ function request(
} else if (params.method.includes("merchants.api.open.createMerchantWithPermissions")) {
/** 开放平台创建商户 — 与同网关 oaapproval 一致,使用 axios_oaapproval / baseURL */
apiName = "oaapproval";
} else if (params.method.includes("dj.api.marketing")) {
apiName = "strategy";
} else {
// console.log(params.method.split(".api"))
apiName = params.method.split(".api")[0];
......
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);
}
......@@ -419,7 +419,7 @@ export function limitPrice(
pointDigit,
minValue,
maxValue,
regRule
regRule,
) {
let reg = {
priceReg: /^\d[\d\.]*$/, // eslint-disable-line
......@@ -427,8 +427,8 @@ export function limitPrice(
};
regRule = regRule || "priceReg";
if (
newValue &&
((minValue && newValue < minValue) || (maxValue && newValue > maxValue))
newValue
&& ((minValue && newValue < minValue) || (maxValue && newValue > maxValue))
) {
return oldValue || "";
}
......@@ -437,18 +437,18 @@ export function limitPrice(
newValue = newValue + "";
let interger = newValue.split(".")[0];
let point = newValue.split(".")[1];
let intergerNum =
interger.length > intergerDigit
let intergerNum
= interger.length > intergerDigit
? oldValue.split(".")[0]
: interger;
let pointNum =
point.length > pointDigit ? point.slice(0, pointDigit) : point;
let pointNum
= point.length > pointDigit ? point.slice(0, pointDigit) : point;
newValue = pointDigit
? intergerNum + "." + pointNum
: newValue.split(".")[0];
} else {
newValue =
newValue.length > intergerDigit
newValue
= newValue.length > intergerDigit
? oldValue.slice(0, intergerDigit)
: newValue;
}
......@@ -481,10 +481,10 @@ export const appointDays = 35;
export const afterTodayOptions = {
disabledDate(date) {
if (
date < new Date(new Date().toLocaleDateString()) ||
date >
new Date(
new Date().setDate(new Date().getDate() + (appointDays - 1))
date < new Date(new Date().toLocaleDateString())
|| date
> new Date(
new Date().setDate(new Date().getDate() + (appointDays - 1)),
)
) {
return true;
......@@ -1109,9 +1109,9 @@ export const businessOptShowText = {
};
// 预警管理 所属业务 显示文字
export const orderBusinessType = {
0: "轻改",
1: "权益",
2: "延保",
"0": "轻改",
"1": "权益",
"2": "延保",
"-1": "其他",
};
......@@ -1681,14 +1681,14 @@ export const evaluationSourceOpt = [
{ confId: 4, confValue: "车况生成" },
];
export const evaluationStatusOptMap = {
10: "#FDB757",
20: "#2CCA74",
30: "#2CCA74",
31: "#2CCA74",
32: "#2CCA74",
40: "#2CCA74",
50: "#2CCA74",
100: "#8C8C8C",
"10": "#FDB757",
"20": "#2CCA74",
"30": "#2CCA74",
"31": "#2CCA74",
"32": "#2CCA74",
"40": "#2CCA74",
"50": "#2CCA74",
"100": "#8C8C8C",
"-1": "#EB4E4E",
};
// 合同类型
......@@ -1937,7 +1937,7 @@ export const djOrderTypeMap = {
export const auditStatusMap = {
1: "区域运营待审批",
2: "线上运营待审批",
2: "运营待审批",
3: "审批通过",
4: "审批驳回",
};
......@@ -1992,7 +1992,7 @@ export const goodsAuditStatusList = [
},
{
confId: "2",
confLabel: "线上运营待审批",
confLabel: "运营待审批",
},
{
confId: "3",
......@@ -2091,6 +2091,16 @@ export const trialStatusOpt = [
confValue: "无试岗",
},
];
export const approvalStatusOpt = [
{
confId: 0,
confValue: "待审批",
},
{
confId: 1,
confValue: "已审批",
},
];
export const connectionFlagOptMap = {
true: "#2CCA74",
false: "#EB4E4E",
......
......@@ -4,17 +4,17 @@
export const beforeRangePickerOptions = {
disabledDate(date) {
if (date > new Date()) {
return true
return true;
}
return false
}
}
return false;
},
};
export const afterRangePickerOptions = {
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) {
return true
}
return false
return true;
}
}
return false;
},
};
<template>
<el-dialog ref="elDialog"
v-bind="$attrs"
:visible.sync="innerVisible"
:width="computedWidth"
:fullscreen="innerFullscreen"
:custom-class="dialogCustomClass"
:fullscreen="innerFullscreen"
:show-close="false"
:visible.sync="innerVisible"
:width="computedWidth"
v-on="$listeners"
@open="handleOpen">
<!-- Title slot wrapper for fullscreen support -->
......@@ -18,15 +18,15 @@
<div class="venus-dialog-actions">
<!-- Fullscreen toggle button -->
<button v-if="allowFullscreen"
type="button"
class="venus-dialog-action-btn"
type="button"
@click="toggleFullscreen">
<i :class="innerFullscreen ? 'el-icon-crop' : 'el-icon-full-screen'"></i>
</button>
<!-- Custom Close button -->
<button v-if="showClose"
type="button"
class="venus-dialog-action-btn"
type="button"
@click="handleClose">
<i class="el-icon-close"></i>
</button>
......@@ -145,6 +145,9 @@ export default {
computedHeight() {
return this.formatSize(this.height);
},
computedTop() {
return this.formatSize(this.$attrs.top);
},
innerVisible: {
get() {
return this.visible;
......@@ -197,18 +200,21 @@ export default {
}
}
},
beforeUnmount() {
beforeDestroy() {
this.destroyDrag();
},
methods: {
formatSize(val) {
if (val === "" || val === undefined || val === null)
if (val === "" || val === undefined || val === null) {
return "";
if (typeof val === "number")
}
if (typeof val === "number") {
return `${val}px`;
}
if (typeof val === "string") {
if (/^\d+$/.test(val))
if (/^\d+$/.test(val)) {
return `${val}px`;
}
return val;
}
return val;
......@@ -219,12 +225,14 @@ export default {
// Just ensure we do our own initialization.
},
centerDialog() {
if (this.innerFullscreen)
if (this.innerFullscreen) {
return;
}
this.$nextTick(() => {
const dialogWrapper = this.$refs.elDialog?.$el;
if (!dialogWrapper)
if (!dialogWrapper) {
return;
}
const dragDom = dialogWrapper.querySelector(".el-dialog");
if (dragDom) {
// Reset inline styles first
......@@ -258,12 +266,15 @@ export default {
// Calculate vertical center
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
const topOffset = Math.max(0, (screenHeight - dragDomHeight) / 2);
dragDom.style.marginTop = "0";
dragDom.style.top = `${topOffset}px`;
}
}
});
},
toggleFullscreen() {
......@@ -286,15 +297,17 @@ export default {
this.$emit("confirm");
},
initDrag() {
if (!this.draggable)
if (!this.draggable) {
return;
}
const dialogWrapper = this.$refs.elDialog.$el;
const dialogHeaderEl = dialogWrapper.querySelector(".el-dialog__header");
const dragDom = dialogWrapper.querySelector(".el-dialog");
if (!dialogHeaderEl || !dragDom)
if (!dialogHeaderEl || !dragDom) {
return;
}
dialogHeaderEl.style.cursor = "move";
......@@ -309,12 +322,14 @@ export default {
this.dragEvent = (e) => {
// Disable drag if fullscreen is active
if (this.innerFullscreen)
if (this.innerFullscreen) {
return;
}
// Prevent drag when clicking on header buttons
if (e.target.closest("button"))
if (e.target.closest("button")) {
return;
}
// Ensure transform is cleared and converted to absolute left/top BEFORE drag starts
// This prevents the jump when dragging starts from the centered position
......@@ -372,11 +387,13 @@ export default {
dialogHeaderEl.addEventListener("mousedown", this.dragEvent);
},
destroyDrag() {
if (!this.dragEvent)
if (!this.dragEvent) {
return;
}
const dialogWrapper = this.$refs.elDialog?.$el;
if (!dialogWrapper)
if (!dialogWrapper) {
return;
}
const dialogHeaderEl = dialogWrapper.querySelector(".el-dialog__header");
if (dialogHeaderEl) {
dialogHeaderEl.removeEventListener("mousedown", this.dragEvent);
......@@ -386,8 +403,9 @@ export default {
},
resetPosition() {
const dialogWrapper = this.$refs.elDialog?.$el;
if (!dialogWrapper)
if (!dialogWrapper) {
return;
}
const dragDom = dialogWrapper.querySelector(".el-dialog");
if (dragDom) {
dragDom.style.left = "50%";
......
/**
* @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) {
};
});
}
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 = {
902: {
path: "/flowManage",
......@@ -7,8 +7,8 @@ export const routerName = {
title: "流量管理",
authId: "902",
parentId: "1",
cache: false
}
cache: false,
},
},
90201: {
path: "/customerList",
......@@ -17,7 +17,7 @@ export const routerName = {
title: "客户列表",
authId: "90201",
parentId: "902",
cache: false
cache: false,
},
auth: [
{
......@@ -26,10 +26,49 @@ export const routerName = {
label: "导出",
category: "Button",
type: "primary",
handle: "handleExport"
}
handle: "handleExport",
},
{
authId: "9020102",
parentId: "90201",
label: "客户画像",
handle: "handleViewPortrait",
addRoutePath: [
{
authId: "90205",
name: "客户画像",
parentId: "90201",
},
],
component: _import("customer/customerList")
},
{
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"),
},
90202: {
path: "/recordList",
......@@ -38,32 +77,16 @@ export const routerName = {
title: "预录信息",
authId: "90202",
parentId: "902",
cache: false
cache: false,
},
auth: [
{
authId: "9020201",
parentId: "90202",
label: "预录客户",
icon: "plus",
category: "Button",
type: "primary",
handle: "handleAdd",
addRoutePath: [
{
authId: "901",
name: "预录客户",
parentId: "90202"
}
]
},
{
authId: "9020202",
parentId: "90202",
label: "一键导入",
category: "Button",
type: "primary",
handle: "handleImport"
handle: "handleImport",
},
{
authId: "9020203",
......@@ -74,75 +97,38 @@ export const routerName = {
{
authId: "901",
name: "预录客户",
parentId: "90202"
}
]
}
],
component: _import("customer/recordList")
},
90203: {
path: "/invitation",
name: "invitation",
meta: {
title: "邀约管理",
authId: "90203",
parentId: "902",
cache: false
},
auth: [
{
authId: "9020301",
parentId: "90203",
label: "再次电联",
handle: "handleMoreCall"
// ruleObj: {
// attr: 'status',
// rule: {
// 0: '上架',
// 1: '下架'
// }
// }
parentId: "90202",
},
{
authId: "9020302",
parentId: "90203",
label: "取消预约",
handle: "handleCancel"
],
},
{
authId: "9020303",
parentId: "90203",
label: "更新备注",
handle: "handleUpdateRemark"
],
component: _import("customer/recordList"),
},
{
authId: "9020304",
parentId: "90203",
label: "修改时间",
handle: "handleChangeTime"
90205: {
path: "/customerPortrait",
name: "customerPortrait",
meta: {
title: "客户画像",
authId: "90205",
parentId: "90201",
cache: false,
sideHidden: true,
activePath: "/customerList",
},
{
authId: "9020305",
parentId: "90203",
label: "电联一下",
handle: "handleCall"
component: _import("customer/portrait/index"),
},
{
authId: "9020306",
parentId: "90203",
label: "预约时间",
handle: "handleAppoint"
90206: {
path: "/customerGroupRel",
name: "customerGroupRel",
meta: {
title: "群关联",
authId: "90206",
parentId: "90201",
cache: false,
sideHidden: true,
activePath: "/customerList",
},
{
authId: "9020307",
parentId: "90203",
label: "更新备注",
handle: "handleUpdateRemark"
}
],
component: _import("customer/invitation")
component: _import("customer/groupRel/index"),
},
901: {
path: "/editCustomer",
......@@ -153,10 +139,10 @@ export const routerName = {
parentId: "90202",
cache: false,
sideHidden: false,
activePath: "/recordList"
activePath: "/recordList",
},
component: _import("customer/editCustomer"),
},
component: _import("customer/editCustomer")
}
}
};
// { routerName }
const _import = require("@/libs/util.import." + process.env.NODE_ENV);
export const routerName = {
922: {
path: "/marketingManagement",
name: "marketingManagement",
meta: {
title: "营销管理",
authId: "922",
parentId: "1",
cache: false,
},
},
92201: {
path: "/marketingActivity",
name: "marketingActivity",
meta: {
title: "营销活动",
authId: "92201",
parentId: "922",
cache: false,
},
component: _import("marketingManagement/marketingActivity/index"),
auth: [
{
authId: "9220101",
parentId: "92201",
label: "新增活动",
category: "Button",
type: "primary",
handle: "handleAdd",
addRoutePath: [
{
authId: "92202",
name: "新增活动",
parentId: "92201",
},
],
},
{
authId: "9220102",
parentId: "92201",
label: "查看详情",
handle: "handleDetail",
addRoutePath: [
{
authId: "92203",
name: "订单详情",
parentId: "92201",
},
],
},
],
},
92202: {
path: "/addMarketingActivity",
name: "addMarketingActivity",
meta: {
title: "新增活动",
authId: "92202",
parentId: "92201",
cache: false,
sideHidden: true,
activePath: "/marketingActivity",
},
component: _import("marketingManagement/marketingActivity/addMarketingActivity"),
},
92203: {
path: "/viewMarketingActivity",
name: "viewMarketingActivity",
meta: {
title: "查看详情",
authId: "92203",
parentId: "92201",
cache: false,
sideHidden: true,
activePath: "/marketingActivity",
},
component: _import("marketingManagement/marketingActivity/viewMarketingActivity"),
auth: [
{
authId: "9220103",
parentId: "92203",
label: "编辑",
category: "Button",
type: "primary",
handle: "handleEdit",
},
{
authId: "9220104",
parentId: "92203",
label: "删除",
category: "Button",
handle: "handleDelete",
},
{
authId: "9220105",
parentId: "92203",
label: "暂停",
category: "Button",
handle: "handlePause",
},
{
authId: "9220106",
parentId: "92203",
label: "恢复",
category: "Button",
type: "primary",
handle: "handleResume",
},
{
authId: "9220107",
parentId: "92203",
label: "延期",
category: "Button",
handle: "handleOpenDelay",
},
{
authId: "9220108",
parentId: "92203",
label: "下线",
category: "Button",
type: "danger",
handle: "handleOffline",
},
{
authId: "9220109",
parentId: "92203",
category: "Button",
type: "primary",
label: "再次创建",
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: "9230102",
parentId: "92301",
label: "新增标签维度",
category: "Button",
type: "primary",
handle: "handleAddDimension",
},
{
authId: "9230105",
parentId: "92301",
label: "编辑",
handle: "handleEditDimension",
},
{
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",
},
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 @@
<p>今日邀约详情</p>
</div>
<div class="appoint-table-content">
<table
cellpadding="0"
<table cellpadding="0"
cellspacing="0">
<tr class="appoint-table-header">
<td>邀约时间</td>
......@@ -14,26 +13,24 @@
<td>服务状态</td>
</tr>
<template v-if="detailData.length">
<tr
v-for="(item, index) in detailData"
<tr v-for="(item, index) in detailData"
:key="index">
<td>{{ item.time }}</td>
<td class="flex">
<img
class="detail-header"
<img class="detail-header"
:src="item.info.sex === 1 ? './images/header-man-grey.png' : './images/header-woman.png'">
<template class="detail-info">
<p>{{ item.info.name }}</p>
<p>{{ item.info.project }}</p>
</template>
<template class="detail-phone">
<p
class="secret-phone"
v-show="!item.info.phone">
<p v-show="!item.info.phone"
class="secret-phone">
<span class="one-tip">手机号码已加密</span>
<span
class="two-tip"
@click="handleGetPhone(item, index)">获取虚拟手机号</span>
<span class="two-tip"
@click="handleGetPhone(item, index)">
获取虚拟手机号
</span>
</p>
<p v-show="item.info.phone">
{{ item.info.phone }}
......@@ -57,126 +54,132 @@
<script>
export default {
name: 'AppointTable',
name: "AppointTable",
data() {
return {
hoursList: [
{ hour: '9:00' }, { hour: '10:00' },
{ hour: '11:00' }, { hour: '12:00' },
{ hour: '13:00' }, { hour: '14:00' },
{ hour: '15:00' }, { hour: '16:00' },
{ hour: '17:00' }, { hour: '18:00' }],
{ hour: "9:00" },
{ hour: "10:00" },
{ hour: "11:00" },
{ hour: "12:00" },
{ hour: "13:00" },
{ hour: "14:00" },
{ hour: "15:00" },
{ hour: "16:00" },
{ hour: "17:00" },
{ hour: "18:00" },
],
detailData: [{
time: '上午9:00',
time: "上午9:00",
info: {
header: '',
name: '张三',
header: "",
name: "张三",
// 1 - 男; 2 - 女
sex: 1,
project: '预约项目',
phone: ''
project: "预约项目",
phone: "",
},
// 0 - 未到店; 1 - 完成服务
status: 0
status: 0,
}, {
time: '上午9:00',
time: "上午9:00",
info: {
header: '',
name: '张兰',
header: "",
name: "张兰",
sex: 2,
project: '预约项目',
phone: ''
project: "预约项目",
phone: "",
},
// 0 - 未到店; 1 - 完成服务
status: 1
status: 1,
}, {
time: '上午10:00',
time: "上午10:00",
info: {
header: '',
name: '张一二',
header: "",
name: "张一二",
sex: 1,
project: '预约项目',
phone: ''
project: "预约项目",
phone: "",
},
// 0 - 未到店; 1 - 完成服务
status: 0
status: 0,
}, {
time: '上午10:00',
time: "上午10:00",
info: {
header: '',
name: '张一二',
header: "",
name: "张一二",
sex: 1,
project: '预约项目',
phone: ''
project: "预约项目",
phone: "",
},
// 0 - 未到店; 1 - 完成服务
status: 0
status: 0,
}, {
time: '上午10:00',
time: "上午10:00",
info: {
header: '',
name: '张一二',
header: "",
name: "张一二",
sex: 1,
project: '预约项目',
phone: ''
project: "预约项目",
phone: "",
},
// 0 - 未到店; 1 - 完成服务
status: 0
status: 0,
}, {
time: '上午10:00',
time: "上午10:00",
info: {
header: '',
name: '张一二',
header: "",
name: "张一二",
sex: 1,
project: '预约项目',
phone: ''
project: "预约项目",
phone: "",
},
// 0 - 未到店; 1 - 完成服务
status: 0
status: 0,
}, {
time: '上午10:00',
time: "上午10:00",
info: {
header: '',
name: '张一二',
header: "",
name: "张一二",
sex: 1,
project: '预约项目',
phone: ''
project: "预约项目",
phone: "",
},
// 0 - 未到店; 1 - 完成服务
status: 0
status: 0,
}, {
time: '上午10:00',
time: "上午10:00",
info: {
header: '',
name: '张一二',
header: "",
name: "张一二",
sex: 1,
project: '预约项目',
phone: ''
project: "预约项目",
phone: "",
},
// 0 - 未到店; 1 - 完成服务
status: 0
}]
}
status: 0,
}],
};
},
mounted() { },
methods: {
handleGetPhone(targetItem, targetIndex) {
this.$confirm('客户手机号码已加密,是否获取虚拟号码?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
this.$confirm("客户手机号码已加密,是否获取虚拟号码?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.detailData[targetIndex].info.phone = '13088889999'
}).catch(err => {
console.log(err)
})
}
}
}
this.detailData[targetIndex].info.phone = "13088889999";
}).catch((err) => {
console.log(err);
});
},
},
};
</script>
<style lang="scss" scoped>
.appoint-table {
width: 49%;
......@@ -245,7 +248,7 @@ export default {
}
.two-tip {
color: #ffffff;
background-color: #4ECB73;
background-color: #4ecb73;
}
}
.secret-phone:hover {
......
......@@ -14,34 +14,36 @@
</div>
<p class="date-y-line" />
</template>
<el-button icon="el-icon-d-arrow-left"
<el-button class="arrow-left-icon"
icon="el-icon-d-arrow-left"
type="text"
class="arrow-left-icon"
:disabled="currentWeek === 1"
@click="handleWeek(false)" />
<template>
<div class="date-picker">
<div class="wrapper"
v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)"
:key="index">
<div v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)"
:key="index"
class="wrapper">
<span>
<p v-for="(info, infoIndex) in appointData[index].infoList"
:key="infoIndex">
<el-popover placement="bottom-start"
<el-popover open-delay="600"
placement="bottom-start"
title=""
width="200"
open-delay="600"
trigger="hover"
width="200"
:disabled="info.status === 0">
<div>
<p>1、客户姓名,时间,项目</p>
<p>2、客户姓名,时间,项目</p>
<p>余位数:8</p>
</div>
<el-button :class="{'col-width': true, 'hour-template': true, 'status-full': info.status === 2, 'status-remain': info.status === 1 }"
slot="reference"
<el-button slot="reference"
class="col-width hour-template"
:class="{ 'status-full': info.status === 2, 'status-remain': info.status === 1 }"
@click="handleAppoint(item, infoIndex)">
{{ appointStatusList[info.status] }}</el-button>
{{ appointStatusList[info.status] }}
</el-button>
</el-popover>
</p>
</span>
......@@ -49,13 +51,14 @@
</div>
<p class="date-x-line" />
<div class="date-picker">
<div class="wrapper"
v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)"
:key="index">
<el-button type="text"
:class="{'date-btn': true, 'col-width': true, 'active': item.active}"
<div v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)"
:key="index"
class="wrapper">
<el-button class="date-btn col-width"
type="text"
:class="{ active: item.active }"
@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>
</el-button>
</div>
......@@ -70,38 +73,39 @@
</template>
<script>
import { appointDays } from '@/common/format'
import { appointDays } from "@/common/format";
export default {
name: 'TimeDate',
name: "TimeDate",
props: {
appointData: {
type: Array,
default: () => [],
},
hoursList: {
type: Array,
default: () => [],
},
},
data() {
return {
// 7天为一个周期,预约时间为35天,一共5个周期,当前周期
currentWeek: 1,
// 日期
dateIndex: 0,
weekList: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
weekList: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
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 {
date: date.toLocaleDateString(),
week: date.getDay(),
active: !index
}
active: !index,
};
}),
// 时间
appointStatusList: ['空', '余', '满']
}
},
props: {
appointData: {
type: Array,
default: () => []
},
hoursList: {
type: Array,
default: () => []
}
appointStatusList: ["空", "余", "满"],
};
},
mounted() { },
......@@ -117,12 +121,12 @@ export default {
// this.$emit('handleAppoint', { date: date.date, hour: this.hoursList[hourIndex].hour })
},
handleWeek(isAdd) {
isAdd ? this.currentWeek++ : this.currentWeek--
}
}
}
isAdd ? this.currentWeek++ : this.currentWeek--;
},
},
};
</script>
<style lang="scss" scoped>
@import "./css/timeDateStyle.scss";
</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 buildCustomerStatusFilterOptions() {
return [
{ confId: "", confLabel: "全部" },
...CUSTOMER_STATUS_LIST,
];
}
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 "核销抵扣";
}
if (source === 13) {
return "PAD录入";
}
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 || "",
};
}
......@@ -17,19 +17,35 @@
src="@/assets/strategy/strategy-analyse-bg.png">
<div class="left">
<div class="right-panel" />
<div class="business-title">
<div class="business-header">
<div class="header-col header-left">
当前周期
</div>
<template v-for="(item, index) in row">
<div class="header-col header-right">
下一周期
</div>
</div>
<div :key="index"
<div class="business-list">
class="business-item">
<div v-for="(item, index) in row"
:key="index"
class="business-row">
<div class="col col-left">
<div class="business-item">
<div class="label">
......@@ -59,23 +75,11 @@
</div>
</template>
</div>
<div class="right">
<div class="business-title">
下一周期
</div>
<template v-for="(item, index) in row">
<div :key="index"
<div class="col col-right">
class="business-item">
<div class="business-item business-item--next">
<div class="label">
......@@ -109,9 +113,10 @@
</div>
</template>
</div>
</div>
</div>
</div>
......@@ -120,16 +125,16 @@
</div>
</baseDialog>
</template>
</template>
<script>
const decline = require("@/assets/strategy/decline.png");
<script>
const decline = require("@/assets/strategy/decline.png");
const just01 = require("@/assets/strategy/just01.png");
const just01 = require("@/assets/strategy/just01.png");
const rise = require("@/assets/strategy/rise.png");
const rise = require("@/assets/strategy/rise.png");
export default {
export default {
name: "EffectDetailDialog",
......@@ -229,29 +234,33 @@ export default {
},
};
</script>
};
</script>
<style scoped lang="scss">
.flex {
<style scoped lang="scss">
.flex {
display: flex;
align-items: center;
}
}
.arrow {
.arrow {
width: 16px;
height: 16px;
transform: translateY(1px);
}
}
.content {
.content {
min-height: 289px;
}
.block {
max-height: 40vh;
overflow: hidden;
}
.block {
&-title {
padding: 0 0 8px;
}
......@@ -265,7 +274,9 @@ export default {
}
.business-box {
height: 289px;
min-height: 289px;
max-height: 60vh;
border-radius: 4px;
......@@ -273,10 +284,14 @@ export default {
display: flex;
flex-direction: column;
box-sizing: border-box;
padding: 10px;
overflow: hidden;
.bg {
position: absolute;
......@@ -287,25 +302,43 @@ export default {
width: 100%;
height: 100%;
object-fit: cover;
}
.left,
.right {
width: 59%;
.right-panel {
position: absolute;
display: flex;
top: 10px;
flex-direction: column;
right: 10px;
bottom: 10px;
gap: 14px;
left: 59%;
border-radius: 4px;
background: #ffffffcc;
z-index: 1;
}
.business-header {
display: flex;
flex-shrink: 0;
position: relative;
z-index: 2;
.business-title {
padding-top: 16px;
margin-bottom: 14px;
}
.header-col {
color: #1d1d1d;
font-size: 14px;
......@@ -313,41 +346,80 @@ export default {
font-weight: 500;
}
.business-item {
display: flex;
.header-left {
box-sizing: border-box;
align-items: center;
width: 59%;
font-size: 13px;
padding-left: 15%;
}
.label {
min-width: 104px;
.header-right {
flex: 1;
color: #888888;
margin-right: 10px;
padding-left: 24px;
}
.value {
color: #1d1d1d;
.business-list {
flex: 1;
min-height: 0;
overflow-y: auto;
position: relative;
z-index: 2;
}
.business-row {
display: flex;
align-items: center;
margin-bottom: 14px;
&:last-child {
margin-bottom: 0;
}
}
.left {
.col {
box-sizing: border-box;
}
.col-left {
width: 59%;
padding-left: 15%;
}
.right {
border-radius: 4px;
background: #ffffffcc;
.col-right {
flex: 1;
padding-left: 24px;
}
.business-item {
display: flex;
align-items: center;
font-size: 13px;
.label {
min-width: 104px;
color: #888888;
margin-right: 10px;
}
.value {
color: #1d1d1d;
}
&--next .value {
color: #2a58ad;
font-size: 16px;
......@@ -357,5 +429,5 @@ export default {
}
}
}
}
</style>
</style>
\ No newline at end of file
......@@ -191,21 +191,21 @@
:search-params="effectSearchParams"
:visible.sync="effectDetailVisible" />
</div>
</template>
</template>
<script>
import dayjs from "dayjs";
import { getStrategyAnalysisEffect, getStrategyEffectList, getStrategyOnlineDist, getStrategyTotal, getStrategyTypeDist, getWarningTypeList } from "@/api/earlyWarningManager";
import noDataImg from "@/assets/strategy/emepty-strategy.png";
import { deepClone } from "@/common/util";
import calendarCustom from "../strategyCentre/compoments/clendarCustom.vue";
import HeaderCustom from "../strategyCentre/compoments/headerCustom.vue";
import SelectCustom from "../strategyCentre/compoments/selectCustom.vue";
import EffectDetailDialog from "./components/EffectDetailDialog.vue";
import OnlineOperList from "./components/OnlineOperList";
import StrategyTypeChart from "./components/StrategyTypeChart/index.vue";
// 盯防类型图标配置(配置化管理,易于扩展)
const WATCH_TYPE_ICON_CONFIG = {
<script>
import dayjs from "dayjs";
import { getStrategyAnalysisEffect, getStrategyEffectList, getStrategyOnlineDist, getStrategyTotal, getStrategyTypeDist, getWarningTypeList } from "@/api/earlyWarningManager";
import noDataImg from "@/assets/strategy/emepty-strategy.png";
import { deepClone } from "@/common/util";
import calendarCustom from "../strategyCentre/compoments/clendarCustom.vue";
import HeaderCustom from "../strategyCentre/compoments/headerCustom.vue";
import SelectCustom from "../strategyCentre/compoments/selectCustom.vue";
import EffectDetailDialog from "./components/EffectDetailDialog.vue";
import OnlineOperList from "./components/OnlineOperList";
import StrategyTypeChart from "./components/StrategyTypeChart/index.vue";
// 盯防类型图标配置(配置化管理,易于扩展)
const WATCH_TYPE_ICON_CONFIG = {
2: {
icon: "el-icon-warning-outline",
iconUrl: require("@/assets/strategy/icon-strategy-type01.png"),
......@@ -227,9 +227,9 @@ const WATCH_TYPE_ICON_CONFIG = {
icon: "el-icon-warning-outline",
iconUrl: require("@/assets/strategy/icon-strategy-type01.png"),
},
};
};
export default {
export default {
name: "StrategyAnalysis",
components: {
HeaderCustom,
......@@ -489,6 +489,7 @@ export default {
params.cycleType = params.periodType == 1 ? 2 : params.periodType == 2 ? 3 : params.periodType;
params.startDate = dayjs(this.startDate).format("YYYY-MM-DD");
params.endDate = dayjs(this.endDate).format("YYYY-MM-DD");
params.pageSize = 1000;
const data = await getStrategyAnalysisEffect(params);
console.log("getStrategyAnalysisEffect", data);
// axios 响应拦截器已返回 data 字段的内容(数组)
......@@ -649,8 +650,9 @@ export default {
* 更新日期范围并刷新数据(公共方法)
*/
_updateDateRangeAndRefresh(dateRange) {
if (!dateRange)
if (!dateRange) {
return;
}
this.dateRange = { ...dateRange };
......@@ -786,33 +788,33 @@ export default {
});
},
},
};
</script>
};
</script>
<style lang="scss" scoped>
$bg-white: #fff;
<style lang="scss" scoped>
$bg-white: #fff;
.dashboard-page {
.dashboard-page {
min-height: 100vh;
padding: 0 19px 20px;
box-sizing: border-box;
height: auto;
overflow: visible;
}
}
.top-header-wrapper {
.top-header-wrapper {
display: flex;
align-items: center;
justify-content: space-between;
background-color: #fff;
}
}
.border-bottom-line {
.border-bottom-line {
margin-top: -1px;
border-bottom: 1px solid #e5e5e5;
}
}
.content-area {
.content-area {
min-height: 0;
width: 100%;
.top-content {
......@@ -893,14 +895,14 @@ $bg-white: #fff;
padding: 16px 20px;
margin-top: 20px;
}
}
}
.tooltip-content-max {
.tooltip-content-max {
max-height: 320px;
overflow-y: scroll;
}
}
.two-line-ellipsis {
.two-line-ellipsis {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
......@@ -910,9 +912,9 @@ $bg-white: #fff;
word-break: break-all;
line-height: 1.5;
padding: 0 10px;
}
}
.tool-left {
.tool-left {
display: flex;
align-items: center;
font-size: 14px;
......@@ -923,14 +925,14 @@ $bg-white: #fff;
color: #e5e6eb;
line-height: normal; // 重置 line-height,避免受 .table-header 影响
}
}
}
.effect-cell {
.effect-cell {
color: #2a58ad;
cursor: pointer;
}
}
::v-deep .emptyBg {
::v-deep .emptyBg {
margin-top: 20px;
color: #999ea8;
font-size: 12px;
......@@ -940,5 +942,5 @@ $bg-white: #fff;
width: 86px;
height: 86px;
}
}
</style>
\ No newline at end of file
}
</style>
\ No newline at end of file
......@@ -271,7 +271,7 @@ export default {
selectedMerchantList() {
return this.cardList.filter(card => card.checked).map(card => ({
merchantId: card.merchantNo,
storeName: card.storeName,
merchantName: card.storeName,
}));
},
......
......@@ -93,7 +93,10 @@ const STRATEGY_FORM_2456 = [
label: "执行周期",
type: "daterange",
key: "dateRange",
pickerOptions: "afterPickerOptions",
pickerOptionsFun: (val) => {
let { strategyType } = val;
return [5, 6].includes(strategyType) ? '' : 'afterPickerOptions'
}
},
];
const STRATEGY_FORM_3 = [
......
......@@ -70,7 +70,7 @@
range-separator="至"
start-placeholder="开始时间"
type="daterange"
:picker-options="datePickerOptions[item.pickerOptions]">
:picker-options=" datePickerOptions[item.pickerOptionsFun ? item.pickerOptionsFun(formData) : item.pickerOptions]">
</el-date-picker>
</template>
<template v-else-if="item.type == 'textarea'">
......@@ -276,7 +276,6 @@ export default {
1: STRATEGY_FORM_1,
3: STRATEGY_FORM_3,
}[strategyType] || [];
return [
...list,
{
......
......@@ -555,8 +555,8 @@ export default {
this.loading = false;
});
if (flag) {
this.$refs.leftTable.refreshTable();
this.$refs.rightTable.refreshTable();
this.$refs.leftTable.refreshTable(true, true);
this.$refs.rightTable.refreshTable(true, true);
}
},
async getStrategyLearningEffectAnalysis() {
......
......@@ -2,57 +2,45 @@
<template>
<d2-dialog btn-ok-label="确定"
class="relateStore"
width="70%"
:is-visible.sync="relateStoreVisible"
:title="title"
width="70%"
@closeDialog="handleRelateStoreClose"
@confirmDialog="handleRelateStoreConfirm">
<slot />
<el-row class="tableCon">
<div class="tableBox left">
<el-table ref="seletingTable"
border
class="table"
:data="selectingData"
height="464px"
border
:data="selectingData"
@select="handleChange"
@select-all="handleAll">
<el-table-column align="center"
type="selection"
width="55" />
<el-table-column align="center"
label="门店名称"
prop="merchantName">
</el-table-column>
<el-table-column align="center"
label="门店地址"
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">
<template v-for="(item, index) in tablecolumnList">
<el-table-column v-if="tableHeadItems.includes(item.label)"
:key="index"
align="center"
:label="item.label"
:prop="item.prop">
</el-table-column>
</template>
</el-table>
<el-pagination background
<el-pagination layout="total, prev, pager, next"
background
small
:current-page.sync="currentPage"
layout="total, prev, pager, next"
:page-size="pageSize"
small
:total="total"
@current-change="handleCurrentChange" />
</div>
<el-table border
class="tableBox table"
:data="selectedData"
height="464px">
<el-table class="tableBox table"
height="464px"
border
:data="selectedData">
<el-table-column align="center"
label="门店名称"
prop="merchantName">
......@@ -114,11 +102,42 @@ export default {
default: false,
},
selectedSceneType: {
type: String
}
type: String,
},
page: {
type: String,
default: "",
},
tableHeadItems: {
type: Array,
default: () => {
return ["门店名称", "门店地址", "门店商户号", "服务对接", "服务对接商户号"];
},
},
},
data() {
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: [],
selectingData: [],
// 分页
......@@ -147,7 +166,7 @@ export default {
currentPage: this.currentPage,
pageSize: this.pageSize,
baseSceneCode: this.selectedBaseSceneCode,
queryMerchantAddr: true
queryMerchantAddr: true,
}).then((res) => {
res?.list?.forEach((val) => {
// 账户中心门店返回商户号字段是merchantNo
......
......@@ -4,16 +4,16 @@
<template #header>
<div class="header">
<d2-search class="show-search"
:form-data="showFormData"
label-width="100px"
:form-data="showFormData"
:search-form="searchForm">
<template #goodsCascader>
<el-cascader v-model="tempGoodsType"
placeholder="请选择"
style="width: 100%"
filterable
:options="baseData.productTypeList"
placeholder="请选择"
:props="{ checkStrictly: true, label: 'categoryName', value: 'categoryType' }"
style="width: 100%"
@change="selectAddAttr($event)">
</el-cascader>
</template>
......@@ -23,20 +23,20 @@
width="100%"
@selection-change="handleAreaSelectChange" /> -->
<ApplicableAreaQuerySelect v-model="applicableAreas"
:options="baseData.applicableAreaList"
:all-exclusive="false"
width="100%"
:all-exclusive="false"
:options="baseData.applicableAreaList"
@change="val => handleAreaSelectChange(val)" />
</template>
<template #providerSelect>
<el-select v-model="searchForm.providerIds"
class="provider-filter-select"
placeholder="请选择供应商"
style="width: 100%"
clearable
collapse-tags
filterable
multiple
placeholder="请选择供应商"
style="width: 100%">
multiple>
<el-option v-for="item in baseData.providerList"
:key="item.id"
:label="item.providerName"
......@@ -63,8 +63,8 @@
</template>
<!-- 导出 -->
<auth-button category="Button"
:show-btn-ids="['9030702']"
style="display: inline-block" />
style="display: inline-block"
:show-btn-ids="['9030702']" />
</d2-table-header>
<d2-table ref="productManageTable"
:before-search-fn="beforeSearchFn"
......@@ -143,25 +143,25 @@
:drawer-update-visible="drawerUpdateVisible"
@handleUpdateClose="handleUpdateClose" />
<!-- 批量新增SPU/SKU -->
<d2-file-import-dialog :is-visible="importSPUOrSKUVisible"
template-name="模板下载"
<d2-file-import-dialog template-name="模板下载"
title="批量新增SPU/SKU"
:is-visible="importSPUOrSKUVisible"
@closeDialog="handleBatchCreateSPUOrSKU"
@confirmDialog="handleConfirmImportSPUOrSKU"
@downloadTemplate="exportTemplate('SPU')">
</d2-file-import-dialog>
<!-- 批量新增SKU -->
<d2-file-import-dialog :is-visible="importSKUVisible"
template-name="模板下载"
<d2-file-import-dialog template-name="模板下载"
title="批量新增SKU"
:is-visible="importSKUVisible"
@closeDialog="handleBatchCreateSKU"
@confirmDialog="handleConfirmImportSKU"
@downloadTemplate="exportTemplate('SKU')">
</d2-file-import-dialog>
<!-- 批量修改SKU -->
<d2-file-import-dialog :is-visible="importEditSKUVisible"
template-name="模板下载"
<d2-file-import-dialog template-name="模板下载"
title="批量编辑SKU"
:is-visible="importEditSKUVisible"
@closeDialog="handleBatchEditSKU"
@confirmDialog="handleConfirmEditSKU"
@downloadTemplate="exportTemplate('editSKU')">
......@@ -420,7 +420,7 @@ export default {
{
label: "运营系数",
prop: "listShowOperationCoefficient",
width: "90",
width: "110",
},
{
label: "运营成本/元",
......@@ -593,24 +593,27 @@ export default {
const needParentProp = !isSkuMode && base.parentPropColumns.includes(col.prop);
return needParentProp ? { ...col, parentProp: "goodsInfo" } : { ...col };
});
if (isSkuMode)
if (isSkuMode) {
return { ...base, mutiSelectName: "productIndex", tableColumns };
}
return { ...base, tableColumns };
},
},
filters: {
formatCar(list) {
if (!Array.isArray(list))
if (!Array.isArray(list)) {
return "-";
}
let str = list?.map((item) => {
return `${item.brandName}-${item.childName}-${item.seriesName}`;
}).join(",");
return str.length > 15 ? str.substring(0, 15) + "..." : str;
},
formatArea(list) {
if (!Array.isArray(list))
if (!Array.isArray(list)) {
return "-";
}
let str = list?.map((item) => {
return item.provinceName == "全国" ? "全国" : `${item.provinceName}-${item.cityName}`;
}).join(",");
......@@ -707,8 +710,9 @@ export default {
const deleteIdSet = new Set()
;(this.selectedList || []).forEach((item) => {
const id = getSkuId(item);
if (!id)
if (!id) {
return;
}
if (!listIdSet.has(id) && !selectedIdSet.has(id)) {
selectedData.push(item);
selectedIdSet.add(id);
......@@ -740,8 +744,9 @@ export default {
},
// 商品管理列表数据转换:N-父级+子级;Y-直接返回 SKU 平铺,均需处理规格、价格等展示数据
filterProductManageListData(listData) {
if (!listData || !Array.isArray(listData))
if (!listData || !Array.isArray(listData)) {
return listData;
}
const isSkuMode = this.searchForm.showSkuMode === "Y";
// 新 SPU 接口不返回 upgradeGoodsList,标记为 SPU 平铺模式
this.spuOnlyMode = !listData.some(item => item.upgradeGoodsList && item.upgradeGoodsList.length);
......@@ -753,8 +758,9 @@ export default {
});
}
listData.forEach((val) => {
if (!val.goodsInfo)
if (!val.goodsInfo) {
val.goodsInfo = {};
}
if (val.upgradeGoodsList && val.upgradeGoodsList.length) {
// N 模式:处理父级下的 upgradeGoodsList,子项字段统一从父级 val.goodsInfo 取
const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName } = val.goodsInfo || {};
......@@ -762,8 +768,9 @@ export default {
val.upgradeGoodsList.forEach((v) => {
v.goodsInfo = v.goodsInfo || {};
// SKU 子行需 baseGoodsId 用于编辑/查看跳转
if (!v.baseGoodsId && val.id)
if (!v.baseGoodsId && val.id) {
v.baseGoodsId = val.id;
}
v.listShowShopPrice = v.upgradePrice;
v.listShowSpecificationData = this._formatSpecificationData(v);
// 子项 goodsInfo 从父级 val.goodsInfo 取值
......@@ -818,9 +825,10 @@ export default {
// 从多个来源取第一个有效值
_pickFirst(fallback, ...sources) {
for (const v of sources) {
if (v != null && v !== "")
if (v != null && v !== "") {
return v;
}
}
return fallback;
},
// 配件性质:1-原厂件 2-品牌件
......@@ -874,19 +882,22 @@ export default {
if (typeArr.length) {
valueArr.forEach((sv, idx) => {
const suffix = suffixMapping[typeArr[idx]];
if (suffix)
if (suffix) {
valueArr[idx] = sv + suffix;
}
});
return valueArr.join("/");
}
if (item.specificationData && item.specificationData.includes(";~;"))
if (item.specificationData && item.specificationData.includes(";~;")) {
return item.specificationData.replace(/;~;/g, "/");
}
return "-";
},
// 处理单条 SKU 的规格、价格、goodsInfo 等展示字段
_processSkuItem(item, parent, types) {
if (!item.goodsInfo)
if (!item.goodsInfo) {
item.goodsInfo = {};
}
// SPU 单行模式可能无 upgradePrice,回退到 shopPrice
item.listShowShopPrice = item.upgradePrice != null ? item.upgradePrice : item.shopPrice != null ? item.shopPrice : item.goodsInfo && item.goodsInfo.shopPrice;
item.listShowSpecificationData = this._formatSpecificationData(item);
......@@ -944,13 +955,16 @@ export default {
},
setTableFinishFun(data) {
data?.forEach((v) => {
if (v.goodsInfo)
if (v.goodsInfo) {
v.goodsInfo.type = v.goodsInfo.sapCode || "";
}
});
this.$nextTick(() => {
if (this.clearMutiSelect) {
this.selectedList = [];
if (this.tableParams.mutiSelectName) this.clearMutiSelect = false;
if (this.tableParams.mutiSelectName) {
this.clearMutiSelect = false;
}
this.$refs.productManageTable.$refs[this.tableParams.mutiSelectName + "MutiTable"].clearSelection();
}
this.recoverySelection(data);
......@@ -960,18 +974,21 @@ export default {
if (this.selectedList.length) {
const tableParamsSnapshot = this.tableParams;
const tableRef = this.$refs?.productManageTable?.$refs && this.$refs.productManageTable.$refs[tableParamsSnapshot.mutiSelectName + "MutiTable"];
if (!tableRef || !Array.isArray(data) || !data.length)
if (!tableRef || !Array.isArray(data) || !data.length) {
return;
}
const dataMap = new Map();
data.forEach((item) => {
if (item && item.upgradeGoodsId)
if (item && item.upgradeGoodsId) {
dataMap.set(item.upgradeGoodsId, item);
}
});
this.selectedList.forEach((row) => {
const obj = dataMap.get(row && row.upgradeGoodsId);
if (obj)
if (obj) {
tableRef.toggleRowSelection(obj, true);
}
});
}
},
......@@ -1075,8 +1092,9 @@ export default {
// 批量修改SKU
handleBatchEditSKU() {
this.selectedList = this.getMutiDate();
if (this.selectedList?.length > 500)
if (this.selectedList?.length > 500) {
this.$message.warning("最多支持选择500条数据");
}
this.importEditSKUVisible = !this.importEditSKUVisible;
},
handleConfirmEditSKU({ fileName, fileData }) {
......
<!-- 适用门店选择弹窗 -->
<template>
<el-dialog custom-class="applicable-stores-dialog"
title="选择门店"
width="1200px"
:close-on-click-modal="false"
:visible.sync="dialogVisible"
@close="handleClose">
<div class="dialog-content">
<!-- 左侧:可选门店列表 -->
<div class="left-panel">
<!-- 搜索条件 -->
<div class="search-bar">
<el-input v-model="searchForm.merchantName"
placeholder="门店名称"
size="small"
clearable
@keyup.enter.native="handleSearch" />
<el-input v-model="searchForm.merchantId"
placeholder="门店商户号"
size="small"
clearable
@keyup.enter.native="handleSearch" />
<el-button size="small"
type="primary"
@click="handleSearch">
查询
</el-button>
<el-button size="small"
@click="handleReset">
重置
</el-button>
</div>
<!-- 门店列表表格 -->
<div v-loading="tableLoading" class="table-wrapper">
<el-table ref="selectingTable"
height="360"
border
:data="selectingData"
@select="handleChange"
@select-all="handleAll">
<el-table-column align="center"
type="selection"
width="55" />
<el-table-column align="center"
label="门店名称"
min-width="200">
<template #default="scope">
{{ scope.row.merchantName != null && scope.row.merchantName !== "" ? scope.row.merchantName : "-" }}
</template>
</el-table-column>
<el-table-column align="center"
label="门店商户号"
width="150">
<template #default="scope">
{{ scope.row.merchantId != null && scope.row.merchantId !== "" ? scope.row.merchantId : "-" }}
</template>
</el-table-column>
<el-table-column align="center"
label="门店地址"
min-width="200">
<template #default="scope">
{{ scope.row.merchantAddress != null && scope.row.merchantAddress !== "" ? scope.row.merchantAddress : "-" }}
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页 -->
<el-pagination layout="prev, pager, next"
background
small
:current-page.sync="currentPage"
:page-size="pageSize"
:total="total"
@current-change="handleCurrentChange" />
</div>
<!-- 右侧:已选结果 -->
<div class="right-panel">
<div class="selected-header">
<span class="selected-title">已选结果 ({{ selectedData.length }})</span>
<el-button size="small"
type="text"
:disabled="!selectedData.length"
@click="handleClearAll">
全部清空
</el-button>
</div>
<!-- 已选列表 -->
<div v-if="selectedData.length" class="selected-list">
<div v-for="item in selectedData"
:key="item.merchantId"
class="selected-item">
<div class="item-name">
{{ item.merchantName }}{{ item.merchantId }}
</div>
<i class="el-icon-delete" @click="handleDelete(item)"></i>
</div>
</div>
<!-- 空状态 -->
<div v-else class="empty-state">
<i class="el-icon-folder-opened"></i>
<p>暂无数据</p>
</div>
</div>
</div>
<!-- 底部按钮 -->
<template #footer>
<div class="dialog-footer">
<el-button size="small" @click="handleCancel">
取消
</el-button>
<el-button size="small"
type="primary"
@click="handleConfirm">
确定
</el-button>
</div>
</template>
</el-dialog>
</template>
<script>
import { getMerchantListByScene } from "@/api/contentManager";
export default {
name: "ApplicableStoresDialog",
props: {
visible: {
type: Boolean,
default: false,
},
selectedStores: {
type: Array,
default: () => [],
},
},
data() {
return {
searchForm: {
merchantName: "",
merchantId: "",
},
selectingData: [],
selectedData: [],
total: 0,
currentPage: 1,
pageSize: 10,
// 表格加载状态
tableLoading: false,
};
},
computed: {
dialogVisible: {
get() {
return this.visible;
},
set(val) {
this.$emit("update:visible", val);
},
},
},
watch: {
visible(val) {
if (val) {
this.selectedData = [...this.selectedStores];
this.currentPage = 1;
this.searchForm = { merchantName: "", merchantId: "" };
this.getSelectingList();
}
},
},
methods: {
// 获取可选门店列表
getSelectingList() {
const params = {
currentPage: this.currentPage,
pageSize: this.pageSize,
merchantName: this.searchForm.merchantName || undefined,
merchantId: this.searchForm.merchantId || undefined,
queryAbsoluteEnable: 1,
};
this.tableLoading = true;
getMerchantListByScene(params).then((res) => {
res?.list?.forEach((val) => {
val.merchantAddress = val.merchantAddress || "-";
});
const list = res.list || [];
this.selectingData = list;
this.total = res.total || 0;
this.$nextTick(() => {
this.recoverySelection();
});
}).finally(() => {
this.tableLoading = false;
});
},
// 恢复选中状态
recoverySelection() {
const exitIds = this.selectedData.map(item => item.merchantId);
this.selectingData.forEach((item) => {
if (exitIds.includes(item.merchantId)) {
this.$refs.selectingTable.toggleRowSelection(item, true);
}
});
},
// 搜索
handleSearch() {
this.currentPage = 1;
this.getSelectingList();
},
handleReset() {
this.currentPage = 1;
this.searchForm = {
merchantId: "",
merchantName: "",
};
this.getSelectingList();
},
// 分页切换
handleCurrentChange(val) {
this.currentPage = val;
this.getSelectingList();
},
// 单选
handleChange(selection, row) {
const isAdded = !!selection.find(item => item.merchantId === row.merchantId);
if (isAdded) {
if (!this.selectedData.find(item => item.merchantId === row.merchantId)) {
this.selectedData.push({ ...row });
}
} else {
this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId);
}
},
// 全选
handleAll(selection) {
this.selectingData.forEach((item) => {
const isExit = this.selectedData.findIndex(subItem => subItem.merchantId === item.merchantId);
if (selection.length && isExit === -1) {
this.selectedData.push({ ...item });
} else if (!selection.length && isExit !== -1) {
this.selectedData.splice(isExit, 1);
}
});
},
// 删除已选
handleDelete(row) {
this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId);
const obj = this.selectingData.find(v => String(v.merchantId) === String(row.merchantId));
if (obj) {
this.$refs.selectingTable.toggleRowSelection(obj, false);
}
},
// 全部清空
handleClearAll() {
this.selectedData = [];
this.$refs.selectingTable.clearSelection();
},
// 确定
handleConfirm() {
if (!this.selectedData.length)
return this.$message.warning("请选择适用门店");
this.$emit("confirm", this.selectedData);
},
// 取消
handleCancel() {
this.dialogVisible = false;
},
// 关闭
handleClose() {
this.$emit("close");
},
},
};
</script>
<style lang="scss" scoped>
.applicable-stores-dialog {
::v-deep .el-dialog__body {
padding: 20px;
}
}
.dialog-content {
display: flex;
gap: 20px;
height: 450px;
}
.left-panel {
flex: 1.5;
display: flex;
flex-direction: column;
.search-bar {
display: flex;
gap: 12px;
margin-bottom: 16px;
.el-input {
width: 240px;
}
}
.el-table {
flex: 1;
}
.table-wrapper {
flex: 1;
min-height: 0;
}
.el-pagination {
margin-top: 12px;
text-align: right;
}
}
.right-panel {
flex: 1;
display: flex;
flex-direction: column;
border-left: 1px solid #ebeef5;
padding-left: 20px;
height: 100%;
overflow: hidden;
.selected-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
flex-shrink: 0;
.selected-title {
font-size: 14px;
font-weight: 600;
color: #303133;
}
}
.selected-list {
flex: 1;
overflow-y: auto;
min-height: 0;
.selected-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 12px;
margin-bottom: 8px;
background: #f5f7fa;
border-radius: 4px;
font-size: 13px;
min-width: 0;
.item-name {
color: #303133;
flex: 1;
min-width: 0;
word-break: break-all;
line-height: 1.4;
padding-right: 8px;
}
.el-icon-delete {
flex-shrink: 0;
cursor: pointer;
color: #c0c4cc;
font-size: 14px;
&:hover {
color: #f56c6c;
}
}
}
}
.empty-state {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #c0c4cc;
i {
font-size: 48px;
margin-bottom: 12px;
}
p {
font-size: 13px;
margin: 0;
}
}
}
.dialog-footer {
text-align: right;
}
</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" 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="页面展示主图,建议尺寸 664x336px" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-thumb">
预览小图
<el-tooltip content="列表中展示的缩略图,建议尺寸 88x120px" 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="页面展示主图,建议尺寸 664x336px" placement="top">
<i class="el-icon-question header-tip"></i>
</el-tooltip>
</span>
<span class="th th-thumb">
预览小图
<el-tooltip content="列表中展示的缩略图,建议尺寸 88x120px" 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>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!