@pisell/pisellos 0.10.14 → 0.10.16
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/core/index.js +6 -9
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +0 -1
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.js +2 -4
- package/dist/modules/OpenData/index.js +0 -2
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +75 -91
- package/dist/modules/Order/types.d.ts +5 -1
- package/dist/modules/Order/utils/virtualSettlement.d.ts +8 -1
- package/dist/modules/Order/utils/virtualSettlement.js +15 -2
- package/dist/modules/Order/utils.js +7 -1
- package/dist/modules/Payment/index.js +97 -162
- package/dist/modules/Product/types.d.ts +2 -0
- package/dist/modules/Rules/index.js +1 -4
- package/dist/modules/Schedule/index.js +0 -1
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.js +97 -129
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/order/index.js +2 -4
- package/dist/server/modules/products/index.js +24 -42
- package/dist/server/modules/quotation/index.js +29 -38
- package/dist/server/modules/resource/index.js +3 -4
- package/dist/server/modules/schedule/index.js +27 -35
- package/dist/server/utils/product.js +0 -1
- package/dist/solution/BaseSales/index.js +107 -76
- package/dist/solution/BaseSales/types.d.ts +2 -0
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +15 -6
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +7 -1
- package/dist/solution/BaseSales/utils.js +6 -3
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.js +8 -4
- package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -1
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
- package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.js +177 -252
- package/dist/solution/Checkout/utils/index.js +4 -16
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/ScanOrder/index.js +50 -60
- package/dist/solution/ScanOrder/types.d.ts +2 -0
- package/dist/solution/ScanOrder/utils.js +6 -3
- package/dist/solution/ShopDiscount/index.js +2 -7
- package/dist/solution/VenueBooking/index.js +45 -55
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +131 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +82 -49
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +209 -315
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
- package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
- package/lib/model/strategy/adapter/promotion/examples.js +222 -234
- package/lib/model/strategy/adapter/promotion/index.js +43 -48
- package/lib/model/strategy/adapter/promotion/type.js +243 -36
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.js +23 -42
- package/lib/modules/BookingContext/index.js +158 -136
- package/lib/modules/BookingContext/types.js +46 -32
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
- package/lib/modules/BookingContext/utils/flexible.js +38 -55
- package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
- package/lib/modules/BookingContext/utils/index.js +124 -41
- package/lib/modules/BookingContext/utils/noResource.js +58 -70
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
- package/lib/modules/BookingContext/utils/productExtend.js +202 -155
- package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
- package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
- package/lib/modules/BookingContext/utils/resources.js +209 -167
- package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
- package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +321 -251
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +70 -78
- package/lib/modules/Cart/utils/changePrice.js +22 -50
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.js +235 -172
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.js +133 -143
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.js +70 -76
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +1810 -2238
- package/lib/modules/Order/payment-utils.js +77 -120
- package/lib/modules/Order/types.d.ts +5 -1
- package/lib/modules/Order/types.js +87 -35
- package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
- package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
- package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
- package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
- package/lib/modules/Order/utils/virtualSettlement.d.ts +8 -1
- package/lib/modules/Order/utils/virtualSettlement.js +126 -164
- package/lib/modules/Order/utils.js +834 -668
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.js +532 -399
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.js +230 -108
- package/lib/modules/Payment/utils.js +52 -51
- package/lib/modules/Payment/walletpass.js +485 -660
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.d.ts +2 -0
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.js +138 -161
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.js +66 -100
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/ResourcePlanner/index.js +25 -23
- package/lib/modules/ResourcePlanner/localClock.js +54 -119
- package/lib/modules/ResourcePlanner/planner.js +591 -772
- package/lib/modules/ResourcePlanner/types.js +10 -29
- package/lib/modules/Rules/index.js +1218 -959
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.js +78 -89
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.js +359 -442
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
- package/lib/modules/Schedule/index.js +100 -114
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -71
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +773 -418
- package/lib/modules/SurchargeList/index.js +46 -60
- package/lib/modules/SurchargeList/types.js +4 -16
- package/lib/modules/index.js +245 -63
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.js +3027 -2655
- package/lib/server/modules/floor-plan/index.js +102 -123
- package/lib/server/modules/floor-plan/types.js +15 -30
- package/lib/server/modules/index.js +106 -68
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.js +758 -956
- package/lib/server/modules/order/types.js +122 -33
- package/lib/server/modules/order/utils/filterBookings.js +219 -194
- package/lib/server/modules/order/utils/filterOrders.js +118 -92
- package/lib/server/modules/payment/index.js +59 -83
- package/lib/server/modules/payment/types.js +4 -16
- package/lib/server/modules/products/index.js +575 -459
- package/lib/server/modules/products/types.js +44 -34
- package/lib/server/modules/quotation/index.js +137 -172
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.js +213 -184
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.js +135 -123
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +196 -139
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/small-ticket.js +479 -456
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BaseSales/index.js +1276 -1485
- package/lib/solution/BaseSales/types.d.ts +2 -0
- package/lib/solution/BaseSales/types.js +42 -38
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +652 -498
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
- package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +138 -180
- package/lib/solution/BaseSales/utils.js +161 -143
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingByStep/index.js +1527 -1340
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.js +598 -514
- package/lib/solution/BookingTicket/types.js +99 -77
- package/lib/solution/BookingTicket/utils/addProductDecision.js +229 -190
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
- package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
- package/lib/solution/BookingTicket/utils/cartView.js +114 -99
- package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
- package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.js +1451 -1158
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +228 -156
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +493 -460
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.js +328 -324
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.js +822 -852
- package/lib/solution/ScanOrder/types.d.ts +2 -0
- package/lib/solution/ScanOrder/types.js +33 -34
- package/lib/solution/ScanOrder/utils.js +412 -374
- package/lib/solution/ShopDiscount/index.js +226 -232
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +300 -172
- package/lib/solution/UnifiedBookingSales/index.js +1052 -1213
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
- package/lib/solution/UnifiedBookingSales/types.js +10 -32
- package/lib/solution/VenueBooking/index.js +811 -879
- package/lib/solution/VenueBooking/types.js +19 -39
- package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
- package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.js +124 -41
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.js +4 -16
- package/lib/utils/payment-number.js +26 -46
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
|
@@ -37,6 +37,10 @@ function toPriceString(value) {
|
|
|
37
37
|
if (!Number.isFinite(parsedValue)) return fallback;
|
|
38
38
|
return parsedValue.toFixed(2);
|
|
39
39
|
}
|
|
40
|
+
function normalizeProductionCode(value) {
|
|
41
|
+
if (value === undefined || value === null) return '';
|
|
42
|
+
return String(value).trim();
|
|
43
|
+
}
|
|
40
44
|
function isBlankValue(value) {
|
|
41
45
|
return value === undefined || value === null || typeof value === 'string' && value.trim() === '';
|
|
42
46
|
}
|
|
@@ -159,7 +163,7 @@ function findVariantById(origin, variantId) {
|
|
|
159
163
|
* 注意:这里不生成 identity,缺省时由 OrderModule 自动补齐。
|
|
160
164
|
*/
|
|
161
165
|
export function transformBaseProductToOrderProduct(params) {
|
|
162
|
-
var _ref10, _ref11, _ref12, _payload$product_id, _ref13, _ref14, _payload$product_vari, _payload$_origin, _payload$_origin2, _payload$metadata, _sourceProduct$metada, _callbackOrigin$metad, _origin$metadata, _payload$metadata2, _payload$_extend, _sourceProduct$metada2, _sourceProduct$_exten, _callbackOrigin$metad2, _callbackOrigin$_exte, _payload$_dataVariant, _sourceProduct$_dataV, _callbackOrigin$_data, _origin$_dataVariant, _ref15, _findVariantById, _ref16, _ref17, _ref18, _ref19, _ref20, _matchedVariant$price, _ref21, _ref22, _payload$price, _ref23, _payload$line_total, _payload$_extend2, _ref24, _ref25, _payload$product_sku$, _payload$product_sku, _payload$bundle, _payload$quantity, _payload$_extend3, _extend, _extend2, _ref26, _ref27, _origin$base_price, _ref28, _ref29, _payload$line_total2, _payload$_extend4, _payload$_extend5, _extend3, _payload$_extend6, _payload$_extend7, _ref30, _ref31, _payload$tax_fee, _ref32, _ref33, _payload$is_charge_ta;
|
|
166
|
+
var _ref10, _ref11, _ref12, _payload$product_id, _ref13, _ref14, _payload$product_vari, _payload$_origin, _payload$_origin2, _payload$metadata, _sourceProduct$metada, _callbackOrigin$metad, _origin$metadata, _payload$metadata2, _payload$_extend, _sourceProduct$metada2, _sourceProduct$_exten, _callbackOrigin$metad2, _callbackOrigin$_exte, _payload$_dataVariant, _sourceProduct$_dataV, _callbackOrigin$_data, _origin$_dataVariant, _ref15, _findVariantById, _origin$production_co, _ref16, _ref17, _ref18, _ref19, _ref20, _matchedVariant$price, _ref21, _ref22, _payload$price, _ref23, _payload$line_total, _payload$_extend2, _ref24, _ref25, _payload$product_sku$, _payload$product_sku, _payload$bundle, _payload$quantity, _payload$_extend3, _extend, _extend2, _ref26, _ref27, _origin$base_price, _ref28, _ref29, _payload$line_total2, _payload$_extend4, _payload$_extend5, _extend3, _payload$_extend6, _payload$_extend7, _ref30, _ref31, _payload$tax_fee, _ref32, _ref33, _payload$is_charge_ta;
|
|
163
167
|
var payload = params.payload,
|
|
164
168
|
_params$fallbackProdu = params.fallbackProductId,
|
|
165
169
|
fallbackProductId = _params$fallbackProdu === void 0 ? null : _params$fallbackProdu;
|
|
@@ -175,6 +179,7 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
175
179
|
var locallyAppliedVariantIds = authoritativeDataVariantIds === undefined ? cloneFirstDataVariantIds((_payload$_dataVariant = payload._dataVariant) === null || _payload$_dataVariant === void 0 ? void 0 : _payload$_dataVariant.appliedVariantIds, sourceProduct === null || sourceProduct === void 0 || (_sourceProduct$_dataV = sourceProduct._dataVariant) === null || _sourceProduct$_dataV === void 0 ? void 0 : _sourceProduct$_dataV.appliedVariantIds, callbackOrigin === null || callbackOrigin === void 0 || (_callbackOrigin$_data = callbackOrigin._dataVariant) === null || _callbackOrigin$_data === void 0 ? void 0 : _callbackOrigin$_data.appliedVariantIds, origin === null || origin === void 0 || (_origin$_dataVariant = origin._dataVariant) === null || _origin$_dataVariant === void 0 ? void 0 : _origin$_dataVariant.appliedVariantIds) : undefined;
|
|
176
180
|
var dataVariantIds = appendDataVariantIds(authoritativeDataVariantIds, locallyAppliedVariantIds, selectedSettlementSnapshot === null || selectedSettlementSnapshot === void 0 ? void 0 : selectedSettlementSnapshot.data_variant_id);
|
|
177
181
|
var matchedVariant = (_ref15 = (_findVariantById = findVariantById(callbackOrigin, productVariantId)) !== null && _findVariantById !== void 0 ? _findVariantById : findVariantById(sourceProduct, productVariantId)) !== null && _ref15 !== void 0 ? _ref15 : findVariantById(origin, productVariantId);
|
|
182
|
+
var productionCode = normalizeProductionCode(Object.prototype.hasOwnProperty.call(payload, 'production_code') ? payload.production_code : productVariantId > 0 ? matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.production_code : (_origin$production_co = origin === null || origin === void 0 ? void 0 : origin.production_code) !== null && _origin$production_co !== void 0 ? _origin$production_co : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.production_code);
|
|
178
183
|
var hasPriceOverride = payload.price_override !== undefined && payload.price_override !== null && payload.price_override !== '';
|
|
179
184
|
// 手动改价后 payload.price 是分摊后的主商品售价,不能再作为券前 source。
|
|
180
185
|
// 此时优先从商品/variant 快照读取目录价;售价仍由 line_total - bundle 推导。
|
|
@@ -261,6 +266,7 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
261
266
|
return _objectSpread(_objectSpread({
|
|
262
267
|
product_id: productId,
|
|
263
268
|
product_variant_id: productVariantId,
|
|
269
|
+
production_code: productionCode,
|
|
264
270
|
unique_identification_number: uniqueIdentificationNumber ? String(uniqueIdentificationNumber) : undefined,
|
|
265
271
|
num: resolvedQuantity,
|
|
266
272
|
product_sku: _objectSpread(_objectSpread({}, payload.product_sku && _typeof(payload.product_sku) === 'object' ? payload.product_sku : {}), {}, {
|
|
@@ -256,11 +256,14 @@ export function normalizeOrderProduct(product) {
|
|
|
256
256
|
sellingPrice: composedSellingPrice,
|
|
257
257
|
quantity: getSafeProductNum(product.num)
|
|
258
258
|
});
|
|
259
|
-
return {
|
|
259
|
+
return _objectSpread(_objectSpread({
|
|
260
260
|
order_detail_id: product.order_detail_id || null,
|
|
261
261
|
product_id: product.product_id,
|
|
262
262
|
num: getSafeProductNum(product.num),
|
|
263
|
-
product_variant_id: product.product_variant_id
|
|
263
|
+
product_variant_id: product.product_variant_id
|
|
264
|
+
}, product.production_code !== undefined && product.production_code !== null ? {
|
|
265
|
+
production_code: String(product.production_code).trim()
|
|
266
|
+
} : {}), {}, {
|
|
264
267
|
product_sku: productSku,
|
|
265
268
|
selling_price: composedSellingPrice,
|
|
266
269
|
original_price: finalOriginalPrice,
|
|
@@ -270,5 +273,5 @@ export function normalizeOrderProduct(product) {
|
|
|
270
273
|
product_bundle: normalizedBundle,
|
|
271
274
|
metadata: metadata,
|
|
272
275
|
note: product.note != null ? String(product.note) : ''
|
|
273
|
-
};
|
|
276
|
+
});
|
|
274
277
|
}
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
345
345
|
count: number;
|
|
346
346
|
left: number;
|
|
347
347
|
summaryCount: number;
|
|
348
|
-
status: "
|
|
348
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
349
349
|
}[];
|
|
350
350
|
/**
|
|
351
351
|
* 找到多个资源的公共可用时间段
|
|
@@ -87,23 +87,22 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
87
87
|
this.core = core;
|
|
88
88
|
this.store = options.store || {};
|
|
89
89
|
this.otherParams = options.otherParams || {};
|
|
90
|
-
console.log('[BookingByStep] 初始化完成');
|
|
91
90
|
// 获取依赖的插件
|
|
92
91
|
this.request = core.getPlugin('request');
|
|
93
92
|
this.window = core.getPlugin('window');
|
|
94
93
|
this.shopStore = core.getPlugin('shopStore');
|
|
95
94
|
if (this.request) {
|
|
96
|
-
_context.next =
|
|
95
|
+
_context.next = 8;
|
|
97
96
|
break;
|
|
98
97
|
}
|
|
99
98
|
throw new Error('bookingByStep解决方案需要 request 插件支持');
|
|
100
|
-
case
|
|
99
|
+
case 8:
|
|
101
100
|
if (this.shopStore) {
|
|
102
|
-
_context.next =
|
|
101
|
+
_context.next = 10;
|
|
103
102
|
break;
|
|
104
103
|
}
|
|
105
104
|
throw new Error('SummaryModule 需要 shopStore 插件支持');
|
|
106
|
-
case
|
|
105
|
+
case 10:
|
|
107
106
|
// 如果有传 cacheid,默认需要收集上面这些模块里用户操作选中的数据
|
|
108
107
|
// 并且在上面 registerModule 的时候,读取 sessionStroage 里的数据,塞进默认值
|
|
109
108
|
targetCacheData = {};
|
|
@@ -138,7 +137,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
138
137
|
});
|
|
139
138
|
this.store.schedule.loadAllSchedule();
|
|
140
139
|
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
141
|
-
case
|
|
140
|
+
case 18:
|
|
142
141
|
case "end":
|
|
143
142
|
return _context.stop();
|
|
144
143
|
}
|
|
@@ -3187,8 +3186,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3187
3186
|
key: "findCommonAvailableTimeSlots",
|
|
3188
3187
|
value: function findCommonAvailableTimeSlots(resources) {
|
|
3189
3188
|
if (resources.length === 0) return [];
|
|
3190
|
-
console.log("\u8BA1\u7B97 ".concat(resources.length, " \u4E2A\u8D44\u6E90\u7684\u516C\u5171\u65F6\u95F4\u6BB5"));
|
|
3191
|
-
|
|
3192
3189
|
// 收集所有资源的时间段,转换为统一的时间格式
|
|
3193
3190
|
var allTimeSlots = resources.map(function (resource) {
|
|
3194
3191
|
return resource.times.map(function (time) {
|
|
@@ -3198,19 +3195,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3198
3195
|
};
|
|
3199
3196
|
});
|
|
3200
3197
|
});
|
|
3201
|
-
console.log('所有资源的时间段:', allTimeSlots.map(function (slots) {
|
|
3202
|
-
return slots.map(function (slot) {
|
|
3203
|
-
return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
|
|
3204
|
-
});
|
|
3205
|
-
}));
|
|
3206
|
-
|
|
3207
3198
|
// 找到公共时间段的交集
|
|
3208
3199
|
var commonSlots = allTimeSlots[0]; // 从第一个资源的时间段开始
|
|
3209
|
-
console.log('初始公共时间段:', commonSlots.map(function (slot) {
|
|
3210
|
-
return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
|
|
3211
|
-
}));
|
|
3212
|
-
|
|
3213
|
-
// 与其他资源的时间段求交集
|
|
3214
3200
|
var _loop3 = function _loop3() {
|
|
3215
3201
|
var currentResourceSlots = allTimeSlots[i];
|
|
3216
3202
|
var intersections = [];
|
|
@@ -3231,14 +3217,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3231
3217
|
});
|
|
3232
3218
|
});
|
|
3233
3219
|
if (intersections.length === 0) {
|
|
3234
|
-
console.log("\u8D44\u6E90".concat(i, "\u4E0E\u5F53\u524D\u516C\u5171\u65F6\u95F4\u6BB5\u65E0\u4EA4\u96C6\uFF0C\u8DF3\u8FC7\u8BE5\u8D44\u6E90"));
|
|
3235
3220
|
return 1; // continue
|
|
3236
3221
|
}
|
|
3237
3222
|
commonSlots = intersections;
|
|
3238
|
-
console.log("\u4E0E\u8D44\u6E90".concat(i, "\u6C42\u4EA4\u96C6\u540E\u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonSlots.map(function (slot) {
|
|
3239
|
-
return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
|
|
3240
|
-
}));
|
|
3241
3223
|
};
|
|
3224
|
+
// 与其他资源的时间段求交集
|
|
3242
3225
|
for (var i = 1; i < allTimeSlots.length; i++) {
|
|
3243
3226
|
if (_loop3()) continue;
|
|
3244
3227
|
}
|
|
@@ -3250,7 +3233,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3250
3233
|
endTime: slot.end.format('HH:mm')
|
|
3251
3234
|
};
|
|
3252
3235
|
});
|
|
3253
|
-
console.log('最终公共时间段:', result);
|
|
3254
3236
|
return result;
|
|
3255
3237
|
}
|
|
3256
3238
|
}, {
|
|
@@ -3360,7 +3342,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3360
3342
|
// 获取该资源类型对应的 form_id
|
|
3361
3343
|
var targetFormId = resourceCodeToFormIdMap[resourceCode];
|
|
3362
3344
|
if (!targetFormId) {
|
|
3363
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u627E\u4E0D\u5230\u5BF9\u5E94\u7684 form_id"));
|
|
3364
3345
|
return {
|
|
3365
3346
|
v: {
|
|
3366
3347
|
success: false,
|
|
@@ -3387,7 +3368,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3387
3368
|
});
|
|
3388
3369
|
});
|
|
3389
3370
|
if (resourcesOfThisType.length === 0) {
|
|
3390
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u627E\u5230\u53EF\u7528\u8D44\u6E90"));
|
|
3391
3371
|
return {
|
|
3392
3372
|
v: {
|
|
3393
3373
|
success: false,
|
|
@@ -3454,24 +3434,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3454
3434
|
// 检查是否有容量问题
|
|
3455
3435
|
if (requiredAmount > totalAvailable) {
|
|
3456
3436
|
hasCapacityIssue = true;
|
|
3457
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " ").concat(isMultipleBooking ? '容量' : '资源数量', "\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredAmount, ", \u603B\u5171 ").concat(totalAvailable));
|
|
3458
3437
|
}
|
|
3459
3438
|
|
|
3460
3439
|
// 为通过检测的商品分配一个公共可用时间段
|
|
3461
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u8D44\u6E90\u65F6\u95F4\u4FE1\u606F:"), resourcesOfThisType.map(function (r) {
|
|
3462
|
-
return {
|
|
3463
|
-
id: r.id,
|
|
3464
|
-
times: r.times.map(function (t) {
|
|
3465
|
-
return "".concat(t.start_at, " - ").concat(t.end_at);
|
|
3466
|
-
})
|
|
3467
|
-
};
|
|
3468
|
-
}));
|
|
3469
3440
|
|
|
3470
3441
|
// 找到所有资源都可用的时间段
|
|
3471
3442
|
var commonTimeSlots = _this16.findCommonAvailableTimeSlots(resourcesOfThisType);
|
|
3472
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonTimeSlots);
|
|
3473
3443
|
if (commonTimeSlots.length === 0) {
|
|
3474
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u516C\u5171\u53EF\u7528\u65F6\u95F4\u6BB5"));
|
|
3475
3444
|
return {
|
|
3476
3445
|
v: {
|
|
3477
3446
|
success: false,
|
|
@@ -3482,7 +3451,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3482
3451
|
|
|
3483
3452
|
// 使用第一个公共可用时间段,但只处理未处理过的商品
|
|
3484
3453
|
var firstCommonSlot = commonTimeSlots[0];
|
|
3485
|
-
console.log("\u4F7F\u7528\u516C\u5171\u65F6\u95F4\u6BB5: ".concat(firstCommonSlot.startTime, " - ").concat(firstCommonSlot.endTime));
|
|
3486
3454
|
items.forEach(function (cartItem) {
|
|
3487
3455
|
// 只处理未处理过的商品,避免重复添加
|
|
3488
3456
|
if (!processedCartItemIds.has(cartItem._id)) {
|
|
@@ -3793,7 +3761,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3793
3761
|
// 获取该资源类型对应的 form_id
|
|
3794
3762
|
var targetFormId = resourceCodeToFormIdMap[resourceCode];
|
|
3795
3763
|
if (!targetFormId) {
|
|
3796
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u627E\u4E0D\u5230\u5BF9\u5E94\u7684 form_id"));
|
|
3797
3764
|
return {
|
|
3798
3765
|
v: {
|
|
3799
3766
|
success: false,
|
|
@@ -3820,7 +3787,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3820
3787
|
});
|
|
3821
3788
|
});
|
|
3822
3789
|
if (resourcesOfThisType.length === 0) {
|
|
3823
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u627E\u5230\u53EF\u7528\u8D44\u6E90"));
|
|
3824
3790
|
return {
|
|
3825
3791
|
v: {
|
|
3826
3792
|
success: false,
|
|
@@ -3887,24 +3853,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3887
3853
|
// 检查是否有容量问题
|
|
3888
3854
|
if (requiredAmount > totalAvailable) {
|
|
3889
3855
|
hasCapacityIssue = true;
|
|
3890
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " ").concat(isMultipleBooking ? '容量' : '资源数量', "\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredAmount, ", \u603B\u5171 ").concat(totalAvailable));
|
|
3891
3856
|
}
|
|
3892
3857
|
|
|
3893
3858
|
// 为通过检测的商品分配一个公共可用时间段
|
|
3894
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u8D44\u6E90\u65F6\u95F4\u4FE1\u606F:"), resourcesOfThisType.map(function (r) {
|
|
3895
|
-
return {
|
|
3896
|
-
id: r.id,
|
|
3897
|
-
times: r.times.map(function (t) {
|
|
3898
|
-
return "".concat(t.start_at, " - ").concat(t.end_at);
|
|
3899
|
-
})
|
|
3900
|
-
};
|
|
3901
|
-
}));
|
|
3902
3859
|
|
|
3903
3860
|
// 找到所有资源都可用的时间段
|
|
3904
3861
|
var commonTimeSlots = _this17.findCommonAvailableTimeSlots(resourcesOfThisType);
|
|
3905
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonTimeSlots);
|
|
3906
3862
|
if (commonTimeSlots.length === 0) {
|
|
3907
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u516C\u5171\u53EF\u7528\u65F6\u95F4\u6BB5"));
|
|
3908
3863
|
return {
|
|
3909
3864
|
v: {
|
|
3910
3865
|
success: false,
|
|
@@ -3915,7 +3870,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3915
3870
|
|
|
3916
3871
|
// 使用第一个公共可用时间段,但只处理未处理过的商品
|
|
3917
3872
|
var firstCommonSlot = commonTimeSlots[0];
|
|
3918
|
-
console.log("\u4F7F\u7528\u516C\u5171\u65F6\u95F4\u6BB5: ".concat(firstCommonSlot.startTime, " - ").concat(firstCommonSlot.endTime));
|
|
3919
3873
|
items.forEach(function (cartItem) {
|
|
3920
3874
|
// 只处理未处理过的商品,避免重复添加
|
|
3921
3875
|
if (!processedCartItemIds.has(cartItem._id)) {
|
|
@@ -4225,12 +4179,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4225
4179
|
while (1) switch (_context29.prev = _context29.next) {
|
|
4226
4180
|
case 0:
|
|
4227
4181
|
startDate = _ref16.startDate, endDate = _ref16.endDate, scheduleIds = _ref16.scheduleIds, resources = _ref16.resources;
|
|
4228
|
-
console.log('appoimentBooking-session-date-getTimeslotsScheduleByDateRange', {
|
|
4229
|
-
startDate: startDate,
|
|
4230
|
-
endDate: endDate,
|
|
4231
|
-
scheduleIds: scheduleIds,
|
|
4232
|
-
resources: resources
|
|
4233
|
-
});
|
|
4234
4182
|
// 生成日期范围内的所有日期
|
|
4235
4183
|
dates = [];
|
|
4236
4184
|
currentDate = dayjs(startDate);
|
|
@@ -4250,7 +4198,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4250
4198
|
});
|
|
4251
4199
|
}
|
|
4252
4200
|
return _context29.abrupt("return", results);
|
|
4253
|
-
case
|
|
4201
|
+
case 8:
|
|
4254
4202
|
case "end":
|
|
4255
4203
|
return _context29.stop();
|
|
4256
4204
|
}
|
|
@@ -293,7 +293,7 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
293
293
|
|
|
294
294
|
// 检查每种资源类型是否有足够的容量
|
|
295
295
|
var _loop = function _loop() {
|
|
296
|
-
var _resourceTypeConfig
|
|
296
|
+
var _resourceTypeConfig;
|
|
297
297
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
298
298
|
formId = _Object$entries$_i[0],
|
|
299
299
|
requiredCapacity = _Object$entries$_i[1];
|
|
@@ -324,12 +324,6 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
324
324
|
_iterator2.f();
|
|
325
325
|
}
|
|
326
326
|
var isMultipleBooking = ((_resourceTypeConfig = resourceTypeConfig) === null || _resourceTypeConfig === void 0 ? void 0 : _resourceTypeConfig.type) === 'multiple';
|
|
327
|
-
console.log("capacity.ts - \u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u914D\u7F6E:"), {
|
|
328
|
-
resourceTypeConfig: resourceTypeConfig,
|
|
329
|
-
type: (_resourceTypeConfig2 = resourceTypeConfig) === null || _resourceTypeConfig2 === void 0 ? void 0 : _resourceTypeConfig2.type,
|
|
330
|
-
isMultipleBooking: isMultipleBooking,
|
|
331
|
-
requiredCapacity: requiredCapacity
|
|
332
|
-
});
|
|
333
327
|
if (isMultipleBooking) {
|
|
334
328
|
// 多个预约:计算总可用容量
|
|
335
329
|
var totalAvailableCapacity = 0;
|
|
@@ -343,9 +337,7 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
343
337
|
totalAvailableCapacity += resource.capacity || 0;
|
|
344
338
|
}
|
|
345
339
|
});
|
|
346
|
-
console.log("capacity.ts - \u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u591A\u4E2A\u9884\u7EA6\u68C0\u67E5: \u603B\u5BB9\u91CF ").concat(totalAvailableCapacity, ", \u9700\u6C42 ").concat(requiredCapacity));
|
|
347
340
|
if (totalAvailableCapacity < requiredCapacity) {
|
|
348
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u5BB9\u91CF\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredCapacity, ", \u53EF\u7528 ").concat(totalAvailableCapacity));
|
|
349
341
|
return {
|
|
350
342
|
v: {
|
|
351
343
|
success: false,
|
|
@@ -366,9 +358,7 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
366
358
|
availableResourceCount++;
|
|
367
359
|
}
|
|
368
360
|
});
|
|
369
|
-
console.log("capacity.ts - \u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u5355\u4E2A\u9884\u7EA6\u68C0\u67E5: \u53EF\u7528\u8D44\u6E90\u6570 ").concat(availableResourceCount, ", \u9700\u6C42 ").concat(requiredCapacity));
|
|
370
361
|
if (availableResourceCount < requiredCapacity) {
|
|
371
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u6570\u91CF\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredCapacity, ", \u53EF\u7528 ").concat(availableResourceCount));
|
|
372
362
|
return {
|
|
373
363
|
v: {
|
|
374
364
|
success: false,
|
|
@@ -101,13 +101,6 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
101
101
|
var isTargetDayToday = targetDay.isSame(currentTime, 'day');
|
|
102
102
|
var fastestTime = null;
|
|
103
103
|
var fastestResources = [];
|
|
104
|
-
console.log('[TimeslotUtils] 查找最快可用资源:', {
|
|
105
|
-
currentTime: currentTime.format('YYYY-MM-DD HH:mm:ss'),
|
|
106
|
-
resourceCount: resources.length,
|
|
107
|
-
currentCapacity: currentCapacity,
|
|
108
|
-
countMap: countMap
|
|
109
|
-
});
|
|
110
|
-
|
|
111
104
|
// 遍历所有资源,找到最快可用的时间点
|
|
112
105
|
var _iterator2 = _createForOfIteratorHelper(resources),
|
|
113
106
|
_step2;
|
|
@@ -122,28 +115,21 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
122
115
|
return dayjs(time.end_at).isAfter(currentTime);
|
|
123
116
|
});
|
|
124
117
|
if (targetDayTimes.length === 0) {
|
|
125
|
-
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(_resource.id, "(").concat(_resource.main_field, ") \u4ECA\u65E5\u65E0\u53EF\u7528\u65F6\u95F4\u6BB5"));
|
|
126
118
|
continue;
|
|
127
119
|
}
|
|
128
120
|
var _iterator4 = _createForOfIteratorHelper(targetDayTimes),
|
|
129
121
|
_step4;
|
|
130
122
|
try {
|
|
131
123
|
var _loop = function _loop() {
|
|
132
|
-
var _time$event_list
|
|
124
|
+
var _time$event_list;
|
|
133
125
|
var time = _step4.value;
|
|
134
126
|
var workStartTime = dayjs(time.start_at);
|
|
135
127
|
var workEndTime = dayjs(time.end_at);
|
|
136
128
|
|
|
137
129
|
// 确定检查的起始时间(当前时间 vs 工作开始时间)
|
|
138
130
|
var nextAvailableTime = isTargetDayToday && currentTime.isAfter(workStartTime) ? currentTime : workStartTime;
|
|
139
|
-
console.log("[TimeslotUtils] \u68C0\u67E5\u8D44\u6E90 ".concat(_resource.id, "(").concat(_resource.main_field, "):"), {
|
|
140
|
-
workTime: "".concat(workStartTime.format('HH:mm'), "-").concat(workEndTime.format('HH:mm')),
|
|
141
|
-
checkStartTime: nextAvailableTime.format('HH:mm:ss'),
|
|
142
|
-
eventCount: ((_time$event_list = time.event_list) === null || _time$event_list === void 0 ? void 0 : _time$event_list.length) || 0
|
|
143
|
-
});
|
|
144
|
-
|
|
145
131
|
// 获取所有影响的预约事件(当前时间之后的)
|
|
146
|
-
var relevantEvents = ((_time$
|
|
132
|
+
var relevantEvents = ((_time$event_list = time.event_list) === null || _time$event_list === void 0 ? void 0 : _time$event_list.filter(function (event) {
|
|
147
133
|
var eventEnd = dayjs(event.end_at);
|
|
148
134
|
return eventEnd.isAfter(nextAvailableTime);
|
|
149
135
|
})) || [];
|
|
@@ -162,20 +148,12 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
162
148
|
var _event = _step5.value;
|
|
163
149
|
var _eventStart = dayjs(_event.start_at);
|
|
164
150
|
var _eventEnd = dayjs(_event.end_at);
|
|
165
|
-
console.log("[TimeslotUtils] \u68C0\u67E5\u4E8B\u4EF6\u51B2\u7A81:", {
|
|
166
|
-
resourceId: _resource.id,
|
|
167
|
-
eventTime: "".concat(_eventStart.format('HH:mm'), "-").concat(_eventEnd.format('HH:mm')),
|
|
168
|
-
checkTime: finalAvailableTime.format('HH:mm:ss'),
|
|
169
|
-
pax: _event.pax || 1
|
|
170
|
-
});
|
|
171
|
-
|
|
172
151
|
// 检查资源类型和容量
|
|
173
152
|
if (_resource.resourceType === 'single' || (_resource.capacity || 1) === 1) {
|
|
174
153
|
// 单人预约资源:检查时间冲突
|
|
175
154
|
if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(resolvedDuration, 'minute'))) {
|
|
176
155
|
// 有冲突,使用事件结束时间
|
|
177
156
|
finalAvailableTime = _eventEnd;
|
|
178
|
-
console.log("[TimeslotUtils] \u53D1\u73B0\u65F6\u95F4\u51B2\u7A81\uFF0C\u8C03\u6574\u5230: ".concat(finalAvailableTime.format('HH:mm:ss')));
|
|
179
157
|
}
|
|
180
158
|
} else {
|
|
181
159
|
// 多人预约资源:检查容量
|
|
@@ -189,7 +167,6 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
189
167
|
if (totalRequiredCapacity > totalCapacity) {
|
|
190
168
|
// 容量不足,使用事件结束时间
|
|
191
169
|
finalAvailableTime = _eventEnd;
|
|
192
|
-
console.log("[TimeslotUtils] \u5BB9\u91CF\u4E0D\u8DB3\uFF0C\u8C03\u6574\u5230: ".concat(finalAvailableTime.format('HH:mm:ss')));
|
|
193
170
|
}
|
|
194
171
|
}
|
|
195
172
|
}
|
|
@@ -202,19 +179,14 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
202
179
|
_iterator5.f();
|
|
203
180
|
}
|
|
204
181
|
if (finalAvailableTime.add(resolvedDuration, 'minute').isAfter(workEndTime)) {
|
|
205
|
-
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(_resource.id, " \u53EF\u7528\u65F6\u95F4\u8D85\u51FA\u5DE5\u4F5C\u65F6\u95F4\uFF0C\u8DF3\u8FC7"));
|
|
206
182
|
return 0; // continue
|
|
207
183
|
}
|
|
208
|
-
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(_resource.id, "(").concat(_resource.main_field, ") \u6700\u5FEB\u53EF\u7528\u65F6\u95F4: ").concat(finalAvailableTime.format('HH:mm:ss')));
|
|
209
|
-
|
|
210
184
|
// 更新最快可用时间和资源
|
|
211
185
|
if (!fastestTime || finalAvailableTime.isBefore(fastestTime)) {
|
|
212
186
|
fastestTime = finalAvailableTime;
|
|
213
187
|
fastestResources = [_resource];
|
|
214
|
-
console.log("[TimeslotUtils] \u66F4\u65B0\u6700\u5FEB\u65F6\u95F4: ".concat(fastestTime.format('HH:mm:ss'), ", \u8D44\u6E90: ").concat(_resource.main_field));
|
|
215
188
|
} else if (finalAvailableTime.isSame(fastestTime)) {
|
|
216
189
|
fastestResources.push(_resource);
|
|
217
|
-
console.log("[TimeslotUtils] \u6DFB\u52A0\u76F8\u540C\u65F6\u95F4\u8D44\u6E90: ".concat(_resource.main_field));
|
|
218
190
|
}
|
|
219
191
|
return 1; // break
|
|
220
192
|
// 每个资源只需要计算一次
|
|
@@ -239,21 +211,16 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
239
211
|
_iterator2.f();
|
|
240
212
|
}
|
|
241
213
|
if (!fastestTime || fastestResources.length === 0) {
|
|
242
|
-
console.log('[TimeslotUtils] 未找到可用资源');
|
|
243
214
|
return null;
|
|
244
215
|
}
|
|
245
|
-
console.log("[TimeslotUtils] \u627E\u5230 ".concat(fastestResources.length, " \u4E2A\u6700\u5FEB\u53EF\u7528\u8D44\u6E90\uFF0C\u65F6\u95F4: ").concat(fastestTime.format('HH:mm:ss')));
|
|
246
|
-
|
|
247
216
|
// 如果只有一个最快可用的资源,直接返回
|
|
248
217
|
if (fastestResources.length === 1) {
|
|
249
|
-
console.log("[TimeslotUtils] \u8FD4\u56DE\u552F\u4E00\u6700\u5FEB\u8D44\u6E90: ".concat(fastestResources[0].main_field));
|
|
250
218
|
return fastestResources[0];
|
|
251
219
|
}
|
|
252
220
|
|
|
253
221
|
// 如果有多个最快可用的资源,选择空闲时间最长的资源
|
|
254
222
|
var selectedResource = fastestResources[0];
|
|
255
223
|
var maxIdleTime = 0;
|
|
256
|
-
console.log("[TimeslotUtils] \u6BD4\u8F83 ".concat(fastestResources.length, " \u4E2A\u8D44\u6E90\u7684\u7A7A\u95F2\u65F6\u95F4:"));
|
|
257
224
|
for (var _i2 = 0, _fastestResources = fastestResources; _i2 < _fastestResources.length; _i2++) {
|
|
258
225
|
var _workingTime$event_li;
|
|
259
226
|
var resource = _fastestResources[_i2];
|
|
@@ -291,19 +258,11 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
291
258
|
} finally {
|
|
292
259
|
_iterator3.f();
|
|
293
260
|
}
|
|
294
|
-
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(resource.id, "(").concat(resource.main_field, "):"), {
|
|
295
|
-
工作结束时间: workEndTime.format('HH:mm'),
|
|
296
|
-
总工作时长: workEndTime.diff(fastestTime, 'minute') + '分钟',
|
|
297
|
-
预约占用时长: workEndTime.diff(fastestTime, 'minute') - totalIdleTime + '分钟',
|
|
298
|
-
实际空闲时长: totalIdleTime + '分钟'
|
|
299
|
-
});
|
|
300
261
|
if (totalIdleTime > maxIdleTime) {
|
|
301
262
|
maxIdleTime = totalIdleTime;
|
|
302
263
|
selectedResource = resource;
|
|
303
|
-
console.log("[TimeslotUtils] \u66F4\u65B0\u6700\u4F73\u9009\u62E9: ".concat(resource.main_field, " (\u7A7A\u95F2").concat(totalIdleTime, "\u5206\u949F)"));
|
|
304
264
|
}
|
|
305
265
|
}
|
|
306
|
-
console.log("[TimeslotUtils] \u6700\u7EC8\u9009\u62E9\u8D44\u6E90: ".concat(selectedResource.main_field, " (\u6700\u957F\u7A7A\u95F2").concat(maxIdleTime, "\u5206\u949F)"));
|
|
307
266
|
return selectedResource;
|
|
308
267
|
}
|
|
309
268
|
|
|
@@ -41,7 +41,7 @@ import { handleGlobalScan, handleCustomerScan, handleUniversalScan } from "./uti
|
|
|
41
41
|
import scanCache from "./utils/scan/scanCache";
|
|
42
42
|
import { formatGlobalScanResult } from "./utils/scan/formatGlobalScan";
|
|
43
43
|
import { applyGlobalScan } from "./utils/scan/applyGlobalScan";
|
|
44
|
-
import { buildCartView } from "./utils/cartView";
|
|
44
|
+
import { buildCartView, isWalkInCustomer } from "./utils/cartView";
|
|
45
45
|
import { buildCacheItemFromCartDetail, buildCacheItemFromDetail, buildRequiresDetailPayload as _buildRequiresDetailPayload, decideAddProduct as decideAddProductUtil, decideAfterDetail as decideAfterDetailUtil, decideAutoClose as decideAutoCloseUtil, getIsEject as getIsEjectUtil, getIsOnlySession as getIsOnlySessionUtil, transformDetailToProductAndBooking as transformDetailToProductAndBookingUtil } from "./utils/addProductDecision";
|
|
46
46
|
import { buildCacheItemFromOrderLine as buildCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildCacheItemFromOrderLine";
|
|
47
47
|
import { buildSessionCatalogStaleInfo, isSessionCatalogDateStale } from "./utils/sessionCatalogStale";
|
|
@@ -237,8 +237,6 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
237
237
|
_context.next = 9;
|
|
238
238
|
return this.configureIdGeneratorFromOpenData();
|
|
239
239
|
case 9:
|
|
240
|
-
console.log('[BookingTicket] 初始化完成');
|
|
241
|
-
case 10:
|
|
242
240
|
case "end":
|
|
243
241
|
return _context.stop();
|
|
244
242
|
}
|
|
@@ -678,7 +676,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
678
676
|
try {
|
|
679
677
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
680
678
|
var item = _step.value;
|
|
681
|
-
var
|
|
679
|
+
var rawCustomerId = item.customer_id;
|
|
680
|
+
if (!rawCustomerId || isWalkInCustomer({
|
|
681
|
+
id: rawCustomerId
|
|
682
|
+
})) {
|
|
683
|
+
continue;
|
|
684
|
+
}
|
|
685
|
+
var topLevelId = Number(rawCustomerId);
|
|
682
686
|
if (Number.isFinite(topLevelId) && topLevelId > 0) {
|
|
683
687
|
return topLevelId;
|
|
684
688
|
}
|
|
@@ -319,7 +319,7 @@ export function transformDetailToProductAndBooking(cacheItem, ctx) {
|
|
|
319
319
|
* 把 cacheItem._extend.other 中的字段 + 顶层运行态拼成 `BaseProductDetailPayload`。
|
|
320
320
|
*/
|
|
321
321
|
function buildBasePayloadFromCacheItem(cacheItem, ctx) {
|
|
322
|
-
var _cacheItem$_extend, _cacheItem$_extend$qu, _cacheItem$_extend2, _cacheItem$product_id, _cacheItem$id, _ref5, _other$product_varian, _extend$skuValue, _extend$_skuValue, _extend$price, _extend$price2, _cacheItem$metadata$s, _cacheItem$metadata, _extend$metadata;
|
|
322
|
+
var _cacheItem$_extend, _cacheItem$_extend$qu, _cacheItem$_extend2, _cacheItem$product_id, _cacheItem$id, _ref5, _other$product_varian, _other$production_cod, _extend$skuValue, _extend$_skuValue, _extend$price, _extend$price2, _cacheItem$metadata$s, _cacheItem$metadata, _extend$metadata;
|
|
323
323
|
var other = (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.other) || {};
|
|
324
324
|
var quantity = (ctx === null || ctx === void 0 ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : (_cacheItem$_extend$qu = cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.quantity) !== null && _cacheItem$_extend$qu !== void 0 ? _cacheItem$_extend$qu : 1;
|
|
325
325
|
var resolvedPid = (_cacheItem$product_id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id) !== null && _cacheItem$product_id !== void 0 ? _cacheItem$product_id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id;
|
|
@@ -329,6 +329,8 @@ function buildBasePayloadFromCacheItem(cacheItem, ctx) {
|
|
|
329
329
|
id: (_cacheItem$id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id) !== null && _cacheItem$id !== void 0 ? _cacheItem$id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id,
|
|
330
330
|
product_id: resolvedPid,
|
|
331
331
|
variant_id: (_ref5 = (_other$product_varian = other === null || other === void 0 ? void 0 : other.product_variant_id) !== null && _other$product_varian !== void 0 ? _other$product_varian : other === null || other === void 0 ? void 0 : other.variant_id) !== null && _ref5 !== void 0 ? _ref5 : 0,
|
|
332
|
+
// SKUOptionsSelection 已按 Product / Variant 解析好主商品编码;显式空串也需保留。
|
|
333
|
+
production_code: (_other$production_cod = other === null || other === void 0 ? void 0 : other.production_code) !== null && _other$production_cod !== void 0 ? _other$production_cod : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.production_code,
|
|
332
334
|
quantity: quantity,
|
|
333
335
|
// 规格弹窗本次选择是 option 权威源,避免目录/旧订单里的空 option 覆盖它。
|
|
334
336
|
product_sku: productSku ? _objectSpread(_objectSpread({}, productSku), {}, {
|
|
@@ -173,26 +173,25 @@ export var searchOrder = /*#__PURE__*/function () {
|
|
|
173
173
|
});
|
|
174
174
|
case 3:
|
|
175
175
|
res = _context4.sent;
|
|
176
|
-
console.log('searchOrder>>>>>>>', res);
|
|
177
176
|
if (!((res === null || res === void 0 ? void 0 : res.code) == 200 && !!(res !== null && res !== void 0 && res.data))) {
|
|
178
|
-
_context4.next =
|
|
177
|
+
_context4.next = 6;
|
|
179
178
|
break;
|
|
180
179
|
}
|
|
181
180
|
return _context4.abrupt("return", {
|
|
182
181
|
searchType: 'order',
|
|
183
182
|
response: res
|
|
184
183
|
});
|
|
185
|
-
case
|
|
184
|
+
case 6:
|
|
186
185
|
throw new Error('没有找到对应的识别码');
|
|
187
|
-
case
|
|
188
|
-
_context4.prev =
|
|
186
|
+
case 9:
|
|
187
|
+
_context4.prev = 9;
|
|
189
188
|
_context4.t0 = _context4["catch"](0);
|
|
190
189
|
throw _context4.t0;
|
|
191
|
-
case
|
|
190
|
+
case 12:
|
|
192
191
|
case "end":
|
|
193
192
|
return _context4.stop();
|
|
194
193
|
}
|
|
195
|
-
}, _callee4, null, [[0,
|
|
194
|
+
}, _callee4, null, [[0, 9]]);
|
|
196
195
|
}));
|
|
197
196
|
return function searchOrder(_x7, _x8) {
|
|
198
197
|
return _ref4.apply(this, arguments);
|