[new feature] Coupon: add currency prop (#2274)

This commit is contained in:
neverland
2018-12-12 16:59:09 +08:00
committed by GitHub
parent a4a2ce9635
commit 267e5eda1d
6 changed files with 20 additions and 4 deletions
+5 -1
View File
@@ -22,6 +22,10 @@ export default create({
props: {
title: String,
coupons: Array,
currency: {
type: String,
default: '¥'
},
border: {
type: Boolean,
default: true
@@ -42,7 +46,7 @@ export default create({
const coupon = coupons[this.chosenCoupon];
if (coupon) {
const value = coupon.denominations || coupon.value;
return `-¥${(value / 100).toFixed(2)}`;
return `-${this.currency}${(value / 100).toFixed(2)}`;
}
return coupons.length === 0 ? this.$t('tips') : this.$t('count', coupons.length);
}