Commit ca1e7dba by Jaxon

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

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