@pisell/pisellos 2.1.170 → 2.1.172
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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -3
- package/dist/model/strategy/adapter/index.d.ts +0 -4
- package/dist/model/strategy/adapter/index.js +1 -5
- package/dist/model/strategy/adapter/promotion/evaluator.js +99 -26
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +61 -8
- package/dist/model/strategy/adapter/walletPass/locales.js +12 -3
- package/dist/model/strategy/engine.d.ts +18 -5
- package/dist/model/strategy/engine.js +145 -45
- package/dist/model/strategy/type.d.ts +17 -0
- package/dist/model/strategy/type.js +4 -0
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.js +56 -25
- package/dist/modules/Cart/utils/changePrice.js +9 -16
- package/dist/modules/Discount/index.d.ts +4 -13
- package/dist/modules/Discount/index.js +12 -124
- package/dist/modules/Discount/types.d.ts +18 -13
- package/dist/modules/Order/index.d.ts +1 -67
- package/dist/modules/Order/index.js +30 -918
- package/dist/modules/Order/types.d.ts +12 -176
- package/dist/modules/Order/types.js +0 -2
- package/dist/modules/Order/utils.d.ts +0 -118
- package/dist/modules/Order/utils.js +2 -586
- package/dist/modules/Payment/index.d.ts +2 -1
- package/dist/modules/Payment/index.js +10 -7
- package/dist/modules/Payment/utils.js +3 -0
- package/dist/modules/Payment/walletpass.d.ts +23 -0
- package/dist/modules/Payment/walletpass.js +191 -95
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.d.ts +2 -4
- package/dist/modules/ProductList/index.js +12 -24
- package/dist/modules/Rules/index.d.ts +9 -5
- package/dist/modules/Rules/index.js +669 -173
- package/dist/modules/Rules/types.d.ts +2 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +18 -16
- package/dist/modules/Schedule/utils.d.ts +1 -1
- package/dist/modules/Summary/types.d.ts +2 -0
- package/dist/modules/Summary/utils.d.ts +9 -3
- package/dist/modules/Summary/utils.js +57 -67
- package/dist/modules/index.d.ts +0 -4
- package/dist/modules/index.js +1 -5
- package/dist/plugins/window.d.ts +2 -0
- package/dist/solution/BookingByStep/index.d.ts +3 -2
- package/dist/solution/BookingByStep/index.js +43 -46
- package/dist/solution/BookingByStep/types.d.ts +1 -3
- package/dist/solution/BookingByStep/types.js +1 -5
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/Checkout/index.js +2 -0
- package/dist/solution/ShopDiscount/index.d.ts +2 -3
- package/dist/solution/ShopDiscount/index.js +60 -62
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.js +2 -1
- package/dist/solution/ShopDiscount/utils.js +26 -12
- package/dist/solution/index.d.ts +0 -2
- package/dist/solution/index.js +1 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -4
- package/lib/model/strategy/adapter/index.d.ts +0 -4
- package/lib/model/strategy/adapter/index.js +2 -13
- package/lib/model/strategy/adapter/promotion/evaluator.js +57 -8
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +34 -3
- package/lib/model/strategy/adapter/walletPass/locales.js +12 -3
- package/lib/model/strategy/engine.d.ts +18 -5
- package/lib/model/strategy/engine.js +85 -21
- package/lib/model/strategy/type.d.ts +17 -0
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.js +39 -12
- package/lib/modules/Cart/utils/changePrice.js +9 -13
- package/lib/modules/Discount/index.d.ts +4 -13
- package/lib/modules/Discount/index.js +5 -76
- package/lib/modules/Discount/types.d.ts +18 -13
- package/lib/modules/Order/index.d.ts +1 -67
- package/lib/modules/Order/index.js +1 -525
- package/lib/modules/Order/types.d.ts +12 -176
- package/lib/modules/Order/utils.d.ts +0 -118
- package/lib/modules/Order/utils.js +2 -483
- package/lib/modules/Payment/index.d.ts +2 -1
- package/lib/modules/Payment/index.js +1 -0
- package/lib/modules/Payment/utils.js +3 -0
- package/lib/modules/Payment/walletpass.d.ts +23 -0
- package/lib/modules/Payment/walletpass.js +94 -17
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +2 -4
- package/lib/modules/ProductList/index.js +39 -46
- package/lib/modules/Rules/index.d.ts +9 -5
- package/lib/modules/Rules/index.js +776 -292
- package/lib/modules/Rules/types.d.ts +2 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +11 -13
- package/lib/modules/Schedule/utils.d.ts +1 -1
- package/lib/modules/Summary/types.d.ts +2 -0
- package/lib/modules/Summary/utils.d.ts +9 -3
- package/lib/modules/Summary/utils.js +34 -45
- package/lib/modules/index.d.ts +0 -4
- package/lib/modules/index.js +1 -9
- package/lib/plugins/window.d.ts +2 -0
- package/lib/solution/BookingByStep/index.d.ts +3 -2
- package/lib/solution/BookingByStep/index.js +4 -6
- package/lib/solution/BookingByStep/types.d.ts +1 -3
- package/lib/solution/BookingByStep/types.js +0 -10
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/Checkout/index.js +2 -0
- package/lib/solution/ShopDiscount/index.d.ts +2 -3
- package/lib/solution/ShopDiscount/index.js +27 -22
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.js +10 -6
- package/lib/solution/index.d.ts +0 -2
- package/lib/solution/index.js +1 -5
- package/package.json +2 -2
- package/dist/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +0 -1
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -167
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -867
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/dist/model/strategy/adapter/dataVariant/examples.js +0 -277
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -149
- package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
- package/dist/modules/OpenData/index.d.ts +0 -24
- package/dist/modules/OpenData/index.js +0 -173
- package/dist/modules/OpenData/types.d.ts +0 -73
- package/dist/modules/OpenData/types.js +0 -1
- package/dist/modules/OpenData/utils.d.ts +0 -2
- package/dist/modules/OpenData/utils.js +0 -75
- package/dist/modules/Quotation/index.d.ts +0 -48
- package/dist/modules/Quotation/index.js +0 -248
- package/dist/modules/Quotation/types.d.ts +0 -42
- package/dist/modules/Quotation/types.js +0 -1
- package/dist/modules/SalesSummary/index.d.ts +0 -63
- package/dist/modules/SalesSummary/index.js +0 -174
- package/dist/modules/SalesSummary/types.d.ts +0 -60
- package/dist/modules/SalesSummary/types.js +0 -1
- package/dist/modules/SalesSummary/utils.d.ts +0 -30
- package/dist/modules/SalesSummary/utils.js +0 -480
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -23
- package/dist/modules/ScanOrderLogger/index.js +0 -174
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +0 -221
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/providers/grafana.js +0 -50
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -53
- package/dist/modules/ScanOrderLogger/types.js +0 -1
- package/dist/solution/ScanOrder/index.d.ts +0 -158
- package/dist/solution/ScanOrder/index.js +0 -3474
- package/dist/solution/ScanOrder/types.d.ts +0 -306
- package/dist/solution/ScanOrder/types.js +0 -35
- package/dist/solution/ScanOrder/utils.d.ts +0 -172
- package/dist/solution/ScanOrder/utils.js +0 -796
- package/dist/solution/VenueBooking/index.d.ts +0 -252
- package/dist/solution/VenueBooking/index.js +0 -3769
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -343
- package/dist/solution/VenueBooking/types.d.ts +0 -156
- package/dist/solution/VenueBooking/types.js +0 -22
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
- package/dist/solution/VenueBooking/utils/dateSummary.js +0 -91
- package/dist/solution/VenueBooking/utils/resource.d.ts +0 -14
- package/dist/solution/VenueBooking/utils/resource.js +0 -131
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -32
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -233
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -71
- package/dist/solution/VenueBooking/utils/smartPricing.js +0 -302
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -34
- package/dist/solution/VenueBooking/utils/timeSlot.js +0 -458
- package/dist/solution/VenueBooking/utils.d.ts +0 -1
- package/dist/solution/VenueBooking/utils.js +0 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -149
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -666
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/lib/model/strategy/adapter/dataVariant/examples.js +0 -293
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -149
- package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
- package/lib/modules/OpenData/index.d.ts +0 -24
- package/lib/modules/OpenData/index.js +0 -119
- package/lib/modules/OpenData/types.d.ts +0 -73
- package/lib/modules/OpenData/types.js +0 -17
- package/lib/modules/OpenData/utils.d.ts +0 -2
- package/lib/modules/OpenData/utils.js +0 -111
- package/lib/modules/Quotation/index.d.ts +0 -48
- package/lib/modules/Quotation/index.js +0 -152
- package/lib/modules/Quotation/types.d.ts +0 -42
- package/lib/modules/Quotation/types.js +0 -17
- package/lib/modules/SalesSummary/index.d.ts +0 -63
- package/lib/modules/SalesSummary/index.js +0 -105
- package/lib/modules/SalesSummary/types.d.ts +0 -60
- package/lib/modules/SalesSummary/types.js +0 -17
- package/lib/modules/SalesSummary/utils.d.ts +0 -30
- package/lib/modules/SalesSummary/utils.js +0 -420
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -23
- package/lib/modules/ScanOrderLogger/index.js +0 -147
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/providers/feishu.js +0 -157
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/providers/grafana.js +0 -52
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -53
- package/lib/modules/ScanOrderLogger/types.js +0 -17
- package/lib/solution/ScanOrder/index.d.ts +0 -158
- package/lib/solution/ScanOrder/index.js +0 -2135
- package/lib/solution/ScanOrder/types.d.ts +0 -306
- package/lib/solution/ScanOrder/types.js +0 -36
- package/lib/solution/ScanOrder/utils.d.ts +0 -172
- package/lib/solution/ScanOrder/utils.js +0 -658
- package/lib/solution/VenueBooking/index.d.ts +0 -252
- package/lib/solution/VenueBooking/index.js +0 -2204
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -343
- package/lib/solution/VenueBooking/types.d.ts +0 -156
- package/lib/solution/VenueBooking/types.js +0 -45
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
- package/lib/solution/VenueBooking/utils/dateSummary.js +0 -105
- package/lib/solution/VenueBooking/utils/resource.d.ts +0 -14
- package/lib/solution/VenueBooking/utils/resource.js +0 -92
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -32
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -236
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -71
- package/lib/solution/VenueBooking/utils/smartPricing.js +0 -225
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -34
- package/lib/solution/VenueBooking/utils/timeSlot.js +0 -343
- package/lib/solution/VenueBooking/utils.d.ts +0 -1
- package/lib/solution/VenueBooking/utils.js +0 -69
|
@@ -28,6 +28,7 @@ export interface RulesModuleAPI {
|
|
|
28
28
|
calcDiscount: (params: {
|
|
29
29
|
discountList: any[];
|
|
30
30
|
productList: any[];
|
|
31
|
+
orderTotalAmount: number;
|
|
31
32
|
holders: {
|
|
32
33
|
form_record_id: number;
|
|
33
34
|
}[];
|
|
@@ -66,6 +67,7 @@ export interface RulesParamsHooks {
|
|
|
66
67
|
quantity?: number;
|
|
67
68
|
bundle?: any[];
|
|
68
69
|
main_product_selling_price?: string | number;
|
|
70
|
+
options?: any[];
|
|
69
71
|
}) => Record<string, any>;
|
|
70
72
|
}
|
|
71
73
|
export {};
|
|
@@ -6,11 +6,6 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
|
|
|
6
6
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
7
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
8
|
import dayjs from "dayjs";
|
|
9
|
-
import isSameOrAfter from "dayjs/plugin/isSameOrAfter";
|
|
10
|
-
import isSameOrBefore from "dayjs/plugin/isSameOrBefore";
|
|
11
|
-
dayjs.extend(isSameOrAfter);
|
|
12
|
-
dayjs.extend(isSameOrBefore);
|
|
13
|
-
|
|
14
9
|
// 获取时间是否在日程范围内
|
|
15
10
|
export var getDateIsInSchedule = function getDateIsInSchedule(dateTime, scheduleList) {
|
|
16
11
|
if (!dateTime || !scheduleList || scheduleList.length === 0) {
|
|
@@ -65,8 +60,8 @@ var isInStandardSchedule = function isInStandardSchedule(targetDate, targetDateS
|
|
|
65
60
|
var startDate = dayjs(schedule.start_time);
|
|
66
61
|
var endDate = dayjs(schedule.end_time);
|
|
67
62
|
|
|
68
|
-
//
|
|
69
|
-
var isInBasicRange = targetDate.isSameOrAfter(startDate) && targetDate.
|
|
63
|
+
// 先检查是否在基础时间范围内(不考虑重复)
|
|
64
|
+
var isInBasicRange = targetDate.isSameOrAfter(startDate) && targetDate.isSameOrBefore(endDate);
|
|
70
65
|
if (schedule.repeat_type === 'none') {
|
|
71
66
|
return isInBasicRange;
|
|
72
67
|
}
|
|
@@ -80,18 +75,24 @@ var isInTimeSlotsSchedule = function isInTimeSlotsSchedule(targetDate, targetDat
|
|
|
80
75
|
if (!schedule.start_time) {
|
|
81
76
|
return false;
|
|
82
77
|
}
|
|
83
|
-
var
|
|
84
|
-
|
|
78
|
+
var scheduleDate = schedule.start_time.split(' ')[0];
|
|
79
|
+
|
|
80
|
+
// 检查日期是否匹配
|
|
81
|
+
if (targetDateString !== scheduleDate) {
|
|
85
82
|
return false;
|
|
86
83
|
}
|
|
84
|
+
|
|
85
|
+
// 检查是否在任一时间段内
|
|
87
86
|
var _iterator2 = _createForOfIteratorHelper(schedule.time_slot),
|
|
88
87
|
_step2;
|
|
89
88
|
try {
|
|
90
89
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
91
90
|
var timeSlot = _step2.value;
|
|
92
|
-
var slotStart =
|
|
93
|
-
var slotEnd =
|
|
94
|
-
|
|
91
|
+
var slotStart = "".concat(scheduleDate, " ").concat(timeSlot.start_time, ":00");
|
|
92
|
+
var slotEnd = "".concat(scheduleDate, " ").concat(timeSlot.end_time, ":00");
|
|
93
|
+
var slotStartDate = dayjs(slotStart);
|
|
94
|
+
var slotEndDate = dayjs(slotEnd);
|
|
95
|
+
if (targetDate.isSameOrAfter(slotStartDate) && targetDate.isSameOrBefore(slotEndDate)) {
|
|
95
96
|
return true;
|
|
96
97
|
}
|
|
97
98
|
}
|
|
@@ -119,7 +120,7 @@ var isInDesignationSchedule = function isInDesignationSchedule(targetDate, targe
|
|
|
119
120
|
var endDateTime = "".concat(designation.end_date, " ").concat(designation.end_time, ":00");
|
|
120
121
|
var startDate = dayjs(startDateTime);
|
|
121
122
|
var endDate = dayjs(endDateTime);
|
|
122
|
-
if (targetDate.isSameOrAfter(startDate) && targetDate.
|
|
123
|
+
if (targetDate.isSameOrAfter(startDate) && targetDate.isSameOrBefore(endDate)) {
|
|
123
124
|
return true;
|
|
124
125
|
}
|
|
125
126
|
}
|
|
@@ -217,8 +218,9 @@ var isInDailyRepeat = function isInDailyRepeat(targetDate, startDate, endDate, r
|
|
|
217
218
|
var startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
|
|
218
219
|
var endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
|
|
219
220
|
|
|
220
|
-
// 每日重复:每天都在相同的时间段内有效
|
|
221
|
-
|
|
221
|
+
// 每日重复:每天都在相同的时间段内有效
|
|
222
|
+
// 例如:01:00:00 - 16:00:00,每天都是这个时间段
|
|
223
|
+
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay <= endTimeOfDay;
|
|
222
224
|
};
|
|
223
225
|
|
|
224
226
|
// 每周重复逻辑
|
|
@@ -245,7 +247,7 @@ var isInWeeklyRepeat = function isInWeeklyRepeat(targetDate, startDate, endDate,
|
|
|
245
247
|
var targetTimeOfDay = targetDate.hour() * 3600 + targetDate.minute() * 60 + targetDate.second();
|
|
246
248
|
var startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
|
|
247
249
|
var endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
|
|
248
|
-
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay
|
|
250
|
+
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay <= endTimeOfDay;
|
|
249
251
|
};
|
|
250
252
|
|
|
251
253
|
// 日程时间段类型
|
|
@@ -46,7 +46,7 @@ export declare const formatScheduleResult: (schedule: ScheduleItem) => {
|
|
|
46
46
|
};
|
|
47
47
|
export declare const calcScheduleDateRange: (schedule: ScheduleItem) => any[];
|
|
48
48
|
export declare const calcCalendarDataBySchedules: (schedules: ScheduleItem[]) => unknown[];
|
|
49
|
-
export declare const calcMinTimeMaxTimeBySchedules: (schedules: ScheduleItem[], scheduleAllMap?: ScheduleAllMap, selectDate?: string) =>
|
|
49
|
+
export declare const calcMinTimeMaxTimeBySchedules: (schedules: ScheduleItem[], scheduleAllMap?: ScheduleAllMap, selectDate?: string) => {};
|
|
50
50
|
/**
|
|
51
51
|
* @title: 格式化日程数据
|
|
52
52
|
* @description:
|
|
@@ -7,8 +7,8 @@ export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], i
|
|
|
7
7
|
* @param item
|
|
8
8
|
*/
|
|
9
9
|
export declare const getBundleDiscountList: (bundle: any[]) => any[];
|
|
10
|
-
export declare const calcDiscountListDifference: (discountList: any[]) =>
|
|
11
|
-
export declare const getProductDiscountProductDiscountDifference: (item: CartItem) =>
|
|
10
|
+
export declare const calcDiscountListDifference: (discountList: any[]) => any;
|
|
11
|
+
export declare const getProductDiscountProductDiscountDifference: (item: CartItem) => any;
|
|
12
12
|
/**
|
|
13
13
|
* 计算订单税费(折扣前/折扣后),并把单品税费信息回写到商品数据上(用于明细展示/后续计算)。
|
|
14
14
|
*
|
|
@@ -58,6 +58,12 @@ export declare const getTax: ({ service, addons, bookingDetail, bookingId }: {
|
|
|
58
58
|
* @returns 商品总价字符串,保留2位小数
|
|
59
59
|
*/
|
|
60
60
|
export declare const calculateSubtotal: (items: CartItem[]) => string;
|
|
61
|
+
/**
|
|
62
|
+
* 计算商品小计(不含其他费用 不包含折扣卡商品券抵扣金额)
|
|
63
|
+
* @param items - 购物车商品数组
|
|
64
|
+
* @returns 商品总价字符串,保留2位小数
|
|
65
|
+
*/
|
|
66
|
+
export declare const calculateOriginSubtotal: (items: CartItem[]) => string;
|
|
61
67
|
/**
|
|
62
68
|
* @title: 单个商品的税费
|
|
63
69
|
* @description:
|
|
@@ -94,7 +100,7 @@ export declare const calculateDeposit: (items: CartItem[]) => {
|
|
|
94
100
|
export declare const getSurchargeAmount: ({ bookingDetail, bookingId }: {
|
|
95
101
|
bookingDetail?: any;
|
|
96
102
|
bookingId?: number | undefined;
|
|
97
|
-
}, surcharge: any[], options: any) =>
|
|
103
|
+
}, surcharge: any[], options: any) => any;
|
|
98
104
|
/**
|
|
99
105
|
* 订单附加费各项信息
|
|
100
106
|
*
|
|
@@ -20,6 +20,7 @@ import { isNormalProduct } from "../Product/utils";
|
|
|
20
20
|
import dayjs from 'dayjs';
|
|
21
21
|
export var calculatePriceDetails = function calculatePriceDetails(shopInfo, items, isInScheduleByDate, surchargeList, scheduleById) {
|
|
22
22
|
var subtotal = new Decimal(calculateSubtotal(items));
|
|
23
|
+
var subOriginTotal = new Decimal(calculateOriginSubtotal(items));
|
|
23
24
|
var totalTaxFee = new Decimal(calculateTaxFee(shopInfo, items));
|
|
24
25
|
// 订单附加费列表
|
|
25
26
|
var surcharge = getSurcharge({
|
|
@@ -58,11 +59,15 @@ export var calculatePriceDetails = function calculatePriceDetails(shopInfo, item
|
|
|
58
59
|
originTax = _getTax.originTax;
|
|
59
60
|
var total = shopInfo !== null && shopInfo !== void 0 && shopInfo.is_price_include_tax ? subtotal.plus(surchargeAmount) : subtotal.plus(tax).plus(surchargeAmount);
|
|
60
61
|
|
|
62
|
+
// 计算总价 不包含折扣卡商品券折扣信息价格
|
|
63
|
+
var originTotal = shopInfo !== null && shopInfo !== void 0 && shopInfo.is_price_include_tax ? subOriginTotal : subOriginTotal.plus(totalTaxFee);
|
|
64
|
+
|
|
61
65
|
// 计算定金
|
|
62
66
|
var deposit = calculateDeposit(items);
|
|
63
67
|
return {
|
|
64
68
|
subtotal: subtotal.toFixed(2),
|
|
65
69
|
total: total.toFixed(2),
|
|
70
|
+
originTotal: originTotal.toFixed(2),
|
|
66
71
|
taxTitle: shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.tax_title,
|
|
67
72
|
taxRate: shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.tax_rate,
|
|
68
73
|
totalTaxFee: tax,
|
|
@@ -94,8 +99,8 @@ export var getBundleDiscountList = function getBundleDiscountList(bundle) {
|
|
|
94
99
|
export var calcDiscountListDifference = function calcDiscountListDifference(discountList) {
|
|
95
100
|
return discountList.reduce(function (pre, cur) {
|
|
96
101
|
var _cur$metadata;
|
|
97
|
-
return pre
|
|
98
|
-
},
|
|
102
|
+
return pre + ((cur === null || cur === void 0 || (_cur$metadata = cur.metadata) === null || _cur$metadata === void 0 ? void 0 : _cur$metadata.product_discount_difference) || 0);
|
|
103
|
+
}, 0);
|
|
99
104
|
};
|
|
100
105
|
export var getProductDiscountProductDiscountDifference = function getProductDiscountProductDiscountDifference(item) {
|
|
101
106
|
var _item$_origin, _item$_origin2;
|
|
@@ -572,6 +577,22 @@ export var calculateSubtotal = function calculateSubtotal(items) {
|
|
|
572
577
|
return subtotal.toFixed(2);
|
|
573
578
|
};
|
|
574
579
|
|
|
580
|
+
/**
|
|
581
|
+
* 计算商品小计(不含其他费用 不包含折扣卡商品券抵扣金额)
|
|
582
|
+
* @param items - 购物车商品数组
|
|
583
|
+
* @returns 商品总价字符串,保留2位小数
|
|
584
|
+
*/
|
|
585
|
+
export var calculateOriginSubtotal = function calculateOriginSubtotal(items) {
|
|
586
|
+
if (!(items !== null && items !== void 0 && items.length)) {
|
|
587
|
+
return '0.00';
|
|
588
|
+
}
|
|
589
|
+
var subtotal = items.reduce(function (sum, item) {
|
|
590
|
+
var cartItemTotalPrice = new Decimal(item.summaryOriginTotal || 0);
|
|
591
|
+
return sum.plus(cartItemTotalPrice);
|
|
592
|
+
}, new Decimal(0));
|
|
593
|
+
return subtotal.toFixed(2);
|
|
594
|
+
};
|
|
595
|
+
|
|
575
596
|
/**
|
|
576
597
|
* @title: 单个商品的税费
|
|
577
598
|
* @description:
|
|
@@ -595,27 +616,6 @@ export var calculateTaxFee = function calculateTaxFee(shopInfo, items) {
|
|
|
595
616
|
}, new Decimal(0));
|
|
596
617
|
return totalTaxFee;
|
|
597
618
|
};
|
|
598
|
-
var getCartItemDepositData = function getCartItemDepositData(item) {
|
|
599
|
-
var _target$_productOrigi, _target$_origin, _target$_origin2;
|
|
600
|
-
var target = item;
|
|
601
|
-
return (target === null || target === void 0 || (_target$_productOrigi = target._productOrigin) === null || _target$_productOrigi === void 0 ? void 0 : _target$_productOrigi.custom_deposit_data) || (target === null || target === void 0 || (_target$_origin = target._origin) === null || _target$_origin === void 0 ? void 0 : _target$_origin.custom_deposit_data) || (target === null || target === void 0 || (_target$_origin2 = target._origin) === null || _target$_origin2 === void 0 || (_target$_origin2 = _target$_origin2.product) === null || _target$_origin2 === void 0 ? void 0 : _target$_origin2.custom_deposit_data);
|
|
602
|
-
};
|
|
603
|
-
var getCartItemQuantity = function getCartItemQuantity(item) {
|
|
604
|
-
return new Decimal((item === null || item === void 0 ? void 0 : item.num) || 1);
|
|
605
|
-
};
|
|
606
|
-
var calculateCartItemDepositTotal = function calculateCartItemDepositTotal(item) {
|
|
607
|
-
var _item$deposit;
|
|
608
|
-
var depositData = getCartItemDepositData(item);
|
|
609
|
-
if ((depositData === null || depositData === void 0 ? void 0 : depositData.has_deposit) == 1 && typeof (depositData === null || depositData === void 0 ? void 0 : depositData.deposit_fixed) === 'string' && typeof (depositData === null || depositData === void 0 ? void 0 : depositData.deposit_percentage) === 'string') {
|
|
610
|
-
var _ref7, _summaryTotal;
|
|
611
|
-
var lineTotal = new Decimal((_ref7 = (_summaryTotal = item.summaryTotal) !== null && _summaryTotal !== void 0 ? _summaryTotal : item.total) !== null && _ref7 !== void 0 ? _ref7 : 0);
|
|
612
|
-
var quantity = getCartItemQuantity(item);
|
|
613
|
-
var fixedTotal = new Decimal(depositData.deposit_fixed || 0).times(quantity);
|
|
614
|
-
var percentageTotal = new Decimal(depositData.deposit_percentage || 0).times(lineTotal);
|
|
615
|
-
return fixedTotal.plus(percentageTotal);
|
|
616
|
-
}
|
|
617
|
-
return new Decimal((item === null || item === void 0 || (_item$deposit = item.deposit) === null || _item$deposit === void 0 ? void 0 : _item$deposit.total) || 0);
|
|
618
|
-
};
|
|
619
619
|
|
|
620
620
|
/**
|
|
621
621
|
* @title: 计算定金
|
|
@@ -630,9 +630,9 @@ export var calculateDeposit = function calculateDeposit(items) {
|
|
|
630
630
|
var hasDeposit = false;
|
|
631
631
|
var total = items.reduce(function (sum, item) {
|
|
632
632
|
if (item !== null && item !== void 0 && item.deposit) {
|
|
633
|
-
var _item$deposit2;
|
|
633
|
+
var _item$deposit, _item$deposit2;
|
|
634
634
|
hasDeposit = true;
|
|
635
|
-
var cartItemTotalPrice =
|
|
635
|
+
var cartItemTotalPrice = new Decimal((item === null || item === void 0 || (_item$deposit = item.deposit) === null || _item$deposit === void 0 ? void 0 : _item$deposit.total) || 0);
|
|
636
636
|
// 将协议数据去重合并
|
|
637
637
|
item === null || item === void 0 || (_item$deposit2 = item.deposit) === null || _item$deposit2 === void 0 || (_item$deposit2 = _item$deposit2.protocols) === null || _item$deposit2 === void 0 || _item$deposit2.forEach(function (protocol) {
|
|
638
638
|
if (protocols.findIndex(function (p) {
|
|
@@ -669,9 +669,9 @@ export var calculateDeposit = function calculateDeposit(items) {
|
|
|
669
669
|
* @param options.isEdit 是否处于“编辑中”。`false` 时会优先走后端金额直取逻辑(若存在)
|
|
670
670
|
* @returns 订单附加费金额(number,金额单位与商品价格一致)
|
|
671
671
|
*/
|
|
672
|
-
export var getSurchargeAmount = function getSurchargeAmount(
|
|
673
|
-
var bookingDetail =
|
|
674
|
-
bookingId =
|
|
672
|
+
export var getSurchargeAmount = function getSurchargeAmount(_ref7, surcharge, options) {
|
|
673
|
+
var bookingDetail = _ref7.bookingDetail,
|
|
674
|
+
bookingId = _ref7.bookingId;
|
|
675
675
|
var isEdit = options.isEdit;
|
|
676
676
|
// 订单未变更过
|
|
677
677
|
if (!isEdit) {
|
|
@@ -683,8 +683,8 @@ export var getSurchargeAmount = function getSurchargeAmount(_ref8, surcharge, op
|
|
|
683
683
|
if (!Array.isArray(surcharge)) return 0;
|
|
684
684
|
// 新增状态使用 getSurcharge 的返回值进行求和
|
|
685
685
|
return surcharge.reduce(function (total, item) {
|
|
686
|
-
return total
|
|
687
|
-
},
|
|
686
|
+
return total + (item.value || 0);
|
|
687
|
+
}, 0);
|
|
688
688
|
};
|
|
689
689
|
|
|
690
690
|
// bundle商品是否是原价
|
|
@@ -716,30 +716,20 @@ var getDiscountAmount = function getDiscountAmount(discounts) {
|
|
|
716
716
|
* 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
|
|
717
717
|
*/
|
|
718
718
|
var getMainProductTotal = function getMainProductTotal(item) {
|
|
719
|
-
var
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
})) || [];
|
|
734
|
-
var mainProductDiscountAmount = getDiscountAmount(discount);
|
|
735
|
-
total = total.minus(mainProductDiscountAmount);
|
|
736
|
-
|
|
737
|
-
// 单规格
|
|
738
|
-
if (item !== null && item !== void 0 && item.option && Array.isArray(item === null || item === void 0 ? void 0 : item.option)) {
|
|
739
|
-
total = total.add(item === null || item === void 0 ? void 0 : item.option.reduce(function (t, option) {
|
|
740
|
-
return t.add(new Decimal(option.price || 0).mul(option.num || 1));
|
|
741
|
-
}, new Decimal(0)));
|
|
742
|
-
}
|
|
719
|
+
var _ref8, _ref9, _item$main_product_se, _item$metadata, _item$_origin3, _item$_originData;
|
|
720
|
+
var total = new Decimal((_ref8 = (_ref9 = (_item$main_product_se = item === null || item === void 0 ? void 0 : item.main_product_selling_price) !== null && _item$main_product_se !== void 0 ? _item$main_product_se : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.main_product_selling_price) !== null && _ref9 !== void 0 ? _ref9 : item.price) !== null && _ref8 !== void 0 ? _ref8 : 0);
|
|
721
|
+
var discount = (item === null || item === void 0 || (_item$_origin3 = item._origin) === null || _item$_origin3 === void 0 || (_item$_origin3 = _item$_origin3.product) === null || _item$_origin3 === void 0 ? void 0 : _item$_origin3.discount_list) || (item === null || item === void 0 || (_item$_originData = item._originData) === null || _item$_originData === void 0 || (_item$_originData = _item$_originData.product) === null || _item$_originData === void 0 || (_item$_originData = _item$_originData.discount_list) === null || _item$_originData === void 0 ? void 0 : _item$_originData.filter(function (item) {
|
|
722
|
+
var _item$metadata2;
|
|
723
|
+
return !(item !== null && item !== void 0 && (_item$metadata2 = item.metadata) !== null && _item$metadata2 !== void 0 && _item$metadata2.custom_product_bundle_map_id);
|
|
724
|
+
})) || [];
|
|
725
|
+
var mainProductDiscountAmount = getDiscountAmount(discount);
|
|
726
|
+
total = total.minus(mainProductDiscountAmount);
|
|
727
|
+
|
|
728
|
+
// 单规格
|
|
729
|
+
if (item !== null && item !== void 0 && item.option && Array.isArray(item === null || item === void 0 ? void 0 : item.option)) {
|
|
730
|
+
total = total.add(item === null || item === void 0 ? void 0 : item.option.reduce(function (t, option) {
|
|
731
|
+
return t.add(new Decimal(option.price || 0).mul(option.num || 1));
|
|
732
|
+
}, new Decimal(0)));
|
|
743
733
|
}
|
|
744
734
|
var _iterator4 = _createForOfIteratorHelper((item === null || item === void 0 ? void 0 : item.bundle) || []),
|
|
745
735
|
_step4;
|
|
@@ -747,9 +737,9 @@ var getMainProductTotal = function getMainProductTotal(item) {
|
|
|
747
737
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
748
738
|
var bundleItem = _step4.value;
|
|
749
739
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
750
|
-
var
|
|
751
|
-
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price
|
|
752
|
-
var bundleItemTotal = new Decimal((
|
|
740
|
+
var _ref10, _bundleItem$bundle_se2;
|
|
741
|
+
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price和 price 其实都已经是折后价格了,不需要单独再减一次
|
|
742
|
+
var bundleItemTotal = new Decimal((_ref10 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref10 !== void 0 ? _ref10 : 0);
|
|
753
743
|
total = total.add(bundleItemTotal);
|
|
754
744
|
}
|
|
755
745
|
}
|
|
@@ -869,12 +859,12 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
|
|
|
869
859
|
* @param options.scheduleById schedule 映射表:`{ [scheduleId]: schedule }`(用于根据配置的 `available_schedule_ids` 做日程匹配)
|
|
870
860
|
* @returns 附加费列表(仅返回金额 > 0 的项)
|
|
871
861
|
*/
|
|
872
|
-
export var getSurcharge = function getSurcharge(
|
|
862
|
+
export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
873
863
|
var _service$filter;
|
|
874
|
-
var service =
|
|
875
|
-
addons =
|
|
876
|
-
bookingDetail =
|
|
877
|
-
bookingId =
|
|
864
|
+
var service = _ref11.service,
|
|
865
|
+
addons = _ref11.addons,
|
|
866
|
+
bookingDetail = _ref11.bookingDetail,
|
|
867
|
+
bookingId = _ref11.bookingId;
|
|
878
868
|
var isEdit = options.isEdit,
|
|
879
869
|
isInScheduleByDate = options.isInScheduleByDate,
|
|
880
870
|
surcharge_list = options.surcharge_list,
|
|
@@ -996,11 +986,11 @@ export var getSurcharge = function getSurcharge(_ref14, options) {
|
|
|
996
986
|
scheduleById: scheduleById || {},
|
|
997
987
|
isInScheduleByDate: isInScheduleByDate
|
|
998
988
|
})) {
|
|
999
|
-
var
|
|
989
|
+
var _ref12, _bundleItem$bundle_se3;
|
|
1000
990
|
var _mainQuantity = item.num || 1;
|
|
1001
991
|
matchedItems.push({
|
|
1002
992
|
isMain: false,
|
|
1003
|
-
total: Number((
|
|
993
|
+
total: Number((_ref12 = (_bundleItem$bundle_se3 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se3 !== void 0 ? _bundleItem$bundle_se3 : bundleItem.price) !== null && _ref12 !== void 0 ? _ref12 : 0),
|
|
1004
994
|
quantity: bundleItem.num || bundleItem.quantity || 1,
|
|
1005
995
|
item: bundleItem,
|
|
1006
996
|
mainQuantity: _mainQuantity // 子商品的mainQuantity是所属主商品的quantity
|
|
@@ -1216,9 +1206,9 @@ export var getSurcharge = function getSurcharge(_ref14, options) {
|
|
|
1216
1206
|
}
|
|
1217
1207
|
return surchargeWithAmount;
|
|
1218
1208
|
};
|
|
1219
|
-
function resetItemsSurchargeSideEffects(
|
|
1220
|
-
var service =
|
|
1221
|
-
addons =
|
|
1209
|
+
function resetItemsSurchargeSideEffects(_ref13) {
|
|
1210
|
+
var service = _ref13.service,
|
|
1211
|
+
addons = _ref13.addons;
|
|
1222
1212
|
var resetItem = function resetItem(item) {
|
|
1223
1213
|
if (!item) return;
|
|
1224
1214
|
item.surcharge_fee = 0;
|
package/dist/modules/index.d.ts
CHANGED
|
@@ -11,8 +11,4 @@ export * from './Payment';
|
|
|
11
11
|
export * from './Resource';
|
|
12
12
|
export * from './Step';
|
|
13
13
|
export * from './Summary';
|
|
14
|
-
export * from './SalesSummary';
|
|
15
14
|
export * from './Schedule';
|
|
16
|
-
export * from './Quotation';
|
|
17
|
-
export * from './ScanOrderLogger';
|
|
18
|
-
export * from './OpenData';
|
package/dist/modules/index.js
CHANGED
|
@@ -11,8 +11,4 @@ export * from "./Payment";
|
|
|
11
11
|
export * from "./Resource";
|
|
12
12
|
export * from "./Step";
|
|
13
13
|
export * from "./Summary";
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./Schedule";
|
|
16
|
-
export * from "./Quotation";
|
|
17
|
-
export * from "./ScanOrderLogger";
|
|
18
|
-
export * from "./OpenData";
|
|
14
|
+
export * from "./Schedule";
|
package/dist/plugins/window.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WalletPassEvaluator } from '../model';
|
|
1
2
|
import { Plugin } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* WindowPlugin 接口定义
|
|
@@ -14,6 +15,7 @@ export interface WindowPlugin extends Plugin {
|
|
|
14
15
|
document: Partial<Document>;
|
|
15
16
|
history: History;
|
|
16
17
|
interaction?: any;
|
|
18
|
+
getWalletPassEvaluator?: () => WalletPassEvaluator;
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
21
|
* 简单的 Storage 接口实现
|
|
@@ -144,6 +144,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
144
144
|
getSummary(): Promise<{
|
|
145
145
|
subtotal: string | number;
|
|
146
146
|
total: string | number;
|
|
147
|
+
originTotal: string | number;
|
|
147
148
|
taxTitle?: string | undefined;
|
|
148
149
|
totalTaxFee?: string | number | undefined;
|
|
149
150
|
isPriceIncludeTax?: 0 | 1 | undefined;
|
|
@@ -301,7 +302,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
301
302
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
302
303
|
errorList: any[];
|
|
303
304
|
};
|
|
304
|
-
getTimeSlotByAllResources(resources_code: string
|
|
305
|
+
getTimeSlotByAllResources(resources_code: string): any[];
|
|
305
306
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
306
307
|
resources_code: string;
|
|
307
308
|
startDate: string;
|
|
@@ -310,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
310
311
|
date: string;
|
|
311
312
|
status: string;
|
|
312
313
|
week: string;
|
|
313
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 1 | 2 | 5 | 3 | 4 | 6;
|
|
314
315
|
}[]>;
|
|
315
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
316
317
|
private getScheduleDataByIds;
|