@pisell/pisellos 2.1.151 → 2.1.152
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/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/model/strategy/adapter/promotion/evaluator.js +26 -99
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +8 -61
- package/dist/model/strategy/adapter/walletPass/locales.js +3 -12
- package/dist/model/strategy/engine.d.ts +5 -18
- package/dist/model/strategy/engine.js +45 -145
- package/dist/model/strategy/type.d.ts +0 -17
- package/dist/model/strategy/type.js +0 -4
- package/dist/modules/Cart/types.d.ts +0 -2
- package/dist/modules/Cart/utils/cartProduct.js +25 -56
- package/dist/modules/Discount/index.d.ts +9 -3
- package/dist/modules/Discount/index.js +103 -11
- package/dist/modules/Discount/types.d.ts +8 -19
- package/dist/modules/OpenData/index.d.ts +24 -0
- package/dist/modules/OpenData/index.js +173 -0
- package/dist/modules/OpenData/types.d.ts +73 -0
- package/dist/modules/OpenData/types.js +1 -0
- package/dist/modules/OpenData/utils.d.ts +2 -0
- package/dist/modules/OpenData/utils.js +75 -0
- package/dist/modules/Order/index.d.ts +66 -1
- package/dist/modules/Order/index.js +906 -30
- package/dist/modules/Order/types.d.ts +174 -12
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +118 -0
- package/dist/modules/Order/utils.js +586 -2
- package/dist/modules/Payment/index.d.ts +1 -2
- package/dist/modules/Payment/index.js +7 -10
- package/dist/modules/Payment/utils.js +0 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -23
- package/dist/modules/Payment/walletpass.js +95 -191
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +4 -3
- package/dist/modules/Quotation/index.d.ts +48 -0
- package/dist/modules/Quotation/index.js +248 -0
- package/dist/modules/Quotation/types.d.ts +42 -0
- package/dist/modules/Quotation/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +5 -9
- package/dist/modules/Rules/index.js +168 -677
- package/dist/modules/Rules/types.d.ts +0 -2
- package/dist/modules/SalesSummary/index.d.ts +63 -0
- package/dist/modules/SalesSummary/index.js +174 -0
- package/dist/modules/SalesSummary/types.d.ts +60 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +30 -0
- package/dist/modules/SalesSummary/utils.js +480 -0
- package/dist/modules/ScanOrderLogger/index.d.ts +23 -0
- package/dist/modules/ScanOrderLogger/index.js +174 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.js +221 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
- package/dist/modules/ScanOrderLogger/types.d.ts +53 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
- package/dist/modules/Schedule/utils.d.ts +1 -1
- package/dist/modules/Summary/types.d.ts +0 -2
- package/dist/modules/Summary/utils.d.ts +3 -9
- package/dist/modules/Summary/utils.js +41 -52
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/plugins/window.d.ts +0 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -2
- package/dist/solution/BookingByStep/index.js +46 -43
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/Checkout/index.js +0 -2
- package/dist/solution/ScanOrder/index.d.ts +152 -0
- package/dist/solution/ScanOrder/index.js +3132 -0
- package/dist/solution/ScanOrder/types.d.ts +287 -0
- package/dist/solution/ScanOrder/types.js +35 -0
- package/dist/solution/ScanOrder/utils.d.ts +167 -0
- package/dist/solution/ScanOrder/utils.js +764 -0
- package/dist/solution/ShopDiscount/index.d.ts +3 -2
- package/dist/solution/ShopDiscount/index.js +60 -59
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.js +1 -2
- package/dist/solution/ShopDiscount/utils.js +12 -26
- package/dist/solution/VenueBooking/index.d.ts +200 -0
- package/dist/solution/VenueBooking/index.js +3459 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +154 -0
- package/dist/solution/VenueBooking/types.js +21 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +104 -0
- package/dist/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/dist/solution/VenueBooking/utils/resource.js +131 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +38 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +239 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +453 -0
- package/dist/solution/VenueBooking/utils.d.ts +1 -0
- package/dist/solution/VenueBooking/utils.js +1 -0
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/model/strategy/adapter/promotion/evaluator.js +8 -57
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
- package/lib/model/strategy/adapter/walletPass/evaluator.js +3 -34
- package/lib/model/strategy/adapter/walletPass/locales.js +3 -12
- package/lib/model/strategy/engine.d.ts +5 -18
- package/lib/model/strategy/engine.js +21 -85
- package/lib/model/strategy/type.d.ts +0 -17
- package/lib/modules/Cart/types.d.ts +0 -2
- package/lib/modules/Cart/utils/cartProduct.js +12 -39
- package/lib/modules/Discount/index.d.ts +9 -3
- package/lib/modules/Discount/index.js +65 -4
- package/lib/modules/Discount/types.d.ts +8 -19
- package/lib/modules/OpenData/index.d.ts +24 -0
- package/lib/modules/OpenData/index.js +119 -0
- package/lib/modules/OpenData/types.d.ts +73 -0
- package/lib/modules/OpenData/types.js +17 -0
- package/lib/modules/OpenData/utils.d.ts +2 -0
- package/lib/modules/OpenData/utils.js +111 -0
- package/lib/modules/Order/index.d.ts +66 -1
- package/lib/modules/Order/index.js +515 -1
- package/lib/modules/Order/types.d.ts +174 -12
- package/lib/modules/Order/utils.d.ts +118 -0
- package/lib/modules/Order/utils.js +483 -2
- package/lib/modules/Payment/index.d.ts +1 -2
- package/lib/modules/Payment/index.js +0 -1
- package/lib/modules/Payment/utils.js +0 -3
- package/lib/modules/Payment/walletpass.d.ts +0 -23
- package/lib/modules/Payment/walletpass.js +17 -94
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +5 -3
- package/lib/modules/Quotation/index.d.ts +48 -0
- package/lib/modules/Quotation/index.js +152 -0
- package/lib/modules/Quotation/types.d.ts +42 -0
- package/lib/modules/Quotation/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +5 -9
- package/lib/modules/Rules/index.js +288 -780
- package/lib/modules/Rules/types.d.ts +0 -2
- package/lib/modules/SalesSummary/index.d.ts +63 -0
- package/lib/modules/SalesSummary/index.js +105 -0
- package/lib/modules/SalesSummary/types.d.ts +60 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +30 -0
- package/lib/modules/SalesSummary/utils.js +420 -0
- package/lib/modules/ScanOrderLogger/index.d.ts +23 -0
- package/lib/modules/ScanOrderLogger/index.js +147 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.js +157 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
- package/lib/modules/ScanOrderLogger/types.d.ts +53 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
- package/lib/modules/Schedule/utils.d.ts +1 -1
- package/lib/modules/Summary/types.d.ts +0 -2
- package/lib/modules/Summary/utils.d.ts +3 -9
- package/lib/modules/Summary/utils.js +22 -31
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/plugins/window.d.ts +0 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -2
- package/lib/solution/BookingByStep/index.js +6 -4
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/Checkout/index.js +0 -2
- package/lib/solution/ScanOrder/index.d.ts +152 -0
- package/lib/solution/ScanOrder/index.js +1901 -0
- package/lib/solution/ScanOrder/types.d.ts +287 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +167 -0
- package/lib/solution/ScanOrder/utils.js +635 -0
- package/lib/solution/ShopDiscount/index.d.ts +3 -2
- package/lib/solution/ShopDiscount/index.js +19 -25
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.js +6 -10
- package/lib/solution/VenueBooking/index.d.ts +200 -0
- package/lib/solution/VenueBooking/index.js +1926 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +154 -0
- package/lib/solution/VenueBooking/types.js +44 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +110 -0
- package/lib/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/lib/solution/VenueBooking/utils/resource.js +92 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +38 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +237 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +339 -0
- package/lib/solution/VenueBooking/utils.d.ts +1 -0
- package/lib/solution/VenueBooking/utils.js +69 -0
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/package.json +1 -1
|
@@ -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) => ScheduleAllMap;
|
|
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[]) => number;
|
|
11
|
+
export declare const getProductDiscountProductDiscountDifference: (item: CartItem) => number;
|
|
12
12
|
/**
|
|
13
13
|
* 计算订单税费(折扣前/折扣后),并把单品税费信息回写到商品数据上(用于明细展示/后续计算)。
|
|
14
14
|
*
|
|
@@ -58,12 +58,6 @@ 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;
|
|
67
61
|
/**
|
|
68
62
|
* @title: 单个商品的税费
|
|
69
63
|
* @description:
|
|
@@ -100,7 +94,7 @@ export declare const calculateDeposit: (items: CartItem[]) => {
|
|
|
100
94
|
export declare const getSurchargeAmount: ({ bookingDetail, bookingId }: {
|
|
101
95
|
bookingDetail?: any;
|
|
102
96
|
bookingId?: number | undefined;
|
|
103
|
-
}, surcharge: any[], options: any) =>
|
|
97
|
+
}, surcharge: any[], options: any) => number;
|
|
104
98
|
/**
|
|
105
99
|
* 订单附加费各项信息
|
|
106
100
|
*
|
|
@@ -20,7 +20,6 @@ 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));
|
|
24
23
|
var totalTaxFee = new Decimal(calculateTaxFee(shopInfo, items));
|
|
25
24
|
// 订单附加费列表
|
|
26
25
|
var surcharge = getSurcharge({
|
|
@@ -59,15 +58,11 @@ export var calculatePriceDetails = function calculatePriceDetails(shopInfo, item
|
|
|
59
58
|
originTax = _getTax.originTax;
|
|
60
59
|
var total = shopInfo !== null && shopInfo !== void 0 && shopInfo.is_price_include_tax ? subtotal.plus(surchargeAmount) : subtotal.plus(tax).plus(surchargeAmount);
|
|
61
60
|
|
|
62
|
-
// 计算总价 不包含折扣卡商品券折扣信息价格
|
|
63
|
-
var originTotal = shopInfo !== null && shopInfo !== void 0 && shopInfo.is_price_include_tax ? subOriginTotal : subOriginTotal.plus(totalTaxFee);
|
|
64
|
-
|
|
65
61
|
// 计算定金
|
|
66
62
|
var deposit = calculateDeposit(items);
|
|
67
63
|
return {
|
|
68
64
|
subtotal: subtotal.toFixed(2),
|
|
69
65
|
total: total.toFixed(2),
|
|
70
|
-
originTotal: originTotal.toFixed(2),
|
|
71
66
|
taxTitle: shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.tax_title,
|
|
72
67
|
taxRate: shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.tax_rate,
|
|
73
68
|
totalTaxFee: tax,
|
|
@@ -99,8 +94,8 @@ export var getBundleDiscountList = function getBundleDiscountList(bundle) {
|
|
|
99
94
|
export var calcDiscountListDifference = function calcDiscountListDifference(discountList) {
|
|
100
95
|
return discountList.reduce(function (pre, cur) {
|
|
101
96
|
var _cur$metadata;
|
|
102
|
-
return pre
|
|
103
|
-
}, 0);
|
|
97
|
+
return pre.plus((cur === null || cur === void 0 || (_cur$metadata = cur.metadata) === null || _cur$metadata === void 0 ? void 0 : _cur$metadata.product_discount_difference) || 0);
|
|
98
|
+
}, new Decimal(0)).toNumber();
|
|
104
99
|
};
|
|
105
100
|
export var getProductDiscountProductDiscountDifference = function getProductDiscountProductDiscountDifference(item) {
|
|
106
101
|
var _item$_origin, _item$_origin2;
|
|
@@ -577,22 +572,6 @@ export var calculateSubtotal = function calculateSubtotal(items) {
|
|
|
577
572
|
return subtotal.toFixed(2);
|
|
578
573
|
};
|
|
579
574
|
|
|
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
|
-
|
|
596
575
|
/**
|
|
597
576
|
* @title: 单个商品的税费
|
|
598
577
|
* @description:
|
|
@@ -683,8 +662,8 @@ export var getSurchargeAmount = function getSurchargeAmount(_ref7, surcharge, op
|
|
|
683
662
|
if (!Array.isArray(surcharge)) return 0;
|
|
684
663
|
// 新增状态使用 getSurcharge 的返回值进行求和
|
|
685
664
|
return surcharge.reduce(function (total, item) {
|
|
686
|
-
return total
|
|
687
|
-
}, 0);
|
|
665
|
+
return total.plus(item.value || 0);
|
|
666
|
+
}, new Decimal(0)).toNumber();
|
|
688
667
|
};
|
|
689
668
|
|
|
690
669
|
// bundle商品是否是原价
|
|
@@ -716,20 +695,30 @@ var getDiscountAmount = function getDiscountAmount(discounts) {
|
|
|
716
695
|
* 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
|
|
717
696
|
*/
|
|
718
697
|
var getMainProductTotal = function getMainProductTotal(item) {
|
|
719
|
-
var _ref8, _ref9, _item$main_product_se, _item$metadata, _item$
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
698
|
+
var _ref8, _ref9, _item$main_product_se, _item$metadata, _item$metadata2, _item$metadata3, _item$metadata4;
|
|
699
|
+
// 新语义 v2 下 `main_product_selling_price` / `metadata.main_product_selling_price`
|
|
700
|
+
// 已经是"含 option、含主商品折扣"的主价,直接作为主商品基准,无需再减折扣或加 option。
|
|
701
|
+
// 仅需叠加 markup / markdown 类 bundle(原价 bundle 的税费单独处理)。
|
|
702
|
+
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 === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.main_product_original_price) !== null && _ref8 !== void 0 ? _ref8 : 0);
|
|
703
|
+
|
|
704
|
+
// 做个兜底 如果新语义价格字段都没有,则切换回老逻辑
|
|
705
|
+
var hasMainProductPrice = (item === null || item === void 0 ? void 0 : item.main_product_selling_price) != null || (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.main_product_selling_price) != null || (item === null || item === void 0 || (_item$metadata4 = item.metadata) === null || _item$metadata4 === void 0 ? void 0 : _item$metadata4.main_product_original_price) != null;
|
|
706
|
+
if (!hasMainProductPrice) {
|
|
707
|
+
var _ref10, _ref11, _item$main_product_se2, _item$metadata5, _item$_origin3, _item$_originData;
|
|
708
|
+
total = new Decimal((_ref10 = (_ref11 = (_item$main_product_se2 = item === null || item === void 0 ? void 0 : item.main_product_selling_price) !== null && _item$main_product_se2 !== void 0 ? _item$main_product_se2 : item === null || item === void 0 || (_item$metadata5 = item.metadata) === null || _item$metadata5 === void 0 ? void 0 : _item$metadata5.main_product_selling_price) !== null && _ref11 !== void 0 ? _ref11 : item.price) !== null && _ref10 !== void 0 ? _ref10 : 0);
|
|
709
|
+
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) {
|
|
710
|
+
var _item$metadata6;
|
|
711
|
+
return !(item !== null && item !== void 0 && (_item$metadata6 = item.metadata) !== null && _item$metadata6 !== void 0 && _item$metadata6.custom_product_bundle_map_id);
|
|
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
|
+
}
|
|
733
722
|
}
|
|
734
723
|
var _iterator4 = _createForOfIteratorHelper((item === null || item === void 0 ? void 0 : item.bundle) || []),
|
|
735
724
|
_step4;
|
|
@@ -737,9 +726,9 @@ var getMainProductTotal = function getMainProductTotal(item) {
|
|
|
737
726
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
738
727
|
var bundleItem = _step4.value;
|
|
739
728
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
740
|
-
var
|
|
741
|
-
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price和 price 其实都已经是折后价格了,不需要单独再减一次
|
|
742
|
-
var bundleItemTotal = new Decimal((
|
|
729
|
+
var _ref12, _bundleItem$bundle_se2;
|
|
730
|
+
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price 和 price 其实都已经是折后价格了,不需要单独再减一次
|
|
731
|
+
var bundleItemTotal = new Decimal((_ref12 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref12 !== void 0 ? _ref12 : 0);
|
|
743
732
|
total = total.add(bundleItemTotal);
|
|
744
733
|
}
|
|
745
734
|
}
|
|
@@ -859,12 +848,12 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
|
|
|
859
848
|
* @param options.scheduleById schedule 映射表:`{ [scheduleId]: schedule }`(用于根据配置的 `available_schedule_ids` 做日程匹配)
|
|
860
849
|
* @returns 附加费列表(仅返回金额 > 0 的项)
|
|
861
850
|
*/
|
|
862
|
-
export var getSurcharge = function getSurcharge(
|
|
851
|
+
export var getSurcharge = function getSurcharge(_ref13, options) {
|
|
863
852
|
var _service$filter;
|
|
864
|
-
var service =
|
|
865
|
-
addons =
|
|
866
|
-
bookingDetail =
|
|
867
|
-
bookingId =
|
|
853
|
+
var service = _ref13.service,
|
|
854
|
+
addons = _ref13.addons,
|
|
855
|
+
bookingDetail = _ref13.bookingDetail,
|
|
856
|
+
bookingId = _ref13.bookingId;
|
|
868
857
|
var isEdit = options.isEdit,
|
|
869
858
|
isInScheduleByDate = options.isInScheduleByDate,
|
|
870
859
|
surcharge_list = options.surcharge_list,
|
|
@@ -986,11 +975,11 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
986
975
|
scheduleById: scheduleById || {},
|
|
987
976
|
isInScheduleByDate: isInScheduleByDate
|
|
988
977
|
})) {
|
|
989
|
-
var
|
|
978
|
+
var _ref14, _bundleItem$bundle_se3;
|
|
990
979
|
var _mainQuantity = item.num || 1;
|
|
991
980
|
matchedItems.push({
|
|
992
981
|
isMain: false,
|
|
993
|
-
total: Number((
|
|
982
|
+
total: Number((_ref14 = (_bundleItem$bundle_se3 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se3 !== void 0 ? _bundleItem$bundle_se3 : bundleItem.price) !== null && _ref14 !== void 0 ? _ref14 : 0),
|
|
994
983
|
quantity: bundleItem.num || bundleItem.quantity || 1,
|
|
995
984
|
item: bundleItem,
|
|
996
985
|
mainQuantity: _mainQuantity // 子商品的mainQuantity是所属主商品的quantity
|
|
@@ -1206,9 +1195,9 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
1206
1195
|
}
|
|
1207
1196
|
return surchargeWithAmount;
|
|
1208
1197
|
};
|
|
1209
|
-
function resetItemsSurchargeSideEffects(
|
|
1210
|
-
var service =
|
|
1211
|
-
addons =
|
|
1198
|
+
function resetItemsSurchargeSideEffects(_ref15) {
|
|
1199
|
+
var service = _ref15.service,
|
|
1200
|
+
addons = _ref15.addons;
|
|
1212
1201
|
var resetItem = function resetItem(item) {
|
|
1213
1202
|
if (!item) return;
|
|
1214
1203
|
item.surcharge_fee = 0;
|
package/dist/modules/index.d.ts
CHANGED
|
@@ -11,4 +11,8 @@ export * from './Payment';
|
|
|
11
11
|
export * from './Resource';
|
|
12
12
|
export * from './Step';
|
|
13
13
|
export * from './Summary';
|
|
14
|
+
export * from './SalesSummary';
|
|
14
15
|
export * from './Schedule';
|
|
16
|
+
export * from './Quotation';
|
|
17
|
+
export * from './ScanOrderLogger';
|
|
18
|
+
export * from './OpenData';
|
package/dist/modules/index.js
CHANGED
|
@@ -11,4 +11,8 @@ export * from "./Payment";
|
|
|
11
11
|
export * from "./Resource";
|
|
12
12
|
export * from "./Step";
|
|
13
13
|
export * from "./Summary";
|
|
14
|
-
export * from "./
|
|
14
|
+
export * from "./SalesSummary";
|
|
15
|
+
export * from "./Schedule";
|
|
16
|
+
export * from "./Quotation";
|
|
17
|
+
export * from "./ScanOrderLogger";
|
|
18
|
+
export * from "./OpenData";
|
package/dist/plugins/window.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WalletPassEvaluator } from '../model';
|
|
2
1
|
import { Plugin } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* WindowPlugin 接口定义
|
|
@@ -15,7 +14,6 @@ export interface WindowPlugin extends Plugin {
|
|
|
15
14
|
document: Partial<Document>;
|
|
16
15
|
history: History;
|
|
17
16
|
interaction?: any;
|
|
18
|
-
getWalletPassEvaluator?: () => WalletPassEvaluator;
|
|
19
17
|
}
|
|
20
18
|
/**
|
|
21
19
|
* 简单的 Storage 接口实现
|
|
@@ -144,7 +144,6 @@ 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;
|
|
148
147
|
taxTitle?: string | undefined;
|
|
149
148
|
totalTaxFee?: string | number | undefined;
|
|
150
149
|
isPriceIncludeTax?: 0 | 1 | undefined;
|
|
@@ -302,7 +301,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
302
301
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
303
302
|
errorList: any[];
|
|
304
303
|
};
|
|
305
|
-
getTimeSlotByAllResources(resources_code: string): any[];
|
|
304
|
+
getTimeSlotByAllResources(resources_code: string, split?: number): any[];
|
|
306
305
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
307
306
|
resources_code: string;
|
|
308
307
|
startDate: string;
|
|
@@ -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, _dateRange$5, _item$duration2, _item$_productOrigin6;
|
|
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,7 +2018,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2018
2018
|
var fastestResource = findFastestAvailableResource({
|
|
2019
2019
|
resources: targetRenderList,
|
|
2020
2020
|
currentCapacity: currentCapacity,
|
|
2021
|
-
countMap: selectResourcesMap
|
|
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
|
|
2022
2024
|
});
|
|
2023
2025
|
var targetResource = fastestResource || targetRenderList[0];
|
|
2024
2026
|
targetResource.capacity = currentCapacity;
|
|
@@ -2069,6 +2071,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2069
2071
|
_cartItems$,
|
|
2070
2072
|
_cartItems$2,
|
|
2071
2073
|
_this$shopStore$get;
|
|
2074
|
+
var split = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
|
|
2072
2075
|
var dateRange = this.store.date.getDateRange();
|
|
2073
2076
|
// 取出购物车中所有一已选择的第一步资源
|
|
2074
2077
|
var resources = [];
|
|
@@ -2084,8 +2087,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2084
2087
|
var maxCutOffTime = undefined;
|
|
2085
2088
|
var maxCutOffTimeValue = dayjs();
|
|
2086
2089
|
cartItems.forEach(function (item) {
|
|
2087
|
-
var _item$
|
|
2088
|
-
(_item$
|
|
2090
|
+
var _item$_productOrigin7, _item$_productOrigin8, _item$_productOrigin9, _item$_productOrigin10;
|
|
2091
|
+
(_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.forEach(function (n) {
|
|
2089
2092
|
// TODO: 少了个 status 的判断
|
|
2090
2093
|
if (n.code === resources_code) {
|
|
2091
2094
|
resources.push.apply(resources, _toConsumableArray(n.renderList || []));
|
|
@@ -2098,10 +2101,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2098
2101
|
if (item.resource_id && !resourceIds.includes(item.resource_id)) {
|
|
2099
2102
|
resourceIds.push(item.resource_id);
|
|
2100
2103
|
}
|
|
2101
|
-
resourcesTypeId = item === null || item === void 0 || (_item$
|
|
2104
|
+
resourcesTypeId = item === null || item === void 0 || (_item$_productOrigin8 = item._productOrigin) === null || _item$_productOrigin8 === void 0 || (_item$_productOrigin8 = _item$_productOrigin8.product_resource) === null || _item$_productOrigin8 === void 0 || (_item$_productOrigin8 = _item$_productOrigin8.resources) === null || _item$_productOrigin8 === void 0 || (_item$_productOrigin8 = _item$_productOrigin8.find(function (n) {
|
|
2102
2105
|
return n.code === resources_code;
|
|
2103
|
-
})) === null || _item$
|
|
2104
|
-
if ((_item$
|
|
2106
|
+
})) === null || _item$_productOrigin8 === void 0 ? void 0 : _item$_productOrigin8.id;
|
|
2107
|
+
if ((_item$_productOrigin9 = item._productOrigin) !== null && _item$_productOrigin9 !== void 0 && _item$_productOrigin9.cut_off_time && ((_item$_productOrigin10 = item._productOrigin) === null || _item$_productOrigin10 === void 0 ? void 0 : _item$_productOrigin10.cut_off_time.type) === 'advance') {
|
|
2105
2108
|
var currentCutOffTime = dayjs().add(item._productOrigin.cut_off_time.unit, item._productOrigin.cut_off_time.unit_type);
|
|
2106
2109
|
if (currentCutOffTime.isAfter(maxCutOffTimeValue, 'minute')) {
|
|
2107
2110
|
maxCutOffTimeValue = currentCutOffTime;
|
|
@@ -2151,13 +2154,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2151
2154
|
cartItems.forEach(function (item) {
|
|
2152
2155
|
// 单个预约累加账号 多个预约取最大值
|
|
2153
2156
|
if (isSingleResource) {
|
|
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;
|
|
2156
|
-
} else {
|
|
2157
2157
|
var _item$_productOrigin11;
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2158
|
+
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
|
+
} else {
|
|
2160
|
+
var _item$_productOrigin12;
|
|
2161
|
+
if (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)) {
|
|
2162
|
+
var _item$_productOrigin13;
|
|
2163
|
+
accountDuration = ((_item$_productOrigin13 = item._productOrigin) === null || _item$_productOrigin13 === void 0 || (_item$_productOrigin13 = _item$_productOrigin13.duration) === null || _item$_productOrigin13 === void 0 ? void 0 : _item$_productOrigin13.value) || 10;
|
|
2161
2164
|
}
|
|
2162
2165
|
}
|
|
2163
2166
|
});
|
|
@@ -2194,8 +2197,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2194
2197
|
}
|
|
2195
2198
|
var resourcesUseableMap = {};
|
|
2196
2199
|
var hasFlexibleDuration = cartItems.some(function (item) {
|
|
2197
|
-
var _item$
|
|
2198
|
-
return ((_item$
|
|
2200
|
+
var _item$_productOrigin14;
|
|
2201
|
+
return ((_item$_productOrigin14 = item._productOrigin) === null || _item$_productOrigin14 === void 0 || (_item$_productOrigin14 = _item$_productOrigin14.duration) === null || _item$_productOrigin14 === void 0 ? void 0 : _item$_productOrigin14.type) === 'flexible';
|
|
2199
2202
|
});
|
|
2200
2203
|
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;
|
|
2201
2204
|
|
|
@@ -2203,11 +2206,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2203
2206
|
var maxBlockThreshold = 0;
|
|
2204
2207
|
if (hasFlexibleDuration) {
|
|
2205
2208
|
maxBlockThreshold = cartItems.reduce(function (max, item) {
|
|
2206
|
-
var _item$
|
|
2209
|
+
var _item$_productOrigin15;
|
|
2207
2210
|
// 如果开启了灵活时长商品配置,则取 block_threshold 的值
|
|
2208
|
-
if ((_item$
|
|
2209
|
-
var _item$
|
|
2210
|
-
return Math.max(max, ((_item$
|
|
2211
|
+
if ((_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 && _item$_productOrigin15.is_enable_minimum_duration) {
|
|
2212
|
+
var _item$_productOrigin16;
|
|
2213
|
+
return Math.max(max, ((_item$_productOrigin16 = item._productOrigin) === null || _item$_productOrigin16 === void 0 || (_item$_productOrigin16 = _item$_productOrigin16.duration) === null || _item$_productOrigin16 === void 0 || (_item$_productOrigin16 = _item$_productOrigin16.flexible_config) === null || _item$_productOrigin16 === void 0 ? void 0 : _item$_productOrigin16.block_threshold) || 0);
|
|
2211
2214
|
}
|
|
2212
2215
|
return 0;
|
|
2213
2216
|
}, 0);
|
|
@@ -2252,7 +2255,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2252
2255
|
resourcesMap: resourcesMap,
|
|
2253
2256
|
duration: duration,
|
|
2254
2257
|
currentDate: dateRange[0].date,
|
|
2255
|
-
split:
|
|
2258
|
+
split: split,
|
|
2256
2259
|
resourcesUseableMap: resourcesUseableMap,
|
|
2257
2260
|
capacity: maxCapacity,
|
|
2258
2261
|
cut_off_time: maxCutOffTime,
|
|
@@ -2299,8 +2302,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2299
2302
|
maxCutOffTime = undefined;
|
|
2300
2303
|
maxCutOffTimeValue = dayjs();
|
|
2301
2304
|
cartItems.forEach(function (item) {
|
|
2302
|
-
var _item$
|
|
2303
|
-
(_item$
|
|
2305
|
+
var _item$_productOrigin17, _item$_productOrigin18, _item$_productOrigin19, _item$_productOrigin20;
|
|
2306
|
+
(_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.forEach(function (n) {
|
|
2304
2307
|
// TODO: 少了个 status 的判断
|
|
2305
2308
|
if (n.code === resources_code) {
|
|
2306
2309
|
resources.push.apply(resources, _toConsumableArray(n.renderList || []));
|
|
@@ -2313,10 +2316,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2313
2316
|
if (item.resource_id && !resourceIds.includes(item.resource_id)) {
|
|
2314
2317
|
resourceIds.push(item.resource_id);
|
|
2315
2318
|
}
|
|
2316
|
-
resourcesTypeId = item === null || item === void 0 || (_item$
|
|
2319
|
+
resourcesTypeId = item === null || item === void 0 || (_item$_productOrigin18 = item._productOrigin) === null || _item$_productOrigin18 === void 0 || (_item$_productOrigin18 = _item$_productOrigin18.product_resource) === null || _item$_productOrigin18 === void 0 || (_item$_productOrigin18 = _item$_productOrigin18.resources) === null || _item$_productOrigin18 === void 0 || (_item$_productOrigin18 = _item$_productOrigin18.find(function (n) {
|
|
2317
2320
|
return n.code === resources_code;
|
|
2318
|
-
})) === null || _item$
|
|
2319
|
-
if ((_item$
|
|
2321
|
+
})) === null || _item$_productOrigin18 === void 0 ? void 0 : _item$_productOrigin18.id;
|
|
2322
|
+
if ((_item$_productOrigin19 = item._productOrigin) !== null && _item$_productOrigin19 !== void 0 && _item$_productOrigin19.cut_off_time && ((_item$_productOrigin20 = item._productOrigin) === null || _item$_productOrigin20 === void 0 ? void 0 : _item$_productOrigin20.cut_off_time.type) === 'advance') {
|
|
2320
2323
|
var currentCutOffTime = dayjs().add(item._productOrigin.cut_off_time.unit, item._productOrigin.cut_off_time.unit_type);
|
|
2321
2324
|
if (currentCutOffTime.isAfter(maxCutOffTimeValue, 'minute')) {
|
|
2322
2325
|
maxCutOffTimeValue = currentCutOffTime;
|
|
@@ -2339,13 +2342,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2339
2342
|
cartItems.forEach(function (item) {
|
|
2340
2343
|
// 单个预约累加账号 多个预约取最大值
|
|
2341
2344
|
if (isSingleResource) {
|
|
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;
|
|
2344
|
-
} else {
|
|
2345
2345
|
var _item$_productOrigin21;
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2346
|
+
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
|
+
} else {
|
|
2348
|
+
var _item$_productOrigin22;
|
|
2349
|
+
if (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)) {
|
|
2350
|
+
var _item$_productOrigin23;
|
|
2351
|
+
accountDuration = ((_item$_productOrigin23 = item._productOrigin) === null || _item$_productOrigin23 === void 0 || (_item$_productOrigin23 = _item$_productOrigin23.duration) === null || _item$_productOrigin23 === void 0 ? void 0 : _item$_productOrigin23.value) || 10;
|
|
2349
2352
|
}
|
|
2350
2353
|
}
|
|
2351
2354
|
});
|
|
@@ -2371,18 +2374,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2371
2374
|
case 20:
|
|
2372
2375
|
resourcesUseableMap = {};
|
|
2373
2376
|
hasFlexibleDuration = cartItems.some(function (item) {
|
|
2374
|
-
var _item$
|
|
2375
|
-
return ((_item$
|
|
2377
|
+
var _item$_productOrigin24;
|
|
2378
|
+
return ((_item$_productOrigin24 = item._productOrigin) === null || _item$_productOrigin24 === void 0 || (_item$_productOrigin24 = _item$_productOrigin24.duration) === null || _item$_productOrigin24 === void 0 ? void 0 : _item$_productOrigin24.type) === 'flexible';
|
|
2376
2379
|
});
|
|
2377
2380
|
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 的值
|
|
2378
2381
|
maxBlockThreshold = 0;
|
|
2379
2382
|
if (hasFlexibleDuration) {
|
|
2380
2383
|
maxBlockThreshold = cartItems.reduce(function (max, item) {
|
|
2381
|
-
var _item$
|
|
2384
|
+
var _item$_productOrigin25;
|
|
2382
2385
|
// 如果开启了灵活时长商品配置,则取 block_threshold 的值
|
|
2383
|
-
if ((_item$
|
|
2384
|
-
var _item$
|
|
2385
|
-
return Math.max(max, ((_item$
|
|
2386
|
+
if ((_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 && _item$_productOrigin25.is_enable_minimum_duration) {
|
|
2387
|
+
var _item$_productOrigin26;
|
|
2388
|
+
return Math.max(max, ((_item$_productOrigin26 = item._productOrigin) === null || _item$_productOrigin26 === void 0 || (_item$_productOrigin26 = _item$_productOrigin26.duration) === null || _item$_productOrigin26 === void 0 || (_item$_productOrigin26 = _item$_productOrigin26.flexible_config) === null || _item$_productOrigin26 === void 0 ? void 0 : _item$_productOrigin26.block_threshold) || 0);
|
|
2386
2389
|
}
|
|
2387
2390
|
return 0;
|
|
2388
2391
|
}, 0);
|
|
@@ -2543,10 +2546,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2543
2546
|
var osWarnTips = [];
|
|
2544
2547
|
var newResources = cloneDeep(item._origin.resources);
|
|
2545
2548
|
newResources.forEach(function (resource) {
|
|
2546
|
-
var _item$
|
|
2549
|
+
var _item$_productOrigin27;
|
|
2547
2550
|
// 如果商品配置的是灵活时长,开始时间设置为提交的时间,结束时间从资源的可用最晚时间和店铺营业结束时间里取一个最早的
|
|
2548
|
-
if (((_item$
|
|
2549
|
-
var _allResources$find, _item$
|
|
2551
|
+
if (((_item$_productOrigin27 = item._productOrigin) === null || _item$_productOrigin27 === void 0 || (_item$_productOrigin27 = _item$_productOrigin27.duration) === null || _item$_productOrigin27 === void 0 ? void 0 : _item$_productOrigin27.type) === 'flexible') {
|
|
2552
|
+
var _allResources$find, _item$_productOrigin28, _item$_productOrigin29;
|
|
2550
2553
|
item.duration = {
|
|
2551
2554
|
type: 'minutes',
|
|
2552
2555
|
value: 10
|
|
@@ -2629,15 +2632,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2629
2632
|
resource.endTime = formattedEndTime.format('YYYY-MM-DD HH:mm');
|
|
2630
2633
|
// 如果是动态时长商品,并且当前选择的时间的结束时间小于了最低提示时长(warningThreshold),则追加一个提示
|
|
2631
2634
|
// 如果currentStartTime + warningThreshold 大于 currentEndTime,且 osWarnTips 没有pisell2.product.card.closing-soon.warning 这一项,则加入这一项
|
|
2632
|
-
if ((_item$
|
|
2635
|
+
if ((_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 && _item$_productOrigin28.is_enable_minimum_duration && dayjs(currentStartTime).add(((_item$_productOrigin29 = item._productOrigin) === null || _item$_productOrigin29 === void 0 || (_item$_productOrigin29 = _item$_productOrigin29.duration) === null || _item$_productOrigin29 === void 0 || (_item$_productOrigin29 = _item$_productOrigin29.flexible_config) === null || _item$_productOrigin29 === void 0 ? void 0 : _item$_productOrigin29.warning_threshold) || 0, 'minutes').isAfter(dayjs(formattedEndTime))) {
|
|
2633
2636
|
if (!osWarnTips.includes('pisell2.product.card.closing-soon.warning')) {
|
|
2634
2637
|
osWarnTips.push('pisell2.product.card.closing-soon.warning');
|
|
2635
2638
|
}
|
|
2636
2639
|
}
|
|
2637
2640
|
} else {
|
|
2638
|
-
var _item$
|
|
2641
|
+
var _item$_productOrigin30;
|
|
2639
2642
|
resource.startTime = currentStartTime;
|
|
2640
|
-
resource.endTime = dayjs(currentStartTime).add(((_item$
|
|
2643
|
+
resource.endTime = dayjs(currentStartTime).add(((_item$_productOrigin30 = item._productOrigin) === null || _item$_productOrigin30 === void 0 || (_item$_productOrigin30 = _item$_productOrigin30.duration) === null || _item$_productOrigin30 === void 0 ? void 0 : _item$_productOrigin30.value) || 10, 'minutes').format('YYYY-MM-DD HH:mm');
|
|
2641
2644
|
}
|
|
2642
2645
|
// delete resource.times;
|
|
2643
2646
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, ScheduleModule } from '../../modules';
|
|
1
|
+
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from '../../modules';
|
|
2
2
|
export interface BookingByStepState {
|
|
3
3
|
cart: CartModule;
|
|
4
4
|
summary: SummaryModule;
|
|
@@ -14,6 +14,8 @@ export interface BookingByStepState {
|
|
|
14
14
|
currentProduct?: ProductData;
|
|
15
15
|
currentProductMeta?: Record<string, any>;
|
|
16
16
|
schedule: ScheduleModule;
|
|
17
|
+
salesSummary?: SalesSummaryModule;
|
|
18
|
+
scanOrderLogger?: ScanOrderLoggerModule;
|
|
17
19
|
}
|
|
18
20
|
export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
|
|
19
21
|
export declare enum BookingByStepHooks {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { ProductList, CartModule, AccountListModule, DateModule, OrderModule, PaymentModule, StepModule, SummaryModule, ScheduleModule } from "../../modules";
|
|
1
|
+
import { ProductList, CartModule, AccountListModule, DateModule, OrderModule, PaymentModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from "../../modules";
|
|
2
2
|
export function createModule(moduleName, solutionName, name, version) {
|
|
3
3
|
switch (moduleName) {
|
|
4
4
|
case 'cart':
|
|
5
5
|
return new CartModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
6
6
|
case 'summary':
|
|
7
7
|
return new SummaryModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
8
|
+
case 'salesSummary':
|
|
9
|
+
return new SalesSummaryModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
8
10
|
case 'step':
|
|
9
11
|
return new StepModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
10
12
|
case 'products':
|
|
@@ -19,6 +21,8 @@ export function createModule(moduleName, solutionName, name, version) {
|
|
|
19
21
|
return new PaymentModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
20
22
|
case 'schedule':
|
|
21
23
|
return new ScheduleModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
24
|
+
case 'scanOrderLogger':
|
|
25
|
+
return new ScanOrderLoggerModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
22
26
|
default:
|
|
23
27
|
throw new Error("Unknown module type: ".concat(moduleName));
|
|
24
28
|
}
|
|
@@ -19,10 +19,12 @@ export declare function calculateResourceAvailableTime({ resource, timeSlots, cu
|
|
|
19
19
|
* @param countMap 已预约数量映射
|
|
20
20
|
* @returns 最快可用的资源
|
|
21
21
|
*/
|
|
22
|
-
export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, }: {
|
|
22
|
+
export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, targetDate, durationMinutes, }: {
|
|
23
23
|
resources: ResourceItem[];
|
|
24
24
|
currentCapacity?: number;
|
|
25
25
|
countMap?: Record<number, number>;
|
|
26
|
+
targetDate?: string | Dayjs;
|
|
27
|
+
durationMinutes?: number;
|
|
26
28
|
}): ResourceItem | null;
|
|
27
29
|
/**
|
|
28
30
|
* 给定一个时间列表,通过开始和结束时间过滤出符合条件的时间段
|