@pisell/pisellos 2.2.243 → 2.2.244
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/model/strategy/adapter/promotion/evaluator.js +2 -3
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +4 -7
- package/dist/modules/Cart/utils/cartProduct.js +3 -24
- package/dist/modules/Cart/utils/changePrice.js +11 -11
- package/dist/modules/Customer/index.d.ts +0 -20
- package/dist/modules/Customer/index.js +83 -172
- package/dist/modules/Customer/types.d.ts +0 -2
- package/dist/modules/Discount/index.js +3 -4
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.d.ts +0 -8
- package/dist/modules/OpenData/index.js +17 -37
- package/dist/modules/Order/index.d.ts +18 -268
- package/dist/modules/Order/index.js +757 -3306
- package/dist/modules/Order/types.d.ts +31 -279
- package/dist/modules/Order/types.js +0 -38
- package/dist/modules/Order/utils.d.ts +5 -147
- package/dist/modules/Order/utils.js +103 -746
- package/dist/modules/Payment/index.d.ts +13 -10
- package/dist/modules/Payment/index.js +837 -467
- package/dist/modules/Payment/types.d.ts +0 -2
- package/dist/modules/Payment/utils.js +1 -2
- package/dist/modules/Payment/walletpass.js +7 -14
- package/dist/modules/ProductList/index.d.ts +12 -16
- package/dist/modules/ProductList/index.js +59 -133
- package/dist/modules/ProductList/types.d.ts +0 -14
- package/dist/modules/Quotation/index.d.ts +1 -0
- package/dist/modules/Quotation/index.js +22 -25
- package/dist/modules/Rules/index.d.ts +0 -4
- package/dist/modules/Rules/index.js +69 -93
- package/dist/modules/Rules/types.d.ts +0 -1
- package/dist/modules/SalesSummary/index.d.ts +25 -8
- package/dist/modules/SalesSummary/index.js +35 -86
- package/dist/modules/SalesSummary/types.d.ts +1 -4
- package/dist/modules/SalesSummary/utils.d.ts +25 -2
- package/dist/modules/SalesSummary/utils.js +162 -794
- package/dist/modules/Schedule/index.d.ts +0 -7
- package/dist/modules/Schedule/index.js +2 -24
- package/dist/modules/Summary/index.js +3 -4
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/request.d.ts +0 -1
- package/dist/server/index.d.ts +1 -204
- package/dist/server/index.js +928 -3658
- package/dist/server/modules/index.d.ts +0 -2
- package/dist/server/modules/index.js +0 -2
- package/dist/server/modules/order/index.d.ts +4 -120
- package/dist/server/modules/order/index.js +483 -1779
- package/dist/server/modules/order/types.d.ts +3 -32
- package/dist/server/modules/order/types.js +0 -8
- package/dist/server/modules/order/utils/filterBookings.js +3 -26
- package/dist/server/modules/order/utils/filterOrders.js +8 -23
- package/dist/server/modules/products/index.d.ts +7 -34
- package/dist/server/modules/products/index.js +317 -631
- package/dist/server/modules/resource/index.d.ts +0 -2
- package/dist/server/modules/resource/index.js +3 -29
- package/dist/server/modules/schedule/index.d.ts +4 -4
- package/dist/server/modules/schedule/index.js +88 -111
- package/dist/solution/BaseSales/index.d.ts +9 -131
- package/dist/solution/BaseSales/index.js +447 -1944
- package/dist/solution/BaseSales/types.d.ts +6 -76
- package/dist/solution/BaseSales/types.js +4 -5
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +24 -105
- package/dist/solution/BaseSales/utils.d.ts +1 -1
- package/dist/solution/BaseSales/utils.js +21 -62
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +10 -270
- package/dist/solution/BookingTicket/index.js +237 -1772
- package/dist/solution/BookingTicket/types.d.ts +1 -118
- package/dist/solution/BookingTicket/types.js +2 -41
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
- package/dist/solution/BookingTicket/utils/bookingStatus.js +0 -70
- package/dist/solution/BookingTicket/utils/cartView.d.ts +1 -9
- package/dist/solution/BookingTicket/utils/cartView.js +7 -94
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -5
- package/dist/solution/BookingTicket/utils/scan/index.js +8 -20
- package/dist/solution/Checkout/appointmentDemo.json +1 -0
- package/dist/solution/Checkout/index.d.ts +0 -1
- package/dist/solution/Checkout/index.js +9 -10
- package/dist/solution/RegisterAndLogin/config.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +3 -9
- package/dist/solution/ScanOrder/index.js +134 -241
- package/dist/solution/ScanOrder/types.d.ts +5 -9
- package/dist/solution/ScanOrder/types.js +3 -2
- package/dist/solution/ScanOrder/utils.d.ts +1 -1
- package/dist/solution/ScanOrder/utils.js +22 -84
- package/dist/solution/VenueBooking/index.d.ts +2 -5
- package/dist/solution/VenueBooking/index.js +59 -110
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +2 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/dist/types/index.d.ts +0 -10
- package/lib/model/strategy/adapter/promotion/evaluator.js +1 -2
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/model/strategy/adapter/walletPass/utils.js +2 -3
- package/lib/modules/Cart/utils/cartProduct.js +3 -20
- package/lib/modules/Cart/utils/changePrice.js +20 -12
- package/lib/modules/Customer/index.d.ts +0 -20
- package/lib/modules/Customer/index.js +11 -64
- package/lib/modules/Customer/types.d.ts +0 -2
- package/lib/modules/Discount/index.js +1 -5
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.d.ts +0 -8
- package/lib/modules/OpenData/index.js +5 -19
- package/lib/modules/Order/index.d.ts +18 -268
- package/lib/modules/Order/index.js +344 -2149
- package/lib/modules/Order/types.d.ts +31 -279
- package/lib/modules/Order/types.js +0 -1
- package/lib/modules/Order/utils.d.ts +5 -147
- package/lib/modules/Order/utils.js +46 -614
- package/lib/modules/Payment/index.d.ts +13 -10
- package/lib/modules/Payment/index.js +150 -18
- package/lib/modules/Payment/types.d.ts +0 -2
- package/lib/modules/Payment/utils.js +1 -2
- package/lib/modules/Payment/walletpass.js +3 -7
- package/lib/modules/ProductList/index.d.ts +12 -16
- package/lib/modules/ProductList/index.js +4 -41
- package/lib/modules/ProductList/types.d.ts +0 -14
- package/lib/modules/Quotation/index.d.ts +1 -0
- package/lib/modules/Quotation/index.js +16 -19
- package/lib/modules/Rules/index.d.ts +0 -4
- package/lib/modules/Rules/index.js +120 -136
- package/lib/modules/Rules/types.d.ts +0 -1
- package/lib/modules/SalesSummary/index.d.ts +25 -8
- package/lib/modules/SalesSummary/index.js +4 -30
- package/lib/modules/SalesSummary/types.d.ts +1 -4
- package/lib/modules/SalesSummary/utils.d.ts +25 -2
- package/lib/modules/SalesSummary/utils.js +91 -645
- package/lib/modules/Schedule/index.d.ts +0 -7
- package/lib/modules/Schedule/index.js +1 -17
- package/lib/modules/Summary/index.js +4 -5
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/request.d.ts +0 -1
- package/lib/server/index.d.ts +1 -204
- package/lib/server/index.js +57 -1888
- package/lib/server/modules/index.d.ts +0 -2
- package/lib/server/modules/index.js +0 -3
- package/lib/server/modules/order/index.d.ts +4 -120
- package/lib/server/modules/order/index.js +142 -919
- package/lib/server/modules/order/types.d.ts +3 -32
- package/lib/server/modules/order/utils/filterBookings.js +5 -24
- package/lib/server/modules/order/utils/filterOrders.js +6 -15
- package/lib/server/modules/products/index.d.ts +7 -34
- package/lib/server/modules/products/index.js +54 -189
- package/lib/server/modules/resource/index.d.ts +0 -2
- package/lib/server/modules/resource/index.js +3 -27
- package/lib/server/modules/schedule/index.d.ts +4 -4
- package/lib/server/modules/schedule/index.js +40 -47
- package/lib/solution/BaseSales/index.d.ts +9 -131
- package/lib/solution/BaseSales/index.js +63 -1106
- package/lib/solution/BaseSales/types.d.ts +6 -76
- package/lib/solution/BaseSales/types.js +1 -3
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +18 -106
- package/lib/solution/BaseSales/utils.d.ts +1 -1
- package/lib/solution/BaseSales/utils.js +10 -54
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +10 -270
- package/lib/solution/BookingTicket/index.js +29 -922
- package/lib/solution/BookingTicket/types.d.ts +1 -118
- package/lib/solution/BookingTicket/types.js +0 -11
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
- package/lib/solution/BookingTicket/utils/bookingStatus.js +2 -44
- package/lib/solution/BookingTicket/utils/cartView.d.ts +1 -9
- package/lib/solution/BookingTicket/utils/cartView.js +6 -61
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -5
- package/lib/solution/BookingTicket/utils/scan/index.js +3 -17
- package/lib/solution/Checkout/appointmentDemo.json +1 -0
- package/lib/solution/Checkout/index.d.ts +0 -1
- package/lib/solution/Checkout/index.js +2 -1
- package/lib/solution/RegisterAndLogin/config.js +10 -2
- package/lib/solution/ScanOrder/index.d.ts +3 -9
- package/lib/solution/ScanOrder/index.js +70 -153
- package/lib/solution/ScanOrder/types.d.ts +5 -9
- package/lib/solution/ScanOrder/utils.d.ts +1 -1
- package/lib/solution/ScanOrder/utils.js +17 -83
- package/lib/solution/VenueBooking/index.d.ts +2 -5
- package/lib/solution/VenueBooking/index.js +17 -54
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +2 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/lib/types/index.d.ts +0 -10
- package/package.json +1 -1
- package/dist/modules/BookingContext/index.d.ts +0 -48
- package/dist/modules/BookingContext/index.js +0 -566
- package/dist/modules/BookingContext/types.d.ts +0 -102
- package/dist/modules/BookingContext/types.js +0 -51
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -284
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -145
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -218
- package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/dist/modules/BookingContext/utils/flexible.js +0 -56
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
- package/dist/modules/BookingContext/utils/index.d.ts +0 -11
- package/dist/modules/BookingContext/utils/index.js +0 -11
- package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/dist/modules/BookingContext/utils/noResource.js +0 -77
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +0 -36
- package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/dist/modules/BookingContext/utils/productExtend.js +0 -339
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
- package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
- package/dist/modules/BookingContext/utils/resources.js +0 -486
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/dist/modules/Order/utils/manualProductDiscount.js +0 -210
- package/dist/modules/SurchargeList/index.d.ts +0 -16
- package/dist/modules/SurchargeList/index.js +0 -162
- package/dist/modules/SurchargeList/types.d.ts +0 -11
- package/dist/modules/SurchargeList/types.js +0 -1
- package/dist/server/modules/payment/index.d.ts +0 -28
- package/dist/server/modules/payment/index.js +0 -305
- package/dist/server/modules/payment/types.d.ts +0 -9
- package/dist/server/modules/payment/types.js +0 -1
- package/dist/server/test.json +0 -713
- package/dist/server/utils/small-ticket.d.ts +0 -71
- package/dist/server/utils/small-ticket.js +0 -830
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
- package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1438
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +0 -95
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +0 -123
- package/dist/solution/BookingTicket/utils/exampleData.js +0 -183
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -438
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -399
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -56
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +0 -150
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +0 -78
- package/lib/modules/BookingContext/index.d.ts +0 -48
- package/lib/modules/BookingContext/index.js +0 -368
- package/lib/modules/BookingContext/types.d.ts +0 -102
- package/lib/modules/BookingContext/types.js +0 -34
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -276
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -151
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -201
- package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/lib/modules/BookingContext/utils/flexible.js +0 -80
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
- package/lib/modules/BookingContext/utils/index.d.ts +0 -11
- package/lib/modules/BookingContext/utils/index.js +0 -43
- package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/lib/modules/BookingContext/utils/noResource.js +0 -90
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +0 -56
- package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/lib/modules/BookingContext/utils/productExtend.js +0 -283
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
- package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
- package/lib/modules/BookingContext/utils/resources.js +0 -377
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/lib/modules/Order/utils/manualProductDiscount.js +0 -206
- package/lib/modules/SurchargeList/index.d.ts +0 -16
- package/lib/modules/SurchargeList/index.js +0 -89
- package/lib/modules/SurchargeList/types.d.ts +0 -11
- package/lib/modules/SurchargeList/types.js +0 -17
- package/lib/server/modules/payment/index.d.ts +0 -28
- package/lib/server/modules/payment/index.js +0 -192
- package/lib/server/modules/payment/types.d.ts +0 -9
- package/lib/server/modules/payment/types.js +0 -17
- package/lib/server/test.json +0 -713
- package/lib/server/utils/small-ticket.d.ts +0 -71
- package/lib/server/utils/small-ticket.js +0 -781
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
- package/lib/solution/BaseSales/utils/cartPromotion.js +0 -992
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +0 -125
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +0 -123
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -254
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -168
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -51
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +0 -127
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +0 -85
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import type { OrderProduct } from '../../../modules/Order/types';
|
|
2
|
-
/**
|
|
3
|
-
* Cart promotion 工具集(OS 内部纯函数)
|
|
4
|
-
*
|
|
5
|
-
* 这是 `private-materials/components/booking/hooks/usePromotion.ts` 中促销/赠品
|
|
6
|
-
* 核心计算(evaluator → 拆分 / 计价 → 赠品差异化 / 未满足提示 / 标签)的 OS 等价实现。
|
|
7
|
-
*
|
|
8
|
-
* 与 legacy 的关键差异:
|
|
9
|
-
* - legacy 操作 booking `_extend.*` 形状;OS 操作 `OrderProduct.metadata.*` 形状。
|
|
10
|
-
* - 行唯一标识不再用 `_id`,统一改用 `metadata.unique_identification_number`。
|
|
11
|
-
* - 赠品标签存到 `metadata._giftInfo`;主商品促销信息存到 `metadata._promotion`;
|
|
12
|
-
* 商品卡列表的促销 tag 存到 `metadata._promotionTags`。
|
|
13
|
-
*
|
|
14
|
-
* 仅暴露纯函数,不持有任何状态;评估器以参数注入。
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* const evaluator = appHelper.utils.promotionEvaluator;
|
|
18
|
-
* const result = processCartPromotion(tempOrder.products, evaluator);
|
|
19
|
-
* // result.products: 处理后的商品(带 _promotion / 拆分)
|
|
20
|
-
* // result.giftActions: 需要 add / reduce / remove 的赠品操作
|
|
21
|
-
* // result.unfulfilledPromotions: 未满足策略列表(购物车底部 alert)
|
|
22
|
-
*/
|
|
23
|
-
/** Cart 评估器协议(只描述本文件用到的方法,避免循环依赖) */
|
|
24
|
-
export interface CartPromotionEvaluator {
|
|
25
|
-
evaluateCartWithPricing(input: {
|
|
26
|
-
products: any[];
|
|
27
|
-
channel?: string;
|
|
28
|
-
}): {
|
|
29
|
-
products: Array<{
|
|
30
|
-
id: number;
|
|
31
|
-
originalId?: number;
|
|
32
|
-
product_id: number;
|
|
33
|
-
product_variant_id: number;
|
|
34
|
-
quantity: number;
|
|
35
|
-
price: number;
|
|
36
|
-
finalPrice: number;
|
|
37
|
-
strategyId?: string;
|
|
38
|
-
strategyMetadata?: any;
|
|
39
|
-
inPromotion: boolean;
|
|
40
|
-
isSplit?: boolean;
|
|
41
|
-
matchedBundleIndex?: number;
|
|
42
|
-
bundle?: any[];
|
|
43
|
-
_originalItem?: any;
|
|
44
|
-
_originalId?: string;
|
|
45
|
-
_originalIndex?: number;
|
|
46
|
-
}>;
|
|
47
|
-
gifts: Array<{
|
|
48
|
-
strategyId: string;
|
|
49
|
-
strategyName: string | Record<string, string>;
|
|
50
|
-
giftCount: number;
|
|
51
|
-
giftOptions: Array<{
|
|
52
|
-
product_id: number;
|
|
53
|
-
product_variant_id: number;
|
|
54
|
-
}>;
|
|
55
|
-
}>;
|
|
56
|
-
totalDiscount: number;
|
|
57
|
-
};
|
|
58
|
-
getProductsApplicableStrategies(input: {
|
|
59
|
-
products: any[];
|
|
60
|
-
channel?: string;
|
|
61
|
-
}, matchVariant?: boolean): Array<{
|
|
62
|
-
product: any;
|
|
63
|
-
applicableStrategies: Array<{
|
|
64
|
-
strategyId: string;
|
|
65
|
-
strategyName: string | Record<string, string>;
|
|
66
|
-
strategyMetadata: any;
|
|
67
|
-
actionType: string;
|
|
68
|
-
actionDetail: any;
|
|
69
|
-
display?: {
|
|
70
|
-
text: string | Record<string, string>;
|
|
71
|
-
type: string;
|
|
72
|
-
};
|
|
73
|
-
requiredQuantity: number;
|
|
74
|
-
eligibleProducts: Array<{
|
|
75
|
-
product_id: number;
|
|
76
|
-
product_variant_id: number;
|
|
77
|
-
}>;
|
|
78
|
-
}>;
|
|
79
|
-
hasApplicableStrategy: boolean;
|
|
80
|
-
}>;
|
|
81
|
-
}
|
|
82
|
-
/** 单个赠品减量项 */
|
|
83
|
-
export interface GiftReduceItem {
|
|
84
|
-
/** 赠品行的 `metadata.unique_identification_number` */
|
|
85
|
-
uid: string;
|
|
86
|
-
currentQuantity: number;
|
|
87
|
-
/** 目标数量(>0;==0 走 toRemove) */
|
|
88
|
-
newQuantity: number;
|
|
89
|
-
}
|
|
90
|
-
/** 赠品新增项 */
|
|
91
|
-
export interface GiftToAddAction {
|
|
92
|
-
strategyId: string;
|
|
93
|
-
strategyName: string | Record<string, string>;
|
|
94
|
-
giftCount: number;
|
|
95
|
-
giftOptions: Array<{
|
|
96
|
-
product_id: number;
|
|
97
|
-
product_variant_id: number;
|
|
98
|
-
}>;
|
|
99
|
-
/** 触发此赠品的主商品 uid 列表 */
|
|
100
|
-
sourceProductIds: string[];
|
|
101
|
-
}
|
|
102
|
-
/** 赠品操作集合(OS 侧根据它落地 tempOrder.products) */
|
|
103
|
-
export interface GiftActions {
|
|
104
|
-
toAdd: GiftToAddAction[];
|
|
105
|
-
toReduce: Array<{
|
|
106
|
-
strategyId: string;
|
|
107
|
-
items: GiftReduceItem[];
|
|
108
|
-
}>;
|
|
109
|
-
/** 需要删除的赠品 uid 列表 */
|
|
110
|
-
toRemove: string[];
|
|
111
|
-
}
|
|
112
|
-
/** 未满足促销提示项(购物车底部 alert 数据源) */
|
|
113
|
-
export interface UnfulfilledPromotion {
|
|
114
|
-
strategyId: string;
|
|
115
|
-
strategyName: string | Record<string, string>;
|
|
116
|
-
actionType: string;
|
|
117
|
-
/** 还差几件 */
|
|
118
|
-
needQuantity: number;
|
|
119
|
-
/** 当前已选几件 */
|
|
120
|
-
currentQuantity: number;
|
|
121
|
-
/** 凑齐促销所需件数 */
|
|
122
|
-
requiredQuantity: number;
|
|
123
|
-
/** 可参与本促销的商品列表 */
|
|
124
|
-
eligibleProducts: Array<{
|
|
125
|
-
product_id: number;
|
|
126
|
-
product_variant_id: number;
|
|
127
|
-
}>;
|
|
128
|
-
strategyMetadata?: any;
|
|
129
|
-
display?: {
|
|
130
|
-
text: string | Record<string, string>;
|
|
131
|
-
type: string;
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
/** 商品卡促销标签结构(写入 `metadata._promotionTags`) */
|
|
135
|
-
export interface PromotionTag {
|
|
136
|
-
text: string | Record<string, string>;
|
|
137
|
-
type: string;
|
|
138
|
-
strategyId?: string;
|
|
139
|
-
}
|
|
140
|
-
/** processCartPromotion 输出 */
|
|
141
|
-
export interface ProcessCartPromotionResult {
|
|
142
|
-
/** 处理后的商品列表(含拆分行、_promotion / _giftInfo 元数据) */
|
|
143
|
-
products: OrderProduct[];
|
|
144
|
-
totalDiscount: number;
|
|
145
|
-
gifts: Array<GiftToAddAction>;
|
|
146
|
-
giftActions: GiftActions;
|
|
147
|
-
unfulfilledPromotions: UnfulfilledPromotion[];
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* 获取商品的「主商品基础价」用于评估器入参。
|
|
151
|
-
*
|
|
152
|
-
* 优先级(与 OS v2 schema 一致):
|
|
153
|
-
* 1. `metadata.source_product_price`
|
|
154
|
-
* 2. `metadata.main_product_original_price` 减去 option 合计
|
|
155
|
-
* 3. `original_price`
|
|
156
|
-
*/
|
|
157
|
-
export declare function getOrderProductBasePrice(product: any): number;
|
|
158
|
-
/**
|
|
159
|
-
* 促销均摊专用原价(对齐 legacy `getMainOriginalPrice` 语义)。
|
|
160
|
-
*
|
|
161
|
-
* 必须用券前原价做 X_ITEMS_FOR_Y_PRICE 比例拆分;`source_product_price` 在上一轮 applyPromotion
|
|
162
|
-
* 后可能已被写成促销价(如 5 / 9 / 1),若继续用它会导致同商品两行出现 9+1 而非 5+5。
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* getOrderProductOriginalPriceForPromotion({ metadata: { source_product_price: '9', main_product_original_price: '5.80' } });
|
|
166
|
-
* // => 5.8
|
|
167
|
-
*/
|
|
168
|
-
export declare function getOrderProductOriginalPriceForPromotion(product: any): number;
|
|
169
|
-
/**
|
|
170
|
-
* 合并「同商品 + 同规格指纹 + 同促销策略 + 同促销单价」的参与促销行(num 累加)。
|
|
171
|
-
* 避免 Browse Items 连续加购同款时拆成多行且单价被错误均摊。
|
|
172
|
-
*
|
|
173
|
-
* @example
|
|
174
|
-
* mergeIdenticalPromotionCartLines(processedProducts);
|
|
175
|
-
*/
|
|
176
|
-
export declare function mergeIdenticalPromotionCartLines(products: any[]): any[];
|
|
177
|
-
/** 获取行 uid(统一以 `metadata.unique_identification_number` 为唯一键) */
|
|
178
|
-
export declare function getOrderProductUid(product: any): string;
|
|
179
|
-
/**
|
|
180
|
-
* 促销评估前合并同 SKU 拆分行(含促销/原价行),避免加购后仅前 2 件享受优惠。
|
|
181
|
-
* 带 `booking_uid` 的预约行不参与合并(每次加车独立 booking + 商品行)。
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
* consolidateMainProductsForPromotion([
|
|
185
|
-
* { item: promoLineNum2, originalListIndex: 0 },
|
|
186
|
-
* { item: regularLineNum2, originalListIndex: 1 },
|
|
187
|
-
* ]);
|
|
188
|
-
* // => 单行 num=4,清除 _promotion 后重新评估
|
|
189
|
-
*/
|
|
190
|
-
export declare function buildConsolidateKeyForPromotion(item: any): string;
|
|
191
|
-
/**
|
|
192
|
-
* 从策略配置的 product_match 规则提取可参与商品列表。
|
|
193
|
-
*
|
|
194
|
-
* @example
|
|
195
|
-
* extractProductMatchIdentifiersFromStrategyConfig(strategyConfig);
|
|
196
|
-
* // => [{ product_id: 60736, product_variant_id: 0 }]
|
|
197
|
-
*/
|
|
198
|
-
export declare function extractProductMatchIdentifiersFromStrategyConfig(strategyConfig: any): Array<{
|
|
199
|
-
product_id: number;
|
|
200
|
-
product_variant_id: number;
|
|
201
|
-
}>;
|
|
202
|
-
/**
|
|
203
|
-
* 解析策略凑单所需件数(evaluator 原始返回可能不含 requiredQuantity)。
|
|
204
|
-
*
|
|
205
|
-
* @example
|
|
206
|
-
* resolveStrategyRequiredQuantity({ actionType: 'X_ITEMS_FOR_Y_PRICE', actionDetail: { x: 2 } });
|
|
207
|
-
*/
|
|
208
|
-
export declare function resolveStrategyRequiredQuantity(matched: {
|
|
209
|
-
requiredQuantity?: number;
|
|
210
|
-
actionType?: string;
|
|
211
|
-
actionDetail?: any;
|
|
212
|
-
}): number;
|
|
213
|
-
/**
|
|
214
|
-
* 解析 Browse Items 弹窗候选商品(优先 eligibleProducts,否则读 strategyConfig)。
|
|
215
|
-
*
|
|
216
|
-
* @example
|
|
217
|
-
* resolveStrategyEligibleProducts(matchedStrategy);
|
|
218
|
-
*/
|
|
219
|
-
export declare function resolveStrategyEligibleProducts(matched: {
|
|
220
|
-
eligibleProducts?: Array<{
|
|
221
|
-
product_id: number;
|
|
222
|
-
product_variant_id: number;
|
|
223
|
-
}>;
|
|
224
|
-
strategyConfig?: any;
|
|
225
|
-
}): Array<{
|
|
226
|
-
product_id: number;
|
|
227
|
-
product_variant_id: number;
|
|
228
|
-
}>;
|
|
229
|
-
/**
|
|
230
|
-
* 计算未满足促销条件(用于购物车底部「再买 N 件即可享受 XX」alert)。
|
|
231
|
-
*
|
|
232
|
-
* 数据源:商品的 `metadata._promotion.inPromotion === false`(来自 processCartPromotion
|
|
233
|
-
* 第 8 步追加的「有适用策略但当前未参与促销」标记)。
|
|
234
|
-
*/
|
|
235
|
-
export declare function calculateUnfulfilledPromotions(processedProducts: any[], applicableStrategiesResult: Array<{
|
|
236
|
-
applicableStrategies: Array<{
|
|
237
|
-
strategyId: string;
|
|
238
|
-
strategyName: string | Record<string, string>;
|
|
239
|
-
strategyMetadata: any;
|
|
240
|
-
actionType: string;
|
|
241
|
-
requiredQuantity?: number;
|
|
242
|
-
eligibleProducts?: Array<{
|
|
243
|
-
product_id: number;
|
|
244
|
-
product_variant_id: number;
|
|
245
|
-
}>;
|
|
246
|
-
actionDetail?: any;
|
|
247
|
-
strategyConfig?: any;
|
|
248
|
-
display?: {
|
|
249
|
-
text: string | Record<string, string>;
|
|
250
|
-
type: string;
|
|
251
|
-
};
|
|
252
|
-
}>;
|
|
253
|
-
hasApplicableStrategy: boolean;
|
|
254
|
-
}>, mainProducts: any[]): UnfulfilledPromotion[];
|
|
255
|
-
/**
|
|
256
|
-
* 给商品列表追加促销标签(写入 `metadata._promotionTags`),供 ProductCard 渲染。
|
|
257
|
-
*
|
|
258
|
-
* - 没有适用策略的商品会清除 `_promotionTags`(避免脏数据)。
|
|
259
|
-
* - 仅基于 product_id 匹配(matchVariant=false),与商品卡通用场景对齐。
|
|
260
|
-
*
|
|
261
|
-
* @example
|
|
262
|
-
* const list = appendPromotionTags(catalog, evaluator);
|
|
263
|
-
* // list[i].metadata._promotionTags = [{ text, type, strategyId }]
|
|
264
|
-
*/
|
|
265
|
-
export declare function appendPromotionTags<T extends Record<string, any>>(products: T[], evaluator: CartPromotionEvaluator | null | undefined): T[];
|
|
266
|
-
/**
|
|
267
|
-
* 处理购物车的促销计算与赠品差异化。
|
|
268
|
-
*
|
|
269
|
-
* 流程:
|
|
270
|
-
* 1. 分离 main / gift / edit-product 三类(带 `booking_id` 的编辑态商品不参与促销)
|
|
271
|
-
* 2. 转 PromotionProduct 喂评估器 → 拿到 `evaluateCartWithPricing` 与 `getProductsApplicableStrategies`
|
|
272
|
-
* 3. 把 PricedProduct 映射回 OrderProduct 形态:
|
|
273
|
-
* - 参与促销的,写 `metadata._promotion` + 调整 `selling_price` / `main_product_selling_price`
|
|
274
|
-
* - 拆分的,生成新 uid,复制原行其它字段
|
|
275
|
-
* 4. 计算 `_giftInfo` 挂主商品(每个策略首个主商品)
|
|
276
|
-
* 5. 计算 `giftActions`(toAdd / toReduce / toRemove)
|
|
277
|
-
* 6. 计算 `unfulfilledPromotions`
|
|
278
|
-
*
|
|
279
|
-
* @example
|
|
280
|
-
* const { products, giftActions, unfulfilledPromotions } = processCartPromotion(
|
|
281
|
-
* tempOrder.products,
|
|
282
|
-
* evaluator,
|
|
283
|
-
* );
|
|
284
|
-
*/
|
|
285
|
-
export declare function processCartPromotion(list: OrderProduct[] | null | undefined, evaluator: CartPromotionEvaluator | null | undefined, options?: {
|
|
286
|
-
channel?: string;
|
|
287
|
-
}): ProcessCartPromotionResult;
|