@pisell/pisellos 2.1.172 → 2.1.174
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/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +12 -63
- 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/Cart/utils/changePrice.js +16 -9
- package/dist/modules/Discount/availability.d.ts +7 -0
- package/dist/modules/Discount/availability.js +52 -0
- package/dist/modules/Discount/entitlementPass.d.ts +34 -0
- package/dist/modules/Discount/entitlementPass.js +147 -0
- package/dist/modules/Discount/entitlementState.d.ts +8 -0
- package/dist/modules/Discount/entitlementState.js +205 -0
- package/dist/modules/Discount/index.d.ts +12 -3
- package/dist/modules/Discount/index.js +211 -17
- package/dist/modules/Discount/types.d.ts +42 -22
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- 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 +67 -1
- package/dist/modules/Order/index.js +923 -30
- package/dist/modules/Order/types.d.ts +176 -12
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +128 -0
- package/dist/modules/Order/utils.js +621 -5
- 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/types.d.ts +7 -0
- 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/entitlementLines.d.ts +8 -0
- package/dist/modules/Rules/entitlementLines.js +157 -0
- package/dist/modules/Rules/index.d.ts +17 -11
- package/dist/modules/Rules/index.js +495 -726
- package/dist/modules/Rules/types.d.ts +2 -4
- 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 +67 -57
- package/dist/modules/index.d.ts +5 -0
- package/dist/modules/index.js +6 -1
- package/dist/plugins/window.d.ts +3 -2
- package/dist/solution/BookingByStep/index.d.ts +17 -3
- package/dist/solution/BookingByStep/index.js +322 -247
- package/dist/solution/BookingByStep/types.d.ts +4 -1
- package/dist/solution/BookingByStep/types.js +7 -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 +158 -0
- package/dist/solution/ScanOrder/index.js +3474 -0
- package/dist/solution/ScanOrder/types.d.ts +307 -0
- package/dist/solution/ScanOrder/types.js +35 -0
- package/dist/solution/ScanOrder/utils.d.ts +172 -0
- package/dist/solution/ScanOrder/utils.js +796 -0
- package/dist/solution/ShopDiscount/index.d.ts +6 -2
- package/dist/solution/ShopDiscount/index.js +194 -110
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.js +1 -2
- package/dist/solution/ShopDiscount/utils.d.ts +1 -0
- package/dist/solution/ShopDiscount/utils.js +52 -27
- package/dist/solution/VenueBooking/index.d.ts +225 -0
- package/dist/solution/VenueBooking/index.js +3749 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +156 -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/dist/types/index.d.ts +1 -0
- 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 +49 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -2
- package/lib/model/strategy/adapter/walletPass/evaluator.js +7 -36
- 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/Cart/utils/changePrice.js +13 -9
- package/lib/modules/Discount/availability.d.ts +7 -0
- package/lib/modules/Discount/availability.js +91 -0
- package/lib/modules/Discount/entitlementPass.d.ts +34 -0
- package/lib/modules/Discount/entitlementPass.js +184 -0
- package/lib/modules/Discount/entitlementState.d.ts +8 -0
- package/lib/modules/Discount/entitlementState.js +206 -0
- package/lib/modules/Discount/index.d.ts +12 -3
- package/lib/modules/Discount/index.js +123 -12
- package/lib/modules/Discount/types.d.ts +42 -22
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- 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 +67 -1
- package/lib/modules/Order/index.js +529 -1
- package/lib/modules/Order/types.d.ts +176 -12
- package/lib/modules/Order/utils.d.ts +128 -0
- package/lib/modules/Order/utils.js +514 -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/types.d.ts +7 -0
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +5 -4
- 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/entitlementLines.d.ts +8 -0
- package/lib/modules/Rules/entitlementLines.js +158 -0
- package/lib/modules/Rules/index.d.ts +17 -11
- package/lib/modules/Rules/index.js +548 -798
- package/lib/modules/Rules/types.d.ts +2 -4
- 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 +45 -34
- package/lib/modules/index.d.ts +5 -0
- package/lib/modules/index.js +11 -1
- package/lib/plugins/window.d.ts +3 -2
- package/lib/solution/BookingByStep/index.d.ts +17 -3
- package/lib/solution/BookingByStep/index.js +45 -4
- package/lib/solution/BookingByStep/types.d.ts +4 -1
- package/lib/solution/BookingByStep/types.js +15 -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 +158 -0
- package/lib/solution/ScanOrder/index.js +2135 -0
- package/lib/solution/ScanOrder/types.d.ts +307 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +172 -0
- package/lib/solution/ScanOrder/utils.js +658 -0
- package/lib/solution/ShopDiscount/index.d.ts +6 -2
- package/lib/solution/ShopDiscount/index.js +94 -50
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.d.ts +1 -0
- package/lib/solution/ShopDiscount/utils.js +48 -11
- package/lib/solution/VenueBooking/index.d.ts +225 -0
- package/lib/solution/VenueBooking/index.js +2073 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +156 -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/lib/types/index.d.ts +1 -0
- 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:
|
|
@@ -616,6 +595,27 @@ export var calculateTaxFee = function calculateTaxFee(shopInfo, items) {
|
|
|
616
595
|
}, new Decimal(0));
|
|
617
596
|
return totalTaxFee;
|
|
618
597
|
};
|
|
598
|
+
var getCartItemDepositData = function getCartItemDepositData(item) {
|
|
599
|
+
var _target$_productOrigi, _target$_origin, _target$_origin2;
|
|
600
|
+
var target = item;
|
|
601
|
+
return (target === null || target === void 0 || (_target$_productOrigi = target._productOrigin) === null || _target$_productOrigi === void 0 ? void 0 : _target$_productOrigi.custom_deposit_data) || (target === null || target === void 0 || (_target$_origin = target._origin) === null || _target$_origin === void 0 ? void 0 : _target$_origin.custom_deposit_data) || (target === null || target === void 0 || (_target$_origin2 = target._origin) === null || _target$_origin2 === void 0 || (_target$_origin2 = _target$_origin2.product) === null || _target$_origin2 === void 0 ? void 0 : _target$_origin2.custom_deposit_data);
|
|
602
|
+
};
|
|
603
|
+
var getCartItemQuantity = function getCartItemQuantity(item) {
|
|
604
|
+
return new Decimal((item === null || item === void 0 ? void 0 : item.num) || 1);
|
|
605
|
+
};
|
|
606
|
+
var calculateCartItemDepositTotal = function calculateCartItemDepositTotal(item) {
|
|
607
|
+
var _item$deposit;
|
|
608
|
+
var depositData = getCartItemDepositData(item);
|
|
609
|
+
if ((depositData === null || depositData === void 0 ? void 0 : depositData.has_deposit) == 1 && typeof (depositData === null || depositData === void 0 ? void 0 : depositData.deposit_fixed) === 'string' && typeof (depositData === null || depositData === void 0 ? void 0 : depositData.deposit_percentage) === 'string') {
|
|
610
|
+
var _ref7, _summaryTotal;
|
|
611
|
+
var lineTotal = new Decimal((_ref7 = (_summaryTotal = item.summaryTotal) !== null && _summaryTotal !== void 0 ? _summaryTotal : item.total) !== null && _ref7 !== void 0 ? _ref7 : 0);
|
|
612
|
+
var quantity = getCartItemQuantity(item);
|
|
613
|
+
var fixedTotal = new Decimal(depositData.deposit_fixed || 0).times(quantity);
|
|
614
|
+
var percentageTotal = new Decimal(depositData.deposit_percentage || 0).times(lineTotal);
|
|
615
|
+
return fixedTotal.plus(percentageTotal);
|
|
616
|
+
}
|
|
617
|
+
return new Decimal((item === null || item === void 0 || (_item$deposit = item.deposit) === null || _item$deposit === void 0 ? void 0 : _item$deposit.total) || 0);
|
|
618
|
+
};
|
|
619
619
|
|
|
620
620
|
/**
|
|
621
621
|
* @title: 计算定金
|
|
@@ -630,9 +630,9 @@ export var calculateDeposit = function calculateDeposit(items) {
|
|
|
630
630
|
var hasDeposit = false;
|
|
631
631
|
var total = items.reduce(function (sum, item) {
|
|
632
632
|
if (item !== null && item !== void 0 && item.deposit) {
|
|
633
|
-
var _item$
|
|
633
|
+
var _item$deposit2;
|
|
634
634
|
hasDeposit = true;
|
|
635
|
-
var cartItemTotalPrice =
|
|
635
|
+
var cartItemTotalPrice = calculateCartItemDepositTotal(item);
|
|
636
636
|
// 将协议数据去重合并
|
|
637
637
|
item === null || item === void 0 || (_item$deposit2 = item.deposit) === null || _item$deposit2 === void 0 || (_item$deposit2 = _item$deposit2.protocols) === null || _item$deposit2 === void 0 || _item$deposit2.forEach(function (protocol) {
|
|
638
638
|
if (protocols.findIndex(function (p) {
|
|
@@ -669,9 +669,9 @@ export var calculateDeposit = function calculateDeposit(items) {
|
|
|
669
669
|
* @param options.isEdit 是否处于“编辑中”。`false` 时会优先走后端金额直取逻辑(若存在)
|
|
670
670
|
* @returns 订单附加费金额(number,金额单位与商品价格一致)
|
|
671
671
|
*/
|
|
672
|
-
export var getSurchargeAmount = function getSurchargeAmount(
|
|
673
|
-
var bookingDetail =
|
|
674
|
-
bookingId =
|
|
672
|
+
export var getSurchargeAmount = function getSurchargeAmount(_ref8, surcharge, options) {
|
|
673
|
+
var bookingDetail = _ref8.bookingDetail,
|
|
674
|
+
bookingId = _ref8.bookingId;
|
|
675
675
|
var isEdit = options.isEdit;
|
|
676
676
|
// 订单未变更过
|
|
677
677
|
if (!isEdit) {
|
|
@@ -683,8 +683,8 @@ export var getSurchargeAmount = function getSurchargeAmount(_ref7, surcharge, op
|
|
|
683
683
|
if (!Array.isArray(surcharge)) return 0;
|
|
684
684
|
// 新增状态使用 getSurcharge 的返回值进行求和
|
|
685
685
|
return surcharge.reduce(function (total, item) {
|
|
686
|
-
return total
|
|
687
|
-
}, 0);
|
|
686
|
+
return total.plus(item.value || 0);
|
|
687
|
+
}, new Decimal(0)).toNumber();
|
|
688
688
|
};
|
|
689
689
|
|
|
690
690
|
// bundle商品是否是原价
|
|
@@ -716,20 +716,30 @@ var getDiscountAmount = function getDiscountAmount(discounts) {
|
|
|
716
716
|
* 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
|
|
717
717
|
*/
|
|
718
718
|
var getMainProductTotal = function getMainProductTotal(item) {
|
|
719
|
-
var
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
719
|
+
var _ref9, _ref10, _item$main_product_se, _item$metadata, _item$metadata2, _item$metadata3, _item$metadata4;
|
|
720
|
+
// 新语义 v2 下 `main_product_selling_price` / `metadata.main_product_selling_price`
|
|
721
|
+
// 已经是"含 option、含主商品折扣"的主价,直接作为主商品基准,无需再减折扣或加 option。
|
|
722
|
+
// 仅需叠加 markup / markdown 类 bundle(原价 bundle 的税费单独处理)。
|
|
723
|
+
var total = new Decimal((_ref9 = (_ref10 = (_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 && _ref10 !== void 0 ? _ref10 : item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.main_product_original_price) !== null && _ref9 !== void 0 ? _ref9 : 0);
|
|
724
|
+
|
|
725
|
+
// 做个兜底 如果新语义价格字段都没有,则切换回老逻辑
|
|
726
|
+
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;
|
|
727
|
+
if (!hasMainProductPrice) {
|
|
728
|
+
var _ref11, _ref12, _item$main_product_se2, _item$metadata5, _item$_origin3, _item$_originData;
|
|
729
|
+
total = new Decimal((_ref11 = (_ref12 = (_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 && _ref12 !== void 0 ? _ref12 : item.price) !== null && _ref11 !== void 0 ? _ref11 : 0);
|
|
730
|
+
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) {
|
|
731
|
+
var _item$metadata6;
|
|
732
|
+
return !(item !== null && item !== void 0 && (_item$metadata6 = item.metadata) !== null && _item$metadata6 !== void 0 && _item$metadata6.custom_product_bundle_map_id);
|
|
733
|
+
})) || [];
|
|
734
|
+
var mainProductDiscountAmount = getDiscountAmount(discount);
|
|
735
|
+
total = total.minus(mainProductDiscountAmount);
|
|
736
|
+
|
|
737
|
+
// 单规格
|
|
738
|
+
if (item !== null && item !== void 0 && item.option && Array.isArray(item === null || item === void 0 ? void 0 : item.option)) {
|
|
739
|
+
total = total.add(item === null || item === void 0 ? void 0 : item.option.reduce(function (t, option) {
|
|
740
|
+
return t.add(new Decimal(option.price || 0).mul(option.num || 1));
|
|
741
|
+
}, new Decimal(0)));
|
|
742
|
+
}
|
|
733
743
|
}
|
|
734
744
|
var _iterator4 = _createForOfIteratorHelper((item === null || item === void 0 ? void 0 : item.bundle) || []),
|
|
735
745
|
_step4;
|
|
@@ -737,9 +747,9 @@ var getMainProductTotal = function getMainProductTotal(item) {
|
|
|
737
747
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
738
748
|
var bundleItem = _step4.value;
|
|
739
749
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
740
|
-
var
|
|
741
|
-
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price和 price 其实都已经是折后价格了,不需要单独再减一次
|
|
742
|
-
var bundleItemTotal = new Decimal((
|
|
750
|
+
var _ref13, _bundleItem$bundle_se2;
|
|
751
|
+
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price 和 price 其实都已经是折后价格了,不需要单独再减一次
|
|
752
|
+
var bundleItemTotal = new Decimal((_ref13 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref13 !== void 0 ? _ref13 : 0);
|
|
743
753
|
total = total.add(bundleItemTotal);
|
|
744
754
|
}
|
|
745
755
|
}
|
|
@@ -859,12 +869,12 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
|
|
|
859
869
|
* @param options.scheduleById schedule 映射表:`{ [scheduleId]: schedule }`(用于根据配置的 `available_schedule_ids` 做日程匹配)
|
|
860
870
|
* @returns 附加费列表(仅返回金额 > 0 的项)
|
|
861
871
|
*/
|
|
862
|
-
export var getSurcharge = function getSurcharge(
|
|
872
|
+
export var getSurcharge = function getSurcharge(_ref14, options) {
|
|
863
873
|
var _service$filter;
|
|
864
|
-
var service =
|
|
865
|
-
addons =
|
|
866
|
-
bookingDetail =
|
|
867
|
-
bookingId =
|
|
874
|
+
var service = _ref14.service,
|
|
875
|
+
addons = _ref14.addons,
|
|
876
|
+
bookingDetail = _ref14.bookingDetail,
|
|
877
|
+
bookingId = _ref14.bookingId;
|
|
868
878
|
var isEdit = options.isEdit,
|
|
869
879
|
isInScheduleByDate = options.isInScheduleByDate,
|
|
870
880
|
surcharge_list = options.surcharge_list,
|
|
@@ -986,11 +996,11 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
986
996
|
scheduleById: scheduleById || {},
|
|
987
997
|
isInScheduleByDate: isInScheduleByDate
|
|
988
998
|
})) {
|
|
989
|
-
var
|
|
999
|
+
var _ref15, _bundleItem$bundle_se3;
|
|
990
1000
|
var _mainQuantity = item.num || 1;
|
|
991
1001
|
matchedItems.push({
|
|
992
1002
|
isMain: false,
|
|
993
|
-
total: Number((
|
|
1003
|
+
total: Number((_ref15 = (_bundleItem$bundle_se3 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se3 !== void 0 ? _bundleItem$bundle_se3 : bundleItem.price) !== null && _ref15 !== void 0 ? _ref15 : 0),
|
|
994
1004
|
quantity: bundleItem.num || bundleItem.quantity || 1,
|
|
995
1005
|
item: bundleItem,
|
|
996
1006
|
mainQuantity: _mainQuantity // 子商品的mainQuantity是所属主商品的quantity
|
|
@@ -1206,9 +1216,9 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
1206
1216
|
}
|
|
1207
1217
|
return surchargeWithAmount;
|
|
1208
1218
|
};
|
|
1209
|
-
function resetItemsSurchargeSideEffects(
|
|
1210
|
-
var service =
|
|
1211
|
-
addons =
|
|
1219
|
+
function resetItemsSurchargeSideEffects(_ref16) {
|
|
1220
|
+
var service = _ref16.service,
|
|
1221
|
+
addons = _ref16.addons;
|
|
1212
1222
|
var resetItem = function resetItem(item) {
|
|
1213
1223
|
if (!item) return;
|
|
1214
1224
|
item.surcharge_fee = 0;
|
package/dist/modules/index.d.ts
CHANGED
|
@@ -11,4 +11,9 @@ 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';
|
|
19
|
+
export * from './Holder';
|
package/dist/modules/index.js
CHANGED
|
@@ -11,4 +11,9 @@ 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";
|
|
19
|
+
export * from "./Holder";
|
package/dist/plugins/window.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WalletPassEvaluator } from '../model';
|
|
2
1
|
import { Plugin } from '../types';
|
|
2
|
+
import type { WalletPassEvaluator } from '../model/strategy/adapter/walletPass/evaluator';
|
|
3
3
|
/**
|
|
4
4
|
* WindowPlugin 接口定义
|
|
5
5
|
*/
|
|
@@ -15,7 +15,8 @@ export interface WindowPlugin extends Plugin {
|
|
|
15
15
|
document: Partial<Document>;
|
|
16
16
|
history: History;
|
|
17
17
|
interaction?: any;
|
|
18
|
-
getWalletPassEvaluator?: () => WalletPassEvaluator;
|
|
18
|
+
getWalletPassEvaluator?: () => WalletPassEvaluator | undefined;
|
|
19
|
+
getLocalStorage?: (key: string) => string | null;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* 简单的 Storage 接口实现
|
|
@@ -10,6 +10,7 @@ import { ITime } from '../../modules/Date/types';
|
|
|
10
10
|
import dayjs from 'dayjs';
|
|
11
11
|
import { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
|
|
12
12
|
import { IHolder, IFetchHolderAccountsParams } from '../../modules/AccountList/types';
|
|
13
|
+
import { IAppendFormRecordParams } from '../../modules/Holder/types';
|
|
13
14
|
export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
14
15
|
protected defaultName: string;
|
|
15
16
|
protected defaultVersion: string;
|
|
@@ -126,6 +127,20 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
126
127
|
* @param params
|
|
127
128
|
*/
|
|
128
129
|
fetchHolderAccountsAsync(params: IFetchHolderAccountsParams): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* 获取 holder 表单 map
|
|
132
|
+
*/
|
|
133
|
+
getHolderFormMap(): import("../../modules").HolderFormMap;
|
|
134
|
+
/**
|
|
135
|
+
* 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
|
|
136
|
+
*/
|
|
137
|
+
refreshAllHolderFormRecords(params?: {
|
|
138
|
+
customer_id?: number;
|
|
139
|
+
}): Promise<import("../../modules").HolderFormMap>;
|
|
140
|
+
/**
|
|
141
|
+
* 添加表单记录
|
|
142
|
+
*/
|
|
143
|
+
appendFormRecord(params: IAppendFormRecordParams): import("../../modules").IFormRecord;
|
|
129
144
|
setDateRange(dateRange: ITime[]): Promise<void>;
|
|
130
145
|
clearDateRange(): void;
|
|
131
146
|
getDateRange(): Promise<ITime[]>;
|
|
@@ -144,7 +159,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
144
159
|
getSummary(): Promise<{
|
|
145
160
|
subtotal: string | number;
|
|
146
161
|
total: string | number;
|
|
147
|
-
originTotal: string | number;
|
|
148
162
|
taxTitle?: string | undefined;
|
|
149
163
|
totalTaxFee?: string | number | undefined;
|
|
150
164
|
isPriceIncludeTax?: 0 | 1 | undefined;
|
|
@@ -302,7 +316,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
302
316
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
303
317
|
errorList: any[];
|
|
304
318
|
};
|
|
305
|
-
getTimeSlotByAllResources(resources_code: string): any[];
|
|
319
|
+
getTimeSlotByAllResources(resources_code: string, split?: number): any[];
|
|
306
320
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
307
321
|
resources_code: string;
|
|
308
322
|
startDate: string;
|
|
@@ -311,7 +325,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
325
|
date: string;
|
|
312
326
|
status: string;
|
|
313
327
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
328
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
315
329
|
}[]>;
|
|
316
330
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
331
|
private getScheduleDataByIds;
|