Commit f434769f by Jaxon

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

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