Commit 545ae443 by wangzhihui

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

…stem into SAAS+V5.8.0
2 parents a68f9d6c fb39ff48
Showing 55 changed files with 2009 additions and 482 deletions
......@@ -12,13 +12,16 @@ import RequestMethods from "./request.methods";
const path = "dj.api.";
const path2 = "dj.api.smartcarlife.";
export function getList(data) {
// data.method = `${path2}merchantSettleAccountRule.page.byMerchant`
// data.method = `${path}servicemerchantref.shop.page`
data.method = `${path}servicemerchantref.pageServiceMerchantRef`;
/** 商户管理/关联 - 分页列表 */
export function pageServiceMerchantRef(data) {
data.method = "dj.api.servicemerchantref.newpageServiceMerchantRef";
return request(data);
}
export function getList(data) {
return pageServiceMerchantRef(data);
}
// 删除4s门店
export function deleteMerchant(data) {
data.method = `${path}servicemerchantref.delete.byId`;
......@@ -319,6 +322,18 @@ export function deleteShopRef(data) {
return request(data, RequestMethods.POST);
}
/** 禁用商户场景关联(财务/对账规则重置,列表仍展示为禁用) */
export function disableMerchantSceneRef(data) {
data.method = `${path}scenemerchantref.disableShopRef`;
return request(data, RequestMethods.POST);
}
/** 启用商户场景关联 */
export function enableMerchantSceneRef(data) {
data.method = `${path}scenemerchantref.enableShopRef`;
return request(data, RequestMethods.POST);
}
// 根据4S店商户号查询二级流量方
export function getDiversionMerchantRef(data) {
data.method = `${path2}diversionMerchant.getDiversionMerchantRef`;
......@@ -365,16 +380,16 @@ export function getContractAffiliationDataList(data) {
return request(data, "post");
}
// 获取商户关系历史记录
// 获取商户关系历史记录(场景商户关系)
export function getMerchantRelationRecordApi(data) {
data.method = `${path2}shopMerchant.queryMerchantRefDetailHistory`;
return request(data, "post");
data.method = `${path}scenemerchantref.queryMerchantHistory`;
return request(data, RequestMethods.POST);
}
// 新增/编辑商户上架
// 新增/编辑商户上架(Open 网关参数形态)
export function merchantOnShelf(data) {
data.method = `${path2}shopMerchant.addOrUpdateSceneMerchantRefNew`;
return request(data, "post");
data.method = `${path2}shopMerchant.addOrUpdateSceneMerchantRefNewOpen`;
return request(data, RequestMethods.POST);
}
// 获取商户关联关系详情
......@@ -383,6 +398,12 @@ export function getMerchantRelationDetailApi(data) {
return request(data, "post");
}
/** 商户上架编辑页详情(merchantId + baseSceneCode)→ scenemerchantref */
export function queryMerchantDetail(data) {
data.method = `${path}scenemerchantref.queryMerchantDetail`;
return request(data, RequestMethods.POST);
}
// 获取4s店和服务商门店数据
export function get4sAndServiceMerchantListApi(data) {
data.method = `${path}merchant.merchantAndService.page`;
......
......@@ -1517,10 +1517,13 @@ export const punishFlagOpt = [
{ confId: "1", confValue: "是" },
];
// 服务中心-长课程配置 处罚状态
// 惩罚状态 1-未触发 2-处罚中 3-已结束 4-已解除
export const punishStatusOpt = [
{ confId: 1, confValue: "未触发" },
{ confId: 2, confValue: "处罚中" },
{ confId: 3, confValue: "已结束" },
{ confId: 4, confValue: "已解除" },
];
// 服务中心-长课程配置 归属业务
export const course_businessOpt = [
......@@ -1539,9 +1542,10 @@ export const effectiveTypeOpt = [
];
// 服务中心-长课程配置 处罚方式
export const punishTypeOpt = [
{ confId: 0, confValue: "不处罚" },
{ confId: 0, confValue: "无处罚" },
{ confId: 1, confValue: "限制录单" },
];
// 服务中心-长课程配置 任务状态
export const course_taskStatusOpt = [
{ confId: 1, confValue: "进行中" },
......
......@@ -9,6 +9,23 @@ export const SCENE_TYPE_TO_BASE_SCENE_CODE = {
7: 120101,
}
/** baseSceneCode(字符串或数字)→ scene_type,与 {@link SCENE_TYPE_TO_BASE_SCENE_CODE} 互逆 */
const BASE_SCENE_CODE_TO_SCENE_TYPE = Object.fromEntries(
Object.entries(SCENE_TYPE_TO_BASE_SCENE_CODE).map(([sceneType, code]) => [String(code), Number(sceneType)]),
);
/**
* @param {unknown} baseSceneCode
* @returns {number} 匹配不到时为 NaN
*/
export function getSceneTypeByBaseSceneCode(baseSceneCode) {
if (baseSceneCode == null || baseSceneCode === "") return NaN;
const n = Number(baseSceneCode);
const key = Number.isNaN(n) ? String(baseSceneCode).trim() : String(n);
const hit = BASE_SCENE_CODE_TO_SCENE_TYPE[key];
return hit !== undefined ? hit : NaN;
}
/**
* @param {unknown} scene
* @returns {number}
......
......@@ -57,8 +57,13 @@ function submitNumber(val) {
return Number.isNaN(n) ? undefined : n;
}
/** 提交流:统一转成字符串(行政区划 code 在表单里可能是 number) */
function submitStringField(val) {
return String(val ?? "").trim();
}
/**
* submitVerification:merchantBrandList[].cars(integer 车系 id)、
* merchantBrandList[].cars(integer 车系 id)、
* merchantBrandList[].merchantBrandId(integer[] 二级车品牌 id)
*/
function normalizeMerchantBrandListForSubmit(list) {
......@@ -161,45 +166,41 @@ export default {
});
},
/**
* 组装 submitVerification 请求体。
* merchantBrandList / merchantBrandListJson:与货架 AddMerchant.saveMerchant 一致(车型 JSON 字符串)。
* source 固定 DJ;channelId / 渠道另传。createdBy 取当前登录用户(d2admin.user.info.detail.userName,与 sunshine 等提交一致)。
* status / isloginName 暂保留供后端兼容。
* 组装信息核验提交请求体(与货架 AddMerchant.saveMerchant 字段对齐)。
*/
buildSubmitVerificationPayload(merchantBrandList) {
const d = this.editData;
const payload = {};
payload.contactPhone = String(d.contactPhone ?? "").trim();
payload.loginAccount = String(d.loginAccount ?? "").trim();
payload.loginPassword = String(d.loginPassword ?? "").trim();
payload.contactPhone = submitStringField(d.contactPhone);
payload.loginAccount = submitStringField(d.loginAccount);
payload.loginPassword = submitStringField(d.loginPassword);
const contactTrim = String(d.contactName ?? "").trim();
const contactTrim = submitStringField(d.contactName);
if (contactTrim) payload.contactName = contactTrim;
const nameTrim = String(d.merchantName ?? "").trim();
const nameTrim = submitStringField(d.merchantName);
if (nameTrim) payload.merchantName = nameTrim;
/* 经度 longitude ← lng;纬度 latitude ← lat(接口类型 string) */
const lngStr = pickCoordString(d.lng, d.longitude);
const latStr = pickCoordString(d.lat, d.latitude);
if (lngStr) payload.longitude = lngStr;
if (latStr) payload.latitude = latStr;
if (d.provinceCode != null && String(d.provinceCode).trim() !== "")
payload.provinceCode = String(d.provinceCode).trim();
if (d.provinceName != null && String(d.provinceName).trim() !== "")
payload.provinceName = String(d.provinceName).trim();
if (d.cityCode != null && String(d.cityCode).trim() !== "")
payload.cityCode = String(d.cityCode).trim();
if (d.cityName != null && String(d.cityName).trim() !== "")
payload.cityName = String(d.cityName).trim();
if (d.districtCode != null && String(d.districtCode).trim() !== "")
payload.districtCode = String(d.districtCode).trim();
if (d.districtName != null && String(d.districtName).trim() !== "")
payload.districtName = String(d.districtName).trim();
const addrTrim = String(d.detailAddress ?? "").trim();
const pc = submitStringField(d.provinceCode);
if (pc) payload.provinceCode = pc;
const pn = submitStringField(d.provinceName);
if (pn) payload.provinceName = pn;
const cc = submitStringField(d.cityCode);
if (cc) payload.cityCode = cc;
const cn = submitStringField(d.cityName);
if (cn) payload.cityName = cn;
const dc = submitStringField(d.districtCode);
if (dc) payload.districtCode = dc;
const dn = submitStringField(d.districtName);
if (dn) payload.districtName = dn;
const addrTrim = submitStringField(d.detailAddress);
if (addrTrim) payload.merchantAddress = addrTrim;
const mal = submitNumber(d.merchantAccountLevel);
......@@ -216,7 +217,6 @@ export default {
);
if (yqNo !== undefined) payload.yqMerchantNo = yqNo;
/* merchantType:与 accounttypeId 一致;扩展字段非文档正文仍保留 */
const merchantTypeNum = submitNumber(d.accounttypeId);
if (merchantTypeNum !== undefined) payload.merchantType = merchantTypeNum;
......@@ -242,9 +242,9 @@ export default {
payload.status = 2;
payload.isloginName = 0;
payload.source = "DJ";
const createdByTrim = String(
this.$store.state.d2admin.user?.info?.detail?.userName ?? ""
).trim();
const createdByTrim = submitStringField(
this.$store.state.d2admin.user?.info?.detail?.userName
);
if (createdByTrim) payload.createdBy = createdByTrim;
return payload;
......
......@@ -23,6 +23,36 @@ export function displayScalarMerchantVerify(v) {
}
/**
* 主营品牌:brandTreeList 树节点取各层 name,父子用「 - 」连接;多枝或多根用「;」分隔。
* @param {unknown} node
* @returns {string[]}
*/
export function pathsFromBrandTreeNode(node) {
if (!node || typeof node !== "object") return [];
const label = String(node.name ?? "").trim();
const subs = Array.isArray(node.subList)
? node.subList.filter(Boolean)
: [];
if (subs.length === 0) {
return label ? [label] : [];
}
const childPaths = subs.flatMap(pathsFromBrandTreeNode);
if (!label) return childPaths;
if (childPaths.length === 0) return label ? [label] : [];
return childPaths.map((cp) => `${label} - ${cp}`);
}
/**
* @param {unknown} list
* @returns {string}
*/
export function formatMainBrandsFromBrandTreeList(list) {
if (!Array.isArray(list) || list.length === 0) return "";
const paths = list.flatMap(pathsFromBrandTreeNode).filter(Boolean);
return paths.join(";");
}
/**
* @param {Record<string, *>} mi merchantInfo
* @returns {Record<string, string>} CustomerDetailDialog「商户信息」Tab 所需展示对象(含占位键)
*/
......@@ -38,9 +68,10 @@ export function buildMerchantVerifyEchoDisplay(mi) {
const regionParts = [m.provinceName, m.cityName, m.districtName].filter(
(x) => x != null && String(x).trim() !== ""
);
const legalParts = [m.merchantLegalPerson, m.merchantLegalPersonPhone].filter(
(x) => x != null && String(x).trim() !== ""
);
const legalParts = [
m.merchantLegalPerson,
m.merchantLegalPersonPhone,
].filter((x) => x != null && String(x).trim() !== "");
const addrFull = String(m.merchantFullAddress ?? "").trim();
const addrStreet = String(m.merchantAddress ?? "").trim();
......@@ -66,17 +97,31 @@ export function buildMerchantVerifyEchoDisplay(mi) {
}
const pw = m.merchantLoginPassword;
const loginMask =
pw != null && String(pw).length > 0 ? "******" : "-";
const loginMask = pw != null && String(pw).length > 0 ? "******" : "-";
/** 核验表单字段名为 contactPhone;接口 merchantInfo 多为 residentPhone */
/** 详情「联系电话」:merchantLegalPersonPhone;兼容旧接口 residentPhone / contactPhone */
const contactPhoneEcho = displayScalarMerchantVerify(
m.residentPhone ?? m.contactPhone
m.merchantLegalPersonPhone
);
const rawAccountTypeNames = m.accountTypeNames;
let merchantTypeFromAccountTypes = "";
if (Array.isArray(rawAccountTypeNames)) {
merchantTypeFromAccountTypes = rawAccountTypeNames
.filter((x) => x != null && String(x).trim() !== "")
.join("、");
} else if (
rawAccountTypeNames != null &&
String(rawAccountTypeNames).trim() !== ""
) {
merchantTypeFromAccountTypes = String(rawAccountTypeNames).trim();
}
const mainBrandsFromTree = formatMainBrandsFromBrandTreeList(m.brandTreeList);
return {
merchantType: displayScalarMerchantVerify(
m.merchantTypeName || m.merchantType
merchantTypeFromAccountTypes || m.merchantTypeName || m.merchantType
),
accountLevel: displayScalarMerchantVerify(
m.accountLevelName || m.merchantAccountLevel
......@@ -93,9 +138,13 @@ export function buildMerchantVerifyEchoDisplay(mi) {
merchantAddress: merchantAddressEcho,
regionLine: regionParts.length ? regionParts.join(" ") : "-",
lngLatLine,
mainBrands: brandLineParts.length
? brandLineParts.join(";")
: displayScalarMerchantVerify(m.merchantBrandName || m.merchantBrand),
mainBrands: mainBrandsFromTree
? mainBrandsFromTree
: brandLineParts.length
? brandLineParts.join(";")
: displayScalarMerchantVerify(
m.merchantBrandName || m.merchantBrand
),
_emptyRightMainBrand: "",
legalPersonLine: legalParts.length ? legalParts.join(" / ") : "-",
residentContact: displayScalarMerchantVerify(m.residentContact),
......
......@@ -123,8 +123,14 @@ export const routerName = {
{
authId: "9060305",
parentId: "90603",
label: "删除",
handle: "handleDelete",
label: "禁用",
handle: "handleDisable",
},
{
authId: "90603019",
parentId: "90603",
label: "启用",
handle: "handleEnable",
},
{
authId: "90603011",
......@@ -196,7 +202,7 @@ export const routerName = {
path: "/merchantGrounding",
name: "merchantGrounding",
meta: {
title: "商户上架",
title: "商户上架编辑",
authId: "90603015",
parentId: "90603",
cache: false,
......
......@@ -26,12 +26,6 @@
<el-radio label="2">
流量方
</el-radio>
<!-- <el-radio label="7">
服务商
</el-radio>
<el-radio label="6" v-if="yqCheckVisible">
园区店
</el-radio> -->
</el-radio-group>
</el-form-item>
<el-form-item label="对账商户:" prop="merchant">
......@@ -147,7 +141,6 @@ import { localTmplList } from "./constant/baseData";
export default {
name: "DownloadAccountDialog",
components: {},
props: {
accountVisible: {
type: Boolean,
......@@ -278,16 +271,6 @@ export default {
confId: false,
confLabel: "否",
}],
// payeeTypeList: [{
// confId: 'all',
// confLabel: '全部'
// }, {
// confId: '0',
// confLabel: '嘀加收款'
// }, {
// confId: '1',
// confLabel: '门店收款'
// }],
merchantList: [],
// 流量方对账单
trafficTemplateList: [],
......@@ -313,9 +296,7 @@ export default {
},
mounted() {
// console.log(this.scene)
this.$EventBus.$on("changeFieldIds", (obj) => {
console.log(obj, "obj---");
this.tmplSelectList = obj?.fieldIds || [];
this.infoForm.fieldsTxt = this.getFieldsTxt();
this.getMetaTmpl();
......@@ -413,7 +394,6 @@ export default {
},
getFieldsTxt() {
let fieldNames = "";
const tmplName = this.localTmplList.find(item => item.type == this.infoForm.tmplType)?.name || "trafficTmpl";
console.log(tmplName, "tmplName---");
let list = JSON.parse(localStorage.getItem(tmplName));
......
......@@ -4,12 +4,10 @@
<div slot="header"
class="header"
style="background: #e7eaec">
<!-- @tab-click="tabClick" -->
<el-tabs v-model="searchForm.sceneType">
<el-tab-pane :label="newSceneList['0']" name="0" />
<el-tab-pane :label="newSceneList['1']" name="1" />
</el-tabs>
<!-- <el-card class="finance_list_summary" :body-style="{ padding: 0 }" v-show="sunmmaryVisible"> -->
<!-- 汇总模块暂不显示 -->
<el-card v-show="false"
class="finance_list_summary"
......@@ -173,7 +171,6 @@
<span class="downloadBtn">
<auth-button :show-btn-ids="['9050104']" category="Button" />
</span>
<!-- <span style="position: absolute; right: 41px; top: 42px; z-index: 999;"> -->
<span class="downloadBtn">
<!-- <el-button type="primary"
size="mini"
......@@ -966,7 +963,6 @@ export default {
},
"searchForm.sceneType": {
handler(val) {
// console.log('searchForm.sceneType', val)
if (val == 0 || val == 4) {
/**
1.0场景(暂无业务支撑)
......@@ -1246,7 +1242,6 @@ export default {
...params,
};
// const apiName = this.userInfo.beSuper ? 'getList' : 'getYqList'
// console.log(params)
// api[apiName](params).then(res => {
this.tableData = [];
......@@ -1285,7 +1280,6 @@ export default {
item = this.numAddPrefix(item);
return item;
});
// console.log(this.tableData)
this.page.currentPage = res.pageNum;
this.page.pageSize = res.pageSize;
this.total = res.total;
......@@ -1407,9 +1401,11 @@ export default {
}
if (Array.isArray(this.searchForm.baseSceneCodeList) && this.searchForm.baseSceneCodeList.length) {
const selected = this.searchForm.baseSceneCodeList;
// “全部”= 不传;否则保持数组类型传给后端
// “全部”= 不传;否则按后端需要解构成 baseSceneCodeList[0]=xxx
if (!selected.includes("")) {
params.baseSceneCodeList = selected;
selected.forEach((code, index) => {
params[`baseSceneCodeList[${index}]`] = code;
});
}
}
if (this.searchForm.sceneType) {
......@@ -1421,7 +1417,6 @@ export default {
return params;
},
getTotal() {
console.log(this.getParams());
api.getListTotal(this.getParams()).then((res) => {
this.totalObj = res;
});
......@@ -1459,7 +1454,6 @@ export default {
// 自定义模版字段
handleCustTmpl(val) {
console.log(val, "val---");
this.tmplInfo.type = val.tmplType;
this.tmplInfo.tmplSelectList = val.tmplSelectList || [];
this.handleCustVisible();
......
......@@ -1219,19 +1219,23 @@ export default {
clearUpgradeGoods() {
this.formData = {
...this.formData,
goodsAlias: '',
upgradeGoodsId: "",
goodsCode: "",
position: '',
goodsType: "",
productType: [],
baseSupplyMode: "",
upgradeSupplyMode: "",
sellPrice: "",
minSellPrice: "",
giveCostPrice: "",
recoveryCostPrice: "",
reconcilyCostPrice: "",
voucherList: [],
minSellPrice: '',
upgradeProductCost: '',
validMinSellPriceFlag: true,
giftCost: '',
recoveryCost: '',
virtualAccountCost: '',
warrantyType: [],
djCost: '',
thirdPartyCost: '',
validMinSellPrice: "Y",
sellPriceValidType: 1,
tempValidDate: [],
......
......@@ -1117,7 +1117,6 @@ export default {
return `${(Math.round(num * pow) / pow).toFixed(2)}元`;
},
handleUp(e) {
console.log(this.formData);
this.$refs[this.formRef + "d2FormRuleForm"].validate((valid, options) => {
if (valid) {
this.$emit("handleAddConfirm", { ...this.formData, num: e });
......
......@@ -416,8 +416,8 @@ export default {
return this.$message.warning("套餐总售价需大于零,请检查套餐包含产品售价");
if (merchantGoodsInfoList?.findIndex(v => this.membraneTypeList.includes(v.goodsType)) > -1 && !this.filterBaseSceneCodeBySceneType(1)?.includes(data?.baseSceneCode))
return this.$message.warning("膜类产品仅支持上架精品升级场景");
if (this.extendedPosiType.includes(data.goodsType) && !this.filterBaseSceneCodeBySceneType(0)?.includes(data?.baseSceneCode))
return this.$message.warning("延保类产品仅支持上架至延保&权益业务场景 ");
if (merchantGoodsInfoList?.findIndex(v => this.extendedPosiType?.concat(this.equitySceneType)?.includes(v.goodsType)) > -1 && !this.filterBaseSceneCodeBySceneType(0)?.includes(data?.baseSceneCode))
return this.$message.warning("延保、权益类产品仅支持上架至延保&权益业务场景");
this.editData = data;
// 判断套餐的所有子产品适用车型是否存在交集(无适用车型默认为全部)
let seriesIdFlag = false;
......
......@@ -208,7 +208,8 @@ export default {
customerLabel: val?.customerLabel,
supplySource: val?.supplySource ? val?.supplySource?.split(',') : [],
remark: val.remark,
checked: false
checked: false,
merchantGoodsExist: val.merchantGoodsExist
}
})
// 从产品清单上架产品带入数据
......
......@@ -1691,6 +1691,7 @@ export default {
item.customerLabel = temp.customerLabel
item.supplySource = temp.supplySource
item.remark = temp.remark
item.merchantGoodsExist = temp.merchantGoodsExist
break;
}
}
......
......@@ -141,7 +141,12 @@ export default {
recordInfo: {
type: Object,
default: () => { }
}
},
/** 与订单列表场景一致,分账规则查询需带上 */
baseSceneCode: {
type: String,
default: "",
},
},
components: {
......@@ -169,7 +174,11 @@ export default {
const sceneType = this.recordInfo.sceneType
const params = {
merchantId,
sceneType
sceneType,
}
const baseSceneCode = this.baseSceneCode || this.recordInfo?.baseSceneCode
if (baseSceneCode) {
params.baseSceneCode = baseSceneCode
}
const res = await getHistoryEffectRecord(params)
......
......@@ -397,7 +397,7 @@
<!-- 选择分账规则 -->
<ChooseRuleDialog v-if="ruleVisible" :record-info="recordInfo" :rule-visible="ruleVisible"
@dialogClose="ruleDialogClose" />
:base-scene-code="baseSceneCode" @dialogClose="ruleDialogClose" />
<!-- 分账记录 -->
<RuleInfoDialog v-if="ruleInfoVisible" :record-info="recordInfo" :rule-info-visible="ruleInfoVisible"
@dialogClose="ruleInfoDialogClose" />
......
......@@ -83,8 +83,8 @@
@click="handleEdit(scope.scope)"
>编辑</el-button>
<!--👇 仅审批状态=“已驳回”“已撤销”“通过后撤销”的记录可操作 -->
<!-- v-if="[3,4,5].includes(scope.scope.approveStatus)" -->
<el-button
v-if="[3,4,5].includes(scope.scope.approveStatus)"
type="text"
@click="handleEdit(scope.scope,'reapply')"
>重新发起</el-button>
......@@ -96,6 +96,7 @@
<script>
import { Util, deepClone } from '@/common/util'
import dayjs from 'dayjs';
import {
approveStatusOpt
} from "@/common/constants.js";
......@@ -235,7 +236,10 @@ export default {
},
{
label: '提交时间',
prop: 'submitDate',
formatter: (cellValue) => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
},
minWidth: 120,
},
{
label: '提交人',
......
......@@ -3,7 +3,7 @@
<el-form
ref="formRef"
label-width="150px"
label-width="155px"
:model="componentData"
:size="size"
:rules="rules"
......@@ -24,13 +24,18 @@
class="business-information-item"
:label="i.label + ':'"
:key="`businessInformation${index}`"
:prop="i.key"
:prop="isViewMode ? '' : i.key"
>
<template v-if="i.type == 'text' || isViewMode">{{ componentData[i.key] || '-' }}</template>
<template v-if="i.type == 'text' || isViewMode">
<template v-if="componentData[i.key] != null">
{{ componentData[i.key] }}<template v-if="i.unit">{{ i.unit }}</template>
</template>
<template v-else></template>
</template>
<template v-else>
<el-input
v-model="componentData[i.key]"
@input="filterInputVal(i,$event,'data')"
@input="filterInputVal(i,$event,'componentData')"
:maxlength="i.maxlength || -1"
></el-input>
</template>
......@@ -91,7 +96,8 @@ export default {
productCost = 0,
recyclingFilm = 0
productDetails.forEach(item => {
revenue = NP.plus(revenue, item.revenue || 0)
const lineRev = item.estimatedRevenue != null ? item.estimatedRevenue : item.revenue
revenue = NP.plus(revenue, lineRev || 0)
trafficFee = NP.plus(trafficFee, item.trafficFee || 0)
marketFee1 = NP.plus(marketFee1, item.marketFee1 || 0)
marketFee2 = NP.plus(marketFee2, item.marketFee2 || 0)
......@@ -124,11 +130,33 @@ export default {
let { productDetails, djGrossProfit } = this,
revenue = 0
productDetails.forEach(item => {
revenue = NP.plus(revenue, item.revenue || 0)
const lineRev = item.estimatedRevenue != null ? item.estimatedRevenue : item.revenue
revenue = NP.plus(revenue, lineRev || 0)
})
if (revenue === 0) return '0.00%'
const gpr = NP.times(NP.divide(djGrossProfit, revenue), 100)
return NP.round(gpr, 2) + '%'
// 检查边界情况
if (revenue === 0 || !isFinite(revenue)) return '0.00%'
if (!isFinite(djGrossProfit)) return '0.00%'
try {
// 使用原生除法,然后手动控制精度
const division = djGrossProfit / revenue
// 检查结果是否有效
if (!isFinite(division)) return '0.00%'
// 转换为百分比并保留2位小数(四舍五入)
const percentage = division * 100
const roundedPercentage = Math.round(percentage * 100) / 100
// 最终检查
if (!isFinite(roundedPercentage)) return '0.00%'
return roundedPercentage.toFixed(2) + '%'
} catch (error) {
console.error('毛利率计算错误:', error)
return '0.00%'
}
}
},
data () {
......@@ -139,8 +167,8 @@ export default {
{ label: '嘀加毛利率', key: 'djGpr', type: 'text' },
],
businessInformation: [
{ label: '预估交付数/月', key: 'deliveryCount', filterRule: 'integerRange', min: 0, max: 999999, maxlength: 6 },
{ label: '预估触客率', key: 'customerTouchRate', filterRule: 'decimalRange', min: 0, max: 100, precision: 2 },
{ label: '预估交付数/月', key: 'deliveryCount', filterRule: 'integerRange', min: 0, max: 999999 },
{ label: '预估触客率', key: 'customerTouchRate', unit: '%', filterRule: 'decimalRange', min: 0, max: 100, precision: 2 },
{ label: '人员成本', key: 'personnelCost', filterRule: 'decimalRange', min: 0, max: 999999, precision: 2 },
{ label: '房租', key: 'rentCost', filterRule: 'decimalRange', min: 0, max: 999999, precision: 2 },
{ label: '折旧与摊销', key: 'depreciationCost', filterRule: 'decimalRange', min: 0, max: 999999, precision: 2 },
......
......@@ -22,7 +22,6 @@
label-width="150px"
:model="componentData"
:size="size"
:rules="rules"
>
<template v-for="(item,index) in salesCategoryList">
<div
......@@ -36,9 +35,11 @@
class="sales-category-item"
:label="i.label + ':'"
:key="ind"
:prop="i.key"
>
{{ componentData[i.key] != null ? componentData[i.key] : '-' }}
<template v-if="componentData[i.key] != null">
{{ componentData[i.key] }}<template v-if="i.unit">{{ i.unit }}</template>
</template>
<template v-else>-</template>
</el-form-item>
</template>
......@@ -56,7 +57,7 @@
<script type='text/ecmascript-6'>
import { deepClone } from '@/common/util'
import { SALES_CATEGORY_LIST, SALES_CATEGORY_RULES } from './constant'
import { SALES_CATEGORY_LIST } from './constant'
import EditSalesCategory from './EditSalesCategory.vue'
export default {
name: 'SalesCategory',
......@@ -80,7 +81,7 @@ export default {
watch: {
data: {
handler (newVal) {
this.componentData = deepClone(newVal)
if (newVal !== null && typeof newVal === 'object' && Object.keys(newVal).length) this.componentData = deepClone(newVal)
},
deep: true,
immediate: true
......@@ -98,7 +99,6 @@ export default {
salesCategoryList: deepClone(SALES_CATEGORY_LIST),
salesCategoryDetailVisible: false,
currentItem: {},
rules: SALES_CATEGORY_RULES
}
},
mounted () {
......
const { util } = require("echarts")
const SALES_CATEGORY_LIST = [
{
title: '销售范围', list: [
......@@ -14,14 +16,14 @@ const SALES_CATEGORY_LIST = [
},
{
title: '兜底要求', list: [
{ label: '渗透率', key: 'penetrationRate', type: 'input', filterRule: 'decimalRange', min: 0, max: 100, precision: 2 },
{ label: '转化率', key: 'conversionRate', type: 'input', filterRule: 'decimalRange', min: 0, max: 100, precision: 2 },
{ label: '渗透率', key: 'penetrationRate', unit: '%', type: 'input', filterRule: 'decimalRange', min: 0, max: 100, precision: 2 },
{ label: '转化率', key: 'conversionRate', unit: '%', type: 'input', filterRule: 'decimalRange', min: 0, max: 100, precision: 2 },
{ label: '单车采购产值', key: 'revenuePerCar', type: 'input', filterRule: 'decimalRange', min: 0, max: 999999, precision: 2 },
]
},
{
title: '预估经营数据', list: [
{ label: '转化率', key: 'estimatedConversionRate', type: 'input', filterRule: 'decimalRange', min: 0, max: 100, precision: 2 },
{ label: '转化率', key: 'estimatedConversionRate', unit: '%', type: 'input', filterRule: 'decimalRange', min: 0, max: 100, precision: 2 },
{ label: '升级客单价', key: 'upgradePrice', type: 'input', filterRule: 'decimalRange', min: 0, max: 999999, precision: 2 },
{ label: '产值', key: 'revenue', type: 'input', filterRule: 'decimalRange', min: 0, max: 999999, precision: 2 },
]
......@@ -61,9 +63,9 @@ const SALES_CATEGORY_RULES = {
penetrationRate: [{ required: true, validator: VAILIDATOR_FROM, trigger: 'blur' }],
conversionRate: [{ required: true, validator: VAILIDATOR_FROM, trigger: 'blur' }],
revenuePerCar: [{ required: true, validator: VAILIDATOR_FROM, trigger: 'blur' }],
estimatedConversionRate: [{ required: true, validator: VAILIDATOR_FROM, trigger: 'blur' }],
upgradePrice: [{ required: true, validator: VAILIDATOR_FROM, trigger: 'blur' }],
revenue: [{ required: true, validator: VAILIDATOR_FROM, trigger: 'blur' }],
estimatedConversion: [{ required: true, validator: VAILIDATOR_FROM, trigger: 'blur' }],
estimatedUpgradePrice: [{ required: true, validator: VAILIDATOR_FROM, trigger: 'blur' }],
estimatedRevenue: [{ required: true, validator: VAILIDATOR_FROM, trigger: 'blur' }],
trafficFee: [{ required: true, validator: VAILIDATOR_FROM, trigger: 'blur' }],
marketFee1: [{ required: true, validator: VAILIDATOR_FROM, trigger: 'blur' }],
marketFee2: [{ required: true, validator: VAILIDATOR_FROM, trigger: 'blur' }],
......
......@@ -15,6 +15,11 @@ export default {
// 只保留数字
let filtered = (val || '').replace(/\D/g, '');
// 去除前导零(但保留单独的0)
if (filtered.length > 1) {
filtered = filtered.replace(/^0+/, '');
}
// 转换为数字进行范围检查
const numValue = parseInt(filtered, 10);
......@@ -32,10 +37,23 @@ export default {
if (parts.length > 2) {
filtered = parts[0] + '.' + parts.slice(1).join('');
}
// 重新分割,确保处理正确
const newParts = filtered.split('.');
// 去除整数部分的前导零(但保留单独的0或小数点前的0)
if (newParts[0].length > 1) {
newParts[0] = newParts[0].replace(/^0+/, '');
}
// 限制小数位数
if (parts.length === 2 && parts[1].length > i.precision) {
filtered = parts[0] + '.' + parts[1].substring(0, i.precision);
if (newParts.length === 2 && newParts[1].length > i.precision) {
newParts[1] = newParts[1].substring(0, i.precision);
}
// 重新组合
filtered = newParts.join('.');
// 转换为数字进行范围检查
const numValue = parseFloat(filtered);
// 如果超出最大值,限制为最大值
......@@ -46,7 +64,6 @@ export default {
filtered = String(i.max);
}
}
this.$set(this[keyName], i.key, filtered);
}
}
......
......@@ -79,6 +79,15 @@
<template v-if="isViewMode">
<div class="step-content">
<div class="step-title">操作记录</div>
<div class="log-box">
<template v-for="(log,logIndex) in operateLogs">
<div class="log-item">
<div class="log-title">{{ logTitle(log) }}</div>
<div class="log-name">操作人:{{ log.operatorName || '-' }}</div>
<div class="log-time">操作时间:{{ logTime(log.operateDate) }}</div>
</div>
</template>
</div>
</div>
</template>
</el-scrollbar>
......@@ -91,7 +100,7 @@ import BusinessInformation from './components/BusinessInformation.vue'
import SalesCategory from './components/SalesCategory.vue'
import { storeApproveQueryDetail } from '@/api/salesManagement.js'
import { deepClone } from "@/common/util";
import dayjs from 'dayjs';
export default {
name: 'StepTwo',
components: { BasicInformation, TrafficProviderInformation, BusinessInformation, SalesCategory },
......@@ -160,6 +169,7 @@ export default {
basicinformationData: {}, // 基础信息数据
basicinformationFormList: [], // 基础信息表单列表
trafficProviderInformationDisabled: false,
operateLogs: []
}
},
......@@ -169,6 +179,7 @@ export default {
init ({
basicinformationFormList,
basicinformationData,
operateLogs,
infoForm
}) {
this.basicinformationFormList = basicinformationFormList
......@@ -178,6 +189,7 @@ export default {
})
this.infoForm.trafficPartyDetails = infoForm
this.trafficPartyId = infoForm[0].trafficPartyId
this.operateLogs = operateLogs
},
editTrafficProviderInformation (e) {
this.trafficProviderInformationDisabled = e
......@@ -234,6 +246,10 @@ export default {
delete componentData.areaOpIdList
delete componentData.onlineOpIdList
delete componentData.regionSupervisorIdList
if (typeof trafficProviderInformationRef.buildOtherServiceProvidersForSubmit === 'function') {
Object.assign(componentData, trafficProviderInformationRef.buildOtherServiceProvidersForSubmit())
}
delete componentData.otherServiceProvidersIdList
trafficValidationData = componentData
}
resolve(valid)
......@@ -259,9 +275,9 @@ export default {
penetrationRate: '兜底要求-渗透率',
conversionRate: '兜底要求-转化率',
revenuePerCar: '兜底要求-单车采购产值',
estimatedConversionRate: '预估经营数据-转化率',
upgradePrice: '预估经营数据-升级客单价',
revenue: '预估经营数据-产值',
estimatedConversion: '预估经营数据-转化率',
estimatedUpgradePrice: '预估经营数据-升级客单价',
estimatedRevenue: '预估经营数据-产值',
trafficFtrafficFeeee: '商务政策-流量费',
marketFee1: '商务政策-管理层市场费1',
marketFee2: '商务政策-管理层市场费2',
......@@ -302,7 +318,17 @@ export default {
.catch(() => {
callback(false)
})
}
},
logTitle (item) {
return {
1: '记录创建',
5: '转OA',
7: '完成',
}[item.operatorType] || item.operateDesc || '未知操作'
},
logTime (time) {
return dayjs(time).format('YYYY-MM-DD HH:mm:ss')
},
}
}
......@@ -325,4 +351,22 @@ export default {
.step-button {
margin-left: auto;
}
.log-box {
padding: 0 20px 20px;
}
.log-item {
display: flex;
margin-top: 20px;
color: rgba(51, 51, 51, 1);
font-size: 14px;
gap: 20px;
.log-title {
min-width: 68px;
flex-shrink: 0;
}
.log-name {
min-width: 200px;
flex-shrink: 0;
}
}
</style>
\ No newline at end of file
......@@ -46,7 +46,8 @@
:show-close="false"
title="提示"
:visible.sync="dialogVisible"
width="30%"
width="40%"
:close-on-press-escape="false"
>
<template v-if="!updateStatus">
<div class="dialog-content">
......@@ -61,31 +62,37 @@
<template v-else>
<div
v-if="errorFileUrl"
class="dialog-content"
class="dialog-content left"
>
<div class="dialog-tips-big">
处理失败。可点击 <span>下载失败模版</span> 查看失败原因。
<i class="el-icon-warning"></i>
处理失败。可点击 <span @click="downloadError">下载失败模版</span> 查看失败原因。
</div>
</div>
<div
v-else
class="dialog-content"
class="dialog-content left"
>
<div class="dialog-tips-big">
<i class="el-icon-success"></i>
处理成功,可返回列表查看。
</div>
</div>
</template>
<template #footer>
<span class="dialog-footer">
<el-button
v-if="updateStatus"
type="primary"
@click="nextStep"
>
{{!errorFileUrl ? '继续下一步' : '确定'}}
</el-button>
</span>
<template
v-if="updateStatus"
#footer
>
<template>
<span class="dialog-footer">
<el-button
type="primary"
@click="nextStep"
>
{{!errorFileUrl ? '继续下一步' : '确定'}}
</el-button>
</span>
</template>
</template>
</el-dialog>
......@@ -94,14 +101,18 @@
:show-close="false"
title="提示"
:visible.sync="successDialogVisible"
width="30%"
width="40%"
:close-on-press-escape="false"
>
<div class="dialog-content">
<div class="dialog-tips-big">
提交成功
</div>
<div class="dialog-tips-small">
因数据量较大,系统处理预计需要几分钟,请耐心等待。您可在当前页面继续等待或返回列表。处理完成后,系统将自动为您提交至OA审核,
<div class="dialog-content success-dialog-content">
<i class="el-icon-success"></i>
<div class="dialog-info">
<div class="dialog-tips-big">
提交成功。
</div>
<div class="dialog-tips-small">
因数据量较大,系统处理预计需要几分钟,请耐心等待。您可在当前页面继续等待或返回列表。处理完成后,系统将自动为您提交至OA审核。
</div>
</div>
</div>
<template #footer>
......@@ -179,7 +190,7 @@ export default {
methods: {
async getDetail (businessCode, pageType) {
const data = await storeApproveQueryDetail({ businessCode }),
{ basicApproveInfo, trafficPartyDetails, baseSceneCode } = data
{ basicApproveInfo, trafficPartyDetails, baseSceneCode, operateLogs } = data
this.baseSceneCode = baseSceneCode
let basicinformationFormList = JSON.parse(basicApproveInfo)
if (pageType != 'reapply') {
......@@ -189,19 +200,29 @@ export default {
this.stepTwoRef.init({
basicinformationFormList,
basicinformationData: data,
infoForm: trafficPartyDetails
infoForm: trafficPartyDetails,
operateLogs
})
})
} else {
this.pageComplete = true
let { trafficPartyId, trafficPartyName } = trafficPartyDetails[0]
let infoForm = {
merchantId: data.merchantId,
shelfType: data.shelfType,
sceneType: data.sceneType,
baseSceneCode: data.baseSceneCode,
}
if (data.shelfType == 1) {
infoForm.merchantId = String(trafficPartyId);
infoForm.merchantName = trafficPartyName;
}
let files = []
basicinformationFormList.map(e => {
infoForm[e.controlId] = e.value
if (e.inputType == 7 && e.files) files = e.files
})
this.templateInfo.map(e => {
if (e.inputType == 7) e.files = files
})
this.$nextTick(() => {
this.stepOneRef.init(infoForm)
......@@ -357,6 +378,15 @@ export default {
this.errorFileUrl = ""
this.updateStatus = false
},
downloadError () {
const link = document.createElement("a");
link.href = this.errorFileUrl
link.download = '失败模板';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(link.href);
}
}
}
</script>
......@@ -394,20 +424,76 @@ export default {
.fixed-btn-box {
height: 86px;
}
::v-deep.el-dialog__wrapper {
display: flex;
align-items: center;
justify-content: center;
.el-dialog__header {
padding: 11.5px 16px;
color: rgba(51, 51, 51, 1);
font-size: 18px;
font-weight: 500;
line-height: 21px;
}
.el-dialog {
margin: 0 auto !important;
border-radius: 8px !important;
}
.el-dialog__body {
padding: 16px 20px;
}
}
.dialog-content {
text-align: center;
i {
font-size: 24px;
margin-right: 10px;
}
.el-icon-warning {
color: rgba(245, 150, 25, 1);
}
.el-icon-success {
color: rgba(44, 202, 116, 1);
}
.dialog-tips-big {
font-size: 16px;
color: #333333;
margin-bottom: 20px;
font-size: 14px;
color: rgba(51, 51, 51, 1);
display: flex;
align-items: center;
justify-content: center;
span {
cursor: pointer;
color: rgba(42, 88, 173, 1);
}
}
.dialog-tips-small {
max-width: 318px;
margin: 10px auto 12px;
font-size: 12px;
color: #666666;
color: rgba(153, 153, 153, 1);
}
}
.left {
text-align: left;
.dialog-tips-big {
justify-content: flex-start;
}
}
.success-dialog-content {
display: flex;
.dialog-tips-big {
justify-content: flex-start;
}
.dialog-tips-small {
max-width: 100%;
margin: 0 auto;
}
.dialog-tips-big,
.dialog-tips-small {
color: rgba(51, 51, 51, 1);
line-height: 20px;
font-size: 14px;
text-align: left;
}
}
}
......
......@@ -54,16 +54,11 @@ export default {
activeTab: 'store',
merchantLoading: false,
merchantInfo: {},
/** 与示意图一致:左列 商户类型/账户等级/渠道/商户名称/商户地址/主营品牌/登录账号;右列 上级商户/开通模式/电话/密码 */
merchantFormData: [{
label: '商户类型',
name: 'merchantType',
type: 'showTxt',
style: { width: '100%', marginRight: '0px' },
txtStyle: { ...contentStyle, width: '890px' }
}, {
label: '账户等级',
name: 'accountLevel',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle
}, {
......@@ -73,8 +68,8 @@ export default {
style: editItemStyle,
txtStyle: contentStyle
}, {
label: '渠道',
name: 'superChannel',
label: '账户等级',
name: 'accountLevel',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle
......@@ -85,30 +80,34 @@ export default {
style: editItemStyle,
txtStyle: contentStyle
}, {
label: '商户名称',
name: 'merchantName',
label: '渠道',
name: 'superChannel',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle
}, {
label: '',
name: '_emptyRightMerchantName',
label: '联系电话',
name: 'contactPhone',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle,
formatter: () => ''
txtStyle: contentStyle
}, {
label: '商户号',
name: 'merchantNo',
label: '商户名称',
name: 'merchantName',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle
}, {
label: '商户ID',
name: 'merchantInnerId',
label: '登录密码',
name: 'loginPasswordMasked',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle
txtStyle: contentStyle,
formatter: (formObj) => {
return formObj.loginPasswordMasked != null && formObj.loginPasswordMasked !== ''
? formObj.loginPasswordMasked
: '-'
}
}, {
label: '商户地址',
name: 'merchantAddress',
......@@ -116,18 +115,6 @@ export default {
style: { width: '100%', marginRight: '0px' },
txtStyle: { ...contentStyle, width: '890px' }
}, {
label: '行政区划',
name: 'regionLine',
type: 'showTxt',
style: { width: '100%', marginRight: '0px' },
txtStyle: { ...contentStyle, width: '890px' }
}, {
label: '经纬度',
name: 'lngLatLine',
type: 'showTxt',
style: { width: '100%', marginRight: '0px' },
txtStyle: { ...contentStyle, width: '890px' }
}, {
label: '主营品牌',
name: 'mainBrands',
type: 'showTxt',
......@@ -141,40 +128,18 @@ export default {
txtStyle: contentStyle,
formatter: () => ''
}, {
label: '法人及联系电话',
name: 'legalPersonLine',
type: 'showTxt',
style: { width: '100%', marginRight: '0px' },
txtStyle: { ...contentStyle, width: '890px' }
}, {
label: '驻店联系人',
name: 'residentContact',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle
}, {
label: '联系电话',
name: 'contactPhone',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle
}, {
label: '登录账号',
name: 'loginAccount',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle
}, {
label: '登录密码',
name: 'loginPasswordMasked',
label: '',
name: '_emptyRightLoginAccount',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle,
formatter: (formObj) => {
return formObj.loginPasswordMasked != null && formObj.loginPasswordMasked !== ''
? formObj.loginPasswordMasked
: '-'
}
formatter: () => ''
}]
}
},
......@@ -225,28 +190,27 @@ export default {
this.merchantInfo = {
merchantType: '-',
accountLevel: '-',
parentMerchantName: '-',
superChannel: '-',
openMode: '-',
merchantName: '-',
_emptyRightMerchantName: '',
merchantNo: '-',
merchantInnerId: '-',
merchantAddress: '-',
regionLine: '-',
lngLatLine: '-',
mainBrands: '-',
_emptyRightMainBrand: '',
legalPersonLine: '-',
residentContact: '-',
contactPhone: '-',
loginAccount: '-',
loginPasswordMasked: '-'
parentMerchantName: '-',
openMode: '-',
contactPhone: '-',
loginPasswordMasked: '-',
_emptyRightMainBrand: '',
_emptyRightLoginAccount: ''
}
},
applyMerchantInfo(mi) {
this.merchantInfo = buildMerchantVerifyEchoDisplay(mi)
const built = buildMerchantVerifyEchoDisplay(mi)
this.merchantInfo = {
...built,
_emptyRightMainBrand: '',
_emptyRightLoginAccount: ''
}
},
fetchMerchantVerificationDetail() {
......
export const busTypeOpt = [
{
confId: "1",
confLabel: "1.1 精品升级"
},
{
confId: "2",
confLabel: "2.1 权益升级"
},
{
confId: "3",
confLabel: "2.2 续保积分"
},
{
confId: "4",
confLabel: "2.3 延保升级"
},
{
confId: "5",
confLabel: "6.1 二手车"
}
]
{
confId: "1",
confLabel: "1.1 精品升级",
},
{
confId: "2",
confLabel: "2.1 权益升级",
},
{
confId: "3",
confLabel: "2.2 续保积分",
},
{
confId: "4",
confLabel: "2.3 延保升级",
},
{
confId: "5",
confLabel: "6.1 二手车",
},
];
export const potentialCustomerOpt = [
{
confId: 1,
confLabel: "跟进中"
},
{
confId: 2,
confLabel: "未签约"
},
{
confId: 3,
confLabel: "已签约"
},
{
confId: 4,
confLabel: "已绑定"
}
]
{
confId: 1,
confLabel: "跟进中",
},
{
confId: 2,
confLabel: "未签约",
},
{
confId: 3,
confLabel: "已签约",
},
{
confId: 4,
confLabel: "已绑定",
},
];
export const cooperModeOpt = [
{
confId: "1",
confLabel: "直营"
},
{
confId: "2",
confLabel: "服务商"
}
]
{
confId: "1",
confLabel: "直营",
},
{
confId: "2",
confLabel: "服务商",
},
];
export const flowSituateOpt = [
{
confId: "1",
confLabel: "30以下"
},
{
confId: "2",
confLabel: "30-50"
},
{
confId: "3",
confLabel: "50-80"
},
{
confId: "4",
confLabel: "80-120"
},
{
confId: "5",
confLabel: "120以上"
}
]
{
confId: "1",
confLabel: "30以下",
},
{
confId: "2",
confLabel: "30-50",
},
{
confId: "3",
confLabel: "50-80",
},
{
confId: "4",
confLabel: "80-120",
},
{
confId: "5",
confLabel: "120以上",
},
];
<!-- 适用人员列表(纯展示) -->
<template>
<div class="white-staff-list">
<baseDialog :config="footerConfig"
:dialog-config="dialogConfig"
:is-show.sync="visible">
<el-table border
:cell-style="bodyCellStyle"
class="staff-table"
:data="displayList"
:header-cell-style="headerCellStyle"
:max-height="tableMaxHeight">
<el-table-column align="center"
label="序号"
type="index"
width="72" />
<el-table-column align="center"
label="员工姓名"
min-width="120"
prop="staffName"
show-overflow-tooltip />
<el-table-column align="center"
label="手机号"
min-width="140"
prop="staffPhone"
show-overflow-tooltip />
</el-table>
</baseDialog>
</div>
</template>
<script>
/** 表头背景色 */
const HEADER_BG = "#F2F4F7";
/** 表格最大高度(px),超出后表体内部滚动、表头固定 */
const TABLE_MAX_HEIGHT = 420;
export default {
name: "WhiteStaffList",
props: {
staffListVisible: {
type: Boolean,
default: false,
},
/** 行数据字段:staffName、staffPhone(可按需扩展列) */
staffList: {
type: Array,
default: () => [],
},
},
data() {
return {
dialogConfig: {
title: "适用人员",
width: "720px",
},
footerConfig: {
isShowFooter: true,
hideConfirmBtn: true,
cancel_name: "关闭",
},
headerCellStyle: {
background: HEADER_BG,
},
tableMaxHeight: TABLE_MAX_HEIGHT,
};
},
computed: {
visible: {
get() {
return this.staffListVisible;
},
set(val) {
this.$emit("dialogClose", {
flag: val,
attrName: "staffListVisible",
});
},
},
displayList() {
return Array.isArray(this.staffList) ? this.staffList : [];
},
},
methods: {
bodyCellStyle() {
return {
color: "#333333",
fontSize: "14px",
};
},
},
};
</script>
<style scoped lang="scss">
.white-staff-list {
$table-border: #e5e5e5;
.staff-table {
width: 100%;
}
::v-deep .el-table--border,
::v-deep .el-table--border::after,
::v-deep .el-table--border::before {
border-color: $table-border;
}
::v-deep .el-table--border td,
::v-deep .el-table--border th {
border-color: $table-border;
}
/* 表头/表体单元格上下内边距 14px(覆盖 public.scss 等全局对 td 的 !important) */
::v-deep .staff-table.el-table thead th,
::v-deep .staff-table.el-table tbody td {
padding-top: 14px !important;
padding-bottom: 14px !important;
}
::v-deep .staff-table.el-table .cell {
color: #333333;
font-size: 14px;
font-weight: 400;
text-align: center;
}
/* 底部关闭按钮:靠右;样式见需求 */
::v-deep .dialog-footer {
align-items: center;
box-sizing: border-box;
display: flex;
justify-content: flex-end;
padding: 14px 20px 14px;
}
::v-deep .dialog-footer .el-button {
background: #e8e8e8;
border: 1px solid #d1d1d1;
border-radius: 4px;
box-sizing: border-box;
color: #666666;
font-size: 14px;
font-weight: 400;
height: 32px;
line-height: 30px;
min-width: 64px !important;
opacity: 1;
padding: 0;
width: 64px;
}
::v-deep .dialog-footer .el-button:hover,
::v-deep .dialog-footer .el-button:focus {
background: #e0e0e0;
border-color: #d1d1d1;
color: #666666;
}
}
</style>
......@@ -54,7 +54,6 @@
</template>
<script>
// import { getList } from "@api/serviceManage";
import { disableScene, enableScene, getList, getSceneTags } from "@api/senseManage";
import { mapActions } from "vuex";
import { procureModeList } from "@/common/constants";
......
......@@ -1916,37 +1916,48 @@ export default {
// }
},
getProgress() {
// groupDivisionRuleId:118
this.goodsTypeGroupDivisionId
&& divisionRuleTestGet({
if (!this.goodsTypeGroupDivisionId)
return;
divisionRuleTestGet({
goodsTypeGroupDivisionId: this.goodsTypeGroupDivisionId,
}).then((result) => {
// const { notInForceAccountMerchantMap, divisionRuleTestMap } = result
const { notInForceAccountMerchants, divisionRuleTests } = result;
if (!result)
return;
const {
notInForceAccountMerchants,
divisionRuleTests,
subProgress,
accountValidMerchants,
} = result;
// 如果有没有管理的虚拟对公账户
if (notInForceAccountMerchants) {
this.tipsDialogVisible = true;
this.accountValidMerchants = notInForceAccountMerchants;
return;
}
// const { subProgress, accountValidMerchants } = result
// 没有虚拟对公账户
// if (subProgress == 32) {
// this.tipsDialogVisible = true
// this.accountValidMerchants = accountValidMerchants
// }
// console.log([34, 35, 36, 31].includes(subProgress))
// [34, 35, 36, 31].includes(subProgress)
// 需要做分账测算
if (divisionRuleTests) {
if (divisionRuleTests.length == 1) {
if (subProgress == 32) {
this.tipsDialogVisible = true;
this.accountValidMerchants = accountValidMerchants;
return;
}
if (Array.isArray(divisionRuleTests) && divisionRuleTests.length > 0) {
if (divisionRuleTests.length === 1) {
this.channelConfirm(divisionRuleTests[0]);
} else {
this.channelSelectDialogVisible = true;
this.divisionRuleTests = divisionRuleTests;
}
return;
}
const sp = Number(subProgress);
if ([34, 35, 36, 31].includes(sp)) {
this.financialCalculationVisible = true;
this.financialCalculationObj = result;
}
}).catch((err) => {
console.error("[FinancialRules/classificationCpt] getProgress", err);
});
},
channelConfirm(result) {
......
......@@ -185,6 +185,11 @@ import {
rebuildFinancialCrossTabGoodsSelections
} from "../merchantStep/utils/reconciliationShared"
import {
getStableReconciliationRuleId,
mergeReconciliationRuleServerFields
} from "../merchantStep/utils/reconciliationIncrementalRules"
import {
appendDeleteOpsToIncremental,
buildGoodsTypeGroupIncrementalRules,
mergeChildClassificationPayload
} from "./utils/classificationRuleCache"
......@@ -278,7 +283,7 @@ export default {
djzhySubMerchantName: ""
},
effectStartDate: false, // 规则时间 true 表示可以立即生效 是否立即生效
/** 会话内删除的已落库分账品类规则 id,随 save 一并提交给后端 */
/** 本会话删除的已落库分账品类规则快照;提交前并入 goodsTypeGroupRules(type=DELETE),不向接口单独字段传(名历史遗留:兼容仅 push id) */
pendingDeletedGroupDivisionRuleIds: [],
/** 费用类目冲突检测用:与 editableTabs 下标对齐的全量规则视图 */
_fullMergedGoodsTypeGroupRulesForConflict: null,
......@@ -988,20 +993,13 @@ export default {
const upgradeArr = []
const packageArr = []
let startNum = 0
this.editableTabs = []
if (goodsTypeGroupRules[0].groupType == 2) {
goodsTypeGroupRules.unshift({ groupType: 1 })
}
goodsTypeGroupRules.forEach((item, index) => {
if (index == 0 && item.groupType == 2) {
startNum = 1
}
this.editableTabs[index] = {
title:
item.groupType == 1
? "全部品类"
: "特殊品类" + (index + startNum),
title: index ? "特殊品类" + index : "全部品类",
name: (index + 1).toString(),
testFlag: item.testFlag == "N" ? "N" : "Y",
groupDivisionRuleId:
......@@ -1167,6 +1165,10 @@ export default {
this.submitParams.effectStartDate = effectStartDate
? effectStartDate + " 00:00:00"
: ""
this.submitParams.goodsTypeGroupRules = appendDeleteOpsToIncremental(
this.submitParams.goodsTypeGroupRules || [],
this.pendingDeletedGroupDivisionRuleIds || []
)
merchantSettleDistributeRule({ json: JSON.stringify(this.submitParams) })
.then((result) => {
// 判断是否有没有进行过分账测试的账号
......@@ -1310,8 +1312,10 @@ export default {
delete restPayload.goodsTypeGroupRules
this.submitParams = {
...restPayload,
goodsTypeGroupRules: ruleResult.incrementalRules,
deletedGroupDivisionRuleIds: ruleResult.deletedGroupDivisionRuleIds || []
goodsTypeGroupRules: appendDeleteOpsToIncremental(
ruleResult.incrementalRules || [],
this.pendingDeletedGroupDivisionRuleIds || []
)
}
if (!this.checkCalculateType()) return
this.verificationCodeVisible = true
......@@ -1434,15 +1438,14 @@ export default {
/**
* 收集分账品类规则:对每个规则 Tab 槽位做纯数据校验(含接口回填未改动的行),失败即停并仅在该 Tab 调用 el-form 标红。
* 全量保存(onlyActiveTab 为 false):参与增量提交的下标(indicesForIncremental)仍为「曾触碰」或「本会话新增未落库」的 Tab,与提交流程一致;
* 全量/测算均对 allRuleTabIndices 做校验。增量 goodsTypeGroupRules 带 type(ADD/UPDATE);删除 id 见 pendingDeletedGroupDivisionRuleIds。
* 全量/测算均对 allRuleTabIndices 做校验。增量 goodsTypeGroupRules 带 type ADD/UPDATE;DELETE 由 submit / codeHandleConfirm 与 pendingDeletedGroupDivisionRuleIds 合并。
* 冲突检测:返回 fullMergedRules(与 Tab 下标对齐的全量视图)。
*
* @returns {Promise<{ ok: boolean, incrementalRules: Array, fullMergedRules: Array|null, deletedGroupDivisionRuleIds: Array, firstErrorTabIndex?: number }>}
* @returns {Promise<{ ok: boolean, incrementalRules: Array, fullMergedRules: Array|null, firstErrorTabIndex?: number }>}
*/
async getGoodsTypeGroupRules(_list, options = {}) {
const onlyActiveTab = options.onlyActiveTab === true
const startTabName = this.editableTabsValue
const deletedGroupDivisionRuleIds = [...this.pendingDeletedGroupDivisionRuleIds]
const allRuleTabIndices = []
for (let ti = 0; ti < this.editableTabs.length; ti++) {
......@@ -1466,8 +1469,7 @@ export default {
return {
ok: false,
incrementalRules: [],
fullMergedRules: null,
deletedGroupDivisionRuleIds
fullMergedRules: null
}
}
} else {
......@@ -1505,8 +1507,7 @@ export default {
return {
ok: true,
incrementalRules: [],
fullMergedRules: fullMerged,
deletedGroupDivisionRuleIds
fullMergedRules: fullMerged
}
}
......@@ -1550,12 +1551,23 @@ export default {
ok: false,
incrementalRules: [],
fullMergedRules: null,
deletedGroupDivisionRuleIds,
firstErrorTabIndex: tabindex
}
}
const prepared = prepareRuleForValidation(rulePayload)
let prepared = prepareRuleForValidation(rulePayload)
const cachedForId = this.financialObj.goodsTypeGroupRules?.[tabindex]
prepared = mergeReconciliationRuleServerFields(prepared, cachedForId)
if (process.env.NODE_ENV === "development") {
console.debug(
"[FinancialRules] validatedByIndex tab",
tabindex,
"groupDivisionRuleId:",
prepared?.groupDivisionRuleId,
"id:",
prepared?.id
)
}
validatedByIndex[tabindex] = prepared
if (tab) {
this.$set(tab, "testFlag", "Y")
......@@ -1587,8 +1599,7 @@ export default {
return {
ok: true,
incrementalRules,
fullMergedRules: fullMerged,
deletedGroupDivisionRuleIds
fullMergedRules: fullMerged
}
} catch (e) {
console.error("[FinancialRules] getGoodsTypeGroupRules", e)
......@@ -1866,7 +1877,7 @@ export default {
addTab() {
// 重排已有 tab 的 name(保证连续),并记录当前数量作为新 tab 标题序号
const length = this.editableTabs.length
this.addIndex = length
this.addIndex = Math.max(1, length)
this.editableTabs = this.editableTabs.map((item, index) => {
item.name = (index + 1).toString()
......@@ -1977,11 +1988,33 @@ export default {
// 本会话新增的 Tab 删掉即可,不向服务端提交删除(无落库 id 或仅本地草稿)
const isSessionOnlyNew = removedTabMeta && removedTabMeta.sessionAdded === true
if (!isSessionOnlyNew) {
const removedId =
(removedRule && removedRule.groupDivisionRuleId)
|| (removedTabMeta && removedTabMeta.groupDivisionRuleId)
if (removedId != null && String(removedId).trim() !== "") {
this.pendingDeletedGroupDivisionRuleIds.push(String(removedId))
let rid =
removedRule && typeof removedRule === "object"
? getStableReconciliationRuleId(removedRule)
: ""
if (!rid && removedTabMeta) {
const gid = removedTabMeta.groupDivisionRuleId
if (gid != null && String(gid).trim() !== "") {
rid = String(gid).trim()
}
}
if (rid) {
const ruleSnapshot
= removedRule && typeof removedRule === "object"
? deepClone(removedRule)
: {}
delete ruleSnapshot.type
delete ruleSnapshot.tabPaneIndex
if (
ruleSnapshot.groupDivisionRuleId == null
|| String(ruleSnapshot.groupDivisionRuleId).trim() === ""
) {
ruleSnapshot.groupDivisionRuleId
= removedTabMeta && removedTabMeta.groupDivisionRuleId != null
? removedTabMeta.groupDivisionRuleId
: rid
}
this.pendingDeletedGroupDivisionRuleIds.push(ruleSnapshot)
}
}
const upgradeArr = []
......
import { getStableReconciliationRuleId } from "../../merchantStep/utils/reconciliationIncrementalRules"
import { GOODS_TYPE_GROUP_RULE_OP } from "./goodsTypeGroupRuleOpType"
/**
* @param {object} rule
* @param {number} idx
*/
function buildOneIncrementalEntry(rule, idx) {
const idStr = getStableReconciliationRuleId(rule)
const type = idStr
? GOODS_TYPE_GROUP_RULE_OP.UPDATE
: GOODS_TYPE_GROUP_RULE_OP.ADD
const entry = {
...rule,
type,
tabPaneIndex: idx
}
if (idStr) {
const gidEmpty =
entry.groupDivisionRuleId == null
|| String(entry.groupDivisionRuleId).trim() === ""
if (gidEmpty) {
entry.groupDivisionRuleId = idStr
}
}
return entry
}
/**
* 由已通过纯数据校验的 validatedByIndex 生成增量提交行(带 type / tabPaneIndex)。
* 主键与对账一致:groupDivisionRuleId 或 id 任一对接 UPDATE;仅 id 时回填 groupDivisionRuleId 便于接口识别。
*
* @param {Record<number, object>} validatedByIndex
* @param {number[]} indicesToValidate
......@@ -18,33 +45,72 @@ export function buildGoodsTypeGroupIncrementalRules(
const idx = indicesToValidate[0]
if (idx !== undefined) {
const rule = validatedByIndex[idx]
const id = rule && rule.groupDivisionRuleId
const hasId = id != null && String(id).trim() !== ""
const type = hasId
? GOODS_TYPE_GROUP_RULE_OP.UPDATE
: GOODS_TYPE_GROUP_RULE_OP.ADD
incrementalRules.push({
...rule,
type,
tabPaneIndex: idx
})
if (rule) {
incrementalRules.push(buildOneIncrementalEntry(rule, idx))
}
}
} else {
for (let j = 0; j < indicesToValidate.length; j++) {
const idx = indicesToValidate[j]
const rule = validatedByIndex[idx]
if (!rule) continue
const id = rule.groupDivisionRuleId
const hasId = id != null && String(id).trim() !== ""
const type = hasId
? GOODS_TYPE_GROUP_RULE_OP.UPDATE
: GOODS_TYPE_GROUP_RULE_OP.ADD
incrementalRules.push({
...rule,
type,
tabPaneIndex: idx
})
incrementalRules.push(buildOneIncrementalEntry(rule, idx))
}
}
return incrementalRules
}
/**
* 会话内删除的已落库规则:与 ADD/UPDATE 一并放入 goodsTypeGroupRules 增量(type=DELETE)。
* deletedEntries 可为:
* - 字符串 / 数字 id(兼容旧写法,仅传 groupDivisionRuleId)
* - 完整规则对象(与编辑提交的 UPDATE 条目同构字段,推荐)
*
* @param {Array<object>} incrementalRules
* @param {Array<string|number|object>} deletedEntries pendingDeletedGroupDivisionRuleIds(名历史遗留,实为 id 或整行快照)
* @returns {Array<object>}
*/
export function appendDeleteOpsToIncremental(incrementalRules, deletedEntries) {
const base = Array.isArray(incrementalRules) ? incrementalRules : []
const presentDeletes = new Set(
base
.filter(
(r) =>
r
&& r.type === GOODS_TYPE_GROUP_RULE_OP.DELETE
&& (r.groupDivisionRuleId ?? r.id) != null
&& String(r.groupDivisionRuleId ?? r.id).trim() !== "",
)
.map((r) => String(r.groupDivisionRuleId ?? r.id).trim()),
)
const raw = deletedEntries || []
const dels = []
for (let i = 0; i < raw.length; i++) {
const entry = raw[i]
if (entry != null && typeof entry === "object" && !Array.isArray(entry)) {
const idRaw = entry.groupDivisionRuleId ?? entry.id
const idStr = idRaw != null ? String(idRaw).trim() : ""
if (!idStr || presentDeletes.has(idStr))
continue
presentDeletes.add(idStr)
const { type: _omitType, tabPaneIndex: _omitIdx, ...rest } = entry
dels.push({
...rest,
type: GOODS_TYPE_GROUP_RULE_OP.DELETE,
groupDivisionRuleId: idStr,
})
continue
}
const idStr = entry != null ? String(entry).trim() : ""
if (!idStr || presentDeletes.has(idStr))
continue
presentDeletes.add(idStr)
dels.push({
type: GOODS_TYPE_GROUP_RULE_OP.DELETE,
groupDivisionRuleId: idStr,
})
}
return [...base, ...dels]
}
......@@ -2,6 +2,8 @@
* 财务规则:费用类目「整单 / 按品类」与其它分润类型组合冲突检测(纯函数,便于单测)。
*/
import { GOODS_TYPE_GROUP_RULE_OP } from "./goodsTypeGroupRuleOpType"
export function splitExpenseRulesByTarget(expenseCategoryRules) {
const trafficSide = []
const serviceProvider = []
......@@ -91,7 +93,8 @@ function runServiceConflict(
* @returns {{ errorTips: number, ops: Array<{tabIndex:number, side:string, rowIndex:number, flag:boolean}>, tabErrors: boolean[] }}
*/
export function computeCalculateModeConflicts(goodsTypeGroupRules) {
const rules = Array.isArray(goodsTypeGroupRules) ? goodsTypeGroupRules : []
const rules = (Array.isArray(goodsTypeGroupRules) ? goodsTypeGroupRules : [])
.filter((r) => r && r.type !== GOODS_TYPE_GROUP_RULE_OP.DELETE)
const tabErrors = rules.map(() => false)
const ops = []
let errorTips = 0
......
......@@ -2,4 +2,7 @@
* 分账品类:子组件 payload 与 financialObj 槽位合并、增量规则构建(供 index.vue 引用)。
*/
export { mergeChildClassificationPayload } from "./mergeClassificationPayload"
export { buildGoodsTypeGroupIncrementalRules } from "./buildGoodsTypeGroupIncrementalRules"
export {
appendDeleteOpsToIncremental,
buildGoodsTypeGroupIncrementalRules
} from "./buildGoodsTypeGroupIncrementalRules"
<template>
<div class="merchant-relation-grounding-readonly" v-loading="loading">
<div class="section grounding-section-traffic">
<div class="section-title">
流量方信息
</div>
<traffic-provider-information
:data="trafficProviderData"
:is-view-mode="true"
:show-edit-toolbar="false"
/>
</div>
<div class="section">
<div class="section-title">经营信息</div>
<mg-business-section
:data="businessForm"
:product-details="productDetails"
:is-view-mode="true"
/>
</div>
<div class="section section-sales-category">
<mg-sales-category-section :product-details="productDetails" />
</div>
</div>
</template>
<script>
import TrafficProviderInformation
from "@/views/salesManagement/availableInStores/tigaListingAndSalesContract/components/StepTwo/components/TrafficProviderInformation.vue";
import MgBusinessSection from "./MgBusinessSection.vue";
import MgSalesCategorySection from "./MgSalesCategorySection.vue";
export default {
name: "MerchantRelationGroundingReadonly",
components: {
TrafficProviderInformation,
MgBusinessSection,
MgSalesCategorySection,
},
provide () {
return {
size: "mini",
};
},
props: {
trafficProviderData: {
type: Object,
default: () => ({}),
},
businessForm: {
type: Object,
default: () => ({}),
},
productDetails: {
type: Array,
default: () => [],
},
loading: {
type: Boolean,
default: false,
},
},
};
</script>
<style scoped lang="scss">
.merchant-relation-grounding-readonly {
background: #f5f7fa;
padding: 12px 0 16px;
box-sizing: border-box;
.section {
margin-bottom: 12px;
background: #fff;
}
.section-title {
height: 48px;
line-height: 48px;
margin: 0;
padding: 0 20px;
box-sizing: border-box;
font-size: 14px;
font-weight: 600;
color: #333333;
background: #fff;
border-bottom: 1px solid #ebeef5;
}
.section-sales-category {
margin-bottom: 0;
}
::v-deep .grounding-section-traffic .traffic-provider-information-btns {
display: none !important;
}
}
</style>
<template>
<div class="business-information-container">
<el-form
ref="formRef"
label-width="155px"
:model="componentData"
size="small"
:rules="rules"
>
<div class="business-information-content">
<template v-for="(i, index) in fixedInfo">
<el-form-item
:key="`fixed-${index}`"
class="business-information-item"
:label="i.label + ':'"
>
{{ getData(i.key) || "-" }}
</el-form-item>
</template>
<template v-for="(i, index) in businessInformation">
<el-form-item
:key="`biz-${index}`"
class="business-information-item"
:label="i.label + ':'"
:prop="isViewMode ? '' : i.key"
>
<template v-if="isViewMode">
<template v-if="componentData[i.key] != null && componentData[i.key] !== ''">
{{ componentData[i.key] }}<template v-if="i.unit">{{ i.unit }}</template>
</template>
<template v-else>-</template>
</template>
<template v-else>
<el-input
v-model="componentData[i.key]"
:maxlength="i.maxlength || -1"
@input="filterInputVal(i, $event, 'componentData')"
/>
</template>
</el-form-item>
</template>
</div>
</el-form>
</div>
</template>
<script>
import { deepClone } from "@/common/util";
import NP from "number-precision";
import mgInputMixin from "./mgInputMixin";
export default {
name: "MgBusinessSection",
mixins: [mgInputMixin],
props: {
data: {
type: Object,
default: () => ({}),
},
productDetails: {
type: Array,
default: () => [],
},
isViewMode: {
type: Boolean,
default: false,
},
},
data() {
return {
componentData: {},
fixedInfo: [
{ label: "嘀加毛利", key: "djGrossProfit", type: "text" },
{ label: "嘀加毛利率", key: "djGpr", type: "text" },
],
businessInformation: [
{ label: "预估交付数/月", key: "deliveryCount", filterRule: "integerRange", min: 0, max: 999999, maxlength: 6 },
{ label: "预估触客率", key: "customerTouchRate", unit: "%", filterRule: "decimalRange", min: 0, max: 100, precision: 2 },
{ label: "人员成本", key: "personnelCost", filterRule: "decimalRange", min: 0, max: 999999, precision: 2 },
{ label: "房租", key: "rentCost", filterRule: "decimalRange", min: 0, max: 999999, precision: 2 },
{ label: "折旧与摊销", key: "depreciationCost", filterRule: "decimalRange", min: 0, max: 999999, precision: 2 },
{ label: "其他(水电、耗材等)", key: "otherCost", filterRule: "decimalRange", min: 0, max: 999999, precision: 2 },
{ label: "门店单台利润额", key: "storeProfitPerCar", filterRule: "decimalRange", min: 0, max: 999999, precision: 2 },
],
rules: {
deliveryCount: [{ required: true, message: "请输入预估交付数/月", trigger: "blur" }],
customerTouchRate: [{ required: true, message: "请输入预估触客率", trigger: "blur" }],
personnelCost: [{ required: true, message: "请输入人员成本", trigger: "blur" }],
rentCost: [{ required: true, message: "请输入房租", trigger: "blur" }],
depreciationCost: [{ required: true, message: "请输入折旧与摊销", trigger: "blur" }],
otherCost: [{ required: true, message: "请输入其他(水电、耗材等)", trigger: "blur" }],
storeProfitPerCar: [{ required: true, message: "请输入门店单台利润额", trigger: "blur" }],
},
};
},
computed: {
djGrossProfit() {
const { componentData, productDetails } = this;
const { personnelCost, rentCost, depreciationCost, otherCost } = componentData;
let sum = 0;
let revenue = 0;
let trafficFee = 0;
let marketFee1 = 0;
let marketFee2 = 0;
let incentive1 = 0;
let incentive2 = 0;
let resourceFee = 0;
let productCost = 0;
let recyclingFilm = 0;
(productDetails || []).forEach((item) => {
const lineRev = item.estimatedRevenue != null ? item.estimatedRevenue : item.revenue;
revenue = NP.plus(revenue, lineRev || 0);
trafficFee = NP.plus(trafficFee, item.trafficFee || 0);
marketFee1 = NP.plus(marketFee1, item.marketFee1 || 0);
marketFee2 = NP.plus(marketFee2, item.marketFee2 || 0);
incentive1 = NP.plus(incentive1, item.incentive1 || 0);
incentive2 = NP.plus(incentive2, item.incentive2 || 0);
resourceFee = NP.plus(resourceFee, item.resourceFee || 0);
productCost = NP.plus(productCost, item.productCost || 0);
recyclingFilm = NP.plus(recyclingFilm, item.recyclingFilm || 0);
});
sum = NP.minus(
revenue,
NP.plus(
trafficFee,
marketFee1,
marketFee2,
incentive1,
incentive2,
resourceFee,
productCost,
recyclingFilm,
personnelCost || 0,
rentCost || 0,
depreciationCost || 0,
otherCost || 0,
),
);
return Math.floor(sum * 100) / 100;
},
djGpr() {
let revenue = 0;
(this.productDetails || []).forEach((item) => {
const lineRev = item.estimatedRevenue != null ? item.estimatedRevenue : item.revenue;
revenue = NP.plus(revenue, lineRev || 0);
});
if (revenue === 0) return "0.00%";
const gpr = NP.times(NP.divide(this.djGrossProfit, revenue), 100);
return NP.round(gpr, 2) + "%";
},
},
watch: {
data: {
handler(newVal) {
this.componentData = deepClone(newVal || {});
},
deep: true,
immediate: true,
},
},
methods: {
getData(key) {
return this[key];
},
getFormData() {
return { ...this.componentData };
},
validate() {
if (this.isViewMode) {
return Promise.resolve(true);
}
return new Promise((resolve) => {
this.$refs.formRef.validate(valid => resolve(valid));
});
},
},
};
</script>
<style scoped lang="scss">
::v-deep .el-form-item__content {
word-break: break-all;
}
.business-information-container {
padding: 20px;
}
.business-information-content {
width: 100%;
display: flex;
flex-wrap: wrap;
gap: 0 32px;
font-size: 14px;
align-items: center;
}
.business-information-item {
flex-shrink: 0;
width: calc(50% - 16px);
}
</style>
<template>
<div class="mg-sales-category">
<div class="sales-category-toolbar-row">
<span class="sales-category-label">销售品类</span>
<el-select v-model="productKey" class="product-select" filterable placeholder="请选择销售品类">
<el-option
v-for="(item, idx) in products"
:key="`p-${idx}`"
:label="optionLabel(item)"
:value="productValueKey(item)"
/>
</el-select>
</div>
<div v-if="currentProduct" class="sales-detail">
<div v-for="(block, bIndex) in blocks" :key="bIndex" class="block">
<div class="sub-title">{{ block.title }}</div>
<div class="block-content">
<div v-for="(field, fIndex) in block.list" :key="fIndex" class="field-row">
<span class="label">{{ field.label }}:</span>
<span class="value">{{ formatField(currentProduct, field) }}</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { MG_SALES_CATEGORY_LIST } from "./mgSalesConstants";
/** 接口历史字段 → 与新 key 等价,便于只读展示回退 */
const MG_FIELD_LEGACY_READ = {
estimatedConversion: "estimatedConversionRate",
estimatedUpgradePrice: "upgradePrice",
estimatedRevenue: "revenue",
};
export default {
name: "MgSalesCategorySection",
props: {
productDetails: {
type: Array,
default: () => [],
},
},
data() {
return {
productKey: "",
blocks: MG_SALES_CATEGORY_LIST,
};
},
computed: {
products() {
return this.productDetails || [];
},
currentProduct() {
if (!this.productKey || !this.products.length) return null;
return this.products.find(p => this.productValueKey(p) === this.productKey) || null;
},
},
watch: {
products: {
handler(val) {
if (val && val.length && !this.productKey) {
this.productKey = this.productValueKey(val[0]);
}
},
immediate: true,
},
},
methods: {
/** 与 StepTwo 下拉 value 一致:productType + '+' + productCategory */
productValueKey(item) {
if (!item) return "";
return String(item.productType ?? "") + "+" + String(item.productCategory ?? "");
},
/** 与 StepTwo el-option label 一致:productType + '+' + productCategory */
optionLabel(item) {
if (!item) return "";
return String(item.productType ?? "") + "+" + String(item.productCategory ?? "");
},
/** 与 SalesCategory.vue 展示一致:仅 null / undefined 显示为 - */
formatField(row, field) {
const legacy = MG_FIELD_LEGACY_READ[field.key];
const v =
row[field.key] != null ? row[field.key] : legacy != null ? row[legacy] : null;
if (v == null) return "-";
return field.unit ? `${v}${field.unit}` : `${v}`;
},
},
};
</script>
<style scoped lang="scss">
.mg-sales-category {
background: #fff;
}
/* 设计稿:一行内 粗体标签 + 下拉,上下细分割线 */
.sales-category-toolbar-row {
display: flex;
align-items: center;
gap: 24px;
min-height: 48px;
padding: 8px 20px;
box-sizing: border-box;
border-top: 1px solid #ebeef5;
border-bottom: 1px solid #ebeef5;
background: #fff;
}
.sales-category-label {
flex-shrink: 0;
font-size: 14px;
font-weight: 600;
color: #333333;
}
.product-select {
width: 360px;
max-width: 100%;
}
.sales-detail {
padding: 20px;
}
.sub-title {
height: 32px;
background: #f5f7fa;
line-height: 32px;
color: #333;
text-align: center;
font-size: 14px;
font-weight: 500;
margin-bottom: 16px;
}
.block-content {
display: flex;
flex-wrap: wrap;
gap: 8px 32px;
font-size: 14px;
margin-bottom: 16px;
}
.field-row {
width: calc(50% - 16px);
.label {
color: #606266;
}
}
</style>
import NP from "number-precision";
export function joinIds(mi, listKey, strKey) {
const list = mi[listKey];
const str = mi[strKey];
if (str != null && str !== "") return String(str);
if (Array.isArray(list) && list.length) return list.join(",");
return "";
}
/** 场景列表接口可能返回 { list } 或裸数组,统一成数组 */
export function normalizeBaseSceneListResponse(res) {
if (Array.isArray(res)) return res;
if (res && typeof res === "object") {
const inner = res.list ?? res.records ?? res.data ?? res.rows ?? res.scenes;
if (Array.isArray(inner)) return inner;
}
return [];
}
function sceneRowMatchCodes(row) {
if (!row || typeof row !== "object") return [];
const keys = ["baseSceneCode", "sceneCode", "bizSceneCode", "code", "id", "sceneId"];
const out = [];
for (const k of keys) {
const v = row[k];
if (v != null && v !== "") out.push(String(v).trim());
}
return out;
}
/** 历史/详情里可能出现的场景编码字段(仅用于名称反查,不含 scene 大类枚举) */
export function pickSceneLookupCode(mi) {
if (!mi || typeof mi !== "object") return "";
const keys = ["baseSceneCode", "bizBaseSceneCode", "bizSceneCode", "sceneBizCode", "businessSceneCode"];
for (const k of keys) {
const v = mi[k];
if (v != null && v !== "") return v;
}
return "";
}
export function resolveSceneName(code, baseSceneList = []) {
if (code == null || code === "") return "";
const codeStr = String(code).trim();
if (!codeStr) return "";
const hit = baseSceneList.find(row => sceneRowMatchCodes(row).includes(codeStr));
if (hit) {
return hit.name ?? hit.sceneName ?? hit.label ?? hit.confLabel ?? codeStr;
}
return codeStr;
}
export function storeProfitPerCar(mi) {
const d = mi?.deliveryCount;
const r = mi?.estimatedRevenue ?? mi?.revenue;
if (!d || Number(d) <= 0 || r == null) return "";
return String(NP.round(NP.divide(Number(r), Number(d)), 2));
}
/**
* 从详情/历史里的 otherServiceProviders(JSON 字符串或对象数组)解析多选 ID 与展示名。
* 元素结构约定:{ merchantNo, merchantName }(兼容 merchantId、name 等别名)
*/
export function parseOtherServiceProvidersFromMi(mi) {
const raw = mi?.otherServiceProviders;
if (raw == null || raw === "") {
return { ids: [], namesStr: "" };
}
let parsed = raw;
if (typeof raw === "string") {
try {
parsed = JSON.parse(raw);
} catch {
return { ids: [], namesStr: "" };
}
}
if (!Array.isArray(parsed)) {
return { ids: [], namesStr: "" };
}
const ids = [];
const names = [];
for (const item of parsed) {
if (item == null) continue;
if (typeof item === "number") {
if (!Number.isNaN(item)) ids.push(Number(item));
continue;
}
if (typeof item === "string") {
const n = Number(item);
if (!Number.isNaN(n)) ids.push(n);
continue;
}
if (typeof item === "object") {
const idRaw = item.merchantNo ?? item.merchantId ?? item.id ?? item.serviceProviderId;
const nameRaw = item.merchantName ?? item.name ?? "";
if (idRaw != null && idRaw !== "") {
const n = Number(idRaw);
if (!Number.isNaN(n)) ids.push(n);
}
if (nameRaw != null && String(nameRaw).trim() !== "") {
names.push(String(nameRaw).trim());
}
}
}
const namesStr = names.length ? names.join("/") : "";
return { ids, namesStr };
}
export function buildTrafficProviderData(mi, baseSceneList = []) {
const osp = parseOtherServiceProvidersFromMi(mi);
const nameFromMi = mi?.otherServiceProvidersName;
return {
trafficPartyName: mi.trafficPartyName || "",
parentName: mi.parentName || mi.parentMerchantName || "",
sceneTypeName: mi.sceneTypeName || mi.baseSceneName || resolveSceneName(pickSceneLookupCode(mi), baseSceneList) || "",
signingEntityId: mi.signingEntityId != null ? Number(mi.signingEntityId) : null,
signingEntity: mi.signingEntity || mi.signingEntityName || "",
businessMode: mi.businessMode != null ? Number(mi.businessMode) : null,
operationMode: mi.operationMode != null ? Number(mi.operationMode) : null,
serviceMerchant2fId: mi.serviceMerchant2fId != null ? Number(mi.serviceMerchant2fId) : null,
serviceMerchant2fName: mi.serviceMerchant2fName || "",
partnerId: mi.partnerId != null ? Number(mi.partnerId) : (mi.serviceProviderId != null ? Number(mi.serviceProviderId) : null),
partnerName: mi.partnerName || mi.serviceProviderName || "",
parentServiceMerchantName: mi.parentServiceMerchantName || "",
yqMerchantId: mi.yqMerchantId != null ? Number(mi.yqMerchantId) : (mi.parkingStoreId != null ? Number(mi.parkingStoreId) : null),
yqMerchantName: mi.yqMerchantName || mi.parkingStoreName || "",
areaOpId: joinIds(mi, "areaOpIdList", "areaOpId"),
onlineOpId: joinIds(mi, "onlineOpIdList", "onlineOpId"),
regionSupervisorId: joinIds(mi, "regionSupervisorIdList", "regionSupervisorId"),
areaOpName: mi.areaOpName || "",
onlineOpName: mi.onlineOpName || "",
regionSupervisorName: mi.regionSupervisorName || "",
otherServiceProvidersIdList: osp.ids,
otherServiceProvidersName:
nameFromMi != null && String(nameFromMi).trim() !== ""
? String(nameFromMi).trim()
: osp.namesStr,
};
}
export function buildBusinessForm(mi) {
return {
deliveryCount: mi.deliveryCount,
customerTouchRate: mi.customerTouchRate,
personnelCost: mi.personnelCost,
rentCost: mi.rentCost,
depreciationCost: mi.depreciationCost,
otherCost: mi.otherCost,
storeProfitPerCar: storeProfitPerCar(mi),
};
}
import NP from "number-precision";
import { getSceneTypeByBaseSceneCode } from "@/common/sceneBaseSceneCode";
/** 与 MgBusinessSection 中嘀加毛利/毛利率/产值合计一致 */
export function computeDjMetrics(componentData, productDetails) {
const pd = productDetails || [];
const { personnelCost, rentCost, depreciationCost, otherCost } = componentData || {};
let revenue = 0;
let trafficFee = 0;
let marketFee1 = 0;
let marketFee2 = 0;
let incentive1 = 0;
let incentive2 = 0;
let resourceFee = 0;
let productCost = 0;
let recyclingFilm = 0;
pd.forEach((item) => {
revenue = NP.plus(revenue, item.estimatedRevenue != null ? item.estimatedRevenue : item.revenue || 0);
trafficFee = NP.plus(trafficFee, item.trafficFee || 0);
marketFee1 = NP.plus(marketFee1, item.marketFee1 || 0);
marketFee2 = NP.plus(marketFee2, item.marketFee2 || 0);
incentive1 = NP.plus(incentive1, item.incentive1 || 0);
incentive2 = NP.plus(incentive2, item.incentive2 || 0);
resourceFee = NP.plus(resourceFee, item.resourceFee || 0);
productCost = NP.plus(productCost, item.productCost || 0);
recyclingFilm = NP.plus(recyclingFilm, item.recyclingFilm || 0);
});
const sum = NP.minus(
revenue,
NP.plus(
trafficFee,
marketFee1,
marketFee2,
incentive1,
incentive2,
resourceFee,
productCost,
recyclingFilm,
personnelCost || 0,
rentCost || 0,
depreciationCost || 0,
otherCost || 0,
),
);
const djGrossProfit = Math.floor(sum * 100) / 100;
const djGpr = revenue === 0 ? 0 : NP.round(NP.times(NP.divide(djGrossProfit, revenue), 100), 2);
return { djGrossProfit, djGpr, estimatedRevenue: revenue };
}
function joinMultiId(traffic, listKey, scalarKey) {
const list = traffic[listKey];
if (Array.isArray(list) && list.length) return list.join(",");
const s = traffic[scalarKey];
if (s != null && s !== "") return String(s);
return "";
}
function numOrNull(v) {
if (v === "" || v === undefined || v === null) return null;
const n = Number(v);
return Number.isNaN(n) ? null : n;
}
function mapProductDetailBusinessRow(pd) {
const row = {
productType: pd.productType,
productCategory: pd.productCategory,
feeSettlementMode: pd.feeSettlementMode,
penetrationRate: numOrNull(pd.penetrationRate),
conversionRate: numOrNull(pd.conversionRate),
revenuePerCar: numOrNull(pd.revenuePerCar),
estimatedConversion: numOrNull(
pd.estimatedConversion != null ? pd.estimatedConversion : pd.estimatedConversionRate,
),
estimatedUpgradePrice: numOrNull(
pd.estimatedUpgradePrice != null ? pd.estimatedUpgradePrice : pd.upgradePrice,
),
estimatedRevenue: numOrNull(
pd.estimatedRevenue != null ? pd.estimatedRevenue : pd.revenue,
),
recyclingFilm: numOrNull(pd.recyclingFilm),
trafficFee: numOrNull(pd.trafficFee),
marketFee1: numOrNull(pd.marketFee1),
marketFee2: numOrNull(pd.marketFee2),
incentive1: numOrNull(pd.incentive1),
incentive2: numOrNull(pd.incentive2),
resourceFee: numOrNull(pd.resourceFee),
productCost: numOrNull(pd.productCost),
};
if (pd.id != null && pd.id !== "") {
const nid = Number(pd.id);
if (!Number.isNaN(nid)) row.id = nid;
}
if (pd.partyId != null && pd.partyId !== "") {
const pid = Number(pd.partyId);
if (!Number.isNaN(pid)) row.partyId = pid;
}
if (pd.createdBy != null) row.createdBy = pd.createdBy;
if (pd.updatedBy != null) row.updatedBy = pd.updatedBy;
if (pd.deletedFlag != null) row.deletedFlag = pd.deletedFlag;
return row;
}
/**
* addOrUpdateSceneMerchantRefNewOpen 请求体(由 sign/qs 序列化后 POST)
*/
export function buildMerchantOnShelfOpenPayload(options) {
const {
detailQueryBaseSceneCode,
detailQueryMerchantId,
merchantInfo: mi0,
traffic,
businessForm,
productDetailsForSubmit,
} = options;
const mi = mi0 || {};
const sceneFromCode = getSceneTypeByBaseSceneCode(detailQueryBaseSceneCode);
let sceneType = !Number.isNaN(sceneFromCode) ? sceneFromCode : NaN;
if (Number.isNaN(sceneType)) {
const s = mi.scene != null && mi.scene !== "" ? Number(mi.scene) : 0;
sceneType = Number.isNaN(s) ? 0 : s;
}
const trafficPartyId =
mi.trafficPartyId != null && mi.trafficPartyId !== ""
? Number(mi.trafficPartyId)
: detailQueryMerchantId;
const trafficPartyName = (traffic && traffic.trafficPartyName) || mi.trafficPartyName || "";
const yqId =
traffic.yqMerchantId != null && traffic.yqMerchantId !== ""
? Number(traffic.yqMerchantId)
: null;
const yqName = traffic.yqMerchantName || mi.parkingStoreName || "";
const biz = businessForm || {};
const { djGrossProfit, djGpr, estimatedRevenue } = computeDjMetrics(biz, productDetailsForSubmit);
const parentSvcId = mi.parentServiceMerchantId;
const trafficPartyBusinessData = {
trafficPartyId,
trafficPartyName,
parkingStoreId: yqId != null && !Number.isNaN(yqId) ? yqId : null,
parkingStoreName: yqName || "",
serviceProviderId: traffic.partnerId != null ? Number(traffic.partnerId) : null,
parentServiceMerchantId:
parentSvcId != null && parentSvcId !== "" ? Number(parentSvcId) : null,
serviceProviderName: traffic.partnerName || "",
parentServiceMerchantName:
traffic.parentServiceMerchantName || mi.parentServiceMerchantName || "",
serviceMerchant2fId:
traffic.serviceMerchant2fId != null ? Number(traffic.serviceMerchant2fId) : null,
serviceMerchant2fName: traffic.serviceMerchant2fName || "",
signingEntityId:
traffic.signingEntityId != null ? Number(traffic.signingEntityId) : null,
signingEntityName: traffic.signingEntity || "",
businessMode: traffic.businessMode != null ? Number(traffic.businessMode) : null,
operationMode: traffic.operationMode != null ? Number(traffic.operationMode) : null,
storeProfitPerCar: numOrNull(biz.storeProfitPerCar),
djGrossProfit,
djGpr,
deliveryCount: numOrNull(biz.deliveryCount),
customerTouchRate: numOrNull(biz.customerTouchRate),
personnelCost: numOrNull(biz.personnelCost),
rentCost: numOrNull(biz.rentCost),
estimatedRevenue: numOrNull(estimatedRevenue),
depreciation: numOrNull(biz.depreciationCost),
otherCost: numOrNull(biz.otherCost),
areaOpId: joinMultiId(traffic, "areaOpIdList", "areaOpId"),
onlineOpId: joinMultiId(traffic, "onlineOpIdList", "onlineOpId"),
regionSupervisorId: joinMultiId(traffic, "regionSupervisorIdList", "regionSupervisorId"),
areaOpName: (traffic && traffic.areaOpName) || "",
onlineOpName: (traffic && traffic.onlineOpName) || "",
regionSupervisorName: (traffic && traffic.regionSupervisorName) || "",
otherServiceProviders:
traffic && traffic.otherServiceProviders != null && traffic.otherServiceProviders !== ""
? String(traffic.otherServiceProviders)
: "",
};
const productDetailBusinessDataList = (productDetailsForSubmit || []).map(
mapProductDetailBusinessRow,
);
const payload = {
baseSceneCode: String(detailQueryBaseSceneCode),
sceneType,
merchantId: trafficPartyId,
partnerMerchantId:
traffic.partnerId != null ? Number(traffic.partnerId) : null,
trafficPartyBusinessData,
productDetailBusinessDataList,
};
if (yqId != null && !Number.isNaN(yqId)) {
payload.yqMerchantId = yqId;
}
return payload;
}
export default {
methods: {
filterInputVal(i, val, keyName) {
if (!i.filterRule) return;
if (i.filterRule === "integerRange") {
let filtered = (val || "").replace(/\D/g, "");
const numValue = Number.parseInt(filtered, 10);
if (!Number.isNaN(numValue) && numValue > i.max) {
filtered = String(i.max);
}
this.$set(this[keyName], i.key, filtered);
} else if (i.filterRule === "decimalRange") {
let filtered = (val || "").replace(/[^\d.]/g, "");
const parts = filtered.split(".");
if (parts.length > 2) {
filtered = parts[0] + "." + parts.slice(1).join("");
}
if (parts.length === 2 && parts[1].length > i.precision) {
filtered = parts[0] + "." + parts[1].substring(0, i.precision);
}
const numValue = Number.parseFloat(filtered);
if (!Number.isNaN(numValue)) {
if (numValue < i.min) {
filtered = String(i.min);
} else if (numValue > i.max) {
filtered = String(i.max);
}
}
this.$set(this[keyName], i.key, filtered);
}
},
},
};
/** 销售品类只读区块:字段 key / label / unit 与 StepTwo SalesCategory(constant.js / SALES_CATEGORY_LIST)一致 */
export const MG_SALES_CATEGORY_LIST = [
{
title: "销售范围",
list: [
{ label: "类型", key: "productType" },
{ label: "销售品类", key: "productCategory" },
{ label: "流量费结算模式", key: "feeSettlementMode" },
],
},
{
title: "兜底要求",
list: [
{ label: "渗透率", key: "penetrationRate", unit: "%" },
{ label: "转化率", key: "conversionRate", unit: "%" },
{ label: "单车采购产值", key: "revenuePerCar" },
],
},
{
title: "预估经营数据",
list: [
{ label: "转化率", key: "estimatedConversion", unit: "%" },
{ label: "升级客单价", key: "estimatedUpgradePrice" },
{ label: "产值", key: "estimatedRevenue" },
],
},
{
title: "商务政策",
list: [
{ label: "流量费", key: "trafficFee" },
{ label: "管理层市场费1", key: "marketFee1" },
{ label: "管理层市场费2", key: "marketFee2" },
{ label: "一线阳光激励1", key: "incentive1" },
{ label: "一线阳光激励2", key: "incentive2" },
{ label: "资源费", key: "resourceFee" },
],
},
{
title: "预估运营成本",
list: [
{ label: "产品成本", key: "productCost" },
{ label: "原厂回收膜", key: "recyclingFilm" },
],
},
];
......@@ -70,8 +70,8 @@
* - checkParamsType 通过后打开验证码弹窗;失败 focusTabByErrorIndex
*
* 提交
* - codeHandleConfirm → submitFormData:若自打开验证码前无新的对账相关交互则跳过第二次 verify;saveRuleApi 传 goodsTypeGroupRules(增量)、deletedGroupDivisionRuleIds、
* smsCode/effectStartDate、formObj 四项费用字段、merchantId/sceneType
* - codeHandleConfirm → submitFormData:若自打开验证码前无新的对账相关交互则跳过第二次 verify;saveRuleApi 传 goodsTypeGroupRules(增量,含 type=DELETE 的删除项)、
* smsCode/effectStartDate、formObj 四项费用字段、merchantId/sceneType(不再单独传 deletedGroupDivisionRuleIds)
*
* 后续优化要点(A 段):sceneLabel、productType 浅监听、allSettled、费用 Promise.all、getAllReconciliationParams、
* persist 深拷贝、uniqueBy、errorIndex;子组件见 merchantStep/components/classificationCpt.vue(B 段)。
......@@ -132,6 +132,9 @@ import {
import { financialRulePayloadDeepEqual } from "../financialRules/utils/rulePayloadCanonicalCompare"
import { CLASSIFICATION_EMIT } from "../financialRules/utils/classificationEmitTypes"
import {
appendDeleteOpsToIncremental
} from "../financialRules/utils/classificationRuleCache"
import {
getUpgradeGoodsRowKey,
sameUpgradeGoodsRow,
mapProductSearchListToUpgradeGoodsOptions,
......@@ -172,7 +175,7 @@ export default {
* submitFormData 会在请求前经 shapeGoodsTypeGroupRulesForApi 写入此处,与实际上报一致。
*/
reconciliationLastVerifyResult: null,
/** 本会话删除的已落库对账规则 id(与 reconciliation.saveRule 的 deletedGroupDivisionRuleIds 对齐) */
/** 本会话删除的已落库对账规则整行快照;提交前并入 goodsTypeGroupRules(type=DELETE),不向接口单独字段传(名历史遗留,兼容仅存 id) */
pendingDeletedGroupDivisionRuleIds: [],
editableTabsValue: "1",
addIndex: 1,
......@@ -972,6 +975,7 @@ export default {
const { merchantId, scene: sceneType } = this.routerInfo
ruleAuditSituation({
merchantId,
sceneType,
baseSceneCode: resolveBaseSceneCodeFromRouter(this.routerInfo),
ruleType: 3
})
......@@ -1150,7 +1154,7 @@ export default {
addTab() {
const length = this.editableTabs.length
this.addIndex = length
this.addIndex = Math.max(1, length)
this.editableTabs = this.editableTabs.map((item, index) => {
item.name = (index + 1).toString()
......@@ -1226,7 +1230,18 @@ export default {
const cached = this.goodsTypeGroupReconciliationRules[ruleIdxRemoved]
const rid = getStableReconciliationRuleId(cached)
if (rid) {
this.pendingDeletedGroupDivisionRuleIds.push(rid)
const ruleSnapshot = cached && typeof cached === "object"
? deepClone(cached)
: {}
delete ruleSnapshot.type
delete ruleSnapshot.tabPaneIndex
if (
ruleSnapshot.groupDivisionRuleId == null
|| String(ruleSnapshot.groupDivisionRuleId).trim() === ""
) {
ruleSnapshot.groupDivisionRuleId = rid
}
this.pendingDeletedGroupDivisionRuleIds.push(ruleSnapshot)
}
}
......@@ -1450,8 +1465,8 @@ export default {
this.submitFormData(true)
},
/**
* 提交对账规则:`goodsTypeGroupRules` 为相对基线仍有变更的增量(含 type / tabPaneIndex),
* 无变更则为 [];`deletedGroupDivisionRuleIds` 为本会话删除的已落库 id。
* 提交对账规则:`goodsTypeGroupRules` 为相对基线仍有变更的增量(含 type ADD/UPDATE/DELETE),
* 无变更且无待删 id 时为 []。
*/
async submitFormData(skipReverifyAfterSms = false) {
const canSkipReverify =
......@@ -1479,12 +1494,16 @@ export default {
} = this.formObj
const rawIncremental =
this.reconciliationLastVerifyResult?.incrementalRules ?? []
const goodsTypeGroupRules = this.shapeGoodsTypeGroupRulesForApi(
rawIncremental
const shapedIncremental = this.shapeGoodsTypeGroupRulesForApi(
rawIncremental,
)
const goodsPayload = appendDeleteOpsToIncremental(
shapedIncremental,
this.pendingDeletedGroupDivisionRuleIds || [],
)
if (this.reconciliationLastVerifyResult?.ok) {
this.reconciliationLastVerifyResult.incrementalRules = deepClone(
goodsTypeGroupRules
goodsPayload,
)
}
const params = {
......@@ -1493,10 +1512,7 @@ export default {
merchantId: this.merchantRow.merchantId,
sceneType: this.merchantRow.scene,
baseSceneCode: resolveBaseSceneCodeFromRouter(this.routerInfo),
goodsTypeGroupRules,
deletedGroupDivisionRuleIds: [
...new Set(this.pendingDeletedGroupDivisionRuleIds)
],
goodsTypeGroupRules: goodsPayload,
shopMerchantTotalFeeCalculateType,
shopMerchantExpenseCategoryValue,
partnerMerchantTotalFeeCalculateType,
......
......@@ -9,9 +9,14 @@
</el-tabs>
</div>
<!-- 商户关系 -->
<!-- 商户关系(与商户上架编辑页一致的字段与布局) -->
<template v-if="activeName == 'third'">
<merchantRelationships :form-item="checkDetailItem" />
<merchant-relation-grounding-readonly
:traffic-provider-data="relationTrafficData"
:business-form="relationBusinessForm"
:product-details="relationProductDetails"
:loading="relationLoading"
/>
</template>
<!-- 分账 -->
......@@ -31,8 +36,6 @@
<el-button @click="handleConfirm" size="small" type="primary">
返回
</el-button>
<!-- <el-button size="small"
@click="handleReset"> 返回 </el-button> -->
</div>
</div>
</d2-Container>
......@@ -41,108 +44,140 @@
<script>
import ledgerAccount from './components/ledgerAccount.vue'
import reconciliation from './components/reconciliation.vue'
import merchantRelationships from './components/merchantRelationships.vue'
import MerchantRelationGroundingReadonly from '../merchantGroundingEdit/MerchantRelationGroundingReadonly.vue'
import { buildTrafficProviderData, buildBusinessForm, normalizeBaseSceneListResponse } from '../merchantGroundingEdit/merchantDetailMap'
import {
getDistributeRuleApi,
getEffectRuleApi,
getMerchantRelationDetailApi
queryMerchantDetail
} from "@api/merchant"
import { getBaseSceneCodeList } from "@api/productManage"
export default {
name: "MerchantCheckDetail",
props: {},
data() {
data () {
return {
activeName: "third",
merchantRow: {},
// 分账数据
checkDetailItem: {},
// 对账数据
checkRecordList: {}
checkRecordList: {},
relationLoading: false,
relationTrafficData: {},
relationBusinessForm: {},
relationProductDetails: [],
relationBaseSceneList: []
}
},
created() {
created () {
this.getRowItem()
},
mounted() {
// 分账
// this.getDistributeRule()
// 商户关系
this.getMerchantRelationDetail()
mounted () {
this.loadMerchantGroundingRelation()
},
methods: {
async init() {
resolveRelationMerchantId (row) {
if (!row) return ''
const raw = row.merchantId ?? row.merchantNo ?? row.trafficPartyId
?? row.trafficPartyMerchantId ?? row.diversionMerchantId ?? row.shopMerchantId
if (raw == null || raw === '') return ''
const n = Number(raw)
return Number.isNaN(n) ? String(raw) : n
},
resolveRowBaseSceneCode (row) {
if (row == null) return ''
const c = row.baseSceneCode
return c != null && c !== '' ? c : ''
},
async init () {
if (this.activeName == "first") {
// 分账
this.getDistributeRule()
} else if (this.activeName == "second") {
// 对账
this.getEffectRule()
} else {
// 商户关系
this.getMerchantRelationDetail()
this.loadMerchantGroundingRelation()
}
},
// 分账
async getDistributeRule() {
async getDistributeRule () {
const params = {
merchantId: this.merchantRow.merchantId,
sceneType: this.merchantRow.scene,
expenseCategroyRulsBuildType: 2
}
const bsc = this.resolveRowBaseSceneCode(this.merchantRow)
if (bsc !== '') params.baseSceneCode = bsc
const res = await getDistributeRuleApi(params)
console.log('res: ', res)
this.checkDetailItem = res
},
// 对账
async getEffectRule() {
async getEffectRule () {
const params = {
merchantId: this.merchantRow.merchantId,
sceneType: this.merchantRow.scene
}
const bsc = this.resolveRowBaseSceneCode(this.merchantRow)
if (bsc !== '') params.baseSceneCode = bsc
const res = await getEffectRuleApi(params)
console.log(res)
this.checkRecordList = res
// this.checkRecordList = res?.goodsTypeGroupReconciliationRules
// console.log('res: ', res)
},
// 商户关系
async getMerchantRelationDetail() {
const params = {
merchantId: this.merchantRow.merchantId,
scene: this.merchantRow.scene
async loadMerchantGroundingRelation () {
const baseSceneCode = this.resolveRowBaseSceneCode(this.merchantRow)
if (!baseSceneCode || String(baseSceneCode) === '') {
this.$message.warning('缺少场景编码 baseSceneCode,无法加载商户详情')
return
}
const midRaw = this.resolveRelationMerchantId(this.merchantRow)
const merchantIdNum = typeof midRaw === 'number' ? midRaw : Number(midRaw)
if (midRaw === '' || midRaw == null || Number.isNaN(merchantIdNum)) {
this.$message.warning('商户ID无效')
return
}
this.relationLoading = true
try {
const scenes = await getBaseSceneCodeList({})
this.relationBaseSceneList = normalizeBaseSceneListResponse(scenes)
const res = await queryMerchantDetail({
merchantId: merchantIdNum,
baseSceneCode: String(baseSceneCode)
})
const mi = res?.merchantInfo || res
const pd = res?.productDetails
if (!mi) {
this.$message.error('未获取到商户详情')
return
}
this.relationProductDetails = Array.isArray(pd) ? pd : []
this.relationTrafficData = buildTrafficProviderData(mi, this.relationBaseSceneList)
this.relationBusinessForm = buildBusinessForm(mi)
} catch (e) {
console.error(e)
this.$message.error('加载商户详情失败')
} finally {
this.relationLoading = false
}
const res = await getMerchantRelationDetailApi(params)
this.checkDetailItem = res
},
getRowItem() {
getRowItem () {
const params = this.$route.query?.params
if (params) {
this.merchantRow = JSON.parse(params)
// console.log("is.merchantRow", this.merchantRow)
}
},
handleClick(tab) {
// console.log(tab.name)
handleClick (tab) {
this.activeName = tab.name
this.init()
},
// handleType(num) {
// this.activeType = num
// },
// 保存
handleConfirm() {
handleConfirm () {
this.$router.go(-1)
},
// 取消
handleReset() {
handleReset () {
this.$router.go(-1)
}
},
components: {
ledgerAccount,
reconciliation,
merchantRelationships
MerchantRelationGroundingReadonly
},
computed: {}
}
......@@ -151,14 +186,10 @@ export default {
$color: #2a58ad;
.merchant-checkdetail {
// height: 100%;
padding-left: 20px;
padding-right: 16px;
padding-bottom: 20px;
// overflow-y: auto;
.title {}
.type {
margin-top: 6px;
display: flex;
......@@ -229,21 +260,18 @@ $color: #2a58ad;
.msg {
padding-bottom: 12px;
flex: 1 0 auto;
// width: 50%;
display: flex;
align-items: flex-start;
line-height: 24px;
.msg-title {
width: 138px;
// height: 20px;
font-size: 14px;
color: #666666;
text-align: right;
}
.msg-val {
// height: 20px;
font-size: 14px;
color: #1d1d1d;
text-align: left;
......@@ -261,8 +289,6 @@ $color: #2a58ad;
font-size: 14px;
color: #666666;
.manner {}
.online {
&+.online {
margin-left: 44px;
......@@ -282,10 +308,6 @@ $color: #2a58ad;
border-left: 1px solid #e5e5e5;
.type1 {
// &:first-child {
// border-top: 1px solid #E5E5E5;
// border-left: 1px solid #E5E5E5;
// }
display: flex;
width: 33.33%;
height: 38px;
......@@ -301,9 +323,6 @@ $color: #2a58ad;
}
.type-val {
// flex: 1;
// display: flex;
// color: #1d1d1d;
flex-shrink: 0;
color: #1d1d1d;
display: inline-block !important;
......@@ -379,15 +398,6 @@ $color: #2a58ad;
}
}
}
// .part2 {
// }
// .part3 {
// }
// .part4 {
// }
// .part5 {
// }
}
.btns {
......
......@@ -29,11 +29,10 @@
<span :class="{ 'labelColorEff': !formItem.formatEffectEndDate }">{{ "待生效"}}</span>
</span>
</template>
<!-- 商户关系 -->
<!-- 商户关系:operationType / createdBy / updatedDate -->
<template v-else>
<span>{{ formItem.formatEffectStartDate }}</span>
<span> - </span>
<span :class="{ 'labelColor': !formItem.applyEndTime }">{{ formItem.applyEndTime ? formItem.formatEffectEndDate : "生效中"}}</span>
<span>操作类型:</span>
<span class="labelColor">{{ formatRelationOperationType(formItem.operationType) }}</span>
</template>
</span>
<span class="updatedInfo">
......@@ -67,9 +66,11 @@
<reconciliation :form-item="formItem" :items="formItem.typeList" />
</template>
<!-- 商户关系 -->
<!-- 商户关系(与上架/详情对齐的新结构) -->
<template v-if="activeName == 'third'">
<merchantRelationships :form-item="formItem" />
<merchant-relation-grounding-readonly
v-bind="groundingRelationProps(formItem)"
/>
</template>
</div>
</el-collapse-transition>
......@@ -94,7 +95,8 @@ import dayjs from "dayjs"
import { getHistoryRecord } from "@api/publicAccount"
import ledgerAccount from "./components/ledgerAccount.vue"
import reconciliation from "./components/reconciliation.vue"
import merchantRelationships from "./components/merchantRelationships.vue"
import MerchantRelationGroundingReadonly from '../merchantGroundingEdit/MerchantRelationGroundingReadonly.vue'
import { buildTrafficProviderData, buildBusinessForm, normalizeBaseSceneListResponse, pickSceneLookupCode } from '../merchantGroundingEdit/merchantDetailMap'
import {
getLedgerHistoryRecordApi,
getReconciliationHistoryRecordApi,
......@@ -102,6 +104,7 @@ import {
getLedgerHistoryRecordDetailApi,
getReconciliationHistoryRecordDetailApi
} from "@api/merchant"
import { getBaseSceneCodeList } from "@api/productManage"
export default {
name: "MerchantCheckRecord",
props: {
......@@ -119,7 +122,8 @@ export default {
activeName: "third",
activeType: 1,
merchantRow: {},
formArray: []
formArray: [],
relationSceneList: []
}
},
created() {
......@@ -137,6 +141,28 @@ export default {
console.log("is.merchantRow", this.merchantRow)
}
},
resolveRowBaseSceneCode(row) {
if (row == null) return ""
const c = row.baseSceneCode
return c != null && c !== "" ? String(c) : ""
},
/** 列表/详情请求统一附加 baseSceneCode(与列表行一致) */
withBaseSceneCode(baseParams) {
const bsc = this.resolveRowBaseSceneCode(this.merchantRow)
if (bsc === "") return baseParams
return { ...baseParams, baseSceneCode: bsc }
},
/** 商户关系历史 operationType:1-新增 2-更新 3-禁用 4-启用 */
formatRelationOperationType(operationType) {
const map = {
1: "新增",
2: "更新",
3: "禁用",
4: "启用",
}
const key = operationType != null ? Number(operationType) : NaN
return !Number.isNaN(key) && map[key] != null ? map[key] : "-"
},
handleClick(tab) {
this.activeName = tab.name
this.formArray = []
......@@ -162,6 +188,7 @@ export default {
getItemDetail(SelectIndex, selectItem) {
let eventApi = this.activeName == "first" ? getLedgerHistoryRecordDetailApi : getReconciliationHistoryRecordDetailApi
let params = selectItem.enableFlag == 2 ? { ruleAuditId: selectItem?.ruleAuditId } : { effectRecordId: selectItem?.id }
params = this.withBaseSceneCode(params)
eventApi(params).then(res => {
// 分账
if (this.activeName == "first") {
......@@ -191,10 +218,10 @@ export default {
async getLedgerHistoryRecord() {
const merchantId = this.merchantRow.merchantId
const sceneType = this.merchantRow.scene
const params = {
const params = this.withBaseSceneCode({
merchantId,
sceneType
}
})
const res = await getLedgerHistoryRecordApi(params)
if (res.length != 0) {
const format = "YYYY/MM/DD HH:mm"
......@@ -228,10 +255,10 @@ export default {
async getReconciliationHistoryRecord() {
const merchantId = this.merchantRow.merchantId
const sceneType = this.merchantRow.scene
const params = {
const params = this.withBaseSceneCode({
merchantId,
sceneType
}
})
const res = await getReconciliationHistoryRecordApi(params)
console.log("res: ", res)
if (res.length != 0) {
......@@ -265,22 +292,77 @@ export default {
this.formArray = []
}
},
groundingRelationProps(formItem) {
const { traffic, business, productDetails } = this.normalizeHistoryToGrounding(formItem)
return {
trafficProviderData: traffic,
businessForm: business,
productDetails,
loading: false,
}
},
/**
* 历史接口:merchantStoreInfoHistory → 商户/流量方与经营映射;
* merchantStoreProductDetailHistoryList → 销售品类(productDetails)。
*/
normalizeHistoryToGrounding(formItem) {
if (formItem == null || typeof formItem !== "object") {
return {
traffic: buildTrafficProviderData({}, this.relationSceneList),
business: buildBusinessForm({}),
productDetails: [],
}
}
const nestedRaw =
formItem.merchantStoreInfoHistory != null
? formItem.merchantStoreInfoHistory
: formItem.merchantInfo != null
? formItem.merchantInfo
: null
/** 顶层与嵌套合并:history 明细里可能没有 baseSceneCode,保留 formItem 上字段 */
const mergedRow =
nestedRaw != null && typeof nestedRaw === "object"
? { ...formItem, ...nestedRaw }
: { ...formItem }
let mi = mergedRow && typeof mergedRow === "object" ? mergedRow : {}
const routeBsc = this.resolveRowBaseSceneCode(this.merchantRow)
if (pickSceneLookupCode(mi) === "" && routeBsc !== "") {
mi = { ...mi, baseSceneCode: routeBsc }
}
let pd = []
if (Array.isArray(formItem.merchantStoreProductDetailHistoryList)) {
pd = formItem.merchantStoreProductDetailHistoryList
} else if (Array.isArray(formItem.productDetails)) {
pd = formItem.productDetails
}
return {
traffic: buildTrafficProviderData(mi, this.relationSceneList),
business: buildBusinessForm(mi),
productDetails: pd,
}
},
// 商户关系
async getMerchantRelationRecord() {
const merchantId = this.merchantRow.merchantId
const scene = this.merchantRow.scene
const params = {
const params = this.withBaseSceneCode({
merchantId,
scene
scene,
})
try {
const scenes = await getBaseSceneCodeList({})
this.relationSceneList = normalizeBaseSceneListResponse(scenes)
} catch (e) {
console.warn(e)
this.relationSceneList = []
}
const res = await getMerchantRelationRecordApi(params)
if (res.length != 0) {
const format = "YYYY/MM/DD HH:mm"
this.formArray = res.map((item) => {
item.formatEffectEndDate = item.applyEndTime ? dayjs(item.applyEndTime).format(format) : ""
item.formatEffectStartDate = item.applyStartTime ? dayjs(item.applyStartTime).format(format) : ""
item.formatUpdatedDate = dayjs(item.operateDate).format(format)
item.updatedBy = item.operator
const updatedRaw = item.updatedDate != null ? item.updatedDate : item.operateDate
item.formatUpdatedDate = updatedRaw ? dayjs(updatedRaw).format(format) : "-"
item.updatedBy = item.createdBy ?? item.operator ?? "-"
item.show = false
return item
})
......@@ -292,7 +374,7 @@ export default {
components: {
ledgerAccount,
reconciliation,
merchantRelationships
MerchantRelationGroundingReadonly,
},
computed: {}
}
......
......@@ -65,8 +65,8 @@
<script>
import { Util, deepClone } from '@/common/util'
import { mapActions, mapState } from 'vuex'
import { sceneCodeList, ruleReview_status, ruleReview_type, withdrawalManageStatusList } from '@/common/constants.js'
import { withdrawOrderRecordPage, rewithdraw } from '@api/withdrawalManage'
import { ruleReview_status, ruleReview_type } from '@/common/constants.js'
import { getBaseSceneCodeList } from '@api/productManage'
import { ruleAuditPage, ruleAuditReject, ruleAuditCancel } from '@api/ruleReview'
export default {
name: 'TransferAccountsList',
......@@ -80,7 +80,7 @@ export default {
searchForm: {
merchantName: '',
merchantIdFuzzy: '',
sceneType: '',
baseSceneCode: '',
ruleType: '',
auditStatus: 1
},
......@@ -100,13 +100,13 @@ export default {
isClear: true
}, {
label: '业务场景',
name: 'sceneType',
name: 'baseSceneCode',
type: 'select',
isClear: true,
optionList: [],
optionId: 'confId',
optionLabel: 'confValue',
optionsName: 'sceneTypeList'
optionId: 'baseSceneCode',
optionLabel: 'name',
optionsName: 'baseSceneCodeListForFilter'
}, {
label: '类型',
name: 'ruleType',
......@@ -138,12 +138,12 @@ export default {
label: '商户号',
prop: 'merchantId',
width: '160px'
}, {
}, {
label: '业务场景',
prop: 'sceneType',
width: '100px',
prop: 'baseSceneCode',
width: '130px',
formatter: (cellValue) => {
return this.baseData.sceneTypeList.find(item => item.confId === cellValue.sceneType)?.confValue
return this.formatBusinessSceneName(cellValue)
}
},
{
......@@ -201,7 +201,7 @@ export default {
]
},
baseData: {
sceneTypeList: deepClone(sceneCodeList),
baseSceneCodeListForFilter: [],
statusList: deepClone(ruleReview_status),
typeList: deepClone(ruleReview_type)
}
......@@ -226,11 +226,48 @@ export default {
async getBaseData() {
this.getOptionsList()
this.loadBaseSceneFilterOptions()
},
loadBaseSceneFilterOptions() {
getBaseSceneCodeList({}).then((res) => {
this.baseData.baseSceneCodeListForFilter = Array.isArray(res) ? res : []
this.getOptionsList()
})
},
formatBusinessSceneName(row) {
if (row.baseSceneName) {
return row.baseSceneName
}
if (row.baseSceneCodeName) {
return row.baseSceneCodeName
}
const code = row.baseSceneCode
if (code != null && code !== '') {
const hit = this.baseData.baseSceneCodeListForFilter.find(
item => String(item.baseSceneCode) === String(code),
)
if (hit && hit.name) {
return hit.name
}
return String(code)
}
return ''
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchFormSearch = deepClone(this.searchForm)
const raw = deepClone(this.searchForm)
if (raw.baseSceneCode === '' || raw.baseSceneCode == null) {
delete raw.baseSceneCode
}
if (raw.auditStatus === '' || raw.auditStatus == null || raw.auditStatus === undefined) {
delete raw.auditStatus
} else {
raw.auditStatus = Number(raw.auditStatus)
}
this.searchFormSearch = raw
resolve()
})
},
......@@ -256,7 +293,7 @@ export default {
this.searchForm = {
merchantName: '',
merchantIdFuzzy: '',
sceneType: '',
baseSceneCode: '',
ruleType: '',
auditStatus: 1
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!