Commit 38ffaa4e by Jaxon

feat: 删除废弃的 shelfManage模块

1 parent 15353e70
Showing 83 changed files with 0 additions and 5139 deletions
<!-- 编辑 - 基础信息 -->
<template>
<div v-loading="loading" class="edit-page base-info">
<div class="title">
<span>基础信息</span>
</div>
<div style="padding: 20px 20px 0">
<el-form label-width="150px" :model="basicInfo">
<el-form-item v-for="(item, index) in editFormData"
:key="index"
class="form-item"
:style="{ width: [2, 7].includes(item.inputType) ? '100%' : '48%' }">
<template #label>
<span class="label">{{ item.title }}:</span>
</template>
<div v-if="item.inputType === 7">
<div v-if="!item.fileList.length">
-
</div>
<div v-else style="width:100%">
<div v-for="(k, kIdx) in item.fileList"
:key="kIdx"
class="file-name-wrapper">
<div class="name text-hide" :title="k.fileName">
{{ k.fileName }}
</div>
<el-link class="download"
:href="k.url"
type="primary">
下载
</el-link>
</div>
</div>
</div>
<span v-else
class="rich-text text-hide"
:title="item.showValue || '-'">
{{ item.showValue || "-" }}
</span>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
import { last } from "lodash-es";
import { getBusisDetailBasic } from "@/api/shelfManage.js";
export default {
name: "BaseInfo",
props: {
shelveId: {
type: [String, Number],
require: true,
},
},
data() {
return {
loading: false,
basicInfo: {},
editFormData: [],
};
},
computed: {
},
watch: {
},
async mounted() {
this.loading = true;
try {
await this.getData(this.shelveId);
} finally {
this.loading = false;
}
},
methods: {
async getData(shelveId) {
const { basicInfo } = await getBusisDetailBasic({ id: shelveId });
console.log("basicInfo", basicInfo);
if (!basicInfo?.basicApproveInfo) {
return [];
}
const editFormData = JSON.parse(basicInfo.basicApproveInfo);
console.log("editFormData", editFormData);
editFormData.forEach((item) => {
// 直接展示
if ([1, 2, 3, 4].includes(item.inputType)) {
item.showValue = item.value;
} else if (item.inputType === 5) {
// 单选
item.showValue = item.options.find(k => k.key == item.value)?.value || "";
} else if (item.inputType === 6) {
// 多选
// console.log(item.value, 'item.value')
const list = item.value.split(",");
item.showValue = "";
list.forEach((m, idx) => {
let label = item.options.find(k => k.key == m)?.value || "";
item.showValue = item.showValue + (idx !== 0 ? "," + label : label);
});
} else if (item.inputType === 7) {
// 附件
item.fileList = [];
if (basicInfo.goodsCreateExcel) {
const goodsCreateExcel = basicInfo.goodsCreateExcel.split("/");
item.fileList.push({
url: basicInfo.goodsCreateExcel,
fileName: last(goodsCreateExcel),
});
}
if (basicInfo?.submitGoodsCreateExcel) {
const submitGoodsCreateExcel = basicInfo.submitGoodsCreateExcel.split("/");
item.fileList.push({
url: basicInfo.submitGoodsCreateExcel,
fileName: last(submitGoodsCreateExcel),
});
}
// console.log(item.value, 'item.value')
const valueList = item.value ? item.value.split(",") : [];
valueList.forEach((k, kIdx) => {
if (k) {
item.fileList.push({
url: k,
fileName: k.split("/")[k.split("/").length - 1],
});
}
});
}
});
this.editFormData = editFormData;
this.baseInfo = basicInfo;
},
},
};
</script>
<style lang="scss">
@import "../../style/editdetailCon.scss";
.base-info {
.el-form-item__label {
padding-right: 0;
}
.el-form-item__label,
.el-form-item__content {
line-height: 20px !important;
}
.form-item {
display: inline-block;
line-height: 20px;
margin-bottom: 20px;
.file-name-wrapper {
width: 100%;
display: flex;
align-items: center;
overflow: hidden;
.download {
margin-left: 12px;
flex-shrink: 0;
}
}
}
.rich-text {
display: inline-block;
max-width: 98%;
overflow-wrap: break-word;
}
}
</style>
<!-- 驳回 -->
<template>
<baseDialog class="accountDailog"
:dialog-config="dialogConfig"
:is-show.sync="visible"
@handleClick="handleAddConfirm">
<div class="reject-dialog">
<glsx-combi-form ref="formRef"
class="edit-form-container"
default-width="350px"
:form-data="editFormData"
:form-obj="infoForm"
:form-ref="rejectRef"
:form-rules="formRules"
label-width="150px">
</glsx-combi-form>
</div>
</baseDialog>
</template>
<script>
import {
reject,
} from "@api/shelfManage.js";
export default {
name: "RejectDialog",
props: {
rejectVisible: {
type: Boolean,
default: false,
},
paramsObj: {
type: Object,
default: () => ({}),
},
},
data() {
return {
userInfo: this.$store.state.d2admin.user.info,
infoForm: {
remark: "",
},
dialogConfig: {
title: "驳回",
width: "600px",
},
rejectRef: "rejectRef",
formRules: {
remark: [{ required: true, message: "请输入驳回原因", trigger: "blur" }],
},
editFormData: [{
label: "驳回原因",
name: "remark",
type: "input",
maxlength: 50,
inputType: "textarea",
showLimit: true,
rows: 4,
}],
baseData: {
},
};
},
computed: {
visible: {
get() {
return this.rejectVisible;
},
set(newVal) {
this.$emit("dialogClose", { flag: newVal, attrName: "rejectVisible" });
},
},
},
mounted() {
console.log("paramsObj", this.paramsObj);
},
methods: {
handleAddConfirm() {
this.$refs.formRef.$refs[this.rejectRef].validate((valid) => {
if (valid) {
let params = {};
params.rejectedReason = this.infoForm.remark;
params.id = this.paramsObj.id;
reject(params).then((res) => {
this.notice.okTips("操作成功");
this.visible = true;
});
}
});
},
},
};
</script>
<style lang="scss" scoped>
.reject-dialog {
margin: 65px 0;
.reject-input {
::v-deep .el-textarea__inner {
height: 70px;
}
}
.el-textarea .el-input__count {
right: 90px;
bottom: -10px;
font-size: 12px;
color: #999999;
}
.tips {
color: #999999;
}
}
</style>
import { limitPrice } from "@/common/format";
import store from "@/store";
export const CategoryTypeOptions = [
{ label: "按商品分类", value: 1 },
{ label: "按具体商品", value: 2 },
{ label: "按具体套餐", value: 3 },
];
<template>
<el-row class="description-wrapper">
<template v-for="item in schema">
<el-col v-if="!isHideSchemaItem(item)" :key="item._key" :span="item.col || 12">
<slot :name="item.slot || item.name">
<div class="form-item" :style="item.itemStyle || {}">
<span class="label" :style="{ width: item.labelWidth || '150px' }">
<slot :name="`${item.slot || item.name}-label`">
{{ item.label }}{{ item.hideColon ? "" : ":" }}
</slot>
</span>
<span class="value">
<div class="text-hide" :style="{ width: item.valueWidth || '100%' }">
<template v-if="item.render">
<RenderProxy :render="item.render" :row="{ data, schemaItem: item, schema }" />
</template>
<template v-else>
<template v-if="item.tooltip && (getValue(item.descKey || item.name))">
<el-tooltip :content="isZeroOrNumber(getValue(item.descKey || item.name))"
v-bind="item.tooltipProps">
<div class="text-hide">
{{ isZeroOrNumber(getValue(item.descKey || item.name)) }}
</div>
</el-tooltip>
</template>
<template v-else>
<slot :name="`${item.slot || item.name}-value`">
{{ isZeroOrNumber(getValue(item.descKey || item.name)) }}
</slot>
</template>
</template>
</div>
</span>
</div>
</slot>
</el-col>
</template>
</el-row>
</template>
<script>
import { get, isFunction } from "lodash-es";
import { nanoid } from "nanoid";
import RenderProxy from "@/components/renderProxy/index.vue";
import { isZeroOrNumber } from "../../utils/index.js";
export default {
name: "Descriptions",
components: {
RenderProxy,
},
props: {
// hideColon 是否隐藏colon , 默认false
// name : - 唯一key , 数据的键值
// label : 文案
// col : 占24分之几
// valueWidth : 值的宽度,默认为100%
// labelWidth : 标签宽度,默认为150px
// slot : 整体的插槽名,优先级高于name
// itemStyle: 每一项的样式
// tooltip: boolean 是否用tooltip 展示data数据
// tooltipProps: el-tooltip 的传参
// render ?:(h,{ data,schemaItem,schema } )=>{} 自定义渲染
// isHide 是否隐藏 (data)=>boolean || boolean
schema: {
type: Array,
default: () => ([]),
},
data: {
type: Object,
default: () => ({}),
},
},
computed: {
getSchema() {
return this.schema.map(item => ({
...item,
_key: nanoid(),
}));
},
},
methods: {
isZeroOrNumber,
getValue(key) {
return get(this.data, key);
},
isHideSchemaItem(schemaItem) {
if (isFunction(schemaItem.isHide)) {
return schemaItem.isHide({ formModel: this.data });
}
return schemaItem.isHide;
},
},
render(h, ctx) {
return ctx.props.render(h, ctx.props.row);
},
};
</script>
<style scoped lang="scss">
.description-wrapper {
font-size: 14px;
.form-item {
display: flex;
flex-direction: row;
line-height: 32px;
margin-bottom: 20px;
>.label {
text-align: right;
color: #666666;
font-size: 14px;
flex-shrink: 0;
}
>.value {
flex-shrink: 0;
flex: 1;
overflow: hidden;
}
}
}
</style>
<!-- 查看 - 对账配置 -->
<template>
<div class="edit-page finance-config">
<div class="title">
<span>对账配置</span>
</div>
<div style="padding: 20px">
<el-tabs v-model="editableTabsValue"
class="my-tab-pane"
type="card">
<el-tab-pane v-for="(item, index) in editableTabs"
:key="index"
:label="item.title"
:name="item.name">
<div class="classificationCptContainer">
<el-form label-suffix=":" label-width="154px">
<h3 v-if="financialObj[editableTabsValue - 1].groupType == 1">
全部品类
</h3>
<div v-else style="display: flex">
<el-form-item label="对账品类" style="min-width: 250px">
{{
financialObj[editableTabsValue - 1].categoryType || "--"
}}
</el-form-item>
<el-form-item label="">
{{
financialObj[editableTabsValue - 1].packageArrText
}}
</el-form-item>
</div>
<template v-for="(item, index) in financialObj[editableTabsValue - 1]
.expenseCategoryTypeRules">
<el-form-item :key="index" :label="item.expenseCategoryName">
<span>
{{
getExpenseCategoryCalculateType(
item.expenseCategoryCalculateType,
item.expenseCategoryValue,
item.expenseCategoryName,
)
}}
</span>
</el-form-item>
</template>
</el-form>
</div>
</el-tab-pane>
</el-tabs>
</div>
</div>
</template>
<script>
import { deepClone } from "@/common/util";
import { baseConfig } from "@/main";
export default {
name: "FinanceConfig",
props: {
financeObj: {
type: Object,
default: () => { },
},
},
data() {
// 这里存放数据
return {
editableTabsValue: "1",
editableTabs: [],
financialObj: [],
};
},
watch: {
financeObj: {
handler(val, oldVal) {
if (val) {
this.initData(val);
}
},
immediate: true,
deep: true,
},
},
methods: {
getExpenseCategoryCalculateType(value, num, name) {
if (!value || value == 7 || num == null) {
return "-";
}
let res;
switch (value) {
case 1:
res = "按毛利比例:";
break;
case 2:
res = "按收入比例:";
break;
case 3:
res = "按固定金额:";
break;
case 4:
res = "按(产值-流量成本):";
break;
case 5:
res = "按(产值-流量成本-其他费用不包含产品成本):";
break;
case 6:
res = "按(产值-流量成本-其他费用包含产品成本):";
break;
case 8:
res = "按(收入-自定义其他费用):";
break;
case 9:
res = "按(收入-其他费用):";
break;
case 10:
res = `按固定金额${num}元*购买数量`;
break;
}
res = value == 10 ? res : res + num + (value == 3 ? "元" : "%");
return res;
},
initData(data) {
const typeList = deepClone(data.goodsTypeGroupReconciliationRules || []);
this.editableTabs = [];
const hasAllGoodsType = typeList.find(item => item.groupType == 1);
typeList.forEach((item, index) => {
const upgradeArr = [];
const packageArr = [];
const textArr = [];
this.editableTabs.push({
title: item.groupType == 1 ? "全部品类" : "特殊品类" + (hasAllGoodsType ? index : index + 1),
name: (index + 1).toString(),
});
// 按具体商品
if (
item.goodsTypeGroupRelations?.length
&& item.goodsTypeGroupRelations[0]?.categoryType == 2
) {
item.upgradeGoods = deepClone(item.goodsTypeGroupRelations);
item.categoryType = "按具体商品";
item.goodsTypeGroupRelations.forEach((val) => {
upgradeArr.push({
upgradeGoodsId: val.upgradeGoodsId,
upgradeGoodsName: val.upgradeGoodsName,
commodityCode: val.commodityCode,
});
textArr.push(val.upgradeGoodsName + `(${val.commodityCode})`);
});
item.packageArrText = textArr.join(",");
item.goodsTypeGroupRelations = [];
}
// 按套餐商品
if (
item.goodsTypeGroupRelations?.length
&& item.goodsTypeGroupRelations[0]?.categoryType == 3
) {
item.packageGoods = deepClone(item.goodsTypeGroupRelations);
item.categoryType = 3;
item.categoryType = "按套餐商品";
item.goodsTypeGroupRelations.forEach((val) => {
packageArr.push({
packageCode: val.packageCode,
packageName: val.packageName,
});
textArr.push(val.packageName + `(${val.packageCode})`);
});
item.packageArrText = textArr.join(",");
item.goodsTypeGroupRelations = [];
}
if (
item.goodsTypeGroupRelations?.length
&& item.goodsTypeGroupRelations[0]?.categoryType == 1
) {
item.goodsTypeGroupRelations = deepClone(item.goodsTypeGroupRelations);
item.categoryType = 1;
item.categoryType = "按商品分类";
item.goodsTypeGroupRelations?.forEach((val) => {
textArr.push(val.goodsTypeName + `(${val.goodsType})`);
});
item.packageArrText = textArr.join(",");
item.upgradeGoods = [];
}
});
this.financialObj = typeList;
this.filterData(typeList);
},
filterData() {
// let arrIdx = [1100, 810, 809, 807, 811]
const arrIdx = baseConfig.shelfManageFinanceConfig;
this.financialObj.forEach((item) => {
item.expenseCategoryTypeRules = [];
item.expenseCategoryRules.forEach((type) => {
if (arrIdx.includes(type.expenseCategoryId)) {
// if (type.expenseCategoryId == 1100)
// type.expenseCategoryName = "一线阳光激励费"
// if (type.expenseCategoryId == 809)
// type.expenseCategoryName = "一线阳光2激励费"
if (type.expenseCategoryId == 809) {
type.expenseCategoryName = "一线阳光激励费";
}
if (type.expenseCategoryId == 901) {
type.expenseCategoryName = "一线阳光2激励费";
}
item.expenseCategoryTypeRules.push(type);
}
});
// if (this.merchantEditData[0].operationMode == 0) {
// // item.expenseCategoryTypeRules = item.expenseCategoryTypeRules.fit
// }
this.$set(
item,
"expenseCategoryTypeRules",
item.expenseCategoryTypeRules,
);
});
},
},
};
</script>
<style lang="scss" scoped>
@import "../../style/editdetailCon.scss";
</style>
<!-- 编辑 - 上架商品及测算 -->
<template>
<div class="edit-page goods-info">
<div class="title">
<span>上架商品</span>
</div>
<div class="check-tab">
<el-tabs v-model="tabsValue"
class="my-tab-pane"
type="card">
<el-tab-pane v-for="(item, idx) in goodTabs"
:key="item.name"
:name="item.name">
<template #label>
<span>
<i v-if="item.valiadError == 'Y'"
class="el-icon-warning car-error-txt" />{{ item.title ? item.title + (idx + 1) : item.goodsName }}
</span>
</template>
<span>
<GoodTab :info="item.info"
:tab-idx="item.tabIndex" />
</span>
</el-tab-pane>
<el-tab-pane v-for="(item, idx) in packageTabs"
:key="item.name"
:label="item.title"
:name="item.name">
<template #label>
<span>
<i v-if="item.valiadError == 'Y'"
class="el-icon-warning car-error-txt" />{{ item.title ? item.title + (idx + 1) : item.goodsName }}
</span>
</template>
<span>
<PackageTab :info="item.info"
:tab-idx="item.tabIndex"
@packageEditInfo="getPackageEditInfo_notice" />
</span>
</el-tab-pane>
</el-tabs>
</div>
</div>
</template>
<script>
import { getGoodsDetail } from "@api/shelfManage.js";
import { deepClone } from "@/common/util";
import goodTab from "./common/goodTab.vue";
import packageTab from "./common/packageTab.vue";
export default {
name: "GoodsInfo",
components: {
GoodTab: goodTab,
PackageTab: packageTab,
},
props: {
recordId: {
type: Number,
default: null,
},
},
data() {
// 这里存放数据
return {
tabsValue: "1",
currentIndex: 1,
addIndex: 1,
tabIndex: 1,
goodTabs: [],
packageTabs: [],
goodInfoList: [],
packageInfoList: [],
goodsInfo: {},
};
},
computed: {
routeInfo() {
return this.$route.params;
},
},
mounted() {
this.getDetail();
},
methods: {
getDetail() {
console.log("getGoodsDetail");
// this.recordId
getGoodsDetail({ id: this.routeInfo.id })
.then((res) => {
console.log(res, "getGoodsDetail");
this.goodsInfo = res;
const goodsList = deepClone(res.goodsList);
const packageGoodsList = deepClone(res.packageGoodsList);
goodsList.forEach((item, idx) => {
const length = this.goodTabs.length;
const tabIndex
= length == 0 ? length : this.goodTabs[length - 1].tabIndex + 1;
this.goodTabs.push({
goodsName: item.upgradeGoodsName,
name: "good_" + tabIndex,
tabIndex,
// goodId: item.id,
info: item,
});
this.tabsValue = "good_" + tabIndex;
});
packageGoodsList.forEach((item, idx) => {
const length = this.packageTabs.length;
const tabIndex
= length == 0 ? length : this.packageTabs[length - 1].tabIndex + 1;
this.packageTabs.push({
goodsName: item.packageName,
name: "package_" + tabIndex,
tabIndex,
// goodId: item.id,
info: item,
});
this.tabsValue = "package_" + tabIndex;
});
this.packageNotice();
})
.catch((err) => {
console.log(err);
});
},
/* 活动标签切换时触发 */
beforeLeave(currentName, oldName) {
// console.log("currentName", currentName)
// 通过tab标签的切换事件触发增加的函数
// 如果name是add,则调用增加tab的函数
this.currentIndex = currentName;
},
// 填写套餐名称时通知
getPackageEditInfo_notice(obj) {
console.log("obj", obj);
this.packageTabs.find(item => item.tabIndex == obj.idx).info = obj.info;
this.packageNotice();
},
// 初始化、填写套餐名称时、删除套餐时通知
packageNotice() {
this.packageInfoList = [];
this.packageTabs.forEach((item) => {
if (item.info) {
console.log(item);
const o = {
name: item.info.val1 || item.info.packageName,
virtualCode: item.info.timeId,
id: item.info.id,
packageCode: item.info.packageCode,
};
this.packageInfoList.push(o);
}
});
},
},
};
</script>
<style lang="scss" scoped>
@import "../../style/editdetailCon.scss";
.addBtnSpan {
float: right;
}
</style>
<!--
* @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2025-02-28 15:16:11
* @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2025-02-28 16:04:13
* @FilePath: \dj-car-life-system\src\views\goods\shelfManage\components\detailCon\OperateList.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="edit-page">
<div class="title">
<span>操作记录</span>
</div>
<div v-if="list && list.length > 0" style="padding: 20px">
<div v-for="(item, index) in list"
:key="index"
class="wrap">
<div class="type">
{{ item.operatorTypeText }}
</div>
<div class="operate">
{{ item.operatorTypeText }}人:{{ item.createdBy }}
</div>
<div>操作时间:{{ item.createdDate }}</div>
</div>
</div>
<div v-else class="empty">
暂无记录
</div>
</div>
</template>
<script>
import { deepClone, Util } from "@/common/util";
export default {
name: "OperateList",
props: {
logList: {
type: Array,
default: () => [],
},
},
data() {
// 这里存放数据
return {
list: [],
types: { 1: "创建", 2: "驳回", 3: "确认", 4: "完成" },
};
},
watch: {
logList(val) {
this.list = val;
for (let item in this.types) {
this.list.forEach((ele) => {
if (ele.operatorType == item) {
ele.operatorTypeText = this.types[item];
}
});
}
// console.log(this.list, "✈")
this.list = deepClone(this.list);
},
},
methods: {},
};
</script>
<style lang="scss" scoped>
@import "../../style/editdetailCon.scss";
.wrap {
display: flex;
align-items: center;
color: #333333;
font-size: 14px;
margin-bottom: 20px;
.type {
font-weight: bold;
margin-right: 60px;
}
.operate {
min-width: 160px;
margin-right: 86px;
white-space: nowrap;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
}
}
.empty {
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
</style>
<!-- 查看 - 流量方信息 -->
<template>
<div class="edit-page shop-merchant-info-detail">
<div style="padding: 20px 20px 0">
<el-form label-width="250px" :model="merchantInfoDetail">
<el-form-item v-for="(item, index) in editFormData"
:key="index"
class="form-item"
:style="{ width: '48%' }">
<template #label>
<span class="label">{{ item.label }}:</span>
</template>
<span>{{ merchantInfoDetail[item.name] || "-" }}{{ item.suffix }}</span>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
import { sceneCodeList } from "@/common/constants.js";
import { deepClone } from "@/common/util";
import {
businessModeList,
onlinePointsEnabledList,
operationModeList,
} from "../../constant/baseData";
export default {
name: "ShopMerchantInfo",
props: {
merchantInfo: {
type: Object,
default: () => { },
},
},
data() {
// 这里存放数据
return {
editFormData: [
{
label: "流量方信息",
name: "merchantName",
},
{
label: "集团(上级商户)",
name: "parentMerchantName",
},
{
label: "业务模式",
name: "businessModeName",
attrName: "businessMode",
optionsName: "businessModeList",
},
{
label: "签约主体",
name: "contractingMerchantName",
},
{
label: "业务场景",
name: "sceneTypeName",
attrName: "sceneType",
optionLabel: "confValue",
optionsName: "sceneCodeList",
},
{
label: "园区店",
name: "yqMerchantName",
},
{
label: "预估流量/月",
name: "estimatedFlow",
},
{
label: "预估转化率",
name: "estimatedUpgradeRate",
suffix: "%",
},
{
label: "运营模式",
name: "operationModeName",
attrName: "operationMode",
optionsName: "operationModeList",
},
{
label: "服务商",
name: "partnerMerchantName",
},
{
label: "上级服务商",
name: "parentPartnerMerchantName",
},
{
label: "一线阳光是否开启线上积分",
name: "firstLineSunshineOnlinePointsFlag",
attrName: "firstLineSunshineOnlinePointsFlag",
optionsName: "onlinePointsEnabledList",
},
{
label: "一线阳光2是否开启线上积分",
name: "firstLineSunshine2OnlinePointsFlag",
attrName: "firstLineSunshine2OnlinePointsFlag",
optionsName: "onlinePointsEnabledList",
},
],
baseData: {
businessModeList,
sceneCodeList,
operationModeList,
onlinePointsEnabledList,
},
merchantInfoDetail: {},
};
},
watch: {
merchantInfo: {
handler(val, oldVal) {
if (val) {
this.dealInitData();
}
},
deep: true,
immediate: true,
},
},
methods: {
dealInitData() {
console.log(this.merchantInfo, "merchantInfo");
this.editFormData.forEach((item) => {
if (item.attrName) {
const obj
= this.baseData[item.optionsName].find(
k =>
k[item.optionId || "confId"] == this.merchantInfo[item.attrName],
) || {};
// console.log(this.merchantInfo[item.attrName], this.baseData[item.optionsName])
// console.log(obj, 'dealInitData')
this.merchantInfoDetail[item.name] = deepClone(obj[item.optionLabel || "confName"]);
} else {
this.merchantInfoDetail[item.name] = deepClone(this.merchantInfo[item.name]);
}
});
},
},
};
</script>
<style lang="scss">
@import "../../style/editdetailCon.scss";
.shop-merchant-info-detail {
.el-form-item__label {
padding-right: 0;
}
.el-form-item__label,
.el-form-item__content {
line-height: 20px !important;
}
.form-item {
display: inline-block;
line-height: 20px;
margin-bottom: 20px;
}
.download {
margin-left: 8px;
}
}
</style>
<template>
<div class="edit-page shop-merchant-info">
<div class="title">
<span>流量方信息</span>
</div>
<div class="content">
<el-tabs v-model="tabsValue"
:before-leave="beforeLeave"
class="my-tab-pane"
type="card">
<el-tab-pane v-for="(item) in tabsList"
:key="item.tabIndex"
:name="`${item.tabIndex}`">
<template #label>
<span>
<i v-if="item.valiadError == 'Y'" class="el-icon-warning car-error-txt" />{{ item.title }}
</span>
</template>
<span>
<!-- <shop-merchant-info :merchantInfo="merchantInfo"></shop-merchant-info> -->
<ShopMerchantInfo :key="item.tabIndex"
:ref="`shopMerchant${item.tabIndex}`"
:edit-data-obj="merchantsList[item.tabIndex]"
:merchant-info="merchantsList[item.tabIndex]">
</ShopMerchantInfo>
</span>
</el-tab-pane>
</el-tabs>
</div>
</div>
</template>
<script>
import { deepClone } from "@/common/util";
import ShopMerchantInfo from "./ShopMerchantInfo";
export default {
name: "EditMultilateralContract",
components: {
ShopMerchantInfo,
},
props: {
merchantsList: {
type: Array,
default: () => { },
},
},
data() {
return {
tabsValue: 0,
tabsList: [],
};
},
watch: {
merchantsList(val) {
this.tabsList = val.map((item, idx) => {
return {
title: item.merchantName,
tabIndex: idx,
};
});
},
},
mounted() { },
methods: {
getAllParams() {
const list = deepClone(this.tabsList);
const merchants = [];
// 需要使用for循环解决异步同步问题
for (let index = 0; index < list.length; index++) {
// const element = array[index];
const node = this.$refs[`shopMerchant${list[index].tabIndex}`][0];
const res = node.getParams();
merchants.push(res);
}
return merchants;
// })
},
submit() {
return new Promise(async (resolve, reject) => {
let flag = true;
const list = deepClone(this.tabsList);
// 需要使用for循环解决异步同步问题
for (let index = 0; index < list.length; index++) {
// const element = array[index];
const node = this.$refs[`shopMerchant${list[index].tabIndex}`][0];
const res = await node.submit();
flag = flag && res;
}
this.$forceUpdate();
resolve(flag);
});
},
/* 活动标签切换时触发 */
beforeLeave(currentName, oldName) {
// console.log("currentName", currentName)
// 通过tab标签的切换事件触发增加的函数
this.currentIndex = currentName;
},
},
};
</script>
<style scoped lang="scss">
@import "../../style/editdetailCon.scss";
.shop-merchant-info {
.add-mer-btn {
margin-left: 12px;
}
}
.content {
box-sizing: border-box;
margin: 20px 20px 0 20px;
}
</style>
<!-- 编辑 - 基础信息 -->
<template>
<div class="edit-page base-info">
<div class="title">
<span>基础信息</span>
</div>
<div style="padding: 20px 20px 0">
<el-form label-width="150px" :model="basicInfo">
<el-form-item v-for="(item, index) in editFormData"
:key="index"
class="form-item"
:style="{ width: [2, 7].includes(item.inputType) ? '100%' : '48%' }">
<template #label>
<span class="label">{{ item.title }}:</span>
</template>
<div v-if="item.inputType == 7">
<div v-if="item.fileList.length == 0">
-
</div>
<div v-else>
<div v-for="(k, kIdx) in item.fileList" :key="kIdx">
<span>{{ k.fileName }}</span>
<el-link class="download"
:href="k.url"
type="primary">
下载
</el-link>
</div>
</div>
</div>
<span v-else class="rich-text">{{ item.showValue || "-" }}</span>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
export default {
name: "BaseInfo",
props: {
basicInfo: {
type: Object,
default: () => ({}),
},
},
data() {
// 这里存放数据
return {
};
},
computed: {
/**
* 动态表单
* inputType 输入类型,1.文本;2.多行文本;3.数字;4.金额;5.单选;6.多选;7.附件;
*/
editFormData() {
if (!this.basicInfo?.basicApproveInfo) {
return [];
}
const editFormData = JSON.parse(this.basicInfo.basicApproveInfo);
editFormData.forEach((item) => {
// 直接展示
if ([1, 2, 3, 4].includes(item.inputType)) {
item.showValue = item.value;
} else if (item.inputType === 5) {
// 单选
item.showValue = item.options.find(k => k.key == item.value)?.value || "";
} else if (item.inputType === 6) {
// 多选
// console.log(item.value, 'item.value')
const list = item.value.split(",");
item.showValue = "";
list.forEach((m, idx) => {
let label = item.options.find(k => k.key == m)?.value || "";
item.showValue = item.showValue + (idx != 0 ? "," + label : label);
});
} else if (item.inputType == 7) {
// 附件
item.fileList = [];
if (this.basicInfo.goodsCreateExcel) {
item.fileList.push({
url: this.basicInfo.goodsCreateExcel,
fileName: this.basicInfo.goodsCreateExcel.split("/")[this.basicInfo.goodsCreateExcel.split("/").length - 1],
});
}
if (this.basicInfo.submitGoodsCreateExcel) {
item.fileList.push({
url: this.basicInfo.submitGoodsCreateExcel,
fileName: this.basicInfo.submitGoodsCreateExcel.split("/")[this.basicInfo.goodsCreateExcel.split("/").length - 1],
});
}
// console.log(item.value, 'item.value')
const valueList = item.value ? item.value.split(",") : [];
valueList.forEach((k, kIdx) => {
if (k) {
item.fileList.push({
url: k,
fileName: k.split("/")[k.split("/").length - 1],
});
}
});
}
});
return editFormData;
},
},
watch: {
},
mounted() { },
methods: {
dealFormData() {
console.log("this.basicInfo", this.basicInfo);
this.editFormData = JSON.parse(this.basicInfo.basicApproveInfo);
console.log("this.editFormData", this.editFormData);
this.editFormData.forEach((item) => {
// 直接展示
if ([1, 2, 3, 4].includes(item.inputType)) {
item.showValue = item.value;
} else if (item.inputType == 5) {
// 单选
item.showValue
= item.options.find(k => k.key == item.value)?.value || "";
} else if (item.inputType == 6) {
// 多选
// console.log(item.value, 'item.value')
const list = item.value.split(",");
item.showValue = "";
list.forEach((m, idx) => {
let label = item.options.find(k => k.key == m)?.value || "";
item.showValue = item.showValue + (idx != 0 ? "," + label : label);
});
} else if (item.inputType == 7) {
// 附件
item.fileList = [];
if (this.basicInfo.goodsCreateExcel) {
item.fileList.push({
url: this.basicInfo.goodsCreateExcel,
fileName: this.basicInfo.goodsCreateExcel.split("/")[this.basicInfo.goodsCreateExcel.split("/").length - 1],
});
}
if (this.basicInfo.submitGoodsCreateExcel) {
item.fileList.push({
url: this.basicInfo.submitGoodsCreateExcel,
fileName: this.basicInfo.submitGoodsCreateExcel.split("/")[this.basicInfo.goodsCreateExcel.split("/").length - 1],
});
}
// console.log(item.value, 'item.value')
const valueList = item.value ? item.value.split(",") : [];
valueList.forEach((k, kIdx) => {
if (k) {
item.fileList.push({
url: k,
fileName: k.split("/")[k.split("/").length - 1],
});
}
});
}
});
},
},
};
</script>
<style lang="scss">
@import "../../style/editdetailCon.scss";
.base-info {
.el-form-item__label {
padding-right: 0;
}
.el-form-item__label,
.el-form-item__content {
line-height: 20px !important;
}
.form-item {
display: inline-block;
line-height: 20px;
margin-bottom: 20px;
}
.download {
margin-left: 8px;
}
.rich-text {
display: inline-block;
max-width: 90%;
overflow-wrap: break-word;
}
}
</style>
<template>
<d2-dialog class="relateStore"
:is-visible.sync="dialogShow"
:no-cancel="true"
title="变更说明"
width="40%"
@closeDialog="dialogShow = false"
@confirmDialog="dialogShow = false">
<d2-table :has-page="false"
:table-data="tableData"
:table-params="tableParams">
</d2-table>
</d2-dialog>
</template>
<script type='text/ecmascript-6'>
export default {
name: "RuleUpdateDialog",
props: {
show: Boolean,
tableData: {
type: Array,
default: () => {
return [];
},
},
},
data() {
return {
tableParams: {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: "list",
tableColumns: [
{
label: "变更内容",
prop: "diffType",
width: 120,
},
{
label: "变更后",
prop: "diffAfter",
},
{
label: "变更前",
prop: "diffBefore",
},
],
},
};
},
computed: {
dialogShow: {
get() {
return this.show;
},
set(n) {
this.$emit("update:show", n);
},
},
},
mounted() {
},
methods: {
init() {
},
handleClick() {
},
},
};
</script>
<style scoped lang='scss'>
.dialog {
&-content {
padding: 5px 0;
.month {
display: flex;
align-items: center;
margin-bottom: 32px;
.label {
color: #333333;
font-size: 14px;
width: 150px;
display: flex;
align-items: center;
justify-content: flex-end;
&::before {
content: "*";
color: #eb4e4e;
display: block;
margin-right: 6px;
}
}
}
}
.input-box {
padding: 4px 10px;
display: flex;
align-items: center;
justify-content: center;
}
}
</style>
<template>
<div class="edit-page shop-merchant-info">
<div class="title">
<span>流量方信息</span>
</div>
<div class="content">
<el-tabs v-model="tabsValue"
:before-leave="beforeLeave"
class="my-tab-pane"
type="card">
<el-tab-pane v-for="(item) in tabsList"
:key="item.tabIndex"
:name="`${item.tabIndex}`">
<template #label>
<span>
<i v-if="item.valiadError === 'Y'" class="el-icon-warning car-error-txt" />{{ item.title }}
</span>
</template>
<span>
<ShopMerchantInfo :key="item.tabIndex"
:ref="`shopMerchant${item.tabIndex}`"
:edit-data-obj="merchantsList[item.tabIndex]"
:platform-level-list="platformLevelList"
:service-list="serviceList"
:yq-merchant-list="yqMerchantList">
</ShopMerchantInfo>
</span>
</el-tab-pane>
</el-tabs>
</div>
</div>
</template>
<script>
import { getPlatformMerchantList } from "@api/index";
import {
getServiceList,
// serviceGetMerchantList,
getyqMerchantList,
// getMerchantLevelApi
} from "@api/merchant";
import { deepClone } from "@/common/util";
import ShopMerchantInfo from "./ShopMerchantInfo.vue";
export default {
name: "EditMultilateralContract",
components: {
ShopMerchantInfo,
},
props: {
merchantsList: {
type: Array,
default: () => { },
},
},
data() {
return {
tabsValue: 0,
tabsList: [],
yqMerchantList: [],
serviceList: [],
platformLevelList: [],
};
},
watch: {
merchantsList(val) {
this.tabsList = val.map((item, idx) => {
return {
title: item.merchantName,
tabIndex: idx,
};
});
},
},
async mounted() {
await this.initList();
},
methods: {
async getYqMerchantList() {
const res = await getyqMerchantList({ currentPage: 1, pageSize: 100000 });
res?.list?.forEach((val) => {
val.merchantId = val.merchantNo - 0;
});
this.yqMerchantList = res?.list || [];
},
async getServiceListData() {
const res = await getServiceList({ currentPage: 1, pageSize: 100000 });
res?.list?.forEach((val) => {
val.merchantId = val.merchantNo - 0;
});
this.serviceList = res?.list || [];
},
async getPlatformMerchantListData() {
const res = await getPlatformMerchantList({});
res.unshift({
merchantId: -1,
merchantName: "嘀加智慧云",
});
this.platformLevelList = res;
},
async initList() {
await this.getYqMerchantList();
await this.getServiceListData();
await this.getPlatformMerchantListData();
},
getAllParams() {
const list = deepClone(this.tabsList);
const merchants = [];
// 需要使用for循环解决异步同步问题
for (let index = 0; index < list.length; index++) {
// const element = array[index];
const node = this.$refs[`shopMerchant${list[index].tabIndex}`][0];
const res = node.getParams();
merchants.push(res);
}
return merchants;
// })
},
async submit() {
let flag = true;
const list = deepClone(this.tabsList);
// 需要使用for循环解决异步同步问题
for (let index = 0; index < list.length; index++) {
// const element = array[index];
const node = this.$refs[`shopMerchant${list[index].tabIndex}`][0];
const res = await node.submit();
flag = flag && res;
}
this.$forceUpdate();
return flag;
},
},
};
</script>
<style scoped lang="scss">
@import "../../style/editdetailCon.scss";
.shop-merchant-info {
.add-mer-btn {
margin-left: 12px;
}
}
.content {
box-sizing: border-box;
margin: 20px 20px 0 20px;
}
</style>
<template>
<div class="detail-wrapper">
<Descriptions :data="packageData" :schema="packagesSchema" />
<el-divider class="divider"></el-divider>
<div v-for="productData in goodsList"
:key="productData.id"
class="product-detail-wrapper">
<Product :product="productData"
:mode="VIEW_MODE.VIEW"
:scene-type="productData.sceneType"
:show-business-line="false"
:show-sales-proportion-percent="false"
:show-settlement-type="false"
:show-gift-cost="false"
:show-penetration-rate="false"
use-parent-mode />
<el-divider class="divider"></el-divider>
</div>
</div>
</template>
<script>
import { cloneDeep } from "lodash-es";
import Descriptions from "@/views/goods/shelfManage/components/descriptions/index.vue";
import { productShelvingComboDetailFormItems } from "@/views/goods/shelfManage/components/productShelving/productShelving.data.js";
import { VIEW_MODE } from "@/views/goods/shelfManage/constant/baseData";
import Product from "../../../product/index.vue";
export default {
components: {
Descriptions,
Product,
},
props: {
packages: {
type: Object,
default: () => ({ }),
},
},
data() {
return {
VIEW_MODE,
packageData: {},
packagesSchema: productShelvingComboDetailFormItems,
goodsList: [],
};
},
watch: {
packages: {
handler(val) {
const packages = cloneDeep(val);
this.packageData = packages;
console.log("packageData", this.packageData);
this.goodsList = packages?.merchantGoodsInfoList;
},
immediate: true,
deep: true,
},
},
mounted() {
},
methods: {
},
};
</script>
<style lang="scss" scoped>
.detail-wrapper {
padding: 20px;
.product-detail-wrapper {
padding-top: 16px;
}
}
.divider {
margin: 0px 16px 0;
width: calc(100% - 32px);
}
</style>
<template>
<div class="content">
<div class="tabs-wrapper">
<Detail v-show="mode === VIEW_MODE.VIEW"
v-bind="$attrs"
v-on="$listeners" />
<Modify v-show="mode === VIEW_MODE.EDIT"
ref="modifyRef"
v-bind="$attrs"
v-on="$listeners" />
</div>
</div>
</template>
<script>
import { VIEW_MODE } from "@/views/goods/shelfManage/constant/baseData.js";
import Detail from "./components/detail/index.vue";
import Modify from "./components/modify/index.vue";
export default {
name: "",
components: {
Modify,
Detail,
},
inheritAttrs: false,
props: {
mode: {
type: String,
default: VIEW_MODE.VIEW,
},
},
data() {
return {
VIEW_MODE,
};
},
methods: {
async validate() {
const modifyRef = this.$refs.modifyRef;
if (!modifyRef) {
// 尚未初始化
return;
}
return await modifyRef.validate();
},
},
};
</script>
<style scoped lang="scss">
</style>
<template>
<div class="detail-wrapper">
<Descriptions :data="localData" :schema="formItems">
<template #upgradeGoodsId-value>
<div class="sub-desc-wrapper">
<Descriptions :data="localData" :schema="subFormItems" />
</div>
</template>
</Descriptions>
</div>
</template>
<script>
import { cloneDeep } from "lodash-es";
import Descriptions from "@/views/goods/shelfManage/components/descriptions/index.vue";
import { getProductShelvingProductDetailSubFormItems, productShelvingProductDetailFormItems } from "@/views/goods/shelfManage/components/productShelving/productShelving.data.js";
import { handleCoverProductForm } from "@/views/goods/shelfManage/components/productShelving/utils/index.js";
export default {
name: "",
components: {
Descriptions,
},
props: {
product: {
type: Object,
required: true,
},
// 当套餐加载这个组件的时候 不需要业务线
showBusinessLine: {
type: Boolean,
default: true,
},
// 当套餐加载这个组件的时候 不需要结算方式
showSettlementType: {
type: Boolean,
default: true,
},
// 当套餐加载这个组件的时候 不需要销售占比
showSalesProportionPercent: {
type: Boolean,
default: true,
},
// 当套餐加载这个组件的时候 不需要赠送成本
showGiftCost: {
type: Boolean,
default: true,
},
// 当套餐加载这个组件的时候 不需要渗透率
showPenetrationRate: {
type: Boolean,
default: true,
},
},
data() {
return {
subFormItems: [],
schema: [],
localData: {},
};
},
computed: {
formItems() {
return this.schema.filter((item) => {
if (item.name === "businessLine") {
return this.showBusinessLine;
}
if (item.name === "settlementType") {
return this.showSettlementType;
}
if (item.name === "salesProportionPercent") {
return this.showSalesProportionPercent;
}
if (item.name === "giftCost") {
return this.showGiftCost;
}
if (item.name === "penetrationRate") {
return this.showPenetrationRate;
}
return true;
});
},
},
watch: {
product: {
handler(val) {
this.localData = cloneDeep(val);
},
immediate: true,
},
},
async mounted() {
this.schema = await productShelvingProductDetailFormItems();
this.subFormItems = await getProductShelvingProductDetailSubFormItems();
},
};
</script>
<style scoped lang="scss">
.sub-desc-wrapper {
background: #f2f4f7;
padding: 16px 8px 0;
// border-bottom: 1px solid #eee;
}
.detail-wrapper {
padding: 20px 20px 0;
}
</style>
<template>
<div class="">
<Detail v-show="mode === VIEW_MODE.VIEW"
v-bind="$attrs"
:mode="mode"
v-on="$listeners" />
<Modify v-show="mode === VIEW_MODE.EDIT"
v-bind="$attrs"
ref="modifyRef"
:mode="mode"
v-on="$listeners" />
</div>
</template>
<script>
import { VIEW_MODE } from "@/views/goods/shelfManage/constant/baseData.js";
import Detail from "./components/detail/index.vue";
import Modify from "./components/modify/index.vue";
export default {
components: {
Detail,
Modify,
},
inheritAttrs: false,
props: {
mode: {
type: String,
required: true,
},
},
data() {
return {
VIEW_MODE,
};
},
computed: {
},
watch: {
},
methods: {
async validate() {
const modifyRef = this.$refs.modifyRef;
if (!modifyRef) {
// 尚未初始化
return;
}
return await modifyRef.validate();
},
},
};
</script>
export const productFromRules = {
upgradeGoodsId: [
{ required: true, message: "请选择上架商品", trigger: "change" },
],
position: [
{ required: true, message: "请选择上架部位", trigger: "change" },
],
businessLine: [
{ required: true, message: "请选择业务线", trigger: "change" },
],
settlementType: [
{ required: true, message: "请选择结算方式", trigger: "change" },
],
salesProportionPercent: [
{ required: true, message: "请输入销售占比", trigger: "change" },
],
penetrationRate: [
{ required: true, message: "请输入渗透率要求", trigger: "change" },
],
sellPrice: [
{ required: true, message: "请输入售价", trigger: "change" },
],
minSellPrice: [
{ required: true, message: "请输入最低售价", trigger: "change" },
],
thirdPartyCost: [
{ required: true, message: "请输入第三方成本", trigger: "change" },
],
upgradeProductCost: [
{ required: true, message: "请输入升级成本", trigger: "change" },
],
};
export const packageFormRules = {
packageName: [
{ required: true, message: "请输入套餐名称", trigger: "change" },
],
businessLine: [
{ required: true, message: "请选择业务线", trigger: "change" },
],
settlementType: [
{ required: true, message: "请选择结算方式", trigger: "change" },
],
salesProportionPercent: [
{ required: true, message: "请输入销售占比", trigger: "change" },
],
penetrationRate: [
{ required: true, message: "请输入渗透率要求", trigger: "change" },
],
};
import { cloneDeep } from "lodash-es";
import { convertYuanToWan, filterSpecsStr } from "@/views/goods/filterOption.js";
export function getFormServiceItemNames(upgradeGoodsServiceItemsList = []) {
const textArr = upgradeGoodsServiceItemsList?.map((item) => {
return `${item.serviceName}-${item.serviceGrade}/${item.servicePeriod}${item.serviceItemId
? `/${convertYuanToWan(item.minPrice)}-${convertYuanToWan(item.maxPrice)}万`
: ""
}`;
});
return textArr?.join(",") || "";
}
export function getGoodsTypes(goodsInfo) {
const { goodsTypeName, secondaryGoodsTypeName, thirdLevelGoodsTypeName } = goodsInfo || {};
const types = [
goodsTypeName,
];
if (secondaryGoodsTypeName) {
types.push(secondaryGoodsTypeName);
}
if (thirdLevelGoodsTypeName) {
types.push(thirdLevelGoodsTypeName);
}
return types.join("-");
}
export function filterEmpty(data) {
return (data ?? "") === "";
}
export function handleCoverProductForm(product = {}) {
product.upgradeGoods = makeUpgradeGoods(product);
return product;
}
export function makeUpgradeGoods(formData) {
console.log(formData);
return {
// ...formData,
// 商品名称
upgradeGoodsName: formData.upgradeGoodsName,
// 规格
specificationData: filterSpecsStr(formData.upgradeGoods),
// 商品编码
type: formData.upgradeGoods?.type,
// 第三方编码
thirdPartyCode: formData.upgradeGoods?.thirdPartyCode,
// 采购价
purchasePrice: formData.upgradeGoods?.purchasePrice,
// 参考售价
upgradePrice: formData.upgradeGoods?.upgradePrice,
// 适用车型
carTypeConfigName: formData.upgradeGoods?.carTypeConfigList?.map(item => item.seriesName).join("/"),
// 所属系列
goodsName: formData.goodsInfo?.goodsName,
// 所属分类
tempGoodsTypeName: getGoodsTypes(formData?.goodsInfo),
// 商品ID
upgradeCommodityCode: formData.upgradeGoods?.commodityCode,
// 上架部位
position: formData.upgradeGoods?.position,
positionList: formData.upgradeGoods.position?.split(",")?.map(item => Number(item.trim())),
djCost: formData.upgradeGoods?.djCost,
// 商品别名
goodsAlias: formData.goodsAlias,
// 服务项目
serviceItemNames: getFormServiceItemNames(formData.upgradeGoods?.upgradeGoodsServiceItemsList),
// 实体卡
entityCardFlag: formData.upgradeGoods?.entityCardFlag,
// 质保年限
warrantyPeriod: formData.upgradeGoods?.warrantyPeriod,
};
}
// 价格计算精度丢失处理
export function subStrPrice(num1, num2) {
let r1, r2;
try {
r1 = num1.toString().split(".")[1].length;
} catch (e) {
r1 = 0;
}
try {
r2 = num2.toString().split(".")[1].length;
} catch (e) {
r2 = 0;
}
const m = 10 ** Math.max(r1, r2);
const n = r1 >= r2 ? r1 : r2;
return ((num1 * m + num2 * m) / m).toFixed(n);
}
<template>
<div class="division-rule">
<p class="edit-sub-title">
实际分账设置 (用于定义费用的实际分账归属)
</p>
<el-form ref="divisionRuleRef"
class="formSty"
label-suffix=":"
label-width="180px"
:model="form"
:rules="rules">
<el-form-item label="" label-width="54px">
<table cellpadding="0"
cellspacing="0"
class="table-block">
<tr class="tableHeader">
<td>分账对象/分账类目</td>
<!-- <td>平台方分账金额</td> -->
<td v-for="(item, index) in radioList" :key="index">
{{ item.applicationObjectName || item.expenseCategoryName }}
</td>
</tr>
<tr>
<td class="merchantNameTd p-b-20">
<p v-for="(item, index) in tableSelectOptions"
:key="index"
:title="item | filterMerchantType">
{{ item | filterMerchantType }}
</p>
</td>
<td v-for="(item, index) in radioList"
:key="`${index}radioList`"
class="p-b-20">
<el-form-item label-width="0"
:prop="`id${item.expenseCategoryId}`">
<el-radio-group v-model="form[`id${item.expenseCategoryId}`]"
@change="
(e) => handleClearValid(e, `id${item.expenseCategoryId}`)
">
<el-radio v-for="(el, index2) in tableSelectOptions"
:key="index2"
:label="el.merchantId" />
</el-radio-group>
</el-form-item>
</td>
</tr>
</table>
</el-form-item>
</el-form>
</div>
</template>
<script>
// import { userType } from '@/common/constants'
export default {
name: "TableAccount",
filters: {
// 过滤商户类型
filterMerchantType(val) {
const name = {
1: "平台方",
2: "服务商",
3: "流量方",
4: "平台方",
};
const type = val.targetMerchantType;
return `${name[type]}: ${val.merchantName}`;
},
},
props: {
// 列选项
tableCategoryOptions: {
type: Object,
default: () => { },
},
merchantDistributionRules: {
type: Array,
default: () => {
return [];
},
},
owningMerchantDistributionRules: {
type: Array,
default: () => {
return [];
},
},
// 分账对象选项 1:平台方 2:服务商 3:流量方 4:子商户
tableSelectCategoryOptions: {
type: Array,
default: () => [],
},
},
data() {
return {
// 多商户存导流方id
copyMerchantInfo: {},
form: {
// settleTimeType: 1
},
rules: {},
};
},
computed: {
radioList() {
const obj = this.classificationObjSelect;
let list = [];
let arr = [];
const arrIdx = [1, 2, 302, 701, 4];
for (const key in obj) {
obj[key].map((item) => {
if (
arrIdx.includes(item.id)
|| arrIdx.includes(item.expenseCategoryId)
) {
list.push(item);
}
});
}
arr = list.filter((item) => {
return (
arrIdx.includes(item.id) || arrIdx.includes(item.expenseCategoryId)
);
});
// console.log('list', arr)
return arr;
},
},
watch: {
// merchantDistributionRules: {
// handler() {
// this.initList();
// },
// deep: true,
// // immediate: true
// },
},
mounted() { },
methods: {
initList() {
const obj = this.classificationObjSelect;
const tableSelectOptionsId = this.tableSelectOptions.some(item => item.merchantId == 1);
const form = {};
// 判断是不是多商户的,是改一下结构绑定
for (const key in obj) {
obj[key].map((item) => {
// 数字转字符串
const name = "id" + item.expenseCategoryId;
// 做回显用数据
const findObj = this.merchantDistributionRules.find((el) => {
return el.expenseCategoryId == item.expenseCategoryId;
});
// 还要跟存在现在的选项里面
form[name] = findObj?.merchantId || "";
});
}
// 判断id是否有在选项里面 没有就去掉
Object.assign(this.form, form);
},
changFormList() {
// console.log(this.form,'this.form')
// 判断id是否有在选项里面 没有就去掉
for (const key in this.form) {
const element = this.form[key];
const index = this.tableSelectOptions.findIndex((opt) => {
return opt.merchantId == element;
});
if (index === -1) {
this.form[key] = "";
}
}
this.$forceUpdate();
},
handleClearValid(e, validField) {
this.$forceUpdate();
// this.handleConfirm()
// console.log('validField', validField)
this.$refs.divisionRuleRef.clearValidate(validField);
},
async handleConfirm() {
const valid = await this.$refs.divisionRuleRef.validate();
if (valid) {
// this.form
return this.getTableAccountParams();
}
},
getTableAccountParams() {
const merchantDistributionRules = this.radioList.reduce((prev, next) => {
const id = this.form["id" + next.expenseCategoryId];
// console.log(id)
const merchantObj = this.tableSelectOptions.find(
// (item) => item.merchantId == id
// (item) => (item.merchantId == id) || item.targetMerchantLevel == id
item => (item.merchantId == id) || (item.targetMerchantType == 3 && item.targetMerchantLevel == id),
);
if (merchantObj?.merchantId == 1) {
merchantObj.merchantId = this.copyMerchantInfo.merchantId;
merchantObj.merchantName = this.copyMerchantInfo.merchantName;
}
next = {
...next,
expenseCategoryId: next.expenseCategoryId,
...merchantObj,
};
// console.log(next, 'next')
// const name = 'id' + next.id
// prev[name] = this.form[name]
prev.push(next);
return prev;
}, []);
return merchantDistributionRules;
},
},
};
</script>
<style scoped lang="scss">
// .formSty {
// overflow-x: scroll;
// }
// .division-rule table {
// width: 98%;
// color: #666666;
// border: 1px solid #e5e6e7;
// border-width: 1px 0 0 1px;
// }
// .division-rule table tr {
// height: 50px;
// line-height: 50px;
// }
// .division-rule table th,
// .division-rule table td {
// font-size: 12px;
// font-weight: normal;
// padding: 0px 10px;
// border: 1px solid #e5e6e7;
// border-width: 0px 1px 1px 0px;
// border-spacing: 0;
// text-align: center;
// min-width: 100px;
// white-space: nowrap;
// /* white-space: nowrap; */
// /* overflow: hidden; */
// /* text-overflow: ellipsis; */
// }
// .division-rule table .merchantNameTd {
// min-width: 150px;
// }
// .division-rule .flex {
// display: flex;
// justify-content: space-around;
// }
// .table-block td {
// font-size: 14px !important;
// }
// .division-rule .table-block .el-radio {
// display: block;
// height: 60px;
// line-height: 42px;
// margin-right: 0;
// }
// .p-b-20 {
// padding-bottom: 26px !important;
// }
// .division-rule ::v-deep {
// .table-block .el-radio__label {
// display: none !important;
// }
// }
</style>
<!-- 2 - 分账金额设置 -->
<template>
<div class="attribution-setting-wrapper">
<el-form-item :label="title" style="flex:1;">
<table cellpadding="0"
cellspacing="0"
class="table-block">
<tr class="table-header">
<th>分账对象/分账类目</th>
<!-- <td>平台方分账金额</td> -->
<th v-for="(item, index) in tableCols"
:key="index">
<span class="required-star">*</span>
{{ item.feeCategoryName || item.expenseCategoryName }}
</th>
</tr>
<tr v-for="(item, rowIndex) in tableRows"
:key="item.targetMerchantType"
class="table-body">
<td class="merchant-name-wrapper">
<span :title="getMerchantTypeName(item)">
{{ getMerchantTypeName(item) }}
</span>
</td>
<template v-for="(colItem, colIndex) in tableCols">
<td :key="`${colIndex}colList`" class="radio-wrapper">
<!-- 只在最后一行渲染 el-form-item 用于校验整列,避免每行都产生校验规则和报错 -->
<el-form-item v-if="rowIndex === tableRows.length - 1"
:prop="propPrefix ? `${propPrefix}_${colItem.expenseCategoryId}` : ''"
:rules="[{
required: true,
validator: validate,
trigger: 'change',
colItem,
}]"
class="column-validator-item"
label-width="0">
<el-radio :value="value[colItem.expenseCategoryId]"
:label="item.targetMerchantType"
:disabled="disabled"
@input="val => handleRadioChange(colItem.expenseCategoryId, val)">
{{ "" }}
</el-radio>
</el-form-item>
<el-radio v-else
:value="value[colItem.expenseCategoryId]"
:label="item.targetMerchantType"
:disabled="disabled"
@input="val => handleRadioChange(colItem.expenseCategoryId, val)">
{{ "" }}
</el-radio>
</td>
</template>
</tr>
</table>
</el-form-item>
</div>
</template>
<script>
import { cloneDeep, uniqBy } from "lodash-es";
// targetMerchantType 决定行数
// expenseCategoryId 决定列数
import { mapGetters, mapState } from "vuex";
// import { userType } from '@/common/constants'
import { getTableFilterIds, isBatchPublishMode, isSingleShopMode } from "../../utils/feeCategoryHelper.js";
export default {
name: "TableAccount",
props: {
title: {
type: String,
default: "",
},
tableCols: {
type: Array,
default: () => ([]),
},
// 分账对象选项 1:平台方 2:服务商 3:流量方 4:子商户
tableRows: {
type: Array,
default: () => ([]),
},
value: {
type: Object,
default: () => ({}),
},
disabled: {
type: Boolean,
default: false,
},
propPrefix: {
type: String,
default: "",
},
},
data() {
return {
copyMerchantInfo: {}, // 多商户存导流方id
rules: {},
// 导流方下拉选项对应
attrToVal: [
{
confId: 3,
confLabel: "city",
},
{
// confId: 4,
confId: 2,
confLabel: "province",
},
{
// confId: 5,
confId: 1,
confLabel: "factory",
},
],
realityShopMerchant: {
merchantId: "",
merchantName: "",
userType: "",
},
};
},
computed: {
...mapState("ShelfManage/ProfitSharingConfigStore", ["shelfType", "sceneType"]),
...mapGetters("ShelfManage/ProfitSharingConfigStore", {
_expenseCategoryRules: "expenseCategoryRules",
goodsTypeGroupRules: "goodsTypeGroupRules",
}),
},
mounted() {},
methods: {
validate(rule, val, callback) {
const { colItem } = rule;
console.log(rule);
// 由于 prop 是拼接的虚拟路径(如 prefix_123),el-form 传入的 val 永远是 undefined。
// 我们需要从 rule.field 中解析出真实的 expenseCategoryId,并从 this.value 中获取真实值
const expenseCategoryId = rule.field ? rule.field.split("_").pop() : null;
const actualValue = expenseCategoryId ? this.value[expenseCategoryId] : val;
if (actualValue === undefined || actualValue === null) {
callback(new Error(`请选择${colItem.feeCategoryName || colItem.expenseCategoryName}`));
} else {
callback();
}
},
handleRadioChange(expenseCategoryId, val) {
const newValue = { ...this.value, [expenseCategoryId]: val };
this.$emit("input", newValue);
// 手动触发该列的表单校验,以消除由于点击非第一行 radio 而未触发的校验错误
if (this.propPrefix) {
const propName = `${this.propPrefix}_${expenseCategoryId}`;
this.$nextTick(() => {
let parent = this.$parent;
while (parent && parent.$options.componentName !== "ElForm") {
parent = parent.$parent;
}
if (parent) {
parent.validateField(propName);
}
});
}
},
getMerchantTypeName(item) {
const name = {
1: "平台方",
2: "服务商",
3: "流量方",
4: "平台方",
5: "服务商2",
};
// 如果是 项目制批量上架 不显示name
if (isBatchPublishMode(this.shelfType)) {
return item.merchantName;
}
const type = item.targetMerchantType;
return `${name[type]}: ${item.merchantName}`;
},
},
};
</script>
<style scoped lang="scss">
.attribution-setting-wrapper {
display: flex;
> .label {
width: 150px;
text-align: right;
flex-shrink: 0;
vertical-align: middle;
font-size: 14px;
color: #606266;
line-height: 32px;
padding: 0 12px 0 0;
box-sizing: border-box;
}
.form-wrapper {
overflow-x: scroll;
flex-shrink: 0;
flex: 1;
}
::v-deep .table-block {
width: 100%;
table-layout: fixed;
border-collapse: collapse;
th,
td {
border: 1px solid #e5e5e5;
}
.table-header {
padding: 14px 0;
th {
width: auto;
line-height: 20px;
color: #333333;
font-size: 14px;
&:first-child {
width: 150px;
}
.required-star {
color: #f56c6c;
margin-right: 4px;
}
}
}
.table-body {
td {
padding: 18px 0;
}
.merchant-name-wrapper {
line-height: 20px;
color: #666666;
font-size: 14px;
text-align: center;
}
.radio-wrapper {
text-align: center;
.el-form-item {
margin-bottom: 0 !important;
.el-form-item__content {
justify-content: center;
align-items: center;
.el-radio {
margin-right: 0;
}
.el-form-item__error {
width: 100%;
}
}
}
.column-validator-item {
::v-deep .el-form-item__error {
position: relative;
padding-top: 4px;
}
}
}
}
// th,
// td {
// font-size: 12px;
// font-weight: normal;
// padding: 0px 10px;
// border: 1px solid #e5e6e7;
// border-width: 0px 1px 1px 0px;
// border-spacing: 0;
// text-align: center;
// min-width: 100px;
// white-space: nowrap;
// &.merchant-name-wrapper {
// min-width: 150px;
// }
// }
// td {
// font-size: 14px !important;
// }
}
}
.pb-20 {
padding-bottom: 26px !important;
}
</style>
<template>
<div class="detail-wrapper ">
<Descriptions :form-items="formItems" />
</div>
</template>
<script>
import Descriptions from "@/views/goods/shelfManage/components/descriptions/index.vue";
import { ShopMerchantFormData } from "../modify/data.js";
export default {
name: "Detail",
components: {
Descriptions,
},
props: {
trafficSourceData: {
type: Object,
default: () => ({}),
},
baseData: {
type: Object,
default: () => ({}),
},
},
data() {
return {
};
},
computed: {
formItems() {
return ShopMerchantFormData.map(item => ({
name: item.name,
label: item.label,
valueWidth: "314px",
labelWidth: "250px",
itemStyle: {
"margin-right": "30px",
},
}));
},
},
mounted() {
},
methods: {
getDisplayValue(item) {
// const value = this.editData[item.name];
// if (item.type === "select" && item.optionsName && this.baseData[item.optionsName]) {
// const option = this.baseData[item.optionsName].find(opt => opt[item.optionId] === value);
// return option ? option[item.optionLabel] : value;
// }
// return value || "";
},
},
};
</script>
<style scoped lang="scss">
.detail-wrapper {
padding-top: 20px;
}
</style>
import { limitPrice } from "@/common/format";
import store from "@/store";
export const ShopMerchantInfoFormRules = {
merchantId: [
{ required: true, message: "请选择流量方信息" },
],
parentMerchantName: [
{ required: true, message: "请选择集团(上级商户)" },
],
businessMode: [
{ required: true, message: "请选择业务模式" },
],
contractingMerchantId: [
{ required: true, message: "请选择签约主体" },
],
sceneType: [
{ required: true, message: "请选择业务场景" },
],
yqMerchantId: [
{ required: true, message: "请选择园区店" },
],
estimatedFlow: [
{ required: true, message: "请输入预估流量" },
],
estimatedUpgradeRate: [
{ required: true, message: "请输入预估转化率" },
],
operationMode: [
{ required: true, message: "请选择运营模式" },
],
partnerMerchantId: [
{ required: true, message: "请选择服务商" },
],
parentPartnerMerchantId: [
{ required: true, message: "请输入上级服务商" },
],
firstLineSunshineOnlinePointsFlag: [
{ required: true, message: "请选择一线阳光是否开启线上积分" },
],
firstLineSunshine2OnlinePointsFlag: [
{ required: true, message: "请选择一线阳光2是否开启线上积分" },
],
};
const isHideSomes = false;
// TODO: 修改this
export const ShopMerchantFormData = [
{
label: "流量方信息",
name: "merchantId",
addHtml: "merchantId",
style: { width: "calc( 50% - 30px )" },
placeholder: "请选择流量方信息",
optionList: [],
optionId: "merchantId",
optionLabel: "merchantName",
optionsName: "merchantList",
searchKey: "merchantNameKeyword",
},
{
label: "集团(上级商户)",
name: "parentMerchantName",
type: "input",
style: { width: "calc( 50% - 30px )" },
placeholder: "选择流量方后自动获取",
isDisabled: true,
},
{
label: "业务模式",
name: "businessMode",
type: "select",
style: { width: "calc( 50% - 30px )" },
optionList: [],
optionId: "confId",
optionLabel: "confName",
optionsName: "businessModeList",
},
{
label: "签约主体",
name: "contractingMerchantId",
type: "select",
style: { width: "calc( 50% - 30px )" },
optionList: [],
optionId: "merchantId",
optionLabel: "merchantName",
optionsName: "contractMerList",
},
{
label: "业务场景",
name: "sceneType",
type: "select",
style: { width: "calc( 50% - 30px )" },
isDisabled: true,
optionList: [],
optionId: "confId",
optionLabel: "confValue",
optionsName: "sceneCodeList",
},
{
label: "园区店",
name: "yqMerchantId",
type: "select",
style: { width: "calc( 50% - 30px )" },
optionList: [],
optionId: "merchantId",
optionLabel: "merchantName",
optionsName: "yqMerchantList",
},
{
label: "预估流量/月",
name: "estimatedFlow",
type: "input",
style: { width: "calc( 50% - 30px )" },
maxlength: 6,
isHide: false,
},
{
label: "预估转化率",
name: "estimatedUpgradeRate",
type: "input",
style: { width: "calc( 50% - 30px )" },
maxlength: 6,
append: "%",
},
{
label: "运营模式",
name: "operationMode",
type: "select",
style: { width: "calc( 50% - 30px )" },
optionList: [],
optionId: "confId",
optionLabel: "confName",
optionsName: "operationModeList",
},
{
label: "服务商",
name: "partnerMerchantId",
type: "select",
style: { width: "calc( 50% - 30px )" },
isDisabled: false,
optionList: [],
optionId: "merchantId",
optionLabel: "merchantName",
optionsName: "partnerMerchantList",
},
{
label: "上级服务商",
name: "parentPartnerMerchantName",
type: "input",
style: { width: "calc( 50% - 30px )" },
maxlength: 50,
},
{
label: "一线阳光是否开启线上积分",
name: "firstLineSunshineOnlinePointsFlag",
type: "select",
style: { width: "calc( 50% - 30px )" },
optionList: [],
optionId: "confId",
optionLabel: "confName",
optionsName: "onlinePointsEnabledList",
},
{
label: "一线阳光2是否开启线上积分",
name: "firstLineSunshine2OnlinePointsFlag",
type: "select",
style: { width: "calc( 50% - 30px )" },
optionList: [],
optionId: "confId",
optionLabel: "confName",
optionsName: "onlinePointsEnabledList",
},
];
<!-- 编辑 - 流量方信息 -->
<template>
<div class="modify-wrapper">
<glsx-combi-form ref="editFormRef"
class="edit-form-container"
default-width="314px"
:form-data="editFormData"
:form-obj="editData"
:form-ref="editChildRef"
:form-rules="formRules"
label-width="250px">
<template #merchantId="scope">
<div>
<el-select v-model="editData[scope.scope.name]"
disabled
:placeholder="scope.scope.placeholder"
style="width: 314px">
<el-option v-for="subItem in scope.scope.optionList"
:key="subItem[scope.scope.optionId]"
:label="subItem[scope.scope.optionLabel]"
:value="subItem[scope.scope.optionId]">
</el-option>
</el-select>
</div>
</template>
</glsx-combi-form>
</div>
</template>
<script>
import { getMerchantLevelApi, serviceGetMerchantList } from "@api/merchant";
import { mapGetters, mapMutations } from "vuex";
import { sceneCodeList } from "@/common/constants.js";
import { deepClone } from "@/common/util";
import { businessModeList, onlinePointsEnabledList, operationModeList } from "../../../../constant/baseData";
import { ShopMerchantFormData, ShopMerchantInfoFormRules } from "./data.js";
export default {
name: "ShopMerchantInfo",
props: {
editDataObj: {
type: Object,
default: () => ({}),
},
serviceList: {
type: Array,
default: () => ([]),
},
yqMerchantList: {
type: Array,
default: () => ([]),
},
platformLevelList: {
type: Array,
default: () => ([]),
},
},
data() {
// 这里存放数据
return {
editData: {},
editChildRef: "editChildRef",
storeCurrentPage: 1, // 流量方 - 4s店数据分页
pageSize: 50,
merchantNameKeyword: "", // 流量方下拉框搜索
selected4SOptionObj: {}, // 已选的4S店
formRules: ShopMerchantInfoFormRules,
editFormData: ShopMerchantFormData,
baseData: {
merchantList: [],
merchantLevelList: [],
businessModeList,
contractMerList: [],
sceneCodeList,
yqMerchantList: [],
operationModeList,
onlinePointsEnabledList,
partnerMerchantList: [],
},
};
},
computed: {},
mounted() {
this.getOptionsList();
},
methods: {
...mapMutations("goodsInfoData", ["SET_DATA"]),
getOptionsList() {
},
async submit() {
// 直接利用验证回调构造的 promise,返回布尔值
return this.$refs.editFormRef.$refs[this.editChildRef].validate();
},
},
};
</script>
<style lang="scss" scoped>
.modify-wrapper {
padding-top: 20px;
}
.shop-merchant-info {
.add-mer-btn {
margin-left: 12px;
}
}
</style>
<template>
<div v-if="isInitialized" class="">
<Detail v-if="mode === VIEW_MODE.VIEW"
v-bind="$attrs"
:goods-list="options.productType"
:scene-type="sceneType"
v-on="$listeners" />
<Modify v-if="mode === VIEW_MODE.EDIT"
ref="modifyRef"
:goods-list="options.productType"
:scene-type="sceneType" />
</div>
</template>
<script>
import { mapActions, mapState } from "vuex";
import { getProfitSharingConfigOtherGoodsItemApi } from "@/api/shelfManage.js";
import {
queryFeeCategoryByType as getFeeCategoryByTypeApi,
getGoodsCategoryConfiguration as getGoodsCategoryConfigurationApi,
} from "@/api/sys.base.js";
import { VIEW_MODE } from "@/views/goods/shelfManage/constant/baseData.js";
import Detail from "./specialCategoryDetail/index.vue";
import Modify from "./specialCategoryModify/index.vue";
export default {
components: {
Detail,
Modify,
},
inheritAttrs: false,
props: {
mode: {
type: String,
require: true,
},
},
data() {
return {
VIEW_MODE,
localGoodsTypeGroupRules: {},
options: {
category: {},
productType: [],
selectedGoodsType: [],
},
isInitialized: false,
};
},
computed: {
...mapState("ShelfManage/ProfitSharingConfigStore", {
sceneType: state => state.sceneType,
goodsTypeGroupRules: state => state.profitSharingForm.goodsTypeGroupRules,
businessCode: "businessCode",
specialCategory: "specialCategory",
}),
},
watch: {
},
async mounted() {
await this.init();
},
methods: {
...mapActions("ShelfManage/ProfitSharingConfigStore", ["getFeeCategoryByType"]),
async init() {
try {
// 商品分类
await this.getProductTypeOptions();
} finally {
this.isInitialized = true;
}
},
async validate() {
const modifyRef = this.$refs.modifyRef;
if (!modifyRef) {
// 尚未初始化
return;
}
return await modifyRef.validate();
},
async getProductTypeOptions() {
const { list } = await getGoodsCategoryConfigurationApi({});
if (!this.options.selectedGoodsType.length) {
const goodsTypeGroupRuleId = String(this.specialCategory.active).startsWith("nano-") ? undefined : this.specialCategory.active;
const selectedGoods = await getProfitSharingConfigOtherGoodsItemApi({
goodsTypeGroupRuleId,
categoryType: 1,
businessCode: this.businessCode,
});
this.options.selectedGoodsType = selectedGoods.map(item => item.goodsType);
}
if (list && list.length) {
this.options.productType = list.map(({ categoryType, categoryName }) => {
return {
goodsType: categoryType,
goodsTypeName: categoryName,
disabled: this.options.selectedGoodsType.includes(categoryType),
};
});
}
},
},
};
</script>
<!-- 分账配置 - 特殊品类 - 编辑状态 -->
<template>
<div class="detail-wrapper ">
<Descriptions :schema="getSchema" :data="getSchemaData" />
<CostAttributionSetting v-model="owningMerchantDistributionRulesMap"
prop-prefix="owningMerchantDistributionRulesMap"
title="费用归属设置"
:disabled="true"
:table-cols="tableCols"
:table-rows="tableRows" />
<CostAttributionSetting v-model="merchantDistributionRulesMap"
prop-prefix="merchantDistributionRulesMap"
title="实际分账设置"
:disabled="true"
:table-cols="tableCols"
:table-rows="tableRows" />
</div>
</template>
<script>
import { mapGetters, mapState } from "vuex";
import {
defaultSelectOptions,
otherSelectOptions,
severSelectOptions,
} from "@/common/constant/merchant";
import Descriptions from "@/views/goods/shelfManage/components/descriptions/index.vue";
import { isZeroOrNumber } from "@/views/goods/shelfManage/utils/index.js";
import { CategoryTypeOptions } from "../../../../data.js";
import { getTableCols, getTableRows, rulesToMap } from "../../../utils/feeCategoryHelper.js";
import CostAttributionSetting from "../../costAttributionSetting/index.vue";
export default {
name: "SpecialCategoryDetail",
components: {
Descriptions,
CostAttributionSetting,
},
props: {
trafficSourceData: {
type: Object,
default: () => ({}),
},
baseData: {
type: Object,
default: () => ({}),
},
},
data() {
return {
};
},
computed: {
...mapState("ShelfManage/ProfitSharingConfigStore", ["businessCode", "specialCategory", "sceneType", "profitSharingForm", "shelfType"]),
...mapGetters("ShelfManage/ProfitSharingConfigStore", {
financialLedgerParty: "financialLedgerParty",
_goodsTypeGroupRules: "goodsTypeGroupRules",
_goodsTypeGroupRelations: "goodsTypeGroupRelations",
_expenseCategoryRules: "expenseCategoryRules",
trafficSideExpenseCategoryRules: "trafficSideExpenseCategoryRules",
}),
owningMerchantDistributionRulesMap() {
return rulesToMap(this._goodsTypeGroupRules?.owningMerchantDistributionRules, this.tableRows, this.tableCols);
},
merchantDistributionRulesMap() {
return rulesToMap(this._goodsTypeGroupRules?.merchantDistributionRules, this.tableRows, this.tableCols);
},
tableCols() {
return getTableCols(this.sceneType, this._expenseCategoryRules, this._goodsTypeGroupRules);
},
tableRows() {
return getTableRows(this.profitSharingForm, this.shelfType);
},
getSchemaData() {
const data = this.trafficSideExpenseCategoryRules.reduce((acc, item) => {
const isAmount = [3, 10].includes(item.expenseCategoryCalculateType);
const unit = isAmount ? "元" : "%";
const value = isZeroOrNumber(item.expenseCategoryValue);
let typeLabel = "";
const options = this.getExpenseCategoryCalculateTypeOptions(item.applicationObjectType);
const opt = options.find(o => o.expenseCategoryCalculateType === item.expenseCategoryCalculateType);
if (opt) {
typeLabel = opt.label;
}
acc[item.expenseCategoryId] = {
text: `${value}${unit}`,
typeLabel,
};
return acc;
}, {});
if (this._goodsTypeGroupRules.groupType !== 1) {
const categoryTypeOpt = CategoryTypeOptions.find(o => o.value === this._goodsTypeGroupRules.categoryType);
data.categoryType = { text: categoryTypeOpt ? categoryTypeOpt.label : "-" };
let goodsStr = "-";
if (this._goodsTypeGroupRelations && this._goodsTypeGroupRelations.length) {
goodsStr = this._goodsTypeGroupRelations.map((item) => {
if (this._goodsTypeGroupRules.categoryType === 1)
return item.goodsTypeName;
if (this._goodsTypeGroupRules.categoryType === 2)
return `${item.upgradeGoodsName}(${item.commodityCode})`;
if (this._goodsTypeGroupRules.categoryType === 3)
return `${item.packageName}(${item.packageCode})`;
return "-";
});
}
data.goodsTypeGroupRelations = { text: goodsStr };
}
return data;
},
getSchema() {
const schema = this.trafficSideExpenseCategoryRules.map((item) => {
return {
descKey: item.expenseCategoryId,
label: item.expenseCategoryName || item.applicationObjectName,
col: 24,
render: (h, { data, schemaItem }) => {
const info = data[schemaItem.descKey];
if (!info)
return h("span", "-");
return h("span", info.typeLabel ? `${info.typeLabel}:${info.text}` : info.text);
},
};
});
if (this._goodsTypeGroupRules.groupType !== 1) {
schema.unshift(
{
descKey: "categoryType",
label: "分账品类",
col: 24,
render: (h, { data, schemaItem }) => {
const info = data[schemaItem.descKey];
return h("span", info ? info.text : "-");
},
},
{
descKey: "goodsTypeGroupRelations",
label: "商品",
col: 24,
render: (h, { data, schemaItem }) => {
const info = data[schemaItem.descKey];
if (!info || info.text === "-") {
return h("span", "-");
}
if (Array.isArray(info.text)) {
return h("div", { class: "goods-relations-wrap" }, info.text.join(","));
}
return h("span", info.text);
},
},
);
}
return schema;
},
},
mounted() {
},
methods: {
getExpenseCategoryCalculateTypeOptions(targetType) {
if (targetType === 1) {
return [...defaultSelectOptions, ...otherSelectOptions];
}
if (targetType === 2) {
return severSelectOptions;
}
if (targetType === 3) {
return defaultSelectOptions;
}
return [];
},
},
};
</script>
<style scoped lang="scss">
::v-deep .goods-relations-wrap {
white-space: normal;
word-break: break-all;
overflow-wrap: anywhere;
}
</style>
export const realityShopLevelOptions = [
{ realityShopLevel: 1, realityShopLevelName: "流量方" },
{ realityShopLevel: 2, realityShopLevelName: "上级流量方" },
];
export const profitSharingFormRules = {
"realityShopMerchantId": [
{ required: true, message: "请选择流量方", trigger: "change" },
],
"realityShopLevel": [
{ required: true, message: "请选择流量方", trigger: "change" },
],
"goodsTypeGroupRules.categoryType": [
{ required: true, message: "请选择分账品类", trigger: "change" },
],
"goodsTypeGroupRules.goodsTypeGroupRelations": [
{ required: true, message: "请选择商品或套餐", trigger: "change" },
],
};
import { cloneDeep, uniqBy } from "lodash-es";
import { isMemberRightsUpgrade, isQualityUpgrade, isSolarFilm } from "@/views/goods/shelfManage/utils/index.js";
/**
* 费用类别处理工具
* 用于处理分账配置中的费用类别数据转换、验证和分类
*/
/**
* 是否为单店模式
*/
export function isSingleShopMode(shelfType) {
return shelfType === 1;
}
/**
* 是否为批量模式
*/
export function isBatchPublishMode(shelfType) {
return shelfType === 2;
}
/**
* 表格仅展示下面这些expenseCategoryId || feeCategoryNameId
* @param {*} sceneType
* @returns
*/
export function getSelectFilterIds(sceneType) {
const ids = [1, 2, 1300];
if (isMemberRightsUpgrade(sceneType)) {
// 会员权益升级 需要1301 资源费
ids.push(1301);
}
return ids;
}
/**
* 表格仅展示下面这些expenseCategoryId || feeCategoryNameId
* @param {*} sceneType
* @returns
*/
export function getTableFilterIds(sceneType) {
const sceneTypeFilter = {
// 精品升级
1: [1, 2, 3, 4, 301, 1300],
// 会员升级权益
0: [1, 2, 4, 701, 1300, 1301],
};
return sceneTypeFilter[sceneType] || [];
}
/**
* 将 expenseCategoryRules 的值 设置到 feeCategoryList 上,返回feeCategoryList
* 会修改 feeCategoryList的值
* @param feeCategoryList
* @param expenseCategoryRules
*/
export function syncExpenseCategoryRulesToFeeCategoryType(feeCategoryList, expenseCategoryRules) {
return feeCategoryList.map((feeItem) => {
feeItem.expenseCategoryId = feeItem.feeCategoryNameId;
feeItem.expenseCategoryName = feeItem.feeCategoryName;
const expenseCategory = expenseCategoryRules.find(item => feeItem.feeCategoryNameId === item.expenseCategoryId);
return {
expenseCategoryId: feeItem.feeCategoryNameId,
expenseCategoryName: feeItem.feeCategoryName,
...feeItem,
...expenseCategory || {},
};
});
}
export function getSubDataGoodsTypeGroupRelations(goodsTypeGroupRelations, categoryType) {
return goodsTypeGroupRelations.map(item => ({
categoryType,
upgradeGoodsId: item.upgradeGoodsId,
goodsType: item.goodsType,
goodsTypeName: item.goodsTypeName,
packageCode: item.packageCode,
packageName: item.packageName,
upgradeGoodsName: item.upgradeGoodsName,
commodityCode: item.commodityCode,
tempPackageCode: item.tempPackageCode,
}));
}
export function getSubDataOwningMerchantDistributionRules(owningMerchantDistributionRules, sceneType) {
const filterData = owningMerchantDistributionRules.filter(item => getTableFilterIds(sceneType).includes(item.expenseCategoryId));
return filterData.map(item => ({
targetMerchantType: item.targetMerchantType,
targetMerchantLevel: item.targetMerchantLevel,
ruleType: item.ruleType,
merchantId: item.merchantId,
merchantName: item.merchantName,
expenseCategoryId: item.expenseCategoryId,
expenseCategoryName: item.expenseCategoryName,
diffTypes: item.diffTypes,
convertRate: item.convertRate,
}));
}
export function getSubDataExpenseCategoryRules(expenseCategoryRules, sceneType) {
const filterIds = getSelectFilterIds(sceneType);
const filterData = expenseCategoryRules.filter(item => filterIds.includes(item.id));
return filterData.map((item) => {
const result = {
nodeType: item.nodeType,
expenseCategoryId: item.expenseCategoryId,
expenseCategoryName: item.expenseCategoryName,
targetMerchantId: item.targetMerchantId,
targetMerchantName: item.targetMerchantName,
calculateMode: item.calculateMode,
expenseCategoryCalculateType: item.expenseCategoryCalculateType,
expenseCategoryValue: item.expenseCategoryValue,
diffTypes: item.diffTypes,
distributeTargetMerchantType: item.distributeTargetMerchantType,
distributeTargetMerchantId: item.distributeTargetMerchantId,
distributeTargetMerchantName: item.distributeTargetMerchantName,
merchantId: item.merchantId,
merchantName: item.merchantName,
};
if (item.children && item.children.length) {
result.children = item?.children?.map(cItem => ({
nodeType: cItem.nodeType,
expenseCategoryId: cItem.expenseCategoryId,
expenseCategoryName: cItem.expenseCategoryName,
targetMerchantId: cItem.targetMerchantId,
targetMerchantName: cItem.targetMerchantName,
calculateMode: cItem.calculateMode,
expenseCategoryCalculateType: cItem.expenseCategoryCalculateType,
expenseCategoryValue: cItem.expenseCategoryValue,
diffTypes: cItem.diffTypes,
distributeTargetMerchantType: cItem.distributeTargetMerchantType,
distributeTargetMerchantId: cItem.distributeTargetMerchantId,
distributeTargetMerchantName: cItem.distributeTargetMerchantName,
merchantId: cItem.merchantId,
merchantName: cItem.merchantName,
}));
}
return result;
});
}
export function getDefaultProfitSharingForm() {
return {
divisionRuleAutos: [
// {
// paymentChannelName:"",
// autoFlag:"", Y | N
// settleTime:0,
// },
],
// 流量方分账方 批量模式
realityShopLevel: undefined,
// 流量方分账方 单店模式
realityShopMerchantId: undefined,
// 详情
goodsTypeGroupRules: {
goodsTypes: [],
expenseCategoryRules: [],
goodsTypeGroupRelations: [],
merchantDistributionRules: [],
owningMerchantDistributionRules: [],
},
// 实际分账4S店商户名称
realityShopMerchantName: "",
// 实际分账4S店商户用户类型(1工厂2省代3市代4门店)
realityShopUserType: "",
// 自动分账标识(Y是,N否)
autoFlag: "N",
// 分账时间方式(1:T+1,2:每月)
settleTimeType: 1,
// 分账时间每月几号
settleTime: "",
// 实际分账平台方商户id(嘀加智慧云为-1)
realityPlatformMerchantId: "",
// 实际分账平台方商户名称
realityPlatformMerchantName: "",
// 实际分账平台方商户用户类型(1工厂2省代3市代4门店)
realityPlatformUserType: "2",
merchantId: "",
merchantName: "",
sceneType: "",
// 是否多平台
multiPlatformMerchantFlag: "N",
partnerMerchantId: "",
partnerMerchantName: "",
};
}
export function getTableCols(sceneType, expenseCategoryRules, goodsTypeGroupRules) {
const filterIdList = getTableFilterIds(sceneType);
const tableCols = cloneDeep(expenseCategoryRules.filter(item => filterIdList.includes(item.feeCategoryNameId)) || []);
console.log("tableCols", tableCols);
if (goodsTypeGroupRules.virtualAccountCostFlag === "Y") {
tableCols.push({
id: 300,
feeCategoryNameId: 300,
expenseCategoryId: 300,
feeCategoryName: "虚拟对账成本",
applicationObjectName: "虚拟对账成本",
applicationObjectType: 3,
});
}
if (goodsTypeGroupRules.recoveryCostFlag === "Y") {
tableCols.push({
id: 301,
feeCategoryNameId: 301,
expenseCategoryId: 301,
feeCategoryName: "回收成本",
applicationObjectName: "回收成本",
applicationObjectType: 3,
});
}
if (goodsTypeGroupRules.djCostFlag === "Y") {
tableCols.push({
id: 700,
feeCategoryNameId: 700,
expenseCategoryId: 700,
feeCategoryName: "嘀加成本",
applicationObjectName: "嘀加成本",
applicationObjectType: 3,
});
}
tableCols.push({
id: 4,
feeCategoryNameId: 4,
expenseCategoryId: 4,
feeCategoryName: "手续费",
applicationObjectName: "手续费",
applicationObjectType: 3,
});
return uniqBy(tableCols, "expenseCategoryId");
}
export function getTableRows(profitSharingForm, shelfType) {
function getMerchantSide(form, type) {
if (isSingleShopMode(type)) {
return {
merchantId: form.realityShopMerchantId,
merchantName: form.realityShopMerchantName,
targetMerchantType: 3,
};
}
return {
merchantId: form.realityShopLevel,
merchantName: form.realityShopLevel === 1 ? "流量方" : "上级流量方",
targetMerchantType: 3,
targetMerchantLevel: form.realityShopLevel,
};
}
const rows = [
{
merchantId: profitSharingForm.realityPlatformMerchantId,
merchantName: isSingleShopMode(shelfType) ? profitSharingForm.realityPlatformMerchantName : "平台方",
targetMerchantType: 1,
targetMerchantLevel: 1,
},
getMerchantSide(profitSharingForm, shelfType),
{
merchantId: profitSharingForm.partnerMerchantId,
merchantName: isSingleShopMode(shelfType) ? profitSharingForm.partnerMerchantName : "服务商",
targetMerchantType: 2,
targetMerchantLevel: 1,
},
];
if (profitSharingForm.partnerMerchantId2) {
rows.push({
merchantId: profitSharingForm.partnerMerchantId2,
merchantName: isSingleShopMode(shelfType) ? profitSharingForm.partnerMerchantName2 : "服务商2",
targetMerchantType: 5,
targetMerchantLevel: 1,
});
}
return rows;
}
export function rulesToMap(rules, tableRows, tableCols) {
const map = {};
// 设置默认值等于平台方
// if (tableRows.length > 0) {
// for (const col of tableCols) {
// map[col.expenseCategoryId] = tableRows[0].targetMerchantType;
// }
// }
for (const rule of (rules || [])) {
map[rule.expenseCategoryId] = rule.targetMerchantType;
}
return map;
}
<template>
<div class="classification-detail">
<Descriptions :schema="getSchema" :data="getSchemaData" />
</div>
</template>
<script>
import { cloneDeep, uniqBy } from "lodash-es";
import { defaultSelectOptions, otherSelectOptions, severSelectOptions } from "@/common/constant/merchant";
import { baseConfig } from "@/main";
import { CategoryTypeOptions } from "@/views/goods/shelfManage/components/data.js";
import Descriptions from "@/views/goods/shelfManage/components/descriptions/index.vue";
import { isMemberRightsUpgrade, isZeroOrNumber } from "@/views/goods/shelfManage/utils/index.js";
export default {
name: "ClassificationDetail",
components: {
Descriptions,
},
props: {
activeRule: {
type: Object,
required: true,
},
queryFeeCategoryByTypePlatform: {
type: Array,
default: () => [],
},
operationMode: {
type: Number,
require: true,
},
sceneType: {
type: Number,
require: true,
},
},
data() {
return {
temporaryArr: [],
localActiveRule: {},
};
},
computed: {
getSchemaData() {
const data = {};
if (this.localActiveRule.groupType !== 1) {
// 处理分账品类
const categoryTypeOpt = CategoryTypeOptions.find(o => o.value === this.localActiveRule.categoryType);
data.categoryType = { text: categoryTypeOpt ? categoryTypeOpt.label : "-" };
// 处理商品关系
let goodsStr = "-";
if (this.localActiveRule.goodsTypeGroupRelations && this.localActiveRule.goodsTypeGroupRelations.length) {
goodsStr = this.localActiveRule.goodsTypeGroupRelations.map((item) => {
if (this.localActiveRule.categoryType === 1)
return item.goodsTypeName || item.goodsType;
if (this.localActiveRule.categoryType === 2)
return `${item.upgradeGoodsName}(${item.commodityCode})`;
if (this.localActiveRule.categoryType === 3)
return `${item.packageName}(${item.packageCode})`;
return "-";
});
}
data.goodsTypeGroupRelations = { text: goodsStr };
}
// 处理平台方费用(temporaryArr)
if (this.temporaryArr && this.temporaryArr.length) {
const expenseRules = this.localActiveRule.expenseCategoryRules || [];
this.temporaryArr.forEach((item) => {
// 在 expenseCategoryRules 中寻找对应的配置
const rule = expenseRules.find(r => r.expenseCategoryId === item.feeCategoryNameId);
if (rule) {
const isAmount = [3, 10].includes(rule.expenseCategoryCalculateType);
const unit = isAmount ? "元" : "%";
const value = isZeroOrNumber(rule.expenseCategoryValue);
let typeLabel = "";
const options = this.getExpenseCategoryCalculateTypeOptions(item.applicationObjectType || 3);
const opt = options.find(o => o.expenseCategoryCalculateType === rule.expenseCategoryCalculateType);
if (opt) {
typeLabel = opt.label;
}
data[item.feeCategoryNameId] = {
text: `${value}${unit}`,
typeLabel,
calculateModeText: rule.calculateMode === 1 ? "按品类计算" : "按整单计算",
};
}
});
}
return data;
},
getSchema() {
const schema = [];
if (this?.localActiveRule?.groupType !== 1) {
schema.push({
descKey: "categoryType",
label: "分账品类",
labelWidth: "150px",
col: 24,
render: (h, { data, schemaItem }) => {
const info = data[schemaItem.descKey];
return h("span", info ? info.text : "-");
},
}, {
descKey: "goodsTypeGroupRelations",
label: "商品",
labelWidth: "150px",
col: 24,
render: (h, { data, schemaItem }) => {
const info = data[schemaItem.descKey];
if (!info || info.text === "-") {
return h("span", "-");
}
if (Array.isArray(info.text)) {
return h("div", { class: "goods-relations-wrap" }, info.text.join(","));
}
return h("span", info.text);
},
});
}
// 动态添加平台方费用项
if (this.temporaryArr && this.temporaryArr.length) {
this.temporaryArr.forEach((item) => {
// 会员权益升级下 - > 人力成本 只有 运营模式 = 1 的时候才展示
// 精品升级照常显示
if (isMemberRightsUpgrade(this.sceneType)) {
if (item.feeCategoryNameId === 807) {
if (this.operationMode !== 1) {
return;
}
}
}
const isSunshineIncentive = [809, 901].includes(item.feeCategoryNameId);
schema.push({
descKey: item.feeCategoryNameId,
label: item.feeCategoryName,
labelWidth: "150px",
col: 24,
render: (h, { data, schemaItem }) => {
const info = data[schemaItem.descKey];
if (!info)
return h("span", "-");
if (isSunshineIncentive) {
return h("span", `${info.calculateModeText}:${info.typeLabel}:${info.text}`);
}
return h("span", info.typeLabel ? `${info.typeLabel}:${info.text}` : info.text);
},
});
});
}
return schema;
},
},
watch: {
queryFeeCategoryByTypePlatform: {
handler(value) {
if (value && value.length) {
this.getQueryFeeCategoryByTypePlatform(value);
}
},
immediate: true,
},
activeRule: {
handler(value) {
if (value) {
this.$set(this, "localActiveRule", cloneDeep(value));
}
},
immediate: true,
deep: true,
},
},
methods: {
getQueryFeeCategoryByTypePlatform(res) {
const that = this;
let tempArr = [];
const arrIdx = baseConfig.shelfManageFinanceConfig || [];
res.forEach((temp) => {
if (arrIdx.includes(temp.id)) {
let feeCategoryName = temp.feeCategoryName;
if (temp.id == 809)
feeCategoryName = "一线阳光激励费";
if (temp.id == 901)
feeCategoryName = "一线阳光2激励费";
tempArr.push({
...temp,
feeCategoryName,
});
}
});
that.temporaryArr = uniqBy(tempArr, "id");
},
getExpenseCategoryCalculateTypeOptions(targetType) {
if (targetType === 1)
return [...defaultSelectOptions, ...otherSelectOptions];
if (targetType === 2)
return severSelectOptions;
if (targetType === 3)
return severSelectOptions; // reconciliation中的platformFeeList用的是severSelectOptions
return [];
},
},
};
</script>
<style scoped lang="scss">
::v-deep .goods-relations-wrap {
white-space: normal;
word-break: break-all;
overflow-wrap: anywhere;
}
</style>
// 获取详情中的数据 赋值改成页面中的结构(1流量方,2服务商)
// originArr初始化生成的数据, 详情中的数据detailArr
export function getClassificationObjFormat(originArr, detailArr, key) {
if (key === "temporary") {
console.log("originArr", originArr);
console.log("detailArr", detailArr);
console.log("key", key);
}
if (!originArr?.length || !detailArr?.length) {
return originArr || [];
}
// 创建 Map 以提高查找效率
const detailMap = new Map();
const collectDetails = (arr) => {
arr.forEach((item) => {
detailMap.set(item.expenseCategoryId, item);
if (item.children?.length) {
collectDetails(item.children);
}
});
};
collectDetails(detailArr);
const updateItem = (item, innerItem) => {
Object.assign(item, {
targetType: innerItem.targetType,
expenseCategoryId: innerItem.expenseCategoryId,
expenseCategoryName: item.expenseCategoryName || innerItem.expenseCategoryName,
expenseCategoryCalculateType: innerItem.expenseCategoryCalculateType,
expenseCategoryValue: innerItem.expenseCategoryValue,
calculateMode: innerItem.calculateMode || 1,
});
};
const updateChildren = (val, innerItem, parentItem) => {
const isSpecialCase = val.nodeType === 4 || innerItem.expenseCategoryCalculateType === 7;
Object.assign(val, {
targetType: innerItem.targetType,
expenseCategoryId: innerItem.expenseCategoryId,
expenseCategoryName: val.expenseCategoryName || innerItem.expenseCategoryName,
expenseCategoryCalculateType: isSpecialCase ? "" : innerItem.expenseCategoryCalculateType,
expenseCategoryValue: isSpecialCase ? "" : innerItem.expenseCategoryValue,
calculateMode: parentItem.calculateMode,
nodeType: val.nodeType,
});
};
return originArr.map((item) => {
const detailItem = detailMap.get(item.expenseCategoryId);
if (detailItem) {
updateItem(item, detailItem);
}
item.children?.forEach((val) => {
const childDetail = detailMap.get(val.expenseCategoryId);
if (childDetail) {
updateChildren(val, childDetail, item);
}
});
return item;
});
}
<template>
<div class="detail-wrapper ">
<Descriptions :schema="formItems" :data="descData" />
</div>
</template>
<script>
import Descriptions from "@/views/goods/shelfManage/components/descriptions/index.vue";
export default {
name: "Detail",
components: {
Descriptions,
},
props: {
schema: {
type: Array,
required: true,
},
descData: {},
},
data() {
return {
};
},
computed: {
formItems() {
return this.schema.map(item => ({
...item,
name: item.descKey || (item.type === "select" ? item.optionLabel : item.name),
valueWidth: "314px",
labelWidth: "250px",
itemStyle: {
"margin-right": "30px",
},
}));
},
},
};
</script>
<style scoped lang="scss">
.detail-wrapper {
padding: 20px;
}
</style>
<!-- 编辑 - 流量方信息 -->
<template>
<div class="modify-wrapper">
<glsx-combi-form ref="trafficFromRef"
class="edit-form-container"
:form-data="schema"
:form-obj="form"
:form-rules="rules"
default-width="100%"
label-width="208px">
<template #merchantId>
<div class="merchant-wrapper">
<div class="select-wrapper">
<el-input v-model="form.merchantName" disabled></el-input>
</div>
<div v-if="shelfType === 1" class="actions-wrapper">
<el-button type="text" @click="handleAppendTraffic">
新建
</el-button>
</div>
</div>
</template>
</glsx-combi-form>
<AddMerchant v-if="dialog.appendTraffic.show"
:add-mer-visible="dialog.appendTraffic.show"
@handleClose="handleAppendTraffic">
</AddMerchant>
</div>
</template>
<script>
import { cloneDeep } from "lodash-es";
import AddMerchant from "@/views/goods/shelfManage/components/editCon/AddMerchant.vue";
export default {
name: "ModifyTrafficSource",
components: {
AddMerchant,
},
props: {
schema: {
type: Array,
required: true,
},
rules: {
type: Object,
required: true,
},
shelfType: {
type: Number,
required: true,
},
trafficForm: {
type: Object,
required: true,
},
},
data() {
return {
form: {},
dialog: {
appendTraffic: {
show: false,
},
},
};
},
computed: {},
watch: {
trafficForm: {
handler(val) {
this.$set(this, "form", cloneDeep(val));
},
deep: true,
immediate: true,
},
},
async mounted() {
},
methods: {
handleAppendTraffic() {
this.dialog.appendTraffic.show = !this.dialog.appendTraffic.show;
},
async validate() {
const valid = await this.$refs.trafficFromRef.$refs.formRef.validate();
if (valid) {
console.log("校验成功", this.form);
return this.form;
}
},
},
};
</script>
<style lang="scss" scoped>
.modify-wrapper {
padding: 20px;
.merchant-wrapper {
display: flex;
overflow: hidden;
.select-wrapper {
flex: 1;
}
> ::v-deep .actions-wrapper {
flex-shrink: 0;
.el-button {
padding: 0 12px;
}
}
}
}
.shop-merchant-info {
.add-mer-btn {
margin-left: 12px;
}
}
</style>
import {
businessModeList,
onlinePointsEnabledList,
operationModeList,
sceneTypeOptions,
trafficFeeSettleModeList,
} from "@/views/goods/shelfManage/constant/baseData.js";
import { isZeroOrNumber } from "../../utils";
export const ShopMerchantInfoFormRules = {
merchantId: [
{ required: true, message: "请选择流量方信息" },
],
parentMerchantName: [
{ required: true, message: "请选择集团(上级商户)" },
],
businessMode: [
{ required: true, message: "请选择业务模式" },
],
contractingMerchantId: [
{ required: true, message: "请选择签约主体" },
],
sceneType: [
{ required: true, message: "请选择业务场景" },
],
yqMerchantId: [
{ required: true, message: "请选择园区店" },
],
estimatedFlow: [
{ required: true, message: "请输入预估流量" },
],
estimatedUpgradeRate: [
{ required: true, message: "请输入预估转化率" },
],
operationMode: [
{ required: true, message: "请选择运营模式" },
],
partnerMerchantId: [
{ required: true, message: "请选择服务商" },
],
parentPartnerMerchantId: [
{ required: true, message: "请输入上级服务商" },
],
firstLineSunshineOnlinePointsFlag: [
{ required: true, message: "请选择一线阳光是否开启线上积分" },
],
firstLineSunshine2OnlinePointsFlag: [
{ required: true, message: "请选择一线阳光2是否开启线上积分" },
],
};
export const ShopMerchantFormData = [
{
label: "流量方信息",
name: "merchantId",
descKey: "merchantName",
addHtml: "merchantId",
placeholder: "请选择流量方信息",
optionList: [],
optionSync: {
useSync: true,
syncField: "merchantName",
},
style: { width: "50%" },
optionsName: "merchantList",
},
{
label: "集团(上级商户)",
descKey: "parentMerchantName",
name: "parentMerchantName",
type: "input",
style: { width: "50%" },
placeholder: "选择流量方后自动获取",
isDisabled: true,
},
{
label: "业务模式",
name: "businessMode",
type: "select",
optionList: businessModeList,
style: { width: "50%" },
optionId: "confId",
optionLabel: "confName",
optionsName: "businessModeList",
isHide({ formModel }) {
return !(formModel.sceneType === 0);
},
render(h, { data }) {
return h(
"span",
businessModeList.find(item => item.confId === data.businessMode)?.confName || "-",
);
},
},
{
label: "签约主体",
name: "contractingMerchantId",
descKey: "contractingMerchantName",
isClear: true,
type: "select",
optionList: [],
style: { width: "50%" },
optionSync: {
useSync: true,
syncField: "contractingMerchantName",
},
optionId: "merchantId",
optionLabel: "merchantName",
optionsName: "contractMerList",
},
{
label: "业务场景",
name: "sceneType",
type: "select",
isDisabled: true,
optionList: sceneTypeOptions,
style: { width: "50%" },
optionId: "confId",
optionLabel: "confValue",
optionsName: "sceneCodeList",
render(h, { data }) {
return h(
"span",
sceneTypeOptions.find(item => item.confId === data.sceneType)?.confValue || "-",
);
},
},
{
label: "园区店",
name: "yqMerchantId",
type: "select",
style: { width: "50%" },
optionList: [],
optionSync: {
useSync: true,
syncField: "yqMerchantName",
},
optionId: "merchantId",
optionLabel: "merchantName",
optionsName: "yqMerchantList",
descKey: "yqMerchantName",
},
{
style: { width: "50%" },
label: "预估流量/月",
name: "estimatedFlow",
type: "inputNumber",
attrs: {
min: 0,
max: 999999,
precision: 0,
controls: false,
},
},
{
label: "预估转化率",
name: "estimatedUpgradeRate",
type: "inputNumber",
style: { width: "50%" },
attrs: {
min: 0,
max: 100,
precision: 2,
controls: false,
},
render(h, { data }) {
return h(
"span",
`${isZeroOrNumber(data.estimatedUpgradeRate)}%`,
);
},
suffix: "%",
},
{
label: "预估平均客单价",
name: "estimatedCustomerUnitPrice",
type: "inputNumber",
style: { width: "50%" },
attrs: {
min: 0,
max: 999999,
precision: 0,
controls: false,
},
render(h, { data }) {
return h(
"span",
`${isZeroOrNumber(data.estimatedCustomerUnitPrice)}元`,
);
},
isHide({ formModel }) {
// 业务场景=精品升级时展示
return formModel.sceneType !== 1;
},
},
{
label: "预估产值",
name: "estimatedOutputValue",
type: "inputNumber",
style: { width: "50%" },
attrs: {
min: 0,
max: 999999,
precision: 0,
controls: false,
},
render(h, { data }) {
return h(
"span",
`${isZeroOrNumber(data.estimatedOutputValue)}元`,
);
},
isHide({ formModel }) {
// 业务场景=精品升级时展示
return formModel.sceneType !== 1;
},
},
{
label: "运营模式",
name: "operationMode",
type: "select",
optionList: operationModeList,
optionId: "confId",
optionLabel: "confName",
optionsName: "operationModeList",
style: { width: "50%" },
changeAttr(value, targetItem, formModel, schema) {
// 如果运营模式变动. 值等于1 的话. 服务商要变成禁用状态, 且值变为 "深圳嘀加"
if (value === 1) {
const partnerMerchantSchemaItem = schema.find(item => item.name === "partnerMerchantId");
if (partnerMerchantSchemaItem) {
const optionsList = partnerMerchantSchemaItem.optionList || [];
const optionsItem = optionsList.find(item => item.merchantName === "深圳嘀加");
formModel.partnerMerchantId = optionsItem?.merchantId;
formModel.partnerMerchantName = optionsItem?.merchantName;
}
}
},
render(h, { data }) {
return h(
"span",
operationModeList.find(item => item.confId === data.operationMode)?.confName || "-",
);
},
isHide({ formModel }) {
// 业务场景=会员权益升级时展示
return formModel.sceneType !== 0;
},
},
{
label: "服务商",
name: "partnerMerchantId",
descKey: "partnerMerchantName",
type: "select",
optionList: [],
optionId: "merchantId",
optionLabel: "merchantName",
optionsName: "partnerMerchantList",
optionSync: {
useSync: true,
syncField: "partnerMerchantName",
},
isDisabled({ formModel }) {
// 运营模式 值等于1 的话. 服务商要变成禁用状态
return formModel.operationMode === 1;
},
style: { width: "50%" },
},
{
label: "服务商2",
name: "partnerMerchantId2",
descKey: "partnerMerchantName2",
style: { width: "50%" },
type: "select",
optionId: "merchantId",
optionLabel: "merchantName",
optionsName: "partnerMerchantList",
optionSync: {
useSync: true,
syncField: "partnerMerchantName2",
},
isHide({ formModel }) {
// 业务场景=会员权益升级 展示
return formModel.sceneType !== 0;
},
},
// TODO:需要核对
{
label: "上级服务商",
name: "parentPartnerMerchantName",
descKey: "parentPartnerMerchantName",
style: { width: "50%" },
type: "input",
maxlength: 50,
isHide({ formModel }) {
// 业务场景=会员权益升级 展示
return formModel.sceneType !== 0;
},
},
{
label: "一线阳光是否开启线上积分",
name: "firstLineSunshineOnlinePointsFlag",
type: "select",
optionList: onlinePointsEnabledList,
optionId: "confId",
style: { width: "50%" },
optionLabel: "confName",
optionsName: "onlinePointsEnabledList",
render(h, { data }) {
return h(
"span",
onlinePointsEnabledList.find(item => item.confId === data.firstLineSunshineOnlinePointsFlag)?.confName || "-",
);
},
},
{
label: "一线阳光2是否开启线上积分",
name: "firstLineSunshine2OnlinePointsFlag",
type: "select",
style: { width: "50%" },
optionList: onlinePointsEnabledList,
optionId: "confId",
optionLabel: "confName",
optionsName: "onlinePointsEnabledList",
render(h, { data }) {
return h(
"span",
onlinePointsEnabledList.find(item => item.confId === data.firstLineSunshine2OnlinePointsFlag)?.confName || "-",
);
},
},
{
label: "流量费结算模式",
name: "trafficFeeSettleMode",
type: "select",
optionList: trafficFeeSettleModeList,
optionId: "confId",
style: { width: "50%" },
optionLabel: "confName",
optionsName: "trafficFeeSettleModeList",
render(h, { data }) {
return h(
"span",
trafficFeeSettleModeList.find(item => item.confId === data.trafficFeeSettleMode)?.confName || "-",
);
},
isHide({ formModel }) {
// 业务场景=精品升级 展示
return formModel.sceneType !== 1;
},
},
];
// 嘀加上架 业务场景
export const sceneTypeOptions = [
{ confId: "", confValue: "全部" },
{ confId: 1, confValue: "精品升级" },
{ confId: 0, confValue: "会员权益升级" },
];
export const businessModeList = [
{ confId: 1, confName: "直营渠道" },
{ confId: 2, confName: "经销商投资" },
{ confId: 3, confName: "服务商投资" },
{ confId: 4, confName: "服务商渠道" },
];
export const operationModeList = [
{ confId: 0, confName: "非直营" },
{ confId: 1, confName: "直营" },
];
export const onlinePointsEnabledList = [
{ confId: "Y", confName: "是" },
{ confId: "N", confName: "否" },
];
// 流量费结算模式
export const trafficFeeSettleModeList = [
// 1:按信息量,2:按有效流量,3:按销售额
{ confId: 1, confName: "按信息量" },
{ confId: 2, confName: "按有效流量" },
{ confId: 3, confName: "按销售额" },
];
export const VIEW_MODE = {
EDIT: "edit",
VIEW: "view",
};
import { cloneDeep } from "lodash-es";
import {
approveStatusOpt,
approveTypeOpt,
shelfTypeOpt,
systemStatusOpt,
} from "@/common/constants.js";
import { Util } from "@/common/util";
import { sceneTypeOptions } from "./baseData.js";
export const shelManageTableForm = [
{
label: "单据编号",
name: "businessCode",
type: "input",
maxlength: "20",
isClear: true,
},
{
label: "流量方信息",
name: "merchantName",
type: "input",
maxlength: "20",
isClear: true,
},
{
label: "审批编号",
name: "workWechatApproveCode",
type: "input",
maxlength: "20",
isClear: true,
},
{
label: "审批类型",
name: "approveType",
type: "select",
isClear: true,
optionList: cloneDeep(approveTypeOpt),
optionId: "confId",
optionLabel: "confValue",
optionsName: "approveTypeOpt",
},
{
label: "上架类型",
name: "shelfType",
type: "select",
isClear: true,
optionList: cloneDeep(shelfTypeOpt),
optionId: "confId",
optionLabel: "confValue",
optionsName: "shelfTypeOpt",
},
{
label: "系统状态",
name: "systemStatus",
type: "select",
isClear: true,
optionList: cloneDeep(systemStatusOpt),
optionId: "confId",
optionLabel: "confValue",
optionsName: "systemStatusOpt",
},
{
label: "审批状态",
name: "approveStatus",
type: "select",
isClear: true,
optionList: cloneDeep(approveStatusOpt),
optionId: "confId",
optionLabel: "confValue",
optionsName: "approveStatusOpt",
},
{
label: "业务场景",
name: "sceneType",
type: "select",
isClear: true,
optionList: cloneDeep(sceneTypeOptions),
optionId: "confId",
optionLabel: "confValue",
optionsName: "sceneTypeOptions",
},
];
export const shelManageTableColumn = [
{
label: "单据编号",
prop: "businessCode",
},
{
label: "流量方信息",
prop: "merchantName",
addHtml: "merchantName",
},
{
label: "上架类型",
prop: "approveType",
width: "150px",
formatter: (cellValue) => {
return cloneDeep(shelfTypeOpt.find(item => item.confId === cellValue.shelfType)?.confValue);
},
},
{
label: "业务场景",
prop: "sceneType",
width: "150px",
formatter: (cellValue) => {
return sceneTypeOptions.find(item => item.confId === cellValue.sceneType)?.confValue;
},
},
{
label: "审批类型",
prop: "approveType",
width: "150px",
formatter: (cellValue) => {
return cloneDeep(approveTypeOpt.find(item => item.confId === cellValue.approveType)?.confValue);
},
},
{
label: "审批编号",
prop: "workWechatApproveCode",
},
{
label: "提交时间",
prop: "createdDate",
width: "160px",
formatter: (cellValue) => {
return cellValue.createdDate ? Util.dateFormate(cellValue.createdDate, "YYYY-MM-DD HH:mm:ss") : "-";
},
},
{
label: "提交人",
prop: "committer",
},
{
label: "系统状态",
prop: "systemStatus",
width: "100px",
formatter: (cellValue) => {
return cloneDeep(systemStatusOpt.find(item => item.confId === cellValue.systemStatus)?.confValue);
},
},
{
label: "审批状态",
prop: "approveStatus",
width: "120px",
formatter: (cellValue) => {
return cloneDeep(approveStatusOpt.find(item => item.confId === cellValue.approveStatus)?.confValue);
},
className: (cellValue) => {
return {
1: "yellowSpot",
2: "greenSpot",
3: "redSpot",
4: "ashSpot",
}[cellValue.approveStatus];
},
},
];
<!-- 嘀加上架 -->
<template>
<d2-container class="shelfManage">
<template #header>
<div class="header">
<d2-search class="show-search"
:form-data="showFormData"
label-width="100px"
:search-form="table.searchForm">
</d2-search>
<div class="up-btns">
<el-button :id="table.tableParams.btnId"
size="small"
type="primary">
查询
</el-button>
<el-button size="small" @click="handleReset">
重置
</el-button>
</div>
</div>
</template>
<div class="d2-container-content">
<d2-table-header>
<template #left>
<span>
<!-- 嘀加上架与销售合同 -->
<span style="display: inline-block; margin-right: 10px">
<auth-button category="Button"
:data="{ operate: 'add', type: 1 }"
:show-btn-ids="['9031301']" />
</span>
<!-- 嘀加上架修改 -->
<auth-button category="Button"
:data="{ operate: 'edit', type: 2 }"
:show-btn-ids="['9031303']"
style="display: inline-block" />
</span>
</template>
</d2-table-header>
<d2-table ref="packageIndexTable" v-bind="table">
<template #merchantName="scope">
<div>
<el-tooltip class="item"
:content="scope.scope.merchantName"
placement="right">
<div class="merchant-item one-line-ellipsis">
{{ scope.scope.merchantName }}
</div>
</el-tooltip>
</div>
</template>
<template #auth-button="scope">
<div>
<!-- 查看 - 查看合同 -->
<span style="margin-right: 10px">
<auth-button :data="scope.scope" :show-btn-ids="['9031304']" />
</span>
<!-- 确认 - 编辑合同 -->
<span v-if="scope.scope.systemStatus === 1" style="margin-right: 10px">
<auth-button :data="scope.scope" :show-btn-ids="['9031306']" />
</span>
<!-- 驳回 -->
<span v-if="scope.scope.systemStatus === 1" style="margin-right: 10px">
<auth-button :data="scope.scope" :show-btn-ids="['9031308']" />
</span>
<!-- 重新发起 -->
<span v-if=" scope.scope.systemStatus === 4 || [3, 4].includes(scope.scope.approveStatus)"
style="margin-right: 10px">
<auth-button :data="{
operate: 'again',
recordId: scope.scope.id,
approveType: scope.scope.approveType,
}"
:show-btn-ids="['9031309']" />
</span>
</div>
</template>
</d2-table>
</div>
<!-- 驳回 -->
<RejectDialog v-if="rejectVisible"
:params-obj="recordInfo"
:reject-visible="rejectVisible"
@dialogClose="rejectDialogClose" />
</d2-container>
</template>
<script>
import { getDPlusPage as getPage } from "@api/shelfManage.js";
import { cloneDeep } from "lodash-es";
import { nanoid } from "nanoid";
import { mapActions } from "vuex";
import rejectDialog from "./components/common/rejectDialog.vue";
import { shelManageTableColumn, shelManageTableForm } from "./constant/table.data.js";
// import { getPage } from "./mock/shelfManage.js";
export default {
name: "ShelfManage",
components: {
RejectDialog: rejectDialog,
},
// :get-list-api="getListApi"
// :search-form="searchForm"
// :table-params="tableParams"
data() {
return {
showFormData: cloneDeep(shelManageTableForm),
table: {
getListApi: getPage,
searchForm: {
businessCode: "",
workWechatApproveCode: "",
approveType: "",
systemStatus: "",
approveStatus: "",
merchantName: "",
shelfType: "",
sceneType: "",
},
// 表格参数
tableParams: {
btnId: nanoid(),
listName: "list",
tableOption: {
width: "170",
},
tableColumns: shelManageTableColumn,
},
},
recordInfo: {},
rejectVisible: false,
};
},
mounted() {
this.getBaseData();
},
methods: {
...mapActions({
close: "d2admin/page/close",
}),
async getBaseData() {
this.setOptionsList();
},
setOptionsList() {
this.showFormData.forEach((item, index) => {
// 添加全部选项
if (item.type === "select") {
if (item.optionList[0][item.optionLabel] !== "全部") {
item.optionList.unshift({
[item.optionId]: "",
[item.optionLabel]: "全部",
});
}
}
});
},
handleReset() {
this.table.searchForm = {
businessCode: "",
workWechatApproveCode: "",
approveType: "",
systemStatus: "",
approveStatus: "",
merchantName: "",
shelfType: "",
sceneType: "",
};
this.$refs.packageIndexTable.refreshTable(false, true);
},
// 确认 - 编辑合同
handleEditContract(row) {
console.log(row);
this.$router.push({
name: row.shelfType === 1 ? "editContract" : "editMultilateralContract",
query: {
id: row.id,
businessCode: row.businessCode,
},
});
},
// 查看 - 查看合同
handleContractDetail(row) {
this.close({ tagName: "/contractDetail" });
this.$router.push({
name: "contractDetail",
query: {
id: row.id,
businessCode: row.businessCode,
},
});
},
// 驳回
handleReject(row) {
this.recordInfo = row;
this.rejectVisible = !this.rejectVisible;
},
// 关闭驳回弹窗
rejectDialogClose(obj) {
this[obj.attrName] = !this[obj.attrName];
if (obj.flag) {
this.$refs.packageIndexTable.refreshTable();
}
},
// 嘀加上架与销售合同 , 嘀加上架修改 ,重新发起
handleEdit(query) {
this.close({ tagName: "/editShelf" });
this.$router.push({
name: "editShelf",
query,
});
},
},
};
</script>
<style lang="scss" scoped>
.merchant-item {
width: 150px;
padding: 0 10px;
}
</style>
[
{
"merchantId": 44209485,
"merchantName": "周立明市级经销商001"
},
{
"merchantId": 44188009,
"merchantName": "嘀加公共市代商户"
},
{
"merchantId": 19180009,
"merchantName": "深圳广联赛讯2015"
},
{
"merchantId": 44211442,
"merchantName": "旧市长"
},
{
"merchantId": 44211441,
"merchantName": "旧省代"
},
{
"merchantId": 44211449,
"merchantName": "lsq省代-园区店"
},
{
"merchantId": 44211450,
"merchantName": "lsq市代-园区店"
},
{
"merchantId": 44211563,
"merchantName": "旧商户省代"
},
{
"merchantId": 44211564,
"merchantName": "旧商户市代"
},
{
"merchantId": 44211684,
"merchantName": "转化+同步园区店省代"
},
{
"merchantId": 44211685,
"merchantName": "转化+同步园区店市代"
},
{
"merchantId": 44211692,
"merchantName": "sq市代-园区店02"
},
{
"merchantId": 44211689,
"merchantName": "lsq省代-园区店02"
},
{
"merchantId": 44211706,
"merchantName": "sdfsd"
},
{
"merchantId": 44211705,
"merchantName": "18188965478"
},
{
"merchantId": 44211704,
"merchantName": "zdasda22"
},
{
"merchantId": 44211703,
"merchantName": "深圳广联数科科技有限公司"
},
{
"merchantId": 44211702,
"merchantName": "accountInfoForm"
},
{
"merchantId": 44211717,
"merchantName": "18858477445"
},
{
"merchantId": 44211752,
"merchantName": "权限验证"
},
{
"merchantId": 44212491,
"merchantName": "ceshi12121"
},
{
"merchantId": 44212490,
"merchantName": "ceshizishanghu "
},
{
"merchantId": 44212569,
"merchantName": "test2202"
},
{
"merchantId": 44212574,
"merchantName": "test2502"
},
{
"merchantId": 44212573,
"merchantName": "test2501"
},
{
"merchantId": 44212620,
"merchantName": "23111302"
},
{
"merchantId": 44212619,
"merchantName": "23111301"
},
{
"merchantId": 44212618,
"merchantName": "231113"
},
{
"merchantId": 44212616,
"merchantName": "231113测试商户011"
},
{
"merchantId": 44217988,
"merchantName": "商户验证"
},
{
"merchantId": 44212635,
"merchantName": "第一轮测试导入上级是园区店的省代"
},
{
"merchantId": 44212809,
"merchantName": "way省代"
},
{
"merchantId": 44217928,
"merchantName": "再再导入99"
},
{
"merchantId": 44217990,
"merchantName": "202419园区店"
},
{
"merchantId": 44217992,
"merchantName": "商户验证001"
},
{
"merchantId": 44217993,
"merchantName": "商户验证002"
},
{
"merchantId": 44217995,
"merchantName": "商户验证003"
},
{
"merchantId": 44217996,
"merchantName": "商户验证004"
},
{
"merchantId": 44217997,
"merchantName": "商户验证005"
},
{
"merchantId": 44218042,
"merchantName": "测试异步同步测试一步一步4s商户"
},
{
"merchantId": 44218041,
"merchantName": "测试异步同步的子商户"
},
{
"merchantId": 44209879,
"merchantName": "明明崇文园区市代x"
},
{
"merchantId": 44211586,
"merchantName": "测试省代33"
},
{
"merchantId": 44211516,
"merchantName": "市代"
},
{
"merchantId": 44209886,
"merchantName": "明明长岭园区市代"
},
{
"merchantId": 44209885,
"merchantName": "明明长岭园区省代"
},
{
"merchantId": 44209878,
"merchantName": "明明崇文园区省代"
},
{
"merchantId": 66666668,
"merchantName": "jac子商户省代A"
},
{
"merchantId": 66666667,
"merchantName": "jac子商户省代"
},
{
"merchantId": 44218065,
"merchantName": "测试园区店省代"
},
{
"merchantId": 44218075,
"merchantName": "园区店-测试-省代"
},
{
"merchantId": 44218076,
"merchantName": "测试-园区-市代"
},
{
"merchantId": 44210256,
"merchantName": "ssssse"
},
{
"merchantId": 44218083,
"merchantName": "测试员工审核78"
},
{
"merchantId": 44218229,
"merchantName": "小黄超级园区店"
},
{
"merchantId": 44218248,
"merchantName": "省代园区"
},
{
"merchantId": 44218261,
"merchantName": "深圳广联赛讯股份有限公司"
},
{
"merchantId": 44218263,
"merchantName": "重庆啦啦啦啦啦"
},
{
"merchantId": 44218290,
"merchantName": "林冲园区店A"
},
{
"merchantId": 44218344,
"merchantName": "服务商626子商户"
},
{
"merchantId": 44218379,
"merchantName": "zjy省代"
},
{
"merchantId": 44218399,
"merchantName": "zishanghu"
}
]
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!