Commit 5389b611 by Jaxon

feat: 嘀加上架 - 运营确认 - 对账配置 - 二次拆分跳帧

1 parent 087842e0
...@@ -130,7 +130,6 @@ import { ...@@ -130,7 +130,6 @@ import {
otherSelectOptions, otherSelectOptions,
severSelectOptions, severSelectOptions,
} from "@/common/constant/merchant"; } from "@/common/constant/merchant";
import { limitPrice } from "@/common/format";
import RemoteSelect from "@/components/remoteSearchSelect/index.vue"; import RemoteSelect from "@/components/remoteSearchSelect/index.vue";
import { CategoryTypeOptions } from "../../../../data.js"; import { CategoryTypeOptions } from "../../../../data.js";
import CostAttributionSetting from "../../costAttributionSetting/index.vue"; import CostAttributionSetting from "../../costAttributionSetting/index.vue";
...@@ -354,22 +353,6 @@ export default { ...@@ -354,22 +353,6 @@ export default {
}, },
}, },
watch: {
categoryOptions: {
handler(val) {
this.initList("classificationObjSelect");
},
deep: true,
immediate: true,
},
goodsTypeGroupRules: {
handler() {
this.initList();
},
deep: true,
// immediate: true
},
},
mounted() { mounted() {
this.initList(); this.initList();
}, },
......
<template> <template>
<div class=""> <div class="edit-page reconciliation-config-wrapper">
<div class="title">
<span class="label">对账配置</span>
<!-- <el-button v-if="merchantSettleDistributeRuleLastRuleInfo && merchantSettleDistributeRuleLastRuleInfo.reconciliationRuleDiffList && merchantSettleDistributeRuleLastRuleInfo.basicInfo.shelfType == 1"
class="ruleBtn"
type="text"
@click="ruleUpdateDialogShow = true">
变更说明
</el-button> -->
<div class="tab-select">
<el-select v-model="tabsActive"
filterable
:loading="tabs.loading"
placeholder="请选择特殊品类"
:popper-append-to-body="false"
remote
:remote-method="handleSearchReconciliation">
<el-option v-for="item in tabs.list"
:key="item.keys"
:label="item.title"
:value="item.keys">
<span>{{ item.title }}</span>
</el-option>
</el-select>
</div>
<div class="actions-wrapper">
<el-button icon="el-icon-plus"
type="primary"
size="small"
plain
@click="handleAppendSpecialCategory">
新增
</el-button>
</div>
</div>
<template v-if="shelveId && tabs.active">
<Detail v-if="mode === VIEW_MODE.VIEW" <Detail v-if="mode === VIEW_MODE.VIEW"
v-bind="$attrs" v-bind="$attrs"
:goods-type-group-reconciliation-rules="goodsTypeGroupReconciliationRules"
:shelve-id="shelveId"
:platform-options="options.platform"
:serve-options="options.server"
:goods-list="options.goods"
v-on="$listeners" /> v-on="$listeners" />
<Modify v-if="mode === VIEW_MODE.EDIT" <Modify v-if="mode === VIEW_MODE.EDIT"
v-bind="$attrs" v-bind="$attrs"
:platform-options="options.platform"
:serve-options="options.server"
:goods-list="options.goods"
:selected-reconciliation-rules="selectedReconciliationRules"
:shelve-id="shelveId"
v-on="$listeners" /> v-on="$listeners" />
</template>
<el-button @click="handleChangeMode"> <el-button @click="handleChangeMode">
编辑 编辑
</el-button> </el-button>
...@@ -15,6 +64,12 @@ ...@@ -15,6 +64,12 @@
</template> </template>
<script> <script>
import { getQueryFeeCategoryByTypeApi } from "@api/merchant";
import { merchantSettleDistributeRuleLastRule } from "@api/shelfManage";
import { cloneDeep } from "lodash-es";
import { nanoid } from "nanoid";
import { getGoodsCategoryConfiguration } 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 Detail from "./components/detail/index.vue"; import Detail from "./components/detail/index.vue";
import Modify from "./components/modify/index.vue"; import Modify from "./components/modify/index.vue";
...@@ -26,26 +81,214 @@ export default { ...@@ -26,26 +81,214 @@ export default {
Modify, Modify,
}, },
props: { props: {
shelveId: {
type: [String, Number],
required: true,
},
}, },
data() { data() {
return { return {
VIEW_MODE, VIEW_MODE,
mode: VIEW_MODE.VIEW, mode: VIEW_MODE.EDIT,
tabs: {
active: undefined,
loading: false,
list: [],
query: {
currentPage: 1,
pageSize: 50,
merchantIdName: "",
},
},
goodsTypeGroupReconciliationRules: [],
options: {
flow: [],
server: [],
platform: [],
goods: [],
},
}; };
}, },
computed: { computed: {
tabsActive: {
get() {
return this.tabs.active || (this.tabs.list.length ? this.tabs.list?.[0]?.id : undefined);
},
set(val) {
this.tabs.active = val;
},
},
selectedReconciliationRules() {
if (!this.tabsActive) {
return {};
}
return this.goodsTypeGroupReconciliationRules.find(item => item.tabKeys === this.tabsActive);
}, },
mounted() { },
watch: {
shelveId: {
immediate: true,
async handler(val, oldVal) {
if (!val || val === oldVal)
return;
await this.getEffectRule(val);
},
},
},
async mounted() {
await this.getQueryFeeCategoryByType();
await this.getGoodsList();
}, },
methods: { methods: {
handleChangeMode() {}, handleChangeMode() {},
// title 特殊品类 选择框 搜索
handleSearchReconciliation() {},
// title 特殊品类 新增
handleAppendSpecialCategory() {},
async getGoodsList() {
const { list } = await getGoodsCategoryConfiguration({});
if (list && list.length) {
this.options.goods = list.map(({ categoryType, categoryName }) => ({
goodsType: categoryType,
goodsTypeName: categoryName,
}));
}
},
async getQueryFeeCategoryByType() {
const result = await getQueryFeeCategoryByTypeApi({
feeCategoryType: 2,
pageSize: 10000,
});
this.options.flow = result.list.filter(item => item.applicationObjectType === 1);
this.options.server = result.list.filter(item => item.applicationObjectType === 2);
this.options.platform = result.list.filter(item => item.applicationObjectType === 3);
},
async getEffectRule(shelveId) {
const { merchantReconciliationRule } = await merchantSettleDistributeRuleLastRule({ id: shelveId });
// 所有按具体商品已选中的商品数据
let upgradeArr = [];
let packageArr = [];
const hasAllGoodsType = merchantReconciliationRule.goodsTypeGroupReconciliationRules.find(item => item.groupType === 1);
const typeList = merchantReconciliationRule.goodsTypeGroupReconciliationRules;
typeList.forEach((item, index) => {
// index &&
const keys = nanoid();
item.tabKeys = keys;
this.tabs.list.push({
title: item.groupType === 1 ? "全部品类" : "特殊品类" + (hasAllGoodsType ? index : index + 1),
name: (index + 1).toString(),
keys,
});
if (item.goodsTypeGroupRelations && item.goodsTypeGroupRelations.length) {
// 按具体分类
if (item.goodsTypeGroupRelations[0]?.categoryType === 1) {
item.goodsTypeGroupRelations = cloneDeep(item.goodsTypeGroupRelations);
item.categoryType = 1;
item.upgradeGoods = [];
}
// 按具体商品
if (item.goodsTypeGroupRelations[0]?.categoryType === 2) {
item.upgradeGoods = cloneDeep(item.goodsTypeGroupRelations);
item.categoryType = 2;
upgradeArr = item.goodsTypeGroupRelations.map(val => ({
upgradeGoodsId: val.upgradeGoodsId,
upgradeGoodsName: val.upgradeGoodsName,
commodityCode: val.commodityCode,
}));
item.goodsTypeGroupRelations = [];
}
if (item.goodsTypeGroupRelations[0]?.categoryType === 3) {
item.packageGoods = cloneDeep(item.goodsTypeGroupRelations);
item.categoryType = 3;
packageArr = item.goodsTypeGroupRelations.map(val => ({
packageCode: val.packageCode,
packageName: val.packageName,
}));
item.goodsTypeGroupRelations = [];
}
}
});
// 设置默认值
this.tabs.active = typeList[0].tabKeys;
this.goodsTypeGroupReconciliationRules = merchantReconciliationRule.goodsTypeGroupReconciliationRules;
await this.getSelectingList(upgradeArr);
await this.getSelectingListPackage(packageArr);
},
async getSelectingList(defaultSelect) {
// let res = await this.getGoods();
// this.allPages = res.pages;
// const resArr = res.list.reduce((arr, val) => {
// val.upgradeGoodsList.forEach((el) => {
// const item = {};
// const { upgradeGoodsName, id, commodityCode } = el;
// item.upgradeGoodsId = id;
// item.upgradeGoodsName = upgradeGoodsName;
// item.commodityCode = commodityCode;
// arr.push(item);
// });
// return arr;
// }, []);
// let arr = this.upgradeGoodsList.concat(resArr);
// // 已选中的做为回显用 将数据追加进去
// if (defaultSelect?.length)
// arr = arr.concat(defaultSelect);
// this.upgradeGoodsList = this.unique(arr);
// console.log(this.upgradeGoodsList, "this.upgradeGoodsList2");
},
// 或者商品套餐
async getSelectingListPackage(defaultSelect = [], packageArr = []) {
// packageArr = packageArr.map((item) => {
// item.packageCode = item.packageCode || item.virtualCode;
// item.packageName = item.name || item.val1;
// item.tempPackageCode = item.virtualCode || "";
// return item;
// });
// this.packageGoodsList = this.uniquePackage(packageArr);
// const res = await getMerchantPackageGoodsInfoApi({
// currentPage: 1,
// pageSize: 20,
// status: 1,
// sceneType: 0, // 固定查权益类的
// merchantIdList: [
// this.merchantSettleDistributeRuleLastRuleInfo.merchantSettleDistributeRule.realityShopMerchantId,
// ],
// });
// console.log(res, "merchantPackageGoodsInfoPage");
// const resArr = [];
// res.list
// && res.list.forEach((val) => {
// resArr.push({
// packageCode: val.packageCode,
// packageName: val.packageName,
// });
// });
// console.log(resArr, "resArr");
// let arr = this.packageGoodsList.concat(resArr);
// if (defaultSelect?.length)
// arr = arr.concat(defaultSelect);
// this.packageGoodsList = this.uniquePackage(arr);
},
}, },
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.reconciliation-config-wrapper {
> .title {
display: flex;
align-items: center;
> .tab-select {
flex: 1;
margin-left: 20px;
margin-right: 20px;
}
}
}
</style> </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;
});
}
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<el-carousel-item> <el-carousel-item>
<div v-if="steps.active === 3"> <div v-if="steps.active === 3">
<!-- 对账配置 --> <!-- 对账配置 -->
<ReconciliationConfig /> <ReconciliationConfig :shelve-id="shelveId" />
</div> </div>
</el-carousel-item> </el-carousel-item>
...@@ -108,18 +108,20 @@ export default { ...@@ -108,18 +108,20 @@ export default {
data() { data() {
return { return {
steps: { steps: {
active: 0, active: 3,
}, },
shelveId: undefined, shelveId: "",
merchantEditData: [], merchantEditData: [],
editData: { editData: {
merchantName: "", merchantName: "",
}, },
}; };
}, },
created() {
this.shelveId = this.$route.query.id;
},
async mounted() { async mounted() {
// id,businessCode // id,businessCode
this.shelveId = this.$route.query.id;
}, },
// 方法集合 // 方法集合
methods: { methods: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!