@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
|
@@ -25,6 +25,9 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
25
25
|
private dbManager;
|
|
26
26
|
private logger;
|
|
27
27
|
private voucherUpdateLockByOrderUuid;
|
|
28
|
+
private payMethodMemoryCache;
|
|
29
|
+
private payMethodListInFlight;
|
|
30
|
+
private isRefreshingPaymentMethods;
|
|
28
31
|
protected otherParams: any;
|
|
29
32
|
cash: CashPayment;
|
|
30
33
|
eftpos: EftposPayment;
|
|
@@ -33,13 +36,6 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
33
36
|
private runVoucherUpdateLocked;
|
|
34
37
|
private normalizeVoucherPaymentItems;
|
|
35
38
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* 更新父级解决方案透传的运行态参数,主要用于日志父模块等上下文。
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
|
|
41
|
-
*/
|
|
42
|
-
updateOtherParams(params: Record<string, any>): void;
|
|
43
39
|
/**
|
|
44
40
|
* 记录信息日志
|
|
45
41
|
*/
|
|
@@ -61,14 +57,23 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
61
57
|
*
|
|
62
58
|
*/
|
|
63
59
|
private registerNetworkHandlers;
|
|
60
|
+
private filterPayMethods;
|
|
64
61
|
/**
|
|
65
62
|
* 获取支付方式列表
|
|
66
63
|
*/
|
|
67
64
|
getPayMethodListAsync(): Promise<PaymentMethod[]>;
|
|
65
|
+
private loadPayMethodListAsync;
|
|
66
|
+
/**
|
|
67
|
+
* 后台刷新支付方式列表
|
|
68
|
+
*/
|
|
69
|
+
private refreshPaymentMethodsInBackground;
|
|
70
|
+
/**
|
|
71
|
+
* 检查支付方式列表是否有变化
|
|
72
|
+
*/
|
|
73
|
+
private hasPaymentMethodsChanged;
|
|
68
74
|
/**
|
|
69
75
|
* 获取订单列表
|
|
70
76
|
*/
|
|
71
|
-
/** @deprecated */
|
|
72
77
|
getOrderListAsync(): Promise<PaymentOrder[]>;
|
|
73
78
|
/**
|
|
74
79
|
* 根据订单UUID获取支付订单(新方法)
|
|
@@ -168,12 +173,10 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
168
173
|
/**
|
|
169
174
|
* 确保支付模块所需的数据库表已创建
|
|
170
175
|
*/
|
|
171
|
-
/** @deprecated */
|
|
172
176
|
private ensurePaymentTables;
|
|
173
177
|
/**
|
|
174
178
|
* 获取部分支付的订单
|
|
175
179
|
*/
|
|
176
|
-
/** @deprecated */
|
|
177
180
|
getPartiallyPaidOrdersAsync(): Promise<PaymentOrder[]>;
|
|
178
181
|
/**
|
|
179
182
|
* 智能金额舍入
|
|
@@ -76,6 +76,9 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
76
76
|
this.defaultVersion = "1.0.0";
|
|
77
77
|
// LoggerManager 实例
|
|
78
78
|
this.voucherUpdateLockByOrderUuid = /* @__PURE__ */ new Map();
|
|
79
|
+
this.payMethodMemoryCache = null;
|
|
80
|
+
this.payMethodListInFlight = null;
|
|
81
|
+
this.isRefreshingPaymentMethods = false;
|
|
79
82
|
this.otherParams = {};
|
|
80
83
|
this.cash = new import_cash.CashPaymentImpl(this);
|
|
81
84
|
this.eftpos = new import_eftpos.EftposPaymentImpl(this);
|
|
@@ -123,19 +126,11 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
123
126
|
this.app = appPlugin.getApp();
|
|
124
127
|
this.dbManager = this.app.dbManager;
|
|
125
128
|
this.logger = this.app.logger;
|
|
129
|
+
await this.ensurePaymentTables();
|
|
126
130
|
this.registerNetworkHandlers();
|
|
127
131
|
console.log("[PaymentModule] 初始化完成");
|
|
128
132
|
this.logInfo("PaymentModule initialized successfully");
|
|
129
133
|
}
|
|
130
|
-
/**
|
|
131
|
-
* 更新父级解决方案透传的运行态参数,主要用于日志父模块等上下文。
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
* paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
|
|
135
|
-
*/
|
|
136
|
-
updateOtherParams(params) {
|
|
137
|
-
this.otherParams = params || {};
|
|
138
|
-
}
|
|
139
134
|
/**
|
|
140
135
|
* 记录信息日志
|
|
141
136
|
*/
|
|
@@ -218,18 +213,66 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
218
213
|
}
|
|
219
214
|
});
|
|
220
215
|
}
|
|
216
|
+
async filterPayMethods(payMethods) {
|
|
217
|
+
payMethods = payMethods.filter((method) => method.status === 1 && method.disable === 0);
|
|
218
|
+
const walletPassMethod = payMethods.find((method) => method.code === "WALLET_PASS");
|
|
219
|
+
if (walletPassMethod) {
|
|
220
|
+
payMethods.forEach((method) => {
|
|
221
|
+
if (method.code === "PRODUCTVOUCHER" || method.code === "GIFTCARD" || method.code === "POINTCARD") {
|
|
222
|
+
method.channel_application = walletPassMethod.channel_application;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
} else {
|
|
226
|
+
payMethods = payMethods.filter((method) => method.code !== "PRODUCTVOUCHER" && method.code !== "GIFTCARD" && method.code !== "POINTCARD");
|
|
227
|
+
}
|
|
228
|
+
return payMethods;
|
|
229
|
+
}
|
|
221
230
|
/**
|
|
222
231
|
* 获取支付方式列表
|
|
223
232
|
*/
|
|
224
233
|
async getPayMethodListAsync() {
|
|
234
|
+
var _a;
|
|
225
235
|
this.logInfo("Starting getPayMethodListAsync");
|
|
236
|
+
if ((_a = this.payMethodMemoryCache) == null ? void 0 : _a.length) {
|
|
237
|
+
return this.payMethodMemoryCache;
|
|
238
|
+
}
|
|
239
|
+
if (this.payMethodListInFlight) {
|
|
240
|
+
return this.payMethodListInFlight;
|
|
241
|
+
}
|
|
242
|
+
this.payMethodListInFlight = this.loadPayMethodListAsync().finally(() => {
|
|
243
|
+
this.payMethodListInFlight = null;
|
|
244
|
+
});
|
|
245
|
+
return this.payMethodListInFlight;
|
|
246
|
+
}
|
|
247
|
+
async loadPayMethodListAsync() {
|
|
226
248
|
try {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
249
|
+
let cachedMethods = [];
|
|
250
|
+
try {
|
|
251
|
+
cachedMethods = await this.dbManager.getAll("pay_method");
|
|
252
|
+
} catch (dbError) {
|
|
253
|
+
console.warn("[PaymentModule] pay_method 表不存在,将从服务器获取数据");
|
|
254
|
+
}
|
|
255
|
+
const hasCache = cachedMethods.length > 0;
|
|
256
|
+
if (hasCache) {
|
|
257
|
+
this.payMethodMemoryCache = cachedMethods;
|
|
258
|
+
this.refreshPaymentMethodsInBackground(cachedMethods);
|
|
259
|
+
return cachedMethods;
|
|
260
|
+
}
|
|
261
|
+
const response = await this.request.get("/pay/custom-payment/all");
|
|
262
|
+
response.data = await this.filterPayMethods(response.data);
|
|
263
|
+
const payMethods = response.data || [];
|
|
264
|
+
this.payMethodMemoryCache = payMethods;
|
|
265
|
+
try {
|
|
266
|
+
for (const method of payMethods) {
|
|
267
|
+
await this.dbManager.update("pay_method", method);
|
|
268
|
+
}
|
|
269
|
+
} catch (dbError) {
|
|
270
|
+
console.warn("[PaymentModule] 无法缓存支付方式,pay_method 表不存在");
|
|
271
|
+
}
|
|
272
|
+
await this.core.effects.emit(
|
|
273
|
+
`${this.name}:onPaymentMethodsLoaded`,
|
|
274
|
+
payMethods
|
|
275
|
+
);
|
|
233
276
|
this.logInfo("getPayMethodListAsync completed successfully", {
|
|
234
277
|
payMethods
|
|
235
278
|
});
|
|
@@ -240,10 +283,101 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
240
283
|
return [];
|
|
241
284
|
}
|
|
242
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* 后台刷新支付方式列表
|
|
288
|
+
*/
|
|
289
|
+
async refreshPaymentMethodsInBackground(cachedMethods) {
|
|
290
|
+
if (this.isRefreshingPaymentMethods)
|
|
291
|
+
return;
|
|
292
|
+
this.isRefreshingPaymentMethods = true;
|
|
293
|
+
this.logInfo("Starting refreshPaymentMethodsInBackground", {
|
|
294
|
+
cachedMethodsCount: cachedMethods.length
|
|
295
|
+
});
|
|
296
|
+
try {
|
|
297
|
+
console.log("[PaymentModule] 后台刷新支付方式列表...");
|
|
298
|
+
const response = await this.request.get("/pay/custom-payment/all");
|
|
299
|
+
response.data = await this.filterPayMethods(response.data);
|
|
300
|
+
const newPayMethods = response.data || [];
|
|
301
|
+
this.payMethodMemoryCache = newPayMethods;
|
|
302
|
+
const hasChanges = this.hasPaymentMethodsChanged(
|
|
303
|
+
cachedMethods,
|
|
304
|
+
newPayMethods
|
|
305
|
+
);
|
|
306
|
+
if (hasChanges) {
|
|
307
|
+
console.log("[PaymentModule] 支付方式列表已更新");
|
|
308
|
+
this.logInfo("Payment methods updated in background", {
|
|
309
|
+
oldCount: cachedMethods.length,
|
|
310
|
+
newCount: newPayMethods.length
|
|
311
|
+
});
|
|
312
|
+
try {
|
|
313
|
+
for (const method of cachedMethods) {
|
|
314
|
+
await this.dbManager.delete("pay_method", method.id);
|
|
315
|
+
}
|
|
316
|
+
for (const method of newPayMethods) {
|
|
317
|
+
await this.dbManager.update("pay_method", method);
|
|
318
|
+
}
|
|
319
|
+
} catch (dbError) {
|
|
320
|
+
console.warn("[PaymentModule] 无法更新支付方式缓存", dbError);
|
|
321
|
+
}
|
|
322
|
+
const eventData = {
|
|
323
|
+
oldMethods: cachedMethods,
|
|
324
|
+
newMethods: newPayMethods
|
|
325
|
+
};
|
|
326
|
+
await this.core.effects.emit(
|
|
327
|
+
`${this.name}:onPaymentMethodsChanged`,
|
|
328
|
+
eventData
|
|
329
|
+
);
|
|
330
|
+
} else {
|
|
331
|
+
console.log("[PaymentModule] 支付方式列表无变化");
|
|
332
|
+
}
|
|
333
|
+
} catch (error) {
|
|
334
|
+
console.error("[PaymentModule] 后台刷新支付方式失败", error);
|
|
335
|
+
} finally {
|
|
336
|
+
this.isRefreshingPaymentMethods = false;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* 检查支付方式列表是否有变化
|
|
341
|
+
*/
|
|
342
|
+
hasPaymentMethodsChanged(oldMethods, newMethods) {
|
|
343
|
+
if (oldMethods.length !== newMethods.length) {
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
const oldMethodsMap = new Map(
|
|
347
|
+
oldMethods.map((method) => [method.id, method])
|
|
348
|
+
);
|
|
349
|
+
for (const newMethod of newMethods) {
|
|
350
|
+
const oldMethod = oldMethodsMap.get(newMethod.id);
|
|
351
|
+
if (!oldMethod) {
|
|
352
|
+
return true;
|
|
353
|
+
}
|
|
354
|
+
if (oldMethod.code !== newMethod.code || oldMethod.name !== newMethod.name || oldMethod.type !== newMethod.type || oldMethod.description !== newMethod.description || oldMethod.status !== newMethod.status || oldMethod.disable !== newMethod.disable || oldMethod.is_surcharge !== newMethod.is_surcharge || oldMethod.fixed !== newMethod.fixed || oldMethod.percentage !== newMethod.percentage || oldMethod.enabled !== newMethod.enabled || JSON.stringify(oldMethod.channel_application || []) !== JSON.stringify(newMethod.channel_application || []) || JSON.stringify(oldMethod.companies || []) !== JSON.stringify(newMethod.companies || []) || JSON.stringify(oldMethod.metadata || {}) !== JSON.stringify(newMethod.metadata || {})) {
|
|
355
|
+
console.log(`[PaymentModule] 支付方式 ${newMethod.id} (${newMethod.code}) 发生变化:`, {
|
|
356
|
+
id: newMethod.id,
|
|
357
|
+
changes: {
|
|
358
|
+
code: oldMethod.code !== newMethod.code ? { old: oldMethod.code, new: newMethod.code } : void 0,
|
|
359
|
+
name: oldMethod.name !== newMethod.name ? { old: oldMethod.name, new: newMethod.name } : void 0,
|
|
360
|
+
type: oldMethod.type !== newMethod.type ? { old: oldMethod.type, new: newMethod.type } : void 0,
|
|
361
|
+
description: oldMethod.description !== newMethod.description ? { old: oldMethod.description, new: newMethod.description } : void 0,
|
|
362
|
+
status: oldMethod.status !== newMethod.status ? { old: oldMethod.status, new: newMethod.status } : void 0,
|
|
363
|
+
disable: oldMethod.disable !== newMethod.disable ? { old: oldMethod.disable, new: newMethod.disable } : void 0,
|
|
364
|
+
is_surcharge: oldMethod.is_surcharge !== newMethod.is_surcharge ? { old: oldMethod.is_surcharge, new: newMethod.is_surcharge } : void 0,
|
|
365
|
+
fixed: oldMethod.fixed !== newMethod.fixed ? { old: oldMethod.fixed, new: newMethod.fixed } : void 0,
|
|
366
|
+
percentage: oldMethod.percentage !== newMethod.percentage ? { old: oldMethod.percentage, new: newMethod.percentage } : void 0,
|
|
367
|
+
enabled: oldMethod.enabled !== newMethod.enabled ? { old: oldMethod.enabled, new: newMethod.enabled } : void 0,
|
|
368
|
+
channel_application: JSON.stringify(oldMethod.channel_application || []) !== JSON.stringify(newMethod.channel_application || []) ? { old: oldMethod.channel_application, new: newMethod.channel_application } : void 0,
|
|
369
|
+
companies: JSON.stringify(oldMethod.companies || []) !== JSON.stringify(newMethod.companies || []) ? { old: oldMethod.companies, new: newMethod.companies } : void 0,
|
|
370
|
+
metadata: JSON.stringify(oldMethod.metadata || {}) !== JSON.stringify(newMethod.metadata || {}) ? { old: oldMethod.metadata, new: newMethod.metadata } : void 0
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return false;
|
|
377
|
+
}
|
|
243
378
|
/**
|
|
244
379
|
* 获取订单列表
|
|
245
380
|
*/
|
|
246
|
-
/** @deprecated */
|
|
247
381
|
async getOrderListAsync() {
|
|
248
382
|
try {
|
|
249
383
|
return await this.dbManager.getAll("order");
|
|
@@ -1001,7 +1135,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1001
1135
|
/**
|
|
1002
1136
|
* 确保支付模块所需的数据库表已创建
|
|
1003
1137
|
*/
|
|
1004
|
-
/** @deprecated */
|
|
1005
1138
|
async ensurePaymentTables() {
|
|
1006
1139
|
try {
|
|
1007
1140
|
await this.dbManager.getAll("pay_method");
|
|
@@ -1023,7 +1156,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1023
1156
|
/**
|
|
1024
1157
|
* 获取部分支付的订单
|
|
1025
1158
|
*/
|
|
1026
|
-
/** @deprecated */
|
|
1027
1159
|
async getPartiallyPaidOrdersAsync() {
|
|
1028
1160
|
try {
|
|
1029
1161
|
const allOrders = await this.dbManager.getAll("order");
|
|
@@ -135,8 +135,6 @@ export interface PaymentItem {
|
|
|
135
135
|
origin_amount?: string;
|
|
136
136
|
/** 订单支付类型 */
|
|
137
137
|
order_payment_type?: 'normal' | 'deposit';
|
|
138
|
-
/** 支付时间 (格式: YYYY-MM-DD HH:mm:ss) */
|
|
139
|
-
payment_time?: string;
|
|
140
138
|
/** 本支付项是否已成功同步到后端 */
|
|
141
139
|
isSynced?: boolean;
|
|
142
140
|
/** 最近一次同步失败信息(存在则代表同步失败过) */
|
|
@@ -31,7 +31,7 @@ var getAvailableMaxAmount = (data) => {
|
|
|
31
31
|
return data.tag !== "point_card" ? data.available_max_amount : data == null ? void 0 : data.recommended_usage_amount;
|
|
32
32
|
};
|
|
33
33
|
var formatWalletPassList2PreparePayments = (list) => {
|
|
34
|
-
|
|
34
|
+
return (list || []).map((item) => {
|
|
35
35
|
return {
|
|
36
36
|
voucher_id: item.id || 0,
|
|
37
37
|
amount: Number(item.edit_current_amount || getAvailableMaxAmount(item)) || 0,
|
|
@@ -40,7 +40,6 @@ var formatWalletPassList2PreparePayments = (list) => {
|
|
|
40
40
|
wallet_pass_use_value: item.wallet_pass_use_value || void 0
|
|
41
41
|
};
|
|
42
42
|
});
|
|
43
|
-
return formatted;
|
|
44
43
|
};
|
|
45
44
|
var sortUserIdentificationCodeList = (list) => {
|
|
46
45
|
if (!Array.isArray(list) || list.length === 0) {
|
|
@@ -296,22 +296,18 @@ var WalletPassPaymentImpl = class {
|
|
|
296
296
|
return (0, import_utils.formatWalletPassList2PreparePayments)(list);
|
|
297
297
|
}
|
|
298
298
|
async getUserIdentificationCodeListAsync(params) {
|
|
299
|
-
var _a, _b
|
|
299
|
+
var _a, _b;
|
|
300
300
|
try {
|
|
301
301
|
const newParams = {
|
|
302
302
|
...this.walletParams,
|
|
303
303
|
...params
|
|
304
304
|
};
|
|
305
|
-
if (!((_a = newParams.products) == null ? void 0 : _a.length)) {
|
|
306
|
-
this.paymentModule.logInfo("[WalletPass] 商品列表为空,跳过获取用户识别码列表");
|
|
307
|
-
return [];
|
|
308
|
-
}
|
|
309
305
|
this.paymentModule.logInfo("[WalletPass] 开始获取用户识别码列表", {
|
|
310
306
|
customer_id: newParams.customer_id,
|
|
311
307
|
available: newParams.available,
|
|
312
|
-
prepare_payments_count: ((
|
|
308
|
+
prepare_payments_count: ((_a = newParams.prepare_payments) == null ? void 0 : _a.length) || 0,
|
|
313
309
|
filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass,
|
|
314
|
-
payment_order_id: (
|
|
310
|
+
payment_order_id: (_b = this.walletParams) == null ? void 0 : _b.payment_order_id
|
|
315
311
|
});
|
|
316
312
|
const response = await this.paymentModule.request.post(
|
|
317
313
|
"/machinecode/prepare/deduction",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Module, PisellCore } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { ProductListLoadProductsParams } from './types';
|
|
4
3
|
import { ProductData } from '../Product/types';
|
|
5
4
|
export * from './types';
|
|
6
5
|
export declare class ProductList extends BaseModule implements Module {
|
|
@@ -11,22 +10,19 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
11
10
|
private otherParams;
|
|
12
11
|
constructor(name?: string, version?: string);
|
|
13
12
|
initialize(core: PisellCore, options: any): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* 更新运行态参数,供父级解决方案 setOtherParams 后同步查询上下文。
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* productList.updateOtherParams({ channel: 'pos' });
|
|
19
|
-
*/
|
|
20
|
-
updateOtherParams(params: Record<string, any>): void;
|
|
21
13
|
storeChange(path?: string, value?: any): Promise<void>;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, }: {
|
|
15
|
+
category_ids?: number[];
|
|
16
|
+
product_ids?: number[];
|
|
17
|
+
collection?: number | string[];
|
|
18
|
+
schedule_date?: string;
|
|
19
|
+
cacheId?: string;
|
|
20
|
+
customer_id?: number;
|
|
21
|
+
menu_list_ids?: number[];
|
|
22
|
+
schedule_datetime?: string;
|
|
23
|
+
with_count?: string[];
|
|
24
|
+
with_schedule?: number;
|
|
25
|
+
}, options?: {
|
|
30
26
|
callback?: (result: any) => void;
|
|
31
27
|
subscriberId?: string;
|
|
32
28
|
}): Promise<any>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
19
17
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/modules/ProductList/index.ts
|
|
@@ -35,7 +25,6 @@ __export(ProductList_exports, {
|
|
|
35
25
|
module.exports = __toCommonJS(ProductList_exports);
|
|
36
26
|
var import_BaseModule = require("../BaseModule");
|
|
37
27
|
var import_lodash_es = require("lodash-es");
|
|
38
|
-
var import_dayjs = __toESM(require("dayjs"));
|
|
39
28
|
__reExport(ProductList_exports, require("./types"), module.exports);
|
|
40
29
|
var ProductList = class extends import_BaseModule.BaseModule {
|
|
41
30
|
constructor(name, version) {
|
|
@@ -58,31 +47,8 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
58
47
|
}
|
|
59
48
|
this.request = core.getPlugin("request");
|
|
60
49
|
}
|
|
61
|
-
/**
|
|
62
|
-
* 更新运行态参数,供父级解决方案 setOtherParams 后同步查询上下文。
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* productList.updateOtherParams({ channel: 'pos' });
|
|
66
|
-
*/
|
|
67
|
-
updateOtherParams(params) {
|
|
68
|
-
this.otherParams = params || {};
|
|
69
|
-
}
|
|
70
50
|
async storeChange(path, value) {
|
|
71
51
|
}
|
|
72
|
-
/**
|
|
73
|
-
* 获取加时商品列表。
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* const products = await productList.getAddTimeProducts({ schedule_date: '2026-06-16' });
|
|
77
|
-
*/
|
|
78
|
-
async getAddTimeProducts(params = {}) {
|
|
79
|
-
return this.loadProducts({
|
|
80
|
-
schedule_date: (0, import_dayjs.default)().format("YYYY-MM-DD"),
|
|
81
|
-
status: "published",
|
|
82
|
-
...params,
|
|
83
|
-
extension_type: ["product_add_time"]
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
52
|
async loadProducts({
|
|
87
53
|
category_ids = [],
|
|
88
54
|
product_ids = [],
|
|
@@ -93,10 +59,8 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
93
59
|
schedule_datetime,
|
|
94
60
|
schedule_date,
|
|
95
61
|
cacheId,
|
|
96
|
-
with_schedule
|
|
97
|
-
|
|
98
|
-
status = "published"
|
|
99
|
-
} = {}, options) {
|
|
62
|
+
with_schedule
|
|
63
|
+
}, options) {
|
|
100
64
|
var _a, _b;
|
|
101
65
|
let userPlugin = this.core.getPlugin("user");
|
|
102
66
|
let customer_id = void 0;
|
|
@@ -119,7 +83,7 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
119
83
|
"event_item"
|
|
120
84
|
],
|
|
121
85
|
with: ["category", "collection", "resourceRelation"],
|
|
122
|
-
status,
|
|
86
|
+
status: "published",
|
|
123
87
|
num: 500,
|
|
124
88
|
skip: 1,
|
|
125
89
|
customer_id,
|
|
@@ -134,8 +98,7 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
134
98
|
application_code: (_b = this.otherParams) == null ? void 0 : _b.channel,
|
|
135
99
|
is_eject: 1,
|
|
136
100
|
with_schedule,
|
|
137
|
-
schedule_datetime
|
|
138
|
-
extension_type
|
|
101
|
+
schedule_datetime
|
|
139
102
|
},
|
|
140
103
|
{ osServer: true, callback: options == null ? void 0 : options.callback, subscriberId: options == null ? void 0 : options.subscriberId, customToast: () => {
|
|
141
104
|
} }
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
import { ProductData } from '../Product/types';
|
|
2
|
-
export interface ProductListLoadProductsParams {
|
|
3
|
-
category_ids?: number[];
|
|
4
|
-
product_ids?: number[];
|
|
5
|
-
collection?: number | string[];
|
|
6
|
-
schedule_date?: string;
|
|
7
|
-
cacheId?: string;
|
|
8
|
-
customer_id?: number;
|
|
9
|
-
menu_list_ids?: number[];
|
|
10
|
-
schedule_datetime?: string;
|
|
11
|
-
with_count?: string[];
|
|
12
|
-
with_schedule?: number;
|
|
13
|
-
extension_type?: string[];
|
|
14
|
-
status?: string;
|
|
15
|
-
}
|
|
16
2
|
export interface ProductListData {
|
|
17
3
|
list: ProductData[];
|
|
18
4
|
selectProducts: ProductData[];
|
|
@@ -47,6 +47,7 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
47
47
|
customer_id?: number | string;
|
|
48
48
|
}): Map<string, string | null>;
|
|
49
49
|
setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
|
|
50
|
+
private filterQuotationsByCustomer;
|
|
50
51
|
private isQuotationVisibleForCustomer;
|
|
51
52
|
private hasValidCustomerId;
|
|
52
53
|
private isQuotationActiveAt;
|
|
@@ -43,15 +43,20 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
43
43
|
const query = {};
|
|
44
44
|
if (params == null ? void 0 : params.channel)
|
|
45
45
|
query.channel = params.channel;
|
|
46
|
+
if (params == null ? void 0 : params.customer_id)
|
|
47
|
+
query.customer_id = String(params.customer_id);
|
|
46
48
|
if ((params == null ? void 0 : params.channel) === "online_store") {
|
|
47
49
|
query.channel = "online-store";
|
|
48
50
|
}
|
|
49
51
|
const res = await this.request.get(
|
|
50
52
|
"/quotation/available",
|
|
51
53
|
query,
|
|
52
|
-
{ useCache: false
|
|
54
|
+
{ useCache: false }
|
|
55
|
+
);
|
|
56
|
+
const list = this.filterQuotationsByCustomer(
|
|
57
|
+
((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || (res == null ? void 0 : res.list) || [],
|
|
58
|
+
params == null ? void 0 : params.customer_id
|
|
53
59
|
);
|
|
54
|
-
const list = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || (res == null ? void 0 : res.list) || [];
|
|
55
60
|
list.sort((a, b) => a.sort - b.sort);
|
|
56
61
|
this.store.list = list;
|
|
57
62
|
}
|
|
@@ -69,11 +74,9 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
69
74
|
getPriceForProduct(params) {
|
|
70
75
|
const { productId, variantId, datetime, customer_id } = params;
|
|
71
76
|
for (const quotation of this.store.list) {
|
|
72
|
-
|
|
73
|
-
if (!visible)
|
|
77
|
+
if (!this.isQuotationVisibleForCustomer(quotation, customer_id))
|
|
74
78
|
continue;
|
|
75
|
-
|
|
76
|
-
if (!active)
|
|
79
|
+
if (!this.isQuotationActiveAt(quotation, datetime))
|
|
77
80
|
continue;
|
|
78
81
|
const match = this.findProductData(quotation.product_data, productId, variantId);
|
|
79
82
|
if (!match)
|
|
@@ -125,6 +128,9 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
125
128
|
setScheduleResolver(resolver) {
|
|
126
129
|
this.scheduleResolver = resolver;
|
|
127
130
|
}
|
|
131
|
+
filterQuotationsByCustomer(list, customerId) {
|
|
132
|
+
return list.filter((quotation) => this.isQuotationVisibleForCustomer(quotation, customerId));
|
|
133
|
+
}
|
|
128
134
|
isQuotationVisibleForCustomer(quotation, customerId) {
|
|
129
135
|
const customers = quotation.customer || [];
|
|
130
136
|
if (customers.length === 0)
|
|
@@ -142,27 +148,18 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
142
148
|
var _a;
|
|
143
149
|
if (!((_a = quotation.schedule) == null ? void 0 : _a.length))
|
|
144
150
|
return false;
|
|
145
|
-
const scheduleItems =
|
|
146
|
-
quotation.schedule.forEach((s) => {
|
|
151
|
+
const scheduleItems = quotation.schedule.map((s) => {
|
|
147
152
|
var _a2;
|
|
148
153
|
const full = (_a2 = this.scheduleResolver) == null ? void 0 : _a2.call(this, s.id);
|
|
149
|
-
if (full)
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
if (this.scheduleResolver) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
const fallbackSchedule = {
|
|
154
|
+
if (full)
|
|
155
|
+
return full;
|
|
156
|
+
return {
|
|
157
157
|
...s,
|
|
158
158
|
repeat_type: s.repeat_type || "none",
|
|
159
159
|
repeat_rule: s.repeat_rule || null,
|
|
160
160
|
time_slot: s.time_slot || []
|
|
161
161
|
};
|
|
162
|
-
scheduleItems.push(fallbackSchedule);
|
|
163
162
|
});
|
|
164
|
-
if (!scheduleItems.length)
|
|
165
|
-
return false;
|
|
166
163
|
return (0, import_getDateIsInSchedule.getDateIsInSchedule)(datetime, scheduleItems);
|
|
167
164
|
}
|
|
168
165
|
findProductData(productData, productId, variantId) {
|
|
@@ -32,10 +32,6 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
32
32
|
unavailableReason?: UnavailableReason;
|
|
33
33
|
};
|
|
34
34
|
filterDiscountListByType(discountList: Discount[], type: string): Discount[];
|
|
35
|
-
/** 剔除指定 type/tag 的折扣项,保留手动改价(type=product) / 券等 */
|
|
36
|
-
excludeDiscountListByType(discountList: Discount[], type: string): Discount[];
|
|
37
|
-
/** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
|
|
38
|
-
resolveDiscountListForManualOverride(discountList: Discount[]): Discount[];
|
|
39
35
|
private getUnavailableReason;
|
|
40
36
|
calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
|
|
41
37
|
discountList: Discount[];
|