@pisell/pisellos 0.10.19 → 0.10.21

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.
Files changed (36) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/OpenData/index.d.ts +10 -1
  3. package/dist/modules/OpenData/index.js +268 -14
  4. package/dist/modules/OpenData/types.d.ts +14 -1
  5. package/dist/modules/OpenData/utils.d.ts +6 -0
  6. package/dist/modules/OpenData/utils.js +50 -5
  7. package/dist/modules/Order/index.d.ts +1 -1
  8. package/dist/plugins/request.d.ts +2 -1
  9. package/dist/plugins/request.js +4 -2
  10. package/dist/server/index.d.ts +5 -0
  11. package/dist/server/index.js +80 -41
  12. package/dist/server/utils/small-ticket.js +52 -0
  13. package/dist/solution/BaseSales/index.js +23 -0
  14. package/dist/solution/BookingByStep/index.d.ts +1 -1
  15. package/dist/solution/BookingTicket/index.d.ts +13 -1
  16. package/dist/solution/BookingTicket/index.js +25 -18
  17. package/dist/solution/Sales/index.js +29 -22
  18. package/dist/solution/UnifiedBookingSales/index.js +25 -18
  19. package/lib/modules/OpenData/index.d.ts +10 -1
  20. package/lib/modules/OpenData/index.js +170 -3
  21. package/lib/modules/OpenData/types.d.ts +14 -1
  22. package/lib/modules/OpenData/utils.d.ts +6 -0
  23. package/lib/modules/OpenData/utils.js +40 -5
  24. package/lib/modules/Order/index.d.ts +1 -1
  25. package/lib/plugins/request.d.ts +2 -1
  26. package/lib/plugins/request.js +3 -2
  27. package/lib/server/index.d.ts +5 -0
  28. package/lib/server/index.js +47 -11
  29. package/lib/server/utils/small-ticket.js +52 -0
  30. package/lib/solution/BaseSales/index.js +21 -0
  31. package/lib/solution/BookingByStep/index.d.ts +1 -1
  32. package/lib/solution/BookingTicket/index.d.ts +13 -1
  33. package/lib/solution/BookingTicket/index.js +3 -0
  34. package/lib/solution/Sales/index.js +3 -0
  35. package/lib/solution/UnifiedBookingSales/index.js +3 -0
  36. package/package.json +1 -1
@@ -43,7 +43,8 @@ import { filterBookingsFromOrders, sortBookings } from "./modules/order/utils/fi
43
43
  import { buildSmallTicketData, hasSmallTicketData } from "./utils/small-ticket";
44
44
  import { BaseSalesImpl } from "../solution/BaseSales";
45
45
  import { getOrderPaymentIdentityKeys, isIdentifiedPendingOrderPayment, isPendingOrderPayment, mergeOrderPaymentListsByIdentity } from "../modules/Order/payment-utils";
46
- import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeRawInvoiceTemplateSettings } from "../modules/OpenData";
46
+ import { normalizeOrderCollections } from "../modules/Order/utils/orderCollectionIdentity";
47
+ import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeRawInvoiceTemplateSettings, resolveInvoiceReceiptLocales } from "../modules/OpenData";
47
48
  var OS_FULFILLMENT_REF_MODE_FIELD = '_os_fulfillment_ref_mode';
48
49
  var OS_INVOICE_LAYOUT_CONFIG_FIELD = '_os_invoice_layout_config';
49
50
  var OS_INVOICE_TEMPLATE_SETTINGS_FIELD = '_os_invoice_template_settings';
