vant 4.8.8 → 4.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/coupon-cell/CouponCell.d.ts +4 -4
- package/es/coupon-cell/CouponCell.mjs +35 -12
- package/es/coupon-cell/index.d.ts +3 -3
- package/es/coupon-list/CouponList.d.ts +3 -13
- package/es/coupon-list/CouponList.mjs +15 -6
- package/es/coupon-list/index.d.ts +2 -9
- package/es/date-picker/DatePicker.d.ts +6 -1
- package/es/date-picker/DatePicker.mjs +12 -0
- package/es/date-picker/index.d.ts +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/time-picker/TimePicker.d.ts +6 -1
- package/es/time-picker/TimePicker.mjs +13 -1
- package/es/time-picker/index.d.ts +1 -1
- package/lib/coupon-cell/CouponCell.d.ts +4 -4
- package/lib/coupon-cell/CouponCell.js +34 -11
- package/lib/coupon-cell/index.d.ts +3 -3
- package/lib/coupon-list/CouponList.d.ts +3 -13
- package/lib/coupon-list/CouponList.js +14 -5
- package/lib/coupon-list/index.d.ts +2 -9
- package/lib/date-picker/DatePicker.d.ts +6 -1
- package/lib/date-picker/DatePicker.js +12 -0
- package/lib/date-picker/index.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/time-picker/TimePicker.d.ts +6 -1
- package/lib/time-picker/TimePicker.js +12 -0
- package/lib/time-picker/index.d.ts +1 -1
- package/lib/vant.cjs.js +71 -17
- package/lib/vant.es.js +71 -17
- package/lib/vant.js +72 -18
- package/lib/vant.min.js +3 -3
- package/lib/web-types.json +1 -1
- package/package.json +11 -11
@@ -16,10 +16,7 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
16
16
|
default: true;
|
17
17
|
};
|
18
18
|
emptyImage: StringConstructor;
|
19
|
-
chosenCoupon:
|
20
|
-
type: NumberConstructor;
|
21
|
-
default: number;
|
22
|
-
};
|
19
|
+
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
23
20
|
enabledTitle: StringConstructor;
|
24
21
|
disabledTitle: StringConstructor;
|
25
22
|
disabledCoupons: {
|
@@ -65,10 +62,7 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
65
62
|
default: true;
|
66
63
|
};
|
67
64
|
emptyImage: StringConstructor;
|
68
|
-
chosenCoupon:
|
69
|
-
type: NumberConstructor;
|
70
|
-
default: number;
|
71
|
-
};
|
65
|
+
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
72
66
|
enabledTitle: StringConstructor;
|
73
67
|
disabledTitle: StringConstructor;
|
74
68
|
disabledCoupons: {
|
@@ -104,7 +98,6 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
104
98
|
code: string;
|
105
99
|
currency: string;
|
106
100
|
coupons: import("..").CouponInfo[];
|
107
|
-
chosenCoupon: number;
|
108
101
|
showCount: boolean;
|
109
102
|
disabledCoupons: import("..").CouponInfo[];
|
110
103
|
showExchangeBar: boolean;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type PropType, type ExtractPropTypes } from 'vue';
|
1
|
+
import { type ComponentPublicInstance, type PropType, type ExtractPropTypes } from 'vue';
|
2
2
|
export type DatePickerColumnType = 'year' | 'month' | 'day';
|
3
3
|
export declare const datePickerProps: {
|
4
4
|
loading: BooleanConstructor;
|
@@ -50,7 +50,12 @@ export declare const datePickerProps: {
|
|
50
50
|
validator: (val: unknown) => val is Date;
|
51
51
|
};
|
52
52
|
};
|
53
|
+
export type DatePickerExpose = {
|
54
|
+
confirm: () => void;
|
55
|
+
getSelectedDate: () => string[];
|
56
|
+
};
|
53
57
|
export type DatePickerProps = ExtractPropTypes<typeof datePickerProps>;
|
58
|
+
export type DatePickerInstance = ComponentPublicInstance<DatePickerProps, DatePickerExpose>;
|
54
59
|
declare const _default: import("vue").DefineComponent<{
|
55
60
|
loading: BooleanConstructor;
|
56
61
|
readonly: BooleanConstructor;
|
@@ -25,6 +25,7 @@ var import_vue = require("vue");
|
|
25
25
|
var import_vue2 = require("vue");
|
26
26
|
var import_utils = require("../utils");
|
27
27
|
var import_utils2 = require("./utils");
|
28
|
+
var import_use_expose = require("../composables/use-expose");
|
28
29
|
var import_picker = require("../picker");
|
29
30
|
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
30
31
|
const [name] = (0, import_utils.createNamespace)("date-picker");
|
@@ -54,6 +55,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
54
55
|
}) {
|
55
56
|
const currentValues = (0, import_vue2.ref)(props.modelValue);
|
56
57
|
const updatedByExternalSources = (0, import_vue2.ref)(false);
|
58
|
+
const pickerRef = (0, import_vue2.ref)();
|
57
59
|
const genYearOptions = () => {
|
58
60
|
const minYear = props.minDate.getFullYear();
|
59
61
|
const maxYear = props.maxDate.getFullYear();
|
@@ -95,6 +97,11 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
95
97
|
const maxDate = isMaxYear(year) && isMaxMonth(month) ? props.maxDate.getDate() : (0, import_utils2.getMonthEndDay)(year, month);
|
96
98
|
return (0, import_utils2.genOptions)(minDate, maxDate, "day", props.formatter, props.filter);
|
97
99
|
};
|
100
|
+
const confirm = () => {
|
101
|
+
var _a;
|
102
|
+
return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
|
103
|
+
};
|
104
|
+
const getSelectedDate = () => currentValues.value;
|
98
105
|
const columns = (0, import_vue2.computed)(() => props.columnsType.map((type) => {
|
99
106
|
switch (type) {
|
100
107
|
case "year":
|
@@ -128,7 +135,12 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
128
135
|
const onChange = (...args) => emit("change", ...args);
|
129
136
|
const onCancel = (...args) => emit("cancel", ...args);
|
130
137
|
const onConfirm = (...args) => emit("confirm", ...args);
|
138
|
+
(0, import_use_expose.useExpose)({
|
139
|
+
confirm,
|
140
|
+
getSelectedDate
|
141
|
+
});
|
131
142
|
return () => (0, import_vue.createVNode)(import_picker.Picker, (0, import_vue.mergeProps)({
|
143
|
+
"ref": pickerRef,
|
132
144
|
"modelValue": currentValues.value,
|
133
145
|
"onUpdate:modelValue": ($event) => currentValues.value = $event,
|
134
146
|
"columns": columns.value,
|
@@ -119,7 +119,7 @@ export declare const DatePicker: import("../utils").WithInstall<import("vue").De
|
|
119
119
|
export default DatePicker;
|
120
120
|
export { datePickerProps } from './DatePicker';
|
121
121
|
export type { DatePickerProps };
|
122
|
-
export type { DatePickerColumnType } from './DatePicker';
|
122
|
+
export type { DatePickerColumnType, DatePickerInstance } from './DatePicker';
|
123
123
|
declare module 'vue' {
|
124
124
|
interface GlobalComponents {
|
125
125
|
VanDatePicker: typeof DatePicker;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -226,7 +226,7 @@ __reExport(stdin_exports, require("./toast"), module.exports);
|
|
226
226
|
__reExport(stdin_exports, require("./tree-select"), module.exports);
|
227
227
|
__reExport(stdin_exports, require("./uploader"), module.exports);
|
228
228
|
__reExport(stdin_exports, require("./watermark"), module.exports);
|
229
|
-
const version = "4.8.
|
229
|
+
const version = "4.8.9";
|
230
230
|
function install(app) {
|
231
231
|
const components = [
|
232
232
|
import_action_bar.ActionBar,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type ExtractPropTypes, type PropType } from 'vue';
|
1
|
+
import { type ExtractPropTypes, type PropType, type ComponentPublicInstance } from 'vue';
|
2
2
|
export type TimePickerColumnType = 'hour' | 'minute' | 'second';
|
3
3
|
export declare const timePickerProps: {
|
4
4
|
loading: BooleanConstructor;
|
@@ -74,6 +74,11 @@ export declare const timePickerProps: {
|
|
74
74
|
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
75
75
|
};
|
76
76
|
export type TimePickerProps = ExtractPropTypes<typeof timePickerProps>;
|
77
|
+
export type TimePickerExpose = {
|
78
|
+
confirm: () => void;
|
79
|
+
getSelectedTime: () => string[];
|
80
|
+
};
|
81
|
+
export type TimePickerInstance = ComponentPublicInstance<TimePickerProps, TimePickerExpose>;
|
77
82
|
declare const _default: import("vue").DefineComponent<{
|
78
83
|
loading: BooleanConstructor;
|
79
84
|
readonly: BooleanConstructor;
|
@@ -25,6 +25,7 @@ var import_vue = require("vue");
|
|
25
25
|
var import_vue2 = require("vue");
|
26
26
|
var import_utils = require("../date-picker/utils");
|
27
27
|
var import_utils2 = require("../utils");
|
28
|
+
var import_use_expose = require("../composables/use-expose");
|
28
29
|
var import_picker = require("../picker");
|
29
30
|
const [name] = (0, import_utils2.createNamespace)("time-picker");
|
30
31
|
const validateTime = (val) => /^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/.test(val);
|
@@ -59,10 +60,16 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
59
60
|
slots
|
60
61
|
}) {
|
61
62
|
const currentValues = (0, import_vue2.ref)(props.modelValue);
|
63
|
+
const pickerRef = (0, import_vue2.ref)();
|
62
64
|
const getValidTime = (time) => {
|
63
65
|
const timeLimitArr = time.split(":");
|
64
66
|
return fullColumns.map((col, i) => props.columnsType.includes(col) ? timeLimitArr[i] : "00");
|
65
67
|
};
|
68
|
+
const confirm = () => {
|
69
|
+
var _a;
|
70
|
+
return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
|
71
|
+
};
|
72
|
+
const getSelectedTime = () => currentValues.value;
|
66
73
|
const columns = (0, import_vue2.computed)(() => {
|
67
74
|
let {
|
68
75
|
minHour,
|
@@ -135,7 +142,12 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
135
142
|
const onChange = (...args) => emit("change", ...args);
|
136
143
|
const onCancel = (...args) => emit("cancel", ...args);
|
137
144
|
const onConfirm = (...args) => emit("confirm", ...args);
|
145
|
+
(0, import_use_expose.useExpose)({
|
146
|
+
confirm,
|
147
|
+
getSelectedTime
|
148
|
+
});
|
138
149
|
return () => (0, import_vue.createVNode)(import_picker.Picker, (0, import_vue.mergeProps)({
|
150
|
+
"ref": pickerRef,
|
139
151
|
"modelValue": currentValues.value,
|
140
152
|
"onUpdate:modelValue": ($event) => currentValues.value = $event,
|
141
153
|
"columns": columns.value,
|
@@ -169,7 +169,7 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
|
|
169
169
|
export default TimePicker;
|
170
170
|
export { timePickerProps } from './TimePicker';
|
171
171
|
export type { TimePickerProps };
|
172
|
-
export type { TimePickerColumnType } from './TimePicker';
|
172
|
+
export type { TimePickerColumnType, TimePickerInstance } from './TimePicker';
|
173
173
|
declare module 'vue' {
|
174
174
|
interface GlobalComponents {
|
175
175
|
VanTimePicker: typeof TimePicker;
|
package/lib/vant.cjs.js
CHANGED
@@ -8632,33 +8632,56 @@ const couponCellProps = {
|
|
8632
8632
|
editable: truthProp,
|
8633
8633
|
coupons: makeArrayProp(),
|
8634
8634
|
currency: makeStringProp("¥"),
|
8635
|
-
chosenCoupon:
|
8635
|
+
chosenCoupon: {
|
8636
|
+
type: [Number, Array],
|
8637
|
+
default: -1
|
8638
|
+
}
|
8636
8639
|
};
|
8637
8640
|
function formatValue({
|
8638
8641
|
coupons,
|
8639
8642
|
chosenCoupon,
|
8640
8643
|
currency
|
8641
8644
|
}) {
|
8642
|
-
const
|
8643
|
-
|
8644
|
-
|
8645
|
+
const getValue = (coupon) => {
|
8646
|
+
let value2 = 0;
|
8647
|
+
const {
|
8648
|
+
value: couponValue,
|
8649
|
+
denominations
|
8650
|
+
} = coupon;
|
8645
8651
|
if (isDef(coupon.value)) {
|
8646
|
-
|
8647
|
-
value
|
8648
|
-
} = coupon);
|
8652
|
+
value2 = couponValue;
|
8649
8653
|
} else if (isDef(coupon.denominations)) {
|
8650
|
-
|
8654
|
+
value2 = denominations;
|
8651
8655
|
}
|
8652
|
-
return
|
8656
|
+
return value2;
|
8657
|
+
};
|
8658
|
+
let value = 0, isExist = false;
|
8659
|
+
if (Array.isArray(chosenCoupon)) {
|
8660
|
+
chosenCoupon.forEach((i) => {
|
8661
|
+
const coupon = coupons[+i];
|
8662
|
+
if (coupon) {
|
8663
|
+
isExist = true;
|
8664
|
+
value += getValue(coupon);
|
8665
|
+
}
|
8666
|
+
});
|
8667
|
+
} else {
|
8668
|
+
const coupon = coupons[+chosenCoupon];
|
8669
|
+
if (coupon) {
|
8670
|
+
isExist = true;
|
8671
|
+
value = getValue(coupon);
|
8672
|
+
}
|
8673
|
+
}
|
8674
|
+
if (!isExist) {
|
8675
|
+
return coupons.length === 0 ? t$a("noCoupon") : t$a("count", coupons.length);
|
8653
8676
|
}
|
8654
|
-
return
|
8677
|
+
return `-${currency} ${(value / 100).toFixed(2)}`;
|
8655
8678
|
}
|
8656
8679
|
var stdin_default$_ = vue.defineComponent({
|
8657
8680
|
name: name$R,
|
8658
8681
|
props: couponCellProps,
|
8659
8682
|
setup(props2) {
|
8660
8683
|
return () => {
|
8661
|
-
const selected = props2.coupons[+props2.chosenCoupon];
|
8684
|
+
const selected = Array.isArray(props2.chosenCoupon) ? props2.chosenCoupon.length : props2.coupons[+props2.chosenCoupon];
|
8662
8685
|
return vue.createVNode(Cell, {
|
8663
8686
|
"class": bem$Q(),
|
8664
8687
|
"value": formatValue(props2),
|
@@ -8996,7 +9019,7 @@ const couponListProps = {
|
|
8996
9019
|
currency: makeStringProp("¥"),
|
8997
9020
|
showCount: truthProp,
|
8998
9021
|
emptyImage: String,
|
8999
|
-
chosenCoupon:
|
9022
|
+
chosenCoupon: [Number, Array],
|
9000
9023
|
enabledTitle: String,
|
9001
9024
|
disabledTitle: String,
|
9002
9025
|
disabledCoupons: makeArrayProp(),
|
@@ -9080,6 +9103,15 @@ var stdin_default$Y = vue.defineComponent({
|
|
9080
9103
|
} = props2;
|
9081
9104
|
const count = props2.showCount ? ` (${coupons.length})` : "";
|
9082
9105
|
const title = (props2.enabledTitle || t$9("enable")) + count;
|
9106
|
+
const getChosenCoupon = (chosenCoupon = [], value = 0) => {
|
9107
|
+
const unrefChosenCoupon = vue.unref(chosenCoupon);
|
9108
|
+
const index = unrefChosenCoupon.indexOf(value);
|
9109
|
+
if (index === -1) {
|
9110
|
+
return [...unrefChosenCoupon, value];
|
9111
|
+
}
|
9112
|
+
unrefChosenCoupon.splice(index, 1);
|
9113
|
+
return [...unrefChosenCoupon];
|
9114
|
+
};
|
9083
9115
|
return vue.createVNode(Tab, {
|
9084
9116
|
"title": title
|
9085
9117
|
}, {
|
@@ -9096,9 +9128,9 @@ var stdin_default$Y = vue.defineComponent({
|
|
9096
9128
|
"key": coupon.id,
|
9097
9129
|
"ref": setCouponRefs(index),
|
9098
9130
|
"coupon": coupon,
|
9099
|
-
"chosen": index === props2.chosenCoupon,
|
9131
|
+
"chosen": Array.isArray(props2.chosenCoupon) ? props2.chosenCoupon.includes(index) : index === props2.chosenCoupon,
|
9100
9132
|
"currency": props2.currency,
|
9101
|
-
"onClick": () => emit("change", index)
|
9133
|
+
"onClick": () => emit("change", Array.isArray(props2.chosenCoupon) ? getChosenCoupon(props2.chosenCoupon, index) : index)
|
9102
9134
|
}, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
|
9103
9135
|
}
|
9104
9136
|
});
|
@@ -9151,13 +9183,13 @@ var stdin_default$Y = vue.defineComponent({
|
|
9151
9183
|
default: () => [renderCouponTab(), renderDisabledTab()]
|
9152
9184
|
}), vue.createVNode("div", {
|
9153
9185
|
"class": bem$O("bottom")
|
9154
|
-
}, [vue.withDirectives(vue.createVNode(Button, {
|
9186
|
+
}, [slots["list-button"] ? slots["list-button"]() : vue.withDirectives(vue.createVNode(Button, {
|
9155
9187
|
"round": true,
|
9156
9188
|
"block": true,
|
9157
9189
|
"type": "primary",
|
9158
9190
|
"class": bem$O("close"),
|
9159
9191
|
"text": props2.closeButtonText || t$9("close"),
|
9160
|
-
"onClick": () => emit("change", -1)
|
9192
|
+
"onClick": () => emit("change", Array.isArray(props2.chosenCoupon) ? [] : -1)
|
9161
9193
|
}, null), [[vue.vShow, props2.showCloseButton]])])]);
|
9162
9194
|
}
|
9163
9195
|
});
|
@@ -9190,6 +9222,7 @@ var stdin_default$X = vue.defineComponent({
|
|
9190
9222
|
}) {
|
9191
9223
|
const currentValues = vue.ref(props2.modelValue);
|
9192
9224
|
const updatedByExternalSources = vue.ref(false);
|
9225
|
+
const pickerRef = vue.ref();
|
9193
9226
|
const genYearOptions = () => {
|
9194
9227
|
const minYear = props2.minDate.getFullYear();
|
9195
9228
|
const maxYear = props2.maxDate.getFullYear();
|
@@ -9231,6 +9264,11 @@ var stdin_default$X = vue.defineComponent({
|
|
9231
9264
|
const maxDate = isMaxYear(year) && isMaxMonth(month) ? props2.maxDate.getDate() : getMonthEndDay(year, month);
|
9232
9265
|
return genOptions(minDate, maxDate, "day", props2.formatter, props2.filter);
|
9233
9266
|
};
|
9267
|
+
const confirm = () => {
|
9268
|
+
var _a;
|
9269
|
+
return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
|
9270
|
+
};
|
9271
|
+
const getSelectedDate = () => currentValues.value;
|
9234
9272
|
const columns = vue.computed(() => props2.columnsType.map((type) => {
|
9235
9273
|
switch (type) {
|
9236
9274
|
case "year":
|
@@ -9264,7 +9302,12 @@ var stdin_default$X = vue.defineComponent({
|
|
9264
9302
|
const onChange = (...args) => emit("change", ...args);
|
9265
9303
|
const onCancel = (...args) => emit("cancel", ...args);
|
9266
9304
|
const onConfirm = (...args) => emit("confirm", ...args);
|
9305
|
+
useExpose({
|
9306
|
+
confirm,
|
9307
|
+
getSelectedDate
|
9308
|
+
});
|
9267
9309
|
return () => vue.createVNode(Picker, vue.mergeProps({
|
9310
|
+
"ref": pickerRef,
|
9268
9311
|
"modelValue": currentValues.value,
|
9269
9312
|
"onUpdate:modelValue": ($event) => currentValues.value = $event,
|
9270
9313
|
"columns": columns.value,
|
@@ -15193,10 +15236,16 @@ var stdin_default$8 = vue.defineComponent({
|
|
15193
15236
|
slots
|
15194
15237
|
}) {
|
15195
15238
|
const currentValues = vue.ref(props2.modelValue);
|
15239
|
+
const pickerRef = vue.ref();
|
15196
15240
|
const getValidTime = (time) => {
|
15197
15241
|
const timeLimitArr = time.split(":");
|
15198
15242
|
return fullColumns.map((col, i) => props2.columnsType.includes(col) ? timeLimitArr[i] : "00");
|
15199
15243
|
};
|
15244
|
+
const confirm = () => {
|
15245
|
+
var _a;
|
15246
|
+
return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
|
15247
|
+
};
|
15248
|
+
const getSelectedTime = () => currentValues.value;
|
15200
15249
|
const columns = vue.computed(() => {
|
15201
15250
|
let {
|
15202
15251
|
minHour,
|
@@ -15269,7 +15318,12 @@ var stdin_default$8 = vue.defineComponent({
|
|
15269
15318
|
const onChange = (...args) => emit("change", ...args);
|
15270
15319
|
const onCancel = (...args) => emit("cancel", ...args);
|
15271
15320
|
const onConfirm = (...args) => emit("confirm", ...args);
|
15321
|
+
useExpose({
|
15322
|
+
confirm,
|
15323
|
+
getSelectedTime
|
15324
|
+
});
|
15272
15325
|
return () => vue.createVNode(Picker, vue.mergeProps({
|
15326
|
+
"ref": pickerRef,
|
15273
15327
|
"modelValue": currentValues.value,
|
15274
15328
|
"onUpdate:modelValue": ($event) => currentValues.value = $event,
|
15275
15329
|
"columns": columns.value,
|
@@ -16819,7 +16873,7 @@ const Lazyload = {
|
|
16819
16873
|
});
|
16820
16874
|
}
|
16821
16875
|
};
|
16822
|
-
const version = "4.8.
|
16876
|
+
const version = "4.8.9";
|
16823
16877
|
function install(app) {
|
16824
16878
|
const components = [
|
16825
16879
|
ActionBar,
|
package/lib/vant.es.js
CHANGED
@@ -8630,33 +8630,56 @@ const couponCellProps = {
|
|
8630
8630
|
editable: truthProp,
|
8631
8631
|
coupons: makeArrayProp(),
|
8632
8632
|
currency: makeStringProp("¥"),
|
8633
|
-
chosenCoupon:
|
8633
|
+
chosenCoupon: {
|
8634
|
+
type: [Number, Array],
|
8635
|
+
default: -1
|
8636
|
+
}
|
8634
8637
|
};
|
8635
8638
|
function formatValue({
|
8636
8639
|
coupons,
|
8637
8640
|
chosenCoupon,
|
8638
8641
|
currency
|
8639
8642
|
}) {
|
8640
|
-
const
|
8641
|
-
|
8642
|
-
|
8643
|
+
const getValue = (coupon) => {
|
8644
|
+
let value2 = 0;
|
8645
|
+
const {
|
8646
|
+
value: couponValue,
|
8647
|
+
denominations
|
8648
|
+
} = coupon;
|
8643
8649
|
if (isDef(coupon.value)) {
|
8644
|
-
|
8645
|
-
value
|
8646
|
-
} = coupon);
|
8650
|
+
value2 = couponValue;
|
8647
8651
|
} else if (isDef(coupon.denominations)) {
|
8648
|
-
|
8652
|
+
value2 = denominations;
|
8649
8653
|
}
|
8650
|
-
return
|
8654
|
+
return value2;
|
8655
|
+
};
|
8656
|
+
let value = 0, isExist = false;
|
8657
|
+
if (Array.isArray(chosenCoupon)) {
|
8658
|
+
chosenCoupon.forEach((i) => {
|
8659
|
+
const coupon = coupons[+i];
|
8660
|
+
if (coupon) {
|
8661
|
+
isExist = true;
|
8662
|
+
value += getValue(coupon);
|
8663
|
+
}
|
8664
|
+
});
|
8665
|
+
} else {
|
8666
|
+
const coupon = coupons[+chosenCoupon];
|
8667
|
+
if (coupon) {
|
8668
|
+
isExist = true;
|
8669
|
+
value = getValue(coupon);
|
8670
|
+
}
|
8671
|
+
}
|
8672
|
+
if (!isExist) {
|
8673
|
+
return coupons.length === 0 ? t$a("noCoupon") : t$a("count", coupons.length);
|
8651
8674
|
}
|
8652
|
-
return
|
8675
|
+
return `-${currency} ${(value / 100).toFixed(2)}`;
|
8653
8676
|
}
|
8654
8677
|
var stdin_default$_ = defineComponent({
|
8655
8678
|
name: name$R,
|
8656
8679
|
props: couponCellProps,
|
8657
8680
|
setup(props2) {
|
8658
8681
|
return () => {
|
8659
|
-
const selected = props2.coupons[+props2.chosenCoupon];
|
8682
|
+
const selected = Array.isArray(props2.chosenCoupon) ? props2.chosenCoupon.length : props2.coupons[+props2.chosenCoupon];
|
8660
8683
|
return createVNode(Cell, {
|
8661
8684
|
"class": bem$Q(),
|
8662
8685
|
"value": formatValue(props2),
|
@@ -8994,7 +9017,7 @@ const couponListProps = {
|
|
8994
9017
|
currency: makeStringProp("¥"),
|
8995
9018
|
showCount: truthProp,
|
8996
9019
|
emptyImage: String,
|
8997
|
-
chosenCoupon:
|
9020
|
+
chosenCoupon: [Number, Array],
|
8998
9021
|
enabledTitle: String,
|
8999
9022
|
disabledTitle: String,
|
9000
9023
|
disabledCoupons: makeArrayProp(),
|
@@ -9078,6 +9101,15 @@ var stdin_default$Y = defineComponent({
|
|
9078
9101
|
} = props2;
|
9079
9102
|
const count = props2.showCount ? ` (${coupons.length})` : "";
|
9080
9103
|
const title = (props2.enabledTitle || t$9("enable")) + count;
|
9104
|
+
const getChosenCoupon = (chosenCoupon = [], value = 0) => {
|
9105
|
+
const unrefChosenCoupon = unref(chosenCoupon);
|
9106
|
+
const index = unrefChosenCoupon.indexOf(value);
|
9107
|
+
if (index === -1) {
|
9108
|
+
return [...unrefChosenCoupon, value];
|
9109
|
+
}
|
9110
|
+
unrefChosenCoupon.splice(index, 1);
|
9111
|
+
return [...unrefChosenCoupon];
|
9112
|
+
};
|
9081
9113
|
return createVNode(Tab, {
|
9082
9114
|
"title": title
|
9083
9115
|
}, {
|
@@ -9094,9 +9126,9 @@ var stdin_default$Y = defineComponent({
|
|
9094
9126
|
"key": coupon.id,
|
9095
9127
|
"ref": setCouponRefs(index),
|
9096
9128
|
"coupon": coupon,
|
9097
|
-
"chosen": index === props2.chosenCoupon,
|
9129
|
+
"chosen": Array.isArray(props2.chosenCoupon) ? props2.chosenCoupon.includes(index) : index === props2.chosenCoupon,
|
9098
9130
|
"currency": props2.currency,
|
9099
|
-
"onClick": () => emit("change", index)
|
9131
|
+
"onClick": () => emit("change", Array.isArray(props2.chosenCoupon) ? getChosenCoupon(props2.chosenCoupon, index) : index)
|
9100
9132
|
}, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
|
9101
9133
|
}
|
9102
9134
|
});
|
@@ -9149,13 +9181,13 @@ var stdin_default$Y = defineComponent({
|
|
9149
9181
|
default: () => [renderCouponTab(), renderDisabledTab()]
|
9150
9182
|
}), createVNode("div", {
|
9151
9183
|
"class": bem$O("bottom")
|
9152
|
-
}, [withDirectives(createVNode(Button, {
|
9184
|
+
}, [slots["list-button"] ? slots["list-button"]() : withDirectives(createVNode(Button, {
|
9153
9185
|
"round": true,
|
9154
9186
|
"block": true,
|
9155
9187
|
"type": "primary",
|
9156
9188
|
"class": bem$O("close"),
|
9157
9189
|
"text": props2.closeButtonText || t$9("close"),
|
9158
|
-
"onClick": () => emit("change", -1)
|
9190
|
+
"onClick": () => emit("change", Array.isArray(props2.chosenCoupon) ? [] : -1)
|
9159
9191
|
}, null), [[vShow, props2.showCloseButton]])])]);
|
9160
9192
|
}
|
9161
9193
|
});
|
@@ -9188,6 +9220,7 @@ var stdin_default$X = defineComponent({
|
|
9188
9220
|
}) {
|
9189
9221
|
const currentValues = ref(props2.modelValue);
|
9190
9222
|
const updatedByExternalSources = ref(false);
|
9223
|
+
const pickerRef = ref();
|
9191
9224
|
const genYearOptions = () => {
|
9192
9225
|
const minYear = props2.minDate.getFullYear();
|
9193
9226
|
const maxYear = props2.maxDate.getFullYear();
|
@@ -9229,6 +9262,11 @@ var stdin_default$X = defineComponent({
|
|
9229
9262
|
const maxDate = isMaxYear(year) && isMaxMonth(month) ? props2.maxDate.getDate() : getMonthEndDay(year, month);
|
9230
9263
|
return genOptions(minDate, maxDate, "day", props2.formatter, props2.filter);
|
9231
9264
|
};
|
9265
|
+
const confirm = () => {
|
9266
|
+
var _a;
|
9267
|
+
return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
|
9268
|
+
};
|
9269
|
+
const getSelectedDate = () => currentValues.value;
|
9232
9270
|
const columns = computed(() => props2.columnsType.map((type) => {
|
9233
9271
|
switch (type) {
|
9234
9272
|
case "year":
|
@@ -9262,7 +9300,12 @@ var stdin_default$X = defineComponent({
|
|
9262
9300
|
const onChange = (...args) => emit("change", ...args);
|
9263
9301
|
const onCancel = (...args) => emit("cancel", ...args);
|
9264
9302
|
const onConfirm = (...args) => emit("confirm", ...args);
|
9303
|
+
useExpose({
|
9304
|
+
confirm,
|
9305
|
+
getSelectedDate
|
9306
|
+
});
|
9265
9307
|
return () => createVNode(Picker, mergeProps({
|
9308
|
+
"ref": pickerRef,
|
9266
9309
|
"modelValue": currentValues.value,
|
9267
9310
|
"onUpdate:modelValue": ($event) => currentValues.value = $event,
|
9268
9311
|
"columns": columns.value,
|
@@ -15191,10 +15234,16 @@ var stdin_default$8 = defineComponent({
|
|
15191
15234
|
slots
|
15192
15235
|
}) {
|
15193
15236
|
const currentValues = ref(props2.modelValue);
|
15237
|
+
const pickerRef = ref();
|
15194
15238
|
const getValidTime = (time) => {
|
15195
15239
|
const timeLimitArr = time.split(":");
|
15196
15240
|
return fullColumns.map((col, i) => props2.columnsType.includes(col) ? timeLimitArr[i] : "00");
|
15197
15241
|
};
|
15242
|
+
const confirm = () => {
|
15243
|
+
var _a;
|
15244
|
+
return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
|
15245
|
+
};
|
15246
|
+
const getSelectedTime = () => currentValues.value;
|
15198
15247
|
const columns = computed(() => {
|
15199
15248
|
let {
|
15200
15249
|
minHour,
|
@@ -15267,7 +15316,12 @@ var stdin_default$8 = defineComponent({
|
|
15267
15316
|
const onChange = (...args) => emit("change", ...args);
|
15268
15317
|
const onCancel = (...args) => emit("cancel", ...args);
|
15269
15318
|
const onConfirm = (...args) => emit("confirm", ...args);
|
15319
|
+
useExpose({
|
15320
|
+
confirm,
|
15321
|
+
getSelectedTime
|
15322
|
+
});
|
15270
15323
|
return () => createVNode(Picker, mergeProps({
|
15324
|
+
"ref": pickerRef,
|
15271
15325
|
"modelValue": currentValues.value,
|
15272
15326
|
"onUpdate:modelValue": ($event) => currentValues.value = $event,
|
15273
15327
|
"columns": columns.value,
|
@@ -16817,7 +16871,7 @@ const Lazyload = {
|
|
16817
16871
|
});
|
16818
16872
|
}
|
16819
16873
|
};
|
16820
|
-
const version = "4.8.
|
16874
|
+
const version = "4.8.9";
|
16821
16875
|
function install(app) {
|
16822
16876
|
const components = [
|
16823
16877
|
ActionBar,
|