@pisell/pisellos 2.2.244 → 2.2.245
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 +3 -2
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
- package/dist/modules/BookingContext/index.d.ts +48 -0
- package/dist/modules/BookingContext/index.js +566 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +284 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +145 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +218 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Cart/utils/cartProduct.js +24 -3
- package/dist/modules/Cart/utils/changePrice.js +11 -11
- package/dist/modules/Customer/index.d.ts +20 -0
- package/dist/modules/Customer/index.js +172 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +1 -1
- package/dist/modules/Discount/index.js +13 -6
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +37 -17
- package/dist/modules/Order/index.d.ts +275 -19
- package/dist/modules/Order/index.js +3493 -809
- package/dist/modules/Order/types.d.ts +286 -31
- package/dist/modules/Order/types.js +38 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils.d.ts +147 -5
- package/dist/modules/Order/utils.js +750 -104
- package/dist/modules/Payment/index.d.ts +10 -13
- package/dist/modules/Payment/index.js +467 -837
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +2 -1
- package/dist/modules/Payment/walletpass.js +41 -25
- package/dist/modules/ProductList/index.d.ts +16 -12
- package/dist/modules/ProductList/index.js +133 -59
- package/dist/modules/ProductList/types.d.ts +14 -0
- package/dist/modules/Quotation/index.d.ts +0 -1
- package/dist/modules/Quotation/index.js +25 -22
- package/dist/modules/Rules/index.d.ts +4 -0
- package/dist/modules/Rules/index.js +97 -70
- package/dist/modules/Rules/types.d.ts +1 -0
- package/dist/modules/SalesSummary/index.d.ts +8 -25
- package/dist/modules/SalesSummary/index.js +86 -35
- package/dist/modules/SalesSummary/types.d.ts +4 -1
- package/dist/modules/SalesSummary/utils.d.ts +2 -25
- package/dist/modules/SalesSummary/utils.js +794 -162
- package/dist/modules/Schedule/index.d.ts +7 -0
- package/dist/modules/Schedule/index.js +24 -2
- package/dist/modules/Summary/index.js +4 -3
- package/dist/modules/SurchargeList/index.d.ts +16 -0
- package/dist/modules/SurchargeList/index.js +162 -0
- package/dist/modules/SurchargeList/types.d.ts +11 -0
- package/dist/modules/SurchargeList/types.js +1 -0
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +204 -1
- package/dist/server/index.js +3654 -922
- package/dist/server/modules/index.d.ts +2 -0
- package/dist/server/modules/index.js +2 -0
- package/dist/server/modules/order/index.d.ts +120 -3
- package/dist/server/modules/order/index.js +1758 -448
- package/dist/server/modules/order/types.d.ts +32 -3
- package/dist/server/modules/order/types.js +8 -0
- package/dist/server/modules/order/utils/filterBookings.js +26 -3
- package/dist/server/modules/order/utils/filterOrders.js +23 -8
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/modules/products/index.d.ts +34 -7
- package/dist/server/modules/products/index.js +631 -317
- package/dist/server/modules/resource/index.d.ts +2 -0
- package/dist/server/modules/resource/index.js +29 -3
- package/dist/server/modules/schedule/index.d.ts +4 -4
- package/dist/server/modules/schedule/index.js +111 -88
- package/dist/server/test.json +713 -0
- package/dist/server/utils/small-ticket.d.ts +71 -0
- package/dist/server/utils/small-ticket.js +840 -0
- package/dist/solution/BaseSales/index.d.ts +133 -10
- package/dist/solution/BaseSales/index.js +1950 -447
- package/dist/solution/BaseSales/types.d.ts +82 -6
- package/dist/solution/BaseSales/types.js +5 -4
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1438 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +105 -24
- package/dist/solution/BaseSales/utils.d.ts +1 -1
- package/dist/solution/BaseSales/utils.js +62 -21
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +271 -11
- package/dist/solution/BookingTicket/index.js +1777 -242
- package/dist/solution/BookingTicket/types.d.ts +118 -1
- package/dist/solution/BookingTicket/types.js +41 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +70 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +9 -1
- package/dist/solution/BookingTicket/utils/cartView.js +94 -7
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +10 -9
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +9 -3
- package/dist/solution/ScanOrder/index.js +241 -134
- package/dist/solution/ScanOrder/types.d.ts +9 -5
- package/dist/solution/ScanOrder/types.js +2 -3
- package/dist/solution/ScanOrder/utils.d.ts +1 -1
- package/dist/solution/ScanOrder/utils.js +84 -22
- package/dist/solution/VenueBooking/index.d.ts +5 -2
- package/dist/solution/VenueBooking/index.js +110 -59
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/dist/types/index.d.ts +10 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +2 -1
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +368 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +151 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +201 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Cart/utils/cartProduct.js +20 -3
- package/lib/modules/Cart/utils/changePrice.js +12 -20
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +64 -11
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +1 -1
- package/lib/modules/Discount/index.js +9 -1
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +19 -5
- package/lib/modules/Order/index.d.ts +275 -19
- package/lib/modules/Order/index.js +2245 -336
- package/lib/modules/Order/types.d.ts +286 -31
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
- package/lib/modules/Order/utils.d.ts +147 -5
- package/lib/modules/Order/utils.js +615 -46
- package/lib/modules/Payment/index.d.ts +10 -13
- package/lib/modules/Payment/index.js +18 -150
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +2 -1
- package/lib/modules/Payment/walletpass.js +16 -3
- package/lib/modules/ProductList/index.d.ts +16 -12
- package/lib/modules/ProductList/index.js +41 -4
- package/lib/modules/ProductList/types.d.ts +14 -0
- package/lib/modules/Quotation/index.d.ts +0 -1
- package/lib/modules/Quotation/index.js +19 -16
- package/lib/modules/Rules/index.d.ts +4 -0
- package/lib/modules/Rules/index.js +137 -120
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/modules/SalesSummary/index.d.ts +8 -25
- package/lib/modules/SalesSummary/index.js +30 -4
- package/lib/modules/SalesSummary/types.d.ts +4 -1
- package/lib/modules/SalesSummary/utils.d.ts +2 -25
- package/lib/modules/SalesSummary/utils.js +645 -91
- package/lib/modules/Schedule/index.d.ts +7 -0
- package/lib/modules/Schedule/index.js +17 -1
- package/lib/modules/Summary/index.js +5 -4
- package/lib/modules/SurchargeList/index.d.ts +16 -0
- package/lib/modules/SurchargeList/index.js +89 -0
- package/lib/modules/SurchargeList/types.d.ts +11 -0
- package/lib/modules/SurchargeList/types.js +17 -0
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +204 -1
- package/lib/server/index.js +1891 -59
- package/lib/server/modules/index.d.ts +2 -0
- package/lib/server/modules/index.js +3 -0
- package/lib/server/modules/order/index.d.ts +120 -3
- package/lib/server/modules/order/index.js +883 -94
- package/lib/server/modules/order/types.d.ts +32 -3
- package/lib/server/modules/order/utils/filterBookings.js +24 -5
- package/lib/server/modules/order/utils/filterOrders.js +15 -6
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +192 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +17 -0
- package/lib/server/modules/products/index.d.ts +34 -7
- package/lib/server/modules/products/index.js +189 -54
- package/lib/server/modules/resource/index.d.ts +2 -0
- package/lib/server/modules/resource/index.js +27 -3
- package/lib/server/modules/schedule/index.d.ts +4 -4
- package/lib/server/modules/schedule/index.js +47 -40
- package/lib/server/test.json +713 -0
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +800 -0
- package/lib/solution/BaseSales/index.d.ts +133 -10
- package/lib/solution/BaseSales/index.js +1111 -63
- package/lib/solution/BaseSales/types.d.ts +82 -6
- package/lib/solution/BaseSales/types.js +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +992 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +106 -18
- package/lib/solution/BaseSales/utils.d.ts +1 -1
- package/lib/solution/BaseSales/utils.js +54 -10
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +271 -11
- package/lib/solution/BookingTicket/index.js +922 -29
- package/lib/solution/BookingTicket/types.d.ts +118 -1
- package/lib/solution/BookingTicket/types.js +11 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +44 -2
- package/lib/solution/BookingTicket/utils/cartView.d.ts +9 -1
- package/lib/solution/BookingTicket/utils/cartView.js +61 -6
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +1 -2
- package/lib/solution/RegisterAndLogin/config.js +2 -10
- package/lib/solution/ScanOrder/index.d.ts +9 -3
- package/lib/solution/ScanOrder/index.js +153 -70
- package/lib/solution/ScanOrder/types.d.ts +9 -5
- package/lib/solution/ScanOrder/utils.d.ts +1 -1
- package/lib/solution/ScanOrder/utils.js +83 -17
- package/lib/solution/VenueBooking/index.d.ts +5 -2
- package/lib/solution/VenueBooking/index.js +54 -17
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/lib/types/index.d.ts +10 -0
- package/package.json +1 -1
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -2,15 +2,129 @@ import { CartItem } from '../Cart/types';
|
|
|
2
2
|
import type { DiscountModule } from '../Discount';
|
|
3
3
|
import type { RulesModule } from '../Rules';
|
|
4
4
|
import type { Discount } from '../Discount/types';
|
|
5
|
+
import type { UnavailableReason } from '../Rules/types';
|
|
5
6
|
import type { SubmitPayloadEnhancer } from './utils';
|
|
6
7
|
import type { PaymentItem } from '../Payment/types';
|
|
7
8
|
import type { ICustomer } from '../AccountList/types';
|
|
9
|
+
import type { OrderProductDiscountItem } from '../../server/modules/order/types';
|
|
10
|
+
export type { OrderProductDiscountItem } from '../../server/modules/order/types';
|
|
8
11
|
export declare enum OrderHooks {
|
|
9
12
|
OnOrderCreate = "order:onOrderCreate",
|
|
10
13
|
OnOrderUpdate = "order:onOrderUpdate",
|
|
11
14
|
OnOrderCancel = "order:onOrderCancel",
|
|
12
15
|
OnOrderStatusChange = "order:onOrderStatusChange",
|
|
13
|
-
OnOrderCustomerChange = "order:onOrderCustomerChange"
|
|
16
|
+
OnOrderCustomerChange = "order:onOrderCustomerChange",
|
|
17
|
+
OnPromotionApplied = "order:onPromotionApplied"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 促销评估器协议(OS 与 PromotionEvaluator 之间的桥接接口)。
|
|
21
|
+
*
|
|
22
|
+
* 与 `pisell_os/src/model/strategy/adapter/promotion/evaluator.ts` 中的
|
|
23
|
+
* `PromotionEvaluator` 实例结构保持兼容。SalesSdkProvider 会从 `appHelper.utils.promotionEvaluator`
|
|
24
|
+
* 读取实例并通过 `setPromotionEvaluator` 注入到 OrderModule。
|
|
25
|
+
*
|
|
26
|
+
* 这里只声明 OrderModule 需要调用的子集,避免反向依赖具体 evaluator 实现。
|
|
27
|
+
*/
|
|
28
|
+
export interface OrderPromotionEvaluator {
|
|
29
|
+
evaluateCartWithPricing(input: {
|
|
30
|
+
products: any[];
|
|
31
|
+
channel?: string;
|
|
32
|
+
}): any;
|
|
33
|
+
getProductsApplicableStrategies(input: {
|
|
34
|
+
products: any[];
|
|
35
|
+
channel?: string;
|
|
36
|
+
}, matchVariant?: boolean): any[];
|
|
37
|
+
}
|
|
38
|
+
/** 赠品解析回调 context(OS → SDK 的请求体) */
|
|
39
|
+
export interface OrderGiftSelectContext {
|
|
40
|
+
strategyId: string;
|
|
41
|
+
strategyName: string | Record<string, string>;
|
|
42
|
+
giftCount: number;
|
|
43
|
+
giftOptions: Array<{
|
|
44
|
+
product_id: number;
|
|
45
|
+
product_variant_id: number;
|
|
46
|
+
}>;
|
|
47
|
+
/** 触发此赠品的主商品 metadata.unique_identification_number 列表 */
|
|
48
|
+
sourceProductIds: string[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 赠品 resolver 返回值。
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* return { products: [giftProduct], bookings: [giftBooking] };
|
|
55
|
+
*/
|
|
56
|
+
export interface OrderGiftSelectResult {
|
|
57
|
+
/** 完整赠品购物车行,必须带 metadata._giftInfo。 */
|
|
58
|
+
products: Partial<OrderProduct>[];
|
|
59
|
+
/** 预约赠品对应的 booking,按 products 下标一一关联。 */
|
|
60
|
+
bookings?: AddProductBookingInput[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 赠品解析回调签名(SDK → OS 的返回值)。
|
|
64
|
+
*
|
|
65
|
+
* - 单选项:SDK 内部自动构造商品,不弹窗
|
|
66
|
+
* - 多选项:SDK 弹窗等用户确认后构造
|
|
67
|
+
* - 用户取消:抛错或返回空数组(OS 视为放弃本次添加)
|
|
68
|
+
*
|
|
69
|
+
* 返回数组时沿用旧协议,只写 tempOrder.products;返回对象时可同时写入预约 bookings。
|
|
70
|
+
*/
|
|
71
|
+
export type OrderGiftSelectResolver = (ctx: OrderGiftSelectContext) => Promise<Partial<OrderProduct>[] | OrderGiftSelectResult | null>;
|
|
72
|
+
/** 未满足的促销策略(购物车底部 alert 渲染源) */
|
|
73
|
+
export interface OrderUnfulfilledPromotion {
|
|
74
|
+
strategyId: string;
|
|
75
|
+
strategyName: string | Record<string, string>;
|
|
76
|
+
actionType: string;
|
|
77
|
+
needQuantity: number;
|
|
78
|
+
currentQuantity: number;
|
|
79
|
+
requiredQuantity: number;
|
|
80
|
+
eligibleProducts: Array<{
|
|
81
|
+
product_id: number;
|
|
82
|
+
product_variant_id: number;
|
|
83
|
+
}>;
|
|
84
|
+
strategyMetadata?: any;
|
|
85
|
+
display?: {
|
|
86
|
+
text: string | Record<string, string>;
|
|
87
|
+
type: string;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/** 上一次 applyPromotion 计算出的赠品操作(仅供调试/读取使用) */
|
|
91
|
+
export interface OrderLastGiftActions {
|
|
92
|
+
toAdd: Array<{
|
|
93
|
+
strategyId: string;
|
|
94
|
+
strategyName: string | Record<string, string>;
|
|
95
|
+
giftCount: number;
|
|
96
|
+
giftOptions: Array<{
|
|
97
|
+
product_id: number;
|
|
98
|
+
product_variant_id: number;
|
|
99
|
+
}>;
|
|
100
|
+
sourceProductIds: string[];
|
|
101
|
+
}>;
|
|
102
|
+
toReduce: Array<{
|
|
103
|
+
strategyId: string;
|
|
104
|
+
items: Array<{
|
|
105
|
+
uid: string;
|
|
106
|
+
currentQuantity: number;
|
|
107
|
+
newQuantity: number;
|
|
108
|
+
}>;
|
|
109
|
+
}>;
|
|
110
|
+
toRemove: string[];
|
|
111
|
+
}
|
|
112
|
+
/** onPromotionApplied 事件 payload */
|
|
113
|
+
export interface OrderPromotionAppliedPayload {
|
|
114
|
+
unfulfilledPromotions: OrderUnfulfilledPromotion[];
|
|
115
|
+
giftActions: OrderLastGiftActions;
|
|
116
|
+
/** evaluator 返回的赠品摘要 */
|
|
117
|
+
gifts: Array<{
|
|
118
|
+
strategyId: string;
|
|
119
|
+
strategyName: string | Record<string, string>;
|
|
120
|
+
giftCount: number;
|
|
121
|
+
giftOptions: Array<{
|
|
122
|
+
product_id: number;
|
|
123
|
+
product_variant_id: number;
|
|
124
|
+
}>;
|
|
125
|
+
}>;
|
|
126
|
+
/** 处理后的商品列表 */
|
|
127
|
+
products: OrderProduct[];
|
|
14
128
|
}
|
|
15
129
|
/**
|
|
16
130
|
* tempOrder 上的下单客户协议字段视图。
|
|
@@ -48,27 +162,41 @@ export interface OrderCustomerChangePayload {
|
|
|
48
162
|
patch: OrderCustomerView;
|
|
49
163
|
snapshot: ICustomer | null;
|
|
50
164
|
}
|
|
165
|
+
export interface OrderScanCodeResult {
|
|
166
|
+
isAvailable: boolean;
|
|
167
|
+
discountList: Discount[];
|
|
168
|
+
scannedDiscountList: Discount[];
|
|
169
|
+
type: 'server' | 'clientCalc';
|
|
170
|
+
unavailableReason?: UnavailableReason;
|
|
171
|
+
}
|
|
51
172
|
export interface OrderProductIdentity {
|
|
52
173
|
product_id: number | null;
|
|
53
174
|
product_variant_id: number;
|
|
54
175
|
unique_identification_number?: string;
|
|
55
|
-
|
|
176
|
+
product_sku?: OrderProductSku;
|
|
56
177
|
product_bundle?: any[];
|
|
57
178
|
}
|
|
179
|
+
export interface OrderProductSku {
|
|
180
|
+
option: any[];
|
|
181
|
+
[key: string]: any;
|
|
182
|
+
}
|
|
183
|
+
export interface OrderLocalizedText {
|
|
184
|
+
[locale: string]: string | null;
|
|
185
|
+
}
|
|
58
186
|
export interface OrderProduct extends OrderProductIdentity {
|
|
59
187
|
order_detail_id: number | null;
|
|
60
188
|
num: number;
|
|
61
189
|
bundle_edit?: number;
|
|
62
|
-
|
|
63
|
-
product_sku?: Record<string, any>;
|
|
190
|
+
product_sku: OrderProductSku;
|
|
64
191
|
gift_card?: number;
|
|
65
192
|
selling_price: string;
|
|
66
193
|
original_price: string;
|
|
67
194
|
tax_fee: string;
|
|
68
195
|
is_charge_tax: number;
|
|
69
|
-
discount_list:
|
|
196
|
+
discount_list: OrderProductDiscountItem[];
|
|
70
197
|
product_bundle: any[];
|
|
71
198
|
booking_uid?: string;
|
|
199
|
+
product_title?: OrderLocalizedText;
|
|
72
200
|
metadata: Record<string, any>;
|
|
73
201
|
note?: string;
|
|
74
202
|
}
|
|
@@ -82,11 +210,13 @@ export interface OrderSummary {
|
|
|
82
210
|
shipping_tax_fee: string;
|
|
83
211
|
tax_fee: string;
|
|
84
212
|
surcharge_fee: string;
|
|
213
|
+
surcharges: any[];
|
|
85
214
|
discount_amount: string;
|
|
86
215
|
deposit_amount: string;
|
|
87
216
|
deposit?: {
|
|
88
217
|
total: string;
|
|
89
218
|
deposit_policy_ids: number[];
|
|
219
|
+
deposit_policy_data?: any[];
|
|
90
220
|
hasDeposit: boolean;
|
|
91
221
|
};
|
|
92
222
|
expect_amount: string;
|
|
@@ -103,11 +233,11 @@ export interface OrderSummary {
|
|
|
103
233
|
export interface OrderTempOrder {
|
|
104
234
|
order_id: number | null;
|
|
105
235
|
external_sale_number: string;
|
|
106
|
-
order_number: string;
|
|
107
|
-
shop_order_number: string;
|
|
108
|
-
shop_full_order_number: string;
|
|
236
|
+
order_number: string | null;
|
|
237
|
+
shop_order_number: string | null;
|
|
238
|
+
shop_full_order_number: string | null;
|
|
109
239
|
type: string;
|
|
110
|
-
business_code
|
|
240
|
+
business_code?: string;
|
|
111
241
|
platform: string;
|
|
112
242
|
sales_channel: string;
|
|
113
243
|
order_sales_channel: string;
|
|
@@ -136,36 +266,39 @@ export interface OrderTempOrder {
|
|
|
136
266
|
delivery_type?: string;
|
|
137
267
|
table_number?: Record<string, any>;
|
|
138
268
|
schedule_date: string;
|
|
139
|
-
created_at: string;
|
|
269
|
+
created_at: string | undefined;
|
|
140
270
|
request_unique_idempotency_token?: string;
|
|
141
271
|
products: OrderProduct[];
|
|
142
272
|
bookings: any[];
|
|
143
273
|
payments: any[];
|
|
144
274
|
surcharges: any[];
|
|
145
|
-
discount_list
|
|
275
|
+
discount_list?: any[];
|
|
146
276
|
relation_forms: any[];
|
|
147
277
|
contacts: any[];
|
|
148
278
|
contacts_info: Record<string, any> | null;
|
|
149
279
|
holder: Record<string, any> | null;
|
|
150
280
|
metadata: Record<string, any>;
|
|
281
|
+
summary?: OrderSummary;
|
|
151
282
|
_extend?: {
|
|
152
283
|
productsByUid?: Record<string, Record<string, any>>;
|
|
153
284
|
[key: string]: any;
|
|
154
285
|
};
|
|
155
286
|
}
|
|
156
|
-
export interface OrderSubmitProduct extends Omit<OrderProduct, 'unique_identification_number' | 'num'
|
|
287
|
+
export interface OrderSubmitProduct extends Omit<OrderProduct, 'unique_identification_number' | 'num'> {
|
|
157
288
|
product_quantity: number;
|
|
158
289
|
payment_price: string;
|
|
159
|
-
product_sku:
|
|
290
|
+
product_sku: OrderProductSku;
|
|
160
291
|
}
|
|
161
|
-
export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | '_extend' | 'customer' | '
|
|
292
|
+
export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | '_extend' | 'customer' | 'discount_list' | 'created_at'> {
|
|
162
293
|
platform: string;
|
|
294
|
+
created_at?: string | undefined;
|
|
163
295
|
request_unique_idempotency_token?: string;
|
|
164
296
|
form_record_ids?: Array<{
|
|
165
297
|
form_id: number | string;
|
|
166
298
|
form_record_id: number | string;
|
|
167
299
|
}>;
|
|
168
300
|
products: OrderSubmitProduct[];
|
|
301
|
+
summary?: OrderSummary;
|
|
169
302
|
small_ticket_data_flag?: number;
|
|
170
303
|
}
|
|
171
304
|
export interface OrderState {
|
|
@@ -177,16 +310,45 @@ export interface OrderState {
|
|
|
177
310
|
discount: DiscountModule | null;
|
|
178
311
|
rules: RulesModule | null;
|
|
179
312
|
}
|
|
313
|
+
export interface ReplaceTempOrderOptions {
|
|
314
|
+
recalculateSummary?: boolean;
|
|
315
|
+
persist?: boolean;
|
|
316
|
+
saveDraft?: boolean;
|
|
317
|
+
}
|
|
318
|
+
export type AddProductBookingInput = Record<string, any>;
|
|
180
319
|
/** 更新购物车行:仅传 SKU 时命中同 SKU 第一行;多行同 SKU 须传 unique_identification_number / 选项指纹等 */
|
|
181
|
-
export interface
|
|
320
|
+
export interface UpdateOrderProductParams {
|
|
182
321
|
product_id: number | null;
|
|
183
322
|
product_variant_id: number;
|
|
184
323
|
updates: Partial<OrderProduct>;
|
|
185
324
|
unique_identification_number?: string;
|
|
186
|
-
|
|
325
|
+
identity_key?: string;
|
|
326
|
+
product_sku?: OrderProductSku;
|
|
187
327
|
product_bundle?: any[];
|
|
328
|
+
booking?: AddProductBookingInput;
|
|
329
|
+
/**
|
|
330
|
+
* 预约时间 / 时长变更后允许使用本次报价覆盖已落库订单行历史价。
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* await order.updateOrderProduct({
|
|
334
|
+
* product_id: 1,
|
|
335
|
+
* product_variant_id: 0,
|
|
336
|
+
* updates: { selling_price: '6.00', metadata: { source_product_price: '6.00' } },
|
|
337
|
+
* booking: { duration: 2 },
|
|
338
|
+
* allow_booking_reprice: true,
|
|
339
|
+
* });
|
|
340
|
+
*/
|
|
341
|
+
allow_booking_reprice?: boolean;
|
|
342
|
+
}
|
|
343
|
+
/** 仅更新购物车行数量;行定位语义与 updateOrderProduct / removeProductFromOrder 保持一致 */
|
|
344
|
+
export interface UpdateOrderProductQuantityParams extends OrderProductIdentity {
|
|
345
|
+
num: number;
|
|
346
|
+
identity_key?: string;
|
|
347
|
+
}
|
|
348
|
+
export interface UpdateOrderBookingParams {
|
|
349
|
+
unique_identification_number: string;
|
|
350
|
+
updates: AddProductBookingInput;
|
|
188
351
|
}
|
|
189
|
-
export type AddProductBookingInput = Record<string, any>;
|
|
190
352
|
export interface OrderProductMergeDecisionContext {
|
|
191
353
|
incomingProduct: Partial<OrderProduct> & OrderProductIdentity;
|
|
192
354
|
normalizedIncoming: OrderProduct;
|
|
@@ -237,10 +399,11 @@ export interface SubmitSalesOrderParams {
|
|
|
237
399
|
query: {
|
|
238
400
|
order_id: number | null;
|
|
239
401
|
external_sale_number: string;
|
|
240
|
-
order_number: string;
|
|
241
|
-
shop_order_number: string;
|
|
402
|
+
order_number: string | null;
|
|
403
|
+
shop_order_number: string | null;
|
|
404
|
+
shop_full_order_number: string | null;
|
|
242
405
|
type: string;
|
|
243
|
-
business_code
|
|
406
|
+
business_code?: string;
|
|
244
407
|
platform: string;
|
|
245
408
|
request_unique_idempotency_token?: string;
|
|
246
409
|
sales_channel: string;
|
|
@@ -267,18 +430,19 @@ export interface SubmitSalesOrderParams {
|
|
|
267
430
|
delivery_type?: string;
|
|
268
431
|
table_number?: Record<string, any>;
|
|
269
432
|
schedule_date: string;
|
|
270
|
-
created_at
|
|
433
|
+
created_at?: string | undefined;
|
|
271
434
|
products: OrderSubmitProduct[];
|
|
272
435
|
bookings: OrderSubmitBooking[];
|
|
273
436
|
payments: any[];
|
|
437
|
+
vouchers: any[];
|
|
274
438
|
surcharges?: any[];
|
|
275
|
-
discount_list: any[];
|
|
276
439
|
relation_forms: any[];
|
|
277
440
|
form_record_ids?: OrderSubmitFormRecord[];
|
|
278
441
|
contacts: any[];
|
|
279
442
|
contacts_info: Record<string, any> | null;
|
|
280
443
|
holder: Record<string, any> | null;
|
|
281
444
|
metadata: Record<string, any>;
|
|
445
|
+
summary?: OrderSummary;
|
|
282
446
|
small_ticket_data_flag?: number;
|
|
283
447
|
};
|
|
284
448
|
}
|
|
@@ -300,6 +464,10 @@ export interface PaymentItemData {
|
|
|
300
464
|
name: string;
|
|
301
465
|
/** 支付类型 */
|
|
302
466
|
type: string;
|
|
467
|
+
/** 支付时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
468
|
+
payment_time?: string;
|
|
469
|
+
/** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
470
|
+
created_at?: string;
|
|
303
471
|
/** @deprecated BaseSales/Sales 协议不提交该字段;旧 Checkout/Payment 内部仍可能使用 */
|
|
304
472
|
isSynced?: boolean;
|
|
305
473
|
}
|
|
@@ -312,18 +480,22 @@ export interface OrderPaymentMetadata {
|
|
|
312
480
|
[key: string]: any;
|
|
313
481
|
}
|
|
314
482
|
export interface OrderPaymentData {
|
|
483
|
+
order_payment_id?: number | string;
|
|
315
484
|
amount: string;
|
|
316
485
|
code: string;
|
|
317
486
|
custom_payment_id: number;
|
|
487
|
+
custom_payment_type?: string;
|
|
318
488
|
name: string;
|
|
319
489
|
type: string;
|
|
320
490
|
voucher_id?: string | number;
|
|
321
491
|
origin_amount?: string;
|
|
322
492
|
service_fee?: string;
|
|
323
493
|
status?: 'active' | 'voided' | string;
|
|
494
|
+
/** 支付时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
324
495
|
payment_time?: string;
|
|
325
496
|
wallet_pass_usage_unit?: unknown;
|
|
326
497
|
wallet_pass_use_value?: string | number | null;
|
|
498
|
+
fund_record?: Record<string, any>;
|
|
327
499
|
metadata: OrderPaymentMetadata;
|
|
328
500
|
rounding_amount?: string;
|
|
329
501
|
service_charge?: {
|
|
@@ -331,6 +503,7 @@ export interface OrderPaymentData {
|
|
|
331
503
|
amount?: string;
|
|
332
504
|
};
|
|
333
505
|
order_payment_type?: 'normal' | 'deposit';
|
|
506
|
+
/** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
334
507
|
created_at?: string;
|
|
335
508
|
updated_at?: string;
|
|
336
509
|
}
|
|
@@ -345,12 +518,19 @@ export interface LoadSalesDetailParams {
|
|
|
345
518
|
externalSaleNumber?: string;
|
|
346
519
|
external_sale_number?: string;
|
|
347
520
|
forceRemote?: boolean;
|
|
521
|
+
merge?: boolean;
|
|
522
|
+
}
|
|
523
|
+
export interface SalesOrderLookupParams {
|
|
524
|
+
lookup: number | string;
|
|
525
|
+
forceRemote?: boolean;
|
|
348
526
|
}
|
|
349
527
|
export interface SyncPaymentsToOrderParams {
|
|
350
528
|
payments: OrderPaymentSource[];
|
|
351
529
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
352
530
|
submitWhenPaid?: boolean;
|
|
353
531
|
smallTicketDataFlag?: number;
|
|
532
|
+
businessCode?: string;
|
|
533
|
+
channel?: string;
|
|
354
534
|
}
|
|
355
535
|
export interface SyncPaymentsToOrderResult<T = any> {
|
|
356
536
|
isFullyPaid: boolean;
|
|
@@ -447,6 +627,7 @@ export interface OrderModuleAPI {
|
|
|
447
627
|
}) => void;
|
|
448
628
|
getTempOrder: () => OrderTempOrder | null;
|
|
449
629
|
ensureTempOrder: () => OrderTempOrder;
|
|
630
|
+
replaceTempOrder: (tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions) => Promise<OrderTempOrder>;
|
|
450
631
|
addNewOrder: () => Promise<OrderTempOrder>;
|
|
451
632
|
restoreOrder: () => OrderTempOrder;
|
|
452
633
|
getOrderProducts: () => OrderProduct[];
|
|
@@ -458,16 +639,41 @@ export interface OrderModuleAPI {
|
|
|
458
639
|
getOrderSnapshot: () => OrderSnapshot | null;
|
|
459
640
|
getOrderSyncState: () => OrderSyncState;
|
|
460
641
|
getOrderAmountSnapshot: () => OrderAmountSnapshot | null;
|
|
642
|
+
buildCurrentSubmitPayloadForLocalPrint: (params?: {
|
|
643
|
+
cacheId?: string;
|
|
644
|
+
platform?: string;
|
|
645
|
+
businessCode?: string;
|
|
646
|
+
channel?: string;
|
|
647
|
+
type?: string;
|
|
648
|
+
}) => OrderSubmitPayload;
|
|
649
|
+
applyLocalPrintOrderNumbers: (order?: Record<string, any> | null) => Promise<OrderTempOrder>;
|
|
461
650
|
getTempOrderNote: () => string;
|
|
462
|
-
updateTempOrderNote:
|
|
651
|
+
updateTempOrderNote: {
|
|
652
|
+
(note: string): string;
|
|
653
|
+
(note: string, sync: true): Promise<string>;
|
|
654
|
+
(note: string, sync: boolean): string | Promise<string>;
|
|
655
|
+
};
|
|
463
656
|
updateTempOrderShopDiscount: (amount: string | number) => string;
|
|
657
|
+
updateTempOrderDepositAmount: (amount: string | number) => OrderSummary;
|
|
464
658
|
updateTempOrderCustomer: (customer: UpdateTempOrderCustomerInput) => OrderSnapshot['customer'];
|
|
465
659
|
updateTempOrderBuzzer: (buzzer: string) => string;
|
|
466
660
|
updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
|
|
467
661
|
addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput) => Promise<OrderProduct[]>;
|
|
468
|
-
|
|
662
|
+
updateOrderProduct: (params: UpdateOrderProductParams) => Promise<OrderProduct[]>;
|
|
663
|
+
updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams) => Promise<OrderProduct[]>;
|
|
664
|
+
updateOrderBooking: (params: UpdateOrderBookingParams) => any[];
|
|
469
665
|
removeProductFromOrder: (identity: OrderProductIdentity) => Promise<OrderProduct[]>;
|
|
666
|
+
/** 批量删除购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
667
|
+
removeProductsFromOrder: (identities: OrderProductIdentity[]) => Promise<OrderProduct[]>;
|
|
668
|
+
/** @deprecated no-op;OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
470
669
|
persistTempOrder: () => void;
|
|
670
|
+
/**
|
|
671
|
+
* 控制 IndexedDB 草稿(saveDraft)开关;localStorage tempOrder 持久化已废弃。
|
|
672
|
+
* BigSale 弹窗等场景传 false 可跳过 saveDraft。
|
|
673
|
+
*/
|
|
674
|
+
setEnableTempOrderPersist: (enabled: boolean) => void;
|
|
675
|
+
/** 是否允许 saveDraft 写入 IndexedDB 草稿。 */
|
|
676
|
+
isTempOrderPersistEnabled: () => boolean;
|
|
471
677
|
submitTempOrder: <T = any>(params?: {
|
|
472
678
|
cacheId?: string;
|
|
473
679
|
platform?: string;
|
|
@@ -479,6 +685,17 @@ export interface OrderModuleAPI {
|
|
|
479
685
|
smallTicketDataFlag?: number;
|
|
480
686
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
481
687
|
}) => Promise<T>;
|
|
688
|
+
submitTempOrderAsync: <T = any>(params?: {
|
|
689
|
+
cacheId?: string;
|
|
690
|
+
platform?: string;
|
|
691
|
+
businessCode?: string;
|
|
692
|
+
channel?: string;
|
|
693
|
+
type?: string;
|
|
694
|
+
payments?: OrderPaymentSource[];
|
|
695
|
+
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
696
|
+
smallTicketDataFlag?: number;
|
|
697
|
+
enhancePayload?: SubmitPayloadEnhancer;
|
|
698
|
+
}) => Promise<T>;
|
|
482
699
|
getOrderPayments: () => OrderPaymentData[];
|
|
483
700
|
setOrderPayments: (payments: OrderPaymentSource[]) => OrderPaymentData[];
|
|
484
701
|
addOrderPayment: (payment: OrderPaymentSource) => OrderPaymentData[];
|
|
@@ -487,15 +704,11 @@ export interface OrderModuleAPI {
|
|
|
487
704
|
updateVoucherOrderPayments: (payments: OrderPaymentSource[]) => OrderPaymentData[];
|
|
488
705
|
sendCustomerPayLink: <T = any>(params: SendCustomerPayLinkParams) => Promise<T>;
|
|
489
706
|
saveDraft: () => Promise<void>;
|
|
490
|
-
hasLocalDatabase: () => boolean;
|
|
491
|
-
getLocalOrderByOrderId: (orderId: number | string) => Promise<Record<string, any> | null>;
|
|
492
|
-
getLocalOrderByExternalSaleNumber: (externalSaleNumber: string) => Promise<Record<string, any> | null>;
|
|
493
|
-
getLocalOrderByOrderNumber: (orderNumber: string) => Promise<Record<string, any> | null>;
|
|
494
707
|
hydrateTempOrderFromRecord: (record: Record<string, any>, options?: {
|
|
495
708
|
recalcOnHydrate?: boolean;
|
|
496
709
|
}) => Promise<OrderTempOrder>;
|
|
497
710
|
syncPaymentsToOrder: <T = any>(params: SyncPaymentsToOrderParams) => Promise<SyncPaymentsToOrderResult<T>>;
|
|
498
|
-
|
|
711
|
+
getSalesOrderByLookup: (params: SalesOrderLookupParams) => Promise<any>;
|
|
499
712
|
getLastOrderInfo: () => Record<string, any> | undefined;
|
|
500
713
|
getOrderInfo: (order_id: number) => Promise<any>;
|
|
501
714
|
/**
|
|
@@ -517,10 +730,52 @@ export interface OrderModuleAPI {
|
|
|
517
730
|
clearOrderCustomer: () => void;
|
|
518
731
|
loadDiscountConfig: (params: {
|
|
519
732
|
customerId: number;
|
|
520
|
-
action?: 'create';
|
|
521
|
-
|
|
733
|
+
action?: 'create' | 'edit';
|
|
734
|
+
orderId?: number;
|
|
735
|
+
apply?: boolean;
|
|
736
|
+
}) => Promise<Discount[]>;
|
|
522
737
|
getDiscountList: () => Discount[];
|
|
523
738
|
applyDiscount: () => void;
|
|
739
|
+
/**
|
|
740
|
+
* 注入促销评估器。
|
|
741
|
+
*
|
|
742
|
+
* SalesSdkProvider 在初始化 bookingTicket 后会自动从 `appHelper.utils.promotionEvaluator`
|
|
743
|
+
* 读取实例并调用本方法注入。host 透明,业务 UI 不感知。
|
|
744
|
+
*
|
|
745
|
+
* @example
|
|
746
|
+
* order.setPromotionEvaluator(appHelper.utils.promotionEvaluator);
|
|
747
|
+
*/
|
|
748
|
+
setPromotionEvaluator: (evaluator: OrderPromotionEvaluator | null) => void;
|
|
749
|
+
/**
|
|
750
|
+
* 注入赠品选择 resolver。OS 在 applyPromotion 内部当需要新增赠品时会 await 调用 resolver。
|
|
751
|
+
*
|
|
752
|
+
* 缺省时 OS 会 `console.warn` 并跳过新增(既有赠品的 reduce/remove 仍会执行)。
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* order.setGiftSelectResolver((ctx) => giftSelectBridge.request(ctx));
|
|
756
|
+
*/
|
|
757
|
+
setGiftSelectResolver: (resolver: OrderGiftSelectResolver | null) => void;
|
|
758
|
+
/**
|
|
759
|
+
* 为商品目录追加促销标签。
|
|
760
|
+
*
|
|
761
|
+
* @example
|
|
762
|
+
* const taggedProducts = order.appendPromotionTags(products);
|
|
763
|
+
*/
|
|
764
|
+
appendPromotionTags: <T extends Record<string, any>>(products: T[]) => T[];
|
|
765
|
+
/**
|
|
766
|
+
* 应用购物车促销(评估 → 差异化赠品 → 写回 tempOrder.products → emit onPromotionApplied)。
|
|
767
|
+
*
|
|
768
|
+
* 自动在 addProductToOrder / updateOrderProductQuantity / removeProductFromOrder /
|
|
769
|
+
* clearOrderCartLines / setOrderCustomer 等写路径末尾触发,业务一般无需手动调用。
|
|
770
|
+
*
|
|
771
|
+
* 多选项赠品依赖 giftSelectResolver;如未注入则跳过且 console.warn。
|
|
772
|
+
* 内部以 `_isApplyingPromotion` flag 防递归。
|
|
773
|
+
*/
|
|
774
|
+
applyPromotion: () => Promise<void>;
|
|
775
|
+
/** 读取上次 applyPromotion 产出的未满足促销提示 */
|
|
776
|
+
getUnfulfilledPromotions: () => OrderUnfulfilledPromotion[];
|
|
777
|
+
/** 读取上次 applyPromotion 产出的赠品操作 diff(toAdd / toReduce / toRemove) */
|
|
778
|
+
getLastGiftActions: () => OrderLastGiftActions | null;
|
|
524
779
|
/**
|
|
525
780
|
* 取消订单
|
|
526
781
|
* @param params 取消订单参数
|
|
@@ -4,9 +4,45 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
|
|
|
4
4
|
OrderHooks["OnOrderCancel"] = "order:onOrderCancel";
|
|
5
5
|
OrderHooks["OnOrderStatusChange"] = "order:onOrderStatusChange";
|
|
6
6
|
OrderHooks["OnOrderCustomerChange"] = "order:onOrderCustomerChange";
|
|
7
|
+
OrderHooks["OnPromotionApplied"] = "order:onPromotionApplied";
|
|
7
8
|
return OrderHooks;
|
|
8
9
|
}({});
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* 促销评估器协议(OS 与 PromotionEvaluator 之间的桥接接口)。
|
|
13
|
+
*
|
|
14
|
+
* 与 `pisell_os/src/model/strategy/adapter/promotion/evaluator.ts` 中的
|
|
15
|
+
* `PromotionEvaluator` 实例结构保持兼容。SalesSdkProvider 会从 `appHelper.utils.promotionEvaluator`
|
|
16
|
+
* 读取实例并通过 `setPromotionEvaluator` 注入到 OrderModule。
|
|
17
|
+
*
|
|
18
|
+
* 这里只声明 OrderModule 需要调用的子集,避免反向依赖具体 evaluator 实现。
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** 赠品解析回调 context(OS → SDK 的请求体) */
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 赠品 resolver 返回值。
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* return { products: [giftProduct], bookings: [giftBooking] };
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 赠品解析回调签名(SDK → OS 的返回值)。
|
|
32
|
+
*
|
|
33
|
+
* - 单选项:SDK 内部自动构造商品,不弹窗
|
|
34
|
+
* - 多选项:SDK 弹窗等用户确认后构造
|
|
35
|
+
* - 用户取消:抛错或返回空数组(OS 视为放弃本次添加)
|
|
36
|
+
*
|
|
37
|
+
* 返回数组时沿用旧协议,只写 tempOrder.products;返回对象时可同时写入预约 bookings。
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/** 未满足的促销策略(购物车底部 alert 渲染源) */
|
|
41
|
+
|
|
42
|
+
/** 上一次 applyPromotion 计算出的赠品操作(仅供调试/读取使用) */
|
|
43
|
+
|
|
44
|
+
/** onPromotionApplied 事件 payload */
|
|
45
|
+
|
|
10
46
|
/**
|
|
11
47
|
* tempOrder 上的下单客户协议字段视图。
|
|
12
48
|
* 这些字段会随订单提交到后端。
|
|
@@ -29,6 +65,8 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
|
|
|
29
65
|
|
|
30
66
|
/** 更新购物车行:仅传 SKU 时命中同 SKU 第一行;多行同 SKU 须传 unique_identification_number / 选项指纹等 */
|
|
31
67
|
|
|
68
|
+
/** 仅更新购物车行数量;行定位语义与 updateOrderProduct / removeProductFromOrder 保持一致 */
|
|
69
|
+
|
|
32
70
|
/**
|
|
33
71
|
* 订单信息
|
|
34
72
|
*/
|