@pisell/pisellos 2.2.244 → 2.2.246
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
- package/dist/modules/BookingContext/index.d.ts +48 -0
- package/dist/modules/BookingContext/index.js +566 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +284 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +218 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Cart/utils/cartProduct.js +24 -3
- package/dist/modules/Cart/utils/changePrice.js +11 -11
- package/dist/modules/Customer/index.d.ts +20 -0
- package/dist/modules/Customer/index.js +172 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +1 -1
- package/dist/modules/Discount/index.js +13 -6
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +37 -17
- package/dist/modules/Order/index.d.ts +277 -18
- package/dist/modules/Order/index.js +3581 -779
- package/dist/modules/Order/types.d.ts +286 -31
- package/dist/modules/Order/types.js +38 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils.d.ts +147 -5
- package/dist/modules/Order/utils.js +750 -104
- package/dist/modules/Payment/index.d.ts +10 -13
- package/dist/modules/Payment/index.js +467 -837
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +2 -1
- package/dist/modules/Payment/walletpass.js +41 -25
- package/dist/modules/ProductList/index.d.ts +16 -12
- package/dist/modules/ProductList/index.js +133 -59
- package/dist/modules/ProductList/types.d.ts +14 -0
- package/dist/modules/Quotation/index.d.ts +0 -1
- package/dist/modules/Quotation/index.js +25 -22
- package/dist/modules/Rules/index.d.ts +4 -0
- package/dist/modules/Rules/index.js +97 -70
- package/dist/modules/Rules/types.d.ts +1 -0
- package/dist/modules/SalesSummary/index.d.ts +8 -25
- package/dist/modules/SalesSummary/index.js +86 -35
- package/dist/modules/SalesSummary/types.d.ts +4 -1
- package/dist/modules/SalesSummary/utils.d.ts +2 -25
- package/dist/modules/SalesSummary/utils.js +794 -162
- package/dist/modules/Schedule/index.d.ts +7 -0
- package/dist/modules/Schedule/index.js +24 -2
- package/dist/modules/Summary/index.js +4 -3
- package/dist/modules/SurchargeList/index.d.ts +16 -0
- package/dist/modules/SurchargeList/index.js +162 -0
- package/dist/modules/SurchargeList/types.d.ts +11 -0
- package/dist/modules/SurchargeList/types.js +1 -0
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +204 -1
- package/dist/server/index.js +3654 -922
- package/dist/server/modules/index.d.ts +2 -0
- package/dist/server/modules/index.js +2 -0
- package/dist/server/modules/order/index.d.ts +120 -3
- package/dist/server/modules/order/index.js +1762 -448
- package/dist/server/modules/order/types.d.ts +32 -3
- package/dist/server/modules/order/types.js +8 -0
- package/dist/server/modules/order/utils/filterBookings.js +26 -3
- package/dist/server/modules/order/utils/filterOrders.js +23 -8
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/modules/products/index.d.ts +34 -7
- package/dist/server/modules/products/index.js +631 -317
- package/dist/server/modules/resource/index.d.ts +2 -0
- package/dist/server/modules/resource/index.js +29 -3
- package/dist/server/modules/schedule/index.d.ts +4 -4
- package/dist/server/modules/schedule/index.js +111 -88
- package/dist/server/test.json +713 -0
- package/dist/server/utils/small-ticket.d.ts +71 -0
- package/dist/server/utils/small-ticket.js +840 -0
- package/dist/solution/BaseSales/index.d.ts +133 -10
- package/dist/solution/BaseSales/index.js +1950 -447
- package/dist/solution/BaseSales/types.d.ts +82 -6
- package/dist/solution/BaseSales/types.js +5 -4
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1438 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +105 -24
- package/dist/solution/BaseSales/utils.d.ts +1 -1
- package/dist/solution/BaseSales/utils.js +62 -21
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +271 -11
- package/dist/solution/BookingTicket/index.js +1777 -242
- package/dist/solution/BookingTicket/types.d.ts +118 -1
- package/dist/solution/BookingTicket/types.js +41 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +70 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +9 -1
- package/dist/solution/BookingTicket/utils/cartView.js +94 -7
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +10 -9
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +9 -3
- package/dist/solution/ScanOrder/index.js +241 -134
- package/dist/solution/ScanOrder/types.d.ts +9 -5
- package/dist/solution/ScanOrder/types.js +2 -3
- package/dist/solution/ScanOrder/utils.d.ts +1 -1
- package/dist/solution/ScanOrder/utils.js +84 -22
- package/dist/solution/VenueBooking/index.d.ts +5 -2
- package/dist/solution/VenueBooking/index.js +110 -59
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/dist/types/index.d.ts +10 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +2 -1
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +368 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +154 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +201 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Cart/utils/cartProduct.js +20 -3
- package/lib/modules/Cart/utils/changePrice.js +12 -20
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +64 -11
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +1 -1
- package/lib/modules/Discount/index.js +9 -1
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +19 -5
- package/lib/modules/Order/index.d.ts +277 -18
- package/lib/modules/Order/index.js +2317 -337
- package/lib/modules/Order/types.d.ts +286 -31
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
- package/lib/modules/Order/utils.d.ts +147 -5
- package/lib/modules/Order/utils.js +615 -46
- package/lib/modules/Payment/index.d.ts +10 -13
- package/lib/modules/Payment/index.js +18 -150
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +2 -1
- package/lib/modules/Payment/walletpass.js +16 -3
- package/lib/modules/ProductList/index.d.ts +16 -12
- package/lib/modules/ProductList/index.js +41 -4
- package/lib/modules/ProductList/types.d.ts +14 -0
- package/lib/modules/Quotation/index.d.ts +0 -1
- package/lib/modules/Quotation/index.js +19 -16
- package/lib/modules/Rules/index.d.ts +4 -0
- package/lib/modules/Rules/index.js +137 -120
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/modules/SalesSummary/index.d.ts +8 -25
- package/lib/modules/SalesSummary/index.js +30 -4
- package/lib/modules/SalesSummary/types.d.ts +4 -1
- package/lib/modules/SalesSummary/utils.d.ts +2 -25
- package/lib/modules/SalesSummary/utils.js +645 -91
- package/lib/modules/Schedule/index.d.ts +7 -0
- package/lib/modules/Schedule/index.js +17 -1
- package/lib/modules/Summary/index.js +5 -4
- package/lib/modules/SurchargeList/index.d.ts +16 -0
- package/lib/modules/SurchargeList/index.js +89 -0
- package/lib/modules/SurchargeList/types.d.ts +11 -0
- package/lib/modules/SurchargeList/types.js +17 -0
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +204 -1
- package/lib/server/index.js +1891 -59
- package/lib/server/modules/index.d.ts +2 -0
- package/lib/server/modules/index.js +3 -0
- package/lib/server/modules/order/index.d.ts +120 -3
- package/lib/server/modules/order/index.js +887 -94
- package/lib/server/modules/order/types.d.ts +32 -3
- package/lib/server/modules/order/utils/filterBookings.js +24 -5
- package/lib/server/modules/order/utils/filterOrders.js +15 -6
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +192 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +17 -0
- package/lib/server/modules/products/index.d.ts +34 -7
- package/lib/server/modules/products/index.js +189 -54
- package/lib/server/modules/resource/index.d.ts +2 -0
- package/lib/server/modules/resource/index.js +27 -3
- package/lib/server/modules/schedule/index.d.ts +4 -4
- package/lib/server/modules/schedule/index.js +47 -40
- package/lib/server/test.json +713 -0
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +800 -0
- package/lib/solution/BaseSales/index.d.ts +133 -10
- package/lib/solution/BaseSales/index.js +1111 -63
- package/lib/solution/BaseSales/types.d.ts +82 -6
- package/lib/solution/BaseSales/types.js +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +992 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +106 -18
- package/lib/solution/BaseSales/utils.d.ts +1 -1
- package/lib/solution/BaseSales/utils.js +54 -10
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +271 -11
- package/lib/solution/BookingTicket/index.js +922 -29
- package/lib/solution/BookingTicket/types.d.ts +118 -1
- package/lib/solution/BookingTicket/types.js +11 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +44 -2
- package/lib/solution/BookingTicket/utils/cartView.d.ts +9 -1
- package/lib/solution/BookingTicket/utils/cartView.js +61 -6
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +1 -2
- package/lib/solution/RegisterAndLogin/config.js +2 -10
- package/lib/solution/ScanOrder/index.d.ts +9 -3
- package/lib/solution/ScanOrder/index.js +153 -70
- package/lib/solution/ScanOrder/types.d.ts +9 -5
- package/lib/solution/ScanOrder/utils.d.ts +1 -1
- package/lib/solution/ScanOrder/utils.js +83 -17
- package/lib/solution/VenueBooking/index.d.ts +5 -2
- package/lib/solution/VenueBooking/index.js +54 -17
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/lib/types/index.d.ts +10 -0
- package/package.json +1 -1
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BookingContext 子模块:承载「预约 UI 上下文」三件套。
|
|
3
|
+
*
|
|
4
|
+
* - bookingConfig:来自 `/core/board/management/config` 的整套预约配置(service_time / resource_tab /
|
|
5
|
+
* appointment_subject / subject_require / stock_setting / basic / capacity 等)。
|
|
6
|
+
* - resourcesOrigin / resourcesOriginMap:来自 `/schedule/resource/list` 的资源全集,含 times / event_list /
|
|
7
|
+
* combined_resource 等运行态信息,是 getResourceByIds / getResourceTimeIsUsable 的输入。
|
|
8
|
+
* - date:当前选择的日期(dayjs 或 ISO 字符串,迁移后内部统一存原始 ISO 字符串,UI 可自行解析)。
|
|
9
|
+
*
|
|
10
|
+
* 设计原则(与 BookingTicket 现状对齐):
|
|
11
|
+
* - 默认由 `loadBookingConfig` / `loadResources` 拉取并写入 store;也支持消费方 `set*` 直接灌入(复用 ticketBooking 已拉到的数据)。
|
|
12
|
+
* - 所有读 API 返回浅克隆(数组)或原引用(map / config),避免 UI 写穿。
|
|
13
|
+
*/
|
|
14
|
+
/** `loadBookingConfig` 入参,与 ticketBooking `getBookingConfig` 一致。 */
|
|
15
|
+
export interface LoadBookingConfigParams {
|
|
16
|
+
item_type?: string;
|
|
17
|
+
sub_type?: string;
|
|
18
|
+
source_type?: string;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
/** `loadResources` 入参,与 info2 `getResourceList` 一致。 */
|
|
22
|
+
export interface LoadBookingResourcesParams {
|
|
23
|
+
/** 查询日期,`YYYY-MM-DD`;缺省用 store 内已 set 的 date,再缺省为当天。 */
|
|
24
|
+
date?: string;
|
|
25
|
+
/** 编辑态排除容量占用用的 booking id 列表。 */
|
|
26
|
+
bookingIds?: number[];
|
|
27
|
+
}
|
|
28
|
+
/** `initBookingContext` 入参(BookingTicket 聚合入口)。 */
|
|
29
|
+
export interface InitBookingContextParams {
|
|
30
|
+
bookingConfigParams?: LoadBookingConfigParams;
|
|
31
|
+
date?: BookingContextDateInput;
|
|
32
|
+
/** 是否拉资源列表,默认 true。 */
|
|
33
|
+
loadResources?: boolean;
|
|
34
|
+
bookingIds?: number[];
|
|
35
|
+
/** 为 true 时忽略内存命中,强制重新请求(默认 false)。 */
|
|
36
|
+
forceRefresh?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 资源全集 map:key 为资源 id(数字),value 为资源原始对象,含 times / event_list 等运行态。
|
|
40
|
+
* 这里只声明 Record 形态;具体字段保留 `any`,与 ticketBooking 现网传入的数据形状兼容。
|
|
41
|
+
*/
|
|
42
|
+
export type BookingContextResource = Record<string, any>;
|
|
43
|
+
export type BookingContextResourceMap = Record<string, BookingContextResource>;
|
|
44
|
+
/**
|
|
45
|
+
* 形参 booking_config(结构来自 `/core/board/management/config` 接口)。
|
|
46
|
+
* OS 不强制 schema,保留 `Record<string, any>` 兼容现网;常用路径文档化在 SDK docs。
|
|
47
|
+
*/
|
|
48
|
+
export type BookingContextConfig = Record<string, any>;
|
|
49
|
+
/**
|
|
50
|
+
* 日期入参:接受 dayjs 实例、ISO 字符串、Date 实例;内部统一 normalize 为 ISO 字符串保存。
|
|
51
|
+
*/
|
|
52
|
+
export type BookingContextDateInput = string | Date | {
|
|
53
|
+
format?: (fmt?: string) => string;
|
|
54
|
+
} | null | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* 内部 store 形态。`resourcesOriginMap` 由 `setResources` 派生,不允许外部直接 set。
|
|
57
|
+
*/
|
|
58
|
+
export interface BookingContextState {
|
|
59
|
+
bookingConfig: BookingContextConfig | null;
|
|
60
|
+
resourcesOrigin: BookingContextResource[];
|
|
61
|
+
resourcesOriginMap: BookingContextResourceMap;
|
|
62
|
+
/**
|
|
63
|
+
* 当前选择的日期,统一 ISO 字符串('YYYY-MM-DD HH:mm:ss' 或 'YYYY-MM-DD')。
|
|
64
|
+
* UI 取出后可自行 dayjs 解析;OS 内的计算 helper 都接受 string,不做 dayjs 依赖。
|
|
65
|
+
*/
|
|
66
|
+
date: string | null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* BookingContextModule 对外 API(给 BookingTicket / SDK Provider 透传消费)。
|
|
70
|
+
*/
|
|
71
|
+
export interface BookingContextModuleAPI {
|
|
72
|
+
setBookingConfig(config: BookingContextConfig | null): void;
|
|
73
|
+
getBookingConfig(): BookingContextConfig | null;
|
|
74
|
+
setResources(resources: BookingContextResource[] | null | undefined): void;
|
|
75
|
+
getResourcesOrigin(): BookingContextResource[];
|
|
76
|
+
getResourcesOriginMap(): BookingContextResourceMap;
|
|
77
|
+
setDate(date: BookingContextDateInput): void;
|
|
78
|
+
getDate(): string | null;
|
|
79
|
+
/** 当前 store 的浅克隆,调试 / 测试用。 */
|
|
80
|
+
getState(): BookingContextState;
|
|
81
|
+
/** 一键清空,destroy / 切租户场景用。 */
|
|
82
|
+
clear(): void;
|
|
83
|
+
/** 拉取 board config 并写入 store(`/core/board/management/config`)。 */
|
|
84
|
+
loadBookingConfig(params?: LoadBookingConfigParams): Promise<BookingContextConfig | null>;
|
|
85
|
+
/** 拉取资源全集并写入 store(`/schedule/resource/list`)。 */
|
|
86
|
+
loadResources(params?: LoadBookingResourcesParams): Promise<BookingContextResource[]>;
|
|
87
|
+
/**
|
|
88
|
+
* 依次 setDate → loadBookingConfig → loadResources。
|
|
89
|
+
* SalesSdkProvider 挂载时默认调用 BookingTicket.initBookingContext。
|
|
90
|
+
*/
|
|
91
|
+
initBookingContext(params?: InitBookingContextParams): Promise<BookingContextState>;
|
|
92
|
+
/** store 是否已具备与入参等价的 config / resources(无需再请求)。 */
|
|
93
|
+
isBookingContextReady(params?: InitBookingContextParams): boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* BookingContextModule 事件名常量(采用 `${this.name}:` 前缀,与现有模块一致)。
|
|
97
|
+
*/
|
|
98
|
+
export declare enum BookingContextEvent {
|
|
99
|
+
OnBookingConfigChange = "onBookingConfigChange",
|
|
100
|
+
OnResourcesChange = "onResourcesChange",
|
|
101
|
+
OnDateChange = "onDateChange"
|
|
102
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BookingContext 子模块:承载「预约 UI 上下文」三件套。
|
|
3
|
+
*
|
|
4
|
+
* - bookingConfig:来自 `/core/board/management/config` 的整套预约配置(service_time / resource_tab /
|
|
5
|
+
* appointment_subject / subject_require / stock_setting / basic / capacity 等)。
|
|
6
|
+
* - resourcesOrigin / resourcesOriginMap:来自 `/schedule/resource/list` 的资源全集,含 times / event_list /
|
|
7
|
+
* combined_resource 等运行态信息,是 getResourceByIds / getResourceTimeIsUsable 的输入。
|
|
8
|
+
* - date:当前选择的日期(dayjs 或 ISO 字符串,迁移后内部统一存原始 ISO 字符串,UI 可自行解析)。
|
|
9
|
+
*
|
|
10
|
+
* 设计原则(与 BookingTicket 现状对齐):
|
|
11
|
+
* - 默认由 `loadBookingConfig` / `loadResources` 拉取并写入 store;也支持消费方 `set*` 直接灌入(复用 ticketBooking 已拉到的数据)。
|
|
12
|
+
* - 所有读 API 返回浅克隆(数组)或原引用(map / config),避免 UI 写穿。
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** `loadBookingConfig` 入参,与 ticketBooking `getBookingConfig` 一致。 */
|
|
16
|
+
|
|
17
|
+
/** `loadResources` 入参,与 info2 `getResourceList` 一致。 */
|
|
18
|
+
|
|
19
|
+
/** `initBookingContext` 入参(BookingTicket 聚合入口)。 */
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 资源全集 map:key 为资源 id(数字),value 为资源原始对象,含 times / event_list 等运行态。
|
|
23
|
+
* 这里只声明 Record 形态;具体字段保留 `any`,与 ticketBooking 现网传入的数据形状兼容。
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 形参 booking_config(结构来自 `/core/board/management/config` 接口)。
|
|
28
|
+
* OS 不强制 schema,保留 `Record<string, any>` 兼容现网;常用路径文档化在 SDK docs。
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 日期入参:接受 dayjs 实例、ISO 字符串、Date 实例;内部统一 normalize 为 ISO 字符串保存。
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 内部 store 形态。`resourcesOriginMap` 由 `setResources` 派生,不允许外部直接 set。
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* BookingContextModule 对外 API(给 BookingTicket / SDK Provider 透传消费)。
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* BookingContextModule 事件名常量(采用 `${this.name}:` 前缀,与现有模块一致)。
|
|
45
|
+
*/
|
|
46
|
+
export var BookingContextEvent = /*#__PURE__*/function (BookingContextEvent) {
|
|
47
|
+
BookingContextEvent["OnBookingConfigChange"] = "onBookingConfigChange";
|
|
48
|
+
BookingContextEvent["OnResourcesChange"] = "onResourcesChange";
|
|
49
|
+
BookingContextEvent["OnDateChange"] = "onDateChange";
|
|
50
|
+
return BookingContextEvent;
|
|
51
|
+
}({});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { OrderProduct } from '../../Order/types';
|
|
2
|
+
export interface BuildCacheItemFromOrderLineInput {
|
|
3
|
+
/** tempOrder.products 中的一行 */
|
|
4
|
+
product: OrderProduct;
|
|
5
|
+
/** 与该行 product_uid 关联的 tempOrder.bookings 项 */
|
|
6
|
+
booking: Record<string, any>;
|
|
7
|
+
/** 商品 catalog / 详情,用于 capacity、duration、product_resource 等模板字段 */
|
|
8
|
+
sourceProduct?: Record<string, any> | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 从已加车的 order line + booking 反查 editService 所需的 cacheItem。
|
|
12
|
+
*
|
|
13
|
+
* 与 `buildCacheItemFromCartDetail` / `buildCacheItemFromDetail` 正向拼装互逆(在 getProductExtend 之前调用)。
|
|
14
|
+
* 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildCacheItemFromOrderLine(input: BuildCacheItemFromOrderLineInput): Record<string, any>;
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
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; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
|
+
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); }
|
|
17
|
+
import dayjs from 'dayjs';
|
|
18
|
+
import { getProductSkuOptions } from "../../Order/utils";
|
|
19
|
+
import { resolveManualDiscountMessage } from "../../Order/utils/manualProductDiscount";
|
|
20
|
+
import { buildProductOptionStringFromOrderLine } from "./orderLineDisplay";
|
|
21
|
+
function safeFormat(value, fmt) {
|
|
22
|
+
if (value === undefined || value === null) return undefined;
|
|
23
|
+
var d = dayjs(value);
|
|
24
|
+
if (!d.isValid()) return undefined;
|
|
25
|
+
return d.format(fmt);
|
|
26
|
+
}
|
|
27
|
+
function normalizeTimeString(value) {
|
|
28
|
+
if (value === undefined || value === null) return undefined;
|
|
29
|
+
if (typeof value === 'string') {
|
|
30
|
+
var t = value.trim();
|
|
31
|
+
var hhmmFromHhmmss = t.match(/^(\d{1,2}:\d{2}):\d{2}$/);
|
|
32
|
+
if (hhmmFromHhmmss) return hhmmFromHhmmss[1];
|
|
33
|
+
if (/^\d{1,2}:\d{2}$/.test(t)) return t;
|
|
34
|
+
}
|
|
35
|
+
var d = dayjs(value);
|
|
36
|
+
if (d.isValid()) return d.format('HH:mm');
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* bookings[].resources[] → cacheItem._extend.resource(与 cacheItemToBookingInput.flattenResources 互逆)。
|
|
42
|
+
*/
|
|
43
|
+
function unflattenResourceMap(resources) {
|
|
44
|
+
var map = {};
|
|
45
|
+
if (!Array.isArray(resources)) return map;
|
|
46
|
+
resources.forEach(function (r) {
|
|
47
|
+
var formId = r === null || r === void 0 ? void 0 : r.form_id;
|
|
48
|
+
if (formId === undefined || formId === null) return;
|
|
49
|
+
var key = String(formId);
|
|
50
|
+
if (!map[key]) map[key] = [];
|
|
51
|
+
map[key].push({
|
|
52
|
+
form_id: formId,
|
|
53
|
+
relation_id: r.relation_id,
|
|
54
|
+
relation_type: r.relation_type || 'form',
|
|
55
|
+
like_status: r.like_status || 'common',
|
|
56
|
+
metadata: r.metadata ? _objectSpread({}, r.metadata) : undefined,
|
|
57
|
+
children: r.children
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
return map;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 从 booking.metadata.capacity 还原 `_extend.capacity`(与 info2 ticketBooking getCapacity 对齐)。
|
|
65
|
+
* 勿用 resources[].relation_id 反推人数维度 id。
|
|
66
|
+
*/
|
|
67
|
+
function resolveCapacityFromBooking(booking) {
|
|
68
|
+
var _booking$metadata;
|
|
69
|
+
var metaCap = (_booking$metadata = booking.metadata) === null || _booking$metadata === void 0 ? void 0 : _booking$metadata.capacity;
|
|
70
|
+
if (Array.isArray(metaCap) && metaCap.length > 0) {
|
|
71
|
+
return metaCap.map(function (item) {
|
|
72
|
+
var _item$value;
|
|
73
|
+
if (!item || _typeof(item) !== 'object') return null;
|
|
74
|
+
if (item.id === undefined || item.id === null) return null;
|
|
75
|
+
var row = {
|
|
76
|
+
id: item.id,
|
|
77
|
+
value: Number((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : 0)
|
|
78
|
+
};
|
|
79
|
+
if (item.name !== undefined) row.name = item.name;
|
|
80
|
+
return row;
|
|
81
|
+
}).filter(function (item) {
|
|
82
|
+
return item != null;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (typeof metaCap === 'number' && Number.isFinite(metaCap)) {
|
|
86
|
+
return [{
|
|
87
|
+
id: 0,
|
|
88
|
+
value: metaCap,
|
|
89
|
+
name: ''
|
|
90
|
+
}];
|
|
91
|
+
}
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
function resolveDurationForExtend(booking) {
|
|
95
|
+
var duration = booking.duration;
|
|
96
|
+
if (booking.sub_type === 'days' || booking.is_all === 1) {
|
|
97
|
+
return duration;
|
|
98
|
+
}
|
|
99
|
+
if (typeof duration === 'number' && Number.isFinite(duration)) {
|
|
100
|
+
return duration;
|
|
101
|
+
}
|
|
102
|
+
return duration;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** booking.duration → catalog 顶层 duration 结构(供 isNormalProductByDurationSchedule 识别)。 */
|
|
106
|
+
function resolveTopLevelDuration(booking, sourceProduct) {
|
|
107
|
+
if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.duration) !== undefined) {
|
|
108
|
+
return sourceProduct.duration;
|
|
109
|
+
}
|
|
110
|
+
var raw = booking.duration;
|
|
111
|
+
if (raw == null || raw === '') return undefined;
|
|
112
|
+
if (_typeof(raw) === 'object' && raw.type) {
|
|
113
|
+
return raw;
|
|
114
|
+
}
|
|
115
|
+
var subType = booking.sub_type === 'days' ? 'days' : 'minutes';
|
|
116
|
+
var value = Number(raw);
|
|
117
|
+
if (!Number.isFinite(value) || value <= 0) return undefined;
|
|
118
|
+
return {
|
|
119
|
+
type: subType,
|
|
120
|
+
value: value
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function resolveProductTitle(product, booking, sourceProduct) {
|
|
124
|
+
var _ref, _ref2, _ref3, _ref4, _ref5, _title, _booking$product, _booking$detail;
|
|
125
|
+
var metadata = product.metadata || {};
|
|
126
|
+
return (_ref = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_title = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) !== null && _title !== void 0 ? _title : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.name) !== null && _ref5 !== void 0 ? _ref5 : metadata.product_title) !== null && _ref4 !== void 0 ? _ref4 : metadata.product_name) !== null && _ref3 !== void 0 ? _ref3 : booking === null || booking === void 0 || (_booking$product = booking.product) === null || _booking$product === void 0 ? void 0 : _booking$product.title) !== null && _ref2 !== void 0 ? _ref2 : booking === null || booking === void 0 || (_booking$detail = booking.detail) === null || _booking$detail === void 0 ? void 0 : _booking$detail.product_title) !== null && _ref !== void 0 ? _ref : '';
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* catalog 缺 product_resource 时,从 booking.resources 反推最小 product_resource 结构,
|
|
131
|
+
* 供 getResourceByIds / formatResources 渲染资源编辑 UI。
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* synthesizeProductResourceFromBooking({ resources: [{ form_id: 35, relation_id: 41077 }] });
|
|
135
|
+
*/
|
|
136
|
+
function synthesizeProductResourceFromBooking(booking) {
|
|
137
|
+
var rows = booking === null || booking === void 0 ? void 0 : booking.resources;
|
|
138
|
+
if (!Array.isArray(rows) || rows.length === 0) return undefined;
|
|
139
|
+
var relationIdsByForm = new Map();
|
|
140
|
+
rows.forEach(function (row) {
|
|
141
|
+
var _relationIdsByForm$ge;
|
|
142
|
+
var formId = row === null || row === void 0 ? void 0 : row.form_id;
|
|
143
|
+
var relationId = Number(row === null || row === void 0 ? void 0 : row.relation_id);
|
|
144
|
+
if (formId == null || formId === '' || !Number.isFinite(relationId) || relationId <= 0) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
var list = (_relationIdsByForm$ge = relationIdsByForm.get(formId)) !== null && _relationIdsByForm$ge !== void 0 ? _relationIdsByForm$ge : [];
|
|
148
|
+
if (!list.includes(relationId)) {
|
|
149
|
+
list.push(relationId);
|
|
150
|
+
}
|
|
151
|
+
relationIdsByForm.set(formId, list);
|
|
152
|
+
});
|
|
153
|
+
if (relationIdsByForm.size === 0) return undefined;
|
|
154
|
+
return {
|
|
155
|
+
resources: Array.from(relationIdsByForm.entries()).map(function (_ref6) {
|
|
156
|
+
var _ref7 = _slicedToArray(_ref6, 2),
|
|
157
|
+
formId = _ref7[0],
|
|
158
|
+
relationIds = _ref7[1];
|
|
159
|
+
return {
|
|
160
|
+
id: formId,
|
|
161
|
+
status: 1,
|
|
162
|
+
type: 'form',
|
|
163
|
+
code: '',
|
|
164
|
+
optional_resource: relationIds,
|
|
165
|
+
default_resource: []
|
|
166
|
+
};
|
|
167
|
+
})
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* 从已加车的 order line + booking 反查 editService 所需的 cacheItem。
|
|
173
|
+
*
|
|
174
|
+
* 与 `buildCacheItemFromCartDetail` / `buildCacheItemFromDetail` 正向拼装互逆(在 getProductExtend 之前调用)。
|
|
175
|
+
* 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
|
|
176
|
+
*/
|
|
177
|
+
export function buildCacheItemFromOrderLine(input) {
|
|
178
|
+
var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num, _ref8, _product$note, _booking$detail2, _product$metadata, _product$metadata2, _ref9, _extension_type, _booking$product2, _booking$product3, _price, _product$order_detail, _ref10, _booking$id;
|
|
179
|
+
var product = input.product,
|
|
180
|
+
booking = input.booking,
|
|
181
|
+
sourceProduct = input.sourceProduct;
|
|
182
|
+
var resolvedId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id;
|
|
183
|
+
var selling = Number((_product$selling_pric = product.selling_price) !== null && _product$selling_pric !== void 0 ? _product$selling_pric : 0);
|
|
184
|
+
var original = Number((_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : selling);
|
|
185
|
+
var startDate = safeFormat(booking.start_date, 'YYYY-MM-DD');
|
|
186
|
+
var endDate = safeFormat(booking.end_date, 'YYYY-MM-DD');
|
|
187
|
+
var startTime = normalizeTimeString(booking.start_time);
|
|
188
|
+
var endTime = normalizeTimeString(booking.end_time);
|
|
189
|
+
var resource = unflattenResourceMap(booking.resources);
|
|
190
|
+
var capacity = resolveCapacityFromBooking(booking);
|
|
191
|
+
var holderId = (_booking$metadata$hol = (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.holder_id) !== null && _booking$metadata$hol !== void 0 ? _booking$metadata$hol : booking.holder_id;
|
|
192
|
+
var productTitle = resolveProductTitle(product, booking, sourceProduct);
|
|
193
|
+
var productOptionString = buildProductOptionStringFromOrderLine(product);
|
|
194
|
+
var other = {
|
|
195
|
+
product_variant_id: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0,
|
|
196
|
+
option: getProductSkuOptions(product),
|
|
197
|
+
bundle: Array.isArray(product.product_bundle) ? _toConsumableArray(product.product_bundle) : []
|
|
198
|
+
};
|
|
199
|
+
var extend = _objectSpread({
|
|
200
|
+
start_date: startDate ? dayjs(startDate) : undefined,
|
|
201
|
+
end_date: endDate ? dayjs(endDate) : undefined,
|
|
202
|
+
startDate: startDate ? dayjs(startDate) : undefined,
|
|
203
|
+
endDate: endDate ? dayjs(endDate) : undefined,
|
|
204
|
+
start_time: startTime,
|
|
205
|
+
end_time: endTime,
|
|
206
|
+
duration: resolveDurationForExtend(booking),
|
|
207
|
+
sub_type: booking.sub_type,
|
|
208
|
+
quantity: (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : 1,
|
|
209
|
+
product_name: productTitle,
|
|
210
|
+
note: (_ref8 = (_product$note = product.note) !== null && _product$note !== void 0 ? _product$note : booking === null || booking === void 0 || (_booking$detail2 = booking.detail) === null || _booking$detail2 === void 0 ? void 0 : _booking$detail2.note) !== null && _ref8 !== void 0 ? _ref8 : '',
|
|
211
|
+
price: selling,
|
|
212
|
+
total: selling,
|
|
213
|
+
origin_total: original,
|
|
214
|
+
resource: resource,
|
|
215
|
+
capacity: capacity,
|
|
216
|
+
holder_id: holderId,
|
|
217
|
+
other: other,
|
|
218
|
+
like_status: booking.like_status || 'common',
|
|
219
|
+
discount_reason: resolveManualDiscountMessage(product.discount_list, (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.product_discount_reason) || undefined
|
|
220
|
+
}, productOptionString ? {
|
|
221
|
+
product_option_string: productOptionString
|
|
222
|
+
} : {});
|
|
223
|
+
var manualDiscount = (product.discount_list || []).find(function (d) {
|
|
224
|
+
return (d === null || d === void 0 ? void 0 : d.type) === 'product';
|
|
225
|
+
});
|
|
226
|
+
if (manualDiscount && extend.origin_total === selling) {
|
|
227
|
+
var _manualDiscount$amoun;
|
|
228
|
+
var manualAmount = Number((_manualDiscount$amoun = manualDiscount.amount) !== null && _manualDiscount$amoun !== void 0 ? _manualDiscount$amoun : 0);
|
|
229
|
+
if (Number.isFinite(manualAmount) && manualAmount > 0) {
|
|
230
|
+
extend.origin_total = selling + manualAmount;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (((_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.price_override) != null || manualDiscount) {
|
|
234
|
+
extend.priceOverride = selling;
|
|
235
|
+
}
|
|
236
|
+
if (booking.holder !== undefined) {
|
|
237
|
+
extend.holder = booking.holder;
|
|
238
|
+
}
|
|
239
|
+
if (Array.isArray(booking.relation_forms)) {
|
|
240
|
+
extend.relation_forms = booking.relation_forms;
|
|
241
|
+
}
|
|
242
|
+
var base = _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
|
|
243
|
+
id: resolvedId,
|
|
244
|
+
product_id: resolvedId,
|
|
245
|
+
extension_type: (_ref9 = (_extension_type = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type) !== null && _extension_type !== void 0 ? _extension_type : booking === null || booking === void 0 || (_booking$product2 = booking.product) === null || _booking$product2 === void 0 ? void 0 : _booking$product2.extension_type) !== null && _ref9 !== void 0 ? _ref9 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type,
|
|
246
|
+
title: productTitle || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || (booking === null || booking === void 0 || (_booking$product3 = booking.product) === null || _booking$product3 === void 0 ? void 0 : _booking$product3.title),
|
|
247
|
+
price: (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : selling,
|
|
248
|
+
selling_price: product.selling_price,
|
|
249
|
+
original_price: product.original_price
|
|
250
|
+
}, productOptionString ? {
|
|
251
|
+
product_option_string: productOptionString
|
|
252
|
+
} : {}), {}, {
|
|
253
|
+
_extend: extend,
|
|
254
|
+
new: 0,
|
|
255
|
+
autoClose: false,
|
|
256
|
+
order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
|
|
257
|
+
booking_id: (_ref10 = (_booking$id = booking.id) !== null && _booking$id !== void 0 ? _booking$id : booking.booking_id) !== null && _ref10 !== void 0 ? _ref10 : 0
|
|
258
|
+
});
|
|
259
|
+
if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.capacity) !== undefined) {
|
|
260
|
+
base.capacity = sourceProduct.capacity;
|
|
261
|
+
}
|
|
262
|
+
var topLevelDuration = resolveTopLevelDuration(booking, sourceProduct);
|
|
263
|
+
if (topLevelDuration !== undefined) {
|
|
264
|
+
base.duration = topLevelDuration;
|
|
265
|
+
}
|
|
266
|
+
if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.product_resource) !== undefined) {
|
|
267
|
+
base.product_resource = sourceProduct.product_resource;
|
|
268
|
+
} else {
|
|
269
|
+
var synthesized = synthesizeProductResourceFromBooking(booking);
|
|
270
|
+
if (synthesized) {
|
|
271
|
+
base.product_resource = synthesized;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (Array.isArray(sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.schedules) && sourceProduct.schedules.length) {
|
|
275
|
+
base.schedules = sourceProduct.schedules;
|
|
276
|
+
}
|
|
277
|
+
if (Array.isArray(sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct['schedule.ids']) && sourceProduct['schedule.ids'].length) {
|
|
278
|
+
base['schedule.ids'] = sourceProduct['schedule.ids'];
|
|
279
|
+
}
|
|
280
|
+
if (booking.schedule_event_id !== undefined) {
|
|
281
|
+
base.schedule_event_id = booking.schedule_event_id;
|
|
282
|
+
}
|
|
283
|
+
return base;
|
|
284
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OrderProduct } from '../../Order/types';
|
|
2
|
+
export interface BuildNormalProductCacheItemFromOrderLineInput {
|
|
3
|
+
/** tempOrder.products 中的一行(普通商品,无关联 booking) */
|
|
4
|
+
product: OrderProduct;
|
|
5
|
+
/** 商品 catalog / 详情,用于 variant / option / bundle 模板字段 */
|
|
6
|
+
sourceProduct?: Record<string, any> | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function buildNormalProductCacheItemFromOrderLine(input: BuildNormalProductCacheItemFromOrderLineInput): Record<string, any>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["bundle_selling_price"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
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); }
|
|
8
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
+
import { getProductSkuOptions } from "../../Order/utils";
|
|
11
|
+
import { buildProductOptionStringFromOrderLine } from "./orderLineDisplay";
|
|
12
|
+
/**
|
|
13
|
+
* 从已加车的普通商品 order line 反查 SkuDetailModal edit 所需的 cacheItem。
|
|
14
|
+
*
|
|
15
|
+
* 与 `buildCacheItemFromOrderLine`(预约行 + booking)并列;不含 resource / duration / holder 等预约字段。
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* 解析 v2 主商品 source 价(不含 option、不含 bundle),供 SkuDetailModal / transform 使用。
|
|
19
|
+
*/
|
|
20
|
+
function resolveSourceProductPrice(product, sourceProduct) {
|
|
21
|
+
var _price, _price2, _metadata$origin2, _metadata$origin3, _product$selling_pric;
|
|
22
|
+
var metadata = product.metadata || {};
|
|
23
|
+
if (metadata.source_product_price !== undefined && metadata.source_product_price !== null) {
|
|
24
|
+
var parsed = Number(metadata.source_product_price);
|
|
25
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
26
|
+
}
|
|
27
|
+
var variantId = Number(product.product_variant_id || 0);
|
|
28
|
+
if (variantId > 0) {
|
|
29
|
+
var _variant, _metadata$origin;
|
|
30
|
+
var variantList = (_variant = (_metadata$origin = metadata.origin) === null || _metadata$origin === void 0 ? void 0 : _metadata$origin.variant) !== null && _variant !== void 0 ? _variant : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.variant;
|
|
31
|
+
if (Array.isArray(variantList)) {
|
|
32
|
+
var _matched$price;
|
|
33
|
+
var matched = variantList.find(function (v) {
|
|
34
|
+
return Number(v === null || v === void 0 ? void 0 : v.id) === variantId;
|
|
35
|
+
});
|
|
36
|
+
var variantPrice = (_matched$price = matched === null || matched === void 0 ? void 0 : matched.price) !== null && _matched$price !== void 0 ? _matched$price : matched === null || matched === void 0 ? void 0 : matched.base_price;
|
|
37
|
+
if (variantPrice !== undefined && variantPrice !== null) {
|
|
38
|
+
var _parsed = Number(variantPrice);
|
|
39
|
+
if (Number.isFinite(_parsed)) return _parsed;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
var catalogPrice = (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price;
|
|
44
|
+
if (catalogPrice !== undefined && catalogPrice !== null) {
|
|
45
|
+
var _parsed2 = Number(catalogPrice);
|
|
46
|
+
if (Number.isFinite(_parsed2)) return _parsed2;
|
|
47
|
+
}
|
|
48
|
+
var originPrice = (_price2 = (_metadata$origin2 = metadata.origin) === null || _metadata$origin2 === void 0 ? void 0 : _metadata$origin2.price) !== null && _price2 !== void 0 ? _price2 : (_metadata$origin3 = metadata.origin) === null || _metadata$origin3 === void 0 ? void 0 : _metadata$origin3.base_price;
|
|
49
|
+
if (originPrice !== undefined && originPrice !== null) {
|
|
50
|
+
var _parsed3 = Number(originPrice);
|
|
51
|
+
if (Number.isFinite(_parsed3)) return _parsed3;
|
|
52
|
+
}
|
|
53
|
+
return Number((_product$selling_pric = product.selling_price) !== null && _product$selling_pric !== void 0 ? _product$selling_pric : 0);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** 订单行 bundle → booking other.bundle(保留 original_price 供 setProductPrice 按比例分摊) */
|
|
57
|
+
function mapOrderBundleToOtherBundle(bundle) {
|
|
58
|
+
return bundle.map(function (item) {
|
|
59
|
+
var _ref, _ref2, _item$original_price, _ref3, _item$bundle_selling_, _item$original_total, _ref4, _item$num, _ref5, _item$quantity;
|
|
60
|
+
var catalogOriginal = (_ref = (_ref2 = (_item$original_price = item.original_price) !== null && _item$original_price !== void 0 ? _item$original_price : item.product_price) !== null && _ref2 !== void 0 ? _ref2 : item.price) !== null && _ref !== void 0 ? _ref : item.bundle_selling_price;
|
|
61
|
+
var selling = (_ref3 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref3 !== void 0 ? _ref3 : catalogOriginal;
|
|
62
|
+
var _omitBundleSelling = item.bundle_selling_price,
|
|
63
|
+
rest = _objectWithoutProperties(item, _excluded);
|
|
64
|
+
var isMarkupOrMarkdown = (item.price_type === 'markdown' || item.price_type === 'markup') && (item.price_type_ext === '' || item.price_type_ext === undefined || item.price_type_ext === null);
|
|
65
|
+
if (isMarkupOrMarkdown) delete rest.original_total;
|
|
66
|
+
return _objectSpread(_objectSpread(_objectSpread({}, rest), {}, {
|
|
67
|
+
price: selling,
|
|
68
|
+
original_price: catalogOriginal
|
|
69
|
+
}, isMarkupOrMarkdown ? {} : {
|
|
70
|
+
original_total: (_item$original_total = item.original_total) !== null && _item$original_total !== void 0 ? _item$original_total : catalogOriginal
|
|
71
|
+
}), {}, {
|
|
72
|
+
num: (_ref4 = (_item$num = item.num) !== null && _item$num !== void 0 ? _item$num : item.quantity) !== null && _ref4 !== void 0 ? _ref4 : 1,
|
|
73
|
+
quantity: (_ref5 = (_item$quantity = item.quantity) !== null && _item$quantity !== void 0 ? _item$quantity : item.num) !== null && _ref5 !== void 0 ? _ref5 : 1
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
export function buildNormalProductCacheItemFromOrderLine(input) {
|
|
78
|
+
var _product$product_id, _product$selling_pric2, _product$original_pri, _product$metadata, _product$metadata2, _product$product_vari, _originExtend$other, _product$num, _product$product_vari2, _product$num2, _title, _product$note, _originExtend$price, _originExtend$total, _originExtend$origin_, _product$metadata3, _ref6, _title2, _price3, _product$order_detail;
|
|
79
|
+
var product = input.product,
|
|
80
|
+
sourceProduct = input.sourceProduct;
|
|
81
|
+
var resolvedId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id;
|
|
82
|
+
var sourcePrice = resolveSourceProductPrice(product, sourceProduct);
|
|
83
|
+
var selling = Number((_product$selling_pric2 = product.selling_price) !== null && _product$selling_pric2 !== void 0 ? _product$selling_pric2 : 0);
|
|
84
|
+
var original = Number((_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : selling);
|
|
85
|
+
var uid = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number;
|
|
86
|
+
var option = getProductSkuOptions(product);
|
|
87
|
+
var bundle = mapOrderBundleToOtherBundle(Array.isArray(product.product_bundle) ? product.product_bundle : []);
|
|
88
|
+
var originExtend = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 || (_product$metadata2 = _product$metadata2.origin) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2._extend;
|
|
89
|
+
var productOptionString = buildProductOptionStringFromOrderLine(product);
|
|
90
|
+
var discountList = product.discount_list || [];
|
|
91
|
+
var other = {
|
|
92
|
+
product_id: resolvedId,
|
|
93
|
+
product_variant_id: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0,
|
|
94
|
+
option: option,
|
|
95
|
+
bundle: originExtend !== null && originExtend !== void 0 && (_originExtend$other = originExtend.other) !== null && _originExtend$other !== void 0 && _originExtend$other.bundle ? JSON.parse(JSON.stringify(originExtend.other.bundle)) : bundle,
|
|
96
|
+
quantity: (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : 1
|
|
97
|
+
};
|
|
98
|
+
var skuValue = {
|
|
99
|
+
product_id: resolvedId,
|
|
100
|
+
product_variant_id: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : 0,
|
|
101
|
+
option: other.option,
|
|
102
|
+
bundle: other.bundle
|
|
103
|
+
};
|
|
104
|
+
var extend = _objectSpread(_objectSpread(_objectSpread({
|
|
105
|
+
quantity: (_product$num2 = product.num) !== null && _product$num2 !== void 0 ? _product$num2 : 1,
|
|
106
|
+
product_name: (_title = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) !== null && _title !== void 0 ? _title : '',
|
|
107
|
+
note: (_product$note = product.note) !== null && _product$note !== void 0 ? _product$note : '',
|
|
108
|
+
// v2:_extend.price 为主商品 source 价;行 composite 用 total / origin_total 展示
|
|
109
|
+
price: (_originExtend$price = originExtend === null || originExtend === void 0 ? void 0 : originExtend.price) !== null && _originExtend$price !== void 0 ? _originExtend$price : sourcePrice,
|
|
110
|
+
total: (_originExtend$total = originExtend === null || originExtend === void 0 ? void 0 : originExtend.total) !== null && _originExtend$total !== void 0 ? _originExtend$total : selling,
|
|
111
|
+
origin_total: (_originExtend$origin_ = originExtend === null || originExtend === void 0 ? void 0 : originExtend.origin_total) !== null && _originExtend$origin_ !== void 0 ? _originExtend$origin_ : original,
|
|
112
|
+
other: other,
|
|
113
|
+
skuValue: JSON.parse(JSON.stringify(skuValue)),
|
|
114
|
+
_skuValue: JSON.parse(JSON.stringify(skuValue)),
|
|
115
|
+
isNormalProduct: true,
|
|
116
|
+
metadata: {
|
|
117
|
+
product_add_schedule_time: (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.product_add_schedule_time
|
|
118
|
+
}
|
|
119
|
+
}, productOptionString ? {
|
|
120
|
+
product_option_string: productOptionString
|
|
121
|
+
} : {}), (originExtend === null || originExtend === void 0 ? void 0 : originExtend.priceOverride) !== undefined ? {
|
|
122
|
+
priceOverride: originExtend.priceOverride
|
|
123
|
+
} : {}), (originExtend === null || originExtend === void 0 ? void 0 : originExtend.bundle_edit) !== undefined ? {
|
|
124
|
+
bundle_edit: originExtend.bundle_edit
|
|
125
|
+
} : {});
|
|
126
|
+
if (originExtend !== null && originExtend !== void 0 && originExtend.skuValue || originExtend !== null && originExtend !== void 0 && originExtend._skuValue) {
|
|
127
|
+
extend.skuValue = JSON.parse(JSON.stringify(originExtend.skuValue || originExtend._skuValue));
|
|
128
|
+
extend._skuValue = JSON.parse(JSON.stringify(extend.skuValue));
|
|
129
|
+
}
|
|
130
|
+
return _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
|
|
131
|
+
id: resolvedId,
|
|
132
|
+
product_id: resolvedId,
|
|
133
|
+
_id: uid,
|
|
134
|
+
title: (_ref6 = (_title2 = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) !== null && _title2 !== void 0 ? _title2 : product.product_title) !== null && _ref6 !== void 0 ? _ref6 : '',
|
|
135
|
+
price: (_price3 = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price3 !== void 0 ? _price3 : sourcePrice,
|
|
136
|
+
selling_price: product.selling_price,
|
|
137
|
+
original_price: product.original_price
|
|
138
|
+
}, productOptionString ? {
|
|
139
|
+
product_option_string: productOptionString
|
|
140
|
+
} : {}), {}, {
|
|
141
|
+
note: product.note,
|
|
142
|
+
order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
|
|
143
|
+
discount_list: discountList,
|
|
144
|
+
new: 0,
|
|
145
|
+
autoClose: true,
|
|
146
|
+
_extend: extend
|
|
147
|
+
});
|
|
148
|
+
}
|