Commit 3bbeebfb by wangzhihui

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

…stem into feature/584/wzh
2 parents 1614a644 9cfe39f0
Showing 34 changed files with 1077 additions and 197 deletions
...@@ -201,7 +201,7 @@ async function main() { ...@@ -201,7 +201,7 @@ async function main() {
- [ ] 编写/补全 `src/api/adapters/{feature}/` adapters - [ ] 编写/补全 `src/api/adapters/{feature}/` adapters
- [ ] `src/api/*.js` 接入 request + adapter - [ ] `src/api/*.js` 接入 request + adapter
- [ ] Mock 数据对齐 Swagger 字段 - [ ] Mock 数据对齐 Swagger 字段
- [ ] `.env.development`:`VUE_APP_USE_DEVELOP_AXIOS=true`,确认未设置 feature mock 开关(或 `VUE_APP_*_MOCK` 非 `true`) - [ ] `.env.development`:默认不开启 `VUE_APP_USE_DEVELOP_AXIOS`(配置中心成功则用返回配置);确认未设置 feature mock 开关(或 `VUE_APP_*_MOCK` 非 `true`)
- [ ] `npm run rop:contract:check` 契约基线通过 - [ ] `npm run rop:contract:check` 契约基线通过
- [ ] `npm run api:smoke:journal`(或对应冒烟脚本)通过 - [ ] `npm run api:smoke:journal`(或对应冒烟脚本)通过
- [ ] 浏览器登录验证页面 - [ ] 浏览器登录验证页面
...@@ -254,7 +254,7 @@ async function main() { ...@@ -254,7 +254,7 @@ async function main() {
- [ ] adapter 单测通过(至少覆盖请求映射 + 行映射) - [ ] adapter 单测通过(至少覆盖请求映射 + 行映射)
- [ ] `npm run rop:contract:check` 通过 - [ ] `npm run rop:contract:check` 通过
- [ ] `npm run api:smoke:{feature}` 或 `npm run rop:verify` exit 0 - [ ] `npm run api:smoke:{feature}` 或 `npm run rop:verify` exit 0
- [ ] `.env.development` 已设 `VUE_APP_USE_DEVELOP_AXIOS=true`,未误开 feature mock(`VUE_APP_*_MOCK=true`) - [ ] `.env.development` 未误开 `VUE_APP_USE_DEVELOP_AXIOS=true`(除非个人本地需强制 dev 网关),未误开 feature mock(`VUE_APP_*_MOCK=true`)
- [ ] 浏览器页面可访问(需账号具备对应菜单权限) - [ ] 浏览器页面可访问(需账号具备对应菜单权限)
- [ ] 脚手架未误覆盖已有 adapter(默认 skip;必要时才用 `--force`) - [ ] 脚手架未误覆盖已有 adapter(默认 skip;必要时才用 `--force`)
......
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
VUE_APP_REPO=http://192.168.3.171:7300/mock/5be17454f31545347559d499/config VUE_APP_REPO=http://192.168.3.171:7300/mock/5be17454f31545347559d499/config
# 配置中心地址继承 .env 中的 VUE_APP_CONFIG_CENTER_URL(config-center-backend) # 配置中心地址继承 .env 中的 VUE_APP_CONFIG_CENTER_URL(config-center-backend)
# 配置中心不可用时,main.js 会回退到 src/common/baseConfig.develop.json # 配置中心成功时直接使用返回的环境配置(测试/正式);不可用时回退 baseConfig.develop.json
# 使用 develop 环境完整配置(含 axios.appkey/secret/baseURL) # 若需强制本地 dev 网关,在 .env.development.local 设 VUE_APP_USE_DEVELOP_AXIOS=true
VUE_APP_USE_DEVELOP_AXIOS=true
# 门店工作汇报:默认走真实 dailyReport 接口;本地需 Mock 时设 VUE_APP_JOURNAL_MOCK=true # 门店工作汇报:默认走真实 dailyReport 接口;本地需 Mock 时设 VUE_APP_JOURNAL_MOCK=true
/**
* 本地验证:洽谈明细 subform v2 格式归一化与回显
* 运行: node scripts/verify-journal-subform-echo.mjs
*/
const EMPTY_TEXT = "—";
function getSubformTemplate(field = {}) {
const children = field.children;
if (Array.isArray(children) && children.length) {
return Array.isArray(children[0]) ? children[0] : children;
}
if (Array.isArray(field.origin_children) && field.origin_children.length) {
return field.origin_children;
}
return [];
}
function extractSubformRowData(rowEntry, subformKey) {
if (!rowEntry || typeof rowEntry !== "object") {
return {};
}
if (subformKey && rowEntry[subformKey] && typeof rowEntry[subformKey] === "object") {
return rowEntry[subformKey];
}
return rowEntry;
}
function hasSubformRowData(value) {
if (!Array.isArray(value) || !value.length) {
return false;
}
return value.some((row) => Array.isArray(row) && row.length);
}
function normalizeSubformField(field = {}) {
if (field.type !== "subform") {
return field;
}
const template = getSubformTemplate(field);
let value = field.value;
if (!hasSubformRowData(value) && Array.isArray(field.childrenValue) && field.childrenValue.length) {
value = field.childrenValue.map((rowEntry) => {
const rowData = extractSubformRowData(rowEntry, field.key);
return template.map((col) => ({
...col,
value: rowData[col.key],
}));
});
}
return {
...field,
children: template.length ? [ template ] : field.children,
value,
};
}
function isLabelValueObject(raw) {
return raw != null && typeof raw === "object" && !Array.isArray(raw) && "text" in raw;
}
function formatCarBrandValue(raw) {
if (raw == null || raw === "") {
return EMPTY_TEXT;
}
if (typeof raw === "object") {
if (raw.displayText) {
return raw.displayText;
}
const parts = [
raw.vehicleBrandName,
raw.vehicleSubBrandName,
raw.vehicleSeriesName,
raw.vehicleShapeName,
].filter((part) => part != null && part !== "");
return parts.length ? parts.join(" / ") : EMPTY_TEXT;
}
return String(raw);
}
function resolveLabelValueRaw(raw, type) {
if (!isLabelValueObject(raw)) {
return raw;
}
if (raw.text != null && raw.text !== "") {
return raw.text;
}
if (type === "carBrandSelect" && raw.value != null) {
return formatCarBrandValue(raw.value);
}
if (raw.value != null && raw.value !== "") {
return raw.value;
}
return raw;
}
function formatEchoValue(field = {}) {
const { type } = field;
const raw = field.value;
if (raw == null || raw === "") {
return EMPTY_TEXT;
}
if (type === "select" || type === "radio") {
const displayRaw = resolveLabelValueRaw(raw, type);
if (displayRaw !== raw) {
return String(displayRaw);
}
return String(raw);
}
if (type === "carBrandSelect") {
const displayRaw = resolveLabelValueRaw(raw, type);
if (displayRaw !== raw) {
return String(displayRaw);
}
return formatCarBrandValue(raw);
}
if (type === "numberInput") {
const unit = field.unit ? String(field.unit) : "";
return `${raw}${unit}`;
}
return String(raw);
}
function buildSubformTable(field = {}) {
const template = getSubformTemplate(field);
const rowFieldsList = Array.isArray(field.value) ? field.value : [];
const rows = rowFieldsList.map((rowFields) => {
const row = {};
const cells = Array.isArray(rowFields) ? rowFields : [];
cells.forEach((cell) => {
if (cell?.key) {
row[cell.key] = formatEchoValue(cell);
}
});
return row;
});
return { columns: template, rows };
}
const subform = normalizeSubformField({
label: "洽谈明细 (轻改)",
key: "F3-4",
type: "subform",
origin_children: [
{ label: "洽谈日期", key: "F3-4-1", type: "date" },
{ label: "驻店人员", key: "F3-4-2", type: "select" },
{ label: "销售/交付/SA", key: "F3-4-4", type: "select" },
{ label: "车型配置", key: "F3-4-7", type: "carBrandSelect" },
{ label: "窗膜金额", key: "F3-4-13", type: "numberInput", unit: "元" },
],
childrenValue: [
{
"F3-4": {
"F3-4-1": "2026-07-20",
"F3-4-2": { text: "小王", value: "staff-id" },
"F3-4-4": { text: "7Na", value: "sa-id" },
"F3-4-7": {
text: "鸿蒙智行-AITO 问界-问界M7",
value: { vehicleBrandName: "鸿蒙智行" },
},
"F3-4-13": 1,
},
},
],
});
const table = buildSubformTable(subform);
const row = table.rows[0] || {};
const checks = [
[ "children columns", subform.children?.[0]?.length, 5 ],
[ "value rows", subform.value?.length, 1 ],
[ "F3-4-1", row["F3-4-1"], "2026-07-20" ],
[ "F3-4-2", row["F3-4-2"], "小王" ],
[ "F3-4-4", row["F3-4-4"], "7Na" ],
[ "F3-4-7", row["F3-4-7"], "鸿蒙智行-AITO 问界-问界M7" ],
[ "F3-4-13", row["F3-4-13"], "1元" ],
];
let failed = false;
checks.forEach(([ label, actual, expected ]) => {
const ok = actual === expected;
console.log(`${ok ? "OK" : "FAIL"} ${label}:`, actual);
if (!ok) {
failed = true;
}
});
process.exit(failed ? 1 : 0);
function tryParseJson(raw) {
if (typeof raw !== "string" || !raw.trim()) {
return null;
}
try {
return JSON.parse(raw);
} catch (error) {
return null;
}
}
/**
* 解析配置中心响应:支持 { code, data } 包装或直接返回配置体
* @param {*} response
* @returns {object|null}
*/
export function parseConfigCenterResponse(response) {
if (!response || typeof response !== "object") {
return null;
}
let payload = response;
if (response.code == "200" && response.data) {
payload = typeof response.data === "string"
? tryParseJson(response.data)
: response.data;
}
if (
payload
&& typeof payload === "object"
&& payload.axios?.baseURL
&& payload.axios?.appkey
) {
return payload;
}
return null;
}
export function mergeConfigTarget(target, source) {
if (!target || !source || typeof source !== "object") {
return target;
}
Object.keys(target).forEach((key) => {
delete target[key];
});
return Object.assign(target, source);
}
<template> <template>
<div class="map-box" :style="{ height: `${mapHeight}px` }"> <div class="map-box" :style="{ height: `${mapHeight}px` }">
<div id="mapContainer" style="width: 100%; height: 100%;z-index: 999999"></div> <div :id="mapContainerId" style="width: 100%; height: 100%;z-index: 999999"></div>
<el-input v-model="address" <!-- 使用原生 input 替代 el-input,避免触发 Element UI 的表单校验 -->
class="map-address-input" <div class="map-address-input-wrapper">
placeholder="请选择或输入地址" <input v-model="address"
size="small" class="map-address-native-input"
clearable /> placeholder="请选择或输入地址"
@blur.stop
@click.stop
@focus.stop />
</div>
<div id="myPageTop" style="position: absolute; top: 10px; width: 50%; left: 25%"> <div id="myPageTop" style="position: absolute; top: 10px; width: 50%; left: 25%">
<el-input id="input" <el-input id="input"
v-model="input" v-model="input"
...@@ -39,6 +43,8 @@ export default { ...@@ -39,6 +43,8 @@ export default {
lnglat: [], lnglat: [],
geocoderAddress: {}, geocoderAddress: {},
mapapi: null, mapapi: null,
// 动态容器 ID(避免多个弹窗容器 ID 冲突)
mapContainerId: `mapContainer_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
}; };
}, },
...@@ -94,7 +100,7 @@ export default { ...@@ -94,7 +100,7 @@ export default {
// 多次尝试获取地图容器(最多等待2秒) // 多次尝试获取地图容器(最多等待2秒)
let mapContainer = null; let mapContainer = null;
for (let i = 0; i < 20; i++) { for (let i = 0; i < 20; i++) {
mapContainer = document.getElementById("mapContainer"); mapContainer = document.getElementById(this.mapContainerId);
if (mapContainer) { if (mapContainer) {
break; break;
} }
...@@ -110,7 +116,7 @@ export default { ...@@ -110,7 +116,7 @@ export default {
let mapInstance = null; let mapInstance = null;
for (let i = 0; i < 3; i++) { for (let i = 0; i < 3; i++) {
try { try {
mapInstance = await mapapi.invoke("Map", "mapContainer"); mapInstance = await mapapi.invoke("Map", this.mapContainerId);
if (mapInstance) { if (mapInstance) {
map = mapInstance; map = mapInstance;
break; break;
...@@ -251,11 +257,31 @@ export default { ...@@ -251,11 +257,31 @@ export default {
right: 10px; right: 10px;
width: 280px; width: 280px;
} }
.map-address-input { .map-address-native-input {
position: absolute;
bottom: -40px;
left: 0;
right: 0;
width: 100%; width: 100%;
height: 32px;
padding: 0 15px;
font-size: 14px;
line-height: 32px;
color: #606266;
background-color: #fff;
background-image: none;
border: 1px solid #dcdfe6;
border-radius: 4px;
box-sizing: border-box;
outline: none;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
margin-top: 10px;
&::placeholder {
color: #c0c4cc;
}
&:hover {
border-color: #c0c4cc;
}
&:focus {
border-color: #409eff;
}
} }
</style> </style>
...@@ -4,6 +4,38 @@ const https = require("https"); ...@@ -4,6 +4,38 @@ const https = require("https");
const path = require("path"); const path = require("path");
const { getAxiosConfigKey } = require("./resolveApiName"); const { getAxiosConfigKey } = require("./resolveApiName");
function tryParseJson(raw) {
if (typeof raw !== "string" || !raw.trim()) {
return null;
}
try {
return JSON.parse(raw);
} catch (error) {
return null;
}
}
function parseConfigCenterResponse(response) {
if (!response || typeof response !== "object") {
return null;
}
let payload = response;
if (response.code == "200" && response.data) {
payload = typeof response.data === "string"
? tryParseJson(response.data)
: response.data;
}
if (
payload
&& typeof payload === "object"
&& payload.axios?.baseURL
&& payload.axios?.appkey
) {
return payload;
}
return null;
}
const DEFAULT_CONFIG_URL = process.env.VUE_APP_CONFIG_CENTER_URL const DEFAULT_CONFIG_URL = process.env.VUE_APP_CONFIG_CENTER_URL
|| "https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config"; || "https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config";
...@@ -64,7 +96,7 @@ async function loadAxiosConfig(options) { ...@@ -64,7 +96,7 @@ async function loadAxiosConfig(options) {
let baseConfig = null; let baseConfig = null;
try { try {
const response = await fetchJson(configUrl); const response = await fetchJson(configUrl);
baseConfig = response.code == "200" ? response.data : response; baseConfig = parseConfigCenterResponse(response);
} catch (error) { } catch (error) {
// 回退 develop 本地配置 // 回退 develop 本地配置
} }
......
...@@ -9,6 +9,10 @@ import VueLazyload from "vue-lazyload"; ...@@ -9,6 +9,10 @@ import VueLazyload from "vue-lazyload";
import { config } from "@/common/baseConfig"; import { config } from "@/common/baseConfig";
import developConfig from "@/common/baseConfig.develop.json"; import developConfig from "@/common/baseConfig.develop.json";
import {
mergeConfigTarget,
parseConfigCenterResponse,
} from "@/common/parseConfigCenterResponse";
import { installVueMapApi } from "@/common/installVueMapApi"; import { installVueMapApi } from "@/common/installVueMapApi";
import notice from "@/common/notice"; import notice from "@/common/notice";
import util from "@/libs/util.js"; import util from "@/libs/util.js";
...@@ -115,6 +119,7 @@ Vue.directive("preventReClick", { ...@@ -115,6 +119,7 @@ Vue.directive("preventReClick", {
}, },
}); });
let baseConfig = config; let baseConfig = config;
let configCenterLoaded = false;
// 如果要改地址, 优先去 .env.development 中配置 // 如果要改地址, 优先去 .env.development 中配置
// 如果要创建自己的配置 可以 创建.env.development.local 文件. 该文件已被 git忽略, 不会上传, 优先级比.env.development更高, 满足本地开发的需求. // 如果要创建自己的配置 可以 创建.env.development.local 文件. 该文件已被 git忽略, 不会上传, 优先级比.env.development更高, 满足本地开发的需求.
...@@ -148,15 +153,20 @@ fetch(configCenterUrl) ...@@ -148,15 +153,20 @@ fetch(configCenterUrl)
}, },
) )
.then((response) => { .then((response) => {
const { code, data } = response; console.log("response", response?.code, response);
console.log("response", code, response); const parsed = parseConfigCenterResponse(response);
if (code == "200") { if (parsed) {
console.log(data); configCenterLoaded = true;
baseConfig = data; mergeConfigTarget(baseConfig, parsed);
// console.log("baseConfig", baseConfig) console.log("config center loaded", baseConfig.env, baseConfig.axios?.baseURL);
// window.$fetchConfig = data
} else { } else {
baseConfig = response; const { code } = response || {};
if (code == "200") {
console.log(response?.data);
}
if (response && typeof response === "object") {
mergeConfigTarget(baseConfig, response);
}
window.$fetchConfig = response; window.$fetchConfig = response;
console.log(response); console.log(response);
window.$gscApi = new Request({ window.$gscApi = new Request({
...@@ -186,11 +196,10 @@ fetch(configCenterUrl) ...@@ -186,11 +196,10 @@ fetch(configCenterUrl)
init(); init();
}); });
function applyDevelopAxiosConfig() { function applyDevelopAxiosConfig() {
if ( if (configCenterLoaded && process.env.VUE_APP_USE_DEVELOP_AXIOS !== "true") {
process.env.NODE_ENV === "development" return;
&& process.env.VUE_APP_USE_DEVELOP_AXIOS === "true" }
&& developConfig?.axios if (process.env.NODE_ENV === "development" && developConfig?.axios) {
) {
baseConfig.axios = { baseConfig.axios = {
...baseConfig.axios, ...baseConfig.axios,
...developConfig.axios, ...developConfig.axios,
...@@ -198,6 +207,7 @@ function applyDevelopAxiosConfig() { ...@@ -198,6 +207,7 @@ function applyDevelopAxiosConfig() {
if (developConfig.env) { if (developConfig.env) {
baseConfig.env = developConfig.env; baseConfig.env = developConfig.env;
} }
console.log("develop axios fallback", baseConfig.env, baseConfig.axios?.baseURL);
} }
} }
......
...@@ -243,13 +243,13 @@ export default { ...@@ -243,13 +243,13 @@ export default {
this.selectedTagLevel = 1; this.selectedTagLevel = 1;
this.tagForm = { this.tagForm = {
key: "", key: "",
parentKey: "", parentKey: "all",
id: "", id: "",
level: 1, level: 1,
levelName: this.getTagLevelText(1), levelName: this.getTagLevelText(1),
name: "", name: "",
financialReportCaliber: "", financialReportCaliber: "",
isNew: false, isNew: true,
}; };
}, },
handleClose() { handleClose() {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<el-input v-model.trim="searchForm.matchPackageCode" <el-input v-model.trim="searchForm.matchPackageCode"
placeholder="请输入套餐ID" placeholder="请输入套餐ID"
:clearable="true" :clearable="true"
:maxlength="20" :maxlength="30"
:style="{ width: '100%' }" :style="{ width: '100%' }"
@input="matchPackageCodeInput" /> @input="matchPackageCodeInput" />
</template> </template>
...@@ -174,7 +174,7 @@ import { getSearchFormSchema, getTableColumnsSchema } from "./index.data.js"; ...@@ -174,7 +174,7 @@ import { getSearchFormSchema, getTableColumnsSchema } from "./index.data.js";
export default { export default {
// 需与路由 name 一致,d2admin keep-alive include 按路由名匹配 // 需与路由 name 一致,d2admin keep-alive include 按路由名匹配
name: "packageManage", name: "PackageManage",
components: { components: {
// ApplicableAreaSelect, // ApplicableAreaSelect,
BatchModifyPackageInventoryDialog, BatchModifyPackageInventoryDialog,
......
...@@ -273,7 +273,9 @@ export default { ...@@ -273,7 +273,9 @@ export default {
try { try {
await this.validate(step.name); await this.validate(step.name);
} catch (err) { } catch (err) {
console.log("校验失败", err); if (!next) {
throw new Error("校验失败");
}
} }
await this.submitStep(step.name); await this.submitStep(step.name);
if (next) { if (next) {
......
...@@ -33,10 +33,12 @@ ...@@ -33,10 +33,12 @@
</div> </div>
</div> </div>
<div ref="tableWrapperRef" class="table-wrapper"> <div ref="tableWrapperRef" class="table-wrapper">
<!-- table-wrapper -> paddingTop 20 滚动条10 -->
<!-- 所以要剪掉20 -->
<el-table ref="tableRef" <el-table ref="tableRef"
border border
:data="table.data" :data="table.data"
:height="table.height - 10"> :height="table.height - 20">
<el-table-column align="center" <el-table-column align="center"
label="序号" label="序号"
type="index" type="index"
...@@ -424,8 +426,7 @@ export default { ...@@ -424,8 +426,7 @@ export default {
} }
} }
> .table-wrapper { > .table-wrapper {
flex: 1; flex: 1 0 0;
flex-shrink: 0;
background-color: #fff; background-color: #fff;
padding: 20px 20px 0; padding: 20px 20px 0;
overflow: hidden; overflow: hidden;
...@@ -468,6 +469,7 @@ export default { ...@@ -468,6 +469,7 @@ export default {
flex-shrink: 0; flex-shrink: 0;
background-color: #fff; background-color: #fff;
margin-top: 20px; margin-top: 20px;
box-sizing: border-box;
padding: 0 20px 20px; padding: 0 20px 20px;
} }
} }
......
...@@ -22,17 +22,17 @@ ...@@ -22,17 +22,17 @@
<span class="label"> <span class="label">
{{ row.productName }} {{ row.productName }}
</span> </span>
<!-- 5.8.4 不允许删除 --> <!-- 5.8.4 特殊上架 取消删除 , 常规上架保留 -->
<!-- <span v-if="useEdit && isView(editState)" <span v-if="useEdit && isView(editState) && shelfModel === 2"
class="actions el-icon-close" class="actions el-icon-close"
@click.stop="handleRemoveTitleSelectItem(row)"> @click.stop="handleRemoveTitleSelectItem(row)">
</span> --> </span>
</div> </div>
</template> </template>
</RemoteSelect> </RemoteSelect>
</div> </div>
<!-- 5.8.4 取消新增功能 --> <!-- 5.8.4 特殊上架 取消新增功能 , 常规上架保留 -->
<!-- <div v-if="useEdit && isView(editState)" class="actions-wrapper"> <div v-if="useEdit && isView(editState) && shelfModel === 2" class="actions-wrapper">
<el-dropdown @command="handleAppendProductPackages"> <el-dropdown @command="handleAppendProductPackages">
<el-button size="small" plain> <el-button size="small" plain>
新增 新增
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
</div> --> </div>
</div> </div>
<div class="content-wrapper"> <div class="content-wrapper">
...@@ -146,6 +146,10 @@ export default { ...@@ -146,6 +146,10 @@ export default {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
shelfModel: {
type: Number,
default: 1,
},
businessCode: { businessCode: {
type: String, type: String,
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
:file-list="form.fileList" :file-list="form.fileList"
:limit="1" :limit="1"
:on-change="handleGoodsCreateExcelChange" :on-change="handleGoodsCreateExcelChange"
:on-exceed="handleExceed"> :on-exceed="handleExceed"
:on-remove="handleGoodsCreateExcelRemove">
<template #trigger> <template #trigger>
<el-button size="small"> <el-button size="small">
+ 添加附件 + 添加附件
...@@ -68,7 +69,13 @@ export default { ...@@ -68,7 +69,13 @@ export default {
merchantId: [{ required: true, message: "请选择流量方信息", trigger: "change" }], merchantId: [{ required: true, message: "请选择流量方信息", trigger: "change" }],
goodsCreateExcel: [{ required: true, message: "请上传商品上架表", trigger: "change" }], goodsCreateExcel: [{ required: true, message: "请上传商品上架表", trigger: "change" }],
}, },
data: { }, data: {
baseSceneCode: undefined,
shelfType: 1,
goodsCreateExcel: null,
merchantId: undefined,
},
// 临时用 // 临时用
fileList: [], fileList: [],
}, },
...@@ -109,6 +116,12 @@ export default { ...@@ -109,6 +116,12 @@ export default {
this.form.fileList = [file]; this.form.fileList = [file];
this.form.data.goodsCreateExcel = file; this.form.data.goodsCreateExcel = file;
}, },
handleGoodsCreateExcelRemove() {
console.log("删除?");
this.form.data.goodsCreateExcel = null;
this.form.fileList = [];
console.log("删除?", this.form.data.goodsCreateExcel);
},
handleGoodsCreateExcelChange(_file, fileList) { handleGoodsCreateExcelChange(_file, fileList) {
if (_file.status === "ready" && _file.size / 1024 / 1024 > 20) { if (_file.status === "ready" && _file.size / 1024 / 1024 > 20) {
this.$message.error("上传文件大小不能超过 20MB!"); this.$message.error("上传文件大小不能超过 20MB!");
...@@ -119,6 +132,10 @@ export default { ...@@ -119,6 +132,10 @@ export default {
if (file) { if (file) {
this.form.fileList = [file]; this.form.fileList = [file];
this.form.data.goodsCreateExcel = file.raw; this.form.data.goodsCreateExcel = file.raw;
const formRef = this?.$refs?.formRef?.$refs?.formRef;
if (formRef) {
formRef.validateField("goodsCreateExcel");
}
} else { } else {
this.form.fileList = []; this.form.fileList = [];
this.form.data.goodsCreateExcel = null; this.form.data.goodsCreateExcel = null;
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
<ShelfProductConfirm :base-scene-code="baseSceneCode" <ShelfProductConfirm :base-scene-code="baseSceneCode"
:business-code="businessCode" :business-code="businessCode"
:merchant-id="merchantId" :merchant-id="merchantId"
:shelf-model="shelfModel"
:shelf-type="shelfType" /> :shelf-type="shelfType" />
</FormStep> </FormStep>
<FormStep v-loading="data.isStepLoading" <FormStep v-loading="data.isStepLoading"
...@@ -144,6 +145,8 @@ export default { ...@@ -144,6 +145,8 @@ export default {
data() { data() {
return { return {
sceneTypeOptions, sceneTypeOptions,
// 常规上架
shelfModel,
step: { step: {
confirmStep: 0, confirmStep: 0,
}, },
......
...@@ -78,7 +78,7 @@ export const TABLE_COLUMNS_MAP = { ...@@ -78,7 +78,7 @@ export const TABLE_COLUMNS_MAP = {
staffDaily: [ staffDaily: [
{ label: "驻店人员", prop: "staffName", minWidth: "100px", showOverFlow: true }, { label: "驻店人员", prop: "staffName", minWidth: "100px", showOverFlow: true },
bizTypeColumn, bizTypeColumn,
{ label: "所属门店", prop: "merchantName", minWidth: "160px", showOverFlow: true, align: "left" }, { label: "所属门店", prop: "merchantName", minWidth: "160px", showOverFlow: true, align: "center" },
createEmptyTextColumn("今日出勤", "attendanceStatus", { width: "100px" }), createEmptyTextColumn("今日出勤", "attendanceStatus", { width: "100px" }),
createDateTimeColumn("最近保存时间", "lastSaveTime"), createDateTimeColumn("最近保存时间", "lastSaveTime"),
], ],
...@@ -88,7 +88,7 @@ export const TABLE_COLUMNS_MAP = { ...@@ -88,7 +88,7 @@ export const TABLE_COLUMNS_MAP = {
prop: "merchantName", prop: "merchantName",
minWidth: "160px", minWidth: "160px",
showOverFlow: true, showOverFlow: true,
align: "left", align: "center",
}, },
bizTypeColumn, bizTypeColumn,
{ {
...@@ -108,7 +108,7 @@ export const TABLE_COLUMNS_MAP = { ...@@ -108,7 +108,7 @@ export const TABLE_COLUMNS_MAP = {
negotiation: [ negotiation: [
{ label: "驻店人员", prop: "staffName", minWidth: "100px", showOverFlow: true }, { label: "驻店人员", prop: "staffName", minWidth: "100px", showOverFlow: true },
bizTypeColumn, bizTypeColumn,
{ label: "所属门店", prop: "merchantName", minWidth: "160px", showOverFlow: true, align: "left" }, { label: "所属门店", prop: "merchantName", minWidth: "160px", showOverFlow: true, align: "center" },
createDateTimeColumn("最近保存时间", "lastSaveTime"), createDateTimeColumn("最近保存时间", "lastSaveTime"),
], ],
}; };
......
...@@ -158,4 +158,73 @@ export function buildJournalDetailJsonContent() { ...@@ -158,4 +158,73 @@ export function buildJournalDetailJsonContent() {
return JSON.stringify(JOURNAL_DETAIL_ECHO_FORM_LIST); return JSON.stringify(JOURNAL_DETAIL_ECHO_FORM_LIST);
} }
const negotiationOriginChildren = [
{ label: "洽谈日期", sortNum: "60", key: "F3-4-1", type: "date", required: true },
{ label: "驻店人员", sortNum: "61", key: "F3-4-2", type: "select", required: true, options: [], optionsKey: "storeStaffList" },
{ label: "部门", sortNum: "62", key: "F3-4-3", type: "select", required: true, options: [ { label: "交付部", value: "交付部" } ] },
{ label: "销售/交付/SA", sortNum: "63", key: "F3-4-4", type: "select", required: true, options: [], optionsKey: "4sStaffList" },
{ label: "客户名称", sortNum: "64", key: "F3-4-5", type: "input", required: true },
{ label: "客户手机号", sortNum: "65", key: "F3-4-6", type: "phoneInput", required: true },
{ label: "车型配置", sortNum: "66", key: "F3-4-7", type: "carBrandSelect", required: true },
{ label: "车架号", sortNum: "67", key: "F3-4-8", type: "input", required: true },
{ label: "销售赠送", sortNum: "68", key: "F3-4-9", type: "numberInput", required: true },
{ label: "客户来源", sortNum: "69", key: "F3-4-10", type: "radio", required: true, options: [ { label: "商超", value: "商超" } ] },
{ label: "是否有效", sortNum: "70", key: "F3-4-11", type: "radio", required: true, options: [ { label: "是", value: "是" } ] },
{ label: "是否升级", sortNum: "71", key: "F3-4-12", type: "radio", required: true, options: [ { label: "是", value: "是" } ] },
{ label: "窗膜金额", sortNum: "72", key: "F3-4-13", type: "numberInput", required: true, unit: "元" },
{ label: "车衣金额", sortNum: "73", key: "F3-4-14", type: "numberInput", required: true, unit: "元" },
{ label: "精品金额", sortNum: "74", key: "F3-4-15", type: "numberInput", required: true, unit: "元" },
{ label: "升级金额", sortNum: "75", key: "F3-4-16", type: "numberInput", required: true, unit: "元" },
{ label: "备注", sortNum: "76", key: "F3-4-17", type: "textarea", required: false },
];
export const NEGOTIATION_SUBFORM_V2_FORM_LIST = [
{
label: "洽谈明细 (轻改)",
sortNum: "59",
key: "F3-4",
type: "subform",
origin_children: negotiationOriginChildren,
childrenValue: [
{
"F3-4": {
"F3-4-1": "2026-07-20",
"F3-4-2": { text: "小王", value: "0a522331c33744a881313e746cc688b1" },
"F3-4-3": "交付部",
"F3-4-4": { text: "7Na", value: "c8335e0f0da84021999edac6254a3dc1" },
"F3-4-5": "1",
"F3-4-6": "15817666666",
"F3-4-7": {
text: "鸿蒙智行-AITO 问界-问界M7-2026款 纯电 Ultra四驱版 5座",
value: {
vehicleBrandId: 2978,
vehicleBrandName: "鸿蒙智行",
vehicleSubBrandId: 3454,
vehicleSubBrandName: "AITO 问界",
vehicleSeriesId: 1149147,
vehicleSeriesName: "问界M7",
vehicleShapeId: 452204,
vehicleShapeName: "2026款 纯电 Ultra四驱版 5座",
},
},
"F3-4-8": "666666666666666666",
"F3-4-9": 222,
"F3-4-10": "商超",
"F3-4-11": "是",
"F3-4-12": "是",
"F3-4-13": 1,
"F3-4-14": 2,
"F3-4-15": 3,
"F3-4-16": 4,
"F3-4-17": "444",
},
},
],
},
];
export function buildNegotiationDetailJsonContent() {
return JSON.stringify(NEGOTIATION_SUBFORM_V2_FORM_LIST);
}
export default JOURNAL_DETAIL_ECHO_FORM_LIST; export default JOURNAL_DETAIL_ECHO_FORM_LIST;
...@@ -44,6 +44,60 @@ function mergeSchemaWithFieldDataList(schemaList = [], fieldDataList = []) { ...@@ -44,6 +44,60 @@ function mergeSchemaWithFieldDataList(schemaList = [], fieldDataList = []) {
})); }));
} }
function getSubformTemplate(field = {}) {
const children = field.children;
if (Array.isArray(children) && children.length) {
return Array.isArray(children[0]) ? children[0] : children;
}
if (Array.isArray(field.origin_children) && field.origin_children.length) {
return field.origin_children;
}
return [];
}
function extractSubformRowData(rowEntry, subformKey) {
if (!rowEntry || typeof rowEntry !== "object") {
return {};
}
if (subformKey && rowEntry[subformKey] && typeof rowEntry[subformKey] === "object") {
return rowEntry[subformKey];
}
return rowEntry;
}
function hasSubformRowData(value) {
if (!Array.isArray(value) || !value.length) {
return false;
}
return value.some((row) => Array.isArray(row) && row.length);
}
function normalizeSubformField(field = {}) {
if (field.type !== "subform") {
return field;
}
const template = getSubformTemplate(field);
let value = field.value;
if (!hasSubformRowData(value) && Array.isArray(field.childrenValue) && field.childrenValue.length) {
value = field.childrenValue.map((rowEntry) => {
const rowData = extractSubformRowData(rowEntry, field.key);
return template.map((col) => ({
...col,
value: rowData[col.key],
}));
});
}
return {
...field,
children: template.length ? [ template ] : field.children,
value,
};
}
function normalizeFormList(formList = []) {
return formList.map((field) => normalizeSubformField(field));
}
/** /**
* 解析详情为 formList:jsonContent 优先,兜底 schema + fieldDataList * 解析详情为 formList:jsonContent 优先,兜底 schema + fieldDataList
*/ */
...@@ -52,7 +106,7 @@ export function parseFormList(detail = {}) { ...@@ -52,7 +106,7 @@ export function parseFormList(detail = {}) {
if (!formList.length && detail.schema?.list?.length) { if (!formList.length && detail.schema?.list?.length) {
formList = mergeSchemaWithFieldDataList(detail.schema.list, detail.fieldDataList || []); formList = mergeSchemaWithFieldDataList(detail.schema.list, detail.fieldDataList || []);
} }
return sortBySortNum(formList); return sortBySortNum(normalizeFormList(formList));
} }
function findOptionLabel(options = [], value) { function findOptionLabel(options = [], value) {
...@@ -82,6 +136,26 @@ function formatCarBrandValue(raw) { ...@@ -82,6 +136,26 @@ function formatCarBrandValue(raw) {
return String(raw); return String(raw);
} }
function isLabelValueObject(raw) {
return raw != null && typeof raw === "object" && !Array.isArray(raw) && "text" in raw;
}
function resolveLabelValueRaw(raw, type) {
if (!isLabelValueObject(raw)) {
return raw;
}
if (raw.text != null && raw.text !== "") {
return raw.text;
}
if (type === "carBrandSelect" && raw.value != null) {
return formatCarBrandValue(raw.value);
}
if (raw.value != null && raw.value !== "") {
return raw.value;
}
return raw;
}
/** /**
* 字段值格式化为只读展示文案 * 字段值格式化为只读展示文案
*/ */
...@@ -94,15 +168,31 @@ export function formatEchoValue(field = {}) { ...@@ -94,15 +168,31 @@ export function formatEchoValue(field = {}) {
switch (type) { switch (type) {
case "radio": case "radio":
case "select": case "select": {
const displayRaw = resolveLabelValueRaw(raw, type);
if (displayRaw !== raw) {
return String(displayRaw);
}
return findOptionLabel(options, raw) || String(raw); return findOptionLabel(options, raw) || String(raw);
}
case "multipleSelect": { case "multipleSelect": {
const list = Array.isArray(raw) ? raw : [raw]; const list = Array.isArray(raw) ? raw : [ raw ];
const labels = list.map((item) => findOptionLabel(options, item) || String(item)).filter(Boolean); const labels = list.map((item) => {
const displayItem = resolveLabelValueRaw(item, "select");
if (displayItem !== item) {
return String(displayItem);
}
return findOptionLabel(options, item) || String(item);
}).filter(Boolean);
return labels.length ? labels.join(",") : EMPTY_TEXT; return labels.length ? labels.join(",") : EMPTY_TEXT;
} }
case "carBrandSelect": case "carBrandSelect": {
const displayRaw = resolveLabelValueRaw(raw, type);
if (displayRaw !== raw) {
return String(displayRaw);
}
return formatCarBrandValue(raw); return formatCarBrandValue(raw);
}
case "numberInput": { case "numberInput": {
const unit = field.unit ? String(field.unit) : ""; const unit = field.unit ? String(field.unit) : "";
return `${raw}${unit}`; return `${raw}${unit}`;
...@@ -189,7 +279,7 @@ export function buildEchoBlocks(formList = []) { ...@@ -189,7 +279,7 @@ export function buildEchoBlocks(formList = []) {
* 子表单 → el-table 列与行(children[0] 为列模板,value 为行数据) * 子表单 → el-table 列与行(children[0] 为列模板,value 为行数据)
*/ */
export function buildSubformTable(field = {}) { export function buildSubformTable(field = {}) {
const template = Array.isArray(field.children?.[0]) ? field.children[0] : []; const template = getSubformTemplate(field);
const rowFieldsList = Array.isArray(field.value) ? field.value : []; const rowFieldsList = Array.isArray(field.value) ? field.value : [];
const columns = template.map((col) => ({ const columns = template.map((col) => ({
......
...@@ -16,8 +16,11 @@ export function getStaticGroupChildren(field = {}) { ...@@ -16,8 +16,11 @@ export function getStaticGroupChildren(field = {}) {
export function getSubformRowTemplate(field = {}) { export function getSubformRowTemplate(field = {}) {
const children = field.children; const children = field.children;
if (!Array.isArray(children) || !children.length) { if (Array.isArray(children) && children.length) {
return []; return Array.isArray(children[0]) ? children[0] : children;
} }
return Array.isArray(children[0]) ? children[0] : children; if (Array.isArray(field.origin_children) && field.origin_children.length) {
return field.origin_children;
}
return [];
} }
...@@ -46,10 +46,14 @@ ...@@ -46,10 +46,14 @@
</el-select> </el-select>
<el-select v-else <el-select v-else
v-model="addForm.potentialStoreId" v-model="addForm.potentialStoreId"
v-el-select-loadmore="interestsLoadmore"
placeholder="请选择门店名称" placeholder="请选择门店名称"
style="width: 530px;" style="width: 530px;"
filterable filterable
@change="handlePotentialStoreSelectChange"> remote
:remote-method="remoteMethod"
@change="handlePotentialStoreSelectChange"
@visible-change="visibleChange">
<el-option v-for="item in baseData.potentialCustomerStoreList" <el-option v-for="item in baseData.potentialCustomerStoreList"
:key="item.id" :key="item.id"
:label="item.storeName" :label="item.storeName"
...@@ -340,7 +344,10 @@ export default { ...@@ -340,7 +344,10 @@ export default {
brandList: [], brandList: [],
}, },
queryMerchantName: "", queryMerchantName: "",
queryPotentialStoreName: "",
currentPage: 1, currentPage: 1,
potentialCustomerCurrentPage: 1,
potentialCustomerAllPages: 0,
pageSize: 20, pageSize: 20,
}; };
}, },
...@@ -432,35 +439,50 @@ export default { ...@@ -432,35 +439,50 @@ export default {
this.addForm.merchantName = item ? item.storeName : ""; this.addForm.merchantName = item ? item.storeName : "";
this.$refs.editFormRef && this.$refs.editFormRef.$refs[this.editChildRef].validateField("merchantId"); this.$refs.editFormRef && this.$refs.editFormRef.$refs[this.editChildRef].validateField("merchantId");
}, },
// 4S门店数据 visibleChange() {
visibleChange(data) { if (this.addForm.bySystemMerchant) {
// 获取焦点重新渲染下拉框数据 this.queryPotentialStoreName = "";
// if (data) { this.potentialCustomerCurrentPage = 1;
// if (this.queryMerchantName) { this.baseData.potentialCustomerStoreList = [];
this.queryMerchantName = ""; this.getPotentialCustomersList();
this.currentPage = 1; } else {
this.baseData.merchantList = []; this.queryMerchantName = "";
this.getSelectingList(); this.currentPage = 1;
// } this.baseData.merchantList = [];
// } this.getSelectingList();
}
}, },
// 获取商品数据
remoteMethod(query) { remoteMethod(query) {
this.queryMerchantName = query; if (this.addForm.bySystemMerchant) {
// console.log("query", query); this.queryPotentialStoreName = query;
this.currentPage = 1; this.potentialCustomerCurrentPage = 1;
this.baseData.merchantList = []; this.baseData.potentialCustomerStoreList = [];
this.getSelectingList(); // 请求接口 this.getPotentialCustomersList();
} else {
this.queryMerchantName = query;
this.currentPage = 1;
this.baseData.merchantList = [];
this.getSelectingList();
}
}, },
// 获取更多4S店 // 获取更多门店(4S / 潜客)
interestsLoadmore() { interestsLoadmore() {
setTimeout(() => { setTimeout(() => {
this.currentPage = this.currentPage + 1; if (this.addForm.bySystemMerchant) {
if (this.allPages < this.currentPage) { this.potentialCustomerCurrentPage = this.potentialCustomerCurrentPage + 1;
this.currentPage = this.allPages; if (this.potentialCustomerAllPages < this.potentialCustomerCurrentPage) {
return; this.potentialCustomerCurrentPage = this.potentialCustomerAllPages;
return;
}
this.getPotentialCustomersList();
} else {
this.currentPage = this.currentPage + 1;
if (this.allPages < this.currentPage) {
this.currentPage = this.allPages;
return;
}
this.getSelectingList();
} }
this.getSelectingList();
}, 10); }, 10);
}, },
// 获取4S门店列表 // 获取4S门店列表
...@@ -481,19 +503,34 @@ export default { ...@@ -481,19 +503,34 @@ export default {
}, },
getPotentialCustomersList() { getPotentialCustomersList() {
getPotentialCustomersList({ getPotentialCustomersList({
currentPage: this.currentPage, currentPage: this.potentialCustomerCurrentPage,
pageSize: this.pageSize, pageSize: this.pageSize,
storeName: this.queryPotentialStoreName,
}).then((res) => { }).then((res) => {
console.log("getPotentialCustomersList潜客列表", res); this.potentialCustomerAllPages = res.pages;
this.baseData.potentialCustomerStoreList = res.list; const resArr = [...(res.list || [])];
this.baseData.potentialCustomerStoreList = this.baseData.potentialCustomerStoreList.concat(resArr);
}).catch(() => { }).catch(() => {
this.baseData.potentialCustomerStoreList = []; if (this.potentialCustomerCurrentPage === 1) {
this.baseData.potentialCustomerStoreList = [];
}
}); });
}, },
handleIsNewMerchantChange(val) { handleIsNewMerchantChange(val) {
this.addForm.merchantId = ""; this.addForm.merchantId = "";
this.addForm.merchantName = ""; this.addForm.merchantName = "";
this.addForm.potentialCustomerId = ""; this.addForm.potentialStoreId = "";
if (val) {
this.queryPotentialStoreName = "";
this.potentialCustomerCurrentPage = 1;
this.baseData.potentialCustomerStoreList = [];
this.getPotentialCustomersList();
} else {
this.queryMerchantName = "";
this.currentPage = 1;
this.baseData.merchantList = [];
this.getSelectingList();
}
this.$refs[this.editChildRef] && this.$refs[this.editChildRef].$refs.form.clearValidate(); this.$refs[this.editChildRef] && this.$refs[this.editChildRef].$refs.form.clearValidate();
}, },
handleSelectProvince(val) { handleSelectProvince(val) {
......
...@@ -188,7 +188,8 @@ export default { ...@@ -188,7 +188,8 @@ export default {
trialTime: data.trialTime, //试岗时间 trialTime: data.trialTime, //试岗时间
resumeFileName: data.resumeFileName, resumeFileName: data.resumeFileName,
channelType: data.channelType, //招聘渠道 channelType: data.channelType, //招聘渠道
channelName: data.channelName channelName: data.channelName,
referrer: data.referrer || data.referrerName || ""
} }
this.$refs.trialOnboard?.handleAdd(params) this.$refs.trialOnboard?.handleAdd(params)
}, },
......
...@@ -153,6 +153,7 @@ export default { ...@@ -153,6 +153,7 @@ export default {
type: 'select', type: 'select',
}, },
], ],
/**targetType : 1(6),2(9),3(4) */
fourFormTwoObj: [ fourFormTwoObj: [
{ {
name: '对账品类', name: '对账品类',
......
...@@ -207,6 +207,7 @@ export default { ...@@ -207,6 +207,7 @@ export default {
}, },
] ]
}, },
/**targetType : 1(6),2(9),3(4) */
{ {
name: '流量费', name: '流量费',
key: 'trafficPartyProfitCalculationMode', key: 'trafficPartyProfitCalculationMode',
...@@ -214,7 +215,7 @@ export default { ...@@ -214,7 +215,7 @@ export default {
inputKey: 'trafficPartyRatio', inputKey: 'trafficPartyRatio',
type: 'radio', type: 'radio',
options: RADIO_OPTIONS, options: RADIO_OPTIONS,
targetType: 3 targetType: 1
}, },
{ {
name: '服务商分润', name: '服务商分润',
...@@ -241,7 +242,7 @@ export default { ...@@ -241,7 +242,7 @@ export default {
inputKey: 'otherFeeRatio', inputKey: 'otherFeeRatio',
type: 'radio', type: 'radio',
options: RADIO_OPTIONS, options: RADIO_OPTIONS,
targetType: 1 targetType: 3
}, },
{ {
name: '费用归属设置', name: '费用归属设置',
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<div class="block" :key="index"> <div class="block" :key="index">
<div class="item"> <div class="item">
<div class="item-label">兜底标准:</div> <div class="item-label">兜底标准:</div>
<div class="item-value">{{ metricName(item) }}</div> <div class="item-value">{{ metricName(item) }}{{guaranteeStandard(item)}}</div>
</div> </div>
<div class="item"> <div class="item">
<div class="item-label">赔付标准:</div> <div class="item-label">赔付标准:</div>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<template v-else> <template v-else>
<template v-if="item.compensationMode == 1"> <template v-if="item.compensationMode == 1">
固定模式 固定模式
<div class="text">差距订单数每单赔付{{ item.guaranteeStandard }}元</div> <div class="text">差距订单数每单赔付{{ item.fixedCompensation }}元</div>
</template> </template>
<template v-else> <template v-else>
阶梯模式 阶梯模式
...@@ -53,8 +53,8 @@ ...@@ -53,8 +53,8 @@
<div class="condition-list"> <div class="condition-list">
<template v-for="(item, index) in guaranteeConfigs"> <template v-for="(item, index) in guaranteeConfigs">
<conditionItem :key="index" :includesList="includesConditionList" :item="item" :num="index" <conditionItem :key="index" :includesList="includesConditionList" :item="item" :num="index"
@delete="deleteCondition(index)" @changeCondition="changeCondition($event, index)" @delete="deleteCondition(index)" @updateCondition="updateCondition($event, index)"
:listLength="guaranteeConfigs.length" :ref="`conditionItem${index}`" /> :listLength="guaranteeConfigs.length" :ref="`conditionItem${index}`" :metricConfigs="metricConfigs" />
</template> </template>
</div> </div>
</div> </div>
...@@ -88,8 +88,7 @@ export default { ...@@ -88,8 +88,7 @@ export default {
return { return {
data: '', data: '',
guaranteeConfigs: [], guaranteeConfigs: [],
includesConditionList: [], metricConfigs: []
metricConfigs: []
} }
}, },
watch: { watch: {
...@@ -105,25 +104,37 @@ export default { ...@@ -105,25 +104,37 @@ export default {
this.storeApproveQueryMetricConfigs() this.storeApproveQueryMetricConfigs()
if (val && val.length) { if (val && val.length) {
this.guaranteeConfigs = val this.guaranteeConfigs = val
this.includesConditionList = val.map(item => item.guaranteeIndex) } else {
} else this.guaranteeConfigs = [{ this.guaranteeConfigs = [{
guaranteeIndex: '', guaranteeIndex: '',
guaranteeStandard: null, guaranteeStandard: null,
compensationMode: 0 compensationMode: 0
}] }]
}
}, },
immediate: true, immediate: true,
deep: true deep: true
} },
},
computed: {
includesConditionList() {
let includesConditionList = [],
{guaranteeConfigs } = this
guaranteeConfigs.map(item => {
if(item.guaranteeIndex) includesConditionList.push(item.guaranteeIndex)
})
console.log(includesConditionList)
return includesConditionList
},
}, },
computed: {},
mounted() { mounted() {
}, },
methods: { methods: {
async storeApproveQueryMetricConfigs() { async storeApproveQueryMetricConfigs() {
let baseSceneCode = this.GET_BASE_SCENE_CODE(), let baseSceneCode = this.GET_BASE_SCENE_CODE(),
metricConfigs = JSON.parse(localStorage.getItem('metricConfigs')) || {} storageData = localStorage.getItem('metricConfigs'),
metricConfigs = storageData ? JSON.parse(storageData) : {}
if (!metricConfigs[baseSceneCode]) { if (!metricConfigs[baseSceneCode]) {
const data = await storeApproveQueryMetricConfigs({ const data = await storeApproveQueryMetricConfigs({
baseSceneCode baseSceneCode
...@@ -136,24 +147,30 @@ export default { ...@@ -136,24 +147,30 @@ export default {
} else this.metricConfigs = metricConfigs[baseSceneCode] } else this.metricConfigs = metricConfigs[baseSceneCode]
}, },
addCondition() { addCondition() {
this.guaranteeConfigs.push({ this.validate(guaranteeConfigs => {
this.guaranteeConfigs = guaranteeConfigs
this.guaranteeConfigs.push({
guaranteeIndex: '', guaranteeIndex: '',
guaranteeStandard: null, guaranteeStandard: null,
compensationMode: '0' compensationMode: 0
})
}) })
}, },
deleteCondition(index) { deleteCondition(index) {
this.includesConditionList.splice(index, 1) this.validate(guaranteeConfigs => {
this.guaranteeConfigs.splice(index, 1) this.guaranteeConfigs = guaranteeConfigs
this.guaranteeConfigs.splice(index, 1)
})
}, },
changeData(val) { changeData(val) {
this.$emit('update:value', val) this.$emit('update:value', val)
this.includesConditionList = []
if (val == 1 && this.guaranteeConfigs.length == 0) this.addCondition() if (val == 1 && this.guaranteeConfigs.length == 0) this.addCondition()
if (val == 0) this.guaranteeConfigs = [] if (val == 0) this.guaranteeConfigs = []
}, },
changeCondition(val, index) { updateCondition() {
this.$set(this.includesConditionList, index, val) this.validate(guaranteeConfigs => {
this.guaranteeConfigs = [...guaranteeConfigs]
})
}, },
validate(callback) { validate(callback) {
try { try {
...@@ -168,6 +185,15 @@ export default { ...@@ -168,6 +185,15 @@ export default {
this.$message.error(error) this.$message.error(error)
} }
}, },
guaranteeStandard(item){
let { metricConfigs } = this
if (metricConfigs && metricConfigs.length && item.guaranteeIndex){
let type = metricConfigs.find(e => e.metricCode == item.guaranteeIndex)?.dataType,
unit = ''
if(type == 1) unit = '%'
return `${item.guaranteeStandard}${unit}`
} else return ''
},
metricName(item) { metricName(item) {
let { metricConfigs } = this let { metricConfigs } = this
if (metricConfigs && metricConfigs.length) return metricConfigs.find(e => e.metricCode == item.guaranteeIndex)?.metricName || '-' if (metricConfigs && metricConfigs.length) return metricConfigs.find(e => e.metricCode == item.guaranteeIndex)?.metricName || '-'
...@@ -178,7 +204,7 @@ export default { ...@@ -178,7 +204,7 @@ export default {
}, },
formatGuaranteeItem(i, item) { formatGuaranteeItem(i, item) {
let unit = i.unit || '' let unit = i.unit || ''
return `满足${i.startValue}${unit} &le; ${this.metricName(item)}&lt;${i.endValue}${unit}时,差距订单数每单赔付${i.compensationAmount}元` return `满足${i.startValue}${unit} &le; ${this.metricName(item)} &lt; ${i.endValue}${unit}时,差距订单数每单赔付${i.compensationAmount}元`
} }
} }
} }
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
</template> </template>
<template v-else-if="i.type == 'select'"> <template v-else-if="i.type == 'select'">
<el-select v-model="componentData[i.key]" class="select" :placeholder="`请选择${i.label}`" <el-select v-model="componentData[i.key]" class="select" :placeholder="`请选择${i.label}`"
:filterable="i.filterable" @change="selectionChange"> :filterable="i.filterable" @change="selectionChange" @visible-change="visibleChange">
<el-option v-for="item in indicatorOptions" :key="item.metricCode" :label="item.metricName" <el-option v-for="item in options" :key="item.metricCode" :label="item.metricName"
:value="item.metricCode" :filterable="i.filterable" :disabled="item.disabled" /> :value="item.metricCode" :filterable="i.filterable" :disabled="includesList.includes(item.metricCode)" />
</el-select> </el-select>
</template> </template>
<template v-else-if="i.type == 'radio'"> <template v-else-if="i.type == 'radio'">
...@@ -87,7 +87,7 @@ const DDBZ = { label: '兜底标准', key: 'guaranteeStandard', type: 'input' }, ...@@ -87,7 +87,7 @@ const DDBZ = { label: '兜底标准', key: 'guaranteeStandard', type: 'input' },
], ],
} }
export default { export default {
inject: ['size', 'GET_BASE_SCENE_CODE'], inject: ['size'],
name: 'ConditionItem', name: 'ConditionItem',
mixins: [componentsMixin], mixins: [componentsMixin],
props: { props: {
...@@ -107,10 +107,12 @@ export default { ...@@ -107,10 +107,12 @@ export default {
type: Array, type: Array,
default: () => [] default: () => []
}, },
metricConfigs: Array
}, },
data() { data() {
return { return {
componentData: {}, guaranteeOptions:[],
componentData: null,
ladderConditions: [], ladderConditions: [],
rules: { rules: {
guaranteeIndex: [{ required: true, message: '请选择兜底指标', trigger: 'change' }], guaranteeIndex: [{ required: true, message: '请选择兜底指标', trigger: 'change' }],
...@@ -146,7 +148,9 @@ export default { ...@@ -146,7 +148,9 @@ export default {
this.selectionChange(val.guaranteeIndex, false) this.selectionChange(val.guaranteeIndex, false)
if (val.ladderConditions) this.ladderConditions = JSON.parse(val.ladderConditions) if (val.ladderConditions) this.ladderConditions = JSON.parse(val.ladderConditions)
} }
this.formRef && this.formRef.clearValidate() this.$nextTick(() => {
this.formRef && this.formRef.clearValidate()
})
}, },
deep: true, deep: true,
immediate: true immediate: true
...@@ -170,12 +174,16 @@ export default { ...@@ -170,12 +174,16 @@ export default {
}, },
computed: { computed: {
options() { options() {
let baseSceneCode = this.GET_BASE_SCENE_CODE(), let {metricConfigs} = this
metricConfigs = localStorage.getItem('metricConfigs') || {}, return metricConfigs
options = metricConfigs ? deepClone(JSON.parse(metricConfigs)[baseSceneCode]) : [] },
return options formRef() {
return this.$refs.formRef
}, },
indicatorOptions() { },
mounted() { },
methods: {
indicatorOptions() {
let { includesList } = this, let { includesList } = this,
options = deepClone(this.options) options = deepClone(this.options)
if (includesList.length) { if (includesList.length) {
...@@ -186,12 +194,6 @@ export default { ...@@ -186,12 +194,6 @@ export default {
} }
return options return options
}, },
formRef() {
return this.$refs.formRef
},
},
mounted() { },
methods: {
radioChange(val) { radioChange(val) {
if (val == 2) { if (val == 2) {
this.ladderConditions = [{ this.ladderConditions = [{
...@@ -224,12 +226,13 @@ export default { ...@@ -224,12 +226,13 @@ export default {
if (clear) this.$set(this.componentData, 'guaranteeStandard', '') if (clear) this.$set(this.componentData, 'guaranteeStandard', '')
this.$set(this, 'conditionStartConfig', conditionStartConfig) this.$set(this, 'conditionStartConfig', conditionStartConfig)
this.$set(this, 'conditionEndConfig', conditionEndConfig) this.$set(this, 'conditionEndConfig', conditionEndConfig)
this.$emit('changeCondition', val) if(clear) this.$emit('updateCondition')
}, },
deleteList(index) { deleteList(index) {
this.ladderConditions.splice(index, 1) this.ladderConditions.splice(index, 1)
this.$forceUpdate() this.$forceUpdate()
this.$emit('updateCondition')
}, },
addList() { addList() {
this.ladderConditions.push({ this.ladderConditions.push({
...@@ -238,9 +241,10 @@ export default { ...@@ -238,9 +241,10 @@ export default {
compensationAmount: '' compensationAmount: ''
}) })
this.$forceUpdate() this.$forceUpdate()
this.$emit('updateCondition')
}, },
indicatorText(val) { indicatorText(val) {
return this.indicatorOptions.find(item => item.metricCode == val)?.metricName || '选中的指标值' return this.indicatorOptions().find(item => item.metricCode == val)?.metricName || '选中的指标值'
}, },
clearValue(index, key, errorText) { clearValue(index, key, errorText) {
this.$set(this.ladderConditions[index], key, '') this.$set(this.ladderConditions[index], key, '')
...@@ -320,7 +324,7 @@ export default { ...@@ -320,7 +324,7 @@ export default {
}, },
disabled(val) { disabled(val) {
return val === '' || val === null || val === undefined return val === '' || val === null || val === undefined
}, }
} }
} }
</script> </script>
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<component :is="i.addComponent" :value.sync="componentData[i.key]" isViewMode <component :is="i.addComponent" :value.sync="componentData[i.key]" isViewMode
:list="componentData[i.listKey]" /> :list="componentData[i.listKey]" />
</template> </template>
<template v-else> {{ componentData[i.key] || '-' }}</template> <template v-else> {{ formatText(componentData[i.key]) }}</template>
<template <template
v-if="i.unit && componentData[i.key] != null && componentData[i.key] != '' && componentData[i.key] != undefined"> v-if="i.unit && componentData[i.key] != null && componentData[i.key] != '' && componentData[i.key] != undefined">
...@@ -125,6 +125,8 @@ export default { ...@@ -125,6 +125,8 @@ export default {
} }
} }
} }
} else {
if (this.componentData.personnelCostRate == null) this.$set(this.componentData, 'personnelCostRate', 0)
} }
}, },
immediate: true, immediate: true,
...@@ -295,6 +297,10 @@ export default { ...@@ -295,6 +297,10 @@ export default {
}) })
} }
return flag return flag
},
formatText(val){
if(val == null || val === '' || val == undefined) return '-'
else return val
} }
}, },
mounted() { mounted() {
......
...@@ -25,13 +25,13 @@ ...@@ -25,13 +25,13 @@
<template v-if="pageComplete"> <template v-if="pageComplete">
<el-button v-if="pageType == 'audit' && step == 4" type="primary" @click="rejectDialogVisible = true" <el-button v-if="pageType == 'audit' && step == 4" type="primary" @click="rejectDialogVisible = true"
plain>驳回</el-button> plain>驳回</el-button>
<el-button v-if="!['audit', 'view'].includes(pageType) && step == 3" type="primary" @click="prevStep" <el-button v-if="!['audit', 'view'].includes(pageType) && [3,4].includes(step) " type="primary" @click="prevStep"
plain>上一步</el-button> plain>上一步</el-button>
<el-button v-if="pageType != 'view'" @click="submit" :loading="buttonLoading" type="primary">{{ submitText <el-button v-if="pageType != 'view'" @click="submit" :loading="buttonLoading" type="primary">{{ submitText
}}</el-button> }}</el-button>
</template> </template>
<el-button v-if="!buttonLoading" @click="$router.go(-1)" plain type="info">{{ pageType == 'view' ? '返回' : '取消' <el-button v-if="!buttonLoading" @click="$router.go(-1)" plain type="info">{{ pageType == 'view' ? '返回' : '取消'
}}</el-button> }}</el-button>
</div> </div>
<el-dialog :close-on-click-modal="false" :show-close="false" title="提示" :visible.sync="dialogVisible" width="40%" <el-dialog :close-on-click-modal="false" :show-close="false" title="提示" :visible.sync="dialogVisible" width="40%"
......
...@@ -158,29 +158,14 @@ function mapMerchantDetailToEditData(detail) { ...@@ -158,29 +158,14 @@ function mapMerchantDetailToEditData(detail) {
}; };
} }
/** 从商户详情映射品牌树勾选数据(处理 merchantBrandMain 字符串以逗号分隔的情况) */ /** 从商户详情映射品牌树勾选数据 */
function mapMerchantBrandListFromDetail(detail) { function mapMerchantBrandListFromDetail(detail) {
if (!detail || !detail?.merchantBrandMain) { if (!detail?.brandTreeList) {
return []; return [];
} }
return detail.brandTreeList.flatMap((val) => {
const brandMainStr = detail.merchantBrandMain; return val.subList?.map(v => v.id) ?? [];
});
// 去除末尾分号,split成数组,转换为数字
const brandIds = brandMainStr
.replace(/[;;]\s*$/, "") // 去除末尾的分号或中文分号
.split(/[,,]/) // 支持英文逗号和中文逗号
.map((id) => {
const trimmed = id.trim();
if (!trimmed) {
return null;
} // 过滤空字符串
const num = Number.parseInt(trimmed, 10);
return Number.isNaN(num) ? null : num; // 转换为数字,过滤无效值
})
.filter(id => id !== null); // 过滤空值和无效值
return brandIds;
} }
export default { export default {
...@@ -260,6 +245,10 @@ export default { ...@@ -260,6 +245,10 @@ export default {
// loading 已在 watch/mounted 中设置,此处无需重复设置 // loading 已在 watch/mounted 中设置,此处无需重复设置
try { try {
this.resetMerchantVerifyForm(); this.resetMerchantVerifyForm();
// 编辑场景:设置当前编辑商户的 merchantNo(用于排除上级商户列表)
if (this.customerRow && this.customerRow.merchantId) {
this.setCurrentEditMerchantNo(this.customerRow.merchantId);
}
// 编辑场景:立即设置字段为只读文本显示(避免loading期间显示输入框) // 编辑场景:立即设置字段为只读文本显示(避免loading期间显示输入框)
this.initEditFieldDisplayTypes(); this.initEditFieldDisplayTypes();
// 编辑场景:修改上级商户字段使用 merchantNo 作为 optionId // 编辑场景:修改上级商户字段使用 merchantNo 作为 optionId
...@@ -273,7 +262,7 @@ export default { ...@@ -273,7 +262,7 @@ export default {
}); });
} catch (e) { } catch (e) {
console.error("编辑商户弹窗初始化失败:", e); console.error("编辑商户弹窗初始化失败:", e);
this.$message.error("数据加载失败,请关闭弹窗后重试"); // this.$message.error("数据加载失败,请关闭弹窗后重试");
} finally { } finally {
// 所有接口加载完成后关闭loading // 所有接口加载完成后关闭loading
this.loading = false; this.loading = false;
...@@ -358,11 +347,15 @@ export default { ...@@ -358,11 +347,15 @@ export default {
// 回显表单数据 // 回显表单数据
const editDataMapped = mapMerchantDetailToEditData(res); const editDataMapped = mapMerchantDetailToEditData(res);
console.log(editDataMapped, "22222", res);
if (editDataMapped) { if (editDataMapped) {
Object.keys(editDataMapped).forEach((key) => { Object.keys(editDataMapped).forEach((key) => {
this.$set(this.editData, key, editDataMapped[key]); this.$set(this.editData, key, editDataMapped[key]);
}); });
// 编辑场景:设置初始商户名称(用于排除重复校验)
if (editDataMapped.merchantName) {
this.setInitialMerchantName(editDataMapped.merchantName);
}
} }
// 触发账户等级联动(初始化阶段不会自动请求上级商户列表,避免重复请求) // 触发账户等级联动(初始化阶段不会自动请求上级商户列表,避免重复请求)
...@@ -423,7 +416,8 @@ export default { ...@@ -423,7 +416,8 @@ export default {
this.syncMerchantBrandSlotPlaceholder(); this.syncMerchantBrandSlotPlaceholder();
} catch (e) { } catch (e) {
console.error("加载商户详情失败:", e); console.error("加载商户详情失败:", e);
throw e; // 抛出错误,让外层统一处理 // 接口失败时,设置默认商户类型为2(4S店)
this.$set(this.editData, "accounttypeId", 2);
} finally { } finally {
// 初始化完成,取消标记,后续用户手动修改账户等级时正常触发联动 // 初始化完成,取消标记,后续用户手动修改账户等级时正常触发联动
this.isLoadingEditDetail = false; this.isLoadingEditDetail = false;
...@@ -505,10 +499,9 @@ export default { ...@@ -505,10 +499,9 @@ export default {
if (parentMerchantNo) { if (parentMerchantNo) {
payload.parentMerchantNo = parentMerchantNo; payload.parentMerchantNo = parentMerchantNo;
} }
// 商户号 // 商户号
const merchantId = submitNumber(d.merchantId || this.customerRow?.merchantId); const merchantId = submitNumber(d.merchantId || this.customerRow?.merchantId);
if (merchantId !== undefined && payload.merchantAccountLevel != 1) { if (merchantId !== undefined) {
payload.merchantNo = merchantId; payload.merchantNo = merchantId;
} }
// 主营品牌 // 主营品牌
......
import { potentialCustomersCheckMerchantName } from "@api/salesManagement";
/** /**
* 商户编辑表单 Mixin * 商户编辑表单 Mixin
* 继承 merchantVerifyFormMixin,针对编辑场景定制: * 继承 merchantVerifyFormMixin,针对编辑场景定制:
...@@ -11,16 +12,193 @@ ...@@ -11,16 +12,193 @@
* - 提交时忽略这些字段的临时值,提交真实数据或不提交 * - 提交时忽略这些字段的临时值,提交真实数据或不提交
* 5. 联系电话:添加输入校验,仅可输入数字 * 5. 联系电话:添加输入校验,仅可输入数字
*/ */
import merchantVerifyFormMixin from "@/components/merchantVerify/merchantVerifyFormMixin"; import merchantVerifyFormMixin, {
normalizeMerchantNameDuplicateResponse,
showMerchantNameDuplicateAlert,
} from "@/components/merchantVerify/merchantVerifyFormMixin";
export default { export default {
mixins: [merchantVerifyFormMixin], mixins: [merchantVerifyFormMixin],
data() { data() {
const vm = this;
return { return {
// 标记是否正在加载编辑数据(初始化阶段) // 标记是否正在加载编辑数据(初始化阶段)
isLoadingEditDetail: false, isLoadingEditDetail: false,
// 只读字段的临时占位值(用于避免校验) // 只读字段的临时占位值(用于避免校验)
_READONLY_PLACEHOLDER_: "__readonly_placeholder__", _READONLY_PLACEHOLDER_: "__readonly_placeholder__",
// 编辑场景:初始商户名称(用于排除重复校验)
initialMerchantName: "",
// 编辑场景:当前编辑商户的 merchantNo(用于排除上级商户列表中的当前商户)
currentEditMerchantNo: "",
// 编辑场景:地址选择只显示省市两级,不显示区县
subdistrict: 2,
// 编辑场景:重写地址校验规则(只校验省市,不校验区县)
formRules: {
// 这里重新定义必要的校验规则
accounttypeId: [{ required: true, message: "请选择商户类型" }],
merchantAccountLevel: [
{ required: true, message: "请选择账户等级" },
],
parentId: [{ required: true, message: "请选择上级商户" }],
channelId: [{ required: true, message: "请选择渠道" }],
merchantModel: [{ required: true, message: "请选择开通模式" }],
merchantName: [
{ required: true, message: "请输入商户名称" },
{
max: 50,
message: "商户名称不能超过50个字",
trigger: "blur",
},
{
validator(rule, value, callback) {
if (vm.merchantNameBlurDuplicateBlocked) {
callback(
new Error(MERCHANT_NAME_DUPLICATE_MESSAGE),
);
return;
}
callback();
},
},
],
contactPhone: [
{ required: true, message: "请输入联系电话" },
{
validator(rule, value, callback) {
if (!/^1[3-9]\d{9}$/.test(value || "")) {
callback(
new Error(
"请输入11位有效手机号(号段须为13-19开头)",
),
);
return;
}
callback();
},
trigger: "blur",
},
],
merchantBrandSlot: [
{
required: true,
message: "请选择主营品牌(需选择至子品牌)",
trigger: "change",
},
{
validator(_, __, callback) {
vm.$nextTick(() => {
const brand = vm.$refs.brandListTree;
const tree = brand && brand.$refs.tree;
if (!tree) {
callback(new Error("请选择主营品牌"));
return;
}
const leaves
= typeof tree.getCheckedNodes === "function"
? tree.getCheckedNodes(true)
: [];
if (!leaves || !leaves.length) {
callback(
new Error(
"请选择主营品牌(需选择至子品牌)",
),
);
return;
}
callback();
});
},
trigger: "change",
},
],
loginAccount: [
{ required: true, message: "请输入登录账号" },
{
validator(rule, value, callback) {
if (!/^[A-Z0-9]{1,15}$/i.test(value)) {
callback(
new Error(
"登录账号仅支持字母与数字,最多15位",
),
);
return false;
}
callback();
},
trigger: "blur",
},
],
loginPassword: [
{ required: true, message: "请输入登录密码" },
{
validator(rule, value, callback) {
const v = value == null ? "" : String(value);
if (
!/^(?=.*[A-Z])(?=.*\d)[A-Z\d]{6,20}$/i.test(
v,
)
) {
callback(
new Error(
"登录密码须为6-20位,仅字母与数字且须同时包含字母与数字",
),
);
return false;
}
callback();
},
trigger: "blur",
},
],
detailAddress: [
{
validator(rule, value, callback) {
const d = vm.editData;
const hasText = !!(
d.detailAddress
&& String(d.detailAddress).trim()
);
const hasProvince = !!(
d.provinceName && String(d.provinceName).trim()
);
const hasCity = !!(
d.cityName && String(d.cityName).trim()
);
const coordOk = x =>
x !== ""
&& x != null
&& String(x).trim() !== ""
&& !Number.isNaN(Number(x));
const latOk = coordOk(d.lat) || coordOk(d.latitude);
const lngOk
= coordOk(d.lng) || coordOk(d.longitude);
// 已通过地图选址(有详细文案与经纬度)时,不要求与省市下拉逐项一致
if (latOk && lngOk && hasText) {
callback();
return;
}
// 编辑场景:只校验省市和详细地址(不校验区县)
if (!hasProvince || !hasCity || !hasText) {
callback(
new Error("请选择省、市并填写详细地址"),
);
return;
}
if (!latOk || !lngOk) {
callback(
new Error("请通过地图选择地址以获取经纬度"),
);
return;
}
callback();
},
trigger: "blur",
},
],
},
}; };
}, },
methods: { methods: {
...@@ -173,7 +351,6 @@ export default { ...@@ -173,7 +351,6 @@ export default {
this.baseData.parentMerchantList = []; this.baseData.parentMerchantList = [];
this.merchantNameKeyword = ""; this.merchantNameKeyword = "";
this.getOptionsList("editFormData", false, "parentId"); this.getOptionsList("editFormData", false, "parentId");
// 自动请求上级商户列表(非工厂级时) // 自动请求上级商户列表(非工厂级时)
if (v != "1") { if (v != "1") {
this.get4sAndServiceMerchantList("store"); this.get4sAndServiceMerchantList("store");
...@@ -212,5 +389,102 @@ export default { ...@@ -212,5 +389,102 @@ export default {
this.refreshMerchantTypeRadioDisabled(); this.refreshMerchantTypeRadioDisabled();
}); });
}, },
/**
* 编辑场景:设置初始商户名称(用于排除重复校验)
* @param {string} merchantName - 商户名称
*/
setInitialMerchantName(merchantName) {
this.initialMerchantName = (merchantName || "").trim();
},
/**
* 编辑场景:设置当前编辑商户的 merchantNo
* @param {string|number} merchantNo - 商户号
*/
setCurrentEditMerchantNo(merchantNo) {
this.currentEditMerchantNo = String(merchantNo || "");
},
/**
* 编辑场景:从上级商户列表中过滤掉当前编辑的商户
* 直接从列表中删除,不显示该选项
*/
filterCurrentMerchantFromParentList() {
if (!this.currentEditMerchantNo) {
return;
}
const list = this.baseData.parentMerchantList || [];
this.baseData.parentMerchantList = list.filter(
item => item.merchantNo != this.currentEditMerchantNo,
);
},
/**
* 编辑场景:重写上级商户列表获取方法
* 获取列表后过滤当前商户
*/
async get4sAndServiceMerchantList(searchIndex) {
// 调用父类方法获取列表
await merchantVerifyFormMixin.methods.get4sAndServiceMerchantList.call(this, searchIndex);
// 编辑场景:处理当前编辑商户
if (this.currentEditMerchantNo) {
this.filterCurrentMerchantFromParentList();
// 更新下拉选项
this.getOptionsList("editFormData", false, "parentId");
}
},
/**
* 编辑场景:排除初始商户名称
* 如果当前商户名称与初始商户名称相同,则跳过校验
*/
validateMerchantNameDuplicateOnBlur() {
const inner = this.$refs.editFormRef?.$refs[this.editChildRef];
if (!inner) {
return;
}
this.merchantNameBlurDuplicateBlocked = false;
inner.validateField("merchantName", (errorMessage) => {
if (errorMessage) {
return;
}
const v = (this.editData.merchantName || "").trim();
if (!v) {
return;
}
// 编辑场景:如果当前商户名称与初始商户名称相同,跳过重复校验
if (this.initialMerchantName && v === this.initialMerchantName) {
this.merchantNameBlurDuplicateBlocked = false;
this.$nextTick(() => {
inner.clearValidate(["merchantName"]);
inner.validateField("merchantName");
});
return;
}
// 否则调用接口校验
potentialCustomersCheckMerchantName({
merchantName: v,
})
.then((res) => {
if (normalizeMerchantNameDuplicateResponse(res)) {
showMerchantNameDuplicateAlert(this);
this.merchantNameBlurDuplicateBlocked = true;
this.setMerchantNameDuplicateFieldError();
return;
}
this.merchantNameBlurDuplicateBlocked = false;
this.$nextTick(() => {
inner.clearValidate(["merchantName"]);
inner.validateField("merchantName");
});
})
.catch(() => {});
});
},
}, },
}; };
...@@ -133,19 +133,24 @@ ...@@ -133,19 +133,24 @@
</el-switch> </el-switch>
</div> </div>
</template> </template>
<auth-button slot="auth-button" <div slot="auth-button" slot-scope="scope">
slot-scope="scope" <auth-button v-if="scope.scope.shopStatus != 4"
:data="scope.scope" slot="auth-button"
:show-btn-ids="[ :data="scope.scope"
'9061903', :show-btn-ids="[
'9061904', '9061903',
'9061906', '9061904',
'9061908', '9061906',
'9061910', '9061908',
'9061912', '9061910',
'9061914', '9061912',
'9061927', '9061914',
]" /> ]" />
<div v-else>
-
</div>
</div>
</d2-table> </d2-table>
</div> </div>
<d2-file-import-dialog template-name="文件下载" <d2-file-import-dialog template-name="文件下载"
......
...@@ -1531,7 +1531,7 @@ export default { ...@@ -1531,7 +1531,7 @@ export default {
); );
// 处理分账品类按商品分类的传参,仅传选中最细一级的类目数据 // 处理分账品类按商品分类的传参,仅传选中最细一级的类目数据
this.submitParams.goodsTypeGroupRules?.forEach((item) => { this.submitParams.goodsTypeGroupRules?.forEach((item) => {
item.goodsTypeGroupRelations.length && item.goodsTypeGroupRelations?.forEach((relation) => { item.goodsTypeGroupRelations?.length && item.goodsTypeGroupRelations?.forEach((relation) => {
relation.goodsType = relation.thirdLevelGoodsType || relation.secondaryGoodsType || relation.goodsType; relation.goodsType = relation.thirdLevelGoodsType || relation.secondaryGoodsType || relation.goodsType;
relation.goodsTypeName = relation.thirdLevelGoodsTypeName || relation.secondaryGoodsTypeName || relation.goodsTypeName; relation.goodsTypeName = relation.thirdLevelGoodsTypeName || relation.secondaryGoodsTypeName || relation.goodsTypeName;
delete relation.thirdLevelGoodsType; delete relation.thirdLevelGoodsType;
......
...@@ -171,9 +171,11 @@ ...@@ -171,9 +171,11 @@
</template> </template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-button v-if="!isViewMode" <el-button v-if="!isViewMode && componentData.guaranteeList.length > 1"
class="delete-btn" class="delete-btn"
type="text" icon="el-icon-delete"
type="danger"
plain
:size="size" :size="size"
@click="removeBottomSupportItem(itemIdx)"> @click="removeBottomSupportItem(itemIdx)">
删除 删除
...@@ -187,6 +189,7 @@ ...@@ -187,6 +189,7 @@
<span v-if="isViewMode">{{ getPayTypeLabel(item.compensationMode) }}</span> <span v-if="isViewMode">{{ getPayTypeLabel(item.compensationMode) }}</span>
<el-radio-group v-else <el-radio-group v-else
v-model="item.compensationMode" v-model="item.compensationMode"
:disabled="item.guaranteeIndex == '' || item.guaranteeIndex == null"
@change="onPayTypeChange(item, $event)"> @change="onPayTypeChange(item, $event)">
<el-radio v-for="p in compensationModeOptions" <el-radio v-for="p in compensationModeOptions"
:key="p.value" :key="p.value"
...@@ -195,13 +198,6 @@ ...@@ -195,13 +198,6 @@
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<div v-if="item.compensationMode === 2 && !isViewMode" class="pay-detail">
<el-button type="text"
:size="size"
@click="addLadderItem(item)">
添加条件
</el-button>
</div>
</div> </div>
<div v-if="item.compensationMode === 1" class="pay-detail"> <div v-if="item.compensationMode === 1" class="pay-detail">
<el-form-item label="差距订单数每单赔付:" <el-form-item label="差距订单数每单赔付:"
...@@ -213,6 +209,7 @@ ...@@ -213,6 +209,7 @@
v-model="item.fixedCompensation" v-model="item.fixedCompensation"
placeholder="请输入" placeholder="请输入"
style="width: 220px;" style="width: 220px;"
:disabled="item.guaranteeStandard == null || item.guaranteeStandard == ''"
@input="handleAmountInput($event, item, 'fixedCompensation')" /> @input="handleAmountInput($event, item, 'fixedCompensation')" />
<span v-if="!isViewMode" class="unit">元</span> <span v-if="!isViewMode" class="unit">元</span>
</el-form-item> </el-form-item>
...@@ -234,6 +231,7 @@ ...@@ -234,6 +231,7 @@
class="ladder-input" class="ladder-input"
placeholder="请输入" placeholder="请输入"
size="small" size="small"
:disabled="item.guaranteeStandard == null || item.guaranteeStandard == ''"
@input="handleAmountInput($event, ladder, 'startValue', item)" /> @input="handleAmountInput($event, ladder, 'startValue', item)" />
</el-form-item> </el-form-item>
<span class="ladder-symbol">{{ '≤ 选中的指标值 <' }}</span> <span class="ladder-symbol">{{ '≤ 选中的指标值 <' }}</span>
...@@ -246,6 +244,7 @@ ...@@ -246,6 +244,7 @@
class="ladder-input" class="ladder-input"
placeholder="请输入" placeholder="请输入"
size="small" size="small"
:disabled="item.guaranteeStandard == null || item.guaranteeStandard == ''"
@input="handleAmountInput($event, ladder, 'endValue', item)" /> @input="handleAmountInput($event, ladder, 'endValue', item)" />
</el-form-item> </el-form-item>
<span class="ladder-symbol">时 差距订单数每单赔付</span> <span class="ladder-symbol">时 差距订单数每单赔付</span>
...@@ -258,13 +257,28 @@ ...@@ -258,13 +257,28 @@
class="ladder-input" class="ladder-input"
placeholder="请输入" placeholder="请输入"
size="small" size="small"
:disabled="item.guaranteeStandard == null || item.guaranteeStandard == ''"
@input="handleAmountInput($event, ladder, 'compensationAmount')" /> @input="handleAmountInput($event, ladder, 'compensationAmount')" />
</el-form-item> </el-form-item>
<span v-if="!isViewMode" class="unit">元</span> <span v-if="!isViewMode" class="unit">元</span>
<i v-if="!isViewMode" <el-button v-if="!isViewMode && item.ladderConditions && item.ladderConditions.length > 2"
class="el-icon-delete delete-icon" icon="el-icon-delete"
@click="removeLadderItem(item, lIdx)"> type="danger"
</i> plain
:size="size"
@click="removeLadderItem(item, lIdx)">
删除
</el-button>
</div>
<!-- 添加阶梯条件按钮:放在阶梯规则最后一行的下边 -->
<div v-if="!isViewMode" class="ladder-add-btn-wrapper">
<el-button type="primary"
plain
:disabled="item.ladderConditions && item.ladderConditions.length >= 5"
:size="size"
@click="addLadderItem(item)">
添加条件
</el-button>
</div> </div>
</div> </div>
</div> </div>
...@@ -656,8 +670,12 @@ export default { ...@@ -656,8 +670,12 @@ export default {
item.ladderConditions = []; item.ladderConditions = [];
} else if (item.compensationMode === 2) { } else if (item.compensationMode === 2) {
item.fixedCompensation = ""; item.fixedCompensation = "";
if (!item.ladderConditions) { // 切换到阶梯模式时,初始化两条空白数据
this.$set(item, "ladderConditions", []); if (!item.ladderConditions || item.ladderConditions.length < 2) {
this.$set(item, "ladderConditions", [
{ startValue: "", endValue: "", compensationAmount: "" },
{ startValue: "", endValue: "", compensationAmount: "" },
]);
} }
} else { } else {
item.fixedCompensation = ""; item.fixedCompensation = "";
...@@ -685,6 +703,11 @@ export default { ...@@ -685,6 +703,11 @@ export default {
* 删除阶梯条件 * 删除阶梯条件
*/ */
removeLadderItem(item, idx) { removeLadderItem(item, idx) {
// 最少保留两条,两条时不可删除
if (!item.ladderConditions || item.ladderConditions.length <= 2) {
this.$message.warning("阶梯条件最少需要保留 2 条");
return;
}
item.ladderConditions.splice(idx, 1); item.ladderConditions.splice(idx, 1);
}, },
/** /**
...@@ -1412,7 +1435,6 @@ export default { ...@@ -1412,7 +1435,6 @@ export default {
.delete-btn { .delete-btn {
margin-left: auto; margin-left: auto;
color: #f56c6c;
} }
} }
...@@ -1435,6 +1457,11 @@ export default { ...@@ -1435,6 +1457,11 @@ export default {
font-size: 14px; font-size: 14px;
} }
.ladder-add-btn-wrapper {
margin-top: 8px;
padding-left: 0;
}
.ladder-row { .ladder-row {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
......
...@@ -817,14 +817,14 @@ export default { ...@@ -817,14 +817,14 @@ export default {
} catch (e) { } catch (e) {
const cached const cached
= ruleIdx == null = ruleIdx == null
? null ? (tabindex === 0 ? this.getEffectivePhantomFullCategoryRuleRaw() : null)
: this.goodsTypeGroupReconciliationRules[ruleIdx]; : this.goodsTypeGroupReconciliationRules[ruleIdx];
rows.push(cached ? deepClone(cached) : {}); rows.push(cached ? deepClone(cached) : {});
} }
} else { } else {
const cached const cached
= ruleIdx == null = ruleIdx == null
? null ? (tabindex === 0 ? this.getEffectivePhantomFullCategoryRuleRaw() : null)
: this.goodsTypeGroupReconciliationRules[ruleIdx]; : this.goodsTypeGroupReconciliationRules[ruleIdx];
rows.push(cached ? deepClone(cached) : {}); rows.push(cached ? deepClone(cached) : {});
} }
......
...@@ -98,6 +98,17 @@ module.exports = { ...@@ -98,6 +98,17 @@ module.exports = {
// lintOnSave: true, // lintOnSave: true,
lintOnSave: false, lintOnSave: false,
devServer: { devServer: {
// webpack-dev-server v5: overlay 已迁到 client.overlay
// 推荐:保留编译错红屏,只关掉 throw 这类运行时错
client: {
// overlay: {
// errors: true,
// warnings: false,
// runtimeErrors: false,
// },
// 想完全静默就把上面注释掉,改成:
overlay: false,
},
// publicPath, // 和 publicPath 保持一致 // publicPath, // 和 publicPath 保持一致
// port: 8081 // port: 8081
// proxy: { // proxy: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!