@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,4 +1,4 @@
|
|
|
1
|
-
import { OrderModule, ProductList,
|
|
1
|
+
import { OrderModule, ProductList, SalesSummaryModule, ScanOrderLoggerModule as BaseSalesLoggerModule, ScheduleModule } from '../../modules';
|
|
2
2
|
import type { ScanOrderLogInput as BaseSalesLogInput, ScanOrderLoggerProviderConfig as BaseSalesLoggerProviderConfig, ScanOrderLoggerProviderType as BaseSalesLoggerProviderType } from '../../modules/ScanOrderLogger/types';
|
|
3
3
|
import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
4
4
|
/**
|
|
@@ -11,8 +11,6 @@ export declare const BaseSalesHookNames: {
|
|
|
11
11
|
readonly onRetryInit: "onRetryInit";
|
|
12
12
|
readonly onRefresh: "onRefresh";
|
|
13
13
|
readonly onCartValidationChanged: "onCartValidationChanged";
|
|
14
|
-
readonly onPaymentSyncStart: "onPaymentSyncStart";
|
|
15
|
-
readonly onPaymentSyncEnd: "onPaymentSyncEnd";
|
|
16
14
|
};
|
|
17
15
|
export type BaseSalesHookName = typeof BaseSalesHookNames[keyof typeof BaseSalesHookNames];
|
|
18
16
|
export declare function createBaseSalesHook(moduleName: string, hookName: BaseSalesHookName): string;
|
|
@@ -41,20 +39,13 @@ export interface BaseSalesOrderProductIdentity {
|
|
|
41
39
|
identity_key?: string;
|
|
42
40
|
unique_identification_number?: string;
|
|
43
41
|
/** 参与合并/匹配;与 remove 通配语义见 isSkuOnlyDeleteIdentity */
|
|
44
|
-
|
|
42
|
+
product_option_item?: any[];
|
|
45
43
|
product_bundle?: any[];
|
|
46
44
|
}
|
|
47
|
-
export interface BaseSalesProductSku {
|
|
48
|
-
option: any[];
|
|
49
|
-
[key: string]: any;
|
|
50
|
-
}
|
|
51
|
-
export interface BaseSalesUpdateOrderProductQuantityParams extends BaseSalesOrderProductIdentity {
|
|
52
|
-
num: number;
|
|
53
|
-
}
|
|
54
45
|
export interface BaseSalesOrderProduct extends BaseSalesOrderProductIdentity {
|
|
55
46
|
order_detail_id: number | null;
|
|
56
47
|
num: number;
|
|
57
|
-
|
|
48
|
+
product_option_item: any[];
|
|
58
49
|
/**
|
|
59
50
|
* 券后 **行 composite 单价** = `metadata.main_product_selling_price`
|
|
60
51
|
* + Σ((bundle.bundle_selling_price ?? bundle.price) × (bundle.num ?? 1))
|
|
@@ -100,8 +91,9 @@ export interface BaseSalesOrderProduct extends BaseSalesOrderProductIdentity {
|
|
|
100
91
|
* 出站 payload 版本的商品行。
|
|
101
92
|
*
|
|
102
93
|
* 与 tempOrder 内部 `BaseSalesOrderProduct` 的字段差异:
|
|
103
|
-
* - `
|
|
104
|
-
*
|
|
94
|
+
* - `product_option_item[*]`:内部为 `{ option_group_item_id, option_group_id, num, price, ... }`,
|
|
95
|
+
* 出站保留 `{ option_group_item_id, option_group_id, num }`
|
|
96
|
+
* (后端 checkout 协议;丢弃 `price` 等运行时辅助字段)。
|
|
105
97
|
* - `product_bundle[*].option[*]`:同上重命名规则。
|
|
106
98
|
*
|
|
107
99
|
* 运行时(UI 显示、加购合并、指纹、持久化)与提交边界统一消费字段名
|
|
@@ -126,7 +118,6 @@ export interface BaseSalesSummary {
|
|
|
126
118
|
shipping_tax_fee: string;
|
|
127
119
|
tax_fee: string;
|
|
128
120
|
surcharge_fee: string;
|
|
129
|
-
surcharges?: any[];
|
|
130
121
|
discount_amount: string;
|
|
131
122
|
deposit_amount: string;
|
|
132
123
|
deposit?: {
|
|
@@ -212,66 +203,6 @@ export interface BaseSalesSubmitPayload extends Omit<BaseSalesTempOrder, 'platfo
|
|
|
212
203
|
}>;
|
|
213
204
|
products: BaseSalesSubmitProduct[];
|
|
214
205
|
}
|
|
215
|
-
export interface BaseSalesQuotationDurationConfig {
|
|
216
|
-
type: string;
|
|
217
|
-
value: number;
|
|
218
|
-
flexible_config?: {
|
|
219
|
-
is_enable_minimum_duration?: 0 | 1;
|
|
220
|
-
warning_threshold?: number;
|
|
221
|
-
block_threshold?: number;
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
export interface BaseSalesCalculateProductBookingPriceParams {
|
|
225
|
-
product: Record<string, any>;
|
|
226
|
-
booking?: {
|
|
227
|
-
start_date?: string;
|
|
228
|
-
start_time?: string;
|
|
229
|
-
end_date?: string;
|
|
230
|
-
end_time?: string;
|
|
231
|
-
[key: string]: any;
|
|
232
|
-
};
|
|
233
|
-
duration?: BaseSalesQuotationDurationConfig;
|
|
234
|
-
customer_id?: number | string;
|
|
235
|
-
fallback_price?: number | string;
|
|
236
|
-
datetime?: string;
|
|
237
|
-
channel?: string;
|
|
238
|
-
}
|
|
239
|
-
export type BaseSalesProductBookingPriceSegmentSource = 'quotation' | 'fallback';
|
|
240
|
-
export interface BaseSalesProductBookingPriceSegment {
|
|
241
|
-
start_datetime: string;
|
|
242
|
-
end_datetime?: string;
|
|
243
|
-
time_point: string;
|
|
244
|
-
unit_price: string;
|
|
245
|
-
quantity: number;
|
|
246
|
-
total_price: string;
|
|
247
|
-
quotation_shelf_id: number;
|
|
248
|
-
source: BaseSalesProductBookingPriceSegmentSource;
|
|
249
|
-
}
|
|
250
|
-
export interface BaseSalesBundleProductBookingPriceResult {
|
|
251
|
-
bundle_id?: number;
|
|
252
|
-
group_id?: number;
|
|
253
|
-
bundle_group_id?: number;
|
|
254
|
-
bundle_product_id: number | null;
|
|
255
|
-
bundle_variant_id: number;
|
|
256
|
-
unit_price: string;
|
|
257
|
-
total_price: string;
|
|
258
|
-
quantity: number;
|
|
259
|
-
quotation_shelf_id: number;
|
|
260
|
-
source: BaseSalesProductBookingPriceSegmentSource;
|
|
261
|
-
segments: BaseSalesProductBookingPriceSegment[];
|
|
262
|
-
}
|
|
263
|
-
export interface BaseSalesProductBookingPriceResult {
|
|
264
|
-
product_id: number | null;
|
|
265
|
-
product_variant_id: number;
|
|
266
|
-
customer_id?: number | string;
|
|
267
|
-
unit_price: string;
|
|
268
|
-
total_price: string;
|
|
269
|
-
quantity: number;
|
|
270
|
-
duration?: BaseSalesQuotationDurationConfig;
|
|
271
|
-
quotation_shelf_id: number;
|
|
272
|
-
segments: BaseSalesProductBookingPriceSegment[];
|
|
273
|
-
product_bundle?: BaseSalesBundleProductBookingPriceResult[];
|
|
274
|
-
}
|
|
275
206
|
export type BaseSalesAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
|
|
276
207
|
export interface BaseSalesTableFormRecord {
|
|
277
208
|
policy?: string | null;
|
|
@@ -350,7 +281,6 @@ export interface BaseSalesState {
|
|
|
350
281
|
error: string | null;
|
|
351
282
|
products?: ProductList;
|
|
352
283
|
order?: OrderModule;
|
|
353
|
-
quotation?: QuotationModule;
|
|
354
284
|
salesSummary?: SalesSummaryModule;
|
|
355
285
|
baseSalesLogger?: BaseSalesLoggerModule;
|
|
356
286
|
schedule?: ScheduleModule;
|
|
@@ -7,9 +7,7 @@ export var BaseSalesHookNames = {
|
|
|
7
7
|
onDestroy: 'onDestroy',
|
|
8
8
|
onRetryInit: 'onRetryInit',
|
|
9
9
|
onRefresh: 'onRefresh',
|
|
10
|
-
onCartValidationChanged: 'onCartValidationChanged'
|
|
11
|
-
onPaymentSyncStart: 'onPaymentSyncStart',
|
|
12
|
-
onPaymentSyncEnd: 'onPaymentSyncEnd'
|
|
10
|
+
onCartValidationChanged: 'onCartValidationChanged'
|
|
13
11
|
};
|
|
14
12
|
export function createBaseSalesHook(moduleName, hookName) {
|
|
15
13
|
return "".concat(moduleName, ":").concat(hookName);
|
|
@@ -19,8 +17,9 @@ export function createBaseSalesHook(moduleName, hookName) {
|
|
|
19
17
|
* 出站 payload 版本的商品行。
|
|
20
18
|
*
|
|
21
19
|
* 与 tempOrder 内部 `BaseSalesOrderProduct` 的字段差异:
|
|
22
|
-
* - `
|
|
23
|
-
*
|
|
20
|
+
* - `product_option_item[*]`:内部为 `{ option_group_item_id, option_group_id, num, price, ... }`,
|
|
21
|
+
* 出站保留 `{ option_group_item_id, option_group_id, num }`
|
|
22
|
+
* (后端 checkout 协议;丢弃 `price` 等运行时辅助字段)。
|
|
24
23
|
* - `product_bundle[*].option[*]`:同上重命名规则。
|
|
25
24
|
*
|
|
26
25
|
* 运行时(UI 显示、加购合并、指纹、持久化)与提交边界统一消费字段名
|
|
@@ -23,7 +23,6 @@ export interface BaseProductDetailPayload {
|
|
|
23
23
|
option?: BaseProductDetailOptionItem[];
|
|
24
24
|
options?: BaseProductDetailOptionItem[];
|
|
25
25
|
product_option_item?: BaseProductDetailOptionItem[];
|
|
26
|
-
product_sku?: Record<string, any>;
|
|
27
26
|
bundle?: BaseProductDetailBundleItem[];
|
|
28
27
|
product_bundle?: BaseProductDetailBundleItem[];
|
|
29
28
|
unique?: string;
|
|
@@ -4,8 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
import { composeLinePrice, getBundleSellingMagnitude, normalizeProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
|
|
8
|
-
import { buildManualProductDiscountItem, mergeManualProductDiscountIntoList, resolveManualDiscountOriginTotal, resolveManualDiscountReasonFromSources, shouldBuildManualProductDiscount } from "../../../modules/Order/utils/manualProductDiscount";
|
|
9
7
|
function toNumber(value) {
|
|
10
8
|
var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
11
9
|
var parsedValue = Number(value);
|
|
@@ -33,49 +31,23 @@ function toPriceString(value) {
|
|
|
33
31
|
function normalizeOptionItems(optionItems) {
|
|
34
32
|
if (!Array.isArray(optionItems)) return [];
|
|
35
33
|
return optionItems.map(function (optionItem) {
|
|
36
|
-
var
|
|
37
|
-
var optionGroupItemId = toNumber(
|
|
34
|
+
var _ref, _optionItem$price, _optionItem$num;
|
|
35
|
+
var optionGroupItemId = toNumber(optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id);
|
|
38
36
|
var price = (_ref = (_optionItem$price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _optionItem$price !== void 0 ? _optionItem$price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _ref !== void 0 ? _ref : 0;
|
|
39
|
-
return
|
|
37
|
+
return {
|
|
40
38
|
option_group_item_id: optionGroupItemId,
|
|
41
39
|
option_group_id: toNumber(optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_id),
|
|
42
40
|
num: toSafePositiveInt((_optionItem$num = optionItem === null || optionItem === void 0 ? void 0 : optionItem.num) !== null && _optionItem$num !== void 0 ? _optionItem$num : optionItem === null || optionItem === void 0 ? void 0 : optionItem.quantity, 1),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
41
|
+
price: toNumber(price, 0)
|
|
42
|
+
};
|
|
46
43
|
});
|
|
47
44
|
}
|
|
48
45
|
function normalizeBundleItems(bundleItems) {
|
|
49
|
-
var preferPriceField = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
50
46
|
if (!Array.isArray(bundleItems)) return [];
|
|
51
47
|
return bundleItems.map(function (bundleItem) {
|
|
52
|
-
|
|
53
|
-
var unitSelling = preferPriceField ? (_ref2 = (_ref3 = (_ref4 = (_bundleItem$price = bundleItem.price) !== null && _bundleItem$price !== void 0 ? _bundleItem$price : bundleItem.bundle_selling_price) !== null && _ref4 !== void 0 ? _ref4 : bundleItem.custom_price) !== null && _ref3 !== void 0 ? _ref3 : bundleItem.product_price) !== null && _ref2 !== void 0 ? _ref2 : '0' : (_ref5 = (_ref6 = (_ref7 = (_bundleItem$bundle_se = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se !== void 0 ? _bundleItem$bundle_se : bundleItem.price) !== null && _ref7 !== void 0 ? _ref7 : bundleItem.custom_price) !== null && _ref6 !== void 0 ? _ref6 : bundleItem.product_price) !== null && _ref5 !== void 0 ? _ref5 : '0';
|
|
54
|
-
var unitStr = toPriceString(unitSelling, '0.00');
|
|
55
|
-
var num = toSafePositiveInt((_bundleItem$num = bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.num) !== null && _bundleItem$num !== void 0 ? _bundleItem$num : bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.quantity, 1);
|
|
56
|
-
var magnitudeSource = _objectSpread(_objectSpread({}, bundleItem), {}, {
|
|
57
|
-
option: normalizeOptionItems(bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.option),
|
|
58
|
-
bundle_selling_price: unitStr,
|
|
59
|
-
// 计算 markdown 净额时,只传真实毛价;仅有 bundle_selling_price 时按历史净额兜底。
|
|
60
|
-
price: (_bundleItem$price2 = bundleItem.price) !== null && _bundleItem$price2 !== void 0 ? _bundleItem$price2 : bundleItem.custom_price
|
|
61
|
-
});
|
|
62
|
-
var normalizedItem = _objectSpread(_objectSpread({}, bundleItem), {}, {
|
|
63
|
-
num: num,
|
|
64
|
-
quantity: (_bundleItem$quantity = bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.quantity) !== null && _bundleItem$quantity !== void 0 ? _bundleItem$quantity : num,
|
|
65
|
-
// price 保留毛价(markdown 仍为正),由 price_type 决定符号。
|
|
66
|
-
price: (_bundleItem$price3 = bundleItem.price) !== null && _bundleItem$price3 !== void 0 ? _bundleItem$price3 : unitStr,
|
|
67
|
-
bundle_selling_price: unitStr,
|
|
68
|
-
original_price: (_ref8 = (_ref9 = (_bundleItem$original_ = bundleItem.original_price) !== null && _bundleItem$original_ !== void 0 ? _bundleItem$original_ : bundleItem.product_price) !== null && _ref9 !== void 0 ? _ref9 : bundleItem.price) !== null && _ref8 !== void 0 ? _ref8 : unitStr,
|
|
48
|
+
return _objectSpread(_objectSpread({}, bundleItem), {}, {
|
|
69
49
|
option: normalizeOptionItems(bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.option)
|
|
70
50
|
});
|
|
71
|
-
// bundle_selling_price 落「正净额」:markdown = |price| − Σoptions;markup/原价维持原值。
|
|
72
|
-
normalizedItem.bundle_selling_price = getBundleSellingMagnitude(magnitudeSource).toFixed(2);
|
|
73
|
-
if (((_normalizedItem$price = normalizedItem.price_type) !== null && _normalizedItem$price !== void 0 ? _normalizedItem$price : normalizedItem.custom_price_type) === 'markdown' && (normalizedItem.price_type_ext === '' || normalizedItem.price_type_ext === undefined || normalizedItem.price_type_ext === null)) {
|
|
74
|
-
var _normalizedItem$custo;
|
|
75
|
-
normalizedItem.custom_price = (_normalizedItem$custo = normalizedItem.custom_price) !== null && _normalizedItem$custo !== void 0 ? _normalizedItem$custo : normalizedItem.price;
|
|
76
|
-
normalizedItem.price = normalizedItem.bundle_selling_price;
|
|
77
|
-
}
|
|
78
|
-
return normalizedItem;
|
|
79
51
|
});
|
|
80
52
|
}
|
|
81
53
|
function findVariantById(origin, variantId) {
|
|
@@ -92,65 +64,23 @@ function findVariantById(origin, variantId) {
|
|
|
92
64
|
* 注意:这里不生成 identity,缺省时由 OrderModule 自动补齐。
|
|
93
65
|
*/
|
|
94
66
|
export function transformBaseProductToOrderProduct(params) {
|
|
95
|
-
var
|
|
67
|
+
var _ref2, _ref3, _ref4, _payload$product_id, _ref5, _ref6, _payload$product_vari, _payload$_origin, _payload$_origin2, _ref7, _findVariantById, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13, _ref14, _payload$price, _ref15, _payload$option, _payload$bundle, _payload$unique_ident, _payload$quantity, _ref16, _ref17, _payload$tax_fee, _ref18, _ref19, _payload$is_charge_ta;
|
|
96
68
|
var payload = params.payload,
|
|
97
69
|
_params$fallbackProdu = params.fallbackProductId,
|
|
98
70
|
fallbackProductId = _params$fallbackProdu === void 0 ? null : _params$fallbackProdu;
|
|
99
71
|
if (!payload || _typeof(payload) !== 'object') return null;
|
|
100
72
|
var sourceProduct = params.sourceProduct || params.sourceItem || {};
|
|
101
|
-
var productId = toProductId((
|
|
73
|
+
var productId = toProductId((_ref2 = (_ref3 = (_ref4 = (_payload$product_id = payload.product_id) !== null && _payload$product_id !== void 0 ? _payload$product_id : payload.id) !== null && _ref4 !== void 0 ? _ref4 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.product_id) !== null && _ref3 !== void 0 ? _ref3 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id) !== null && _ref2 !== void 0 ? _ref2 : fallbackProductId);
|
|
102
74
|
if (productId === null) return null;
|
|
103
|
-
var productVariantId = toNumber((
|
|
75
|
+
var productVariantId = toNumber((_ref5 = (_ref6 = (_payload$product_vari = payload.product_variant_id) !== null && _payload$product_vari !== void 0 ? _payload$product_vari : payload.variant_id) !== null && _ref6 !== void 0 ? _ref6 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.product_variant_id) !== null && _ref5 !== void 0 ? _ref5 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.variant_id, 0);
|
|
104
76
|
var callbackOrigin = payload.origin || ((_payload$_origin = payload._origin) === null || _payload$_origin === void 0 ? void 0 : _payload$_origin.sourceProduct) || ((_payload$_origin2 = payload._origin) === null || _payload$_origin2 === void 0 ? void 0 : _payload$_origin2.sourceItem) || payload._origin || {};
|
|
105
77
|
var origin = _objectSpread(_objectSpread({}, sourceProduct || {}), callbackOrigin || {});
|
|
106
|
-
var matchedVariant = (
|
|
107
|
-
var sourceProductPrice = toPriceString((
|
|
108
|
-
var
|
|
109
|
-
var
|
|
110
|
-
var
|
|
111
|
-
var
|
|
112
|
-
// `payload.unique` 是业务侧商品/票务标识,可能在连续加同一商品时重复;
|
|
113
|
-
// 行级唯一值只接受显式协议字段,缺省交给 OrderModule 生成。
|
|
114
|
-
var uniqueIdentificationNumber = payload.unique_identification_number;
|
|
115
|
-
var resolvedQuantity = toSafePositiveInt((_payload$quantity = payload.quantity) !== null && _payload$quantity !== void 0 ? _payload$quantity : payload.num, 1);
|
|
116
|
-
var originTotal = resolveManualDiscountOriginTotal({
|
|
117
|
-
originTotal: payload.origin_total,
|
|
118
|
-
extendOriginTotal: (_payload$_extend2 = payload._extend) === null || _payload$_extend2 === void 0 ? void 0 : _payload$_extend2.origin_total,
|
|
119
|
-
originExtendOriginTotal: origin === null || origin === void 0 || (_extend = origin._extend) === null || _extend === void 0 ? void 0 : _extend.origin_total,
|
|
120
|
-
sourceExtendOriginTotal: sourceProduct === null || sourceProduct === void 0 || (_extend2 = sourceProduct._extend) === null || _extend2 === void 0 ? void 0 : _extend2.origin_total,
|
|
121
|
-
catalogUnitPrice: (_ref26 = (_ref27 = (_origin$base_price = origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _origin$base_price !== void 0 ? _origin$base_price : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref27 !== void 0 ? _ref27 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price) !== null && _ref26 !== void 0 ? _ref26 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price,
|
|
122
|
-
quantity: resolvedQuantity
|
|
123
|
-
});
|
|
124
|
-
var sellingTotal = Number((_ref28 = (_ref29 = (_payload$line_total2 = payload.line_total) !== null && _payload$line_total2 !== void 0 ? _payload$line_total2 : payload.total) !== null && _ref29 !== void 0 ? _ref29 : (_payload$_extend3 = payload._extend) === null || _payload$_extend3 === void 0 ? void 0 : _payload$_extend3.total) !== null && _ref28 !== void 0 ? _ref28 : lineCompositeTotal);
|
|
125
|
-
var discountReason = resolveManualDiscountReasonFromSources({
|
|
126
|
-
discountReason: payload.discount_reason,
|
|
127
|
-
extendDiscountReason: (_payload$_extend4 = payload._extend) === null || _payload$_extend4 === void 0 ? void 0 : _payload$_extend4.discount_reason,
|
|
128
|
-
originExtendDiscountReason: origin === null || origin === void 0 || (_extend3 = origin._extend) === null || _extend3 === void 0 ? void 0 : _extend3.discount_reason
|
|
129
|
-
});
|
|
130
|
-
var lineOriginalPrice = hasPriceOverride && Number.isFinite(originTotal) ? toPriceString(originTotal) : lineCompositeTotal;
|
|
131
|
-
var manualDiscountList = shouldBuildManualProductDiscount({
|
|
132
|
-
hasPriceOverride: hasPriceOverride,
|
|
133
|
-
originTotal: originTotal,
|
|
134
|
-
sellingTotal: sellingTotal
|
|
135
|
-
}) ? mergeManualProductDiscountIntoList(payload.discount_list, buildManualProductDiscountItem({
|
|
136
|
-
originTotal: Number.isFinite(originTotal) ? originTotal : Number(lineOriginalPrice),
|
|
137
|
-
sellingTotal: Number.isFinite(sellingTotal) ? sellingTotal : Number(lineCompositeTotal),
|
|
138
|
-
quantity: resolvedQuantity,
|
|
139
|
-
message: discountReason,
|
|
140
|
-
discountway: (_payload$_extend5 = payload._extend) === null || _payload$_extend5 === void 0 ? void 0 : _payload$_extend5.discountway,
|
|
141
|
-
discount_per: (_payload$_extend6 = payload._extend) === null || _payload$_extend6 === void 0 ? void 0 : _payload$_extend6.discount_per
|
|
142
|
-
})) : payload.discount_list || [];
|
|
143
|
-
|
|
144
|
-
// v2:source 不含 option;main_product_* 含 option(与 normalizeOrderProduct 一致)
|
|
145
|
-
var optionSum = sumOptionUnitPrice(productOptionItem).toNumber();
|
|
146
|
-
var mainProductOriginalPrice = toPriceString(Number(sourceProductPrice) + optionSum);
|
|
147
|
-
var bundleOnlyComposite = composeLinePrice({
|
|
148
|
-
mainPrice: 0,
|
|
149
|
-
bundle: productBundle
|
|
150
|
-
});
|
|
151
|
-
var derivedMainSelling = Number(lineCompositeTotal) - Number(bundleOnlyComposite);
|
|
152
|
-
var mainProductSellingPrice = toPriceString(Number.isFinite(derivedMainSelling) && derivedMainSelling >= 0 ? derivedMainSelling : Number(mainProductOriginalPrice));
|
|
153
|
-
var metadata = _objectSpread(_objectSpread({
|
|
78
|
+
var matchedVariant = (_ref7 = (_findVariantById = findVariantById(callbackOrigin, productVariantId)) !== null && _findVariantById !== void 0 ? _findVariantById : findVariantById(sourceProduct, productVariantId)) !== null && _ref7 !== void 0 ? _ref7 : findVariantById(origin, productVariantId);
|
|
79
|
+
var sourceProductPrice = toPriceString((_ref8 = (_ref9 = (_ref10 = (_ref11 = (_ref12 = (_ref13 = (_ref14 = (_payload$price = payload.price) !== null && _payload$price !== void 0 ? _payload$price : payload.selling_price) !== null && _ref14 !== void 0 ? _ref14 : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.price) !== null && _ref13 !== void 0 ? _ref13 : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.base_price) !== null && _ref12 !== void 0 ? _ref12 : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref11 !== void 0 ? _ref11 : origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _ref10 !== void 0 ? _ref10 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _ref9 !== void 0 ? _ref9 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.selling_price) !== null && _ref8 !== void 0 ? _ref8 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price, '0.00');
|
|
80
|
+
var productOptionItem = normalizeOptionItems((_ref15 = (_payload$option = payload.option) !== null && _payload$option !== void 0 ? _payload$option : payload.options) !== null && _ref15 !== void 0 ? _ref15 : payload.product_option_item);
|
|
81
|
+
var productBundle = normalizeBundleItems((_payload$bundle = payload.bundle) !== null && _payload$bundle !== void 0 ? _payload$bundle : payload.product_bundle);
|
|
82
|
+
var uniqueIdentificationNumber = (_payload$unique_ident = payload.unique_identification_number) !== null && _payload$unique_ident !== void 0 ? _payload$unique_ident : payload.unique;
|
|
83
|
+
var metadata = {
|
|
154
84
|
unique: payload.unique,
|
|
155
85
|
session: payload.session,
|
|
156
86
|
form: payload.form,
|
|
@@ -160,16 +90,9 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
160
90
|
duration: payload.duration,
|
|
161
91
|
policy_id: payload.policy_id,
|
|
162
92
|
source_shop_id: payload.source_shop_id,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
price_schema_version: 2
|
|
167
|
-
}, hasPriceOverride ? {
|
|
168
|
-
price_override: String(payload.price_override),
|
|
169
|
-
is_manual_discount: 1
|
|
170
|
-
} : {}), payload.bundle_edit !== undefined ? {
|
|
171
|
-
bundle_edit: payload.bundle_edit
|
|
172
|
-
} : {});
|
|
93
|
+
origin: origin,
|
|
94
|
+
source_product_price: sourceProductPrice
|
|
95
|
+
};
|
|
173
96
|
if (uniqueIdentificationNumber) {
|
|
174
97
|
metadata.unique_identification_number = String(uniqueIdentificationNumber);
|
|
175
98
|
}
|
|
@@ -177,17 +100,13 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
177
100
|
product_id: productId,
|
|
178
101
|
product_variant_id: productVariantId,
|
|
179
102
|
unique_identification_number: uniqueIdentificationNumber ? String(uniqueIdentificationNumber) : undefined,
|
|
180
|
-
num:
|
|
181
|
-
|
|
182
|
-
option: productOptionItem
|
|
183
|
-
}),
|
|
103
|
+
num: toSafePositiveInt((_payload$quantity = payload.quantity) !== null && _payload$quantity !== void 0 ? _payload$quantity : payload.num, 1),
|
|
104
|
+
product_option_item: productOptionItem,
|
|
184
105
|
product_bundle: productBundle,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
tax_fee: toPriceString((_ref30 = (_ref31 = (_payload$tax_fee = payload.tax_fee) !== null && _payload$tax_fee !== void 0 ? _payload$tax_fee : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.tax_fee) !== null && _ref31 !== void 0 ? _ref31 : origin === null || origin === void 0 ? void 0 : origin.tax_fee) !== null && _ref30 !== void 0 ? _ref30 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.tax_fee, '0.00'),
|
|
190
|
-
is_charge_tax: toNumber((_ref32 = (_ref33 = (_payload$is_charge_ta = payload.is_charge_tax) !== null && _payload$is_charge_ta !== void 0 ? _payload$is_charge_ta : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.is_charge_tax) !== null && _ref33 !== void 0 ? _ref33 : origin === null || origin === void 0 ? void 0 : origin.is_charge_tax) !== null && _ref32 !== void 0 ? _ref32 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.is_charge_tax, 0),
|
|
106
|
+
selling_price: sourceProductPrice,
|
|
107
|
+
original_price: sourceProductPrice,
|
|
108
|
+
tax_fee: toPriceString((_ref16 = (_ref17 = (_payload$tax_fee = payload.tax_fee) !== null && _payload$tax_fee !== void 0 ? _payload$tax_fee : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.tax_fee) !== null && _ref17 !== void 0 ? _ref17 : origin === null || origin === void 0 ? void 0 : origin.tax_fee) !== null && _ref16 !== void 0 ? _ref16 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.tax_fee, '0.00'),
|
|
109
|
+
is_charge_tax: toNumber((_ref18 = (_ref19 = (_payload$is_charge_ta = payload.is_charge_tax) !== null && _payload$is_charge_ta !== void 0 ? _payload$is_charge_ta : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.is_charge_tax) !== null && _ref19 !== void 0 ? _ref19 : origin === null || origin === void 0 ? void 0 : origin.is_charge_tax) !== null && _ref18 !== void 0 ? _ref18 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.is_charge_tax, 0),
|
|
191
110
|
metadata: metadata,
|
|
192
111
|
note: payload.note != null ? String(payload.note) : '',
|
|
193
112
|
_origin: _objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
|
|
@@ -12,7 +12,7 @@ export declare function buildProductLineFingerprint(productOptionItem?: unknown,
|
|
|
12
12
|
export declare function getSafeProductNum(num?: number): number;
|
|
13
13
|
/**
|
|
14
14
|
* removeProductFromOrder 仅传 SKU 时的通配 identity(对象上未声明选项键)。
|
|
15
|
-
* 与显式 `
|
|
15
|
+
* 与显式 `product_option_item: []` 区分:后者只匹配「无选项」行。
|
|
16
16
|
*/
|
|
17
17
|
export declare function isSkuOnlyDeleteIdentity(x: BaseSalesOrderProductIdentity): boolean;
|
|
18
18
|
/**
|
|
@@ -5,8 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import Decimal from 'decimal.js';
|
|
8
|
-
import { composeLinePrice, createUuidV4,
|
|
9
|
-
import { ensureManualProductDiscountList } from "../../modules/Order/utils/manualProductDiscount";
|
|
8
|
+
import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* 构建金额全为 0 的空 summary。
|
|
@@ -39,12 +38,12 @@ export function createEmptySummary() {
|
|
|
39
38
|
export function buildProductLineFingerprint(productOptionItem, productBundle) {
|
|
40
39
|
var optArr = Array.isArray(productOptionItem) ? productOptionItem : [];
|
|
41
40
|
var normalizedOpts = optArr.map(function (item) {
|
|
42
|
-
var
|
|
41
|
+
var _item$price;
|
|
43
42
|
return {
|
|
44
43
|
option_group_item_id: Number(item === null || item === void 0 ? void 0 : item.option_group_item_id) || 0,
|
|
45
44
|
option_group_id: Number(item === null || item === void 0 ? void 0 : item.option_group_id) || 0,
|
|
46
45
|
num: typeof (item === null || item === void 0 ? void 0 : item.num) === 'number' && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
|
|
47
|
-
price: String((
|
|
46
|
+
price: String((_item$price = item === null || item === void 0 ? void 0 : item.price) !== null && _item$price !== void 0 ? _item$price : '')
|
|
48
47
|
};
|
|
49
48
|
}).sort(function (p, q) {
|
|
50
49
|
if (p.option_group_item_id !== q.option_group_item_id) {
|
|
@@ -56,9 +55,9 @@ export function buildProductLineFingerprint(productOptionItem, productBundle) {
|
|
|
56
55
|
});
|
|
57
56
|
var bundleArr = Array.isArray(productBundle) ? productBundle : [];
|
|
58
57
|
var normalizedBundles = bundleArr.map(function (item) {
|
|
59
|
-
var
|
|
58
|
+
var _ref, _item$bundle_id;
|
|
60
59
|
return {
|
|
61
|
-
bundle_id: Number((
|
|
60
|
+
bundle_id: Number((_ref = (_item$bundle_id = item === null || item === void 0 ? void 0 : item.bundle_id) !== null && _item$bundle_id !== void 0 ? _item$bundle_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref !== void 0 ? _ref : 0) || 0,
|
|
62
61
|
product_id: Number(item === null || item === void 0 ? void 0 : item.product_id) || 0,
|
|
63
62
|
num: typeof (item === null || item === void 0 ? void 0 : item.num) === 'number' && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1
|
|
64
63
|
};
|
|
@@ -77,11 +76,11 @@ export function getSafeProductNum(num) {
|
|
|
77
76
|
|
|
78
77
|
/**
|
|
79
78
|
* removeProductFromOrder 仅传 SKU 时的通配 identity(对象上未声明选项键)。
|
|
80
|
-
* 与显式 `
|
|
79
|
+
* 与显式 `product_option_item: []` 区分:后者只匹配「无选项」行。
|
|
81
80
|
*/
|
|
82
81
|
export function isSkuOnlyDeleteIdentity(x) {
|
|
83
82
|
if (x.identity_key) return false;
|
|
84
|
-
return !('
|
|
83
|
+
return !('product_option_item' in x) && !('product_bundle' in x);
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
/**
|
|
@@ -107,51 +106,23 @@ export function isSkuOnlyDeleteIdentity(x) {
|
|
|
107
106
|
* - 因此多次 normalize 不会重复叠加 option/bundle。
|
|
108
107
|
*/
|
|
109
108
|
export function normalizeOrderProduct(product) {
|
|
110
|
-
var _product$metadata, _metadata$origin,
|
|
109
|
+
var _product$metadata, _metadata$origin, _variantList$find, _product$is_charge_ta;
|
|
111
110
|
var metadata = _objectSpread({}, product.metadata || {});
|
|
112
111
|
// 不透明 identity 契约:每条订单行必须带 identity_key。
|
|
113
112
|
// 调用方未传时由 SDK 自动生成 UUID,后续 update/remove 只做严格比对,避免猜测合成 key。
|
|
114
113
|
var resolvedIdentityKey = (_product$metadata = product.metadata) !== null && _product$metadata !== void 0 && _product$metadata.unique_identification_number ? String(product.metadata.unique_identification_number) : product.unique_identification_number && String(product.unique_identification_number).length > 0 ? String(product.unique_identification_number) : product.identity_key && String(product.identity_key).length > 0 ? String(product.identity_key) : createUuidV4();
|
|
115
114
|
metadata.unique_identification_number = resolvedIdentityKey;
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
var bundleInput = product.product_bundle || [];
|
|
119
|
-
if (priceOverride !== undefined && priceOverride !== null && priceOverride !== '' && Array.isArray(originOtherBundle) && originOtherBundle.length > 0) {
|
|
120
|
-
var priceById = new Map();
|
|
121
|
-
originOtherBundle.forEach(function (item) {
|
|
122
|
-
var _item$price;
|
|
123
|
-
if ((item === null || item === void 0 ? void 0 : item.id) == null) return;
|
|
124
|
-
var unit = (_item$price = item.price) !== null && _item$price !== void 0 ? _item$price : item.bundle_selling_price;
|
|
125
|
-
if (unit === undefined || unit === null) return;
|
|
126
|
-
priceById.set(String(item.id), String(unit));
|
|
127
|
-
});
|
|
128
|
-
var base = Array.isArray(bundleInput) && bundleInput.length > 0 ? bundleInput : originOtherBundle;
|
|
129
|
-
bundleInput = base.map(function (item) {
|
|
130
|
-
var unit = priceById.get(String(item === null || item === void 0 ? void 0 : item.id));
|
|
131
|
-
if (unit === undefined) return item;
|
|
132
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
133
|
-
price: unit,
|
|
134
|
-
bundle_selling_price: unit
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
var normalizedBundle = bundleInput.map(function (item) {
|
|
139
|
-
var _item$bundle_id2, _item$bundle_product_, _item$bundle_group_id, _ref3, _item$bundle_selling_, _ref4, _ref5, _item$price2, _ref6, _item$price_type, _ref7, _item$price_type_ext;
|
|
115
|
+
var normalizedBundle = (product.product_bundle || []).map(function (item) {
|
|
116
|
+
var _ref2, _item$bundle_selling_, _ref3, _ref4, _item$price2, _ref5, _item$price_type, _ref6, _item$price_type_ext;
|
|
140
117
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
price: (_ref4 = (_ref5 = (_item$price2 = item.price) !== null && _item$price2 !== void 0 ? _item$price2 : item.custom_price) !== null && _ref5 !== void 0 ? _ref5 : item.bundle_selling_price) !== null && _ref4 !== void 0 ? _ref4 : '0.00',
|
|
146
|
-
price_type: (_ref6 = (_item$price_type = item.price_type) !== null && _item$price_type !== void 0 ? _item$price_type : item.custom_price_type) !== null && _ref6 !== void 0 ? _ref6 : '',
|
|
147
|
-
price_type_ext: (_ref7 = (_item$price_type_ext = item.price_type_ext) !== null && _item$price_type_ext !== void 0 ? _item$price_type_ext : item.custom_price_type_ext) !== null && _ref7 !== void 0 ? _ref7 : ''
|
|
118
|
+
bundle_selling_price: (_ref2 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref2 !== void 0 ? _ref2 : '0.00',
|
|
119
|
+
price: (_ref3 = (_ref4 = (_item$price2 = item.price) !== null && _item$price2 !== void 0 ? _item$price2 : item.custom_price) !== null && _ref4 !== void 0 ? _ref4 : item.bundle_selling_price) !== null && _ref3 !== void 0 ? _ref3 : '0.00',
|
|
120
|
+
price_type: (_ref5 = (_item$price_type = item.price_type) !== null && _item$price_type !== void 0 ? _item$price_type : item.custom_price_type) !== null && _ref5 !== void 0 ? _ref5 : '',
|
|
121
|
+
price_type_ext: (_ref6 = (_item$price_type_ext = item.price_type_ext) !== null && _item$price_type_ext !== void 0 ? _item$price_type_ext : item.custom_price_type_ext) !== null && _ref6 !== void 0 ? _ref6 : ''
|
|
148
122
|
});
|
|
149
123
|
});
|
|
150
|
-
var normalizedOptions =
|
|
124
|
+
var normalizedOptions = product.product_option_item || [];
|
|
151
125
|
var optionSum = sumOptionUnitPrice(normalizedOptions);
|
|
152
|
-
var productSku = _objectSpread(_objectSpread({}, ensureProductSku(product)), {}, {
|
|
153
|
-
option: normalizedOptions
|
|
154
|
-
});
|
|
155
126
|
|
|
156
127
|
// 1) 解析 source_product_price。
|
|
157
128
|
// 优先级:
|
|
@@ -163,11 +134,11 @@ export function normalizeOrderProduct(product) {
|
|
|
163
134
|
// 6) 入参 selling_price(最末兜底,新添加路径 caller 只给 selling_price)
|
|
164
135
|
var isV2 = metadata.price_schema_version === 2 || metadata.price_schema_version === '2';
|
|
165
136
|
var variantId = Number(product.product_variant_id || 0);
|
|
166
|
-
var variantList = variantId ? metadata === null || metadata === void 0 || (_metadata$
|
|
137
|
+
var variantList = variantId ? metadata === null || metadata === void 0 || (_metadata$origin = metadata.origin) === null || _metadata$origin === void 0 ? void 0 : _metadata$origin.variant : null;
|
|
167
138
|
var variantPrice = Array.isArray(variantList) ? (_variantList$find = variantList.find(function (v) {
|
|
168
139
|
return Number(v === null || v === void 0 ? void 0 : v.id) === variantId;
|
|
169
140
|
})) === null || _variantList$find === void 0 ? void 0 : _variantList$find.price : undefined;
|
|
170
|
-
var resolvedSource = function (_product$_origin, _product$_origin2,
|
|
141
|
+
var resolvedSource = function (_product$_origin, _product$_origin2, _ref7, _product$original_pri) {
|
|
171
142
|
if (metadata.source_product_price !== undefined) {
|
|
172
143
|
return String(metadata.source_product_price);
|
|
173
144
|
}
|
|
@@ -185,7 +156,7 @@ export function normalizeOrderProduct(product) {
|
|
|
185
156
|
if (!isV2 && metadata.main_product_original_price !== undefined) {
|
|
186
157
|
return String(metadata.main_product_original_price);
|
|
187
158
|
}
|
|
188
|
-
return (
|
|
159
|
+
return (_ref7 = (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : product.selling_price) !== null && _ref7 !== void 0 ? _ref7 : '0.00';
|
|
189
160
|
}();
|
|
190
161
|
|
|
191
162
|
// 2) 派生 main_product_original_price(含 option、不含折扣)
|
|
@@ -233,29 +204,17 @@ export function normalizeOrderProduct(product) {
|
|
|
233
204
|
bundle: normalizedBundle,
|
|
234
205
|
useOriginalBundle: true
|
|
235
206
|
});
|
|
236
|
-
var finalOriginalPrice = resolveManualOverrideLineOriginalPrice({
|
|
237
|
-
num: product.num,
|
|
238
|
-
metadata: metadata,
|
|
239
|
-
lineOriginalPrice: product.original_price
|
|
240
|
-
}, composedOriginalPrice);
|
|
241
|
-
var discountList = ensureManualProductDiscountList({
|
|
242
|
-
discountList: product.discount_list,
|
|
243
|
-
metadata: metadata,
|
|
244
|
-
originalPrice: finalOriginalPrice,
|
|
245
|
-
sellingPrice: composedSellingPrice,
|
|
246
|
-
quantity: getSafeProductNum(product.num)
|
|
247
|
-
});
|
|
248
207
|
return {
|
|
249
208
|
order_detail_id: product.order_detail_id || null,
|
|
250
209
|
product_id: product.product_id,
|
|
251
210
|
num: getSafeProductNum(product.num),
|
|
252
211
|
product_variant_id: product.product_variant_id,
|
|
253
|
-
|
|
212
|
+
product_option_item: normalizedOptions,
|
|
254
213
|
selling_price: composedSellingPrice,
|
|
255
|
-
original_price:
|
|
214
|
+
original_price: composedOriginalPrice,
|
|
256
215
|
tax_fee: product.tax_fee || '0.00',
|
|
257
216
|
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
258
|
-
discount_list:
|
|
217
|
+
discount_list: product.discount_list || [],
|
|
259
218
|
product_bundle: normalizedBundle,
|
|
260
219
|
metadata: metadata,
|
|
261
220
|
note: product.note != null ? String(product.note) : ''
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 2 | 1 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|