mirror of
https://gitee.com/vant-contrib/vant.git
synced 2026-04-30 02:18:15 +08:00
Compare commits
4 Commits
9abae5fbe6
...
086ba1603b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
086ba1603b | ||
|
|
10aea2b620 | ||
|
|
999017d067 | ||
|
|
dd4a637a0d |
@ -16,6 +16,14 @@ Vant follows [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/).
|
||||
|
||||
## Details
|
||||
|
||||
### [v2.12.17](https://github.com/youzan/vant/compare/v2.12.16...v2.12.17)
|
||||
|
||||
`2021-05-08`
|
||||
|
||||
**Feature**
|
||||
|
||||
- CouponList: support custom valid period [#8679](https://github.com/youzan/vant/issues/8679)
|
||||
|
||||
### [v2.12.16](https://github.com/youzan/vant/compare/v2.12.15...v2.12.16)
|
||||
|
||||
`2021-05-03`
|
||||
|
||||
@ -16,6 +16,14 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
|
||||
|
||||
## 更新内容
|
||||
|
||||
### [v2.12.17](https://github.com/youzan/vant/compare/v2.12.16...v2.12.17)
|
||||
|
||||
`2021-05-08`
|
||||
|
||||
**Feature**
|
||||
|
||||
- CouponList: 支持通过 customValidPeriod 字段自定义有效期 [#8679](https://github.com/youzan/vant/issues/8679)
|
||||
|
||||
### [v2.12.16](https://github.com/youzan/vant/compare/v2.12.15...v2.12.16)
|
||||
|
||||
`2021-05-03`
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vant",
|
||||
"version": "2.12.16",
|
||||
"version": "2.12.17",
|
||||
"description": "Mobile UI Components built on Vue",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
||||
@ -75,14 +75,14 @@ export default {
|
||||
|
||||
### CouponCell Props
|
||||
|
||||
| Attribute | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| title | Cell title | _string_ | `Coupon` |
|
||||
| chosen-coupon | Index of chosen coupon | _number \| string_ | `-1` |
|
||||
| coupons | Coupon list | _Coupon[]_ | `[]` |
|
||||
| editable | Cell editable | _boolean_ | `true` |
|
||||
| border | Whether to show innner border | _boolean_ | `true` |
|
||||
| currency | Currency symbol | _string_ | `¥` |
|
||||
| Attribute | Description | Type | Default |
|
||||
| ------------- | ---------------------------- | ------------------ | -------- |
|
||||
| title | Cell title | _string_ | `Coupon` |
|
||||
| chosen-coupon | Index of chosen coupon | _number \| string_ | `-1` |
|
||||
| coupons | Coupon list | _Coupon[]_ | `[]` |
|
||||
| editable | Cell editable | _boolean_ | `true` |
|
||||
| border | Whether to show inner border | _boolean_ | `true` |
|
||||
| currency | Currency symbol | _string_ | `¥` |
|
||||
|
||||
### CouponList Props
|
||||
|
||||
@ -114,18 +114,19 @@ export default {
|
||||
|
||||
### Data Structure of Coupon
|
||||
|
||||
| Key | Description | Type |
|
||||
| ----------- | ----------------------------------- | -------- |
|
||||
| id | Id | _string_ |
|
||||
| name | Name | _string_ |
|
||||
| condition | Condition | _string_ |
|
||||
| startAt | Start time (Timestmap, unit second) | _number_ |
|
||||
| endAt | End time (Timestmap, unit second) | _number_ |
|
||||
| description | Description | _string_ |
|
||||
| reason | Unavailable reason | _string_ |
|
||||
| value | Value | _number_ |
|
||||
| valueDesc | Value Text | _string_ |
|
||||
| unitDesc | Unit Text | _string_ |
|
||||
| Key | Description | Type |
|
||||
| ----------------- | ---------------------------------------- | -------- |
|
||||
| id | Id | _string_ |
|
||||
| name | Name | _string_ |
|
||||
| condition | Condition | _string_ |
|
||||
| startAt | Start time (Timestamp, unit millisecond) | _number_ |
|
||||
| endAt | End time (Timestamp, unit millisecond) | _number_ |
|
||||
| description | Description | _string_ |
|
||||
| reason | Unavailable reason | _string_ |
|
||||
| value | Value | _number_ |
|
||||
| valueDesc | Value Text | _string_ |
|
||||
| unitDesc | Unit Text | _string_ |
|
||||
| customValidPeriod | custom valid period | _string_ |
|
||||
|
||||
### Less Variables
|
||||
|
||||
|
||||
@ -116,18 +116,19 @@ export default {
|
||||
|
||||
### Coupon 数据结构
|
||||
|
||||
| 键名 | 说明 | 类型 |
|
||||
| ----------- | ------------------------------- | -------- |
|
||||
| id | 优惠券 id | _string_ |
|
||||
| name | 优惠券名称 | _string_ |
|
||||
| condition | 满减条件 | _string_ |
|
||||
| startAt | 卡有效开始时间 (时间戳, 单位秒) | _number_ |
|
||||
| endAt | 卡失效日期 (时间戳, 单位秒) | _number_ |
|
||||
| description | 描述信息,优惠券可用时展示 | _string_ |
|
||||
| reason | 不可用原因,优惠券不可用时展示 | _string_ |
|
||||
| value | 折扣券优惠金额,单位分 | _number_ |
|
||||
| valueDesc | 折扣券优惠金额文案 | _string_ |
|
||||
| unitDesc | 单位文案 | _string_ |
|
||||
| 键名 | 说明 | 类型 |
|
||||
| ----------------- | --------------------------------- | -------- |
|
||||
| id | 优惠券 id | _string_ |
|
||||
| name | 优惠券名称 | _string_ |
|
||||
| condition | 满减条件 | _string_ |
|
||||
| startAt | 卡有效开始时间 (时间戳, 单位毫秒) | _number_ |
|
||||
| endAt | 卡失效日期 (时间戳, 单位毫秒) | _number_ |
|
||||
| description | 描述信息,优惠券可用时展示 | _string_ |
|
||||
| reason | 不可用原因,优惠券不可用时展示 | _string_ |
|
||||
| value | 折扣券优惠金额,单位分 | _number_ |
|
||||
| valueDesc | 折扣券优惠金额文案 | _string_ |
|
||||
| unitDesc | 单位文案 | _string_ |
|
||||
| customValidPeriod | 自定义有效时间文案 | _string_ |
|
||||
|
||||
### 样式变量
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
v-model="showList"
|
||||
round
|
||||
position="bottom"
|
||||
style="height: 90%; padding-top: 4px;"
|
||||
style="height: 90%; padding-top: 4px"
|
||||
>
|
||||
<van-coupon-list
|
||||
:coupons="coupons"
|
||||
|
||||
@ -5,8 +5,16 @@ import Checkbox from '../checkbox';
|
||||
|
||||
const [createComponent, bem, t] = createNamespace('coupon');
|
||||
|
||||
function formatTimeStamp(timeStamp) {
|
||||
// compatible when the timestamp is seconds
|
||||
if (timeStamp < 10 ** 12) {
|
||||
return timeStamp * 1000;
|
||||
}
|
||||
return timeStamp;
|
||||
}
|
||||
|
||||
function getDate(timeStamp) {
|
||||
const date = new Date(timeStamp * 1000);
|
||||
const date = new Date(formatTimeStamp(timeStamp));
|
||||
return `${date.getFullYear()}.${padZero(date.getMonth() + 1)}.${padZero(
|
||||
date.getDate()
|
||||
)}`;
|
||||
@ -35,8 +43,8 @@ export default createComponent({
|
||||
|
||||
computed: {
|
||||
validPeriod() {
|
||||
const { startAt, endAt } = this.coupon;
|
||||
return `${getDate(startAt)} - ${getDate(endAt)}`;
|
||||
const { startAt, endAt, customValidPeriod } = this.coupon;
|
||||
return customValidPeriod || `${getDate(startAt)} - ${getDate(endAt)}`;
|
||||
},
|
||||
|
||||
faceAmount() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user