Commit dfc2afd2 by crushh

Merge branch 'feature/hl-2月迭代' into dev

parents 51541155 bf1b77e8
......@@ -1059,6 +1059,11 @@ export default {
this.limitTimesNum = Math.min.apply(null, this.limitTimesNumArr);
this.couponCardStock = Math.min.apply(null, this.couponCardStockArr);
}
const params = {
coupCardId: this.cardList.map(item => item.coupCardId).join(','),
proType: 1,
};
this.getCardCost(params);
}
this.couponStatus = this.cardList.some(item => {
return item.status === 0;
......@@ -1086,7 +1091,7 @@ export default {
this.showCardDialog = true;
},
// 子组件触发方法
async selectCard (arr) {
selectCard (arr) {
console.log(arr);
if (arr.length + this.cardList.length > 15) {
this.$message.error(`最多支持添加15张卡券,目前一共选择${arr.length + this.cardList.length}张卡券`);
......@@ -1120,32 +1125,39 @@ export default {
coupCardId: this.cardList.map(item => item.coupCardId).join(','),
proType: 1,
};
const res = await request.post('/api-integral-mall/get-integral-mall-CashCost', qs.stringify(params));
if (res.data.errorCode === 0) {
if (res.data.result.costValue) {
this.costValueArr = [];
const arr = res.data.result.costValue.split(',');
arr.forEach(item => {
this.costValueArr.push(Number(item));
});
const sum = this.costValueArr.reduce(function (prev, cur, index, array) {
return prev + cur;
});
this.costValue = sum;
}
} else {
this.$message.error(res.data.message);
this.getCardCost(params);
}
},
async getCardCost (params) {
const res = await request.post('/api-integral-mall/get-integral-mall-CashCost', qs.stringify(params));
if (res.data.errorCode === 0) {
if (res.data.result.costValue) {
this.costValueArr = [];
const arr = res.data.result.costValue.split(',');
arr.forEach(item => {
this.costValueArr.push(Number(item));
});
const sum = this.costValueArr.reduce(function (prev, cur, index, array) {
return prev + cur;
});
this.costValue = sum;
}
} else {
this.$message.error(res.data.message);
}
},
deleteCard (index) {
this.cardList.splice(index, 1);
this.cardCouponList.splice(index, 1);
this.costValueArr.splice(index, 1);
const sum = this.costValueArr.reduce(function (prev, cur, index, array) {
return prev + cur;
});
this.costValue = sum;
if (this.costValueArr.length) {
const sum = this.costValueArr.reduce(function (prev, cur, index, array) {
return prev + cur;
});
this.costValue = sum;
} else {
this.costValue = 0;
}
if (this.cardList.length > 0) {
this.limitTimesNumArr = [];
this.couponCardStockArr = [];
......@@ -1286,9 +1298,12 @@ export default {
async submitForm (couponForm) {
this.couponForm.detailDescription = this.$refs.tinymceWrap.tinymceHtml;
const proReferIdArr = [];
if (this.cardList.length === 0) {
if (!this.cardList.length) {
this.$message.error('请选择卡券');
return false;
} else if (this.isCopy && this.cardList.filter(item => item.status != 1).length) {
this.$message.error('选择了无效卡券,无法保存');
return false;
} else {
for (const item of this.cardList) {
proReferIdArr.push(item.coupCardId);
......
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