Commit 735c1915 by Jaxon

fix(performanceScheme): 修复门店选择组件和提成方案页面的加载与数据问题

- 移除调试用的 console.log 和硬编码的总数,使用接口返回的 total
- 为门店选择组件添加 overflow: hidden 防止布局溢出
- 将全局加载状态替换为页面级独立 loading 控制
- 优化 mounted 和异步操作的加载状态管理,确保 finally 中正确关闭
- 移除已注释的 watch 规则,简化代码逻辑
1 parent 38940b37
......@@ -309,10 +309,8 @@ export default {
});
},
async getData() {
console.log("this.queryParams", this.queryParams);
this.loading = true;
const { currentPage, list, pageSize, total }
= await getMerchantBrand(this.queryParams);
const { currentPage, list, pageSize, total } = await getMerchantBrand(this.queryParams);
this.loading = false;
list.forEach((merchant, index) => {
const selectedMerchant
......@@ -356,8 +354,7 @@ export default {
});
this.merchantTable = list;
// this.queryParams.total = total;
this.queryParams.total = 99999999;
this.queryParams.total = total;
},
},
};
......@@ -367,6 +364,7 @@ export default {
.selection-store-wrapper {
display: flex;
width: 100%;
overflow: hidden;
> .pre-select-store-wrapper {
flex: 1;
min-width: 616px;
......
<template>
<d2-container v-loading="$store.state.d2admin.loading.value" class="performance-scheme-wrapper">
<!-- v-loading="$store.state.d2admin.loading.value" -->
<d2-container v-loading="loading.page" class="performance-scheme-wrapper">
<el-form ref="form"
class="form-performance-name"
label-width="170px"
......@@ -112,6 +113,9 @@ export default {
data() {
return {
id: 0,
loading: {
page: false,
},
rules: {},
detailVisible: false,
shouldValidateAll: false, // 是否应该验证所有字段
......@@ -122,27 +126,32 @@ export default {
schemeName: bindFormFields("schemeName"),
},
watch: {
formData: {
handler() {
// 当formData变化时,更新rules
this.rules = getFormRules(this.formData, this.merchantBrandRefList);
},
deep: true,
immediate: true,
},
merchantBrandRefList: {
handler() {
// 当门店列表变化时,更新rules
this.rules = getFormRules(this.formData, this.merchantBrandRefList);
},
deep: true,
},
// formData: {
// handler() {
// // 当formData变化时,更新rules
// this.rules = getFormRules(this.formData, this.merchantBrandRefList);
// },
// deep: true,
// immediate: true,
// },
// merchantBrandRefList: {
// handler() {
// // 当门店列表变化时,更新rules
// this.rules = getFormRules(this.formData, this.merchantBrandRefList);
// },
// deep: true,
// },
},
async mounted() {
await this.initLoad();
if (this.$route?.query?.id) {
this.id = this.$route.query.id;
await this.getData(this.$route?.query?.id);
try {
this.loading.page = true;
await this.initLoad();
if (this.$route?.query?.id) {
this.id = this.$route.query.id;
await this.getData(this.$route?.query?.id);
}
} finally {
this.loading.page = false;
}
},
......
<template>
<d2-container v-loading="$store.state.d2admin.loading.value"
<d2-container v-loading="loading.page"
class="performance-scheme-wrapper">
<el-form ref="form"
class="form-performance-name"
......@@ -134,6 +134,9 @@ export default {
props: {},
data() {
return {
loading: {
page: false,
},
brandMerchantList: [],
rules: {},
detailVisible: false,
......@@ -172,21 +175,6 @@ export default {
},
},
watch: {
formData: {
handler() {
// 当formData变化时,更新rules
this.rules = getFormRules(this.formData, this.merchantBrandRefList);
},
deep: true,
immediate: true,
},
merchantBrandRefList: {
handler() {
// 当门店列表变化时,更新rules
this.rules = getFormRules(this.formData, this.merchantBrandRefList);
},
deep: true,
},
},
async mounted() {
console.log("this.$route.query", this.$route.query);
......@@ -206,17 +194,22 @@ export default {
"resetFormData",
]),
async handleChangeBusinessType({ id }) {
const data = await getConfigMerchantDetail({
id,
merchantId: this.$route.query?.id,
});
const performance = convertBackendToData(data);
this.touchAssessment(performance.assessmentFactorValue);
this.setFormData({
...performance,
id,
});
this.setMerchantBrandRefList(data.merchantBrandRefList);
this.loading.page = true;
try {
const data = await getConfigMerchantDetail({
id,
merchantId: this.$route.query?.id,
});
const performance = convertBackendToData(data);
this.touchAssessment(performance.assessmentFactorValue);
this.setFormData({
...performance,
id,
});
this.setMerchantBrandRefList(data.merchantBrandRefList);
} finally {
this.loading.page = false;
}
},
handleCheckClose(e) {
......@@ -277,22 +270,26 @@ export default {
}
},
async getData(id) {
this.brandMerchantList = await postBrandMerchant({
merchantId: id,
});
// 获取品类
const { list } = await getAllCategory({
pageSize: 9999,
currentPage: 1,
});
this.setGoodsCategory(list);
// 获取圈定商品/套餐
const res = await getTargetProductConfigListAPI({
currentPage: 1,
pageSize: 999,
});
this.setProductDefineList(res?.list);
console.log(this.brandMerchantList);
this.loading.page = true;
try {
this.brandMerchantList = await postBrandMerchant({
merchantId: id,
});
// 获取品类
const { list } = await getAllCategory({
pageSize: 9999,
currentPage: 1,
});
this.setGoodsCategory(list);
// 获取圈定商品/套餐
const res = await getTargetProductConfigListAPI({
currentPage: 1,
pageSize: 999,
});
this.setProductDefineList(res?.list);
} finally {
this.loading.page = false;
}
},
handleCancel() {
// this.$EventBus.$emit("salaryPerformanceTab", {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!