Commit 0274e53d by huaying

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

parents c54585a4 715dd24a
......@@ -152,6 +152,7 @@ export default {
const that = this;
return {
storeUuid: '',
storeUuidCache: '',
// 商场抵金券适用门店-部分门店列表数据
originStoreList: [],
// 商场抵金券适用门店-门店选择器选中的数据
......@@ -459,48 +460,45 @@ export default {
this.storeMode = value == 0 ? 0 : 1;
this.originStoreList = [];
if (this.isEdit) {
this.selectedStoreList = [];
this.originStoreList = [...this.form.costStoreList];
}
if (this.isEdit || this.isCopy) {
this.storeUuid = this.storeUuidCache;
}
},
onStoreChange(id) {
if (this.storeMode == 0) {
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 +866,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);
}
}
// 线下适用商品
......@@ -980,6 +981,7 @@ export default {
}
if (this.form.cardType == 3) {
this.storeUuid = card.storeWidgetKey || '';
this.storeUuidCache = card.storeWidgetKey || '';
} else {
this.uuid = card.storeWidgetKey || '';
this.$nextTick(_ => {
......
......@@ -177,7 +177,8 @@ export default {
0: 'https://pic01-10001430.image.myqcloud.com/522b7c1e-dea4-4068-b0a3-0e07bc229b0d',
1: 'https://pic01-10001430.image.myqcloud.com/32fa9132-5aed-4f7f-8be1-a3f81f2e58f7',
2: 'https://pic01-10001430.image.myqcloud.com/029abce4-660c-4115-a70f-55ba8f626832',
3: 'https://pic01-10001430.image.myqcloud.com/7fbc9e9b-4115-4795-aea3-cd2c1ec8da63'
// 3: 'https://pic01-10001430.image.myqcloud.com/7fbc9e9b-4115-4795-aea3-cd2c1ec8da63'
3: 'https://pic01-10001430.image.myqcloud.com/522b7c1e-dea4-4068-b0a3-0e07bc229b0d'
},
show: false,
prizeForm: {
......
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