@@ -2435,7 +2436,7 @@ var Server = /*#__PURE__*/function () {
2435
2436
  return this.ensureCheckoutOrderNumbers(normalizedData, title);
2436
2437
  case 6:
2437
2438
  numberedData = _context31.sent;
2438
- checkoutData = this.applyCheckoutFulfillmentBuzzer(numberedData, title);
2439
+ checkoutData = this.normalizeCheckoutCollections(this.applyCheckoutFulfillmentBuzzer(numberedData, title));
2439
2440
  remoteCheckoutData = this.buildRemoteCheckoutData(checkoutData, title);
2440
2441
  if ((_this$app5 = this.app) !== null && _this$app5 !== void 0 && (_this$app5 = _this$app5.request) !== null && _this$app5 !== void 0 && _this$app5.post) {
2441
2442
  _context31.next = 11;
@@ -5824,7 +5825,8 @@ var Server = /*#__PURE__*/function () {
5824
5825
  case 2:
5825
5826
  _context58.next = 4;
5826
5827
  return this.withLocalSmallTicketData(params.order, {
5827
- requireFullyPaid: params.requireFullyPaid
5828
+ requireFullyPaid: params.requireFullyPaid,
5829
+ invoiceTemplateSettings: params.invoiceTemplateSettings
5828
5830
  });
5829
5831
  case 4:
5830
5832
  printableOrder = _context58.sent;
@@ -6085,13 +6087,14 @@ var Server = /*#__PURE__*/function () {
6085
6087
  return this.ensureCheckoutOrderNumbers(normalizedData, title);
6086
6088
  case 14:
6087
6089
  numberedData = _context60.sent;
6088
- checkoutData = this.applyCheckoutFulfillmentBuzzer(numberedData, title);
6090
+ checkoutData = this.normalizeCheckoutCollections(this.applyCheckoutFulfillmentBuzzer(numberedData, title));
6089
6091
  _context60.next = 18;
6090
6092
  return this.handlePendingSyncCheckoutOrder({
6091
6093
  backendPath: backendPath,
6092
6094
  data: checkoutData,
6093
6095
  title: title,
6094
- reason: 'checkout 已转入设备任务同步'
6096
+ reason: 'checkout 已转入设备任务同步',
6097
+ invoiceTemplateSettings: invoiceTemplateSettings
6095
6098
  });
6096
6099
  case 18:
6097
6100
  pendingResult = _context60.sent;
@@ -6338,13 +6341,13 @@ var Server = /*#__PURE__*/function () {
6338
6341
  value: function () {
6339
6342
  var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
6340
6343
  var _this14 = this;
6341
- var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
6344
+ var backendPath, data, title, reason, invoiceTemplateSettings, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
6342
6345
  return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6343
6346
  while (1) switch (_context63.prev = _context63.next) {
6344
6347
  case 0:
6345
- backendPath = params.backendPath, data = params.data, title = params.title, reason = params.reason;
6348
+ backendPath = params.backendPath, data = params.data, title = params.title, reason = params.reason, invoiceTemplateSettings = params.invoiceTemplateSettings;
6346
6349
  _context63.next = 3;
6347
- return this.buildPendingSyncCheckoutOrder(data);
6350
+ return this.buildPendingSyncCheckoutOrder(data, invoiceTemplateSettings);
6348
6351
  case 3:
6349
6352
  pendingOrder = _context63.sent;
6350
6353
  if (pendingOrder) {
@@ -6435,7 +6438,7 @@ var Server = /*#__PURE__*/function () {
6435
6438
  }, {
6436
6439
  key: "buildPendingSyncCheckoutOrder",
6437
6440
  value: function () {
6438
- var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(data) {
6441
+ var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(data, invoiceTemplateSettings) {
6439
6442
  var hasStorageKey, pendingOrder, productMap, orderWithProductTitles;
6440
6443
  return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6441
6444
  while (1) switch (_context64.prev = _context64.next) {
@@ -6453,10 +6456,10 @@ var Server = /*#__PURE__*/function () {
6453
6456
  }
6454
6457
  return _context64.abrupt("return", null);
6455
6458
  case 5:
6456
- pendingOrder = _objectSpread(_objectSpread({}, data), {}, {
6459
+ pendingOrder = this.normalizeCheckoutCollections(_objectSpread(_objectSpread({}, data), {}, {
6457
6460
  need_sync: 1,
6458
6461
  is_draft_order: 0
6459
- });
6462
+ }));
6460
6463
  _context64.next = 8;
6461
6464
  return this.buildSmallTicketProductMap(pendingOrder);
6462
6465
  case 8:
@@ -6464,7 +6467,8 @@ var Server = /*#__PURE__*/function () {
6464
6467
  orderWithProductTitles = this.withPendingSyncProductTitles(pendingOrder, productMap);
6465
6468
  return _context64.abrupt("return", this.withLocalSmallTicketData(orderWithProductTitles, {
6466
6469
  requireFullyPaid: true,
6467
- productMap: productMap
6470
+ productMap: productMap,
6471
+ invoiceTemplateSettings: invoiceTemplateSettings
6468
6472
  }));
6469
6473
  case 11:
6470
6474
  case "end":
@@ -6472,11 +6476,28 @@ var Server = /*#__PURE__*/function () {
6472
6476
  }
6473
6477
  }, _callee64, this);
6474
6478
  }));
6475
- function buildPendingSyncCheckoutOrder(_x71) {
6479
+ function buildPendingSyncCheckoutOrder(_x71, _x72) {
6476
6480
  return _buildPendingSyncCheckoutOrder.apply(this, arguments);
6477
6481
  }
6478
6482
  return buildPendingSyncCheckoutOrder;
6479
6483
  }()
6484
+ /**
6485
+ * Checkout 与本地小票必须消费同一份规范化子项快照。
6486
+ * 商品/预约只折叠持久化 ID 或协议 UID 相同的行;支付额外兼容 payment_number。
6487
+ */
6488
+ }, {
6489
+ key: "normalizeCheckoutCollections",
6490
+ value: function normalizeCheckoutCollections(data) {
6491
+ if (!data || _typeof(data) !== 'object' || Array.isArray(data)) return data;
6492
+ var normalized = normalizeOrderCollections(data, {
6493
+ ensureUid: false
6494
+ }).order;
6495
+ if (Array.isArray(normalized.payments)) {
6496
+ normalized.payments = mergeOrderPaymentListsByIdentity([], normalized.payments);
6497
+ }
6498
+ return normalized;
6499
+ }
6500
+
6480
6501
  /**
6481
6502
  * Android 结账自动小票由当前设备设置控制;其它平台保持原有行为。
6482
6503
  */
@@ -6609,7 +6630,7 @@ var Server = /*#__PURE__*/function () {
6609
6630
  }
6610
6631
  }, _callee65, null, [[0, 7]]);
6611
6632
  }));
6612
- return function (_x73) {
6633
+ return function (_x74) {
6613
6634
  return _ref70.apply(this, arguments);
6614
6635
  };
6615
6636
  }()));
@@ -6629,7 +6650,7 @@ var Server = /*#__PURE__*/function () {
6629
6650
  }
6630
6651
  }, _callee66, this);
