mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[Doc] Coupon: fix exchange coupons (#486)
This commit is contained in:
parent
6b563b2e5a
commit
6d003c88a1
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user