Commit a8d33194 by 张立顺

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 d987441b c09200d6
...@@ -12,13 +12,16 @@ import RequestMethods from "./request.methods"; ...@@ -12,13 +12,16 @@ import RequestMethods from "./request.methods";
const path = "dj.api."; const path = "dj.api.";
const path2 = "dj.api.smartcarlife."; const path2 = "dj.api.smartcarlife.";
export function getList(data) { /** 商户管理/关联 - 分页列表 */
// data.method = `${path2}merchantSettleAccountRule.page.byMerchant` export function pageServiceMerchantRef(data) {
// data.method = `${path}servicemerchantref.shop.page` data.method = "dj.api.servicemerchantref.newpageServiceMerchantRef";
data.method = `${path}servicemerchantref.pageServiceMerchantRef`;
return request(data); return request(data);
} }
export function getList(data) {
return pageServiceMerchantRef(data);
}
// 删除4s门店 // 删除4s门店
export function deleteMerchant(data) { export function deleteMerchant(data) {
data.method = `${path}servicemerchantref.delete.byId`; data.method = `${path}servicemerchantref.delete.byId`;
...@@ -319,6 +322,18 @@ export function deleteShopRef(data) { ...@@ -319,6 +322,18 @@ export function deleteShopRef(data) {
return request(data, RequestMethods.POST); 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店商户号查询二级流量方 // 根据4S店商户号查询二级流量方
export function getDiversionMerchantRef(data) { export function getDiversionMerchantRef(data) {
data.method = `${path2}diversionMerchant.getDiversionMerchantRef`; data.method = `${path2}diversionMerchant.getDiversionMerchantRef`;
...@@ -383,6 +398,12 @@ export function getMerchantRelationDetailApi(data) { ...@@ -383,6 +398,12 @@ export function getMerchantRelationDetailApi(data) {
return request(data, "post"); return request(data, "post");
} }
/** 商户上架编辑页详情(merchantId + baseSceneCode) */
export function queryMerchantDetail(data) {
data.method = `${path}servicemerchantref.queryMerchantDetail`;
return request(data, RequestMethods.POST);
}
// 获取4s店和服务商门店数据 // 获取4s店和服务商门店数据
export function get4sAndServiceMerchantListApi(data) { export function get4sAndServiceMerchantListApi(data) {
data.method = `${path}merchant.merchantAndService.page`; data.method = `${path}merchant.merchantAndService.page`;
......
...@@ -9,6 +9,23 @@ export const SCENE_TYPE_TO_BASE_SCENE_CODE = { ...@@ -9,6 +9,23 @@ export const SCENE_TYPE_TO_BASE_SCENE_CODE = {
7: 120101, 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 * @param {unknown} scene
* @returns {number} * @returns {number}
......
...@@ -123,8 +123,14 @@ export const routerName = { ...@@ -123,8 +123,14 @@ export const routerName = {
{ {
authId: "9060305", authId: "9060305",
parentId: "90603", parentId: "90603",
label: "删除", label: "禁用",
handle: "handleDelete", handle: "handleDisable",
},
{
authId: "90603019",
parentId: "90603",
label: "启用",
handle: "handleEnable",
}, },
{ {
authId: "90603011", authId: "90603011",
...@@ -196,7 +202,7 @@ export const routerName = { ...@@ -196,7 +202,7 @@ export const routerName = {
path: "/merchantGrounding", path: "/merchantGrounding",
name: "merchantGrounding", name: "merchantGrounding",
meta: { meta: {
title: "商户上架", title: "商户上架编辑",
authId: "90603015", authId: "90603015",
parentId: "90603", parentId: "90603",
cache: false, cache: false,
......
<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: {
productRows() {
return (this.productDetails || []).map(p => ({
...p,
revenue: p.estimatedRevenue != null ? p.estimatedRevenue : (p.revenue || 0),
}));
},
djGrossProfit() {
const { componentData, productRows } = 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;
productRows.forEach((item) => {
revenue = NP.plus(revenue, 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);
});
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.productRows.forEach((item) => {
revenue = NP.plus(revenue, item.revenue || 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-toolbar">
<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">
<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";
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: {
productValueKey(item) {
return `${item.productType || ""}+${item.productCategory || ""}`;
},
optionLabel(item) {
const t = item.productType || "-";
const c = item.productCategory || "-";
return `${t} + ${c}`;
},
formatField(row, field) {
if (field.key === "feeSettlementMode") {
return row[field.key] != null && row[field.key] !== "" ? row[field.key] : "-";
}
const v = row[field.key];
if (v === null || v === undefined || v === "") return "-";
return field.unit ? `${v}${field.unit}` : `${v}`;
},
},
};
</script>
<style scoped lang="scss">
.mg-sales-category {
padding: 20px;
}
.sales-toolbar {
margin-bottom: 16px;
}
.product-select {
width: 360px;
}
.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>
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);
}
},
},
};
/** 销售品类只读区块配置(字段与 ProductDetailDTO 对齐) */
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" },
],
},
];
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!