first
This commit is contained in:
1
node_modules/vant/es/coupon-list/index.css
generated
vendored
Normal file
1
node_modules/vant/es/coupon-list/index.css
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
.van-coupon-list{position:relative;height:100%;background-color:#f7f8fa}.van-coupon-list__field{padding:5px 0 5px 16px}.van-coupon-list__field .van-field__body{height:34px;padding-left:12px;line-height:34px;background:#f7f8fa;border-radius:17px}.van-coupon-list__field .van-field__body::-webkit-input-placeholder{color:#c8c9cc}.van-coupon-list__field .van-field__body::placeholder{color:#c8c9cc}.van-coupon-list__field .van-field__clear{margin-right:0}.van-coupon-list__exchange-bar{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;background-color:#fff}.van-coupon-list__exchange{-webkit-box-flex:0;-webkit-flex:none;flex:none;height:32px;font-size:16px;line-height:30px;border:0}.van-coupon-list .van-tabs__wrap{box-shadow:0 6px 12px -12px #969799}.van-coupon-list__list{box-sizing:border-box;padding:16px 0 24px;overflow-y:auto;-webkit-overflow-scrolling:touch}.van-coupon-list__list--with-bottom{padding-bottom:66px}.van-coupon-list__bottom{position:absolute;bottom:0;left:0;z-index:999;box-sizing:border-box;width:100%;padding:5px 16px;font-weight:500;background-color:#fff}.van-coupon-list__close{height:40px}.van-coupon-list__empty{padding-top:60px;text-align:center}.van-coupon-list__empty p{margin:16px 0;color:#969799;font-size:14px;line-height:20px}.van-coupon-list__empty img{width:200px;height:200px}
|
265
node_modules/vant/es/coupon-list/index.js
generated
vendored
Normal file
265
node_modules/vant/es/coupon-list/index.js
generated
vendored
Normal file
@ -0,0 +1,265 @@
|
||||
// Utils
|
||||
import { createNamespace } from '../utils'; // Components
|
||||
|
||||
import Tab from '../tab';
|
||||
import Tabs from '../tabs';
|
||||
import Field from '../field';
|
||||
import Button from '../button';
|
||||
import Coupon from '../coupon';
|
||||
|
||||
var _createNamespace = createNamespace('coupon-list'),
|
||||
createComponent = _createNamespace[0],
|
||||
bem = _createNamespace[1],
|
||||
t = _createNamespace[2];
|
||||
|
||||
var EMPTY_IMAGE = 'https://img01.yzcdn.cn/vant/coupon-empty.png';
|
||||
export default createComponent({
|
||||
model: {
|
||||
prop: 'code'
|
||||
},
|
||||
props: {
|
||||
code: String,
|
||||
closeButtonText: String,
|
||||
inputPlaceholder: String,
|
||||
enabledTitle: String,
|
||||
disabledTitle: String,
|
||||
exchangeButtonText: String,
|
||||
exchangeButtonLoading: Boolean,
|
||||
exchangeButtonDisabled: Boolean,
|
||||
exchangeMinLength: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
chosenCoupon: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
coupons: {
|
||||
type: Array,
|
||||
default: function _default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
disabledCoupons: {
|
||||
type: Array,
|
||||
default: function _default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
displayedCouponIndex: {
|
||||
type: Number,
|
||||
default: -1
|
||||
},
|
||||
showExchangeBar: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showCloseButton: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showCount: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
currency: {
|
||||
type: String,
|
||||
default: '¥'
|
||||
},
|
||||
emptyImage: {
|
||||
type: String,
|
||||
default: EMPTY_IMAGE
|
||||
}
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
tab: 0,
|
||||
winHeight: window.innerHeight,
|
||||
currentCode: this.code || ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
buttonDisabled: function buttonDisabled() {
|
||||
return !this.exchangeButtonLoading && (this.exchangeButtonDisabled || !this.currentCode || this.currentCode.length < this.exchangeMinLength);
|
||||
},
|
||||
listStyle: function listStyle() {
|
||||
return {
|
||||
height: this.winHeight - (this.showExchangeBar ? 140 : 94) + 'px'
|
||||
};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
code: function code(_code) {
|
||||
this.currentCode = _code;
|
||||
},
|
||||
currentCode: function currentCode(code) {
|
||||
this.$emit('input', code);
|
||||
},
|
||||
displayedCouponIndex: 'scrollToShowCoupon'
|
||||
},
|
||||
mounted: function mounted() {
|
||||
this.scrollToShowCoupon(this.displayedCouponIndex);
|
||||
},
|
||||
methods: {
|
||||
onClickExchangeButton: function onClickExchangeButton() {
|
||||
this.$emit('exchange', this.currentCode); // auto clear currentCode when not use vModel
|
||||
|
||||
if (!this.code) {
|
||||
this.currentCode = '';
|
||||
}
|
||||
},
|
||||
// scroll to show specific coupon
|
||||
scrollToShowCoupon: function scrollToShowCoupon(index) {
|
||||
var _this = this;
|
||||
|
||||
if (index === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.$nextTick(function () {
|
||||
var _this$$refs = _this.$refs,
|
||||
card = _this$$refs.card,
|
||||
list = _this$$refs.list;
|
||||
/* istanbul ignore next */
|
||||
|
||||
if (list && card && card[index]) {
|
||||
list.scrollTop = card[index].$el.offsetTop - 100;
|
||||
}
|
||||
});
|
||||
},
|
||||
genEmpty: function genEmpty() {
|
||||
var h = this.$createElement;
|
||||
return h("div", {
|
||||
"class": bem('empty')
|
||||
}, [h("img", {
|
||||
"attrs": {
|
||||
"src": this.emptyImage
|
||||
}
|
||||
}), h("p", [t('empty')])]);
|
||||
},
|
||||
genExchangeButton: function genExchangeButton() {
|
||||
var h = this.$createElement;
|
||||
return h(Button, {
|
||||
"attrs": {
|
||||
"plain": true,
|
||||
"type": "danger",
|
||||
"text": this.exchangeButtonText || t('exchange'),
|
||||
"loading": this.exchangeButtonLoading,
|
||||
"disabled": this.buttonDisabled
|
||||
},
|
||||
"class": bem('exchange'),
|
||||
"on": {
|
||||
"click": this.onClickExchangeButton
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
render: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
var h = arguments[0];
|
||||
var coupons = this.coupons,
|
||||
disabledCoupons = this.disabledCoupons;
|
||||
var count = this.showCount ? " (" + coupons.length + ")" : '';
|
||||
var title = (this.enabledTitle || t('enable')) + count;
|
||||
var disabledCount = this.showCount ? " (" + disabledCoupons.length + ")" : '';
|
||||
var disabledTitle = (this.disabledTitle || t('disabled')) + disabledCount;
|
||||
var ExchangeBar = this.showExchangeBar && h("div", {
|
||||
"class": bem('exchange-bar')
|
||||
}, [h(Field, {
|
||||
"attrs": {
|
||||
"clearable": true,
|
||||
"border": false,
|
||||
"placeholder": this.inputPlaceholder || t('placeholder'),
|
||||
"maxlength": "20"
|
||||
},
|
||||
"class": bem('field'),
|
||||
"model": {
|
||||
value: _this2.currentCode,
|
||||
callback: function callback($$v) {
|
||||
_this2.currentCode = $$v;
|
||||
}
|
||||
}
|
||||
}), this.genExchangeButton()]);
|
||||
|
||||
var onChange = function onChange(index) {
|
||||
return function () {
|
||||
return _this2.$emit('change', index);
|
||||
};
|
||||
};
|
||||
|
||||
var CouponTab = h(Tab, {
|
||||
"attrs": {
|
||||
"title": title
|
||||
}
|
||||
}, [h("div", {
|
||||
"class": bem('list', {
|
||||
'with-bottom': this.showCloseButton
|
||||
}),
|
||||
"style": this.listStyle
|
||||
}, [coupons.map(function (coupon, index) {
|
||||
return h(Coupon, {
|
||||
"ref": "card",
|
||||
"key": coupon.id,
|
||||
"attrs": {
|
||||
"coupon": coupon,
|
||||
"currency": _this2.currency,
|
||||
"chosen": index === _this2.chosenCoupon
|
||||
},
|
||||
"nativeOn": {
|
||||
"click": onChange(index)
|
||||
}
|
||||
});
|
||||
}), !coupons.length && this.genEmpty(), this.slots('list-footer')])]);
|
||||
var DisabledCouponTab = h(Tab, {
|
||||
"attrs": {
|
||||
"title": disabledTitle
|
||||
}
|
||||
}, [h("div", {
|
||||
"class": bem('list', {
|
||||
'with-bottom': this.showCloseButton
|
||||
}),
|
||||
"style": this.listStyle
|
||||
}, [disabledCoupons.map(function (coupon) {
|
||||
return h(Coupon, {
|
||||
"attrs": {
|
||||
"disabled": true,
|
||||
"coupon": coupon,
|
||||
"currency": _this2.currency
|
||||
},
|
||||
"key": coupon.id
|
||||
});
|
||||
}), !disabledCoupons.length && this.genEmpty(), this.slots('disabled-list-footer')])]);
|
||||
return h("div", {
|
||||
"class": bem()
|
||||
}, [ExchangeBar, h(Tabs, {
|
||||
"class": bem('tab'),
|
||||
"attrs": {
|
||||
"border": false
|
||||
},
|
||||
"model": {
|
||||
value: _this2.tab,
|
||||
callback: function callback($$v) {
|
||||
_this2.tab = $$v;
|
||||
}
|
||||
}
|
||||
}, [CouponTab, DisabledCouponTab]), h("div", {
|
||||
"class": bem('bottom')
|
||||
}, [h(Button, {
|
||||
"directives": [{
|
||||
name: "show",
|
||||
value: this.showCloseButton
|
||||
}],
|
||||
"attrs": {
|
||||
"round": true,
|
||||
"type": "danger",
|
||||
"block": true,
|
||||
"text": this.closeButtonText || t('close')
|
||||
},
|
||||
"class": bem('close'),
|
||||
"on": {
|
||||
"click": onChange(-1)
|
||||
}
|
||||
})])]);
|
||||
}
|
||||
});
|
89
node_modules/vant/es/coupon-list/index.less
generated
vendored
Normal file
89
node_modules/vant/es/coupon-list/index.less
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
@import '../style/var';
|
||||
|
||||
.van-coupon-list {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
background-color: @coupon-list-background-color;
|
||||
|
||||
&__field {
|
||||
padding: @coupon-list-field-padding;
|
||||
|
||||
.van-field__body {
|
||||
height: 34px;
|
||||
padding-left: @padding-sm;
|
||||
line-height: 34px;
|
||||
background: @gray-1;
|
||||
border-radius: 17px;
|
||||
|
||||
&::placeholder {
|
||||
color: @gray-5;
|
||||
}
|
||||
}
|
||||
|
||||
.van-field__clear {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__exchange-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: @white;
|
||||
}
|
||||
|
||||
&__exchange {
|
||||
flex: none;
|
||||
height: @coupon-list-exchange-button-height;
|
||||
font-size: @font-size-lg;
|
||||
line-height: @coupon-list-exchange-button-height - 2px;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.van-tabs__wrap {
|
||||
box-shadow: 0 6px 12px -12px @gray-6;
|
||||
}
|
||||
|
||||
&__list {
|
||||
box-sizing: border-box;
|
||||
padding: @padding-md 0 @padding-lg;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
||||
&--with-bottom {
|
||||
padding-bottom: @padding-md + 50px;
|
||||
}
|
||||
}
|
||||
|
||||
&__bottom {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 999;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 5px @padding-md;
|
||||
font-weight: @font-weight-bold;
|
||||
background-color: @white;
|
||||
}
|
||||
|
||||
&__close {
|
||||
height: @coupon-list-close-button-height;
|
||||
}
|
||||
|
||||
&__empty {
|
||||
padding-top: 60px;
|
||||
text-align: center;
|
||||
|
||||
p {
|
||||
margin: @padding-md 0;
|
||||
color: @coupon-list-empty-tip-color;
|
||||
font-size: @coupon-list-empty-tip-font-size;
|
||||
line-height: @coupon-list-empty-tip-line-height;
|
||||
}
|
||||
|
||||
img {
|
||||
width: @coupon-list-empty-image-size;
|
||||
height: @coupon-list-empty-image-size;
|
||||
}
|
||||
}
|
||||
}
|
13
node_modules/vant/es/coupon-list/style/index.js
generated
vendored
Normal file
13
node_modules/vant/es/coupon-list/style/index.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import '../../style/base.css';
|
||||
import '../../info/index.css';
|
||||
import '../../icon/index.css';
|
||||
import '../../checkbox/index.css';
|
||||
import '../../coupon/index.css';
|
||||
import '../../cell/index.css';
|
||||
import '../../field/index.css';
|
||||
import '../../loading/index.css';
|
||||
import '../../button/index.css';
|
||||
import '../../tab/index.css';
|
||||
import '../../sticky/index.css';
|
||||
import '../../tabs/index.css';
|
||||
import '../index.css';
|
13
node_modules/vant/es/coupon-list/style/less.js
generated
vendored
Normal file
13
node_modules/vant/es/coupon-list/style/less.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import '../../style/base.less';
|
||||
import '../../info/index.less';
|
||||
import '../../icon/index.less';
|
||||
import '../../checkbox/index.less';
|
||||
import '../../coupon/index.less';
|
||||
import '../../cell/index.less';
|
||||
import '../../field/index.less';
|
||||
import '../../loading/index.less';
|
||||
import '../../button/index.less';
|
||||
import '../../tab/index.less';
|
||||
import '../../sticky/index.less';
|
||||
import '../../tabs/index.less';
|
||||
import '../index.less';
|
Reference in New Issue
Block a user