@pisell/pisellos 0.0.510 → 0.0.511
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Order/index.d.ts +3 -6
- package/dist/modules/Order/index.js +69 -23
- package/dist/modules/Order/types.d.ts +12 -5
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +1 -0
- package/dist/modules/Order/utils.js +29 -2
- package/dist/solution/ScanOrder/index.d.ts +7 -5
- package/dist/solution/ScanOrder/index.js +327 -274
- package/dist/solution/ScanOrder/types.d.ts +14 -0
- package/dist/solution/ScanOrder/types.js +13 -0
- package/dist/solution/ScanOrder/utils.d.ts +8 -10
- package/dist/solution/ScanOrder/utils.js +20 -54
- package/dist/solution/VenueBooking/index.d.ts +2 -5
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/Order/index.d.ts +3 -6
- package/lib/modules/Order/index.js +78 -17
- package/lib/modules/Order/types.d.ts +12 -5
- package/lib/modules/Order/utils.d.ts +1 -0
- package/lib/modules/Order/utils.js +22 -2
- package/lib/solution/ScanOrder/index.d.ts +7 -5
- package/lib/solution/ScanOrder/index.js +30 -0
- package/lib/solution/ScanOrder/types.d.ts +14 -0
- package/lib/solution/ScanOrder/utils.d.ts +8 -10
- package/lib/solution/ScanOrder/utils.js +10 -53
- package/lib/solution/VenueBooking/index.d.ts +2 -5
- package/package.json +1 -1
|
@@ -1453,51 +1453,104 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1453
1453
|
}
|
|
1454
1454
|
return updateProductInOrder;
|
|
1455
1455
|
}()
|
|
1456
|
+
/**
|
|
1457
|
+
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
1458
|
+
* 多行同 SKU 时必须传入与删除/更新一致的 identity(如 `identity_key`)。
|
|
1459
|
+
*/
|
|
1460
|
+
}, {
|
|
1461
|
+
key: "setOrderProductLineNote",
|
|
1462
|
+
value: (function () {
|
|
1463
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(identity, note) {
|
|
1464
|
+
var params, products;
|
|
1465
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1466
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1467
|
+
case 0:
|
|
1468
|
+
this.logMethodStart('setOrderProductLineNote', {
|
|
1469
|
+
product_id: identity.product_id,
|
|
1470
|
+
product_variant_id: identity.product_variant_id
|
|
1471
|
+
});
|
|
1472
|
+
_context19.prev = 1;
|
|
1473
|
+
params = {
|
|
1474
|
+
product_id: identity.product_id,
|
|
1475
|
+
product_variant_id: identity.product_variant_id,
|
|
1476
|
+
updates: {
|
|
1477
|
+
note: String(note || '')
|
|
1478
|
+
}
|
|
1479
|
+
};
|
|
1480
|
+
if (identity.identity_key !== undefined) params.identity_key = identity.identity_key;
|
|
1481
|
+
if (identity.product_option_item !== undefined) {
|
|
1482
|
+
params.product_option_item = identity.product_option_item;
|
|
1483
|
+
}
|
|
1484
|
+
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
1485
|
+
_context19.next = 8;
|
|
1486
|
+
return this.updateProductInOrder(params);
|
|
1487
|
+
case 8:
|
|
1488
|
+
products = _context19.sent;
|
|
1489
|
+
this.logMethodSuccess('setOrderProductLineNote', {
|
|
1490
|
+
productCount: products.length
|
|
1491
|
+
});
|
|
1492
|
+
return _context19.abrupt("return", products);
|
|
1493
|
+
case 13:
|
|
1494
|
+
_context19.prev = 13;
|
|
1495
|
+
_context19.t0 = _context19["catch"](1);
|
|
1496
|
+
this.logMethodError('setOrderProductLineNote', _context19.t0);
|
|
1497
|
+
throw _context19.t0;
|
|
1498
|
+
case 17:
|
|
1499
|
+
case "end":
|
|
1500
|
+
return _context19.stop();
|
|
1501
|
+
}
|
|
1502
|
+
}, _callee19, this, [[1, 13]]);
|
|
1503
|
+
}));
|
|
1504
|
+
function setOrderProductLineNote(_x12, _x13) {
|
|
1505
|
+
return _setOrderProductLineNote.apply(this, arguments);
|
|
1506
|
+
}
|
|
1507
|
+
return setOrderProductLineNote;
|
|
1508
|
+
}())
|
|
1456
1509
|
}, {
|
|
1457
1510
|
key: "removeProductFromOrder",
|
|
1458
1511
|
value: function () {
|
|
1459
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1512
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(identity) {
|
|
1460
1513
|
var products;
|
|
1461
|
-
return _regeneratorRuntime().wrap(function
|
|
1462
|
-
while (1) switch (
|
|
1514
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1515
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1463
1516
|
case 0:
|
|
1464
1517
|
this.logMethodStart('removeProductFromOrder', {
|
|
1465
1518
|
product_id: identity.product_id,
|
|
1466
1519
|
product_variant_id: identity.product_variant_id
|
|
1467
1520
|
});
|
|
1468
|
-
|
|
1521
|
+
_context20.prev = 1;
|
|
1469
1522
|
if (this.store.order) {
|
|
1470
|
-
|
|
1523
|
+
_context20.next = 4;
|
|
1471
1524
|
break;
|
|
1472
1525
|
}
|
|
1473
1526
|
throw new Error('order 模块未初始化');
|
|
1474
1527
|
case 4:
|
|
1475
|
-
|
|
1528
|
+
_context20.next = 6;
|
|
1476
1529
|
return this.store.order.removeProductFromOrder(identity);
|
|
1477
1530
|
case 6:
|
|
1478
|
-
products =
|
|
1479
|
-
|
|
1531
|
+
products = _context20.sent;
|
|
1532
|
+
_context20.next = 9;
|
|
1480
1533
|
return this.refreshItemRuleQuantityLimits();
|
|
1481
1534
|
case 9:
|
|
1482
|
-
|
|
1535
|
+
_context20.next = 11;
|
|
1483
1536
|
return this.refreshCartValidationPassed();
|
|
1484
1537
|
case 11:
|
|
1485
1538
|
this.logMethodSuccess('removeProductFromOrder', {
|
|
1486
1539
|
productCount: products.length
|
|
1487
1540
|
});
|
|
1488
|
-
return
|
|
1541
|
+
return _context20.abrupt("return", products);
|
|
1489
1542
|
case 15:
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
this.logMethodError('removeProductFromOrder',
|
|
1493
|
-
throw
|
|
1543
|
+
_context20.prev = 15;
|
|
1544
|
+
_context20.t0 = _context20["catch"](1);
|
|
1545
|
+
this.logMethodError('removeProductFromOrder', _context20.t0);
|
|
1546
|
+
throw _context20.t0;
|
|
1494
1547
|
case 19:
|
|
1495
1548
|
case "end":
|
|
1496
|
-
return
|
|
1549
|
+
return _context20.stop();
|
|
1497
1550
|
}
|
|
1498
|
-
},
|
|
1551
|
+
}, _callee20, this, [[1, 15]]);
|
|
1499
1552
|
}));
|
|
1500
|
-
function removeProductFromOrder(
|
|
1553
|
+
function removeProductFromOrder(_x14) {
|
|
1501
1554
|
return _removeProductFromOrder.apply(this, arguments);
|
|
1502
1555
|
}
|
|
1503
1556
|
return removeProductFromOrder;
|
|
@@ -1505,26 +1558,26 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1505
1558
|
}, {
|
|
1506
1559
|
key: "loadRuntimeConfigs",
|
|
1507
1560
|
value: function () {
|
|
1508
|
-
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1561
|
+
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1509
1562
|
var itemRuleConfigs;
|
|
1510
|
-
return _regeneratorRuntime().wrap(function
|
|
1511
|
-
while (1) switch (
|
|
1563
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1564
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1512
1565
|
case 0:
|
|
1513
|
-
|
|
1566
|
+
_context21.next = 2;
|
|
1514
1567
|
return this.ensureItemRuleConfigsLoaded();
|
|
1515
1568
|
case 2:
|
|
1516
|
-
itemRuleConfigs =
|
|
1569
|
+
itemRuleConfigs = _context21.sent;
|
|
1517
1570
|
this.logMethodSuccess('loadRuntimeConfigs', {
|
|
1518
1571
|
itemRuleCount: itemRuleConfigs.length
|
|
1519
1572
|
});
|
|
1520
|
-
return
|
|
1573
|
+
return _context21.abrupt("return", {
|
|
1521
1574
|
itemRuleConfigs: itemRuleConfigs
|
|
1522
1575
|
});
|
|
1523
1576
|
case 5:
|
|
1524
1577
|
case "end":
|
|
1525
|
-
return
|
|
1578
|
+
return _context21.stop();
|
|
1526
1579
|
}
|
|
1527
|
-
},
|
|
1580
|
+
}, _callee21, this);
|
|
1528
1581
|
}));
|
|
1529
1582
|
function loadRuntimeConfigs() {
|
|
1530
1583
|
return _loadRuntimeConfigs.apply(this, arguments);
|
|
@@ -1534,15 +1587,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1534
1587
|
}, {
|
|
1535
1588
|
key: "syncItemRuleConfigsFromDineInConfig",
|
|
1536
1589
|
value: function () {
|
|
1537
|
-
var _syncItemRuleConfigsFromDineInConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1590
|
+
var _syncItemRuleConfigsFromDineInConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(dineInConfig) {
|
|
1538
1591
|
var enableItemRules, strategyModelIds, itemRuleConfigs;
|
|
1539
|
-
return _regeneratorRuntime().wrap(function
|
|
1540
|
-
while (1) switch (
|
|
1592
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1593
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1541
1594
|
case 0:
|
|
1542
1595
|
enableItemRules = toBoolean(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['sale.enable_item_rules']);
|
|
1543
1596
|
strategyModelIds = normalizeEnabledItemRuleIds(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['sale.enabled_item_rules']);
|
|
1544
1597
|
if (!(!enableItemRules || !strategyModelIds.length)) {
|
|
1545
|
-
|
|
1598
|
+
_context22.next = 8;
|
|
1546
1599
|
break;
|
|
1547
1600
|
}
|
|
1548
1601
|
this.itemRuleConfigs = [];
|
|
@@ -1553,12 +1606,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1553
1606
|
strategyModelIds: [],
|
|
1554
1607
|
itemRuleCount: 0
|
|
1555
1608
|
});
|
|
1556
|
-
return
|
|
1609
|
+
return _context22.abrupt("return", []);
|
|
1557
1610
|
case 8:
|
|
1558
|
-
|
|
1611
|
+
_context22.next = 10;
|
|
1559
1612
|
return this.fetchItemRuleConfigsByModelIds(strategyModelIds);
|
|
1560
1613
|
case 10:
|
|
1561
|
-
itemRuleConfigs =
|
|
1614
|
+
itemRuleConfigs = _context22.sent;
|
|
1562
1615
|
this.itemRuleConfigs = itemRuleConfigs;
|
|
1563
1616
|
this.itemRuleConfigsPromise = Promise.resolve(itemRuleConfigs);
|
|
1564
1617
|
this.itemRuleEvaluator.setStrategyConfigs(itemRuleConfigs);
|
|
@@ -1567,14 +1620,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1567
1620
|
strategyModelIds: strategyModelIds,
|
|
1568
1621
|
itemRuleCount: itemRuleConfigs.length
|
|
1569
1622
|
});
|
|
1570
|
-
return
|
|
1623
|
+
return _context22.abrupt("return", itemRuleConfigs);
|
|
1571
1624
|
case 16:
|
|
1572
1625
|
case "end":
|
|
1573
|
-
return
|
|
1626
|
+
return _context22.stop();
|
|
1574
1627
|
}
|
|
1575
|
-
},
|
|
1628
|
+
}, _callee22, this);
|
|
1576
1629
|
}));
|
|
1577
|
-
function syncItemRuleConfigsFromDineInConfig(
|
|
1630
|
+
function syncItemRuleConfigsFromDineInConfig(_x15) {
|
|
1578
1631
|
return _syncItemRuleConfigsFromDineInConfig.apply(this, arguments);
|
|
1579
1632
|
}
|
|
1580
1633
|
return syncItemRuleConfigsFromDineInConfig;
|
|
@@ -1582,22 +1635,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1582
1635
|
}, {
|
|
1583
1636
|
key: "fetchItemRuleConfigsByModelIds",
|
|
1584
1637
|
value: function () {
|
|
1585
|
-
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1638
|
+
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(strategyModelIds) {
|
|
1586
1639
|
var result, configs;
|
|
1587
|
-
return _regeneratorRuntime().wrap(function
|
|
1588
|
-
while (1) switch (
|
|
1640
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1641
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1589
1642
|
case 0:
|
|
1590
1643
|
this.logMethodStart('fetchItemRuleConfigsByModelIds', {
|
|
1591
1644
|
strategyModelIds: strategyModelIds
|
|
1592
1645
|
});
|
|
1593
1646
|
if (strategyModelIds.length) {
|
|
1594
|
-
|
|
1647
|
+
_context23.next = 3;
|
|
1595
1648
|
break;
|
|
1596
1649
|
}
|
|
1597
|
-
return
|
|
1650
|
+
return _context23.abrupt("return", []);
|
|
1598
1651
|
case 3:
|
|
1599
|
-
|
|
1600
|
-
|
|
1652
|
+
_context23.prev = 3;
|
|
1653
|
+
_context23.next = 6;
|
|
1601
1654
|
return this.request.get('/promotion', {
|
|
1602
1655
|
skip: 1,
|
|
1603
1656
|
num: 99,
|
|
@@ -1605,7 +1658,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1605
1658
|
ids: strategyModelIds
|
|
1606
1659
|
});
|
|
1607
1660
|
case 6:
|
|
1608
|
-
result =
|
|
1661
|
+
result = _context23.sent;
|
|
1609
1662
|
configs = [];
|
|
1610
1663
|
if (result.code === 200) {
|
|
1611
1664
|
configs = result.data.list.map(function (item) {
|
|
@@ -1616,22 +1669,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1616
1669
|
strategyModelIds: strategyModelIds,
|
|
1617
1670
|
strategyCount: configs.length
|
|
1618
1671
|
});
|
|
1619
|
-
return
|
|
1672
|
+
return _context23.abrupt("return", configs);
|
|
1620
1673
|
case 13:
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
this.logMethodError('fetchItemRuleConfigsByModelIds',
|
|
1674
|
+
_context23.prev = 13;
|
|
1675
|
+
_context23.t0 = _context23["catch"](3);
|
|
1676
|
+
this.logMethodError('fetchItemRuleConfigsByModelIds', _context23.t0, {
|
|
1624
1677
|
strategyModelIds: strategyModelIds
|
|
1625
1678
|
});
|
|
1626
1679
|
// A:策略加载失败时不阻塞下单
|
|
1627
|
-
return
|
|
1680
|
+
return _context23.abrupt("return", []);
|
|
1628
1681
|
case 17:
|
|
1629
1682
|
case "end":
|
|
1630
|
-
return
|
|
1683
|
+
return _context23.stop();
|
|
1631
1684
|
}
|
|
1632
|
-
},
|
|
1685
|
+
}, _callee23, this, [[3, 13]]);
|
|
1633
1686
|
}));
|
|
1634
|
-
function fetchItemRuleConfigsByModelIds(
|
|
1687
|
+
function fetchItemRuleConfigsByModelIds(_x16) {
|
|
1635
1688
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
1636
1689
|
}
|
|
1637
1690
|
return fetchItemRuleConfigsByModelIds;
|
|
@@ -1639,22 +1692,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1639
1692
|
}, {
|
|
1640
1693
|
key: "buildPrefillProductSourceMap",
|
|
1641
1694
|
value: function () {
|
|
1642
|
-
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1695
|
+
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1643
1696
|
var sourceMap, productList, visited, collectFromValue;
|
|
1644
|
-
return _regeneratorRuntime().wrap(function
|
|
1645
|
-
while (1) switch (
|
|
1697
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1698
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1646
1699
|
case 0:
|
|
1647
1700
|
sourceMap = new Map();
|
|
1648
|
-
|
|
1649
|
-
|
|
1701
|
+
_context24.prev = 1;
|
|
1702
|
+
_context24.next = 4;
|
|
1650
1703
|
return this.getProductList();
|
|
1651
1704
|
case 4:
|
|
1652
|
-
productList =
|
|
1705
|
+
productList = _context24.sent;
|
|
1653
1706
|
if (Array.isArray(productList)) {
|
|
1654
|
-
|
|
1707
|
+
_context24.next = 7;
|
|
1655
1708
|
break;
|
|
1656
1709
|
}
|
|
1657
|
-
return
|
|
1710
|
+
return _context24.abrupt("return", sourceMap);
|
|
1658
1711
|
case 7:
|
|
1659
1712
|
visited = new Set();
|
|
1660
1713
|
collectFromValue = function collectFromValue(value) {
|
|
@@ -1697,19 +1750,19 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1697
1750
|
}
|
|
1698
1751
|
};
|
|
1699
1752
|
collectFromValue(productList);
|
|
1700
|
-
|
|
1753
|
+
_context24.next = 15;
|
|
1701
1754
|
break;
|
|
1702
1755
|
case 12:
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
this.logMethodError('buildPrefillProductSourceMap',
|
|
1756
|
+
_context24.prev = 12;
|
|
1757
|
+
_context24.t0 = _context24["catch"](1);
|
|
1758
|
+
this.logMethodError('buildPrefillProductSourceMap', _context24.t0);
|
|
1706
1759
|
case 15:
|
|
1707
|
-
return
|
|
1760
|
+
return _context24.abrupt("return", sourceMap);
|
|
1708
1761
|
case 16:
|
|
1709
1762
|
case "end":
|
|
1710
|
-
return
|
|
1763
|
+
return _context24.stop();
|
|
1711
1764
|
}
|
|
1712
|
-
},
|
|
1765
|
+
}, _callee24, this, [[1, 12]]);
|
|
1713
1766
|
}));
|
|
1714
1767
|
function buildPrefillProductSourceMap() {
|
|
1715
1768
|
return _buildPrefillProductSourceMap.apply(this, arguments);
|
|
@@ -1724,58 +1777,58 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1724
1777
|
}, {
|
|
1725
1778
|
key: "ensureItemRuleConfigsLoaded",
|
|
1726
1779
|
value: function () {
|
|
1727
|
-
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1780
|
+
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
1728
1781
|
var _this6 = this;
|
|
1729
1782
|
var loadedConfigs;
|
|
1730
|
-
return _regeneratorRuntime().wrap(function
|
|
1731
|
-
while (1) switch (
|
|
1783
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1784
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1732
1785
|
case 0:
|
|
1733
1786
|
if (!(this.itemRuleConfigs.length > 0)) {
|
|
1734
|
-
|
|
1787
|
+
_context26.next = 2;
|
|
1735
1788
|
break;
|
|
1736
1789
|
}
|
|
1737
|
-
return
|
|
1790
|
+
return _context26.abrupt("return", this.itemRuleConfigs);
|
|
1738
1791
|
case 2:
|
|
1739
1792
|
if (!this.itemRuleConfigsPromise) {
|
|
1740
|
-
|
|
1793
|
+
_context26.next = 4;
|
|
1741
1794
|
break;
|
|
1742
1795
|
}
|
|
1743
|
-
return
|
|
1796
|
+
return _context26.abrupt("return", this.itemRuleConfigsPromise);
|
|
1744
1797
|
case 4:
|
|
1745
|
-
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1798
|
+
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1746
1799
|
var runtimeConfig, staticConfigs;
|
|
1747
|
-
return _regeneratorRuntime().wrap(function
|
|
1748
|
-
while (1) switch (
|
|
1800
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1801
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1749
1802
|
case 0:
|
|
1750
1803
|
runtimeConfig = _this6.getItemRuleRuntimeConfig();
|
|
1751
1804
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
1752
1805
|
if (!(staticConfigs.length > 0)) {
|
|
1753
|
-
|
|
1806
|
+
_context25.next = 6;
|
|
1754
1807
|
break;
|
|
1755
1808
|
}
|
|
1756
1809
|
_this6.itemRuleConfigs = staticConfigs;
|
|
1757
1810
|
_this6.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
1758
|
-
return
|
|
1811
|
+
return _context25.abrupt("return", _this6.itemRuleConfigs);
|
|
1759
1812
|
case 6:
|
|
1760
1813
|
_this6.itemRuleConfigs = [];
|
|
1761
1814
|
_this6.itemRuleEvaluator.setStrategyConfigs([]);
|
|
1762
|
-
return
|
|
1815
|
+
return _context25.abrupt("return", _this6.itemRuleConfigs);
|
|
1763
1816
|
case 9:
|
|
1764
1817
|
case "end":
|
|
1765
|
-
return
|
|
1818
|
+
return _context25.stop();
|
|
1766
1819
|
}
|
|
1767
|
-
},
|
|
1820
|
+
}, _callee25);
|
|
1768
1821
|
}))();
|
|
1769
|
-
|
|
1822
|
+
_context26.next = 7;
|
|
1770
1823
|
return this.itemRuleConfigsPromise;
|
|
1771
1824
|
case 7:
|
|
1772
|
-
loadedConfigs =
|
|
1773
|
-
return
|
|
1825
|
+
loadedConfigs = _context26.sent;
|
|
1826
|
+
return _context26.abrupt("return", loadedConfigs);
|
|
1774
1827
|
case 9:
|
|
1775
1828
|
case "end":
|
|
1776
|
-
return
|
|
1829
|
+
return _context26.stop();
|
|
1777
1830
|
}
|
|
1778
|
-
},
|
|
1831
|
+
}, _callee26, this);
|
|
1779
1832
|
}));
|
|
1780
1833
|
function ensureItemRuleConfigsLoaded() {
|
|
1781
1834
|
return _ensureItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -1785,22 +1838,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1785
1838
|
}, {
|
|
1786
1839
|
key: "refreshItemRuleQuantityLimits",
|
|
1787
1840
|
value: function () {
|
|
1788
|
-
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1841
|
+
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
1789
1842
|
var strategyConfigs, businessData, limits;
|
|
1790
|
-
return _regeneratorRuntime().wrap(function
|
|
1791
|
-
while (1) switch (
|
|
1843
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1844
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1792
1845
|
case 0:
|
|
1793
|
-
|
|
1794
|
-
|
|
1846
|
+
_context27.prev = 0;
|
|
1847
|
+
_context27.next = 3;
|
|
1795
1848
|
return this.ensureItemRuleConfigsLoaded();
|
|
1796
1849
|
case 3:
|
|
1797
|
-
strategyConfigs =
|
|
1850
|
+
strategyConfigs = _context27.sent;
|
|
1798
1851
|
if (strategyConfigs.length) {
|
|
1799
|
-
|
|
1852
|
+
_context27.next = 7;
|
|
1800
1853
|
break;
|
|
1801
1854
|
}
|
|
1802
1855
|
this.store.itemRuleQuantityLimits = [];
|
|
1803
|
-
return
|
|
1856
|
+
return _context27.abrupt("return", []);
|
|
1804
1857
|
case 7:
|
|
1805
1858
|
businessData = buildItemRuleBusinessData({
|
|
1806
1859
|
tempOrder: this.ensureTempOrder(),
|
|
@@ -1812,18 +1865,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1812
1865
|
this.logMethodSuccess('refreshItemRuleQuantityLimits', {
|
|
1813
1866
|
limitCount: limits.length
|
|
1814
1867
|
});
|
|
1815
|
-
return
|
|
1868
|
+
return _context27.abrupt("return", limits);
|
|
1816
1869
|
case 14:
|
|
1817
|
-
|
|
1818
|
-
|
|
1870
|
+
_context27.prev = 14;
|
|
1871
|
+
_context27.t0 = _context27["catch"](0);
|
|
1819
1872
|
this.store.itemRuleQuantityLimits = [];
|
|
1820
|
-
this.logMethodError('refreshItemRuleQuantityLimits',
|
|
1821
|
-
return
|
|
1873
|
+
this.logMethodError('refreshItemRuleQuantityLimits', _context27.t0);
|
|
1874
|
+
return _context27.abrupt("return", []);
|
|
1822
1875
|
case 19:
|
|
1823
1876
|
case "end":
|
|
1824
|
-
return
|
|
1877
|
+
return _context27.stop();
|
|
1825
1878
|
}
|
|
1826
|
-
},
|
|
1879
|
+
}, _callee27, this, [[0, 14]]);
|
|
1827
1880
|
}));
|
|
1828
1881
|
function refreshItemRuleQuantityLimits() {
|
|
1829
1882
|
return _refreshItemRuleQuantityLimits.apply(this, arguments);
|
|
@@ -1833,32 +1886,32 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1833
1886
|
}, {
|
|
1834
1887
|
key: "applyPrefillByItemRule",
|
|
1835
1888
|
value: function () {
|
|
1836
|
-
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1889
|
+
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
1837
1890
|
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator5, _step5, _prefillItem$product_, _targetProduct$_origi, _targetProduct$_origi2, _targetProduct$_origi3, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct, hasQuantityChanged, hasOriginChanged;
|
|
1838
|
-
return _regeneratorRuntime().wrap(function
|
|
1839
|
-
while (1) switch (
|
|
1891
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
1892
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1840
1893
|
case 0:
|
|
1841
1894
|
if (!this.itemRulePrefillApplied) {
|
|
1842
|
-
|
|
1895
|
+
_context28.next = 2;
|
|
1843
1896
|
break;
|
|
1844
1897
|
}
|
|
1845
|
-
return
|
|
1898
|
+
return _context28.abrupt("return");
|
|
1846
1899
|
case 2:
|
|
1847
1900
|
if (this.store.order) {
|
|
1848
|
-
|
|
1901
|
+
_context28.next = 4;
|
|
1849
1902
|
break;
|
|
1850
1903
|
}
|
|
1851
|
-
return
|
|
1904
|
+
return _context28.abrupt("return");
|
|
1852
1905
|
case 4:
|
|
1853
|
-
|
|
1906
|
+
_context28.next = 6;
|
|
1854
1907
|
return this.ensureItemRuleConfigsLoaded();
|
|
1855
1908
|
case 6:
|
|
1856
|
-
strategyConfigs =
|
|
1909
|
+
strategyConfigs = _context28.sent;
|
|
1857
1910
|
if (strategyConfigs.length) {
|
|
1858
|
-
|
|
1911
|
+
_context28.next = 9;
|
|
1859
1912
|
break;
|
|
1860
1913
|
}
|
|
1861
|
-
return
|
|
1914
|
+
return _context28.abrupt("return");
|
|
1862
1915
|
case 9:
|
|
1863
1916
|
businessData = buildItemRuleBusinessData({
|
|
1864
1917
|
tempOrder: this.ensureTempOrder(),
|
|
@@ -1867,24 +1920,24 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1867
1920
|
});
|
|
1868
1921
|
prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
|
|
1869
1922
|
if (prefillItems.length) {
|
|
1870
|
-
|
|
1923
|
+
_context28.next = 14;
|
|
1871
1924
|
break;
|
|
1872
1925
|
}
|
|
1873
1926
|
this.itemRulePrefillApplied = true;
|
|
1874
|
-
return
|
|
1927
|
+
return _context28.abrupt("return");
|
|
1875
1928
|
case 14:
|
|
1876
|
-
|
|
1929
|
+
_context28.next = 16;
|
|
1877
1930
|
return this.buildPrefillProductSourceMap();
|
|
1878
1931
|
case 16:
|
|
1879
|
-
productSourceMap =
|
|
1932
|
+
productSourceMap = _context28.sent;
|
|
1880
1933
|
tempOrder = this.ensureTempOrder();
|
|
1881
1934
|
hasChanges = false;
|
|
1882
1935
|
_iterator5 = _createForOfIteratorHelper(prefillItems);
|
|
1883
|
-
|
|
1936
|
+
_context28.prev = 20;
|
|
1884
1937
|
_iterator5.s();
|
|
1885
1938
|
case 22:
|
|
1886
1939
|
if ((_step5 = _iterator5.n()).done) {
|
|
1887
|
-
|
|
1940
|
+
_context28.next = 47;
|
|
1888
1941
|
break;
|
|
1889
1942
|
}
|
|
1890
1943
|
prefillItem = _step5.value;
|
|
@@ -1892,16 +1945,16 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1892
1945
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
1893
1946
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
1894
1947
|
if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
|
|
1895
|
-
|
|
1948
|
+
_context28.next = 29;
|
|
1896
1949
|
break;
|
|
1897
1950
|
}
|
|
1898
|
-
return
|
|
1951
|
+
return _context28.abrupt("continue", 45);
|
|
1899
1952
|
case 29:
|
|
1900
1953
|
if (!Number.isNaN(productVariantId)) {
|
|
1901
|
-
|
|
1954
|
+
_context28.next = 31;
|
|
1902
1955
|
break;
|
|
1903
1956
|
}
|
|
1904
|
-
return
|
|
1957
|
+
return _context28.abrupt("continue", 45);
|
|
1905
1958
|
case 31:
|
|
1906
1959
|
sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
|
|
1907
1960
|
productIndex = getProductIdentityIndex(tempOrder.products, {
|
|
@@ -1909,7 +1962,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1909
1962
|
product_variant_id: productVariantId
|
|
1910
1963
|
});
|
|
1911
1964
|
if (!(productIndex === -1)) {
|
|
1912
|
-
|
|
1965
|
+
_context28.next = 38;
|
|
1913
1966
|
break;
|
|
1914
1967
|
}
|
|
1915
1968
|
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');
|
|
@@ -1929,7 +1982,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1929
1982
|
})
|
|
1930
1983
|
})));
|
|
1931
1984
|
hasChanges = true;
|
|
1932
|
-
return
|
|
1985
|
+
return _context28.abrupt("continue", 45);
|
|
1933
1986
|
case 38:
|
|
1934
1987
|
targetProduct = tempOrder.products[productIndex];
|
|
1935
1988
|
existedQuantity = toNonNegativeInt(targetProduct.num);
|
|
@@ -1950,34 +2003,34 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1950
2003
|
hasChanges = true;
|
|
1951
2004
|
}
|
|
1952
2005
|
case 45:
|
|
1953
|
-
|
|
2006
|
+
_context28.next = 22;
|
|
1954
2007
|
break;
|
|
1955
2008
|
case 47:
|
|
1956
|
-
|
|
2009
|
+
_context28.next = 52;
|
|
1957
2010
|
break;
|
|
1958
2011
|
case 49:
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
_iterator5.e(
|
|
2012
|
+
_context28.prev = 49;
|
|
2013
|
+
_context28.t0 = _context28["catch"](20);
|
|
2014
|
+
_iterator5.e(_context28.t0);
|
|
1962
2015
|
case 52:
|
|
1963
|
-
|
|
2016
|
+
_context28.prev = 52;
|
|
1964
2017
|
_iterator5.f();
|
|
1965
|
-
return
|
|
2018
|
+
return _context28.finish(52);
|
|
1966
2019
|
case 55:
|
|
1967
2020
|
if (!hasChanges) {
|
|
1968
|
-
|
|
2021
|
+
_context28.next = 60;
|
|
1969
2022
|
break;
|
|
1970
2023
|
}
|
|
1971
2024
|
// Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
|
|
1972
2025
|
this.store.order.applyDiscount();
|
|
1973
|
-
|
|
2026
|
+
_context28.next = 59;
|
|
1974
2027
|
return this.store.order.recalculateSummary({
|
|
1975
2028
|
createIfMissing: true
|
|
1976
2029
|
});
|
|
1977
2030
|
case 59:
|
|
1978
2031
|
this.store.order.persistTempOrder();
|
|
1979
2032
|
case 60:
|
|
1980
|
-
|
|
2033
|
+
_context28.next = 62;
|
|
1981
2034
|
return this.refreshItemRuleQuantityLimits();
|
|
1982
2035
|
case 62:
|
|
1983
2036
|
this.itemRulePrefillApplied = true;
|
|
@@ -1987,9 +2040,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1987
2040
|
});
|
|
1988
2041
|
case 64:
|
|
1989
2042
|
case "end":
|
|
1990
|
-
return
|
|
2043
|
+
return _context28.stop();
|
|
1991
2044
|
}
|
|
1992
|
-
},
|
|
2045
|
+
}, _callee28, this, [[20, 49, 52, 55]]);
|
|
1993
2046
|
}));
|
|
1994
2047
|
function applyPrefillByItemRule() {
|
|
1995
2048
|
return _applyPrefillByItemRule.apply(this, arguments);
|
|
@@ -1999,31 +2052,31 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1999
2052
|
}, {
|
|
2000
2053
|
key: "applyItemRulePrefill",
|
|
2001
2054
|
value: function () {
|
|
2002
|
-
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2055
|
+
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2003
2056
|
var _this$store$order4, _this$store$order4$ge;
|
|
2004
|
-
return _regeneratorRuntime().wrap(function
|
|
2005
|
-
while (1) switch (
|
|
2057
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2058
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2006
2059
|
case 0:
|
|
2007
2060
|
if (!((_this$store$order4 = this.store.order) !== null && _this$store$order4 !== void 0 && (_this$store$order4$ge = _this$store$order4.getLastOrderInfo) !== null && _this$store$order4$ge !== void 0 && _this$store$order4$ge.call(_this$store$order4))) {
|
|
2008
|
-
|
|
2061
|
+
_context29.next = 2;
|
|
2009
2062
|
break;
|
|
2010
2063
|
}
|
|
2011
|
-
return
|
|
2064
|
+
return _context29.abrupt("return");
|
|
2012
2065
|
case 2:
|
|
2013
2066
|
this.logMethodStart('applyItemRulePrefill');
|
|
2014
|
-
|
|
2067
|
+
_context29.next = 5;
|
|
2015
2068
|
return this.applyPrefillByItemRule();
|
|
2016
2069
|
case 5:
|
|
2017
|
-
|
|
2070
|
+
_context29.next = 7;
|
|
2018
2071
|
return this.refreshItemRuleQuantityLimits();
|
|
2019
2072
|
case 7:
|
|
2020
|
-
|
|
2073
|
+
_context29.next = 9;
|
|
2021
2074
|
return this.refreshCartValidationPassed();
|
|
2022
2075
|
case 9:
|
|
2023
2076
|
case "end":
|
|
2024
|
-
return
|
|
2077
|
+
return _context29.stop();
|
|
2025
2078
|
}
|
|
2026
|
-
},
|
|
2079
|
+
}, _callee29, this);
|
|
2027
2080
|
}));
|
|
2028
2081
|
function applyItemRulePrefill() {
|
|
2029
2082
|
return _applyItemRulePrefill.apply(this, arguments);
|
|
@@ -2033,20 +2086,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2033
2086
|
}, {
|
|
2034
2087
|
key: "evaluateCartValidationByItemRule",
|
|
2035
2088
|
value: function () {
|
|
2036
|
-
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2089
|
+
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2037
2090
|
var strategyConfigs, businessData;
|
|
2038
|
-
return _regeneratorRuntime().wrap(function
|
|
2039
|
-
while (1) switch (
|
|
2091
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2092
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2040
2093
|
case 0:
|
|
2041
|
-
|
|
2094
|
+
_context30.next = 2;
|
|
2042
2095
|
return this.ensureItemRuleConfigsLoaded();
|
|
2043
2096
|
case 2:
|
|
2044
|
-
strategyConfigs =
|
|
2097
|
+
strategyConfigs = _context30.sent;
|
|
2045
2098
|
if (strategyConfigs.length) {
|
|
2046
|
-
|
|
2099
|
+
_context30.next = 5;
|
|
2047
2100
|
break;
|
|
2048
2101
|
}
|
|
2049
|
-
return
|
|
2102
|
+
return _context30.abrupt("return", {
|
|
2050
2103
|
passed: true,
|
|
2051
2104
|
failures: []
|
|
2052
2105
|
});
|
|
@@ -2056,12 +2109,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2056
2109
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
2057
2110
|
itemRuleConfigs: this.itemRuleConfigs
|
|
2058
2111
|
});
|
|
2059
|
-
return
|
|
2112
|
+
return _context30.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
|
|
2060
2113
|
case 7:
|
|
2061
2114
|
case "end":
|
|
2062
|
-
return
|
|
2115
|
+
return _context30.stop();
|
|
2063
2116
|
}
|
|
2064
|
-
},
|
|
2117
|
+
}, _callee30, this);
|
|
2065
2118
|
}));
|
|
2066
2119
|
function evaluateCartValidationByItemRule() {
|
|
2067
2120
|
return _evaluateCartValidationByItemRule.apply(this, arguments);
|
|
@@ -2071,20 +2124,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2071
2124
|
}, {
|
|
2072
2125
|
key: "validateBeforeSubmitByItemRule",
|
|
2073
2126
|
value: function () {
|
|
2074
|
-
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2127
|
+
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2075
2128
|
var validationResult, firstFailure, errorMessage, error;
|
|
2076
|
-
return _regeneratorRuntime().wrap(function
|
|
2077
|
-
while (1) switch (
|
|
2129
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2130
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2078
2131
|
case 0:
|
|
2079
|
-
|
|
2132
|
+
_context31.next = 2;
|
|
2080
2133
|
return this.evaluateCartValidationByItemRule();
|
|
2081
2134
|
case 2:
|
|
2082
|
-
validationResult =
|
|
2135
|
+
validationResult = _context31.sent;
|
|
2083
2136
|
if (!validationResult.passed) {
|
|
2084
|
-
|
|
2137
|
+
_context31.next = 5;
|
|
2085
2138
|
break;
|
|
2086
2139
|
}
|
|
2087
|
-
return
|
|
2140
|
+
return _context31.abrupt("return");
|
|
2088
2141
|
case 5:
|
|
2089
2142
|
firstFailure = validationResult.failures[0];
|
|
2090
2143
|
errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
|
|
@@ -2093,9 +2146,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2093
2146
|
throw error;
|
|
2094
2147
|
case 10:
|
|
2095
2148
|
case "end":
|
|
2096
|
-
return
|
|
2149
|
+
return _context31.stop();
|
|
2097
2150
|
}
|
|
2098
|
-
},
|
|
2151
|
+
}, _callee31, this);
|
|
2099
2152
|
}));
|
|
2100
2153
|
function validateBeforeSubmitByItemRule() {
|
|
2101
2154
|
return _validateBeforeSubmitByItemRule.apply(this, arguments);
|
|
@@ -2105,10 +2158,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2105
2158
|
}, {
|
|
2106
2159
|
key: "refreshCartValidationPassed",
|
|
2107
2160
|
value: function () {
|
|
2108
|
-
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2161
|
+
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
2109
2162
|
var previous, nextState, validationResult, changed;
|
|
2110
|
-
return _regeneratorRuntime().wrap(function
|
|
2111
|
-
while (1) switch (
|
|
2163
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2164
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2112
2165
|
case 0:
|
|
2113
2166
|
previous = this.store.cartValidation || {
|
|
2114
2167
|
passed: null,
|
|
@@ -2118,20 +2171,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2118
2171
|
passed: null,
|
|
2119
2172
|
failures: []
|
|
2120
2173
|
};
|
|
2121
|
-
|
|
2122
|
-
|
|
2174
|
+
_context32.prev = 2;
|
|
2175
|
+
_context32.next = 5;
|
|
2123
2176
|
return this.evaluateCartValidationByItemRule();
|
|
2124
2177
|
case 5:
|
|
2125
|
-
validationResult =
|
|
2178
|
+
validationResult = _context32.sent;
|
|
2126
2179
|
nextState = {
|
|
2127
2180
|
passed: validationResult.passed,
|
|
2128
2181
|
failures: validationResult.failures || []
|
|
2129
2182
|
};
|
|
2130
|
-
|
|
2183
|
+
_context32.next = 12;
|
|
2131
2184
|
break;
|
|
2132
2185
|
case 9:
|
|
2133
|
-
|
|
2134
|
-
|
|
2186
|
+
_context32.prev = 9;
|
|
2187
|
+
_context32.t0 = _context32["catch"](2);
|
|
2135
2188
|
nextState = {
|
|
2136
2189
|
passed: false,
|
|
2137
2190
|
failures: []
|
|
@@ -2140,21 +2193,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2140
2193
|
this.store.cartValidation = nextState;
|
|
2141
2194
|
changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
|
|
2142
2195
|
if (!changed) {
|
|
2143
|
-
|
|
2196
|
+
_context32.next = 17;
|
|
2144
2197
|
break;
|
|
2145
2198
|
}
|
|
2146
|
-
|
|
2199
|
+
_context32.next = 17;
|
|
2147
2200
|
return this.core.effects.emit(ScanOrderHooks.onCartValidationChanged, {
|
|
2148
2201
|
cartValidation: nextState,
|
|
2149
2202
|
cartValidationPassed: nextState.passed
|
|
2150
2203
|
});
|
|
2151
2204
|
case 17:
|
|
2152
|
-
return
|
|
2205
|
+
return _context32.abrupt("return", nextState.passed);
|
|
2153
2206
|
case 18:
|
|
2154
2207
|
case "end":
|
|
2155
|
-
return
|
|
2208
|
+
return _context32.stop();
|
|
2156
2209
|
}
|
|
2157
|
-
},
|
|
2210
|
+
}, _callee32, this, [[2, 9]]);
|
|
2158
2211
|
}));
|
|
2159
2212
|
function refreshCartValidationPassed() {
|
|
2160
2213
|
return _refreshCartValidationPassed.apply(this, arguments);
|
|
@@ -2164,14 +2217,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2164
2217
|
}, {
|
|
2165
2218
|
key: "setItemRuleRuntimeConfig",
|
|
2166
2219
|
value: function () {
|
|
2167
|
-
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2220
|
+
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2168
2221
|
var _this$itemRuleRuntime, _this$itemRuleRuntime2;
|
|
2169
2222
|
var config,
|
|
2170
|
-
|
|
2171
|
-
return _regeneratorRuntime().wrap(function
|
|
2172
|
-
while (1) switch (
|
|
2223
|
+
_args33 = arguments;
|
|
2224
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2225
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2173
2226
|
case 0:
|
|
2174
|
-
config =
|
|
2227
|
+
config = _args33.length > 0 && _args33[0] !== undefined ? _args33[0] : {};
|
|
2175
2228
|
this.logMethodStart('setItemRuleRuntimeConfig');
|
|
2176
2229
|
this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
|
|
2177
2230
|
pax: _objectSpread(_objectSpread({}, ((_this$itemRuleRuntime = this.itemRuleRuntimeConfig) === null || _this$itemRuleRuntime === void 0 ? void 0 : _this$itemRuleRuntime.pax) || {}), (config === null || config === void 0 ? void 0 : config.pax) || {}),
|
|
@@ -2183,10 +2236,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2183
2236
|
this.itemRuleEvaluator.setStrategyConfigs([]);
|
|
2184
2237
|
}
|
|
2185
2238
|
this.itemRulePrefillApplied = false;
|
|
2186
|
-
|
|
2239
|
+
_context33.next = 7;
|
|
2187
2240
|
return this.refreshItemRuleQuantityLimits();
|
|
2188
2241
|
case 7:
|
|
2189
|
-
|
|
2242
|
+
_context33.next = 9;
|
|
2190
2243
|
return this.refreshCartValidationPassed();
|
|
2191
2244
|
case 9:
|
|
2192
2245
|
this.logMethodSuccess('setItemRuleRuntimeConfig', {
|
|
@@ -2194,9 +2247,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2194
2247
|
});
|
|
2195
2248
|
case 10:
|
|
2196
2249
|
case "end":
|
|
2197
|
-
return
|
|
2250
|
+
return _context33.stop();
|
|
2198
2251
|
}
|
|
2199
|
-
},
|
|
2252
|
+
}, _callee33, this);
|
|
2200
2253
|
}));
|
|
2201
2254
|
function setItemRuleRuntimeConfig() {
|
|
2202
2255
|
return _setItemRuleRuntimeConfig.apply(this, arguments);
|
|
@@ -2295,27 +2348,27 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2295
2348
|
}, {
|
|
2296
2349
|
key: "fetchResourceOccupyDetailByResourceId",
|
|
2297
2350
|
value: function () {
|
|
2298
|
-
var _fetchResourceOccupyDetailByResourceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2351
|
+
var _fetchResourceOccupyDetailByResourceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(resourceId) {
|
|
2299
2352
|
var _this$otherParams9, _this$otherParams9$ge, _response$data$occupy, _response$data;
|
|
2300
2353
|
var formRecordId, shopId, response;
|
|
2301
|
-
return _regeneratorRuntime().wrap(function
|
|
2302
|
-
while (1) switch (
|
|
2354
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2355
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2303
2356
|
case 0:
|
|
2304
2357
|
formRecordId = Number(resourceId);
|
|
2305
2358
|
if (!(!Number.isFinite(formRecordId) || formRecordId <= 0)) {
|
|
2306
|
-
|
|
2359
|
+
_context34.next = 3;
|
|
2307
2360
|
break;
|
|
2308
2361
|
}
|
|
2309
2362
|
throw new Error("[ScanOrder] \u975E\u6CD5\u684C\u53F0 resourceId: ".concat(resourceId));
|
|
2310
2363
|
case 3:
|
|
2311
2364
|
shopId = (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 || (_this$otherParams9$ge = _this$otherParams9.getStateData) === null || _this$otherParams9$ge === void 0 ? void 0 : _this$otherParams9$ge.call(_this$otherParams9, 'shop_id');
|
|
2312
2365
|
if (shopId) {
|
|
2313
|
-
|
|
2366
|
+
_context34.next = 6;
|
|
2314
2367
|
break;
|
|
2315
2368
|
}
|
|
2316
2369
|
throw new Error('[ScanOrder] 无法获取 shop_id');
|
|
2317
2370
|
case 6:
|
|
2318
|
-
|
|
2371
|
+
_context34.next = 8;
|
|
2319
2372
|
return this.request.get('/order/resource/occupy-detail', {
|
|
2320
2373
|
shop_id: shopId,
|
|
2321
2374
|
'form_record_ids[]': formRecordId,
|
|
@@ -2324,21 +2377,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2324
2377
|
with_resource_form_info: 1
|
|
2325
2378
|
});
|
|
2326
2379
|
case 8:
|
|
2327
|
-
response =
|
|
2380
|
+
response = _context34.sent;
|
|
2328
2381
|
if (response !== null && response !== void 0 && response.status) {
|
|
2329
|
-
|
|
2382
|
+
_context34.next = 11;
|
|
2330
2383
|
break;
|
|
2331
2384
|
}
|
|
2332
2385
|
throw new Error((response === null || response === void 0 ? void 0 : response.message) || '获取资源占用详情失败');
|
|
2333
2386
|
case 11:
|
|
2334
|
-
return
|
|
2387
|
+
return _context34.abrupt("return", (_response$data$occupy = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 || (_response$data = _response$data.occupy_details) === null || _response$data === void 0 ? void 0 : _response$data[0]) !== null && _response$data$occupy !== void 0 ? _response$data$occupy : null);
|
|
2335
2388
|
case 12:
|
|
2336
2389
|
case "end":
|
|
2337
|
-
return
|
|
2390
|
+
return _context34.stop();
|
|
2338
2391
|
}
|
|
2339
|
-
},
|
|
2392
|
+
}, _callee34, this);
|
|
2340
2393
|
}));
|
|
2341
|
-
function fetchResourceOccupyDetailByResourceId(
|
|
2394
|
+
function fetchResourceOccupyDetailByResourceId(_x17) {
|
|
2342
2395
|
return _fetchResourceOccupyDetailByResourceId.apply(this, arguments);
|
|
2343
2396
|
}
|
|
2344
2397
|
return fetchResourceOccupyDetailByResourceId;
|
|
@@ -2348,32 +2401,32 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2348
2401
|
}, {
|
|
2349
2402
|
key: "checkResourceAvailable",
|
|
2350
2403
|
value: function () {
|
|
2351
|
-
var _checkResourceAvailable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2404
|
+
var _checkResourceAvailable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(resourceId, hasOrderId) {
|
|
2352
2405
|
var _this$otherParams10, _this$otherParams10$g, _occupyDetail$form_re, _occupyDetail$form_re2, _this$otherParams11, _this$store$order5, _this$store$order7, _this$store$order7$ge, _this$otherParams12, 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;
|
|
2353
|
-
return _regeneratorRuntime().wrap(function
|
|
2354
|
-
while (1) switch (
|
|
2406
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2407
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2355
2408
|
case 0:
|
|
2356
2409
|
this.logMethodStart('checkResourceAvailable', {
|
|
2357
2410
|
resourceId: resourceId
|
|
2358
2411
|
});
|
|
2359
|
-
|
|
2360
|
-
|
|
2412
|
+
_context35.prev = 1;
|
|
2413
|
+
_context35.next = 4;
|
|
2361
2414
|
return (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 || (_this$otherParams10$g = _this$otherParams10.getOpenData) === null || _this$otherParams10$g === void 0 ? void 0 : _this$otherParams10$g.call(_this$otherParams10, {
|
|
2362
2415
|
scope: 'board',
|
|
2363
2416
|
target: 'dine_in+scan_to_order',
|
|
2364
2417
|
section_code: ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow']
|
|
2365
2418
|
});
|
|
2366
2419
|
case 4:
|
|
2367
|
-
openData =
|
|
2420
|
+
openData = _context35.sent;
|
|
2368
2421
|
if (!((openData === null || openData === void 0 ? void 0 : openData.status) === false)) {
|
|
2369
|
-
|
|
2422
|
+
_context35.next = 7;
|
|
2370
2423
|
break;
|
|
2371
2424
|
}
|
|
2372
2425
|
throw new Error((openData === null || openData === void 0 ? void 0 : openData.message) || '获取店铺配置失败');
|
|
2373
2426
|
case 7:
|
|
2374
2427
|
dineInConfig = (openData === null || openData === void 0 ? void 0 : openData.data) || {};
|
|
2375
2428
|
this.otherParams.dineInConfig = dineInConfig;
|
|
2376
|
-
|
|
2429
|
+
_context35.next = 11;
|
|
2377
2430
|
return this.syncItemRuleConfigsFromDineInConfig(dineInConfig);
|
|
2378
2431
|
case 11:
|
|
2379
2432
|
closedBehaviorValue = dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_behavior'];
|
|
@@ -2392,20 +2445,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2392
2445
|
};
|
|
2393
2446
|
}; // 1. 基础开关 basic.enable 关闭
|
|
2394
2447
|
if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.enable']) === false)) {
|
|
2395
|
-
|
|
2448
|
+
_context35.next = 18;
|
|
2396
2449
|
break;
|
|
2397
2450
|
}
|
|
2398
|
-
return
|
|
2451
|
+
return _context35.abrupt("return", makeShopClosed(basicUnavailableMessage));
|
|
2399
2452
|
case 18:
|
|
2400
2453
|
if (!toBoolean(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.paused'])) {
|
|
2401
|
-
|
|
2454
|
+
_context35.next = 21;
|
|
2402
2455
|
break;
|
|
2403
2456
|
}
|
|
2404
2457
|
if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.pause_behavior']) === 'hide_all')) {
|
|
2405
|
-
|
|
2458
|
+
_context35.next = 21;
|
|
2406
2459
|
break;
|
|
2407
2460
|
}
|
|
2408
|
-
return
|
|
2461
|
+
return _context35.abrupt("return", makeShopClosed(pauseMessage));
|
|
2409
2462
|
case 21:
|
|
2410
2463
|
// 3. 营业时间 operating_hours 闸门
|
|
2411
2464
|
operatingHourIds = Array.isArray(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.operating_hours']) ? dineInConfig['availability.operating_hours'].map(function (id) {
|
|
@@ -2422,27 +2475,27 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2422
2475
|
}
|
|
2423
2476
|
}
|
|
2424
2477
|
if (!(outsideOperatingHours && closedBehaviorValue !== 'show_menu_disabled')) {
|
|
2425
|
-
|
|
2478
|
+
_context35.next = 26;
|
|
2426
2479
|
break;
|
|
2427
2480
|
}
|
|
2428
|
-
return
|
|
2481
|
+
return _context35.abrupt("return", makeShopClosed(closedMessage, closedBehaviorValue));
|
|
2429
2482
|
case 26:
|
|
2430
2483
|
// Step1: 先加载预约规则商品,拿到 enabledReservationRuleProducts 与容量附加信息
|
|
2431
2484
|
// (resourceSelectType 需要基于这些商品 + 占用接口的 form_id 计算,故必须前置)
|
|
2432
2485
|
tempOrder = this.ensureTempOrder();
|
|
2433
2486
|
reservationLinkIds = collectLinkProductIdsFromReservationRules(dineInConfig['fulfillment.enabled_resource_rules']);
|
|
2434
2487
|
if (!(reservationLinkIds.length === 0)) {
|
|
2435
|
-
|
|
2488
|
+
_context35.next = 32;
|
|
2436
2489
|
break;
|
|
2437
2490
|
}
|
|
2438
2491
|
this.enabledReservationRuleProducts = [];
|
|
2439
|
-
|
|
2492
|
+
_context35.next = 43;
|
|
2440
2493
|
break;
|
|
2441
2494
|
case 32:
|
|
2442
2495
|
tempOrder.metadata = _objectSpread({}, tempOrder.metadata || {});
|
|
2443
2496
|
delete tempOrder.metadata.table_occupancy_duration;
|
|
2444
2497
|
reservationProductList = new ProductList("".concat(this.name, "_reservationEnabledRules"), this.defaultVersion);
|
|
2445
|
-
|
|
2498
|
+
_context35.next = 37;
|
|
2446
2499
|
return reservationProductList.initialize(this.core, {
|
|
2447
2500
|
store: {
|
|
2448
2501
|
list: [],
|
|
@@ -2457,7 +2510,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2457
2510
|
case 37:
|
|
2458
2511
|
scheduleDate = dayjs().format('YYYY-MM-DD');
|
|
2459
2512
|
scheduleDatetime = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
2460
|
-
|
|
2513
|
+
_context35.next = 41;
|
|
2461
2514
|
return reservationProductList.loadProducts({
|
|
2462
2515
|
product_ids: reservationLinkIds,
|
|
2463
2516
|
schedule_date: scheduleDate,
|
|
@@ -2465,7 +2518,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2465
2518
|
cacheId: this.cacheId
|
|
2466
2519
|
});
|
|
2467
2520
|
case 41:
|
|
2468
|
-
loaded =
|
|
2521
|
+
loaded = _context35.sent;
|
|
2469
2522
|
if (Array.isArray(loaded)) {
|
|
2470
2523
|
this.enabledReservationRuleProducts = loaded;
|
|
2471
2524
|
occupancyMinutes = pickFirstDurationMinutesFromProducts(loaded);
|
|
@@ -2490,10 +2543,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2490
2543
|
});
|
|
2491
2544
|
}
|
|
2492
2545
|
case 43:
|
|
2493
|
-
|
|
2546
|
+
_context35.next = 45;
|
|
2494
2547
|
return this.fetchResourceOccupyDetailByResourceId(resourceId);
|
|
2495
2548
|
case 45:
|
|
2496
|
-
occupyDetail =
|
|
2549
|
+
occupyDetail = _context35.sent;
|
|
2497
2550
|
// Step3: 结合预约规则商品的 product_resource.resources 与占用接口返回的 form_id,
|
|
2498
2551
|
// 计算当前桌台的 resourceSelectType(single/multiple/capacity)
|
|
2499
2552
|
resourceSelectType = this.resolveResourceSelectType(toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id)); // Step4: 用 occupyDetail + resourceSelectType 规整为 resourceState
|
|
@@ -2533,10 +2586,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2533
2586
|
|
|
2534
2587
|
// 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
|
|
2535
2588
|
if (!(availabilityInfo.mode === 'idle')) {
|
|
2536
|
-
|
|
2589
|
+
_context35.next = 60;
|
|
2537
2590
|
break;
|
|
2538
2591
|
}
|
|
2539
|
-
|
|
2592
|
+
_context35.next = 60;
|
|
2540
2593
|
return this.addNewOrder();
|
|
2541
2594
|
case 60:
|
|
2542
2595
|
// 如果是加单模式,tempOrder 里 需要记录 lastOrderId,提交的时候走加单接口
|
|
@@ -2544,23 +2597,23 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2544
2597
|
tempOrder.order_id = resourceState.lastOrderId;
|
|
2545
2598
|
}
|
|
2546
2599
|
if (!tempOrder.order_id) {
|
|
2547
|
-
|
|
2600
|
+
_context35.next = 69;
|
|
2548
2601
|
break;
|
|
2549
2602
|
}
|
|
2550
|
-
|
|
2603
|
+
_context35.next = 64;
|
|
2551
2604
|
return (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getOrderInfoByRemote(tempOrder.order_id);
|
|
2552
2605
|
case 64:
|
|
2553
|
-
res =
|
|
2606
|
+
res = _context35.sent;
|
|
2554
2607
|
// 找到下单的时候输入的 entryPaxNumber
|
|
2555
2608
|
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) {
|
|
2556
2609
|
var _p$metadata;
|
|
2557
2610
|
return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
|
|
2558
2611
|
})) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
|
|
2559
2612
|
if (!entryPaxNumber) {
|
|
2560
|
-
|
|
2613
|
+
_context35.next = 69;
|
|
2561
2614
|
break;
|
|
2562
2615
|
}
|
|
2563
|
-
|
|
2616
|
+
_context35.next = 69;
|
|
2564
2617
|
return this.setEntryPaxNumber(entryPaxNumber);
|
|
2565
2618
|
case 69:
|
|
2566
2619
|
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);
|
|
@@ -2574,7 +2627,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2574
2627
|
} : {}));
|
|
2575
2628
|
return acc;
|
|
2576
2629
|
}, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
|
|
2577
|
-
|
|
2630
|
+
_context35.next = 73;
|
|
2578
2631
|
return this.setItemRuleRuntimeConfig({
|
|
2579
2632
|
serviceType: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode,
|
|
2580
2633
|
submissionIndex: hasOrderId ? 1 : 0,
|
|
@@ -2601,21 +2654,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2601
2654
|
isExclusive: resourceState.isExclusive,
|
|
2602
2655
|
isFull: resourceState.isFull
|
|
2603
2656
|
});
|
|
2604
|
-
return
|
|
2657
|
+
return _context35.abrupt("return", availabilityInfo);
|
|
2605
2658
|
case 78:
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
this.logMethodError('checkResourceAvailable',
|
|
2659
|
+
_context35.prev = 78;
|
|
2660
|
+
_context35.t0 = _context35["catch"](1);
|
|
2661
|
+
this.logMethodError('checkResourceAvailable', _context35.t0.message, {
|
|
2609
2662
|
resourceId: resourceId
|
|
2610
2663
|
});
|
|
2611
|
-
throw
|
|
2664
|
+
throw _context35.t0;
|
|
2612
2665
|
case 82:
|
|
2613
2666
|
case "end":
|
|
2614
|
-
return
|
|
2667
|
+
return _context35.stop();
|
|
2615
2668
|
}
|
|
2616
|
-
},
|
|
2669
|
+
}, _callee35, this, [[1, 78]]);
|
|
2617
2670
|
}));
|
|
2618
|
-
function checkResourceAvailable(
|
|
2671
|
+
function checkResourceAvailable(_x18, _x19) {
|
|
2619
2672
|
return _checkResourceAvailable.apply(this, arguments);
|
|
2620
2673
|
}
|
|
2621
2674
|
return checkResourceAvailable;
|
|
@@ -2623,10 +2676,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2623
2676
|
}, {
|
|
2624
2677
|
key: "getAdditionalOrderInfo",
|
|
2625
2678
|
value: function () {
|
|
2626
|
-
var _getAdditionalOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2679
|
+
var _getAdditionalOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
2627
2680
|
var result;
|
|
2628
|
-
return _regeneratorRuntime().wrap(function
|
|
2629
|
-
while (1) switch (
|
|
2681
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2682
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2630
2683
|
case 0:
|
|
2631
2684
|
this.logMethodStart('getAdditionalOrderInfo');
|
|
2632
2685
|
result = {
|
|
@@ -2640,12 +2693,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2640
2693
|
orderId: result.orderId,
|
|
2641
2694
|
orderStatus: result.orderStatus
|
|
2642
2695
|
});
|
|
2643
|
-
return
|
|
2696
|
+
return _context36.abrupt("return", result);
|
|
2644
2697
|
case 4:
|
|
2645
2698
|
case "end":
|
|
2646
|
-
return
|
|
2699
|
+
return _context36.stop();
|
|
2647
2700
|
}
|
|
2648
|
-
},
|
|
2701
|
+
}, _callee36, this);
|
|
2649
2702
|
}));
|
|
2650
2703
|
function getAdditionalOrderInfo() {
|
|
2651
2704
|
return _getAdditionalOrderInfo.apply(this, arguments);
|
|
@@ -2655,19 +2708,19 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2655
2708
|
}, {
|
|
2656
2709
|
key: "getProductList",
|
|
2657
2710
|
value: function () {
|
|
2658
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2711
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
2659
2712
|
var _this$otherParams13;
|
|
2660
2713
|
var menu_list_ids, _this$store$products, res, formattedRes;
|
|
2661
|
-
return _regeneratorRuntime().wrap(function
|
|
2662
|
-
while (1) switch (
|
|
2714
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
2715
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2663
2716
|
case 0:
|
|
2664
2717
|
this.logMethodStart('getProductList');
|
|
2665
2718
|
// 可以直接通过配置里的 menu 读取
|
|
2666
2719
|
menu_list_ids = ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.dineInConfig) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13['menu.associated_menus'].map(function (n) {
|
|
2667
2720
|
return Number(n.value);
|
|
2668
2721
|
})) || [];
|
|
2669
|
-
|
|
2670
|
-
|
|
2722
|
+
_context37.prev = 2;
|
|
2723
|
+
_context37.next = 5;
|
|
2671
2724
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
2672
2725
|
menu_list_ids: menu_list_ids,
|
|
2673
2726
|
cacheId: this.cacheId,
|
|
@@ -2675,22 +2728,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2675
2728
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
2676
2729
|
});
|
|
2677
2730
|
case 5:
|
|
2678
|
-
res =
|
|
2731
|
+
res = _context37.sent;
|
|
2679
2732
|
formattedRes = attachItemRuleLimitsToTopLevelProducts(res, this.store.itemRuleQuantityLimits || []);
|
|
2680
2733
|
this.logMethodSuccess('getProductList', {
|
|
2681
2734
|
menuCount: menu_list_ids.length
|
|
2682
2735
|
});
|
|
2683
|
-
return
|
|
2736
|
+
return _context37.abrupt("return", formattedRes);
|
|
2684
2737
|
case 11:
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
this.logMethodError('getProductList',
|
|
2688
|
-
throw
|
|
2738
|
+
_context37.prev = 11;
|
|
2739
|
+
_context37.t0 = _context37["catch"](2);
|
|
2740
|
+
this.logMethodError('getProductList', _context37.t0.message);
|
|
2741
|
+
throw _context37.t0;
|
|
2689
2742
|
case 15:
|
|
2690
2743
|
case "end":
|
|
2691
|
-
return
|
|
2744
|
+
return _context37.stop();
|
|
2692
2745
|
}
|
|
2693
|
-
},
|
|
2746
|
+
}, _callee37, this, [[2, 11]]);
|
|
2694
2747
|
}));
|
|
2695
2748
|
function getProductList() {
|
|
2696
2749
|
return _getProductList.apply(this, arguments);
|
|
@@ -2705,15 +2758,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2705
2758
|
}, {
|
|
2706
2759
|
key: "setOtherParams",
|
|
2707
2760
|
value: function () {
|
|
2708
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2761
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
2709
2762
|
var _ref8,
|
|
2710
2763
|
_ref8$cover,
|
|
2711
2764
|
cover,
|
|
2712
|
-
|
|
2713
|
-
return _regeneratorRuntime().wrap(function
|
|
2714
|
-
while (1) switch (
|
|
2765
|
+
_args38 = arguments;
|
|
2766
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
2767
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
2715
2768
|
case 0:
|
|
2716
|
-
_ref8 =
|
|
2769
|
+
_ref8 = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : {}, _ref8$cover = _ref8.cover, cover = _ref8$cover === void 0 ? false : _ref8$cover;
|
|
2717
2770
|
if (cover) {
|
|
2718
2771
|
this.otherParams = params;
|
|
2719
2772
|
} else {
|
|
@@ -2721,11 +2774,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2721
2774
|
}
|
|
2722
2775
|
case 2:
|
|
2723
2776
|
case "end":
|
|
2724
|
-
return
|
|
2777
|
+
return _context38.stop();
|
|
2725
2778
|
}
|
|
2726
|
-
},
|
|
2779
|
+
}, _callee38, this);
|
|
2727
2780
|
}));
|
|
2728
|
-
function setOtherParams(
|
|
2781
|
+
function setOtherParams(_x20) {
|
|
2729
2782
|
return _setOtherParams.apply(this, arguments);
|
|
2730
2783
|
}
|
|
2731
2784
|
return setOtherParams;
|
|
@@ -2815,10 +2868,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2815
2868
|
}, {
|
|
2816
2869
|
key: "setEntryPaxNumber",
|
|
2817
2870
|
value: function () {
|
|
2818
|
-
var _setEntryPaxNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2871
|
+
var _setEntryPaxNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(number) {
|
|
2819
2872
|
var pax, t;
|
|
2820
|
-
return _regeneratorRuntime().wrap(function
|
|
2821
|
-
while (1) switch (
|
|
2873
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
2874
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
2822
2875
|
case 0:
|
|
2823
2876
|
pax = normalizeSubmitCollectPaxValue(number);
|
|
2824
2877
|
this.store.entryPaxNumber = pax;
|
|
@@ -2839,18 +2892,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2839
2892
|
}
|
|
2840
2893
|
});
|
|
2841
2894
|
this.itemRulePrefillApplied = false;
|
|
2842
|
-
|
|
2895
|
+
_context39.next = 7;
|
|
2843
2896
|
return this.refreshItemRuleQuantityLimits();
|
|
2844
2897
|
case 7:
|
|
2845
|
-
|
|
2898
|
+
_context39.next = 9;
|
|
2846
2899
|
return this.refreshCartValidationPassed();
|
|
2847
2900
|
case 9:
|
|
2848
2901
|
case "end":
|
|
2849
|
-
return
|
|
2902
|
+
return _context39.stop();
|
|
2850
2903
|
}
|
|
2851
|
-
},
|
|
2904
|
+
}, _callee39, this);
|
|
2852
2905
|
}));
|
|
2853
|
-
function setEntryPaxNumber(
|
|
2906
|
+
function setEntryPaxNumber(_x21) {
|
|
2854
2907
|
return _setEntryPaxNumber.apply(this, arguments);
|
|
2855
2908
|
}
|
|
2856
2909
|
return setEntryPaxNumber;
|