@pisell/pisellos 0.10.49 → 0.10.51

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 (62) hide show
  1. package/dist/modules/Discount/types.d.ts +2 -0
  2. package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
  3. package/dist/modules/FulfillmentTiming/index.js +407 -0
  4. package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
  5. package/dist/modules/FulfillmentTiming/types.js +1 -0
  6. package/dist/modules/OpenData/types.d.ts +6 -0
  7. package/dist/modules/Order/index.d.ts +19 -1
  8. package/dist/modules/Order/index.js +362 -217
  9. package/dist/modules/Order/pickupTiming.d.ts +46 -0
  10. package/dist/modules/Order/pickupTiming.js +53 -0
  11. package/dist/modules/Order/types.d.ts +11 -1
  12. package/dist/modules/Order/utils.d.ts +10 -0
  13. package/dist/modules/Order/utils.js +145 -85
  14. package/dist/modules/Rules/index.js +45 -26
  15. package/dist/modules/Rules/types.d.ts +4 -0
  16. package/dist/modules/index.d.ts +1 -0
  17. package/dist/modules/index.js +1 -0
  18. package/dist/server/modules/order/index.d.ts +8 -0
  19. package/dist/server/modules/order/index.js +506 -453
  20. package/dist/server/modules/order/types.d.ts +1 -0
  21. package/dist/server/utils/small-ticket.js +173 -95
  22. package/dist/solution/BaseSales/index.d.ts +23 -0
  23. package/dist/solution/BaseSales/index.js +1216 -1031
  24. package/dist/solution/BaseSales/pickupTiming.d.ts +37 -0
  25. package/dist/solution/BaseSales/pickupTiming.js +482 -0
  26. package/dist/solution/BaseSales/utils/parseSalesResponse.js +3 -0
  27. package/dist/solution/BookingByStep/index.d.ts +1 -1
  28. package/dist/solution/BookingTicket/utils/cartView.js +3 -1
  29. package/dist/solution/UnifiedBookingSales/index.d.ts +2 -0
  30. package/dist/solution/UnifiedBookingSales/index.js +583 -531
  31. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  32. package/lib/modules/Discount/types.d.ts +2 -0
  33. package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
  34. package/lib/modules/FulfillmentTiming/index.js +359 -0
  35. package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
  36. package/lib/modules/FulfillmentTiming/types.js +5 -0
  37. package/lib/modules/OpenData/types.d.ts +6 -0
  38. package/lib/modules/Order/index.d.ts +19 -1
  39. package/lib/modules/Order/index.js +120 -7
  40. package/lib/modules/Order/pickupTiming.d.ts +46 -0
  41. package/lib/modules/Order/pickupTiming.js +61 -0
  42. package/lib/modules/Order/types.d.ts +11 -1
  43. package/lib/modules/Order/utils.d.ts +10 -0
  44. package/lib/modules/Order/utils.js +58 -4
  45. package/lib/modules/Rules/index.js +24 -13
  46. package/lib/modules/Rules/types.d.ts +4 -0
  47. package/lib/modules/index.d.ts +1 -0
  48. package/lib/modules/index.js +11 -0
  49. package/lib/server/modules/order/index.d.ts +8 -0
  50. package/lib/server/modules/order/index.js +19 -0
  51. package/lib/server/modules/order/types.d.ts +1 -0
  52. package/lib/server/utils/small-ticket.js +93 -22
  53. package/lib/solution/BaseSales/index.d.ts +23 -0
  54. package/lib/solution/BaseSales/index.js +104 -1
  55. package/lib/solution/BaseSales/pickupTiming.d.ts +37 -0
  56. package/lib/solution/BaseSales/pickupTiming.js +222 -0
  57. package/lib/solution/BaseSales/utils/parseSalesResponse.js +3 -0
  58. package/lib/solution/BookingByStep/index.d.ts +1 -1
  59. package/lib/solution/BookingTicket/utils/cartView.js +3 -1
  60. package/lib/solution/UnifiedBookingSales/index.d.ts +2 -0
  61. package/lib/solution/UnifiedBookingSales/index.js +20 -0
  62. package/package.json +1 -1
@@ -5,10 +5,6 @@ var _excluded = ["custom_product_bundle_map_id"],
5
5
  _excluded5 = ["collect_pax", "table_occupancy_duration", "cart_settlement_key", "cart_settlement_snapshot", "legal_currency_snapshot"];
6
6
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
7
7
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
8
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
13
9
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
10
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -17,10 +13,14 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
17
13
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
14
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
19
15
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
20
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
22
16
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
23
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
19
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
20
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
22
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
23
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
24
24
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
25
25
  import dayjs from 'dayjs';
26
26
  import customParseFormat from 'dayjs/plugin/customParseFormat';
@@ -29,6 +29,7 @@ import { getProductHolderConfig } from "../Holder/utils";
29
29
  import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
30
30
  import { createUuidV4 } from "./utils/orderCollectionIdentity";
31
31
  import { encodeSalesNotes } from "./salesNotes";
32
+ import { isFulfillmentTimingBooking } from "./pickupTiming";
32
33
  dayjs.extend(customParseFormat);
33
34
  var POINT_CARD_SNAPSHOT_TAG = 'point_card';
34
35
  var VIRTUAL_CURRENCY_SNAPSHOT_TAG = 'virtual_currency';
@@ -60,6 +61,10 @@ export function normalizePointCardSnapshotItem(value) {
60
61
  if (productId !== undefined) {
61
62
  snapshot.product_id = productId;
62
63
  }
64
+ var code = normalizeSnapshotScalar(value.code);
65
+ if (code !== undefined) {
66
+ snapshot.code = String(code).trim();
67
+ }
63
68
  return snapshot;
64
69
  }
65
70
  export function buildPointCardSnapshotFromWalletPassList(value) {
@@ -70,6 +75,52 @@ export function buildPointCardSnapshotFromWalletPassList(value) {
70
75
  return result;
71
76
  }, []);
