first commit
This commit is contained in:
45
node_modules/vant/es/coupon/Coupon.d.ts
generated
vendored
Normal file
45
node_modules/vant/es/coupon/Coupon.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import { type PropType } from 'vue';
|
||||
import { type Numeric } from '../utils';
|
||||
export type CouponInfo = {
|
||||
id: Numeric;
|
||||
name: string;
|
||||
endAt: number;
|
||||
value: number;
|
||||
startAt: number;
|
||||
reason?: string;
|
||||
discount?: number;
|
||||
unitDesc?: string;
|
||||
condition?: string;
|
||||
valueDesc?: string;
|
||||
description: string;
|
||||
denominations?: number;
|
||||
originCondition?: number;
|
||||
};
|
||||
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
||||
chosen: BooleanConstructor;
|
||||
coupon: {
|
||||
type: PropType<CouponInfo>;
|
||||
required: true;
|
||||
};
|
||||
disabled: BooleanConstructor;
|
||||
currency: {
|
||||
type: PropType<string>;
|
||||
default: string;
|
||||
};
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
chosen: BooleanConstructor;
|
||||
coupon: {
|
||||
type: PropType<CouponInfo>;
|
||||
required: true;
|
||||
};
|
||||
disabled: BooleanConstructor;
|
||||
currency: {
|
||||
type: PropType<string>;
|
||||
default: string;
|
||||
};
|
||||
}>> & Readonly<{}>, {
|
||||
disabled: boolean;
|
||||
currency: string;
|
||||
chosen: boolean;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
||||
export default _default;
|
||||
79
node_modules/vant/es/coupon/Coupon.mjs
generated
vendored
Normal file
79
node_modules/vant/es/coupon/Coupon.mjs
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
import { computed, defineComponent, createVNode as _createVNode } from "vue";
|
||||
import { makeStringProp, createNamespace, makeRequiredProp } from "../utils/index.mjs";
|
||||
import { getDate, formatAmount, formatDiscount } from "./utils.mjs";
|
||||
import { Checkbox } from "../checkbox/index.mjs";
|
||||
const [name, bem, t] = createNamespace("coupon");
|
||||
var stdin_default = defineComponent({
|
||||
name,
|
||||
props: {
|
||||
chosen: Boolean,
|
||||
coupon: makeRequiredProp(Object),
|
||||
disabled: Boolean,
|
||||
currency: makeStringProp("\xA5")
|
||||
},
|
||||
setup(props) {
|
||||
const validPeriod = computed(() => {
|
||||
const {
|
||||
startAt,
|
||||
endAt
|
||||
} = props.coupon;
|
||||
return `${getDate(startAt)} - ${getDate(endAt)}`;
|
||||
});
|
||||
const faceAmount = computed(() => {
|
||||
const {
|
||||
coupon,
|
||||
currency
|
||||
} = props;
|
||||
if (coupon.valueDesc) {
|
||||
return [coupon.valueDesc, _createVNode("span", null, [coupon.unitDesc || ""])];
|
||||
}
|
||||
if (coupon.denominations) {
|
||||
const denominations = formatAmount(coupon.denominations);
|
||||
return [_createVNode("span", null, [currency]), ` ${denominations}`];
|
||||
}
|
||||
if (coupon.discount) {
|
||||
return t("discount", formatDiscount(coupon.discount));
|
||||
}
|
||||
return "";
|
||||
});
|
||||
const conditionMessage = computed(() => {
|
||||
const condition = formatAmount(props.coupon.originCondition || 0);
|
||||
return condition === "0" ? t("unlimited") : t("condition", condition);
|
||||
});
|
||||
return () => {
|
||||
const {
|
||||
chosen,
|
||||
coupon,
|
||||
disabled
|
||||
} = props;
|
||||
const description = disabled && coupon.reason || coupon.description;
|
||||
return _createVNode("div", {
|
||||
"class": bem({
|
||||
disabled
|
||||
})
|
||||
}, [_createVNode("div", {
|
||||
"class": bem("content")
|
||||
}, [_createVNode("div", {
|
||||
"class": bem("head")
|
||||
}, [_createVNode("h2", {
|
||||
"class": bem("amount")
|
||||
}, [faceAmount.value]), _createVNode("p", {
|
||||
"class": bem("condition")
|
||||
}, [coupon.condition || conditionMessage.value])]), _createVNode("div", {
|
||||
"class": bem("body")
|
||||
}, [_createVNode("p", {
|
||||
"class": bem("name")
|
||||
}, [coupon.name]), _createVNode("p", {
|
||||
"class": bem("valid")
|
||||
}, [validPeriod.value]), !disabled && _createVNode(Checkbox, {
|
||||
"class": bem("corner"),
|
||||
"modelValue": chosen
|
||||
}, null)])]), description && _createVNode("p", {
|
||||
"class": bem("description")
|
||||
}, [description])]);
|
||||
};
|
||||
}
|
||||
});
|
||||
export {
|
||||
stdin_default as default
|
||||
};
|
||||
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 @@
|
||||
:root,:host{--van-coupon-margin: 0 var(--van-padding-sm) var(--van-padding-sm);--van-coupon-content-height: 84px;--van-coupon-content-padding: 14px 0;--van-coupon-content-text-color: var(--van-text-color);--van-coupon-background: var(--van-background-2);--van-coupon-active-background: var(--van-active-color);--van-coupon-radius: var(--van-radius-lg);--van-coupon-shadow: 0 0 4px rgba(0, 0, 0, .1);--van-coupon-head-width: 96px;--van-coupon-amount-color: var(--van-primary-color);--van-coupon-amount-font-size: 30px;--van-coupon-currency-font-size: 40%;--van-coupon-name-font-size: var(--van-font-size-md);--van-coupon-disabled-text-color: var(--van-text-color-2);--van-coupon-description-padding: var(--van-padding-xs) var(--van-padding-md);--van-coupon-description-border-color: var(--van-border-color);--van-coupon-checkbox-color: var(--van-primary-color)}.van-coupon{margin:var(--van-coupon-margin);overflow:hidden;background:var(--van-coupon-background);border-radius:var(--van-coupon-radius);box-shadow:var(--van-coupon-shadow)}.van-coupon:active{background-color:var(--van-coupon-active-background)}.van-coupon__content{display:flex;align-items:center;box-sizing:border-box;min-height:var(--van-coupon-content-height);padding:var(--van-coupon-content-padding);color:var(--van-coupon-content-text-color)}.van-coupon__head{position:relative;min-width:var(--van-coupon-head-width);padding:0 var(--van-padding-xs);color:var(--van-coupon-amount-color);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:var(--van-font-bold);font-size:var(--van-coupon-amount-font-size);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-coupon__amount span{font-size:var(--van-coupon-currency-font-size)}.van-coupon__amount span:not(:empty){margin-left:2px}.van-coupon__condition{font-size:var(--van-font-size-sm);line-height:16px;white-space:pre-wrap}.van-coupon__body{position:relative;flex:1}.van-coupon__name{margin-bottom:10px;font-weight:var(--van-font-bold);font-size:var(--van-coupon-name-font-size);line-height:var(--van-line-height-md)}.van-coupon__valid{font-size:var(--van-font-size-sm)}.van-coupon__corner{position:absolute;top:0;right:var(--van-padding-md);bottom:0}.van-coupon__corner .van-checkbox__icon--checked .van-icon{background-color:var(--van-coupon-checkbox-color);border-color:var(--van-coupon-checkbox-color)}.van-coupon__description{padding:var(--van-coupon-description-padding);font-size:var(--van-font-size-sm);border-top:1px dashed var(--van-coupon-description-border-color)}.van-coupon--disabled:active{background-color:var(--van-coupon-background)}.van-coupon--disabled .van-coupon-item__content{height:calc(var(--van-coupon-content-height) - 10px)}.van-coupon--disabled .van-coupon__head{color:inherit}
|
||||
35
node_modules/vant/es/coupon/index.d.ts
generated
vendored
Normal file
35
node_modules/vant/es/coupon/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
export declare const Coupon: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
||||
chosen: BooleanConstructor;
|
||||
coupon: {
|
||||
type: import("vue").PropType<import("./Coupon").CouponInfo>;
|
||||
required: true;
|
||||
};
|
||||
disabled: BooleanConstructor;
|
||||
currency: {
|
||||
type: import("vue").PropType<string>;
|
||||
default: string;
|
||||
};
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
chosen: BooleanConstructor;
|
||||
coupon: {
|
||||
type: import("vue").PropType<import("./Coupon").CouponInfo>;
|
||||
required: true;
|
||||
};
|
||||
disabled: BooleanConstructor;
|
||||
currency: {
|
||||
type: import("vue").PropType<string>;
|
||||
default: string;
|
||||
};
|
||||
}>> & Readonly<{}>, {
|
||||
disabled: boolean;
|
||||
currency: string;
|
||||
chosen: boolean;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
||||
export default Coupon;
|
||||
export type { CouponInfo } from './Coupon';
|
||||
export type { CouponThemeVars } from './types';
|
||||
declare module 'vue' {
|
||||
interface GlobalComponents {
|
||||
VanCoupon: typeof Coupon;
|
||||
}
|
||||
}
|
||||
8
node_modules/vant/es/coupon/index.mjs
generated
vendored
Normal file
8
node_modules/vant/es/coupon/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { withInstall } from "../utils/index.mjs";
|
||||
import _Coupon from "./Coupon.mjs";
|
||||
const Coupon = withInstall(_Coupon);
|
||||
var stdin_default = Coupon;
|
||||
export {
|
||||
Coupon,
|
||||
stdin_default as default
|
||||
};
|
||||
1
node_modules/vant/es/coupon/style/index.d.ts
generated
vendored
Normal file
1
node_modules/vant/es/coupon/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
6
node_modules/vant/es/coupon/style/index.mjs
generated
vendored
Normal file
6
node_modules/vant/es/coupon/style/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import "../../style/base.css";
|
||||
import "../../badge/index.css";
|
||||
import "../../icon/index.css";
|
||||
import "../../checkbox-group/index.css";
|
||||
import "../../checkbox/index.css";
|
||||
import "../index.css";
|
||||
19
node_modules/vant/es/coupon/types.d.ts
generated
vendored
Normal file
19
node_modules/vant/es/coupon/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export type CouponThemeVars = {
|
||||
couponMargin?: string;
|
||||
couponContentHeight?: string;
|
||||
couponContentPadding?: string;
|
||||
couponContentTextColor?: string;
|
||||
couponBackground?: string;
|
||||
couponActiveBackground?: string;
|
||||
couponRadius?: string;
|
||||
couponShadow?: string;
|
||||
couponHeadWidth?: string;
|
||||
couponAmountColor?: string;
|
||||
couponAmountFontSize?: string;
|
||||
couponCurrencyFontSize?: string;
|
||||
couponNameFontSize?: string;
|
||||
couponDisabledTextColor?: string;
|
||||
couponDescriptionPadding?: string;
|
||||
couponDescriptionBorderColor?: string;
|
||||
couponCheckboxColor?: string;
|
||||
};
|
||||
0
node_modules/vant/es/coupon/types.mjs
generated
vendored
Normal file
0
node_modules/vant/es/coupon/types.mjs
generated
vendored
Normal file
3
node_modules/vant/es/coupon/utils.d.ts
generated
vendored
Normal file
3
node_modules/vant/es/coupon/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export declare function getDate(timeStamp: number): string;
|
||||
export declare const formatDiscount: (discount: number) => string;
|
||||
export declare const formatAmount: (amount: number) => string;
|
||||
14
node_modules/vant/es/coupon/utils.mjs
generated
vendored
Normal file
14
node_modules/vant/es/coupon/utils.mjs
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { padZero } from "../utils/index.mjs";
|
||||
function getDate(timeStamp) {
|
||||
const date = new Date(timeStamp * 1e3);
|
||||
return `${date.getFullYear()}.${padZero(date.getMonth() + 1)}.${padZero(
|
||||
date.getDate()
|
||||
)}`;
|
||||
}
|
||||
const formatDiscount = (discount) => (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);
|
||||
const formatAmount = (amount) => (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);
|
||||
export {
|
||||
formatAmount,
|
||||
formatDiscount,
|
||||
getDate
|
||||
};
|
||||
Reference in New Issue
Block a user