|
@@ -838,10 +838,6 @@ const formRef = ref<FormInstance>();
|
|
|
const loading = ref(false);
|
|
const loading = ref(false);
|
|
|
// 标记是否正在加载详情数据,用于防止触发 watch
|
|
// 标记是否正在加载详情数据,用于防止触发 watch
|
|
|
const isLoadingDetail = ref(false);
|
|
const isLoadingDetail = ref(false);
|
|
|
-// 保存原始的经营板块值,用于确认对话框
|
|
|
|
|
-const originalBusinessSection = ref<number | "">("");
|
|
|
|
|
-// 标记是否正在恢复原值,防止触发 watch 递归
|
|
|
|
|
-const isRestoringValue = ref(false);
|
|
|
|
|
|
|
|
|
|
// 店铺评价三个输入框的独立变量
|
|
// 店铺评价三个输入框的独立变量
|
|
|
const storeEvaluate1 = ref("");
|
|
const storeEvaluate1 = ref("");
|
|
@@ -1284,8 +1280,6 @@ const getStoreDetailData = async () => {
|
|
|
if (storeData.businessSection) {
|
|
if (storeData.businessSection) {
|
|
|
formData.businessSection = storeData.businessSection;
|
|
formData.businessSection = storeData.businessSection;
|
|
|
formData.businessSectionName = storeData.businessSectionName ?? "";
|
|
formData.businessSectionName = storeData.businessSectionName ?? "";
|
|
|
- // 保存原始的经营板块值
|
|
|
|
|
- originalBusinessSection.value = storeData.businessSection;
|
|
|
|
|
}
|
|
}
|
|
|
// 设置标签选择(仅当经营板块为生活服务时)
|
|
// 设置标签选择(仅当经营板块为生活服务时)
|
|
|
if (storeData.businessSection === 3) {
|
|
if (storeData.businessSection === 3) {
|
|
@@ -1306,78 +1300,30 @@ const getStoreDetailData = async () => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// 监听经营板块变化,更新经营板块名称
|
|
|
|
|
|
|
+// 监听经营板块变化,更新经营板块名称(由于已禁用,此 watch 主要用于初始化)
|
|
|
watch(
|
|
watch(
|
|
|
() => formData.businessSection,
|
|
() => formData.businessSection,
|
|
|
- async (newValue, oldValue) => {
|
|
|
|
|
|
|
+ newValue => {
|
|
|
// 如果正在加载详情数据,不触发 watch(避免重复请求)
|
|
// 如果正在加载详情数据,不触发 watch(避免重复请求)
|
|
|
if (isLoadingDetail.value) {
|
|
if (isLoadingDetail.value) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 如果正在恢复原值,不处理
|
|
|
|
|
- if (isRestoringValue.value) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 如果是首次加载或值没有变化,直接更新原始值
|
|
|
|
|
- if (originalBusinessSection.value === "" || oldValue === undefined) {
|
|
|
|
|
- originalBusinessSection.value = newValue;
|
|
|
|
|
- if (newValue) {
|
|
|
|
|
- const selectedSection = businessSectionList.value.find(item => item.dictId === newValue);
|
|
|
|
|
- formData.businessSectionName = selectedSection ? selectedSection.dictDetail : "";
|
|
|
|
|
- // 当切换到生活服务时,如果经营类目是 0,清空它
|
|
|
|
|
- if (newValue === 3 && formData.businessCategoryName === "0") {
|
|
|
|
|
- formData.businessCategoryName = "";
|
|
|
|
|
- }
|
|
|
|
|
- // 当切换到非生活服务时,清空标签选择
|
|
|
|
|
- if (newValue !== 3) {
|
|
|
|
|
- formData.storeTickets = "";
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- // 如果经营板块为空,也清空标签选择
|
|
|
|
|
- formData.storeTickets = "";
|
|
|
|
|
|
|
+ // 更新经营板块名称
|
|
|
|
|
+ if (newValue) {
|
|
|
|
|
+ const selectedSection = businessSectionList.value.find(item => item.dictId === newValue);
|
|
|
|
|
+ formData.businessSectionName = selectedSection ? selectedSection.dictDetail : "";
|
|
|
|
|
+ // 当切换到生活服务时,如果经营类目是 0,清空它
|
|
|
|
|
+ if (newValue === 3 && formData.businessCategoryName === "0") {
|
|
|
|
|
+ formData.businessCategoryName = "";
|
|
|
}
|
|
}
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 如果值没有变化,不处理
|
|
|
|
|
- if (newValue === oldValue) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 弹出确认对话框
|
|
|
|
|
- try {
|
|
|
|
|
- await ElMessageBox.confirm("更改经营板块需要同步更换营业执照等信息,如不更换可能会导致审核不通过", "确认更改么?", {
|
|
|
|
|
- confirmButtonText: "确认",
|
|
|
|
|
- cancelButtonText: "取消",
|
|
|
|
|
- type: "warning"
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- // 用户确认,更新值
|
|
|
|
|
- originalBusinessSection.value = newValue;
|
|
|
|
|
- if (newValue) {
|
|
|
|
|
- const selectedSection = businessSectionList.value.find(item => item.dictId === newValue);
|
|
|
|
|
- formData.businessSectionName = selectedSection ? selectedSection.dictDetail : "";
|
|
|
|
|
- // 当切换到生活服务时,如果经营类目是 0,清空它
|
|
|
|
|
- if (newValue === 3 && formData.businessCategoryName === "0") {
|
|
|
|
|
- formData.businessCategoryName = "";
|
|
|
|
|
- }
|
|
|
|
|
- // 当切换到非生活服务时,清空标签选择
|
|
|
|
|
- if (newValue !== 3) {
|
|
|
|
|
- formData.storeTickets = "";
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- // 如果经营板块为空,也清空标签选择
|
|
|
|
|
|
|
+ // 当切换到非生活服务时,清空标签选择
|
|
|
|
|
+ if (newValue !== 3) {
|
|
|
formData.storeTickets = "";
|
|
formData.storeTickets = "";
|
|
|
}
|
|
}
|
|
|
- } catch {
|
|
|
|
|
- // 用户取消,恢复原值
|
|
|
|
|
- isRestoringValue.value = true;
|
|
|
|
|
- formData.businessSection = originalBusinessSection.value;
|
|
|
|
|
- nextTick(() => {
|
|
|
|
|
- isRestoringValue.value = false;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果经营板块为空,也清空标签选择
|
|
|
|
|
+ formData.storeTickets = "";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|