6631
6652
  }));
6632
- function buildSmallTicketProductMap(_x72) {
6653
+ function buildSmallTicketProductMap(_x73) {
6633
6654
  return _buildSmallTicketProductMap.apply(this, arguments);
6634
6655
  }
6635
6656
  return buildSmallTicketProductMap;
@@ -6692,7 +6713,7 @@ var Server = /*#__PURE__*/function () {
6692
6713
  }
6693
6714
  }, _callee67, this, [[4, 10]]);
6694
6715
  }));
6695
- function buildSalesDetailProductSnapshotMap(_x74) {
6716
+ function buildSalesDetailProductSnapshotMap(_x75) {
6696
6717
  return _buildSalesDetailProductSnapshotMap.apply(this, arguments);
6697
6718
  }
6698
6719
  return buildSalesDetailProductSnapshotMap;
@@ -6794,7 +6815,7 @@ var Server = /*#__PURE__*/function () {
6794
6815
  }
6795
6816
  }, _callee68, this);
6796
6817
  }));
6797
- function withSalesDetailProductSnapshots(_x75) {
6818
+ function withSalesDetailProductSnapshots(_x76) {
6798
6819
  return _withSalesDetailProductSnapshots.apply(this, arguments);
6799
6820
  }
6800
6821
  return withSalesDetailProductSnapshots;
@@ -6997,7 +7018,7 @@ var Server = /*#__PURE__*/function () {
6997
7018
  }
6998
7019
  }, _callee69, this, [[4, 21]]);
6999
7020
  }));
