Commit 64136ba6 by caoyanzhi

Merge branch 'feature/8月-奥莱定制' into dev

parents b2110c1a 61f08de8
......@@ -467,40 +467,33 @@ export default {
getStoreByCode({ key: this.storeUuid, isClique: 0, pageSize: 99999, currentPage: 1 }).then(res => {
const { result, errorCode } = res || {};
if (errorCode == 0 && Array.isArray(result.result)) {
this.selectedStoreList = result.result.map(el => {
const { storeId, storeCode, storeName } = el;
return { storeId, storeCode, storeName, costValueProportion: undefined, costValue: 0 };
});
if (this.isEdit) {
// 编辑卡券通过门店选择器添加门店时,需要先过滤掉已经选中的门店,再与form.costStoreList合并
this.selectedStoreList = this.selectedStoreList.filter(el => this.form.costStoreList.every(item => item.storeId != el.storeId));
this.originStoreList = [...this.selectedStoreList, ...this.form.costStoreList];
} else if (this.isAdd || this.isCopy) {
// 新建卡券时直接覆盖
this.originStoreList = this.selectedStoreList;
}
this.setStoreList(result.result);
}
});
} else {
getStoreWidgetStore({ key: id, pageSize: 99999, currentPage: 1 }).then(res => {
const { result, errorCode } = res || {};
if (errorCode == 0 && Array.isArray(result.result)) {
this.selectedStoreList = result.result.map(el => {
const { storeId, storeCode, storeName } = el;
return { storeId, storeCode, storeName, costValueProportion: undefined, costValue: 0 };
});
if (this.isEdit) {
// 编辑卡券通过门店选择器添加门店时,需要先过滤掉已经选中的门店,再与form.costStoreList合并
this.selectedStoreList = this.selectedStoreList.filter(el => this.form.costStoreList.every(item => item.storeId != el.storeId));
this.originStoreList = [...this.selectedStoreList, ...this.form.costStoreList];
} else if (this.isAdd || this.isCopy) {
// 新建卡券时直接覆盖
this.originStoreList = this.selectedStoreList;
}
this.setStoreList(result.result);
}
});
}
},
setStoreList(storeList) {
this.selectedStoreList = storeList.map(el => {
const index = this.originStoreList.findIndex(item => item.storeId == el.storeId);
const { storeId, storeCode, storeName } = el;
return { storeId, storeCode, storeName, costValueProportion: index >= 0 ? this.originStoreList[index].costValueProportion : undefined, costValue: 0 };
});
if (this.isEdit) {
// 编辑卡券通过门店选择器添加门店时,需要先过滤掉已经选中的门店,再与form.costStoreList合并
this.selectedStoreList = this.selectedStoreList.filter(el => this.form.costStoreList.every(item => item.storeId != el.storeId));
this.originStoreList = [...this.selectedStoreList, ...this.form.costStoreList];
} else if (this.isAdd || this.isCopy) {
// 新建卡券时直接覆盖
this.originStoreList = this.selectedStoreList;
}
},
onSortStore(sortType) {
this.sortType = sortType;
if (sortType == 0) {
......@@ -868,6 +861,9 @@ export default {
this.form.costValueProportion = card.costValueProportion; //成本比例
this.form.costStoreList = (this.isEdit || this.isInfo || this.isCopy) && Array.isArray(card.costStoreList) ? card.costStoreList : [];
this.originStoreList = this.form.costStoreList;
if (this.isCopy) {
this.onStoreChange(card.storeWidgetKey);
}
}
// 线下适用商品
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment