Commit ca1e7dba by Jaxon

feat: 嘀加上架 - 运营确认 - 分账配置 - 首次联调

1 parent 9a2f24cb
...@@ -162,12 +162,12 @@ export function getProductPackagesApi(data) { ...@@ -162,12 +162,12 @@ export function getProductPackagesApi(data) {
// 保存单个商品 // 保存单个商品
export function postProductApi(data) { export function postProductApi(data) {
data.method = "dj.api.create.business.approve.saveGoodsInfo"; data.method = "dj.api.create.business.approve.saveGoodsInfo";
return request(data); return request(data, "post");
} }
// 保存单个商品 // 保存单个商品
export function postPackageApi(data) { export function postPackageApi(data) {
data.method = "dj.api.create.business.approve.savePackageInfo"; data.method = "dj.api.create.business.approve.savePackageInfo";
return request(data); return request(data, "post");
} }
// 获取上架基础信息 // 获取上架基础信息
...@@ -181,3 +181,20 @@ export function delProductPackagesApi(data) { ...@@ -181,3 +181,20 @@ export function delProductPackagesApi(data) {
data.method = "dj.api.create.business.approve.deleteProductInfo"; data.method = "dj.api.create.business.approve.deleteProductInfo";
return request(data); return request(data);
}; };
// 获取分账信息下 所有 特殊品类列表
export function getProfitSharingTypeListApi(data) {
data.method = "dj.api.create.business.approve.listSettleGoodsTypeGroup";
return request(data);
};
// 获取分账信息下 所有 单个特殊品类的详情
export function getProfitSharingTypeDetailApi(data) {
data.method = "dj.api.create.business.approve.getSettleGoodsTypeGroupRuleDetail";
return request(data);
};
export function getSaveRuleMerchantApi(data) {
data.method = "dj.api.create.business.approve.getSaveRuleMerchant";
return request(data);
};
...@@ -8,10 +8,12 @@ ...@@ -8,10 +8,12 @@
@blur="handleSelectBlur" @blur="handleSelectBlur"
@change="handleSelectChange"> @change="handleSelectChange">
<el-option v-for="subItem in localOptions" <el-option v-for="subItem in localOptions"
:key="subItem[valueKey]" :key="subItem[fieldName.value]"
:label="subItem[labelKey]" v-bind="{
:value="subItem[valueKey]" value: $attrs['value-key'] ? subItem : subItem[fieldName.value],
v-bind="isFunction(optionProps) ? optionProps(subItem) : optionProps"> label: subItem[fieldName.label],
...isFunction(optionProps) ? optionProps(subItem) : optionProps,
}">
<slot name="options" :row="subItem"></slot> <slot name="options" :row="subItem"></slot>
</el-option> </el-option>
<template #empty> <template #empty>
...@@ -67,10 +69,6 @@ export default { ...@@ -67,10 +69,6 @@ export default {
default: false, default: false,
type: Boolean, type: Boolean,
}, },
labelKey: {
default: "label",
type: String,
},
optionProps: { optionProps: {
default: () => ({}), default: () => ({}),
type: [Object, Function], type: [Object, Function],
...@@ -83,11 +81,14 @@ export default { ...@@ -83,11 +81,14 @@ export default {
required: true, required: true,
type: [Array, String, Number], type: [Array, String, Number],
}, },
valueKey: { fieldName: {
default: "value", type: Object,
type: String, default: () => ({
}, label: "label",
value: "value",
}),
},
}, },
data() { data() {
return { return {
...@@ -106,6 +107,7 @@ export default { ...@@ -106,6 +107,7 @@ export default {
}, },
computed: { computed: {
selectProps() { selectProps() {
console.log("selectProps", this.$attrs);
return { return {
"collapse-tags": true, "collapse-tags": true,
"filterable": true, "filterable": true,
...@@ -114,7 +116,7 @@ export default { ...@@ -114,7 +116,7 @@ export default {
"reserve-keyword": true, "reserve-keyword": true,
"placeholder": "请选择", "placeholder": "请选择",
"remote-method": this.remoteOptions, "remote-method": this.remoteOptions,
...omit(this.$attrs, ["fetchApi", "value", "valueKey", "labelKey", "searchKey", "optionProps"]), ...this.$attrs,
}; };
}, },
selectEvent() { selectEvent() {
......
...@@ -12,8 +12,10 @@ ...@@ -12,8 +12,10 @@
placeholder="请输入相关名称以搜索" placeholder="请输入相关名称以搜索"
immediate immediate
:popper-append-to-body="false" :popper-append-to-body="false"
value-key="id" :filed-name="{
label-key="productName" value: 'id',
label: 'productName',
}"
:multiple="false" :multiple="false"
:collapse-tags="false" :collapse-tags="false"
@change="handleTitleSelectChange"> @change="handleTitleSelectChange">
......
...@@ -221,65 +221,65 @@ export default { ...@@ -221,65 +221,65 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.formSty { // .formSty {
overflow-x: scroll; // overflow-x: scroll;
} // }
.division-rule table { // .division-rule table {
width: 98%; // width: 98%;
color: #666666; // color: #666666;
border: 1px solid #e5e6e7; // border: 1px solid #e5e6e7;
border-width: 1px 0 0 1px; // border-width: 1px 0 0 1px;
} // }
.division-rule table tr { // .division-rule table tr {
height: 50px; // height: 50px;
line-height: 50px; // line-height: 50px;
} // }
.division-rule table th, // .division-rule table th,
.division-rule table td { // .division-rule table td {
font-size: 12px; // font-size: 12px;
font-weight: normal; // font-weight: normal;
padding: 0px 10px; // padding: 0px 10px;
border: 1px solid #e5e6e7; // border: 1px solid #e5e6e7;
border-width: 0px 1px 1px 0px; // border-width: 0px 1px 1px 0px;
border-spacing: 0; // border-spacing: 0;
text-align: center; // text-align: center;
min-width: 100px; // min-width: 100px;
white-space: nowrap; // white-space: nowrap;
/* white-space: nowrap; */ // /* white-space: nowrap; */
/* overflow: hidden; */ // /* overflow: hidden; */
/* text-overflow: ellipsis; */ // /* text-overflow: ellipsis; */
} // }
.division-rule table .merchantNameTd { // .division-rule table .merchantNameTd {
min-width: 150px; // min-width: 150px;
} // }
.division-rule .flex { // .division-rule .flex {
display: flex; // display: flex;
justify-content: space-around; // justify-content: space-around;
} // }
.table-block td { // .table-block td {
font-size: 14px !important; // font-size: 14px !important;
} // }
.division-rule .table-block .el-radio { // .division-rule .table-block .el-radio {
display: block; // display: block;
height: 60px; // height: 60px;
line-height: 42px; // line-height: 42px;
margin-right: 0; // margin-right: 0;
} // }
.p-b-20 { // .p-b-20 {
padding-bottom: 26px !important; // padding-bottom: 26px !important;
} // }
.division-rule ::v-deep { // .division-rule ::v-deep {
.table-block .el-radio__label { // .table-block .el-radio__label {
display: none !important; // display: none !important;
} // }
} // }
</style> </style>
<template> <template>
<div v-if="isInitialized" class=""> <div v-if="isInitialized" class="">
<Detail v-if="mode === VIEW_MODE.VIEW" <!-- <Detail v-if="mode === VIEW_MODE.VIEW"
v-bind="$attrs" v-bind="$attrs"
:goodsTypeGroupRules='localGoodsTypeGroupRules'
:goods-list="options.productType" :goods-list="options.productType"
v-on="$listeners" /> v-on="$listeners" /> -->
<Modify v-if="mode === VIEW_MODE.EDIT" <Modify v-if="mode === VIEW_MODE.EDIT"
:category-options="options.category" ref="modifyRef"
:goods-list="options.productType" :goods-list="options.productType"
v-bind="$attrs" :scene-type="sceneType" />
v-on="$listeners" />
</div> </div>
</template> </template>
<script> <script>
import { mapActions, mapState } from "vuex";
import { import {
queryFeeCategoryByType as getFeeCategoryByTypeApi, queryFeeCategoryByType as getFeeCategoryByTypeApi,
getGoodsCategoryConfiguration as getGoodsCategoryConfigurationApi, getGoodsCategoryConfiguration as getGoodsCategoryConfigurationApi,
} from "@/api/sys.base.js"; } from "@/api/sys.base.js";
import { VIEW_MODE } from "@/views/goods/shelfManage/constant/baseData.js"; import { VIEW_MODE } from "@/views/goods/shelfManage/constant/baseData.js";
import { processFeeCategories } from "../../utils/feeCategoryHelper.js";
import Detail from "./specialCategoryDetail/index.vue"; import Detail from "./specialCategoryDetail/index.vue";
import Modify from "./specialCategoryModify/index.vue"; import Modify from "./specialCategoryModify/index.vue";
...@@ -35,48 +35,58 @@ export default { ...@@ -35,48 +35,58 @@ export default {
type: String, type: String,
require: true, require: true,
}, },
scene: {
type: Number,
require: true,
},
}, },
data() { data() {
return { return {
VIEW_MODE, VIEW_MODE,
localGoodsTypeGroupRules: {},
options: { options: {
category: [], category: {},
productType: [], productType: [],
}, },
query: {
feeCategoryByType: {
feeCategoryType: 1,
orderBy: 2,
pageSize: 100000,
},
},
isInitialized: false, isInitialized: false,
}; };
}, },
computed: { computed: {
...mapState("ShelfManage/ProfitSharingConfigStore", {
sceneType: state => state.sceneType,
goodsTypeGroupRules: state => state.profitSharingForm.goodsTypeGroupRules,
}),
},
watch: {
goodsTypeGroupRules: {
async handler(val) {
await this.init();
},
immediate: true,
},
}, },
async mounted() { async mounted() {
await this.init();
}, },
methods: { methods: {
...mapActions("ShelfManage/ProfitSharingConfigStore", ["getFeeCategoryByType"]),
async init() { async init() {
try { try {
await this.initFeeCategoryByType(this.scene); await this.getFeeCategoryByType();
await this.getProductTypeOptions(); // 商品分类 await this.getProductTypeOptions(); // 商品分类
} finally { } finally {
this.isInitialized = true; this.isInitialized = true;
} }
}, },
handleChangeMode() {},
async validate() {
const modifyRef = this.$refs.modifyRef;
if (!modifyRef) {
// 尚未初始化
return;
}
return await modifyRef.validate();
},
async getProductTypeOptions() { async getProductTypeOptions() {
const { list } = await getGoodsCategoryConfigurationApi({}); const { list } = await getGoodsCategoryConfigurationApi({});
if (list.length) { if (list && list.length) {
this.options.productType = list.map(({ categoryType, categoryName }) => { this.options.productType = list.map(({ categoryType, categoryName }) => {
return { return {
goodsType: categoryType, goodsType: categoryType,
...@@ -85,17 +95,6 @@ export default { ...@@ -85,17 +95,6 @@ export default {
}); });
} }
}, },
async initFeeCategoryByType(scene) {
// 从 API 获取费用类别列表
const result = await getFeeCategoryByTypeApi({ ...this.query.feeCategoryByType, applicationSceneType: this.scene });
// 使用工具函数处理数据:转换格式 + 分类 + 过滤
this.options.category = processFeeCategories(result.list);
},
}, },
}; };
</script> </script>
<style scoped lang="scss">
</style>
...@@ -2,6 +2,40 @@ ...@@ -2,6 +2,40 @@
* 费用类别处理工具 * 费用类别处理工具
* 用于处理分账配置中的费用类别数据转换、验证和分类 * 用于处理分账配置中的费用类别数据转换、验证和分类
*/ */
import _ from "lodash";
/**
* 是否为单店模式
*/
export function isSingleShopMode(shelfType) {
return shelfType === 1;
}
/**
* 是否为批量模式
*/
export function isBatchPublishMode(shelfType) {
return shelfType === 2;
}
/**
* 将 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 || {},
};
});
}
/** /**
* 费用类别类型常量 * 费用类别类型常量
...@@ -49,12 +83,14 @@ export const CATEGORY_CONFIG = { ...@@ -49,12 +83,14 @@ export const CATEGORY_CONFIG = {
export function transformFeeCategoryItem(item) { export function transformFeeCategoryItem(item) {
return { return {
id: item.id, id: item.id,
nodeType: item.nodeType,
applicationObjectType: item.applicationObjectType, applicationObjectType: item.applicationObjectType,
applicationObjectName: item.feeCategoryName,
formType: item.formType, formType: item.formType,
expenseCategoryId: item.feeCategoryNameId,
nodeType: item.nodeType,
targetType: item.applicationObjectType, targetType: item.applicationObjectType,
applicationObjectName: item.feeCategoryName,
// 对应detail中的id
expenseCategoryId: item.feeCategoryNameId,
expenseType: "", expenseType: "",
// 转换子费用类别列表 // 转换子费用类别列表
feeCategoryNameList: transformFeeCategoryChildren(item.feeCategoryChildren, item.applicationObjectType), feeCategoryNameList: transformFeeCategoryChildren(item.feeCategoryChildren, item.applicationObjectType),
...@@ -119,19 +155,22 @@ export function shouldIncludeItem(id, typeConfig) { ...@@ -119,19 +155,22 @@ export function shouldIncludeItem(id, typeConfig) {
* @returns {object} 分类后的费用类别对象 * @returns {object} 分类后的费用类别对象
*/ */
export function processFeeCategories(items) { export function processFeeCategories(items) {
return items.reduce((acc, item) => { const grouped = _
const transformedItem = transformFeeCategoryItem(item); .chain(items)
const config = CATEGORY_CONFIG[item.applicationObjectType]; .map((item) => {
const transformedItem = transformFeeCategoryItem(item);
if (config && shouldIncludeItem(transformedItem.id, config)) { const config = CATEGORY_CONFIG[item.applicationObjectType];
const targetArray = config.target; return config && shouldIncludeItem(transformedItem.id, config)
acc[targetArray].push(transformedItem); ? { item: transformedItem, target: config.target }
} : null;
})
.compact() // 移除 null 值
.groupBy("target") // 按 target 字段分组
.value();
return acc; return {
}, { trafficSide: _.map(grouped.trafficSide, "item") || [],
trafficSide: [], serviceProvider: _.map(grouped.serviceProvider, "item") || [],
serviceProvider: [], platformPublic: _.map(grouped.platformPublic, "item") || [],
platformPublic: [], };
});
} }
...@@ -48,8 +48,10 @@ ...@@ -48,8 +48,10 @@
label: `${subItem.upgradeGoodsName}(${subItem.commodityCode})`, label: `${subItem.upgradeGoodsName}(${subItem.commodityCode})`,
disabled: filterUpgradeGoodsItem(subItem, disabledUpgradeGoodsList), disabled: filterUpgradeGoodsItem(subItem, disabledUpgradeGoodsList),
})" })"
placeholder="请选择商品" :field-name="{
value-key="upgradeGoodsId"> value: 'upgradeGoodsId',
}"
placeholder="请选择商品">
</RemoteSelect> </RemoteSelect>
</el-form-item> </el-form-item>
...@@ -63,8 +65,10 @@ ...@@ -63,8 +65,10 @@
label: `${subItem.packageName}(${subItem.packageCode})`, label: `${subItem.packageName}(${subItem.packageCode})`,
disabled: filterPackageGoodsItem(subItem, disabledUpgradeGoodsList), disabled: filterPackageGoodsItem(subItem, disabledUpgradeGoodsList),
})" })"
placeholder="请选择套餐商品" :field-name="{
value-key="packageCode"> value: 'packageCode',
}"
placeholder="请选择套餐商品">
</RemoteSelect> </RemoteSelect>
</el-form-item> </el-form-item>
</div> </div>
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
class="tab-select" class="tab-select"
:fetch-api="getTitleSelectOptions" :fetch-api="getTitleSelectOptions"
placeholder="请输入相关名称以搜索" placeholder="请输入相关名称以搜索"
value-key="keys" :field-name="{
value: 'keys',
}"
:option-props="(subItem) => ({ :option-props="(subItem) => ({
label: `${subItem.title}`, label: `${subItem.title}`,
})" })"
......
...@@ -8,8 +8,10 @@ ...@@ -8,8 +8,10 @@
class="tab-select" class="tab-select"
:fetch-api="getTitleSelectOptions" :fetch-api="getTitleSelectOptions"
placeholder="请输入相关名称以搜索" placeholder="请输入相关名称以搜索"
label-key="merchantName" :field-name="{
value-key="merchantId" label: 'merchantName',
value: 'merchantId',
}"
immediate immediate
:popper-append-to-body="false" :popper-append-to-body="false"
:multiple="false" :multiple="false"
......
import { getBusisDetailBasic } from "@/api/shelfManage.js"; import ProfitSharingConfigStore from "../components/profitSharingConfig/store/index";
import { getGoodsCategoryConfiguration } from "@/api/sys.base.js";
import { businessModeList, onlinePointsEnabledList, operationModeList } from "../constant/baseData";
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
options: {
// 签约主体
platformLevelList: [],
// 园区店上级
serviceList: [],
// 园区店
parkStoreList: [],
merchantList: [],
merchantLevelList: [],
businessModeList,
sceneCodeList: [],
operationModeList,
onlinePointsEnabledList,
partnerMerchantList: [],
},
}, },
actions: { actions: {
async getGoodsCategoryConfiguration({ commit, state, dispatch }) {
return await dispatch("cacheStore/fetchData", {
key: "goodsCategoryConfiguration",
apiFn: getGoodsCategoryConfiguration,
}, { root: true });
},
async getBusinessDetailBasic({ commit, state, dispatch }, params) {
return dispatch("cacheStore/fetchData", {
key: "businessDetailBasic",
apiFn: getBusisDetailBasic,
params,
}, { root: true });
},
}, },
modules: {
ProfitSharingConfigStore,
},
}; };
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<!-- 分账配置 --> <!-- 分账配置 -->
<ProfitSharingConfig ref="profitSharingConfigRef" <ProfitSharingConfig ref="profitSharingConfigRef"
:shelve-id="shelveId" :shelve-id="shelveId"
:scene-type="shelvingData.sceneType"
:shelf-type="shelvingData.shelfType" :shelf-type="shelvingData.shelfType"
:business-code="businessCode" /> :business-code="businessCode" />
</div> </div>
...@@ -135,7 +136,7 @@ export default { ...@@ -135,7 +136,7 @@ export default {
data() { data() {
return { return {
steps: { steps: {
active: 1, active: 2,
}, },
shelveId: "", shelveId: "",
businessCode: "", businessCode: "",
......
...@@ -134,8 +134,10 @@ ...@@ -134,8 +134,10 @@
class="tab-select" class="tab-select"
:fetch-api="getMerchantPageList" :fetch-api="getMerchantPageList"
placeholder="请输入相关名称以搜索" placeholder="请输入相关名称以搜索"
label-key="merchantName" :field-name="{
value-key="merchantNo" label: 'merchantName',
value: 'merchantNo',
}"
immediate immediate
:popper-append-to-body="false" :popper-append-to-body="false"
:multiple="false" :multiple="false"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!