first commit
This commit is contained in:
45
node_modules/vant/lib/coupon/Coupon.d.ts
generated
vendored
Normal file
45
node_modules/vant/lib/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;
|
||||
98
node_modules/vant/lib/coupon/Coupon.js
generated
vendored
Normal file
98
node_modules/vant/lib/coupon/Coupon.js
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name2 in all)
|
||||
__defProp(target, name2, { get: all[name2], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
default: () => stdin_default
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_vue = require("vue");
|
||||
var import_utils = require("../utils");
|
||||
var import_utils2 = require("./utils");
|
||||
var import_checkbox = require("../checkbox");
|
||||
const [name, bem, t] = (0, import_utils.createNamespace)("coupon");
|
||||
var stdin_default = (0, import_vue.defineComponent)({
|
||||
name,
|
||||
props: {
|
||||
chosen: Boolean,
|
||||
coupon: (0, import_utils.makeRequiredProp)(Object),
|
||||
disabled: Boolean,
|
||||
currency: (0, import_utils.makeStringProp)("\xA5")
|
||||
},
|
||||
setup(props) {
|
||||
const validPeriod = (0, import_vue.computed)(() => {
|
||||
const {
|
||||
startAt,
|
||||
endAt
|
||||
} = props.coupon;
|
||||
return `${(0, import_utils2.getDate)(startAt)} - ${(0, import_utils2.getDate)(endAt)}`;
|
||||
});
|
||||
const faceAmount = (0, import_vue.computed)(() => {
|
||||
const {
|
||||
coupon,
|
||||
currency
|
||||
} = props;
|
||||
if (coupon.valueDesc) {
|
||||
return [coupon.valueDesc, (0, import_vue.createVNode)("span", null, [coupon.unitDesc || ""])];
|
||||
}
|
||||
if (coupon.denominations) {
|
||||
const denominations = (0, import_utils2.formatAmount)(coupon.denominations);
|
||||
return [(0, import_vue.createVNode)("span", null, [currency]), ` ${denominations}`];
|
||||
}
|
||||
if (coupon.discount) {
|
||||
return t("discount", (0, import_utils2.formatDiscount)(coupon.discount));
|
||||
}
|
||||
return "";
|
||||
});
|
||||
const conditionMessage = (0, import_vue.computed)(() => {
|
||||
const condition = (0, import_utils2.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 (0, import_vue.createVNode)("div", {
|
||||
"class": bem({
|
||||
disabled
|
||||
})
|
||||
}, [(0, import_vue.createVNode)("div", {
|
||||
"class": bem("content")
|
||||
}, [(0, import_vue.createVNode)("div", {
|
||||
"class": bem("head")
|
||||
}, [(0, import_vue.createVNode)("h2", {
|
||||
"class": bem("amount")
|
||||
}, [faceAmount.value]), (0, import_vue.createVNode)("p", {
|
||||
"class": bem("condition")
|
||||
}, [coupon.condition || conditionMessage.value])]), (0, import_vue.createVNode)("div", {
|
||||
"class": bem("body")
|
||||
}, [(0, import_vue.createVNode)("p", {
|
||||
"class": bem("name")
|
||||
}, [coupon.name]), (0, import_vue.createVNode)("p", {
|
||||
"class": bem("valid")
|
||||
}, [validPeriod.value]), !disabled && (0, import_vue.createVNode)(import_checkbox.Checkbox, {
|
||||
"class": bem("corner"),
|
||||
"modelValue": chosen
|
||||
}, null)])]), description && (0, import_vue.createVNode)("p", {
|
||||
"class": bem("description")
|
||||
}, [description])]);
|
||||
};
|
||||
}
|
||||
});
|
||||
1
node_modules/vant/lib/coupon/index.css
generated
vendored
Normal file
1
node_modules/vant/lib/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/lib/coupon/index.d.ts
generated
vendored
Normal file
35
node_modules/vant/lib/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;
|
||||
}
|
||||
}
|
||||
37
node_modules/vant/lib/coupon/index.js
generated
vendored
Normal file
37
node_modules/vant/lib/coupon/index.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
Coupon: () => Coupon,
|
||||
default: () => stdin_default
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_utils = require("../utils");
|
||||
var import_Coupon = __toESM(require("./Coupon"));
|
||||
const Coupon = (0, import_utils.withInstall)(import_Coupon.default);
|
||||
var stdin_default = Coupon;
|
||||
1
node_modules/vant/lib/coupon/style/index.d.ts
generated
vendored
Normal file
1
node_modules/vant/lib/coupon/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
6
node_modules/vant/lib/coupon/style/index.js
generated
vendored
Normal file
6
node_modules/vant/lib/coupon/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
require("../../style/base.css");
|
||||
require("../../badge/index.css");
|
||||
require("../../icon/index.css");
|
||||
require("../../checkbox-group/index.css");
|
||||
require("../../checkbox/index.css");
|
||||
require("../index.css");
|
||||
19
node_modules/vant/lib/coupon/types.d.ts
generated
vendored
Normal file
19
node_modules/vant/lib/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;
|
||||
};
|
||||
15
node_modules/vant/lib/coupon/types.js
generated
vendored
Normal file
15
node_modules/vant/lib/coupon/types.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
3
node_modules/vant/lib/coupon/utils.d.ts
generated
vendored
Normal file
3
node_modules/vant/lib/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;
|
||||
33
node_modules/vant/lib/coupon/utils.js
generated
vendored
Normal file
33
node_modules/vant/lib/coupon/utils.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
formatAmount: () => formatAmount,
|
||||
formatDiscount: () => formatDiscount,
|
||||
getDate: () => getDate
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_utils = require("../utils");
|
||||
function getDate(timeStamp) {
|
||||
const date = new Date(timeStamp * 1e3);
|
||||
return `${date.getFullYear()}.${(0, import_utils.padZero)(date.getMonth() + 1)}.${(0, import_utils.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);
|
||||
Reference in New Issue
Block a user