7000
- function enrichPaymentNamesByCode(_x76) {
7021
+ function enrichPaymentNamesByCode(_x77) {
7001
7022
  return _enrichPaymentNamesByCode.apply(this, arguments);
7002
7023
  }
7003
7024
  return enrichPaymentNamesByCode;
@@ -7006,7 +7027,7 @@ var Server = /*#__PURE__*/function () {
7006
7027
  key: "withLocalSmallTicketData",
7007
7028
  value: function () {
7008
7029
  var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(order, options) {
7009
- var _options$productMap, enrichedOrder, productMap, smallTicketData;
7030
+ var _options$productMap, normalizedCollections, normalizedOrder, collapsedDuplicateCounts, _ref75, _ref76, _order_id, enrichedOrder, productMap, smallTicketData;
7010
7031
  return _regeneratorRuntime().wrap(function _callee70$(_context70) {
7011
7032
  while (1) switch (_context70.prev = _context70.next) {
7012
7033
  case 0:
@@ -7023,27 +7044,45 @@ var Server = /*#__PURE__*/function () {
7023
7044
  return _context70.abrupt("return", order);
7024
7045
  case 4:
7025
7046
  _context70.prev = 4;
7026
- _context70.next = 7;
7027
- return this.enrichPaymentNamesByCode(order);
7028
- case 7:
7047
+ normalizedCollections = normalizeOrderCollections(order, {
7048
+ ensureUid: false
7049
+ });
7050
+ normalizedOrder = normalizedCollections.order;
7051
+ collapsedDuplicateCounts = {
7052
+ products: normalizedCollections.stats.product.collapsedDuplicateCount,
7053
+ bookings: normalizedCollections.stats.booking.collapsedDuplicateCount,
7054
+ payments: normalizedCollections.stats.payment.collapsedDuplicateCount
7055
+ };
7056
+ if (Object.values(collapsedDuplicateCounts).some(function (count) {
7057
+ return count > 0;
7058
+ })) {
7059
+ this.logWarning('withLocalSmallTicketData: 折叠重复订单子项', {
7060
+ order_identifier: (_ref75 = (_ref76 = (_order_id = normalizedOrder.order_id) !== null && _order_id !== void 0 ? _order_id : normalizedOrder.external_sale_number) !== null && _ref76 !== void 0 ? _ref76 : normalizedOrder.shop_order_number) !== null && _ref75 !== void 0 ? _ref75 : null,
7061
+ collapsed_duplicate_counts: collapsedDuplicateCounts
7062
+ });
7063
+ }
7064
+ _context70.next = 11;
7065
+ return this.enrichPaymentNamesByCode(normalizedOrder);
7066
+ case 11:
7029
7067
  enrichedOrder = _context70.sent;
7030
7068
  if (!((_options$productMap = options === null || options === void 0 ? void 0 : options.productMap) !== null && _options$productMap !== void 0)) {
7031
- _context70.next = 12;
7069
+ _context70.next = 16;
7032
7070
  break;
7033
7071
  }
7034
7072
  _context70.t0 = _options$productMap;
7035
- _context70.next = 15;
7073
+ _context70.next = 19;
7036
7074
  break;
7037
- case 12:
7038
- _context70.next = 14;
7075
+ case 16:
7076
+ _context70.next = 18;
7039
7077
  return this.buildSmallTicketProductMap(enrichedOrder);
7040
- case 14:
7078
+ case 18:
7041
7079
  _context70.t0 = _context70.sent;
7042
- case 15:
7080
+ case 19:
7043
7081
  productMap = _context70.t0;
7044
7082
  smallTicketData = buildSmallTicketData({
7045
7083
  order: enrichedOrder,
7046
7084
  shopInfo: this.getSmallTicketShopInfo(),
7085
+ locales: resolveInvoiceReceiptLocales(options === null || options === void 0 ? void 0 : options.invoiceTemplateSettings),
7047
7086
  productMap: productMap
7048
7087
  });
7049
7088
  return _context70.abrupt("return", _objectSpread(_objectSpread({}, enrichedOrder), {}, {
@@ -7051,20 +7090,20 @@ var Server = /*#__PURE__*/function () {
7051
7090
  small_ticket_data: smallTicketData
7052
7091
  })
7053
7092
  }));
7054
- case 20:
7055
- _context70.prev = 20;
7093
+ case 24:
7094
+ _context70.prev = 24;
7056
7095
  _context70.t1 = _context70["catch"](4);
7057
7096
  this.logError('withLocalSmallTicketData: 生成本地小票数据失败', {
7058
7097
  error: _context70.t1 instanceof Error ? _context70.t1.message : String(_context70.t1)
7059
7098
  });
7060
7099
  return _context70.abrupt("return", order);
7061
- case 24:
7100
+ case 28:
7062
7101
  case "end":
7063
7102
  return _context70.stop();
7064
7103
  }
7065
- }, _callee70, this, [[4, 20]]);
7104
+ }, _callee70, this, [[4, 24]]);
7066
7105
  }));
