@pisell/pisellos 2.1.126 → 2.1.128
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/itemRule/adapter.js +6 -2
- package/dist/model/strategy/adapter/itemRule/examples.d.ts +15 -0
- package/dist/model/strategy/adapter/itemRule/examples.js +68 -1
- package/dist/model/strategy/adapter/itemRule/index.d.ts +1 -1
- package/dist/model/strategy/adapter/itemRule/index.js +1 -1
- package/dist/model/strategy/adapter/itemRule/type.d.ts +9 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +9 -40
- package/dist/modules/Order/utils.d.ts +25 -1
- package/dist/modules/Order/utils.js +88 -12
- package/dist/modules/SalesSummary/types.d.ts +2 -1
- package/dist/modules/SalesSummary/utils.js +10 -10
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/ScanOrder/index.d.ts +5 -0
- package/dist/solution/ScanOrder/index.js +181 -62
- package/dist/solution/ScanOrder/types.d.ts +19 -5
- package/dist/solution/ScanOrder/utils.d.ts +14 -0
- package/dist/solution/ScanOrder/utils.js +138 -63
- package/dist/solution/VenueBooking/index.js +42 -44
- package/lib/model/strategy/adapter/itemRule/adapter.js +10 -2
- package/lib/model/strategy/adapter/itemRule/examples.d.ts +15 -0
- package/lib/model/strategy/adapter/itemRule/examples.js +47 -0
- package/lib/model/strategy/adapter/itemRule/index.d.ts +1 -1
- package/lib/model/strategy/adapter/itemRule/index.js +2 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +9 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +8 -41
- package/lib/modules/Order/utils.d.ts +25 -1
- package/lib/modules/Order/utils.js +66 -5
- package/lib/modules/SalesSummary/types.d.ts +2 -1
- package/lib/modules/SalesSummary/utils.js +2 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/ScanOrder/index.d.ts +5 -0
- package/lib/solution/ScanOrder/index.js +78 -19
- package/lib/solution/ScanOrder/types.d.ts +19 -5
- package/lib/solution/ScanOrder/utils.d.ts +14 -0
- package/lib/solution/ScanOrder/utils.js +82 -20
- package/lib/solution/VenueBooking/index.js +11 -16
- package/package.json +1 -1
|
@@ -22,9 +22,10 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
22
22
|
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); }
|
|
23
23
|
import { BaseModule } from "../../modules/BaseModule";
|
|
24
24
|
import { ScanOrderHooks } from "./types";
|
|
25
|
-
import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, collectLinkProductIdsFromReservationRules, createEmptySummary, getProductIdentityIndex, getSafeProductNum, hasCustomCapacityProduct, normalizeEnabledItemRuleIds, normalizeOrderProduct, normalizeItemRuleStrategies, pickFirstDurationMinutesFromProducts, toNonNegativeInt, toNonNegativeNumber, toPriceString, toBoolean, toPositiveString } from "./utils";
|
|
25
|
+
import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, collectLinkProductIdsFromReservationRules, createEmptySummary, getProductIdentityIndex, getSafeProductNum, hasCustomCapacityProduct, pickFirstCustomCapacityPaxBounds, normalizeEnabledItemRuleIds, normalizeOrderProduct, normalizeItemRuleStrategies, pickFirstDurationMinutesFromProducts, toNonNegativeInt, toNonNegativeNumber, toPriceString, toBoolean, toPositiveString } from "./utils";
|
|
26
26
|
import { createModule } from "../BookingByStep/types";
|
|
27
27
|
import { ProductList } from "../../modules/ProductList";
|
|
28
|
+
import { normalizeSubmitCollectPaxValue } from "../../modules/Order/utils";
|
|
28
29
|
import dayjs from 'dayjs';
|
|
29
30
|
import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
30
31
|
export * from "./types";
|
|
@@ -51,7 +52,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
51
52
|
cartValidation: {
|
|
52
53
|
passed: null,
|
|
53
54
|
failures: []
|
|
54
|
-
}
|
|
55
|
+
},
|
|
56
|
+
entryPaxNumber: 1
|
|
55
57
|
});
|
|
56
58
|
_defineProperty(_assertThisInitialized(_this), "otherParams", {});
|
|
57
59
|
_defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
|
|
@@ -635,7 +637,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
635
637
|
key: "submitScanOrder",
|
|
636
638
|
value: function () {
|
|
637
639
|
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
638
|
-
var _this$otherParams4, _this$otherParams5, _this$otherParams6, _this$otherParams7, _tempOrder$products, result, tempOrder;
|
|
640
|
+
var _this$otherParams4, _this$otherParams5, _this$otherParams6, _this$otherParams7, _tempOrder$products, pax, tempOrderForSubmit, result, tempOrder;
|
|
639
641
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
640
642
|
while (1) switch (_context9.prev = _context9.next) {
|
|
641
643
|
case 0:
|
|
@@ -650,7 +652,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
650
652
|
}
|
|
651
653
|
throw new Error('scanOrder解决方案需要 order 模块支持');
|
|
652
654
|
case 6:
|
|
653
|
-
|
|
655
|
+
pax = normalizeSubmitCollectPaxValue(this.store.entryPaxNumber);
|
|
656
|
+
this.store.entryPaxNumber = pax;
|
|
657
|
+
tempOrderForSubmit = this.store.order.ensureTempOrder();
|
|
658
|
+
tempOrderForSubmit.metadata = _objectSpread(_objectSpread({}, tempOrderForSubmit.metadata), {}, {
|
|
659
|
+
collect_pax: pax
|
|
660
|
+
});
|
|
661
|
+
this.store.order.persistTempOrder();
|
|
662
|
+
_context9.next = 13;
|
|
654
663
|
return this.store.order.submitTempOrder({
|
|
655
664
|
cacheId: this.cacheId,
|
|
656
665
|
platform: (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.platform,
|
|
@@ -658,23 +667,23 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
658
667
|
channel: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.channel,
|
|
659
668
|
type: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.type
|
|
660
669
|
});
|
|
661
|
-
case
|
|
670
|
+
case 13:
|
|
662
671
|
result = _context9.sent;
|
|
663
672
|
tempOrder = this.store.order.getTempOrder();
|
|
664
673
|
this.logMethodSuccess('submitScanOrder', {
|
|
665
674
|
productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products = tempOrder.products) === null || _tempOrder$products === void 0 ? void 0 : _tempOrder$products.length) || 0
|
|
666
675
|
});
|
|
667
676
|
return _context9.abrupt("return", result);
|
|
668
|
-
case
|
|
669
|
-
_context9.prev =
|
|
677
|
+
case 19:
|
|
678
|
+
_context9.prev = 19;
|
|
670
679
|
_context9.t0 = _context9["catch"](1);
|
|
671
680
|
this.logMethodError('submitScanOrder', _context9.t0);
|
|
672
681
|
throw _context9.t0;
|
|
673
|
-
case
|
|
682
|
+
case 23:
|
|
674
683
|
case "end":
|
|
675
684
|
return _context9.stop();
|
|
676
685
|
}
|
|
677
|
-
}, _callee9, this, [[1,
|
|
686
|
+
}, _callee9, this, [[1, 19]]);
|
|
678
687
|
}));
|
|
679
688
|
function submitScanOrder() {
|
|
680
689
|
return _submitScanOrder.apply(this, arguments);
|
|
@@ -1160,7 +1169,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1160
1169
|
key: "applyPrefillByItemRule",
|
|
1161
1170
|
value: function () {
|
|
1162
1171
|
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1163
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator2, _step2, _prefillItem$product_, _targetProduct$_origi, _targetProduct$_origi2, _targetProduct$_origi3, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price,
|
|
1172
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator2, _step2, _prefillItem$product_, _targetProduct$_origi, _targetProduct$_origi2, _targetProduct$_origi3, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct, hasQuantityChanged, hasOriginChanged;
|
|
1164
1173
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1165
1174
|
while (1) switch (_context20.prev = _context20.next) {
|
|
1166
1175
|
case 0:
|
|
@@ -1210,7 +1219,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1210
1219
|
_iterator2.s();
|
|
1211
1220
|
case 22:
|
|
1212
1221
|
if ((_step2 = _iterator2.n()).done) {
|
|
1213
|
-
_context20.next =
|
|
1222
|
+
_context20.next = 47;
|
|
1214
1223
|
break;
|
|
1215
1224
|
}
|
|
1216
1225
|
prefillItem = _step2.value;
|
|
@@ -1221,13 +1230,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1221
1230
|
_context20.next = 29;
|
|
1222
1231
|
break;
|
|
1223
1232
|
}
|
|
1224
|
-
return _context20.abrupt("continue",
|
|
1233
|
+
return _context20.abrupt("continue", 45);
|
|
1225
1234
|
case 29:
|
|
1226
1235
|
if (!Number.isNaN(productVariantId)) {
|
|
1227
1236
|
_context20.next = 31;
|
|
1228
1237
|
break;
|
|
1229
1238
|
}
|
|
1230
|
-
return _context20.abrupt("continue",
|
|
1239
|
+
return _context20.abrupt("continue", 45);
|
|
1231
1240
|
case 31:
|
|
1232
1241
|
sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
|
|
1233
1242
|
productIndex = getProductIdentityIndex(tempOrder.products, {
|
|
@@ -1235,19 +1244,16 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1235
1244
|
product_variant_id: productVariantId
|
|
1236
1245
|
});
|
|
1237
1246
|
if (!(productIndex === -1)) {
|
|
1238
|
-
_context20.next =
|
|
1247
|
+
_context20.next = 38;
|
|
1239
1248
|
break;
|
|
1240
1249
|
}
|
|
1241
1250
|
sellingPrice = toPriceString((_sourceItem$price = sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _sourceItem$price !== void 0 ? _sourceItem$price : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.selling_price, '0.00');
|
|
1242
|
-
|
|
1243
|
-
paymentPrice = toPriceString((_ref4 = (_sourceItem$payment_p = sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.payment_price) !== null && _sourceItem$payment_p !== void 0 ? _sourceItem$payment_p : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _ref4 !== void 0 ? _ref4 : sellingPrice, sellingPrice);
|
|
1244
|
-
tempOrder.products.push(normalizeOrderProduct({
|
|
1251
|
+
tempOrder.products.push(normalizeOrderProduct(_objectSpread(_objectSpread({}, sourceItem), {}, {
|
|
1245
1252
|
product_id: productId,
|
|
1246
1253
|
product_variant_id: productVariantId,
|
|
1247
1254
|
num: targetQuantity,
|
|
1248
1255
|
selling_price: sellingPrice,
|
|
1249
|
-
original_price:
|
|
1250
|
-
payment_price: paymentPrice,
|
|
1256
|
+
original_price: sellingPrice,
|
|
1251
1257
|
metadata: {
|
|
1252
1258
|
item_rule_prefill: true,
|
|
1253
1259
|
item_rule_id: prefillItem.ruleId
|
|
@@ -1256,10 +1262,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1256
1262
|
item_rule_prefill: true,
|
|
1257
1263
|
item_rule_id: prefillItem.ruleId
|
|
1258
1264
|
})
|
|
1259
|
-
}));
|
|
1265
|
+
})));
|
|
1260
1266
|
hasChanges = true;
|
|
1261
|
-
return _context20.abrupt("continue",
|
|
1262
|
-
case
|
|
1267
|
+
return _context20.abrupt("continue", 45);
|
|
1268
|
+
case 38:
|
|
1263
1269
|
targetProduct = tempOrder.products[productIndex];
|
|
1264
1270
|
existedQuantity = toNonNegativeInt(targetProduct.num);
|
|
1265
1271
|
delta = targetQuantity - existedQuantity;
|
|
@@ -1278,45 +1284,47 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1278
1284
|
tempOrder.products[productIndex] = nextProduct;
|
|
1279
1285
|
hasChanges = true;
|
|
1280
1286
|
}
|
|
1281
|
-
case
|
|
1287
|
+
case 45:
|
|
1282
1288
|
_context20.next = 22;
|
|
1283
1289
|
break;
|
|
1284
|
-
case
|
|
1285
|
-
_context20.next =
|
|
1290
|
+
case 47:
|
|
1291
|
+
_context20.next = 52;
|
|
1286
1292
|
break;
|
|
1287
|
-
case
|
|
1288
|
-
_context20.prev =
|
|
1293
|
+
case 49:
|
|
1294
|
+
_context20.prev = 49;
|
|
1289
1295
|
_context20.t0 = _context20["catch"](20);
|
|
1290
1296
|
_iterator2.e(_context20.t0);
|
|
1291
|
-
case
|
|
1292
|
-
_context20.prev =
|
|
1297
|
+
case 52:
|
|
1298
|
+
_context20.prev = 52;
|
|
1293
1299
|
_iterator2.f();
|
|
1294
|
-
return _context20.finish(
|
|
1295
|
-
case
|
|
1300
|
+
return _context20.finish(52);
|
|
1301
|
+
case 55:
|
|
1296
1302
|
if (!hasChanges) {
|
|
1297
|
-
_context20.next =
|
|
1303
|
+
_context20.next = 60;
|
|
1298
1304
|
break;
|
|
1299
1305
|
}
|
|
1300
|
-
|
|
1306
|
+
// Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
|
|
1307
|
+
this.store.order.applyDiscount();
|
|
1308
|
+
_context20.next = 59;
|
|
1301
1309
|
return this.store.order.recalculateSummary({
|
|
1302
1310
|
createIfMissing: true
|
|
1303
1311
|
});
|
|
1304
|
-
case
|
|
1312
|
+
case 59:
|
|
1305
1313
|
this.store.order.persistTempOrder();
|
|
1306
|
-
case
|
|
1307
|
-
_context20.next =
|
|
1314
|
+
case 60:
|
|
1315
|
+
_context20.next = 62;
|
|
1308
1316
|
return this.refreshItemRuleQuantityLimits();
|
|
1309
|
-
case
|
|
1317
|
+
case 62:
|
|
1310
1318
|
this.itemRulePrefillApplied = true;
|
|
1311
1319
|
this.logMethodSuccess('applyPrefillByItemRule', {
|
|
1312
1320
|
prefillCount: prefillItems.length,
|
|
1313
1321
|
hasChanges: hasChanges
|
|
1314
1322
|
});
|
|
1315
|
-
case
|
|
1323
|
+
case 64:
|
|
1316
1324
|
case "end":
|
|
1317
1325
|
return _context20.stop();
|
|
1318
1326
|
}
|
|
1319
|
-
}, _callee20, this, [[20,
|
|
1327
|
+
}, _callee20, this, [[20, 49, 52, 55]]);
|
|
1320
1328
|
}));
|
|
1321
1329
|
function applyPrefillByItemRule() {
|
|
1322
1330
|
return _applyPrefillByItemRule.apply(this, arguments);
|
|
@@ -1533,7 +1541,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1533
1541
|
}, {
|
|
1534
1542
|
key: "normalizeResourceState",
|
|
1535
1543
|
value: function normalizeResourceState(config, hasOrderId) {
|
|
1536
|
-
var _this$otherParams8;
|
|
1544
|
+
var _this$otherParams8, _config$table_form_re;
|
|
1537
1545
|
var orderNumberPrefix = Array.isArray(config === null || config === void 0 ? void 0 : config.order_number_prefix) ? (config === null || config === void 0 ? void 0 : config.order_number_prefix) || [] : [];
|
|
1538
1546
|
var tableMaxNumber = Number((config === null || config === void 0 ? void 0 : config.table_max_number) || 1);
|
|
1539
1547
|
var orderCount = toNonNegativeNumber(config === null || config === void 0 ? void 0 : config.order_count);
|
|
@@ -1612,7 +1620,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1612
1620
|
isExclusive: isExclusive,
|
|
1613
1621
|
isFull: isFull,
|
|
1614
1622
|
orderNumberPrefix: orderNumberPrefix,
|
|
1615
|
-
raw: config
|
|
1623
|
+
raw: config,
|
|
1624
|
+
table_form_record: (_config$table_form_re = config === null || config === void 0 ? void 0 : config.table_form_record) !== null && _config$table_form_re !== void 0 ? _config$table_form_re : null
|
|
1616
1625
|
});
|
|
1617
1626
|
}
|
|
1618
1627
|
}, {
|
|
@@ -1661,7 +1670,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1661
1670
|
key: "checkResourceAvailable",
|
|
1662
1671
|
value: function () {
|
|
1663
1672
|
var _checkResourceAvailable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(resourceId, hasOrderId) {
|
|
1664
|
-
var _this$otherParams9, _this$otherParams9$ge, _config$
|
|
1673
|
+
var _this$otherParams9, _this$otherParams9$ge, _config$table_form_re2, _config$table_form_re3, _this$otherParams10, _this$store$order5, _this$store$order7, _this$store$order7$ge, _this$otherParams11, openData, dineInConfig, shopClosedInfo, config, resourceState, availabilityInfo, tempOrder, reservationLinkIds, reservationProductList, scheduleDate, scheduleDatetime, loaded, occupancyMinutes, paxBounds, _this$store$order6, _res$data, res, entryPaxNumber, lastOrderInfo, historicalItems;
|
|
1665
1674
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1666
1675
|
while (1) switch (_context27.prev = _context27.next) {
|
|
1667
1676
|
case 0:
|
|
@@ -1720,8 +1729,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1720
1729
|
relation_id: resourceState.relationId,
|
|
1721
1730
|
table_form_id: resourceState.tableFormId,
|
|
1722
1731
|
deskmate_valid: resourceState.deskmate_valid,
|
|
1723
|
-
|
|
1724
|
-
|
|
1732
|
+
table_form_record: resourceState.table_form_record,
|
|
1733
|
+
policy: config === null || config === void 0 || (_config$table_form_re2 = config.table_form_record) === null || _config$table_form_re2 === void 0 ? void 0 : _config$table_form_re2.policy,
|
|
1734
|
+
partyroom_booking: config === null || config === void 0 || (_config$table_form_re3 = config.table_form_record) === null || _config$table_form_re3 === void 0 ? void 0 : _config$table_form_re3.partyroom_booking
|
|
1725
1735
|
};
|
|
1726
1736
|
tempOrder = this.ensureTempOrder();
|
|
1727
1737
|
tempOrder.relation_id = resourceId || ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.relation_id);
|
|
@@ -1733,7 +1743,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1733
1743
|
break;
|
|
1734
1744
|
}
|
|
1735
1745
|
this.enabledReservationRuleProducts = [];
|
|
1736
|
-
if (this.store.resource)
|
|
1746
|
+
if (this.store.resource) {
|
|
1747
|
+
delete this.store.resource.requestEntryPax;
|
|
1748
|
+
delete this.store.resource.requestPaxMin;
|
|
1749
|
+
delete this.store.resource.requestPaxMax;
|
|
1750
|
+
}
|
|
1737
1751
|
_context27.next = 42;
|
|
1738
1752
|
break;
|
|
1739
1753
|
case 31:
|
|
@@ -1773,12 +1787,33 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1773
1787
|
if (hasCustomCapacityProduct(loaded)) {
|
|
1774
1788
|
availabilityInfo.requestEntryPax = 1;
|
|
1775
1789
|
if (this.store.resource) this.store.resource.requestEntryPax = 1;
|
|
1790
|
+
delete availabilityInfo.requestPaxMin;
|
|
1791
|
+
delete availabilityInfo.requestPaxMax;
|
|
1792
|
+
if (this.store.resource) {
|
|
1793
|
+
delete this.store.resource.requestPaxMin;
|
|
1794
|
+
delete this.store.resource.requestPaxMax;
|
|
1795
|
+
}
|
|
1796
|
+
paxBounds = pickFirstCustomCapacityPaxBounds(loaded);
|
|
1797
|
+
if ((paxBounds === null || paxBounds === void 0 ? void 0 : paxBounds.min) !== undefined) {
|
|
1798
|
+
availabilityInfo.requestPaxMin = paxBounds.min;
|
|
1799
|
+
if (this.store.resource) this.store.resource.requestPaxMin = paxBounds.min;
|
|
1800
|
+
}
|
|
1801
|
+
if ((paxBounds === null || paxBounds === void 0 ? void 0 : paxBounds.max) !== undefined) {
|
|
1802
|
+
availabilityInfo.requestPaxMax = paxBounds.max;
|
|
1803
|
+
if (this.store.resource) this.store.resource.requestPaxMax = paxBounds.max;
|
|
1804
|
+
}
|
|
1776
1805
|
} else if (this.store.resource) {
|
|
1777
1806
|
delete this.store.resource.requestEntryPax;
|
|
1807
|
+
delete this.store.resource.requestPaxMin;
|
|
1808
|
+
delete this.store.resource.requestPaxMax;
|
|
1778
1809
|
}
|
|
1779
1810
|
} else {
|
|
1780
1811
|
this.enabledReservationRuleProducts = [];
|
|
1781
|
-
if (this.store.resource)
|
|
1812
|
+
if (this.store.resource) {
|
|
1813
|
+
delete this.store.resource.requestEntryPax;
|
|
1814
|
+
delete this.store.resource.requestPaxMin;
|
|
1815
|
+
delete this.store.resource.requestPaxMax;
|
|
1816
|
+
}
|
|
1782
1817
|
void this.addScanOrderLog({
|
|
1783
1818
|
level: 'error',
|
|
1784
1819
|
title: '[ScanOrder] enabled_reservation_rules product query failed',
|
|
@@ -1804,12 +1839,25 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1804
1839
|
tempOrder.order_id = resourceState.lastOrderId;
|
|
1805
1840
|
}
|
|
1806
1841
|
if (!tempOrder.order_id) {
|
|
1807
|
-
_context27.next =
|
|
1842
|
+
_context27.next = 55;
|
|
1808
1843
|
break;
|
|
1809
1844
|
}
|
|
1810
1845
|
_context27.next = 50;
|
|
1811
1846
|
return (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getOrderInfoByRemote(tempOrder.order_id);
|
|
1812
1847
|
case 50:
|
|
1848
|
+
res = _context27.sent;
|
|
1849
|
+
// 找到下单的时候输入的 entryPaxNumber
|
|
1850
|
+
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) {
|
|
1851
|
+
var _p$metadata;
|
|
1852
|
+
return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
|
|
1853
|
+
})) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
|
|
1854
|
+
if (!entryPaxNumber) {
|
|
1855
|
+
_context27.next = 55;
|
|
1856
|
+
break;
|
|
1857
|
+
}
|
|
1858
|
+
_context27.next = 55;
|
|
1859
|
+
return this.setEntryPaxNumber(entryPaxNumber);
|
|
1860
|
+
case 55:
|
|
1813
1861
|
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);
|
|
1814
1862
|
historicalItems = hasOrderId && Array.isArray(lastOrderInfo === null || lastOrderInfo === void 0 ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce(function (acc, p) {
|
|
1815
1863
|
if (typeof (p === null || p === void 0 ? void 0 : p.product_id) !== 'number') return acc;
|
|
@@ -1820,19 +1868,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1820
1868
|
product_variant_id: p.product_variant_id
|
|
1821
1869
|
} : {}));
|
|
1822
1870
|
return acc;
|
|
1823
|
-
}, []) : [];
|
|
1824
|
-
_context27.next =
|
|
1871
|
+
}, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
|
|
1872
|
+
_context27.next = 59;
|
|
1825
1873
|
return this.setItemRuleRuntimeConfig({
|
|
1826
|
-
|
|
1827
|
-
total: 2,
|
|
1828
|
-
adult: 2,
|
|
1829
|
-
child: 0
|
|
1830
|
-
},
|
|
1831
|
-
serviceType: 'dine-in',
|
|
1874
|
+
serviceType: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.businessCode,
|
|
1832
1875
|
submissionIndex: hasOrderId ? 1 : 0,
|
|
1833
1876
|
historicalItems: historicalItems
|
|
1834
1877
|
});
|
|
1835
|
-
case
|
|
1878
|
+
case 59:
|
|
1836
1879
|
this.logMethodSuccess('checkResourceAvailable', {
|
|
1837
1880
|
resourceId: resourceId,
|
|
1838
1881
|
mode: availabilityInfo.mode,
|
|
@@ -1848,18 +1891,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1848
1891
|
isFull: resourceState.isFull
|
|
1849
1892
|
});
|
|
1850
1893
|
return _context27.abrupt("return", availabilityInfo);
|
|
1851
|
-
case
|
|
1852
|
-
_context27.prev =
|
|
1894
|
+
case 63:
|
|
1895
|
+
_context27.prev = 63;
|
|
1853
1896
|
_context27.t0 = _context27["catch"](1);
|
|
1854
1897
|
this.logMethodError('checkResourceAvailable', _context27.t0, {
|
|
1855
1898
|
resourceId: resourceId
|
|
1856
1899
|
});
|
|
1857
1900
|
throw _context27.t0;
|
|
1858
|
-
case
|
|
1901
|
+
case 67:
|
|
1859
1902
|
case "end":
|
|
1860
1903
|
return _context27.stop();
|
|
1861
1904
|
}
|
|
1862
|
-
}, _callee27, this, [[1,
|
|
1905
|
+
}, _callee27, this, [[1, 63]]);
|
|
1863
1906
|
}));
|
|
1864
1907
|
function checkResourceAvailable(_x10, _x11) {
|
|
1865
1908
|
return _checkResourceAvailable.apply(this, arguments);
|
|
@@ -1902,14 +1945,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1902
1945
|
key: "getProductList",
|
|
1903
1946
|
value: function () {
|
|
1904
1947
|
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
1905
|
-
var _this$
|
|
1948
|
+
var _this$otherParams12;
|
|
1906
1949
|
var menu_list_ids, _this$store$products, res, formattedRes;
|
|
1907
1950
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1908
1951
|
while (1) switch (_context29.prev = _context29.next) {
|
|
1909
1952
|
case 0:
|
|
1910
1953
|
this.logMethodStart('getProductList');
|
|
1911
1954
|
// 可以直接通过配置里的 menu 读取
|
|
1912
|
-
menu_list_ids = ((_this$
|
|
1955
|
+
menu_list_ids = ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 || (_this$otherParams12 = _this$otherParams12.dineInConfig) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12['menu.associated_menus'].map(function (n) {
|
|
1913
1956
|
return Number(n.value);
|
|
1914
1957
|
})) || [];
|
|
1915
1958
|
_context29.prev = 2;
|
|
@@ -1948,6 +1991,82 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1948
1991
|
value: function getOtherParams() {
|
|
1949
1992
|
return this.otherParams;
|
|
1950
1993
|
}
|
|
1994
|
+
}, {
|
|
1995
|
+
key: "setOtherParams",
|
|
1996
|
+
value: function () {
|
|
1997
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
1998
|
+
var _ref3,
|
|
1999
|
+
_ref3$cover,
|
|
2000
|
+
cover,
|
|
2001
|
+
_args30 = arguments;
|
|
2002
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2003
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2004
|
+
case 0:
|
|
2005
|
+
_ref3 = _args30.length > 1 && _args30[1] !== undefined ? _args30[1] : {}, _ref3$cover = _ref3.cover, cover = _ref3$cover === void 0 ? false : _ref3$cover;
|
|
2006
|
+
if (cover) {
|
|
2007
|
+
this.otherParams = params;
|
|
2008
|
+
} else {
|
|
2009
|
+
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
2010
|
+
}
|
|
2011
|
+
case 2:
|
|
2012
|
+
case "end":
|
|
2013
|
+
return _context30.stop();
|
|
2014
|
+
}
|
|
2015
|
+
}, _callee30, this);
|
|
2016
|
+
}));
|
|
2017
|
+
function setOtherParams(_x12) {
|
|
2018
|
+
return _setOtherParams.apply(this, arguments);
|
|
2019
|
+
}
|
|
2020
|
+
return setOtherParams;
|
|
2021
|
+
}()
|
|
2022
|
+
}, {
|
|
2023
|
+
key: "setEntryPaxNumber",
|
|
2024
|
+
value: function () {
|
|
2025
|
+
var _setEntryPaxNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(number) {
|
|
2026
|
+
var pax, t;
|
|
2027
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2028
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2029
|
+
case 0:
|
|
2030
|
+
pax = normalizeSubmitCollectPaxValue(number);
|
|
2031
|
+
this.store.entryPaxNumber = pax;
|
|
2032
|
+
if (this.store.order) {
|
|
2033
|
+
t = this.store.order.ensureTempOrder();
|
|
2034
|
+
t.metadata = _objectSpread(_objectSpread({}, t.metadata), {}, {
|
|
2035
|
+
collect_pax: pax
|
|
2036
|
+
});
|
|
2037
|
+
this.store.order.persistTempOrder();
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
// pax 变化后同步到 itemRuleRuntimeConfig,并刷新限购 / 校验
|
|
2041
|
+
this.itemRuleRuntimeConfig = _objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), {}, {
|
|
2042
|
+
pax: {
|
|
2043
|
+
total: pax,
|
|
2044
|
+
adult: 0,
|
|
2045
|
+
child: 0
|
|
2046
|
+
}
|
|
2047
|
+
});
|
|
2048
|
+
this.itemRulePrefillApplied = false;
|
|
2049
|
+
_context31.next = 7;
|
|
2050
|
+
return this.refreshItemRuleQuantityLimits();
|
|
2051
|
+
case 7:
|
|
2052
|
+
_context31.next = 9;
|
|
2053
|
+
return this.refreshCartValidationPassed();
|
|
2054
|
+
case 9:
|
|
2055
|
+
case "end":
|
|
2056
|
+
return _context31.stop();
|
|
2057
|
+
}
|
|
2058
|
+
}, _callee31, this);
|
|
2059
|
+
}));
|
|
2060
|
+
function setEntryPaxNumber(_x13) {
|
|
2061
|
+
return _setEntryPaxNumber.apply(this, arguments);
|
|
2062
|
+
}
|
|
2063
|
+
return setEntryPaxNumber;
|
|
2064
|
+
}()
|
|
2065
|
+
}, {
|
|
2066
|
+
key: "getEntryPaxNumber",
|
|
2067
|
+
value: function getEntryPaxNumber() {
|
|
2068
|
+
return this.store.entryPaxNumber;
|
|
2069
|
+
}
|
|
1951
2070
|
}]);
|
|
1952
2071
|
return ScanOrderImpl;
|
|
1953
2072
|
}(BaseModule);
|
|
@@ -36,9 +36,10 @@ export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
|
|
|
36
36
|
order_detail_id: number | null;
|
|
37
37
|
num: number;
|
|
38
38
|
product_option_item: any[];
|
|
39
|
+
/** 券后单品单价(= 订单域实际成交单价)。未应用券时等同 original_price。 */
|
|
39
40
|
selling_price: string;
|
|
41
|
+
/** 券前单品单价(= 店铺售价),不承载后台划线价语义。 */
|
|
40
42
|
original_price: string;
|
|
41
|
-
payment_price: string;
|
|
42
43
|
tax_fee: string;
|
|
43
44
|
is_charge_tax: number;
|
|
44
45
|
discount_list: any[];
|
|
@@ -47,6 +48,11 @@ export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
|
|
|
47
48
|
_origin?: Record<string, any>;
|
|
48
49
|
}
|
|
49
50
|
export interface ScanOrderSubmitProduct extends Omit<ScanOrderOrderProduct, '_origin' | 'identity_key'> {
|
|
51
|
+
/**
|
|
52
|
+
* 出站兼容字段:SDK 内部不再消费 payment_price,
|
|
53
|
+
* 仅在提交后端时由 selling_price 派生,保持原有后端契约。
|
|
54
|
+
*/
|
|
55
|
+
payment_price: string;
|
|
50
56
|
}
|
|
51
57
|
export interface ScanOrderSummary {
|
|
52
58
|
product_quantity: number;
|
|
@@ -133,6 +139,11 @@ export interface ScanOrderSubmitPayload extends Omit<ScanOrderTempOrder, 'platfo
|
|
|
133
139
|
products: ScanOrderSubmitProduct[];
|
|
134
140
|
}
|
|
135
141
|
export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'resource_block' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
|
|
142
|
+
export interface ScanOrderTableFormRecord {
|
|
143
|
+
policy?: string | null;
|
|
144
|
+
partyroom_booking?: string | null;
|
|
145
|
+
[key: string]: any;
|
|
146
|
+
}
|
|
136
147
|
export interface ScanOrderAvailabilityInfo {
|
|
137
148
|
mode: ScanOrderAvailabilityMode;
|
|
138
149
|
order_id?: string;
|
|
@@ -140,10 +151,16 @@ export interface ScanOrderAvailabilityInfo {
|
|
|
140
151
|
table_form_id?: string;
|
|
141
152
|
deskmate_valid?: boolean;
|
|
142
153
|
errorTips?: string;
|
|
154
|
+
/** `/order/dining/table/config` 返回的 `table_form_record` 原样透出 */
|
|
155
|
+
table_form_record?: ScanOrderTableFormRecord | null;
|
|
143
156
|
policy?: string | null;
|
|
144
157
|
partyroom_booking?: string | null;
|
|
145
158
|
/** 预约规则关联商品存在 custom 容量时,由 checkResourceAvailable 置为 1 */
|
|
146
159
|
requestEntryPax?: number;
|
|
160
|
+
/** 首个 `capacity.type === 'custom'` 商品里 `custom[0]` 的 min(人数下限) */
|
|
161
|
+
requestPaxMin?: number;
|
|
162
|
+
/** 首个 `capacity.type === 'custom'` 商品里 `custom[0]` 的 max(人数上限) */
|
|
163
|
+
requestPaxMax?: number;
|
|
147
164
|
}
|
|
148
165
|
export interface ScanOrderTableSnackConfig {
|
|
149
166
|
snack?: boolean | number | string;
|
|
@@ -153,9 +170,6 @@ export interface ScanOrderOrderNumberPrefixConfig {
|
|
|
153
170
|
table_order?: string;
|
|
154
171
|
pos?: string;
|
|
155
172
|
}
|
|
156
|
-
export interface ScanOrderTableFormRecord {
|
|
157
|
-
policy?: string | null;
|
|
158
|
-
}
|
|
159
173
|
export interface ScanOrderTableConfigApiData {
|
|
160
174
|
table_max_number?: number | string | null;
|
|
161
175
|
order_count?: number | string | null;
|
|
@@ -186,7 +200,6 @@ export interface ScanOrderResourceState extends ScanOrderAvailabilityInfo {
|
|
|
186
200
|
isFull: boolean;
|
|
187
201
|
orderNumberPrefix: ScanOrderOrderNumberPrefixConfig[];
|
|
188
202
|
raw: ScanOrderTableConfigApiData | null;
|
|
189
|
-
table_form_record?: ScanOrderTableFormRecord | null;
|
|
190
203
|
}
|
|
191
204
|
export interface ScanOrderState {
|
|
192
205
|
entryContext: ScanOrderEntryContext | null;
|
|
@@ -204,6 +217,7 @@ export interface ScanOrderState {
|
|
|
204
217
|
passed: boolean | null;
|
|
205
218
|
failures: QuantityCheckResult[];
|
|
206
219
|
};
|
|
220
|
+
entryPaxNumber: number | null;
|
|
207
221
|
}
|
|
208
222
|
export interface ScanOrderLoggerRuntimeConfig {
|
|
209
223
|
provider?: ScanOrderLoggerProviderType;
|
|
@@ -62,6 +62,12 @@ export declare function aggregateItemRuleLimit(matchedLimits: QuantityLimitResul
|
|
|
62
62
|
remainingMax: number | undefined;
|
|
63
63
|
exact: number | undefined;
|
|
64
64
|
mustInclude: boolean;
|
|
65
|
+
validationMessage: string | undefined;
|
|
66
|
+
rawValidationMessage: string | Record<string, string> | undefined;
|
|
67
|
+
maxValidationMessage: string | undefined;
|
|
68
|
+
rawMaxValidationMessage: string | Record<string, string> | undefined;
|
|
69
|
+
minValidationMessage: string | undefined;
|
|
70
|
+
rawMinValidationMessage: string | Record<string, string> | undefined;
|
|
65
71
|
} | null;
|
|
66
72
|
export declare function buildItemRuleBusinessData(params: {
|
|
67
73
|
tempOrder: ScanOrderTempOrder;
|
|
@@ -103,3 +109,11 @@ export declare function collectLinkProductIdsFromReservationRules(rules: unknown
|
|
|
103
109
|
export declare function pickFirstDurationMinutesFromProducts(products: ProductData[]): number | undefined;
|
|
104
110
|
/** 是否存在 capacity.type === 'custom' 的商品 */
|
|
105
111
|
export declare function hasCustomCapacityProduct(products: ProductData[]): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* 在商品列表中找到第一个 `capacity.type === 'custom'` 的商品,取其 `custom` 数组第一项的 min/max。
|
|
114
|
+
* 仅返回有限数字字段;若均无法解析则返回 `undefined`。
|
|
115
|
+
*/
|
|
116
|
+
export declare function pickFirstCustomCapacityPaxBounds(products: ProductData[]): {
|
|
117
|
+
min?: number;
|
|
118
|
+
max?: number;
|
|
119
|
+
} | undefined;
|