@pisell/pisellos 2.1.134 → 2.1.136
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/modules/Cart/utils/cartProduct.js +1 -1
- package/dist/modules/Order/utils.js +15 -12
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/ScanOrder/index.js +52 -49
- package/dist/solution/ScanOrder/utils.js +5 -5
- package/lib/modules/Cart/utils/cartProduct.js +1 -1
- package/lib/modules/Order/utils.js +1 -12
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/ScanOrder/index.js +15 -12
- package/lib/solution/ScanOrder/utils.js +2 -2
- package/package.json +1 -1
|
@@ -350,7 +350,7 @@ export var formatBundleToOrigin = function formatBundleToOrigin(bundle) {
|
|
|
350
350
|
option: formatOptionsToOrigin(getBundleValueByKey('option')),
|
|
351
351
|
discount_list: d.discount_list,
|
|
352
352
|
"bundle_selling_price": d === null || d === void 0 ? void 0 : d.price,
|
|
353
|
-
"custom_price": d
|
|
353
|
+
// "custom_price": d?.price,
|
|
354
354
|
metadata: {
|
|
355
355
|
custom_product_bundle_map_id: d._id,
|
|
356
356
|
product_discount_difference: product_discount_difference
|
|
@@ -334,13 +334,16 @@ function toBundleCustomPriceString(value) {
|
|
|
334
334
|
function formatSubmitBundleItems(bundle) {
|
|
335
335
|
if (!Array.isArray(bundle)) return [];
|
|
336
336
|
return bundle.map(function (b) {
|
|
337
|
-
var _rawBundle$bundle_sel, _rawBundle$price_type,
|
|
337
|
+
var _rawBundle$bundle_sel, _rawBundle$price_type, _rawBundle$surcharge_, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$extension_, _rawBundle$extension_2, _rawBundle$price_type2, _ref5, _rawBundle$custom_pri;
|
|
338
338
|
var rawBundle = b && _typeof(b) === 'object' ? b : {};
|
|
339
339
|
var existedMetadata = rawBundle.metadata && _typeof(rawBundle.metadata) === 'object' ? rawBundle.metadata : {};
|
|
340
340
|
var sellingPriceNum = toBundleNumber((_rawBundle$bundle_sel = rawBundle.bundle_selling_price) !== null && _rawBundle$bundle_sel !== void 0 ? _rawBundle$bundle_sel : rawBundle.price, 0);
|
|
341
341
|
var priceNum = toBundleNumber(rawBundle.price, sellingPriceNum);
|
|
342
342
|
var priceType = (_rawBundle$price_type = rawBundle.price_type) !== null && _rawBundle$price_type !== void 0 ? _rawBundle$price_type : '';
|
|
343
|
-
|
|
343
|
+
// const customPriceStr = toBundleCustomPriceString(
|
|
344
|
+
// rawBundle.custom_price ?? rawBundle.bundle_selling_price ?? rawBundle.price,
|
|
345
|
+
// );
|
|
346
|
+
|
|
344
347
|
var relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
|
|
345
348
|
var surchargeFee = toBundleNumber((_rawBundle$surcharge_ = rawBundle.surcharge_fee) !== null && _rawBundle$surcharge_ !== void 0 ? _rawBundle$surcharge_ : existedMetadata.surcharge_fee, 0);
|
|
346
349
|
var productDiscountDifference = toBundleNumber(existedMetadata.product_discount_difference, 0);
|
|
@@ -354,8 +357,8 @@ function formatSubmitBundleItems(bundle) {
|
|
|
354
357
|
price: priceNum,
|
|
355
358
|
price_type: priceType,
|
|
356
359
|
price_type_ext: (_rawBundle$price_type2 = rawBundle.price_type_ext) !== null && _rawBundle$price_type2 !== void 0 ? _rawBundle$price_type2 : '',
|
|
357
|
-
custom_price: customPriceStr,
|
|
358
|
-
custom_price_type: (
|
|
360
|
+
// custom_price: customPriceStr,
|
|
361
|
+
custom_price_type: (_ref5 = (_rawBundle$custom_pri = rawBundle.custom_price_type) !== null && _rawBundle$custom_pri !== void 0 ? _rawBundle$custom_pri : priceType) !== null && _ref5 !== void 0 ? _ref5 : '',
|
|
359
362
|
bundle_selling_price: sellingPriceNum,
|
|
360
363
|
option: formatSubmitOptionItems(rawBundle.option),
|
|
361
364
|
bundle_group_id: rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.group_id,
|
|
@@ -517,7 +520,7 @@ export function createDefaultTempOrder(params) {
|
|
|
517
520
|
};
|
|
518
521
|
}
|
|
519
522
|
export function buildSubmitPayload(params) {
|
|
520
|
-
var _ref7, _ref8,
|
|
523
|
+
var _ref6, _ref7, _ref8, _tempOrder$is_price_i, _tempOrder$is_deposit;
|
|
521
524
|
var tempOrder = params.tempOrder,
|
|
522
525
|
cacheId = params.cacheId,
|
|
523
526
|
_params$now = params.now,
|
|
@@ -565,10 +568,10 @@ export function buildSubmitPayload(params) {
|
|
|
565
568
|
var payload = _objectSpread(_objectSpread({}, tempOrderRest), {}, {
|
|
566
569
|
platform: normalizeSubmitPlatform(platform !== null && platform !== void 0 ? platform : tempOrder.platform),
|
|
567
570
|
request_unique_idempotency_token: cacheId,
|
|
568
|
-
type: (
|
|
569
|
-
business_code: (
|
|
571
|
+
type: (_ref6 = type !== null && type !== void 0 ? type : tempOrder.type) !== null && _ref6 !== void 0 ? _ref6 : 'table-order',
|
|
572
|
+
business_code: (_ref7 = businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code) !== null && _ref7 !== void 0 ? _ref7 : 'table-order',
|
|
570
573
|
sales_channel: tempOrder.sales_channel || 'my_pisel',
|
|
571
|
-
order_sales_channel: (
|
|
574
|
+
order_sales_channel: (_ref8 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref8 !== void 0 ? _ref8 : 'online_store',
|
|
572
575
|
status: tempOrder.status || 'normal',
|
|
573
576
|
payment_status: tempOrder.payment_status || 'payment_processing',
|
|
574
577
|
// shipping_status: tempOrder.shipping_status || 'unfulfilled',
|
|
@@ -592,10 +595,10 @@ export function buildSubmitPayload(params) {
|
|
|
592
595
|
// holder: tempOrder.holder || null,
|
|
593
596
|
// summary,
|
|
594
597
|
metadata: function () {
|
|
595
|
-
var
|
|
596
|
-
_collectPax =
|
|
597
|
-
_tableOccupancyDuration =
|
|
598
|
-
rest = _objectWithoutProperties(
|
|
598
|
+
var _ref9 = tempOrder.metadata || {},
|
|
599
|
+
_collectPax = _ref9.collect_pax,
|
|
600
|
+
_tableOccupancyDuration = _ref9.table_occupancy_duration,
|
|
601
|
+
rest = _objectWithoutProperties(_ref9, _excluded3);
|
|
599
602
|
return _objectSpread({}, rest);
|
|
600
603
|
}(),
|
|
601
604
|
products: (tempOrder.products || []).map(function (product) {
|
|
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
310
310
|
date: string;
|
|
311
311
|
status: string;
|
|
312
312
|
week: string;
|
|
313
|
-
weekNum: 0 |
|
|
313
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
314
314
|
}[]>;
|
|
315
315
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
316
316
|
private getScheduleDataByIds;
|
|
@@ -357,7 +357,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
357
357
|
};
|
|
358
358
|
setOtherData(key: string, value: any): void;
|
|
359
359
|
getOtherData(key: string): any;
|
|
360
|
-
getProductTypeById(id: number): Promise<"
|
|
360
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
361
361
|
/**
|
|
362
362
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
363
363
|
*
|
|
@@ -2462,7 +2462,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2462
2462
|
key: "checkResourceAvailable",
|
|
2463
2463
|
value: function () {
|
|
2464
2464
|
var _checkResourceAvailable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(resourceId, hasOrderId) {
|
|
2465
|
-
var _this$
|
|
2465
|
+
var _this$otherParams$bus, _this$otherParams10, _this$otherParams$cha, _this$otherParams11, _this$otherParams12, _this$otherParams12$g, _occupyDetail$form_re, _occupyDetail$form_re2, _this$otherParams13, _this$store$order5, _this$store$order7, _this$store$order7$ge, _this$otherParams14, businessCode, channel, openDataTarget, openData, dineInConfig, closedBehaviorValue, closedMessage, basicUnavailableMessage, pauseMessage, makeShopClosed, operatingHourIds, outsideOperatingHours, scheduleList, now, tempOrder, reservationLinkIds, pendingRequestEntryPax, pendingRequestPaxMin, pendingRequestPaxMax, reservationProductList, scheduleDate, scheduleDatetime, loaded, occupancyMinutes, paxBounds, occupyDetail, resourceSelectType, resourceState, availabilityInfo, _this$store$order6, _res$data, res, entryPaxNumber, lastOrderInfo, historicalItems;
|
|
2466
2466
|
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2467
2467
|
while (1) switch (_context36.prev = _context36.next) {
|
|
2468
2468
|
case 0:
|
|
@@ -2470,25 +2470,28 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2470
2470
|
resourceId: resourceId
|
|
2471
2471
|
});
|
|
2472
2472
|
_context36.prev = 1;
|
|
2473
|
-
|
|
2474
|
-
|
|
2473
|
+
businessCode = String((_this$otherParams$bus = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : '').trim();
|
|
2474
|
+
channel = String((_this$otherParams$cha = (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : '').trim();
|
|
2475
|
+
openDataTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : 'dine_in+scan_to_order';
|
|
2476
|
+
_context36.next = 7;
|
|
2477
|
+
return (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 || (_this$otherParams12$g = _this$otherParams12.getOpenData) === null || _this$otherParams12$g === void 0 ? void 0 : _this$otherParams12$g.call(_this$otherParams12, {
|
|
2475
2478
|
scope: 'board',
|
|
2476
|
-
target:
|
|
2479
|
+
target: openDataTarget,
|
|
2477
2480
|
section_code: ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow']
|
|
2478
2481
|
});
|
|
2479
|
-
case
|
|
2482
|
+
case 7:
|
|
2480
2483
|
openData = _context36.sent;
|
|
2481
2484
|
if (!((openData === null || openData === void 0 ? void 0 : openData.status) === false)) {
|
|
2482
|
-
_context36.next =
|
|
2485
|
+
_context36.next = 10;
|
|
2483
2486
|
break;
|
|
2484
2487
|
}
|
|
2485
2488
|
throw new Error((openData === null || openData === void 0 ? void 0 : openData.message) || '获取店铺配置失败');
|
|
2486
|
-
case
|
|
2489
|
+
case 10:
|
|
2487
2490
|
dineInConfig = (openData === null || openData === void 0 ? void 0 : openData.data) || {};
|
|
2488
2491
|
this.otherParams.dineInConfig = dineInConfig;
|
|
2489
|
-
_context36.next =
|
|
2492
|
+
_context36.next = 14;
|
|
2490
2493
|
return this.syncItemRuleConfigsFromDineInConfig(dineInConfig);
|
|
2491
|
-
case
|
|
2494
|
+
case 14:
|
|
2492
2495
|
closedBehaviorValue = dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_behavior'];
|
|
2493
2496
|
closedMessage = (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_message']) || (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.message']) || (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.closed_message']);
|
|
2494
2497
|
basicUnavailableMessage = (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.unavailable_message']) || closedMessage;
|
|
@@ -2505,21 +2508,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2505
2508
|
};
|
|
2506
2509
|
}; // 1. 基础开关 basic.enable 关闭
|
|
2507
2510
|
if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.enable']) === false)) {
|
|
2508
|
-
_context36.next =
|
|
2511
|
+
_context36.next = 21;
|
|
2509
2512
|
break;
|
|
2510
2513
|
}
|
|
2511
2514
|
return _context36.abrupt("return", makeShopClosed(basicUnavailableMessage));
|
|
2512
|
-
case
|
|
2515
|
+
case 21:
|
|
2513
2516
|
if (!toBoolean(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.paused'])) {
|
|
2514
|
-
_context36.next =
|
|
2517
|
+
_context36.next = 24;
|
|
2515
2518
|
break;
|
|
2516
2519
|
}
|
|
2517
2520
|
if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.pause_behavior']) === 'hide_all')) {
|
|
2518
|
-
_context36.next =
|
|
2521
|
+
_context36.next = 24;
|
|
2519
2522
|
break;
|
|
2520
2523
|
}
|
|
2521
2524
|
return _context36.abrupt("return", makeShopClosed(pauseMessage));
|
|
2522
|
-
case
|
|
2525
|
+
case 24:
|
|
2523
2526
|
// 3. 营业时间 operating_hours 闸门
|
|
2524
2527
|
operatingHourIds = Array.isArray(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.operating_hours']) ? dineInConfig['availability.operating_hours'].map(function (id) {
|
|
2525
2528
|
return Number(id);
|
|
@@ -2535,27 +2538,27 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2535
2538
|
}
|
|
2536
2539
|
}
|
|
2537
2540
|
if (!(outsideOperatingHours && closedBehaviorValue !== 'show_menu_disabled')) {
|
|
2538
|
-
_context36.next =
|
|
2541
|
+
_context36.next = 29;
|
|
2539
2542
|
break;
|
|
2540
2543
|
}
|
|
2541
2544
|
return _context36.abrupt("return", makeShopClosed(closedMessage, closedBehaviorValue));
|
|
2542
|
-
case
|
|
2545
|
+
case 29:
|
|
2543
2546
|
// Step1: 先加载预约规则商品,拿到 enabledReservationRuleProducts 与容量附加信息
|
|
2544
2547
|
// (resourceSelectType 需要基于这些商品 + 占用接口的 form_id 计算,故必须前置)
|
|
2545
2548
|
tempOrder = this.ensureTempOrder();
|
|
2546
2549
|
reservationLinkIds = collectLinkProductIdsFromReservationRules(dineInConfig['fulfillment.enabled_resource_rules']);
|
|
2547
2550
|
if (!(reservationLinkIds.length === 0)) {
|
|
2548
|
-
_context36.next =
|
|
2551
|
+
_context36.next = 35;
|
|
2549
2552
|
break;
|
|
2550
2553
|
}
|
|
2551
2554
|
this.enabledReservationRuleProducts = [];
|
|
2552
|
-
_context36.next =
|
|
2555
|
+
_context36.next = 46;
|
|
2553
2556
|
break;
|
|
2554
|
-
case
|
|
2557
|
+
case 35:
|
|
2555
2558
|
tempOrder.metadata = _objectSpread({}, tempOrder.metadata || {});
|
|
2556
2559
|
delete tempOrder.metadata.table_occupancy_duration;
|
|
2557
2560
|
reservationProductList = new ProductList("".concat(this.name, "_reservationEnabledRules"), this.defaultVersion);
|
|
2558
|
-
_context36.next =
|
|
2561
|
+
_context36.next = 40;
|
|
2559
2562
|
return reservationProductList.initialize(this.core, {
|
|
2560
2563
|
store: {
|
|
2561
2564
|
list: [],
|
|
@@ -2567,17 +2570,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2567
2570
|
cacheId: this.cacheId
|
|
2568
2571
|
})
|
|
2569
2572
|
});
|
|
2570
|
-
case
|
|
2573
|
+
case 40:
|
|
2571
2574
|
scheduleDate = dayjs().format('YYYY-MM-DD');
|
|
2572
2575
|
scheduleDatetime = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
2573
|
-
_context36.next =
|
|
2576
|
+
_context36.next = 44;
|
|
2574
2577
|
return reservationProductList.loadProducts({
|
|
2575
2578
|
product_ids: reservationLinkIds,
|
|
2576
2579
|
schedule_date: scheduleDate,
|
|
2577
2580
|
schedule_datetime: scheduleDatetime,
|
|
2578
2581
|
cacheId: this.cacheId
|
|
2579
2582
|
});
|
|
2580
|
-
case
|
|
2583
|
+
case 44:
|
|
2581
2584
|
loaded = _context36.sent;
|
|
2582
2585
|
if (Array.isArray(loaded)) {
|
|
2583
2586
|
this.enabledReservationRuleProducts = loaded;
|
|
@@ -2602,10 +2605,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2602
2605
|
}
|
|
2603
2606
|
});
|
|
2604
2607
|
}
|
|
2605
|
-
case
|
|
2606
|
-
_context36.next =
|
|
2608
|
+
case 46:
|
|
2609
|
+
_context36.next = 48;
|
|
2607
2610
|
return this.fetchResourceOccupyDetailByResourceId(resourceId);
|
|
2608
|
-
case
|
|
2611
|
+
case 48:
|
|
2609
2612
|
occupyDetail = _context36.sent;
|
|
2610
2613
|
// Step3: 结合预约规则商品的 product_resource.resources 与占用接口返回的 form_id,
|
|
2611
2614
|
// 计算当前桌台的 resourceSelectType(single/multiple/capacity)
|
|
@@ -2639,30 +2642,30 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2639
2642
|
} : {}), this.store.resource.requestPaxMax !== undefined ? {
|
|
2640
2643
|
requestPaxMax: this.store.resource.requestPaxMax
|
|
2641
2644
|
} : {});
|
|
2642
|
-
tempOrder.relation_id = resourceId || ((_this$
|
|
2645
|
+
tempOrder.relation_id = resourceId || ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.relation_id);
|
|
2643
2646
|
tempOrder.table_form_id = resourceState.tableFormId;
|
|
2644
2647
|
tempOrder.resource_id = resourceId;
|
|
2645
2648
|
(_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || _this$store$order5.persistTempOrder();
|
|
2646
2649
|
|
|
2647
2650
|
// 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
|
|
2648
2651
|
if (!(availabilityInfo.mode === 'idle')) {
|
|
2649
|
-
_context36.next =
|
|
2652
|
+
_context36.next = 63;
|
|
2650
2653
|
break;
|
|
2651
2654
|
}
|
|
2652
|
-
_context36.next =
|
|
2655
|
+
_context36.next = 63;
|
|
2653
2656
|
return this.addNewOrder();
|
|
2654
|
-
case
|
|
2657
|
+
case 63:
|
|
2655
2658
|
// 如果是加单模式,tempOrder 里 需要记录 lastOrderId,提交的时候走加单接口
|
|
2656
2659
|
if (availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code') {
|
|
2657
2660
|
tempOrder.order_id = resourceState.lastOrderId;
|
|
2658
2661
|
}
|
|
2659
2662
|
if (!tempOrder.order_id) {
|
|
2660
|
-
_context36.next =
|
|
2663
|
+
_context36.next = 72;
|
|
2661
2664
|
break;
|
|
2662
2665
|
}
|
|
2663
|
-
_context36.next =
|
|
2666
|
+
_context36.next = 67;
|
|
2664
2667
|
return (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getOrderInfoByRemote(tempOrder.order_id);
|
|
2665
|
-
case
|
|
2668
|
+
case 67:
|
|
2666
2669
|
res = _context36.sent;
|
|
2667
2670
|
// 找到下单的时候输入的 entryPaxNumber
|
|
2668
2671
|
entryPaxNumber = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.bookings) === null || _res$data === void 0 || (_res$data = _res$data.find(function (p) {
|
|
@@ -2670,12 +2673,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2670
2673
|
return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
|
|
2671
2674
|
})) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
|
|
2672
2675
|
if (!entryPaxNumber) {
|
|
2673
|
-
_context36.next =
|
|
2676
|
+
_context36.next = 72;
|
|
2674
2677
|
break;
|
|
2675
2678
|
}
|
|
2676
|
-
_context36.next =
|
|
2679
|
+
_context36.next = 72;
|
|
2677
2680
|
return this.setEntryPaxNumber(entryPaxNumber);
|
|
2678
|
-
case
|
|
2681
|
+
case 72:
|
|
2679
2682
|
lastOrderInfo = (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7$ge = _this$store$order7.getLastOrderInfo) === null || _this$store$order7$ge === void 0 ? void 0 : _this$store$order7$ge.call(_this$store$order7);
|
|
2680
2683
|
historicalItems = hasOrderId && Array.isArray(lastOrderInfo === null || lastOrderInfo === void 0 ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce(function (acc, p) {
|
|
2681
2684
|
if (typeof (p === null || p === void 0 ? void 0 : p.product_id) !== 'number') return acc;
|
|
@@ -2687,13 +2690,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2687
2690
|
} : {}));
|
|
2688
2691
|
return acc;
|
|
2689
2692
|
}, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
|
|
2690
|
-
_context36.next =
|
|
2693
|
+
_context36.next = 76;
|
|
2691
2694
|
return this.setItemRuleRuntimeConfig({
|
|
2692
|
-
serviceType: (_this$
|
|
2695
|
+
serviceType: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.businessCode,
|
|
2693
2696
|
submissionIndex: hasOrderId ? 1 : 0,
|
|
2694
2697
|
historicalItems: historicalItems
|
|
2695
2698
|
});
|
|
2696
|
-
case
|
|
2699
|
+
case 76:
|
|
2697
2700
|
// operating_hours 超出营业时段 + closed_behavior=show_menu_disabled:
|
|
2698
2701
|
// 允许浏览商品但 UI 层需拦截“下一步”,这里覆盖最终 mode 并回传错误提示
|
|
2699
2702
|
if (outsideOperatingHours && closedBehaviorValue === 'show_menu_disabled') {
|
|
@@ -2715,18 +2718,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2715
2718
|
isFull: resourceState.isFull
|
|
2716
2719
|
});
|
|
2717
2720
|
return _context36.abrupt("return", availabilityInfo);
|
|
2718
|
-
case
|
|
2719
|
-
_context36.prev =
|
|
2721
|
+
case 81:
|
|
2722
|
+
_context36.prev = 81;
|
|
2720
2723
|
_context36.t0 = _context36["catch"](1);
|
|
2721
2724
|
this.logMethodError('checkResourceAvailable', _context36.t0.message, {
|
|
2722
2725
|
resourceId: resourceId
|
|
2723
2726
|
});
|
|
2724
2727
|
throw _context36.t0;
|
|
2725
|
-
case
|
|
2728
|
+
case 85:
|
|
2726
2729
|
case "end":
|
|
2727
2730
|
return _context36.stop();
|
|
2728
2731
|
}
|
|
2729
|
-
}, _callee36, this, [[1,
|
|
2732
|
+
}, _callee36, this, [[1, 81]]);
|
|
2730
2733
|
}));
|
|
2731
2734
|
function checkResourceAvailable(_x18, _x19) {
|
|
2732
2735
|
return _checkResourceAvailable.apply(this, arguments);
|
|
@@ -2769,14 +2772,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2769
2772
|
key: "getProductList",
|
|
2770
2773
|
value: function () {
|
|
2771
2774
|
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
2772
|
-
var _this$
|
|
2775
|
+
var _this$otherParams15;
|
|
2773
2776
|
var menu_list_ids, _this$store$products, res, formattedRes;
|
|
2774
2777
|
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
2775
2778
|
while (1) switch (_context38.prev = _context38.next) {
|
|
2776
2779
|
case 0:
|
|
2777
2780
|
this.logMethodStart('getProductList');
|
|
2778
2781
|
// 可以直接通过配置里的 menu 读取
|
|
2779
|
-
menu_list_ids = ((_this$
|
|
2782
|
+
menu_list_ids = ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 || (_this$otherParams15 = _this$otherParams15.dineInConfig) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15['menu.associated_menus'].map(function (n) {
|
|
2780
2783
|
return Number(n.value);
|
|
2781
2784
|
})) || [];
|
|
2782
2785
|
_context38.prev = 2;
|
|
@@ -2979,9 +2982,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2979
2982
|
}, {
|
|
2980
2983
|
key: "getFulfillmentModes",
|
|
2981
2984
|
value: function getFulfillmentModes() {
|
|
2982
|
-
var _this$
|
|
2985
|
+
var _this$otherParams16;
|
|
2983
2986
|
this.logMethodStart('getFulfillmentModes');
|
|
2984
|
-
var dineInConfig = ((_this$
|
|
2987
|
+
var dineInConfig = ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.dineInConfig) || {};
|
|
2985
2988
|
var result = {
|
|
2986
2989
|
enablePickup: Boolean(dineInConfig['fulfillment.enable_pickup']),
|
|
2987
2990
|
enableTableService: Boolean(dineInConfig['fulfillment.enable_table_service'])
|
|
@@ -2995,9 +2998,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2995
2998
|
}, {
|
|
2996
2999
|
key: "checkManualPickupRef",
|
|
2997
3000
|
value: function checkManualPickupRef() {
|
|
2998
|
-
var _this$
|
|
3001
|
+
var _this$otherParams17;
|
|
2999
3002
|
this.logMethodStart('checkManualPickupRef');
|
|
3000
|
-
var dineInConfig = ((_this$
|
|
3003
|
+
var dineInConfig = ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.dineInConfig) || {};
|
|
3001
3004
|
var refMode = dineInConfig['fulfillment.fulfillment_ref_mode'];
|
|
3002
3005
|
var manualInputType = dineInConfig['fulfillment.manual_input_type'];
|
|
3003
3006
|
var enabled = refMode === 'manual_input';
|
|
@@ -483,10 +483,10 @@ export function normalizeOrderProduct(product) {
|
|
|
483
483
|
metadata.unique_identification_number = resolvedIdentityKey;
|
|
484
484
|
}
|
|
485
485
|
var normalizedBundle = (product.product_bundle || []).map(function (item) {
|
|
486
|
-
var _ref2, _item$bundle_selling_
|
|
486
|
+
var _ref2, _item$bundle_selling_;
|
|
487
487
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
488
|
-
bundle_selling_price: (_ref2 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref2 !== void 0 ? _ref2 : '0.00'
|
|
489
|
-
custom_price:
|
|
488
|
+
bundle_selling_price: (_ref2 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref2 !== void 0 ? _ref2 : '0.00'
|
|
489
|
+
// custom_price: item.custom_price ?? item.bundle_selling_price ?? item.price ?? '0.00',
|
|
490
490
|
});
|
|
491
491
|
});
|
|
492
492
|
var normalizedOptions = product.product_option_item || [];
|
|
@@ -506,7 +506,7 @@ export function normalizeOrderProduct(product) {
|
|
|
506
506
|
var variantPrice = Array.isArray(variantList) ? (_variantList$find = variantList.find(function (v) {
|
|
507
507
|
return Number(v === null || v === void 0 ? void 0 : v.id) === variantId;
|
|
508
508
|
})) === null || _variantList$find === void 0 ? void 0 : _variantList$find.price : undefined;
|
|
509
|
-
var resolvedSource = function (_product$_origin, _product$_origin2,
|
|
509
|
+
var resolvedSource = function (_product$_origin, _product$_origin2, _ref3, _product$original_pri) {
|
|
510
510
|
if (metadata.source_product_price !== undefined) {
|
|
511
511
|
return String(metadata.source_product_price);
|
|
512
512
|
}
|
|
@@ -524,7 +524,7 @@ export function normalizeOrderProduct(product) {
|
|
|
524
524
|
if (!isV2 && metadata.main_product_original_price !== undefined) {
|
|
525
525
|
return String(metadata.main_product_original_price);
|
|
526
526
|
}
|
|
527
|
-
return (
|
|
527
|
+
return (_ref3 = (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : product.selling_price) !== null && _ref3 !== void 0 ? _ref3 : '0.00';
|
|
528
528
|
}();
|
|
529
529
|
|
|
530
530
|
// 2) 派生 main_product_original_price(含 option、不含折扣)
|
|
@@ -313,7 +313,7 @@ var formatBundleToOrigin = (bundle) => {
|
|
|
313
313
|
option: formatOptionsToOrigin(getBundleValueByKey("option")),
|
|
314
314
|
discount_list: d.discount_list,
|
|
315
315
|
"bundle_selling_price": d == null ? void 0 : d.price,
|
|
316
|
-
"custom_price": d
|
|
316
|
+
// "custom_price": d?.price,
|
|
317
317
|
metadata: {
|
|
318
318
|
custom_product_bundle_map_id: d._id,
|
|
319
319
|
product_discount_difference
|
|
@@ -246,14 +246,6 @@ function toBundleNumber(value, fallback = 0) {
|
|
|
246
246
|
const parsed = Number(value);
|
|
247
247
|
return Number.isFinite(parsed) ? parsed : fallback;
|
|
248
248
|
}
|
|
249
|
-
function toBundleCustomPriceString(value) {
|
|
250
|
-
const parsed = Number(value);
|
|
251
|
-
if (Number.isFinite(parsed))
|
|
252
|
-
return parsed.toFixed(2);
|
|
253
|
-
if (value === null || value === void 0 || value === "")
|
|
254
|
-
return "0.00";
|
|
255
|
-
return String(value);
|
|
256
|
-
}
|
|
257
249
|
function formatSubmitBundleItems(bundle) {
|
|
258
250
|
if (!Array.isArray(bundle))
|
|
259
251
|
return [];
|
|
@@ -266,9 +258,6 @@ function formatSubmitBundleItems(bundle) {
|
|
|
266
258
|
);
|
|
267
259
|
const priceNum = toBundleNumber(rawBundle.price, sellingPriceNum);
|
|
268
260
|
const priceType = rawBundle.price_type ?? "";
|
|
269
|
-
const customPriceStr = toBundleCustomPriceString(
|
|
270
|
-
rawBundle.custom_price ?? rawBundle.bundle_selling_price ?? rawBundle.price
|
|
271
|
-
);
|
|
272
261
|
const relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
|
|
273
262
|
const surchargeFee = toBundleNumber(
|
|
274
263
|
rawBundle.surcharge_fee ?? existedMetadata.surcharge_fee,
|
|
@@ -289,7 +278,7 @@ function formatSubmitBundleItems(bundle) {
|
|
|
289
278
|
price: priceNum,
|
|
290
279
|
price_type: priceType,
|
|
291
280
|
price_type_ext: rawBundle.price_type_ext ?? "",
|
|
292
|
-
custom_price: customPriceStr,
|
|
281
|
+
// custom_price: customPriceStr,
|
|
293
282
|
custom_price_type: rawBundle.custom_price_type ?? priceType ?? "",
|
|
294
283
|
bundle_selling_price: sellingPriceNum,
|
|
295
284
|
option: formatSubmitOptionItems(rawBundle.option),
|
|
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
310
310
|
date: string;
|
|
311
311
|
status: string;
|
|
312
312
|
week: string;
|
|
313
|
-
weekNum: 0 |
|
|
313
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
314
314
|
}[]>;
|
|
315
315
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
316
316
|
private getScheduleDataByIds;
|
|
@@ -357,7 +357,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
357
357
|
};
|
|
358
358
|
setOtherData(key: string, value: any): void;
|
|
359
359
|
getOtherData(key: string): any;
|
|
360
|
-
getProductTypeById(id: number): Promise<"
|
|
360
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
361
361
|
/**
|
|
362
362
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
363
363
|
*
|
|
@@ -1426,14 +1426,17 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1426
1426
|
// 通过 resource_id + 店铺配置
|
|
1427
1427
|
// hasOrderId 表示 url 上是否有 orderid,如果是的话,后续的流程会走加单
|
|
1428
1428
|
async checkResourceAvailable(resourceId, hasOrderId) {
|
|
1429
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
1429
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
1430
1430
|
this.logMethodStart("checkResourceAvailable", {
|
|
1431
1431
|
resourceId
|
|
1432
1432
|
});
|
|
1433
1433
|
try {
|
|
1434
|
-
const
|
|
1434
|
+
const businessCode = String(((_a = this.otherParams) == null ? void 0 : _a.businessCode) ?? "").trim();
|
|
1435
|
+
const channel = String(((_b = this.otherParams) == null ? void 0 : _b.channel) ?? "").trim();
|
|
1436
|
+
const openDataTarget = businessCode && channel ? `${businessCode}+${channel}` : "dine_in+scan_to_order";
|
|
1437
|
+
const openData = await ((_d = (_c = this.otherParams) == null ? void 0 : _c.getOpenData) == null ? void 0 : _d.call(_c, {
|
|
1435
1438
|
scope: "board",
|
|
1436
|
-
target:
|
|
1439
|
+
target: openDataTarget,
|
|
1437
1440
|
section_code: ["basic", "fulfillment", "reservation", "sale", "menu", "availability", "workflow"]
|
|
1438
1441
|
}));
|
|
1439
1442
|
if ((openData == null ? void 0 : openData.status) === false) {
|
|
@@ -1560,16 +1563,16 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1560
1563
|
table_form_id: resourceState.tableFormId,
|
|
1561
1564
|
deskmate_valid: resourceState.deskmate_valid,
|
|
1562
1565
|
table_form_record: resourceState.table_form_record,
|
|
1563
|
-
policy: (
|
|
1564
|
-
partyroom_booking: (
|
|
1566
|
+
policy: (_e = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _e.policy,
|
|
1567
|
+
partyroom_booking: (_f = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _f.partyroom_booking,
|
|
1565
1568
|
...this.store.resource.requestEntryPax !== void 0 ? { requestEntryPax: this.store.resource.requestEntryPax } : {},
|
|
1566
1569
|
...this.store.resource.requestPaxMin !== void 0 ? { requestPaxMin: this.store.resource.requestPaxMin } : {},
|
|
1567
1570
|
...this.store.resource.requestPaxMax !== void 0 ? { requestPaxMax: this.store.resource.requestPaxMax } : {}
|
|
1568
1571
|
};
|
|
1569
|
-
tempOrder.relation_id = resourceId || ((
|
|
1572
|
+
tempOrder.relation_id = resourceId || ((_g = this.otherParams) == null ? void 0 : _g.relation_id);
|
|
1570
1573
|
tempOrder.table_form_id = resourceState.tableFormId;
|
|
1571
1574
|
tempOrder.resource_id = resourceId;
|
|
1572
|
-
(
|
|
1575
|
+
(_h = this.store.order) == null ? void 0 : _h.persistTempOrder();
|
|
1573
1576
|
if (availabilityInfo.mode === "idle") {
|
|
1574
1577
|
await this.addNewOrder();
|
|
1575
1578
|
}
|
|
@@ -1577,16 +1580,16 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1577
1580
|
tempOrder.order_id = resourceState.lastOrderId;
|
|
1578
1581
|
}
|
|
1579
1582
|
if (tempOrder.order_id) {
|
|
1580
|
-
const res = await ((
|
|
1581
|
-
const entryPaxNumber = (
|
|
1583
|
+
const res = await ((_i = this.store.order) == null ? void 0 : _i.getOrderInfoByRemote(tempOrder.order_id));
|
|
1584
|
+
const entryPaxNumber = (_m = (_l = (_k = (_j = res == null ? void 0 : res.data) == null ? void 0 : _j.bookings) == null ? void 0 : _k.find((p) => {
|
|
1582
1585
|
var _a2;
|
|
1583
1586
|
return (_a2 = p.metadata) == null ? void 0 : _a2.collect_pax;
|
|
1584
|
-
})) == null ? void 0 :
|
|
1587
|
+
})) == null ? void 0 : _l.metadata) == null ? void 0 : _m.collect_pax;
|
|
1585
1588
|
if (entryPaxNumber) {
|
|
1586
1589
|
await this.setEntryPaxNumber(entryPaxNumber);
|
|
1587
1590
|
}
|
|
1588
1591
|
}
|
|
1589
|
-
const lastOrderInfo = (
|
|
1592
|
+
const lastOrderInfo = (_o = (_n = this.store.order) == null ? void 0 : _n.getLastOrderInfo) == null ? void 0 : _o.call(_n);
|
|
1590
1593
|
const historicalItems = hasOrderId && Array.isArray(lastOrderInfo == null ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce((acc, p) => {
|
|
1591
1594
|
if (typeof (p == null ? void 0 : p.product_id) !== "number")
|
|
1592
1595
|
return acc;
|
|
@@ -1598,7 +1601,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1598
1601
|
return acc;
|
|
1599
1602
|
}, []) : [];
|
|
1600
1603
|
await this.setItemRuleRuntimeConfig({
|
|
1601
|
-
serviceType: (
|
|
1604
|
+
serviceType: (_p = this.otherParams) == null ? void 0 : _p.businessCode,
|
|
1602
1605
|
submissionIndex: hasOrderId ? 1 : 0,
|
|
1603
1606
|
historicalItems
|
|
1604
1607
|
});
|
|
@@ -408,8 +408,8 @@ function normalizeOrderProduct(product) {
|
|
|
408
408
|
}
|
|
409
409
|
const normalizedBundle = (product.product_bundle || []).map((item) => ({
|
|
410
410
|
...item,
|
|
411
|
-
bundle_selling_price: item.bundle_selling_price ?? item.price ?? "0.00"
|
|
412
|
-
custom_price: item.custom_price ?? item.bundle_selling_price ?? item.price ??
|
|
411
|
+
bundle_selling_price: item.bundle_selling_price ?? item.price ?? "0.00"
|
|
412
|
+
// custom_price: item.custom_price ?? item.bundle_selling_price ?? item.price ?? '0.00',
|
|
413
413
|
}));
|
|
414
414
|
const normalizedOptions = product.product_option_item || [];
|
|
415
415
|
const optionSum = (0, import_utils.sumOptionUnitPrice)(normalizedOptions);
|