mirror of
https://github.com/youzan/vant.git
synced 2025-10-18 17:51:54 +00:00
[Doc] Coupon: fix exchange coupons (#486)
This commit is contained in:
@@ -43,13 +43,14 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showList: false,
|
showList: false,
|
||||||
chosenCoupon: -1
|
chosenCoupon: -1,
|
||||||
|
exchangedCoupons: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
coupons() {
|
coupons() {
|
||||||
return [this.coupon, this.discountCoupon];
|
return [this.coupon, this.discountCoupon, ...this.exchangedCoupons];
|
||||||
},
|
},
|
||||||
|
|
||||||
disabledCoupons() {
|
disabledCoupons() {
|
||||||
@@ -108,7 +109,13 @@ export default {
|
|||||||
},
|
},
|
||||||
onExchange(code) {
|
onExchange(code) {
|
||||||
Toast(this.$t('exchange'));
|
Toast(this.$t('exchange'));
|
||||||
this.coupons.push(coupon);
|
this.exchangedCoupons.push({
|
||||||
|
...this.coupon,
|
||||||
|
id: this.randomId()
|
||||||
|
});
|
||||||
|
},
|
||||||
|
randomId(max = 999999) {
|
||||||
|
return Math.floor(Math.random() * max) + 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user