@pisell/pisellos 2.1.150 → 2.1.151
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 -0
- package/dist/index.js +1 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +99 -26
- 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/Discount/index.d.ts +2 -6
- package/dist/modules/Discount/index.js +8 -14
- package/dist/modules/Discount/types.d.ts +19 -1
- package/dist/modules/Order/index.d.ts +1 -65
- package/dist/modules/Order/index.js +30 -901
- package/dist/modules/Order/types.d.ts +12 -174
- 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 +1 -1
- package/dist/modules/ProductList/index.js +3 -4
- package/dist/modules/Rules/index.d.ts +9 -5
- package/dist/modules/Rules/index.js +677 -168
- package/dist/modules/Rules/types.d.ts +2 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +18 -11
- 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 +52 -41
- 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 -2
- package/dist/solution/ShopDiscount/index.js +41 -37
- 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 -0
- package/lib/index.js +3 -1
- package/lib/model/strategy/adapter/promotion/evaluator.js +57 -8
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- 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/Discount/index.d.ts +2 -6
- package/lib/modules/Discount/index.js +1 -3
- package/lib/modules/Discount/types.d.ts +19 -1
- package/lib/modules/Order/index.d.ts +1 -65
- package/lib/modules/Order/index.js +1 -513
- package/lib/modules/Order/types.d.ts +12 -174
- 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 +1 -1
- package/lib/modules/ProductList/index.js +3 -5
- package/lib/modules/Rules/index.d.ts +9 -5
- package/lib/modules/Rules/index.js +780 -288
- package/lib/modules/Rules/types.d.ts +2 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +11 -9
- 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 +31 -22
- 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 -2
- package/lib/solution/ShopDiscount/index.js +24 -16
- 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 +1 -1
- package/dist/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +0 -1
- 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 -152
- package/dist/solution/ScanOrder/index.js +0 -3132
- package/dist/solution/ScanOrder/types.d.ts +0 -287
- package/dist/solution/ScanOrder/types.js +0 -35
- package/dist/solution/ScanOrder/utils.d.ts +0 -167
- package/dist/solution/ScanOrder/utils.js +0 -764
- package/dist/solution/VenueBooking/index.d.ts +0 -199
- package/dist/solution/VenueBooking/index.js +0 -3459
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -343
- package/dist/solution/VenueBooking/types.d.ts +0 -154
- package/dist/solution/VenueBooking/types.js +0 -21
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
- package/dist/solution/VenueBooking/utils/dateSummary.js +0 -104
- 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 -38
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -239
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -32
- package/dist/solution/VenueBooking/utils/timeSlot.js +0 -453
- 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/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 -152
- package/lib/solution/ScanOrder/index.js +0 -1901
- package/lib/solution/ScanOrder/types.d.ts +0 -287
- package/lib/solution/ScanOrder/types.js +0 -36
- package/lib/solution/ScanOrder/utils.d.ts +0 -167
- package/lib/solution/ScanOrder/utils.js +0 -635
- package/lib/solution/VenueBooking/index.d.ts +0 -199
- package/lib/solution/VenueBooking/index.js +0 -1926
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -343
- package/lib/solution/VenueBooking/types.d.ts +0 -154
- package/lib/solution/VenueBooking/types.js +0 -44
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
- package/lib/solution/VenueBooking/utils/dateSummary.js +0 -110
- 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 -38
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -237
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -32
- package/lib/solution/VenueBooking/utils/timeSlot.js +0 -339
- 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 {};
|
|
@@ -60,8 +60,8 @@ var isInStandardSchedule = function isInStandardSchedule(targetDate, targetDateS
|
|
|
60
60
|
var startDate = dayjs(schedule.start_time);
|
|
61
61
|
var endDate = dayjs(schedule.end_time);
|
|
62
62
|
|
|
63
|
-
//
|
|
64
|
-
var isInBasicRange = targetDate.isSameOrAfter(startDate) && targetDate.
|
|
63
|
+
// 先检查是否在基础时间范围内(不考虑重复)
|
|
64
|
+
var isInBasicRange = targetDate.isSameOrAfter(startDate) && targetDate.isSameOrBefore(endDate);
|
|
65
65
|
if (schedule.repeat_type === 'none') {
|
|
66
66
|
return isInBasicRange;
|
|
67
67
|
}
|
|
@@ -75,18 +75,24 @@ var isInTimeSlotsSchedule = function isInTimeSlotsSchedule(targetDate, targetDat
|
|
|
75
75
|
if (!schedule.start_time) {
|
|
76
76
|
return false;
|
|
77
77
|
}
|
|
78
|
-
var
|
|
79
|
-
|
|
78
|
+
var scheduleDate = schedule.start_time.split(' ')[0];
|
|
79
|
+
|
|
80
|
+
// 检查日期是否匹配
|
|
81
|
+
if (targetDateString !== scheduleDate) {
|
|
80
82
|
return false;
|
|
81
83
|
}
|
|
84
|
+
|
|
85
|
+
// 检查是否在任一时间段内
|
|
82
86
|
var _iterator2 = _createForOfIteratorHelper(schedule.time_slot),
|
|
83
87
|
_step2;
|
|
84
88
|
try {
|
|
85
89
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
86
90
|
var timeSlot = _step2.value;
|
|
87
|
-
var slotStart =
|
|
88
|
-
var slotEnd =
|
|
89
|
-
|
|
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)) {
|
|
90
96
|
return true;
|
|
91
97
|
}
|
|
92
98
|
}
|
|
@@ -114,7 +120,7 @@ var isInDesignationSchedule = function isInDesignationSchedule(targetDate, targe
|
|
|
114
120
|
var endDateTime = "".concat(designation.end_date, " ").concat(designation.end_time, ":00");
|
|
115
121
|
var startDate = dayjs(startDateTime);
|
|
116
122
|
var endDate = dayjs(endDateTime);
|
|
117
|
-
if (targetDate.isSameOrAfter(startDate) && targetDate.
|
|
123
|
+
if (targetDate.isSameOrAfter(startDate) && targetDate.isSameOrBefore(endDate)) {
|
|
118
124
|
return true;
|
|
119
125
|
}
|
|
120
126
|
}
|
|
@@ -212,8 +218,9 @@ var isInDailyRepeat = function isInDailyRepeat(targetDate, startDate, endDate, r
|
|
|
212
218
|
var startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
|
|
213
219
|
var endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
|
|
214
220
|
|
|
215
|
-
// 每日重复:每天都在相同的时间段内有效
|
|
216
|
-
|
|
221
|
+
// 每日重复:每天都在相同的时间段内有效
|
|
222
|
+
// 例如:01:00:00 - 16:00:00,每天都是这个时间段
|
|
223
|
+
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay <= endTimeOfDay;
|
|
217
224
|
};
|
|
218
225
|
|
|
219
226
|
// 每周重复逻辑
|
|
@@ -240,7 +247,7 @@ var isInWeeklyRepeat = function isInWeeklyRepeat(targetDate, startDate, endDate,
|
|
|
240
247
|
var targetTimeOfDay = targetDate.hour() * 3600 + targetDate.minute() * 60 + targetDate.second();
|
|
241
248
|
var startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
|
|
242
249
|
var endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
|
|
243
|
-
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay
|
|
250
|
+
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay <= endTimeOfDay;
|
|
244
251
|
};
|
|
245
252
|
|
|
246
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:
|
|
@@ -662,8 +683,8 @@ export var getSurchargeAmount = function getSurchargeAmount(_ref7, surcharge, op
|
|
|
662
683
|
if (!Array.isArray(surcharge)) return 0;
|
|
663
684
|
// 新增状态使用 getSurcharge 的返回值进行求和
|
|
664
685
|
return surcharge.reduce(function (total, item) {
|
|
665
|
-
return total
|
|
666
|
-
},
|
|
686
|
+
return total + (item.value || 0);
|
|
687
|
+
}, 0);
|
|
667
688
|
};
|
|
668
689
|
|
|
669
690
|
// bundle商品是否是原价
|
|
@@ -695,30 +716,20 @@ var getDiscountAmount = function getDiscountAmount(discounts) {
|
|
|
695
716
|
* 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
|
|
696
717
|
*/
|
|
697
718
|
var getMainProductTotal = function getMainProductTotal(item) {
|
|
698
|
-
var _ref8, _ref9, _item$main_product_se, _item$metadata, _item$
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
})) || [];
|
|
713
|
-
var mainProductDiscountAmount = getDiscountAmount(discount);
|
|
714
|
-
total = total.minus(mainProductDiscountAmount);
|
|
715
|
-
|
|
716
|
-
// 单规格
|
|
717
|
-
if (item !== null && item !== void 0 && item.option && Array.isArray(item === null || item === void 0 ? void 0 : item.option)) {
|
|
718
|
-
total = total.add(item === null || item === void 0 ? void 0 : item.option.reduce(function (t, option) {
|
|
719
|
-
return t.add(new Decimal(option.price || 0).mul(option.num || 1));
|
|
720
|
-
}, new Decimal(0)));
|
|
721
|
-
}
|
|
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)));
|
|
722
733
|
}
|
|
723
734
|
var _iterator4 = _createForOfIteratorHelper((item === null || item === void 0 ? void 0 : item.bundle) || []),
|
|
724
735
|
_step4;
|
|
@@ -726,9 +737,9 @@ var getMainProductTotal = function getMainProductTotal(item) {
|
|
|
726
737
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
727
738
|
var bundleItem = _step4.value;
|
|
728
739
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
729
|
-
var
|
|
730
|
-
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price
|
|
731
|
-
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);
|
|
732
743
|
total = total.add(bundleItemTotal);
|
|
733
744
|
}
|
|
734
745
|
}
|
|
@@ -848,12 +859,12 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
|
|
|
848
859
|
* @param options.scheduleById schedule 映射表:`{ [scheduleId]: schedule }`(用于根据配置的 `available_schedule_ids` 做日程匹配)
|
|
849
860
|
* @returns 附加费列表(仅返回金额 > 0 的项)
|
|
850
861
|
*/
|
|
851
|
-
export var getSurcharge = function getSurcharge(
|
|
862
|
+
export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
852
863
|
var _service$filter;
|
|
853
|
-
var service =
|
|
854
|
-
addons =
|
|
855
|
-
bookingDetail =
|
|
856
|
-
bookingId =
|
|
864
|
+
var service = _ref11.service,
|
|
865
|
+
addons = _ref11.addons,
|
|
866
|
+
bookingDetail = _ref11.bookingDetail,
|
|
867
|
+
bookingId = _ref11.bookingId;
|
|
857
868
|
var isEdit = options.isEdit,
|
|
858
869
|
isInScheduleByDate = options.isInScheduleByDate,
|
|
859
870
|
surcharge_list = options.surcharge_list,
|
|
@@ -975,11 +986,11 @@ export var getSurcharge = function getSurcharge(_ref13, options) {
|
|
|
975
986
|
scheduleById: scheduleById || {},
|
|
976
987
|
isInScheduleByDate: isInScheduleByDate
|
|
977
988
|
})) {
|
|
978
|
-
var
|
|
989
|
+
var _ref12, _bundleItem$bundle_se3;
|
|
979
990
|
var _mainQuantity = item.num || 1;
|
|
980
991
|
matchedItems.push({
|
|
981
992
|
isMain: false,
|
|
982
|
-
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),
|
|
983
994
|
quantity: bundleItem.num || bundleItem.quantity || 1,
|
|
984
995
|
item: bundleItem,
|
|
985
996
|
mainQuantity: _mainQuantity // 子商品的mainQuantity是所属主商品的quantity
|
|
@@ -1195,9 +1206,9 @@ export var getSurcharge = function getSurcharge(_ref13, options) {
|
|
|
1195
1206
|
}
|
|
1196
1207
|
return surchargeWithAmount;
|
|
1197
1208
|
};
|
|
1198
|
-
function resetItemsSurchargeSideEffects(
|
|
1199
|
-
var service =
|
|
1200
|
-
addons =
|
|
1209
|
+
function resetItemsSurchargeSideEffects(_ref13) {
|
|
1210
|
+
var service = _ref13.service,
|
|
1211
|
+
addons = _ref13.addons;
|
|
1201
1212
|
var resetItem = function resetItem(item) {
|
|
1202
1213
|
if (!item) return;
|
|
1203
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 | 2 | 1 | 5 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
314
315
|
}[]>;
|
|
315
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
316
317
|
private getScheduleDataByIds;
|
|
@@ -2008,7 +2008,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2008
2008
|
return n.code === resources_code;
|
|
2009
2009
|
})) === null || _productResources$fin === void 0 ? void 0 : _productResources$fin.renderList;
|
|
2010
2010
|
if (targetRenderList && targetRenderList.length > 0) {
|
|
2011
|
-
var _item$_origin$resourc2
|
|
2011
|
+
var _item$_origin$resourc2;
|
|
2012
2012
|
// 如果购物车里已经有同类型的 form_id 的资源了,则不处理
|
|
2013
2013
|
if ((_item$_origin$resourc2 = item._origin.resources) !== null && _item$_origin$resourc2 !== void 0 && _item$_origin$resourc2.some(function (n) {
|
|
2014
2014
|
return n.form_id === targetRenderList[0].form_id;
|
|
@@ -2018,9 +2018,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2018
2018
|
var fastestResource = findFastestAvailableResource({
|
|
2019
2019
|
resources: targetRenderList,
|
|
2020
2020
|
currentCapacity: currentCapacity,
|
|
2021
|
-
countMap: selectResourcesMap
|
|
2022
|
-
targetDate: dateRange === null || dateRange === void 0 || (_dateRange$5 = dateRange[0]) === null || _dateRange$5 === void 0 ? void 0 : _dateRange$5.date,
|
|
2023
|
-
durationMinutes: (item === null || item === void 0 || (_item$duration2 = item.duration) === null || _item$duration2 === void 0 ? void 0 : _item$duration2.value) || (item === null || item === void 0 || (_item$_productOrigin6 = item._productOrigin) === null || _item$_productOrigin6 === void 0 || (_item$_productOrigin6 = _item$_productOrigin6.duration) === null || _item$_productOrigin6 === void 0 ? void 0 : _item$_productOrigin6.value) || 10
|
|
2021
|
+
countMap: selectResourcesMap
|
|
2024
2022
|
});
|
|
2025
2023
|
var targetResource = fastestResource || targetRenderList[0];
|
|
2026
2024
|
targetResource.capacity = currentCapacity;
|
|
@@ -2071,7 +2069,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2071
2069
|
_cartItems$,
|
|
2072
2070
|
_cartItems$2,
|
|
2073
2071
|
_this$shopStore$get;
|
|
2074
|
-
var split = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
|
|
2075
2072
|
var dateRange = this.store.date.getDateRange();
|
|
2076
2073
|
// 取出购物车中所有一已选择的第一步资源
|
|
2077
2074
|
var resources = [];
|
|
@@ -2087,8 +2084,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2087
2084
|
var maxCutOffTime = undefined;
|
|
2088
2085
|
var maxCutOffTimeValue = dayjs();
|
|
2089
2086
|
cartItems.forEach(function (item) {
|
|
2090
|
-
var _item$
|
|
2091
|
-
(_item$
|
|
2087
|
+
var _item$_productOrigin6, _item$_productOrigin7, _item$_productOrigin8, _item$_productOrigin9;
|
|
2088
|
+
(_item$_productOrigin6 = item._productOrigin) === null || _item$_productOrigin6 === void 0 || (_item$_productOrigin6 = _item$_productOrigin6.product_resource) === null || _item$_productOrigin6 === void 0 || (_item$_productOrigin6 = _item$_productOrigin6.resources) === null || _item$_productOrigin6 === void 0 || _item$_productOrigin6.forEach(function (n) {
|
|
2092
2089
|
// TODO: 少了个 status 的判断
|
|
2093
2090
|
if (n.code === resources_code) {
|
|
2094
2091
|
resources.push.apply(resources, _toConsumableArray(n.renderList || []));
|
|
@@ -2101,10 +2098,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2101
2098
|
if (item.resource_id && !resourceIds.includes(item.resource_id)) {
|
|
2102
2099
|
resourceIds.push(item.resource_id);
|
|
2103
2100
|
}
|
|
2104
|
-
resourcesTypeId = item === null || item === void 0 || (_item$
|
|
2101
|
+
resourcesTypeId = item === null || item === void 0 || (_item$_productOrigin7 = item._productOrigin) === null || _item$_productOrigin7 === void 0 || (_item$_productOrigin7 = _item$_productOrigin7.product_resource) === null || _item$_productOrigin7 === void 0 || (_item$_productOrigin7 = _item$_productOrigin7.resources) === null || _item$_productOrigin7 === void 0 || (_item$_productOrigin7 = _item$_productOrigin7.find(function (n) {
|
|
2105
2102
|
return n.code === resources_code;
|
|
2106
|
-
})) === null || _item$
|
|
2107
|
-
if ((_item$
|
|
2103
|
+
})) === null || _item$_productOrigin7 === void 0 ? void 0 : _item$_productOrigin7.id;
|
|
2104
|
+
if ((_item$_productOrigin8 = item._productOrigin) !== null && _item$_productOrigin8 !== void 0 && _item$_productOrigin8.cut_off_time && ((_item$_productOrigin9 = item._productOrigin) === null || _item$_productOrigin9 === void 0 ? void 0 : _item$_productOrigin9.cut_off_time.type) === 'advance') {
|
|
2108
2105
|
var currentCutOffTime = dayjs().add(item._productOrigin.cut_off_time.unit, item._productOrigin.cut_off_time.unit_type);
|
|
2109
2106
|
if (currentCutOffTime.isAfter(maxCutOffTimeValue, 'minute')) {
|
|
2110
2107
|
maxCutOffTimeValue = currentCutOffTime;
|
|
@@ -2154,13 +2151,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2154
2151
|
cartItems.forEach(function (item) {
|
|
2155
2152
|
// 单个预约累加账号 多个预约取最大值
|
|
2156
2153
|
if (isSingleResource) {
|
|
2157
|
-
var _item$
|
|
2158
|
-
accountDuration += ((_item$
|
|
2154
|
+
var _item$_productOrigin10;
|
|
2155
|
+
accountDuration += ((_item$_productOrigin10 = item._productOrigin) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.duration) === null || _item$_productOrigin10 === void 0 ? void 0 : _item$_productOrigin10.value) || 10;
|
|
2159
2156
|
} else {
|
|
2160
|
-
var _item$
|
|
2161
|
-
if (accountDuration < (((_item$
|
|
2162
|
-
var _item$
|
|
2163
|
-
accountDuration = ((_item$
|
|
2157
|
+
var _item$_productOrigin11;
|
|
2158
|
+
if (accountDuration < (((_item$_productOrigin11 = item._productOrigin) === null || _item$_productOrigin11 === void 0 || (_item$_productOrigin11 = _item$_productOrigin11.duration) === null || _item$_productOrigin11 === void 0 ? void 0 : _item$_productOrigin11.value) || 10)) {
|
|
2159
|
+
var _item$_productOrigin12;
|
|
2160
|
+
accountDuration = ((_item$_productOrigin12 = item._productOrigin) === null || _item$_productOrigin12 === void 0 || (_item$_productOrigin12 = _item$_productOrigin12.duration) === null || _item$_productOrigin12 === void 0 ? void 0 : _item$_productOrigin12.value) || 10;
|
|
2164
2161
|
}
|
|
2165
2162
|
}
|
|
2166
2163
|
});
|
|
@@ -2197,8 +2194,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2197
2194
|
}
|
|
2198
2195
|
var resourcesUseableMap = {};
|
|
2199
2196
|
var hasFlexibleDuration = cartItems.some(function (item) {
|
|
2200
|
-
var _item$
|
|
2201
|
-
return ((_item$
|
|
2197
|
+
var _item$_productOrigin13;
|
|
2198
|
+
return ((_item$_productOrigin13 = item._productOrigin) === null || _item$_productOrigin13 === void 0 || (_item$_productOrigin13 = _item$_productOrigin13.duration) === null || _item$_productOrigin13 === void 0 ? void 0 : _item$_productOrigin13.type) === 'flexible';
|
|
2202
2199
|
});
|
|
2203
2200
|
var operating_day_boundary = (_this$shopStore$get = this.shopStore.get('core')) === null || _this$shopStore$get === void 0 || (_this$shopStore$get = _this$shopStore$get.core) === null || _this$shopStore$get === void 0 ? void 0 : _this$shopStore$get.operating_day_boundary;
|
|
2204
2201
|
|
|
@@ -2206,11 +2203,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2206
2203
|
var maxBlockThreshold = 0;
|
|
2207
2204
|
if (hasFlexibleDuration) {
|
|
2208
2205
|
maxBlockThreshold = cartItems.reduce(function (max, item) {
|
|
2209
|
-
var _item$
|
|
2206
|
+
var _item$_productOrigin14;
|
|
2210
2207
|
// 如果开启了灵活时长商品配置,则取 block_threshold 的值
|
|
2211
|
-
if ((_item$
|
|
2212
|
-
var _item$
|
|
2213
|
-
return Math.max(max, ((_item$
|
|
2208
|
+
if ((_item$_productOrigin14 = item._productOrigin) !== null && _item$_productOrigin14 !== void 0 && (_item$_productOrigin14 = _item$_productOrigin14.duration) !== null && _item$_productOrigin14 !== void 0 && (_item$_productOrigin14 = _item$_productOrigin14.flexible_config) !== null && _item$_productOrigin14 !== void 0 && _item$_productOrigin14.is_enable_minimum_duration) {
|
|
2209
|
+
var _item$_productOrigin15;
|
|
2210
|
+
return Math.max(max, ((_item$_productOrigin15 = item._productOrigin) === null || _item$_productOrigin15 === void 0 || (_item$_productOrigin15 = _item$_productOrigin15.duration) === null || _item$_productOrigin15 === void 0 || (_item$_productOrigin15 = _item$_productOrigin15.flexible_config) === null || _item$_productOrigin15 === void 0 ? void 0 : _item$_productOrigin15.block_threshold) || 0);
|
|
2214
2211
|
}
|
|
2215
2212
|
return 0;
|
|
2216
2213
|
}, 0);
|
|
@@ -2255,7 +2252,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2255
2252
|
resourcesMap: resourcesMap,
|
|
2256
2253
|
duration: duration,
|
|
2257
2254
|
currentDate: dateRange[0].date,
|
|
2258
|
-
split:
|
|
2255
|
+
split: 10,
|
|
2259
2256
|
resourcesUseableMap: resourcesUseableMap,
|
|
2260
2257
|
capacity: maxCapacity,
|
|
2261
2258
|
cut_off_time: maxCutOffTime,
|
|
@@ -2302,8 +2299,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2302
2299
|
maxCutOffTime = undefined;
|
|
2303
2300
|
maxCutOffTimeValue = dayjs();
|
|
2304
2301
|
cartItems.forEach(function (item) {
|
|
2305
|
-
var _item$
|
|
2306
|
-
(_item$
|
|
2302
|
+
var _item$_productOrigin16, _item$_productOrigin17, _item$_productOrigin18, _item$_productOrigin19;
|
|
2303
|
+
(_item$_productOrigin16 = item._productOrigin) === null || _item$_productOrigin16 === void 0 || (_item$_productOrigin16 = _item$_productOrigin16.product_resource) === null || _item$_productOrigin16 === void 0 || (_item$_productOrigin16 = _item$_productOrigin16.resources) === null || _item$_productOrigin16 === void 0 || _item$_productOrigin16.forEach(function (n) {
|
|
2307
2304
|
// TODO: 少了个 status 的判断
|
|
2308
2305
|
if (n.code === resources_code) {
|
|
2309
2306
|
resources.push.apply(resources, _toConsumableArray(n.renderList || []));
|
|
@@ -2316,10 +2313,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2316
2313
|
if (item.resource_id && !resourceIds.includes(item.resource_id)) {
|
|
2317
2314
|
resourceIds.push(item.resource_id);
|
|
2318
2315
|
}
|
|
2319
|
-
resourcesTypeId = item === null || item === void 0 || (_item$
|
|
2316
|
+
resourcesTypeId = item === null || item === void 0 || (_item$_productOrigin17 = item._productOrigin) === null || _item$_productOrigin17 === void 0 || (_item$_productOrigin17 = _item$_productOrigin17.product_resource) === null || _item$_productOrigin17 === void 0 || (_item$_productOrigin17 = _item$_productOrigin17.resources) === null || _item$_productOrigin17 === void 0 || (_item$_productOrigin17 = _item$_productOrigin17.find(function (n) {
|
|
2320
2317
|
return n.code === resources_code;
|
|
2321
|
-
})) === null || _item$
|
|
2322
|
-
if ((_item$
|
|
2318
|
+
})) === null || _item$_productOrigin17 === void 0 ? void 0 : _item$_productOrigin17.id;
|
|
2319
|
+
if ((_item$_productOrigin18 = item._productOrigin) !== null && _item$_productOrigin18 !== void 0 && _item$_productOrigin18.cut_off_time && ((_item$_productOrigin19 = item._productOrigin) === null || _item$_productOrigin19 === void 0 ? void 0 : _item$_productOrigin19.cut_off_time.type) === 'advance') {
|
|
2323
2320
|
var currentCutOffTime = dayjs().add(item._productOrigin.cut_off_time.unit, item._productOrigin.cut_off_time.unit_type);
|
|
2324
2321
|
if (currentCutOffTime.isAfter(maxCutOffTimeValue, 'minute')) {
|
|
2325
2322
|
maxCutOffTimeValue = currentCutOffTime;
|
|
@@ -2342,13 +2339,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2342
2339
|
cartItems.forEach(function (item) {
|
|
2343
2340
|
// 单个预约累加账号 多个预约取最大值
|
|
2344
2341
|
if (isSingleResource) {
|
|
2345
|
-
var _item$
|
|
2346
|
-
accountDuration += ((_item$
|
|
2342
|
+
var _item$_productOrigin20;
|
|
2343
|
+
accountDuration += ((_item$_productOrigin20 = item._productOrigin) === null || _item$_productOrigin20 === void 0 || (_item$_productOrigin20 = _item$_productOrigin20.duration) === null || _item$_productOrigin20 === void 0 ? void 0 : _item$_productOrigin20.value) || 10;
|
|
2347
2344
|
} else {
|
|
2348
|
-
var _item$
|
|
2349
|
-
if (accountDuration < (((_item$
|
|
2350
|
-
var _item$
|
|
2351
|
-
accountDuration = ((_item$
|
|
2345
|
+
var _item$_productOrigin21;
|
|
2346
|
+
if (accountDuration < (((_item$_productOrigin21 = item._productOrigin) === null || _item$_productOrigin21 === void 0 || (_item$_productOrigin21 = _item$_productOrigin21.duration) === null || _item$_productOrigin21 === void 0 ? void 0 : _item$_productOrigin21.value) || 10)) {
|
|
2347
|
+
var _item$_productOrigin22;
|
|
2348
|
+
accountDuration = ((_item$_productOrigin22 = item._productOrigin) === null || _item$_productOrigin22 === void 0 || (_item$_productOrigin22 = _item$_productOrigin22.duration) === null || _item$_productOrigin22 === void 0 ? void 0 : _item$_productOrigin22.value) || 10;
|
|
2352
2349
|
}
|
|
2353
2350
|
}
|
|
2354
2351
|
});
|
|
@@ -2374,18 +2371,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2374
2371
|
case 20:
|
|
2375
2372
|
resourcesUseableMap = {};
|
|
2376
2373
|
hasFlexibleDuration = cartItems.some(function (item) {
|
|
2377
|
-
var _item$
|
|
2378
|
-
return ((_item$
|
|
2374
|
+
var _item$_productOrigin23;
|
|
2375
|
+
return ((_item$_productOrigin23 = item._productOrigin) === null || _item$_productOrigin23 === void 0 || (_item$_productOrigin23 = _item$_productOrigin23.duration) === null || _item$_productOrigin23 === void 0 ? void 0 : _item$_productOrigin23.type) === 'flexible';
|
|
2379
2376
|
});
|
|
2380
2377
|
operating_day_boundary = (_this$shopStore$get2 = this.shopStore.get('core')) === null || _this$shopStore$get2 === void 0 || (_this$shopStore$get2 = _this$shopStore$get2.core) === null || _this$shopStore$get2 === void 0 ? void 0 : _this$shopStore$get2.operating_day_boundary; // 如果有 hasFlexibleDuration,需要把动态时长商品(可能是多个,取最长的那个最低禁止购买时长)的最低禁止购买时长作为 split 的值
|
|
2381
2378
|
maxBlockThreshold = 0;
|
|
2382
2379
|
if (hasFlexibleDuration) {
|
|
2383
2380
|
maxBlockThreshold = cartItems.reduce(function (max, item) {
|
|
2384
|
-
var _item$
|
|
2381
|
+
var _item$_productOrigin24;
|
|
2385
2382
|
// 如果开启了灵活时长商品配置,则取 block_threshold 的值
|
|
2386
|
-
if ((_item$
|
|
2387
|
-
var _item$
|
|
2388
|
-
return Math.max(max, ((_item$
|
|
2383
|
+
if ((_item$_productOrigin24 = item._productOrigin) !== null && _item$_productOrigin24 !== void 0 && (_item$_productOrigin24 = _item$_productOrigin24.duration) !== null && _item$_productOrigin24 !== void 0 && (_item$_productOrigin24 = _item$_productOrigin24.flexible_config) !== null && _item$_productOrigin24 !== void 0 && _item$_productOrigin24.is_enable_minimum_duration) {
|
|
2384
|
+
var _item$_productOrigin25;
|
|
2385
|
+
return Math.max(max, ((_item$_productOrigin25 = item._productOrigin) === null || _item$_productOrigin25 === void 0 || (_item$_productOrigin25 = _item$_productOrigin25.duration) === null || _item$_productOrigin25 === void 0 || (_item$_productOrigin25 = _item$_productOrigin25.flexible_config) === null || _item$_productOrigin25 === void 0 ? void 0 : _item$_productOrigin25.block_threshold) || 0);
|
|
2389
2386
|
}
|
|
2390
2387
|
return 0;
|
|
2391
2388
|
}, 0);
|
|
@@ -2546,10 +2543,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2546
2543
|
var osWarnTips = [];
|
|
2547
2544
|
var newResources = cloneDeep(item._origin.resources);
|
|
2548
2545
|
newResources.forEach(function (resource) {
|
|
2549
|
-
var _item$
|
|
2546
|
+
var _item$_productOrigin26;
|
|
2550
2547
|
// 如果商品配置的是灵活时长,开始时间设置为提交的时间,结束时间从资源的可用最晚时间和店铺营业结束时间里取一个最早的
|
|
2551
|
-
if (((_item$
|
|
2552
|
-
var _allResources$find, _item$
|
|
2548
|
+
if (((_item$_productOrigin26 = item._productOrigin) === null || _item$_productOrigin26 === void 0 || (_item$_productOrigin26 = _item$_productOrigin26.duration) === null || _item$_productOrigin26 === void 0 ? void 0 : _item$_productOrigin26.type) === 'flexible') {
|
|
2549
|
+
var _allResources$find, _item$_productOrigin27, _item$_productOrigin28;
|
|
2553
2550
|
item.duration = {
|
|
2554
2551
|
type: 'minutes',
|
|
2555
2552
|
value: 10
|
|
@@ -2632,15 +2629,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2632
2629
|
resource.endTime = formattedEndTime.format('YYYY-MM-DD HH:mm');
|
|
2633
2630
|
// 如果是动态时长商品,并且当前选择的时间的结束时间小于了最低提示时长(warningThreshold),则追加一个提示
|
|
2634
2631
|
// 如果currentStartTime + warningThreshold 大于 currentEndTime,且 osWarnTips 没有pisell2.product.card.closing-soon.warning 这一项,则加入这一项
|
|
2635
|
-
if ((_item$
|
|
2632
|
+
if ((_item$_productOrigin27 = item._productOrigin) !== null && _item$_productOrigin27 !== void 0 && (_item$_productOrigin27 = _item$_productOrigin27.duration) !== null && _item$_productOrigin27 !== void 0 && (_item$_productOrigin27 = _item$_productOrigin27.flexible_config) !== null && _item$_productOrigin27 !== void 0 && _item$_productOrigin27.is_enable_minimum_duration && dayjs(currentStartTime).add(((_item$_productOrigin28 = item._productOrigin) === null || _item$_productOrigin28 === void 0 || (_item$_productOrigin28 = _item$_productOrigin28.duration) === null || _item$_productOrigin28 === void 0 || (_item$_productOrigin28 = _item$_productOrigin28.flexible_config) === null || _item$_productOrigin28 === void 0 ? void 0 : _item$_productOrigin28.warning_threshold) || 0, 'minutes').isAfter(dayjs(formattedEndTime))) {
|
|
2636
2633
|
if (!osWarnTips.includes('pisell2.product.card.closing-soon.warning')) {
|
|
2637
2634
|
osWarnTips.push('pisell2.product.card.closing-soon.warning');
|
|
2638
2635
|
}
|
|
2639
2636
|
}
|
|
2640
2637
|
} else {
|
|
2641
|
-
var _item$
|
|
2638
|
+
var _item$_productOrigin29;
|
|
2642
2639
|
resource.startTime = currentStartTime;
|
|
2643
|
-
resource.endTime = dayjs(currentStartTime).add(((_item$
|
|
2640
|
+
resource.endTime = dayjs(currentStartTime).add(((_item$_productOrigin29 = item._productOrigin) === null || _item$_productOrigin29 === void 0 || (_item$_productOrigin29 = _item$_productOrigin29.duration) === null || _item$_productOrigin29 === void 0 ? void 0 : _item$_productOrigin29.value) || 10, 'minutes').format('YYYY-MM-DD HH:mm');
|
|
2644
2641
|
}
|
|
2645
2642
|
// delete resource.times;
|
|
2646
2643
|
});
|