72
77
  }
78
+ export function collectPointCardSnapshotCodeCandidates(value) {
79
+ if (!Array.isArray(value)) return [];
80
+ var codeById = new Map();
81
+ value.forEach(function (item) {
82
+ var _item$id;
83
+ if (!isPlainObject(item)) return;
84
+ var id = normalizeSnapshotScalar((_item$id = item.id) !== null && _item$id !== void 0 ? _item$id : item.voucher_id);
85
+ var code = normalizeSnapshotScalar(item.code);
86
+ if (id === undefined || code === undefined) return;
87
+ var identity = String(id).trim();
88
+ var normalizedCode = String(code).trim();
89
+ if (!identity || !normalizedCode || codeById.has(identity)) return;
90
+ codeById.set(identity, normalizedCode);
91
+ });
92
+ return _toConsumableArray(codeById).map(function (_ref) {
93
+ var _ref2 = _slicedToArray(_ref, 2),
94
+ id = _ref2[0],
95
+ code = _ref2[1];
96
+ return {
97
+ id: id,
98
+ code: code
99
+ };
100
+ });
101
+ }
102
+
103
+ /**
104
+ * Payment 的 WalletPass 列表包含实例 code,而 prepare/config 通常只提供
105
+ * 卡名称和余额。按实例 ID 仅补齐 Snapshot 缺失的 code,避免后到的运行态
106
+ * 数据覆盖下单时已经冻结的卡名称和余额。
107
+ */
108
+ export function mergePointCardSnapshotCodes(snapshotsValue, walletPassesValue) {
109
+ var snapshots = buildPointCardSnapshotFromWalletPassList(snapshotsValue);
110
+ if (!snapshots.length || !Array.isArray(walletPassesValue)) return snapshots;
111
+ var codeById = new Map(collectPointCardSnapshotCodeCandidates(walletPassesValue).map(function (_ref3) {
112
+ var id = _ref3.id,
113
+ code = _ref3.code;
114
+ return [id, code];
115
+ }));
116
+ return snapshots.map(function (snapshot) {
117
+ if (snapshot.code) return snapshot;
118
+ var code = codeById.get(String(snapshot.id).trim());
119
+ return code ? _objectSpread(_objectSpread({}, snapshot), {}, {
120
+ code: code
121
+ }) : snapshot;
122
+ });
123
+ }
73
124
  function normalizeSnapshotNameMap(value) {
74
125
  if (typeof value === 'string' || typeof value === 'number') {
75
126
  var normalizedText = String(value).trim();
@@ -78,10 +129,10 @@ function normalizeSnapshotNameMap(value) {
78
129
  } : {};
79
130
  }
80
131
  if (!isPlainObject(value)) return {};
81
- return Object.entries(value).reduce(function (result, _ref) {
82
- var _ref2 = _slicedToArray(_ref, 2),
83
- locale = _ref2[0],
84
- text = _ref2[1];
132
+ return Object.entries(value).reduce(function (result, _ref4) {
133
+ var _ref5 = _slicedToArray(_ref4, 2),
134
+ locale = _ref5[0],
135
+ text = _ref5[1];
85
136
  if (!locale.trim()) return result;
86
137
  if (typeof text !== 'string' && typeof text !== 'number') return result;
87
138
  var normalizedText = String(text).trim();
@@ -207,13 +258,13 @@ export function composeLinePrice(params) {
207
258
  _step;
208
259
  try {
209
260
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
210
- var _ref3, _item$num;
261
+ var _ref6, _item$num;
211
262
  var item = _step.value;
212
263
  // markdown(减价)按带符号净额取减;markup/原价维持相加。
213
264
  var signedUnit = getBundleSignedUnit(item, {
214
265
  useOriginal: useOriginalBundle
215
266
  });
216
- var rawNum = (_ref3 = (_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref3 !== void 0 ? _ref3 : 1;
267
+ var rawNum = (_ref6 = (_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref6 !== void 0 ? _ref6 : 1;
217
268
  var num = new Decimal(Number(rawNum) || 0);
218
269
  total = total.plus(signedUnit.times(num));
219
270
  }
@@ -277,12 +328,12 @@ function getSafeOrderProductNum(num) {
277
328
  return Math.floor(parsedNum);
278
329
  }
279
330
  function getOrderProductDepositUnitTotal(product) {
280
- var _ref4;
331
+ var _ref7;
281
332
  var metadata = product.metadata || {};
282
333
  var paymentPrice = metadata.main_product_attached_bundle_payment_price;
283
334
  var mainSellingPrice = metadata.main_product_selling_price;
284
335
  var fallbackPrice = product.selling_price;
285
- return new Decimal(Number((_ref4 = paymentPrice !== null && paymentPrice !== void 0 ? paymentPrice : mainSellingPrice) !== null && _ref4 !== void 0 ? _ref4 : fallbackPrice) || 0);
336
+ return new Decimal(Number((_ref7 = paymentPrice !== null && paymentPrice !== void 0 ? paymentPrice : mainSellingPrice) !== null && _ref7 !== void 0 ? _ref7 : fallbackPrice) || 0);
286
337
  }
287
338
  function normalizeDepositProtocols(protocols) {
288
339
  if (!Array.isArray(protocols)) return [];
@@ -331,13 +382,13 @@ function handleOrderProductDeposit(params) {
331
382
  };
332
383
  }
333
384
  function resolveOrderProductDepositSource(product, runtimeOrigin) {
334
- var _ref5, _record$custom_deposi, _ref6, _record$variant;
385
+ var _ref8, _record$custom_deposi, _ref9, _record$variant;
335
386
  var record = product;
336
387
  var origin = record._origin || runtimeOrigin || {};
337
388
  var originProduct = origin.product || {};
338
389
  return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, originProduct), origin), record), {}, {
339
- custom_deposit_data: (_ref5 = (_record$custom_deposi = record.custom_deposit_data) !== null && _record$custom_deposi !== void 0 ? _record$custom_deposi : origin.custom_deposit_data) !== null && _ref5 !== void 0 ? _ref5 : originProduct.custom_deposit_data,
340
- variant: (_ref6 = (_record$variant = record.variant) !== null && _record$variant !== void 0 ? _record$variant : origin.variant) !== null && _ref6 !== void 0 ? _ref6 : originProduct.variant
390
+ custom_deposit_data: (_ref8 = (_record$custom_deposi = record.custom_deposit_data) !== null && _record$custom_deposi !== void 0 ? _record$custom_deposi : origin.custom_deposit_data) !== null && _ref8 !== void 0 ? _ref8 : originProduct.custom_deposit_data,
391
+ variant: (_ref9 = (_record$variant = record.variant) !== null && _record$variant !== void 0 ? _record$variant : origin.variant) !== null && _ref9 !== void 0 ? _ref9 : originProduct.variant
341
392
  });
342
393
  }
343
394
  function getOrderProductDeposit(product, runtimeOrigin) {
@@ -489,12 +540,12 @@ export function isMarkdownBundle(bundle) {
489
540
  * - markup(加价)/原价子商品:维持 `+(bundle_selling_price ?? price)`,行为不变。
490
541
  */
491
542
  export function getBundleSignedUnit(bundle, options) {
492
- var _options$useOriginal, _ref13, _bundle$original_pric2, _bundle$bundle_sellin;
543
+ var _options$useOriginal, _ref16, _bundle$original_pric2, _bundle$bundle_sellin;
493
544
  if (!bundle || _typeof(bundle) !== 'object') return new Decimal(0);
494
545
  var useOriginal = (_options$useOriginal = options === null || options === void 0 ? void 0 : options.useOriginal) !== null && _options$useOriginal !== void 0 ? _options$useOriginal : false;
495
546
  if (isMarkdownBundle(bundle)) {
496
- var _ref7, _ref8, _ref9, _bundle$original_pric, _ref10, _ref11, _ref12, _bundle$custom_price;
497
- var catalog = useOriginal ? (_ref7 = (_ref8 = (_ref9 = (_bundle$original_pric = bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle.product_price) !== null && _ref9 !== void 0 ? _ref9 : bundle.custom_price) !== null && _ref8 !== void 0 ? _ref8 : bundle.base_price) !== null && _ref7 !== void 0 ? _ref7 : bundle.price : (_ref10 = (_ref11 = (_ref12 = (_bundle$custom_price = bundle.custom_price) !== null && _bundle$custom_price !== void 0 ? _bundle$custom_price : bundle.product_price) !== null && _ref12 !== void 0 ? _ref12 : bundle.original_price) !== null && _ref11 !== void 0 ? _ref11 : bundle.base_price) !== null && _ref10 !== void 0 ? _ref10 : bundle.price;
547
+ var _ref10, _ref11, _ref12, _bundle$original_pric, _ref13, _ref14, _ref15, _bundle$custom_price;
548
+ var catalog = useOriginal ? (_ref10 = (_ref11 = (_ref12 = (_bundle$original_pric = bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle.product_price) !== null && _ref12 !== void 0 ? _ref12 : bundle.custom_price) !== null && _ref11 !== void 0 ? _ref11 : bundle.base_price) !== null && _ref10 !== void 0 ? _ref10 : bundle.price : (_ref13 = (_ref14 = (_ref15 = (_bundle$custom_price = bundle.custom_price) !== null && _bundle$custom_price !== void 0 ? _bundle$custom_price : bundle.product_price) !== null && _ref15 !== void 0 ? _ref15 : bundle.original_price) !== null && _ref14 !== void 0 ? _ref14 : bundle.base_price) !== null && _ref13 !== void 0 ? _ref13 : bundle.price;
498
549
  if (catalog !== undefined && catalog !== null && catalog !== '') {
499
550
  var raw = new Decimal(Number(catalog) || 0);
500
551
  // 负值表示价格已是「带符号净额」(如 cart/changePrice 产出的 -3.7),直接取用不再扣 option,
@@ -505,7 +556,7 @@ export function getBundleSignedUnit(bundle, options) {
505
556
  // 仅剩净额(无毛价)兜底:直接取负,不再扣 option
506
557
  return new Decimal(Number(bundle.bundle_selling_price) || 0).abs().negated();
507
558
  }
508
- var rawPrice = useOriginal ? (_ref13 = (_bundle$original_pric2 = bundle.original_price) !== null && _bundle$original_pric2 !== void 0 ? _bundle$original_pric2 : bundle.product_price) !== null && _ref13 !== void 0 ? _ref13 : bundle.price : (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.price;
559
+ var rawPrice = useOriginal ? (_ref16 = (_bundle$original_pric2 = bundle.original_price) !== null && _bundle$original_pric2 !== void 0 ? _bundle$original_pric2 : bundle.product_price) !== null && _ref16 !== void 0 ? _ref16 : bundle.price : (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.price;
509
560
  return new Decimal(Number(rawPrice) || 0);
510
561
  }
511
562
 
@@ -735,17 +786,17 @@ export function resolveEffectivePerUnitDiscount(product) {
735
786
  }
736
787
  export function createDefaultOrderRulesHooks(getBookings) {
737
788
  var getProductStartDate = function getProductStartDate(product) {
738
- var _ref14, _product$metadata$uni, _product$metadata2, _ref15, _product$booking_uid, _product$metadata3, _product$metadata4, _product$metadata5, _product$metadata6;
739
- var productUid = String((_ref14 = (_product$metadata$uni = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.unique_identification_number) !== null && _product$metadata$uni !== void 0 ? _product$metadata$uni : product.unique_identification_number) !== null && _ref14 !== void 0 ? _ref14 : '');
740
- var bookingUid = String((_ref15 = (_product$booking_uid = product.booking_uid) !== null && _product$booking_uid !== void 0 ? _product$booking_uid : (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.booking_uid) !== null && _ref15 !== void 0 ? _ref15 : '');
789
+ var _ref17, _product$metadata$uni, _product$metadata2, _ref18, _product$booking_uid, _product$metadata3, _product$metadata4, _product$metadata5, _product$metadata6;
790
+ var productUid = String((_ref17 = (_product$metadata$uni = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.unique_identification_number) !== null && _product$metadata$uni !== void 0 ? _product$metadata$uni : product.unique_identification_number) !== null && _ref17 !== void 0 ? _ref17 : '');
791
+ var bookingUid = String((_ref18 = (_product$booking_uid = product.booking_uid) !== null && _product$booking_uid !== void 0 ? _product$booking_uid : (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.booking_uid) !== null && _ref18 !== void 0 ? _ref18 : '');
741
792
  // 每次读取当前 bookings,覆盖改期、订单回显以及直接调用 Rules 的选券入口。
742
793
  var bookings = (getBookings === null || getBookings === void 0 ? void 0 : getBookings()) || [];
743
794
  var booking = bookings.find(function (item) {
744
- var _ref16, _item$product_uid, _item$metadata3;
745
- return productUid && String((_ref16 = (_item$product_uid = item === null || item === void 0 ? void 0 : item.product_uid) !== null && _item$product_uid !== void 0 ? _item$product_uid : item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.product_uid) !== null && _ref16 !== void 0 ? _ref16 : '') === productUid;
795
+ var _ref19, _item$product_uid, _item$metadata3;
796
+ return productUid && String((_ref19 = (_item$product_uid = item === null || item === void 0 ? void 0 : item.product_uid) !== null && _item$product_uid !== void 0 ? _item$product_uid : item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.product_uid) !== null && _ref19 !== void 0 ? _ref19 : '') === productUid;
746
797
  }) || bookings.find(function (item) {
747
- var _ref17, _item$metadata$unique, _item$metadata4;
748
- return bookingUid && String((_ref17 = (_item$metadata$unique = item === null || item === void 0 || (_item$metadata4 = item.metadata) === null || _item$metadata4 === void 0 ? void 0 : _item$metadata4.unique_identification_number) !== null && _item$metadata$unique !== void 0 ? _item$metadata$unique : item === null || item === void 0 ? void 0 : item.booking_uid) !== null && _ref17 !== void 0 ? _ref17 : '') === bookingUid;
798
+ var _ref20, _item$metadata$unique, _item$metadata4;
799
+ return bookingUid && String((_ref20 = (_item$metadata$unique = item === null || item === void 0 || (_item$metadata4 = item.metadata) === null || _item$metadata4 === void 0 ? void 0 : _item$metadata4.unique_identification_number) !== null && _item$metadata$unique !== void 0 ? _item$metadata$unique : item === null || item === void 0 ? void 0 : item.booking_uid) !== null && _ref20 !== void 0 ? _ref20 : '') === bookingUid;
749
800
  });
750
801
  if (booking) {
751
802
  // 严格解析并保留 Invalid Date,让公共时间校验拒绝缺失/非法时间,避免回退到当前时间。
@@ -762,8 +813,8 @@ export function createDefaultOrderRulesHooks(getBookings) {
762
813
  return new Decimal(Number(totalLike) || 0).dividedBy(effectiveNum).toDecimalPlaces(2).toString();
763
814
  };
764
815
  var getBundleIdentity = function getBundleIdentity(bundle) {
765
- var _ref18, _bundle$bundle_id, _ref19, _ref20, _bundle$bundle_produc, _ref21, _ref22, _bundle$bundle_varian, _ref23, _bundle$bundle_group_;
766
- return [(_ref18 = (_bundle$bundle_id = bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle.id) !== null && _ref18 !== void 0 ? _ref18 : '', (_ref19 = (_ref20 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref20 !== void 0 ? _ref20 : bundle.product_id) !== null && _ref19 !== void 0 ? _ref19 : '', (_ref21 = (_ref22 = (_bundle$bundle_varian = bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle.variant_id) !== null && _ref22 !== void 0 ? _ref22 : bundle.product_variant_id) !== null && _ref21 !== void 0 ? _ref21 : 0, (_ref23 = (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id) !== null && _ref23 !== void 0 ? _ref23 : ''].join('|');
816
+ var _ref21, _bundle$bundle_id, _ref22, _ref23, _bundle$bundle_produc, _ref24, _ref25, _bundle$bundle_varian, _ref26, _bundle$bundle_group_;
817
+ return [(_ref21 = (_bundle$bundle_id = bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle.id) !== null && _ref21 !== void 0 ? _ref21 : '', (_ref22 = (_ref23 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref23 !== void 0 ? _ref23 : bundle.product_id) !== null && _ref22 !== void 0 ? _ref22 : '', (_ref24 = (_ref25 = (_bundle$bundle_varian = bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle.variant_id) !== null && _ref25 !== void 0 ? _ref25 : bundle.product_variant_id) !== null && _ref24 !== void 0 ? _ref24 : 0, (_ref26 = (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id) !== null && _ref26 !== void 0 ? _ref26 : ''].join('|');
767
818
  };
768
819
  var mergeRulesBundlePrices = function mergeRulesBundlePrices(currentBundle, rulesBundle) {
769
820
  if (!Array.isArray(rulesBundle)) return rulesBundle;
@@ -773,7 +824,7 @@ export function createDefaultOrderRulesHooks(getBookings) {
773
824
  currentByIdentity.set(getBundleIdentity(bundle), bundle);
774
825
  });
775
826
  return rulesBundle.map(function (bundle) {
776
- var _bundle$price_type_ex2, _ref24, _ref25, _current$price, _ref26, _ref27, _ref28, _current$original_pri;
827
+ var _bundle$price_type_ex2, _ref27, _ref28, _current$price, _ref29, _ref30, _ref31, _current$original_pri;
777
828
  if (!bundle || _typeof(bundle) !== 'object') return bundle;
778
829
  var current = currentByIdentity.get(getBundleIdentity(bundle));
779
830
  if (!current) return bundle;
@@ -782,8 +833,8 @@ export function createDefaultOrderRulesHooks(getBookings) {
782
833
  } : {});
783
834
  var isProductPriceBundle = ((_bundle$price_type_ex2 = bundle.price_type_ext) !== null && _bundle$price_type_ex2 !== void 0 ? _bundle$price_type_ex2 : current.price_type_ext) === 'product_price';
784
835
  if (!isProductPriceBundle) return bundleWithDisplayFields;
785
- var sourcePrice = (_ref24 = (_ref25 = (_current$price = current.price) !== null && _current$price !== void 0 ? _current$price : current.custom_price) !== null && _ref25 !== void 0 ? _ref25 : current.original_price) !== null && _ref24 !== void 0 ? _ref24 : current.bundle_selling_price;
786
- var originalPrice = (_ref26 = (_ref27 = (_ref28 = (_current$original_pri = current.original_price) !== null && _current$original_pri !== void 0 ? _current$original_pri : current.product_price) !== null && _ref28 !== void 0 ? _ref28 : current.price) !== null && _ref27 !== void 0 ? _ref27 : current.custom_price) !== null && _ref26 !== void 0 ? _ref26 : sourcePrice;
836
+ var sourcePrice = (_ref27 = (_ref28 = (_current$price = current.price) !== null && _current$price !== void 0 ? _current$price : current.custom_price) !== null && _ref28 !== void 0 ? _ref28 : current.original_price) !== null && _ref27 !== void 0 ? _ref27 : current.bundle_selling_price;
837
+ var originalPrice = (_ref29 = (_ref30 = (_ref31 = (_current$original_pri = current.original_price) !== null && _current$original_pri !== void 0 ? _current$original_pri : current.product_price) !== null && _ref31 !== void 0 ? _ref31 : current.price) !== null && _ref30 !== void 0 ? _ref30 : current.custom_price) !== null && _ref29 !== void 0 ? _ref29 : sourcePrice;
787
838
  return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, bundleWithDisplayFields), sourcePrice !== undefined ? {
788
839
  price: sourcePrice
789
840
  } : {}), originalPrice !== undefined ? {
@@ -847,10 +898,10 @@ export function createDefaultOrderRulesHooks(getBookings) {
847
898
  };
848
899
  },
849
900
  setProduct: function setProduct(product, values) {
850
- var _ref29, _values$quantity, _ref30, _metadataAny$source_p, _values$discount_list, _values$quantity2;
851
- var nextNum = Number((_ref29 = (_values$quantity = values.quantity) !== null && _values$quantity !== void 0 ? _values$quantity : product.num) !== null && _ref29 !== void 0 ? _ref29 : 1) || 1;
901
+ var _ref32, _values$quantity, _ref33, _metadataAny$source_p, _values$discount_list, _values$quantity2;
902
+ var nextNum = Number((_ref32 = (_values$quantity = values.quantity) !== null && _values$quantity !== void 0 ? _values$quantity : product.num) !== null && _ref32 !== void 0 ? _ref32 : 1) || 1;
852
903
  var metadataAny = product.metadata || {};
853
- var existedSource = (_ref30 = (_metadataAny$source_p = metadataAny.source_product_price) !== null && _metadataAny$source_p !== void 0 ? _metadataAny$source_p : product.selling_price) !== null && _ref30 !== void 0 ? _ref30 : '0';
904
+ var existedSource = (_ref33 = (_metadataAny$source_p = metadataAny.source_product_price) !== null && _metadataAny$source_p !== void 0 ? _metadataAny$source_p : product.selling_price) !== null && _ref33 !== void 0 ? _ref33 : '0';
854
905
  var nextOptions = getProductSkuOptions(product);
855
906
  var optionSum = sumOptionUnitPrice(nextOptions);
856
907
 
@@ -1060,7 +1111,7 @@ function formatSubmitBundleItems(bundle) {
1060
1111
  var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1061
1112
  if (!Array.isArray(bundle)) return [];
1062
1113
  return bundle.map(function (b) {
1063
- var _ref31, _rawBundle$price, _rawBundle$surcharge_, _rawBundle$num, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$quantity, _rawBundle$extension_, _rawBundle$extension_2, _ref32, _rawBundle$price_type, _ref33, _rawBundle$price_type2, _rawBundle$bundle_gro, _rawBundle$bundle_id, _rawBundle$bundle_pro;
1114
+ var _ref34, _rawBundle$price, _rawBundle$surcharge_, _rawBundle$num, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$quantity, _rawBundle$extension_, _rawBundle$extension_2, _ref35, _rawBundle$price_type, _ref36, _rawBundle$price_type2, _rawBundle$bundle_gro, _rawBundle$bundle_id, _rawBundle$bundle_pro;
1064
1115
  var rawBundle = b && _typeof(b) === 'object' ? b : {};
1065
1116
  var existedMetadata = rawBundle.metadata && _typeof(rawBundle.metadata) === 'object' ? rawBundle.metadata : {};
1066
1117
  var _customProductBundleMapId = existedMetadata.custom_product_bundle_map_id,
@@ -1071,7 +1122,7 @@ function formatSubmitBundleItems(bundle) {
1071
1122
  var sellingPrice = formatOptions.virtualSettlementMode ? '0.00' : getBundleSellingMagnitude(rawBundle).toFixed(2);
1072
1123
  // payment 价由整单折扣均摊层产出;缺省(无折扣)时与 selling 净额同义。
1073
1124
  var paymentPrice = formatOptions.virtualSettlementMode ? '0.00' : rawBundle.bundle_payment_price !== undefined && rawBundle.bundle_payment_price !== null && rawBundle.bundle_payment_price !== '' ? toMoneyString(rawBundle.bundle_payment_price) : sellingPrice;
1074
- var priceValue = formatOptions.virtualSettlementMode ? 0 : (_ref31 = (_rawBundle$price = rawBundle.price) !== null && _rawBundle$price !== void 0 ? _rawBundle$price : rawBundle.custom_price) !== null && _ref31 !== void 0 ? _ref31 : rawBundle.bundle_selling_price;
1125
+ var priceValue = formatOptions.virtualSettlementMode ? 0 : (_ref34 = (_rawBundle$price = rawBundle.price) !== null && _rawBundle$price !== void 0 ? _rawBundle$price : rawBundle.custom_price) !== null && _ref34 !== void 0 ? _ref34 : rawBundle.bundle_selling_price;
1075
1126
  var relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
1076
1127
  var surchargeFee = toMoneyString((_rawBundle$surcharge_ = rawBundle.surcharge_fee) !== null && _rawBundle$surcharge_ !== void 0 ? _rawBundle$surcharge_ : existedMetadata.surcharge_fee);
1077
1128
  var productDiscountDifference = toBundleNumber(existedMetadata.product_discount_difference, 0);
@@ -1090,8 +1141,8 @@ function formatSubmitBundleItems(bundle) {
1090
1141
  extension_id: (_rawBundle$extension_ = rawBundle.extension_id) !== null && _rawBundle$extension_ !== void 0 ? _rawBundle$extension_ : 0,
1091
1142
  extension_type: (_rawBundle$extension_2 = rawBundle.extension_type) !== null && _rawBundle$extension_2 !== void 0 ? _rawBundle$extension_2 : 'normal',
1092
1143
  price: priceValue,
1093
- price_type: (_ref32 = (_rawBundle$price_type = rawBundle.price_type) !== null && _rawBundle$price_type !== void 0 ? _rawBundle$price_type : rawBundle.custom_price_type) !== null && _ref32 !== void 0 ? _ref32 : '',
1094
- price_type_ext: (_ref33 = (_rawBundle$price_type2 = rawBundle.price_type_ext) !== null && _rawBundle$price_type2 !== void 0 ? _rawBundle$price_type2 : rawBundle.custom_price_type_ext) !== null && _ref33 !== void 0 ? _ref33 : '',
1144
+ price_type: (_ref35 = (_rawBundle$price_type = rawBundle.price_type) !== null && _rawBundle$price_type !== void 0 ? _rawBundle$price_type : rawBundle.custom_price_type) !== null && _ref35 !== void 0 ? _ref35 : '',
1145
+ price_type_ext: (_ref36 = (_rawBundle$price_type2 = rawBundle.price_type_ext) !== null && _rawBundle$price_type2 !== void 0 ? _rawBundle$price_type2 : rawBundle.custom_price_type_ext) !== null && _ref36 !== void 0 ? _ref36 : '',
1095
1146
  bundle_selling_price: sellingPrice,
1096
1147
  bundle_payment_price: paymentPrice,
1097
1148
  option: formatSubmitOptionItems(rawBundle.option, formatOptions),
@@ -1127,11 +1178,11 @@ function formatSubmitBundleItems(bundle) {
1127
1178
  * 法币仅做字段/metadata 裁剪;虚拟币在出站前再次执行零加价与固定单价断言。
1128
1179
  */
1129
1180
  function normalizeSubmitProduct(product) {
1130
- var _ref35, _submitProduct$bundle, _rawMetadata$product_, _rawMetadata$selected, _rawMetadata$selected2, _submitProduct$produc, _submitProduct$paymen;
1181
+ var _ref38, _submitProduct$bundle, _rawMetadata$product_, _rawMetadata$selected, _rawMetadata$selected2, _submitProduct$produc, _submitProduct$paymen;
1131
1182
  var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1132
- var _ref34 = product,
1133
- _runtimeUid = _ref34.unique_identification_number,
1134
- submitProduct = _objectWithoutProperties(_ref34, _excluded2);
1183
+ var _ref37 = product,
1184
+ _runtimeUid = _ref37.unique_identification_number,
1185
+ submitProduct = _objectWithoutProperties(_ref37, _excluded2);
1135
1186
  var num = submitProduct.num,
1136
1187
  _productSurchargeFee = submitProduct.surcharge_fee,
1137
1188
  _deprecatedDiscountAmount = submitProduct.discount_amount,
@@ -1148,7 +1199,7 @@ function normalizeSubmitProduct(product) {
1148
1199
  // 兼容历史 BigSale 编辑链路:bundle_edit 曾被写入 metadata,
1149
1200
  // 出站时需提升到商品顶层;套餐未编辑时也必须显式提交 0。
1150
1201
  var hasProductBundle = Array.isArray(submitProduct.product_bundle) && submitProduct.product_bundle.length > 0;
1151
- var bundleEdit = (_ref35 = (_submitProduct$bundle = submitProduct.bundle_edit) !== null && _submitProduct$bundle !== void 0 ? _submitProduct$bundle : rawMetadata.bundle_edit) !== null && _ref35 !== void 0 ? _ref35 : hasProductBundle ? 0 : undefined;
1202
+ var bundleEdit = (_ref38 = (_submitProduct$bundle = submitProduct.bundle_edit) !== null && _submitProduct$bundle !== void 0 ? _submitProduct$bundle : rawMetadata.bundle_edit) !== null && _ref38 !== void 0 ? _ref38 : hasProductBundle ? 0 : undefined;
1152
1203
  var cleanMetadata = {};
1153
1204
  if (rawMetadata.unique_identification_number) {
1154
1205
  cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
@@ -1213,7 +1264,7 @@ function normalizeSubmitProduct(product) {
1213
1264
  payment_price: formatOptions.virtualSettlementMode ? virtualPrice : (_submitProduct$paymen = submitProduct.payment_price) !== null && _submitProduct$paymen !== void 0 ? _submitProduct$paymen : submitProduct.selling_price
1214
1265
  });
1215
1266
  }
1216
- var SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder'];
1267
+ var SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder', 'is_fulfillment_timing', 'fulfillment_timing'];
1217
1268
  export function normalizeBookingIsAll(booking) {
1218
1269
  return booking.is_all === true || booking.is_all === 1 || booking.is_all === '1' || booking.is_all === 'true' ? 1 : 0;
1219
1270
  }
@@ -1241,16 +1292,22 @@ export function normalizeSubmitBooking(booking) {
1241
1292
  } finally {
1242
1293
  _iterator7.f();
1243
1294
  }
1244
- if (cleanMetadata.holder_id === undefined) cleanMetadata.holder_id = null;
1295
+ if (cleanMetadata.holder_id === undefined && !isFulfillmentTimingBooking(booking)) {
1296
+ cleanMetadata.holder_id = null;
1297
+ }
1245
1298
  var bookingRecord = booking;
1246
1299
  var startDate = bookingRecord.start_date;
1247
1300
  var shouldRestoreSelectDate = bookingRecord.select_date === undefined || bookingRecord.select_date === null || bookingRecord.select_date === '';
1248
1301
  var selectDateFromStartDate = typeof startDate === 'string' ? startDate.split(/\s+/)[0] : startDate;
1249
- return _objectSpread(_objectSpread(_objectSpread({}, booking), shouldRestoreSelectDate && selectDateFromStartDate ? {
1302
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, booking), shouldRestoreSelectDate && selectDateFromStartDate ? {
1250
1303
  select_date: selectDateFromStartDate
1251
1304
  } : {}), {}, {
1252
1305
  is_all: normalizeBookingIsAll(bookingRecord),
1253
- sub_type: normalizeBookingSubType(bookingRecord),
1306
+ sub_type: normalizeBookingSubType(bookingRecord)
1307
+ }, isFulfillmentTimingBooking(booking) ? {
1308
+ like_status: bookingRecord.like_status || 'common',
1309
+ schedule_id: bookingRecord.schedule_id || 0
1310
+ } : {}), {}, {
1254
1311
  metadata: cleanMetadata
1255
1312
  });
1256
1313
  }
@@ -1339,6 +1396,7 @@ function hasBoundBookingResource(bookings) {
1339
1396
  if (!Array.isArray(bookings)) return false;
1340
1397
  return bookings.some(function (booking) {
1341
1398
  if (!booking || _typeof(booking) !== 'object') return false;
1399
+ if (isFulfillmentTimingBooking(booking)) return false;
1342
1400
  if (Number(booking.parent_id) === 0) return false;
1343
1401
  var resources = booking.resources;
1344
1402
  if (!Array.isArray(resources)) return false;
@@ -1373,13 +1431,15 @@ export function resolveSubmitOrderType(params) {
1373
1431
  return 'table-order';
1374
1432
  }
1375
1433
  if (currentType) return currentType;
1376
- if (Array.isArray(bookings) && bookings.length > 0) {
1434
+ if (Array.isArray(bookings) && bookings.some(function (booking) {
1435
+ return !isFulfillmentTimingBooking(booking);
1436
+ })) {
1377
1437
  return businessCode === 'dine_in' ? 'table-order' : 'appointment_booking';
1378
1438
  }
1379
1439
  return 'virtual';
1380
1440
  }
1381
1441
  export function buildSubmitPayload(params) {
1382
- var _tempOrder$metadata2, _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref37, _tempOrder$is_price_i, _tempOrder$is_deposit, _tempOrder$_extend, _enhancedPayload$summ;
1442
+ var _tempOrder$metadata2, _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref40, _tempOrder$is_price_i, _tempOrder$is_deposit, _tempOrder$_extend, _enhancedPayload$summ;
1383
1443
  var tempOrder = params.tempOrder,
1384
1444
  cacheId = params.cacheId,
1385
1445
  _params$now = params.now,
@@ -1393,29 +1453,29 @@ export function buildSubmitPayload(params) {
1393
1453
  var scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
1394
1454
  var bookingUuid = createUuidV4();
1395
1455
  var virtualSettlementMode = ((_tempOrder$metadata2 = tempOrder.metadata) === null || _tempOrder$metadata2 === void 0 || (_tempOrder$metadata2 = _tempOrder$metadata2.currency_settlement_config) === null || _tempOrder$metadata2 === void 0 ? void 0 : _tempOrder$metadata2.settlement_type) === 'virtual_currency';
1396
- var _ref36 = tempOrder,
1397
- _extend = _ref36._extend,
1398
- _relationId = _ref36.relation_id,
1399
- _tableFormId = _ref36.table_form_id,
1400
- _resourceId = _ref36.resource_id,
1401
- _summary = _ref36.summary,
1402
- _lastOrderInfo = _ref36.lastOrderInfo,
1403
- _paidAmount = _ref36.paid_amount,
1404
- _shopId = _ref36.shop_id,
1405
- _shopNote = _ref36.shop_note,
1406
- _shopServiceType = _ref36.shop_service_type,
1407
- _startTime = _ref36.start_time,
1408
- _customer = _ref36.customer,
1409
- _discountList = _ref36.discount_list,
1410
- _orderMetaList = _ref36.order_meta_list,
1411
- _rootTaxFee = _ref36.tax_fee,
1412
- _totalAmount = _ref36.total_amount,
1413
- _totalRefundAmount = _ref36.total_refund_amount,
1414
- _createDate = _ref36.create_date,
1415
- _holderId = _ref36.holder_id,
1416
- _paymentStatus = _ref36.payment_status,
1417
- _notes = _ref36.notes,
1418
- tempOrderRest = _objectWithoutProperties(_ref36, _excluded4);
1456
+ var _ref39 = tempOrder,
1457
+ _extend = _ref39._extend,
1458
+ _relationId = _ref39.relation_id,
1459
+ _tableFormId = _ref39.table_form_id,
1460
+ _resourceId = _ref39.resource_id,
1461
+ _summary = _ref39.summary,
1462
+ _lastOrderInfo = _ref39.lastOrderInfo,
1463
+ _paidAmount = _ref39.paid_amount,
1464
+ _shopId = _ref39.shop_id,
1465
+ _shopNote = _ref39.shop_note,
1466
+ _shopServiceType = _ref39.shop_service_type,
1467
+ _startTime = _ref39.start_time,
1468
+ _customer = _ref39.customer,
1469
+ _discountList = _ref39.discount_list,
1470
+ _orderMetaList = _ref39.order_meta_list,
1471
+ _rootTaxFee = _ref39.tax_fee,
1472
+ _totalAmount = _ref39.total_amount,
1473
+ _totalRefundAmount = _ref39.total_refund_amount,
1474
+ _createDate = _ref39.create_date,
1475
+ _holderId = _ref39.holder_id,
1476
+ _paymentStatus = _ref39.payment_status,
1477
+ _notes = _ref39.notes,
1478
+ tempOrderRest = _objectWithoutProperties(_ref39, _excluded4);
1419
1479
  var resolvedBusinessCode = businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code;
1420
1480
  var normalizedOrderMetaList = normalizeOrderMetaList(tempOrder.order_meta_list);
1421
1481
  var submitType = resolveSubmitOrderType({
@@ -1440,7 +1500,7 @@ export function buildSubmitPayload(params) {
1440
1500
  type: submitType,
1441
1501
  business_code: resolvedBusinessCode,
1442
1502
  sales_channel: tempOrder.sales_channel || 'my_pisel',
1443
- order_sales_channel: (_ref37 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref37 !== void 0 ? _ref37 : 'online_store',
1503
+ order_sales_channel: (_ref40 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref40 !== void 0 ? _ref40 : 'online_store',
1444
1504
  status: tempOrder.status || 'normal'
1445
1505
  }, params.includePaymentStatus !== false ? {
1446
1506
  payment_status: tempOrder.payment_status || 'payment_processing'
@@ -1457,7 +1517,7 @@ export function buildSubmitPayload(params) {
1457
1517
  schedule_date: scheduleDate,
1458
1518
  // created_at: tempOrder.created_at || formatDateTime(now), 和后端协定这个字段先不提交到接口
1459
1519
  bookings: (tempOrder.bookings || []).filter(function (booking) {
1460
- return Number(booking.parent_id) !== 0;
1520
+ return isFulfillmentTimingBooking(booking) || Number(booking.parent_id) !== 0;
1461
1521
  }).map(function (booking) {
1462
1522
  return normalizeSubmitBooking(booking);
1463
1523
  }),
@@ -1468,13 +1528,13 @@ export function buildSubmitPayload(params) {
1468
1528
  // holder: tempOrder.holder || null,
1469
1529
  summary: summary || tempOrder.summary || createEmptySummary(),
1470
1530
  metadata: function () {
1471
- var _ref38 = tempOrder.metadata || {},
1472
- _collectPax = _ref38.collect_pax,
1473
- _tableOccupancyDuration = _ref38.table_occupancy_duration,
1474
- _cartSettlementKey = _ref38.cart_settlement_key,
1475
- _cartSettlementSnapshot = _ref38.cart_settlement_snapshot,
1476
- _legalCurrencySnapshot = _ref38.legal_currency_snapshot,
1477
- rest = _objectWithoutProperties(_ref38, _excluded5);
1531
+ var _ref41 = tempOrder.metadata || {},
1532
+ _collectPax = _ref41.collect_pax,
1533
+ _tableOccupancyDuration = _ref41.table_occupancy_duration,
1534
+ _cartSettlementKey = _ref41.cart_settlement_key,
1535
+ _cartSettlementSnapshot = _ref41.cart_settlement_snapshot,
1536
+ _legalCurrencySnapshot = _ref41.legal_currency_snapshot,
1537
+ rest = _objectWithoutProperties(_ref41, _excluded5);
1478
1538
  return _objectSpread({}, rest);
1479
1539
  }()
1480
1540
  }, (_tempOrder$_extend = tempOrder._extend) !== null && _tempOrder$_extend !== void 0 && (_tempOrder$_extend = _tempOrder$_extend.salesNotesState) !== null && _tempOrder$_extend !== void 0 && _tempOrder$_extend.dirty ? {
@@ -1691,8 +1751,8 @@ export function getRuntimeProductOrigin(tempOrder, product) {
1691
1751
  return tempOrder._extend.productsByUid[uid].origin;
1692
1752
  }
1693
1753
  var matchedProduct = ((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || []).find(function (item) {
1694
- var _ref39, _item$product_id, _ref40, _product$product_id;
1695
- return item === product || getOrderProductLineUid(item) === uid || String((_ref39 = (_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref39 !== void 0 ? _ref39 : '') === String((_ref40 = (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id) !== null && _ref40 !== void 0 ? _ref40 : '');
1754
+ var _ref42, _item$product_id, _ref43, _product$product_id;
1755
+ return item === product || getOrderProductLineUid(item) === uid || String((_ref42 = (_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref42 !== void 0 ? _ref42 : '') === String((_ref43 = (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id) !== null && _ref43 !== void 0 ? _ref43 : '');
1696
1756
  });
1697
1757
  var matchedUid = matchedProduct ? getOrderProductLineUid(matchedProduct) : '';
1698
1758
  return matchedUid ? (tempOrder === null || tempOrder === void 0 || (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[matchedUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin) || null : null;