From abd4819ca1033620604fe18843aa4da392448b0c Mon Sep 17 00:00:00 2001 From: neverland <chenjiahan@buaa.edu.cn> Date: Fri, 17 Aug 2018 15:20:08 +0800 Subject: [PATCH] [breaking change] Coupon: use camelcase data (#1643) --- packages/coupon-cell/index.vue | 7 ++++++- packages/coupon-list/Item.vue | 6 +++--- packages/coupon-list/demo/index.vue | 8 ++++---- packages/coupon-list/en-US.md | 13 ++++++------- packages/coupon-list/zh-CN.md | 12 ++++++------ 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/packages/coupon-cell/index.vue b/packages/coupon-cell/index.vue index 58088f50e..96d875357 100644 --- a/packages/coupon-cell/index.vue +++ b/packages/coupon-cell/index.vue @@ -1,6 +1,11 @@ <template> <cell-group :class="b()"> - <cell :title="title || $t('title')" :value="value" :is-link="editable" @click="$emit('click')" /> + <cell + :title="title || $t('title')" + :value="value" + :is-link="editable" + @click="$emit('click')" + /> </cell-group> </template> diff --git a/packages/coupon-list/Item.vue b/packages/coupon-list/Item.vue index c84941e5d..0145a8484 100644 --- a/packages/coupon-list/Item.vue +++ b/packages/coupon-list/Item.vue @@ -34,7 +34,7 @@ export default create({ computed: { validPeriod() { - return `${this.$t('valid')}:${this.getDate(this.data.start_at)} - ${this.getDate(this.data.end_at)}`; + return `${this.$t('valid')}:${this.getDate(this.data.startAt)} - ${this.getDate(this.data.endAt)}`; }, faceAmount() { @@ -46,9 +46,9 @@ export default create({ }, conditionMessage() { - let condition = this.data.origin_condition; + let condition = this.data.originCondition; condition = condition % 100 === 0 ? Math.round(condition / 100) : (condition / 100).toFixed(2); - return this.data.origin_condition === 0 ? this.$t('unlimited') : this.$t('condition', condition); + return this.data.originCondition === 0 ? this.$t('unlimited') : this.$t('condition', condition); } }, diff --git a/packages/coupon-list/demo/index.vue b/packages/coupon-list/demo/index.vue index 591dc84dc..6420de3e5 100644 --- a/packages/coupon-list/demo/index.vue +++ b/packages/coupon-list/demo/index.vue @@ -63,12 +63,12 @@ export default { available: 1, discount: 0, denominations: 150, - origin_condition: 0, + originCondition: 0, reason: '', value: 150, name: this.$t('coupon.name'), - start_at: 1489104000, - end_at: 1514592000 + startAt: 1489104000, + endAt: 1514592000 }; }, @@ -78,7 +78,7 @@ export default { id: 2, discount: 88, denominations: 0, - origin_condition: 50, + originCondition: 50, value: 12 }; }, diff --git a/packages/coupon-list/en-US.md b/packages/coupon-list/en-US.md index 479de4261..3494f9b2b 100644 --- a/packages/coupon-list/en-US.md +++ b/packages/coupon-list/en-US.md @@ -36,12 +36,12 @@ const coupon = { available: 1, discount: 0, denominations: 150, - origin_condition: 0, + originCondition: 0, reason: '', value: 150, name: 'Coupon name', - start_at: 1489104000, - end_at: 1514592000 + startAt: 1489104000, + endAt: 1514592000 }; export default { @@ -106,9 +106,8 @@ export default { | name | Name | `String` | | discount | Discount | `Number` | | denominations | Denominations | `Number` | -| origin_condition | Condition | `Number` | -| start_at | Start time (Timestmap, unit second) | `Number` | -| end_at | End time (Timestmap, unit second) | `Number` | +| originCondition | Condition | `Number` | +| startAt | Start time (Timestmap, unit second) | `Number` | +| endAt | End time (Timestmap, unit second) | `Number` | | reason | Unavailable reason | `String` | | value | Value | `Number` | - diff --git a/packages/coupon-list/zh-CN.md b/packages/coupon-list/zh-CN.md index af6f5f615..8dbf72c19 100644 --- a/packages/coupon-list/zh-CN.md +++ b/packages/coupon-list/zh-CN.md @@ -36,12 +36,12 @@ const coupon = { available: 1, discount: 0, denominations: 150, - origin_condition: 0, + originCondition: 0, reason: '', value: 150, name: '优惠券名称', - start_at: 1489104000, - end_at: 1514592000 + startAt: 1489104000, + endAt: 1514592000 }; export default { @@ -109,8 +109,8 @@ export default { | name | 优惠券名称 | `String` | | discount | 折扣(0为满减券)88=>8.8折 | `Number` | | denominations | 面值(0为折扣券)单位分 | `Number` | -| origin_condition | 满减条件(0为无门槛,满XX元可用)单位分 | `Number` | -| start_at | 卡有效开始时间 (时间戳, 单位秒) | `Number` | -| end_at | 卡失效日期 (时间戳, 单位秒) | `Number` | +| originCondition | 满减条件(0为无门槛,满XX元可用)单位分 | `Number` | +| startAt | 卡有效开始时间 (时间戳, 单位秒) | `Number` | +| endAt | 卡失效日期 (时间戳, 单位秒) | `Number` | | reason | 不可用原因 | `String` | | value | 订单优惠金额,单位分 | `Number` |