7067
- function withLocalSmallTicketData(_x77, _x78) {
7106
+ function withLocalSmallTicketData(_x78, _x79) {
7068
7107
  return _withLocalSmallTicketData.apply(this, arguments);
7069
7108
  }
7070
7109
  return withLocalSmallTicketData;
@@ -7081,7 +7120,7 @@ var Server = /*#__PURE__*/function () {
7081
7120
  value: function () {
7082
7121
  var _fetchAndPersistSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(lookup, data, title) {
7083
7122
  var _this$order4, _this$order5, _this$app17;
7084
- var backendPath, response, _response$code3, responseStatusCode, code, message, fresh, savedOrder, _errorRecord$response, backendError, errorRecord, _responseStatusCode, _ref75, _backendError$code2, backendStatusCode, _code, _message2, _message3;
7123
+ var backendPath, response, _response$code3, responseStatusCode, code, message, fresh, savedOrder, _errorRecord$response, backendError, errorRecord, _responseStatusCode, _ref77, _backendError$code2, backendStatusCode, _code, _message2, _message3;
7085
7124
  return _regeneratorRuntime().wrap(function _callee71$(_context71) {
7086
7125
  while (1) switch (_context71.prev = _context71.next) {
7087
7126
  case 0:
@@ -7202,7 +7241,7 @@ var Server = /*#__PURE__*/function () {
7202
7241
  break;
7203
7242
  }
7204
7243
  backendStatusCode = typeof (backendError === null || backendError === void 0 ? void 0 : backendError.status) === 'number' ? backendError.status : undefined;
7205
- _code = this.normalizeRemoteSalesOrderErrorCode((_ref75 = (_backendError$code2 = backendError === null || backendError === void 0 ? void 0 : backendError.code) !== null && _backendError$code2 !== void 0 ? _backendError$code2 : backendStatusCode) !== null && _ref75 !== void 0 ? _ref75 : _responseStatusCode);
7244
+ _code = this.normalizeRemoteSalesOrderErrorCode((_ref77 = (_backendError$code2 = backendError === null || backendError === void 0 ? void 0 : backendError.code) !== null && _backendError$code2 !== void 0 ? _backendError$code2 : backendStatusCode) !== null && _ref77 !== void 0 ? _ref77 : _responseStatusCode);
7206
7245
  _message2 = (backendError === null || backendError === void 0 ? void 0 : backendError.message) || this.getUnknownErrorMessage(_context71.t0);
7207
7246
  this.logInfo("".concat(title, ": \u540E\u7AEF\u8BA2\u5355\u67E5\u8BE2\u5931\u8D25"), {
7208
7247
  lookup: lookup,
@@ -7233,7 +7272,7 @@ var Server = /*#__PURE__*/function () {
7233
7272
  }
7234
7273
  }, _callee71, this, [[7, 37]]);
7235
7274
  }));
7236
- function fetchAndPersistSalesOrderByLookup(_x79, _x80, _x81) {
7275
+ function fetchAndPersistSalesOrderByLookup(_x80, _x81, _x82) {
7237
7276
  return _fetchAndPersistSalesOrderByLookup.apply(this, arguments);
7238
7277
  }
7239
7278
  return fetchAndPersistSalesOrderByLookup;
@@ -7475,7 +7514,7 @@ var Server = /*#__PURE__*/function () {
7475
7514
  }
7476
7515
  }, _callee72, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
7477
7516
  }));
7478
- function handleUpdateLocalOrdersBatch(_x82) {
7517
+ function handleUpdateLocalOrdersBatch(_x83) {
7479
7518
  return _handleUpdateLocalOrdersBatch.apply(this, arguments);
7480
7519
  }
7481
7520
  return handleUpdateLocalOrdersBatch;
@@ -7967,7 +8006,7 @@ var Server = /*#__PURE__*/function () {
7967
8006
  }
7968
8007
  }, _callee74, this);
7969
8008
  }));
7970
- function computeOrderQueryResult(_x83) {
8009
+ function computeOrderQueryResult(_x84) {
7971
8010
  return _computeOrderQueryResult.apply(this, arguments);
7972
8011
  }
7973
8012
  return computeOrderQueryResult;
@@ -8021,7 +8060,7 @@ var Server = /*#__PURE__*/function () {
8021
8060
  }
8022
8061
  }, _callee75, this);
8023
8062
  }));
8024
- function computeBookingQueryResult(_x84) {
8063
+ function computeBookingQueryResult(_x85) {
8025
8064
  return _computeBookingQueryResult.apply(this, arguments);
8026
8065
  }
8027
8066
  return computeBookingQueryResult;
@@ -8386,7 +8425,7 @@ var Server = /*#__PURE__*/function () {
8386
8425
  }
8387
8426
  }, _callee76, this);
8388
8427
  }));
8389
- function computeProductQueryResult(_x85, _x86) {
8428
+ function computeProductQueryResult(_x86, _x87) {
8390
8429
  return _computeProductQueryResult.apply(this, arguments);
8391
8430
  }
8392
8431
  return computeProductQueryResult;
@@ -8487,7 +8526,7 @@ var Server = /*#__PURE__*/function () {
8487
8526
  }
8488
8527
  }, _callee77, this, [[4, 24, 27, 30], [8, 16]]);
