Commit f434769f by Jaxon

fix(performanceScheme): 修复商品配置与门店品牌数据转换问题

修复商品定义列表选项未正确传递的问题,确保商品分类信息在参数配置中正确设置。调整门店品牌数据在表单保存时的处理逻辑,避免数据转换错误。移除调试用的 console.log 语句。
1 parent dbf9e8fb
......@@ -134,6 +134,7 @@ export default {
},
computedOptions() {
console.log("222", this.getProductDefineListOptions);
if (!this.getProductDefineListOptions || !this.getProductDefineListOptions.length)
return [];
......
......@@ -88,6 +88,7 @@ export default {
if (!state.formData.goodsConfigTypes.includes("1")) {
return [];
}
console.log("123123");
return state.productDefineList.map(item => ({
label: item.label,
value: item.value,
......@@ -192,13 +193,21 @@ export default {
);
// 按 selectedItems 顺序构建新的 paramConfigList
const formDataGoodsCategory = state.formData.goodsConfigTypes;
state.formData.paramConfigList = selectedOptions.map((item) => {
const sort = item.sort;
const table = structuredClone(paramConfigListTemplate);
console.log("formDataGoodsCategory", formDataGoodsCategory);
if (formDataGoodsCategory && formDataGoodsCategory.length) {
table.goodsCategory = formDataGoodsCategory[0];
}
// 如果已存在(根据 sort),使用现有配置;否则创建新配置
return existingConfigMap.has(sort)
? existingConfigMap.get(sort)
: {
...structuredClone(paramConfigListTemplate),
...table,
priceRangeProps: item.componentProps,
title: item.label,
assessmentFactorOptions: item,
......
......@@ -6,7 +6,6 @@ const commissionTypesCoverCommissionBase = {
GDJE: "SJDDS",
};
export function convertDataToBackend(formData) {
console.log("store.getters", store.getters);
const productDefineList = store.getters["PerformanceFormStore/getProductDefineListOptions"];
const goodsCategory = store.getters["PerformanceFormStore/getGoodsCategory"];
const { paramConfigList, merchantBrandRefList, ...data } = formData;
......@@ -78,6 +77,7 @@ export function convertDataToBackend(formData) {
});
}
}
console.log("setMerchantBrandRefList", merchantBrandRefList);
// 整理门店
if (merchantBrandRefList && merchantBrandRefList.length) {
requestData.merchantBrandRefList = buildMerchantBrandPayload(merchantBrandRefList, data.businessType);
......
......@@ -207,13 +207,10 @@ export default {
id,
merchantId: this.$route.query?.id,
});
const performance = convertBackendToData(data);
const { merchantBrandRefList, ...performance } = convertBackendToData(data);
this.touchAssessment(performance.assessmentFactorValue);
this.setFormData({
...performance,
id,
});
this.setMerchantBrandRefList(data.merchantBrandRefList);
this.setFormData(performance);
this.setMerchantBrandRefList(merchantBrandRefList);
} finally {
this.loading.page = false;
}
......@@ -251,13 +248,10 @@ export default {
return;
}
// 其他状态直接弹窗,在弹窗确定后在提交保存
this.dialog.approvalView.params = {
...convertDataToBackend(this.formData),
// 门店品牌数据不转换.这个页面没有用到这个数据的地方.
// 后端要求前端保存, 前端发送
// 要原汁原味- -
this.dialog.approvalView.params = convertDataToBackend({
...this.formData,
merchantBrandRefList: this.merchantBrandRefList,
};
});
// const params = convertDataToBackend({
// ...this.formData,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!