first
This commit is contained in:
1
node_modules/vant/es/coupon/index.css
generated
vendored
Normal file
1
node_modules/vant/es/coupon/index.css
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
.van-coupon{margin:0 12px 12px;overflow:hidden;background-color:#fff;border-radius:8px;box-shadow:0 0 4px rgba(0,0,0,.1)}.van-coupon:active{background-color:#f2f3f5}.van-coupon__content{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;box-sizing:border-box;min-height:84px;padding:14px 0;color:#323233}.van-coupon__head{position:relative;min-width:96px;padding:0 8px;color:#ee0a24;text-align:center}.van-coupon__amount,.van-coupon__condition,.van-coupon__name,.van-coupon__valid{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-coupon__amount{margin-bottom:6px;font-weight:500;font-size:30px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-coupon__amount span{font-weight:400;font-size:40%}.van-coupon__amount span:not(:empty){margin-left:2px}.van-coupon__condition{font-size:12px;line-height:16px;white-space:pre-wrap}.van-coupon__body{position:relative;-webkit-box-flex:1;-webkit-flex:1;flex:1;border-radius:0 8px 8px 0}.van-coupon__name{margin-bottom:10px;font-weight:700;font-size:14px;line-height:20px}.van-coupon__valid{font-size:12px}.van-coupon__corner{position:absolute;top:0;right:16px;bottom:0}.van-coupon__description{padding:8px 16px;font-size:12px;border-top:1px dashed #ebedf0}.van-coupon--disabled:active{background-color:#fff}.van-coupon--disabled .van-coupon-item__content{height:74px}.van-coupon--disabled .van-coupon__head{color:inherit}
|
111
node_modules/vant/es/coupon/index.js
generated
vendored
Normal file
111
node_modules/vant/es/coupon/index.js
generated
vendored
Normal file
@ -0,0 +1,111 @@
|
||||
import { createNamespace } from '../utils';
|
||||
import { RED } from '../utils/constant';
|
||||
import { padZero } from '../utils/format/string';
|
||||
import Checkbox from '../checkbox';
|
||||
|
||||
var _createNamespace = createNamespace('coupon'),
|
||||
createComponent = _createNamespace[0],
|
||||
bem = _createNamespace[1],
|
||||
t = _createNamespace[2];
|
||||
|
||||
function formatTimeStamp(timeStamp) {
|
||||
// compatible when the timestamp is seconds
|
||||
if (timeStamp < Math.pow(10, 12)) {
|
||||
return timeStamp * 1000;
|
||||
}
|
||||
|
||||
return +timeStamp;
|
||||
}
|
||||
|
||||
function getDate(timeStamp) {
|
||||
var date = new Date(formatTimeStamp(timeStamp));
|
||||
return date.getFullYear() + "." + padZero(date.getMonth() + 1) + "." + padZero(date.getDate());
|
||||
}
|
||||
|
||||
function formatDiscount(discount) {
|
||||
return (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);
|
||||
}
|
||||
|
||||
function formatAmount(amount) {
|
||||
return (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);
|
||||
}
|
||||
|
||||
export default createComponent({
|
||||
props: {
|
||||
coupon: Object,
|
||||
chosen: Boolean,
|
||||
disabled: Boolean,
|
||||
currency: {
|
||||
type: String,
|
||||
default: '¥'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
validPeriod: function validPeriod() {
|
||||
var _this$coupon = this.coupon,
|
||||
startAt = _this$coupon.startAt,
|
||||
endAt = _this$coupon.endAt,
|
||||
customValidPeriod = _this$coupon.customValidPeriod;
|
||||
return customValidPeriod || getDate(startAt) + " - " + getDate(endAt);
|
||||
},
|
||||
faceAmount: function faceAmount() {
|
||||
var coupon = this.coupon;
|
||||
|
||||
if (coupon.valueDesc) {
|
||||
return coupon.valueDesc + "<span>" + (coupon.unitDesc || '') + "</span>";
|
||||
}
|
||||
|
||||
if (coupon.denominations) {
|
||||
var denominations = formatAmount(coupon.denominations);
|
||||
return "<span>" + this.currency + "</span> " + denominations;
|
||||
}
|
||||
|
||||
if (coupon.discount) {
|
||||
return t('discount', formatDiscount(coupon.discount));
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
conditionMessage: function conditionMessage() {
|
||||
var condition = formatAmount(this.coupon.originCondition);
|
||||
return condition === '0' ? t('unlimited') : t('condition', condition);
|
||||
}
|
||||
},
|
||||
render: function render() {
|
||||
var h = arguments[0];
|
||||
var coupon = this.coupon,
|
||||
disabled = this.disabled;
|
||||
var description = disabled && coupon.reason || coupon.description;
|
||||
return h("div", {
|
||||
"class": bem({
|
||||
disabled: disabled
|
||||
})
|
||||
}, [h("div", {
|
||||
"class": bem('content')
|
||||
}, [h("div", {
|
||||
"class": bem('head')
|
||||
}, [h("h2", {
|
||||
"class": bem('amount'),
|
||||
"domProps": {
|
||||
"innerHTML": this.faceAmount
|
||||
}
|
||||
}), h("p", {
|
||||
"class": bem('condition')
|
||||
}, [this.coupon.condition || this.conditionMessage])]), h("div", {
|
||||
"class": bem('body')
|
||||
}, [h("p", {
|
||||
"class": bem('name')
|
||||
}, [coupon.name]), h("p", {
|
||||
"class": bem('valid')
|
||||
}, [this.validPeriod]), !this.disabled && h(Checkbox, {
|
||||
"attrs": {
|
||||
"size": 18,
|
||||
"value": this.chosen,
|
||||
"checkedColor": RED
|
||||
},
|
||||
"class": bem('corner')
|
||||
})])]), description && h("p", {
|
||||
"class": bem('description')
|
||||
}, [description])]);
|
||||
}
|
||||
});
|
104
node_modules/vant/es/coupon/index.less
generated
vendored
Normal file
104
node_modules/vant/es/coupon/index.less
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
@import '../style/var';
|
||||
@import '../style/mixins/ellipsis';
|
||||
|
||||
.van-coupon {
|
||||
margin: @coupon-margin;
|
||||
overflow: hidden;
|
||||
background-color: @coupon-background-color;
|
||||
border-radius: @coupon-border-radius;
|
||||
box-shadow: @coupon-box-shadow;
|
||||
|
||||
&:active {
|
||||
background-color: @coupon-active-background-color;
|
||||
}
|
||||
|
||||
&__content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
min-height: @coupon-content-height;
|
||||
padding: @coupon-content-padding;
|
||||
color: @gray-8;
|
||||
}
|
||||
|
||||
&__head {
|
||||
position: relative;
|
||||
min-width: @coupon-head-width;
|
||||
padding: 0 @padding-xs;
|
||||
color: @coupon-amount-color;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&__amount,
|
||||
&__condition,
|
||||
&__name,
|
||||
&__valid {
|
||||
.ellipsis();
|
||||
}
|
||||
|
||||
&__amount {
|
||||
margin-bottom: 6px;
|
||||
font-weight: @font-weight-bold;
|
||||
font-size: @coupon-amount-font-size;
|
||||
.ellipsis();
|
||||
|
||||
span {
|
||||
font-weight: normal;
|
||||
font-size: @coupon-currency-font-size;
|
||||
|
||||
&:not(:empty) {
|
||||
margin-left: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__condition {
|
||||
font-size: @font-size-sm;
|
||||
line-height: 16px;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
&__body {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
border-radius: 0 @coupon-border-radius @coupon-border-radius 0;
|
||||
}
|
||||
|
||||
&__name {
|
||||
margin-bottom: 10px;
|
||||
font-weight: bold;
|
||||
font-size: @coupon-name-font-size;
|
||||
line-height: @line-height-md;
|
||||
}
|
||||
|
||||
&__valid {
|
||||
font-size: @font-size-sm;
|
||||
}
|
||||
|
||||
&__corner {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: @padding-md;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
&__description {
|
||||
padding: @coupon-description-padding;
|
||||
font-size: @font-size-sm;
|
||||
border-top: 1px dashed @coupon-description-border-color;
|
||||
}
|
||||
|
||||
&--disabled {
|
||||
&:active {
|
||||
background-color: @coupon-background-color;
|
||||
}
|
||||
|
||||
.van-coupon-item__content {
|
||||
height: @coupon-content-height - 10px;
|
||||
}
|
||||
|
||||
.van-coupon__head {
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
}
|
0
node_modules/vant/es/coupon/shared.js
generated
vendored
Normal file
0
node_modules/vant/es/coupon/shared.js
generated
vendored
Normal file
5
node_modules/vant/es/coupon/style/index.js
generated
vendored
Normal file
5
node_modules/vant/es/coupon/style/index.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import '../../style/base.css';
|
||||
import '../../info/index.css';
|
||||
import '../../icon/index.css';
|
||||
import '../../checkbox/index.css';
|
||||
import '../index.css';
|
5
node_modules/vant/es/coupon/style/less.js
generated
vendored
Normal file
5
node_modules/vant/es/coupon/style/less.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import '../../style/base.less';
|
||||
import '../../info/index.less';
|
||||
import '../../icon/index.less';
|
||||
import '../../checkbox/index.less';
|
||||
import '../index.less';
|
Reference in New Issue
Block a user