8489
8528
  }));
8490
- function recomputeAndNotifyProductQuery(_x87) {
8529
+ function recomputeAndNotifyProductQuery(_x88) {
8491
8530
  return _recomputeAndNotifyProductQuery.apply(this, arguments);
8492
8531
  }
8493
8532
  return recomputeAndNotifyProductQuery;
@@ -95,6 +95,58 @@ var LABELS = {
95
95
  rounding: '抹零',
96
96
  gross: '重量',
97
97
  tare: '去皮'
98
+ },
99
+ ja: {
100
+ contactName: '連絡先名',
101
+ contactMobile: '連絡先電話',
102
+ email: 'メール',
103
+ dineIn: '店内飲食',
104
+ takeAway: 'テイクアウト',
105
+ delivery: '配達',
106
+ pickUp: '受け取り',
107
+ shopService: '店内飲食',
108
+ pickUpTime: '受取時間',
109
+ asap: 'できるだけ早く',
110
+ cash: '現金',
111
+ eftpos: 'カード',
112
+ wallet: 'ウォレット',
113
+ giftCard: 'ギフトカード',
114
+ remainingAmount: '残高',
115
+ redeemPoints: '利用ポイント',
116
+ remainingPoints: '残りポイント',
117
+ table: 'テーブル',
118
+ orderDiscount: '注文割引',
119
+ manualDiscount: '手動割引',
120
+ payProcessingFee: '決済手数料',
121
+ rounding: '端数調整',
122
+ gross: '総重量',
123
+ tare: '風袋'
124
+ },
125
+ pt: {
126
+ contactName: 'Nome de contato',
127
+ contactMobile: 'Celular de contato',
128
+ email: 'e-mail',
129
+ dineIn: 'Consumo no local',
130
+ takeAway: 'Para levar',
131
+ delivery: 'Entrega',
132
+ pickUp: 'Recolha',
133
+ shopService: 'Consumo no local',
134
+ pickUpTime: 'Hora de recolha',
135
+ asap: 'Assim que possível',
136
+ cash: 'Dinheiro',
137
+ eftpos: 'Cartão',
138
+ wallet: 'Carteira',
139
+ giftCard: 'Cartão-presente',
140
+ remainingAmount: 'Saldo restante',
141
+ redeemPoints: 'Pontos utilizados',
142
+ remainingPoints: 'Pontos restantes',
143
+ table: 'Mesa',
144
+ orderDiscount: 'Desconto do pedido',
145
+ manualDiscount: 'Desconto manual',
146
+ payProcessingFee: 'Taxa de processamento',
147
+ rounding: 'Arredondamento',
148
+ gross: 'Peso bruto',
149
+ tare: 'Tara'
98
150
  }
99
151
  };
100
152
  export function buildSmallTicketData(params) {
@@ -293,6 +293,24 @@ function normalizeBaseSalesRecordCollections(sourceRecord, options) {
293
293
  }
294
294
  return normalizedRecord;
295
295
  }
296
+ function isValidBaseSalesSmallTicketDataSnapshot(value) {
297
+ if (!value || _typeof(value) !== 'object' || Array.isArray(value)) return false;
298
+ var localeSnapshots = Object.values(value);
299
+ return localeSnapshots.length > 0 && localeSnapshots.some(function (localeSnapshot) {
300
+ return localeSnapshot !== null && _typeof(localeSnapshot) === 'object' && !Array.isArray(localeSnapshot);
301
+ });
302
+ }
303
+ function mergeBaseSalesSmallTicketDataSnapshot(currentValue, loadedValue) {
304
+ if (isValidBaseSalesSmallTicketDataSnapshot(loadedValue)) {
305
+ return cloneDeep(loadedValue);
306
+ }
307
+ if (isValidBaseSalesSmallTicketDataSnapshot(currentValue)) {
308
+ return cloneDeep(currentValue);
309
+ }
310
+ if (loadedValue !== undefined) return cloneDeep(loadedValue);
311
+ if (currentValue !== undefined) return cloneDeep(currentValue);
312
+ return undefined;
313
+ }
296
314
  function getBaseSalesMetadataUid(item, metadataKey) {
297
315
  var _item$metadata$metada, _item$metadata;
298
316
  var uid = (_item$metadata$metada = item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata[metadataKey]) !== null && _item$metadata$metada !== void 0 ? _item$metadata$metada : item === null || item === void 0 ? void 0 : item[metadataKey];
@@ -333,6 +351,11 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
333
351
  });
