Commit 8708483d by chenwq

fix(oneCustomerOneGroup): 修复更新时店铺不存在导致数据不一致的问题

在更新群码时,如果关联的店铺在店铺列表中不存在,则清空已选择的店铺信息,避免数据不一致
1 parent ef9f3450
...@@ -214,14 +214,27 @@ export default { ...@@ -214,14 +214,27 @@ export default {
}, },
mounted() { mounted() {
const { optType, id } = this.$route.query; const { optType, id } = this.$route.query;
const promises = [this.getStoreList()];
if (optType === "update") { if (optType === "update") {
this.getDetail(id); promises.push(this.getDetail(id));
} }
this.getStoreList();
Promise.all(promises).then(() => {
if (optType === "update" && this.editData.storeId) {
const storeExists = this.baseData.storeList.some(
(item) => item.mainMerchantId == this.editData.storeId
);
if (!storeExists) {
this.editData.storeId = "";
this.editData.storeName = "";
}
}
});
}, },
methods: { methods: {
getDetail(id) { getDetail(id) {
getLiveCodeDetail({ id }).then((res) => { return getLiveCodeDetail({ id }).then((res) => {
const data = res || {}; const data = res || {};
const groupChatIds = deepClone(data.groupList || []); const groupChatIds = deepClone(data.groupList || []);
const deteleAttrList = ["groupList", "groupCount", "idleGroupCount"]; const deteleAttrList = ["groupList", "groupCount", "idleGroupCount"];
...@@ -284,7 +297,7 @@ export default { ...@@ -284,7 +297,7 @@ export default {
console.log(this.baseFormData, "----"); console.log(this.baseFormData, "----");
}, },
getStoreList() { getStoreList() {
getCarDealerList().then((res) => { return getCarDealerList().then((res) => {
this.baseData.storeList = res || []; this.baseData.storeList = res || [];
console.log(this.baseData.storeList); console.log(this.baseData.storeList);
this.getOptionsList("baseFormData", false, "storeId"); this.getOptionsList("baseFormData", false, "storeId");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!