334
352
  var uidRemaps = [];
335
353
  var mergedRecord = mergeWith(normalizedCurrentTempOrder, normalizedLoadedRecord, function (currentValue, loadedValue, key) {
354
+ // small_ticket_data 是由 Server 一次性生成的完整展示快照,不能递归进入
355
+ // locale 内部继续套用订单集合或普通数组的合并规则。
356
+ if (key === 'small_ticket_data') {
357
+ return mergeBaseSalesSmallTicketDataSnapshot(currentValue, loadedValue);
358
+ }
336
359
  var collectionKind = getBaseSalesOrderCollectionKind(key);
337
360
  if (collectionKind && Array.isArray(loadedValue)) {
338
361
  return mergeBaseSalesOrderCollection(collectionKind, Array.isArray(currentValue) ? currentValue : [], loadedValue, strategy, uidRemaps);
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 2 | 3 | 4 | 6 | 5;
329
+ weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -458,7 +458,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
458
458
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
459
459
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
460
460
  */
461
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
461
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
462
+ action: "reloadCatalog";
463
+ } | {
464
+ action: "add";
465
+ cacheItem: any;
466
+ } | {
467
+ action: "requiresDetail";
468
+ payload: AddProductRequiresDetailPayload;
469
+ } | {
470
+ action: "requiresBookingEdit";
471
+ cacheItem: any;
472
+ payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
473
+ };
462
474
  /** 规格弹窗 callback 后的第二段决策。 */
463
475
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
464
476
  /**
@@ -298,30 +298,37 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
298
298
  lastFetchedAt = this.store.openData.getLastFetchedAt();
299
299
  cachedData = this.store.openData.getOpenData();
300
300
  if (!(cachedData && this.openDataTarget === target && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL)) {
301
- _context2.next = 13;
301
+ _context2.next = 16;
302
302
  break;
303
303
  }
304
+ if (!(typeof this.store.openData.ensureInvoiceTemplateSettings === 'function')) {
305
+ _context2.next = 14;
306
+ break;
307
+ }
308
+ _context2.next = 14;
309
+ return this.store.openData.ensureInvoiceTemplateSettings(target);
310
+ case 14:
304
311
  this.otherParams.openData = cachedData;
305
312
  return _context2.abrupt("return", cachedData);
306
- case 13:
313
+ case 16:
307
314
  if (!this.loadOpenDataInFlight) {
308
- _context2.next = 21;
315
+ _context2.next = 24;
309
316
  break;
310
317
  }
311
318
  if (!(this.loadOpenDataInFlightTarget === target)) {
312
- _context2.next = 18;
319
+ _context2.next = 21;
313
320
  break;
314
321
  }
315
- _context2.next = 17;
316
- return this.loadOpenDataInFlight;
317
- case 17:
318
- return _context2.abrupt("return", _context2.sent);
319
- case 18:
320
322
  _context2.next = 20;
321
323
  return this.loadOpenDataInFlight;
322
324
  case 20:
323
- return _context2.abrupt("return", this.loadOpenDataConfig());
325
+ return _context2.abrupt("return", _context2.sent);
324
326
  case 21:
327
+ _context2.next = 23;
328
+ return this.loadOpenDataInFlight;
329
+ case 23:
330
+ return _context2.abrupt("return", this.loadOpenDataConfig());
331
+ case 24:
325
332
  this.loadOpenDataInFlightTarget = target;
326
333
  request = this.store.openData.fetchOpenData({
327
334
  scope: 'board',
@@ -330,10 +337,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
330
337
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
331
338
  });
332
339
  this.loadOpenDataInFlight = request;
333
- _context2.prev = 24;
334
- _context2.next = 27;
340
+ _context2.prev = 27;
341
+ _context2.next = 30;
335
342
  return request;
336
- case 27:
343
+ case 30:
337
344
  openDataConfig = _context2.sent;
338
345
  // clearOpenDataCache() 或新请求已接管时,旧响应只能返回给原调用方,不能复活缓存归属。
339
346
  if (this.loadOpenDataInFlight === request) {
@@ -341,18 +348,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
341
348
  this.otherParams.openData = openDataConfig;
342
349
  }
343
350
  return _context2.abrupt("return", openDataConfig);
344
- case 30:
345
- _context2.prev = 30;
351
+ case 33:
352
+ _context2.prev = 33;
346
353
  if (this.loadOpenDataInFlight === request) {
347
354
  this.loadOpenDataInFlight = null;
348
355
  this.loadOpenDataInFlightTarget = null;
349
356
  }
350
- return _context2.finish(30);
351
- case 33:
357
+ return _context2.finish(33);
358
+ case 36:
352
359
  case "end":
353
360
  return _context2.stop();
354
361
  }
355
- }, _callee2, this, [[24,, 30, 33]]);
362
+ }, _callee2, this, [[27,, 33, 36]]);
356
363
  }));
357
364
  function loadOpenDataConfig() {
358
365
  return _loadOpenDataConfig.apply(this, arguments);
@@ -275,33 +275,40 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
275
275
  cachedData = this.invoiceOpenDataModule.getOpenData();
276
276
  lastFetchedAt = this.invoiceOpenDataModule.getLastFetchedAt();
277
277
  if (!(cachedData && this.invoiceOpenDataTarget === target && typeof lastFetchedAt === 'number' && Date.now() - lastFetchedAt < INVOICE_OPEN_DATA_CACHE_TTL)) {
278
- _context4.next = 7;
278
+ _context4.next = 10;
279
+ break;
280
+ }
281
+ if (!(typeof this.invoiceOpenDataModule.ensureInvoiceTemplateSettings === 'function')) {
282
+ _context4.next = 9;
279
283
  break;
280
284
  }
285
+ _context4.next = 9;
286
+ return this.invoiceOpenDataModule.ensureInvoiceTemplateSettings(target);
287
+ case 9:
281
288
  return _context4.abrupt("return", cachedData);
282
- case 7:
289
+ case 10:
283
290
  if (!this.invoiceOpenDataInFlight) {
284
- _context4.next = 18;
291
+ _context4.next = 21;
285
292
  break;
286
293
  }
287
294
  if (!(this.invoiceOpenDataInFlightTarget === target)) {
288
- _context4.next = 10;
295
+ _context4.next = 13;
289
296
  break;
290
297
  }
291
298
  return _context4.abrupt("return", this.invoiceOpenDataInFlight);
292
- case 10:
293
- _context4.prev = 10;
294
- _context4.next = 13;
295
- return this.invoiceOpenDataInFlight;
296
299
  case 13:
297
- _context4.next = 17;
300
+ _context4.prev = 13;
301
+ _context4.next = 16;
302
+ return this.invoiceOpenDataInFlight;
303
+ case 16:
304
+ _context4.next = 20;
298
305
  break;
299
- case 15:
300
- _context4.prev = 15;
301
- _context4.t0 = _context4["catch"](10);
302
- case 17:
303
- return _context4.abrupt("return", this.loadInvoiceOpenData(businessCode, channel));
304
306
  case 18:
307
+ _context4.prev = 18;
308
+ _context4.t0 = _context4["catch"](13);
309
+ case 20:
310
+ return _context4.abrupt("return", this.loadInvoiceOpenData(businessCode, channel));
311
+ case 21:
305
312
  request = this.invoiceOpenDataModule.fetchOpenData({
306
313
  scope: 'board',
307
314
  target: target,
@@ -309,28 +316,28 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
309
316
  });
310
317
  this.invoiceOpenDataInFlight = request;
311
318
  this.invoiceOpenDataInFlightTarget = target;
312
- _context4.prev = 21;
313
- _context4.next = 24;
319
+ _context4.prev = 24;
320
+ _context4.next = 27;
314
321
  return request;
315
- case 24:
322
+ case 27:
316
323
  openData = _context4.sent;
317
324
  // clearOpenDataCache() 或后续请求接管后,旧响应不得复活 target 归属。
318
325
  if (this.invoiceOpenDataInFlight === request) {
319
326
  this.invoiceOpenDataTarget = target;
320
327
  }
321
328
  return _context4.abrupt("return", openData);
322
- case 27:
323
- _context4.prev = 27;
329
+ case 30:
330
+ _context4.prev = 30;
324
331
  if (this.invoiceOpenDataInFlight === request) {
325
332
  this.invoiceOpenDataInFlight = null;
326
333
  this.invoiceOpenDataInFlightTarget = null;
327
334
  }
328
- return _context4.finish(27);
329
- case 30:
335
+ return _context4.finish(30);
336
+ case 33:
330
337
  case "end":
331
338
  return _context4.stop();
332
339
  }
333
- }, _callee4, this, [[10, 15], [21,, 27, 30]]);
340
+ }, _callee4, this, [[13, 18], [24,, 30, 33]]);
334
341
  }));
335
342
  function loadInvoiceOpenData(_x4, _x5) {
336
343
  return _loadInvoiceOpenData.apply(this, arguments);