@pisell/pisellos 0.10.8 → 0.10.9

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 (98) hide show
  1. package/dist/core/index.js +0 -1
  2. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
  3. package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
  4. package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
  5. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  6. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
  7. package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
  8. package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
  9. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
  10. package/dist/modules/BookingContext/utils/productExtend.js +5 -9
  11. package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
  12. package/dist/modules/Customer/index.d.ts +4 -0
  13. package/dist/modules/Customer/index.js +91 -59
  14. package/dist/modules/Customer/types.d.ts +2 -0
  15. package/dist/modules/Discount/index.d.ts +2 -0
  16. package/dist/modules/Discount/index.js +38 -5
  17. package/dist/modules/Discount/types.d.ts +11 -0
  18. package/dist/modules/Order/index.d.ts +20 -1
  19. package/dist/modules/Order/index.js +976 -730
  20. package/dist/modules/Order/types.d.ts +6 -1
  21. package/dist/modules/Order/utils/virtualSettlement.d.ts +56 -0
  22. package/dist/modules/Order/utils/virtualSettlement.js +271 -0
  23. package/dist/modules/Order/utils.js +89 -48
  24. package/dist/modules/Payment/types.d.ts +2 -0
  25. package/dist/modules/Payment/utils.js +4 -1
  26. package/dist/modules/Payment/walletpass.d.ts +11 -0
  27. package/dist/modules/Payment/walletpass.js +235 -60
  28. package/dist/modules/Product/types.d.ts +23 -0
  29. package/dist/modules/ProductList/index.d.ts +15 -2
  30. package/dist/modules/ProductList/index.js +92 -13
  31. package/dist/modules/SalesSummary/index.d.ts +1 -0
  32. package/dist/modules/SalesSummary/index.js +4 -3
  33. package/dist/modules/SalesSummary/types.d.ts +1 -0
  34. package/dist/modules/SalesSummary/utils.d.ts +1 -0
  35. package/dist/modules/SalesSummary/utils.js +21 -1
  36. package/dist/server/index.d.ts +9 -0
  37. package/dist/server/index.js +90 -58
  38. package/dist/server/modules/order/index.d.ts +1 -0
  39. package/dist/server/modules/order/index.js +252 -94
  40. package/dist/server/utils/small-ticket.js +2 -1
  41. package/dist/solution/BaseSales/index.d.ts +26 -2
  42. package/dist/solution/BaseSales/index.js +1310 -931
  43. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  44. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +78 -12
  45. package/dist/solution/BookingByStep/index.d.ts +3 -3
  46. package/dist/solution/BookingTicket/index.d.ts +5 -1
  47. package/dist/solution/BookingTicket/index.js +221 -159
  48. package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
  49. package/dist/solution/ScanOrder/index.js +25 -64
  50. package/lib/core/index.js +0 -1
  51. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
  52. package/lib/model/strategy/adapter/dataVariant/evaluator.js +170 -7
  53. package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
  54. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
  55. package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
  56. package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
  57. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
  58. package/lib/modules/BookingContext/utils/productExtend.js +4 -3
  59. package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
  60. package/lib/modules/Customer/index.d.ts +4 -0
  61. package/lib/modules/Customer/index.js +11 -0
  62. package/lib/modules/Customer/types.d.ts +2 -0
  63. package/lib/modules/Discount/index.d.ts +2 -0
  64. package/lib/modules/Discount/index.js +37 -3
  65. package/lib/modules/Discount/types.d.ts +11 -0
  66. package/lib/modules/Order/index.d.ts +20 -1
  67. package/lib/modules/Order/index.js +393 -128
  68. package/lib/modules/Order/types.d.ts +6 -1
  69. package/lib/modules/Order/utils/virtualSettlement.d.ts +56 -0
  70. package/lib/modules/Order/utils/virtualSettlement.js +300 -0
  71. package/lib/modules/Order/utils.js +65 -21
  72. package/lib/modules/Payment/types.d.ts +2 -0
  73. package/lib/modules/Payment/utils.js +5 -1
  74. package/lib/modules/Payment/walletpass.d.ts +11 -0
  75. package/lib/modules/Payment/walletpass.js +198 -17
  76. package/lib/modules/Product/types.d.ts +23 -0
  77. package/lib/modules/ProductList/index.d.ts +15 -2
  78. package/lib/modules/ProductList/index.js +85 -3
  79. package/lib/modules/SalesSummary/index.d.ts +1 -0
  80. package/lib/modules/SalesSummary/index.js +10 -2
  81. package/lib/modules/SalesSummary/types.d.ts +1 -0
  82. package/lib/modules/SalesSummary/utils.d.ts +1 -0
  83. package/lib/modules/SalesSummary/utils.js +25 -1
  84. package/lib/server/index.d.ts +9 -0
  85. package/lib/server/index.js +54 -14
  86. package/lib/server/modules/order/index.d.ts +1 -0
  87. package/lib/server/modules/order/index.js +66 -2
  88. package/lib/server/utils/small-ticket.js +1 -1
  89. package/lib/solution/BaseSales/index.d.ts +26 -2
  90. package/lib/solution/BaseSales/index.js +261 -23
  91. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  92. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +61 -11
  93. package/lib/solution/BookingByStep/index.d.ts +3 -3
  94. package/lib/solution/BookingTicket/index.d.ts +5 -1
  95. package/lib/solution/BookingTicket/index.js +30 -2
  96. package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -1
  97. package/lib/solution/ScanOrder/index.js +17 -54
  98. package/package.json +1 -1
@@ -18,6 +18,19 @@ export declare class ProductList extends BaseModule implements Module {
18
18
  * productList.updateOtherParams({ channel: 'pos' });
19
19
  */
20
20
  updateOtherParams(params: Record<string, any>): void;
21
+ /**
22
+ * 判断当前商品查询是否会被本地 OS Server 接管。
23
+ *
24
+ * 不能只看请求参数中的 osServer=true:H5 RequestPlugin 会透传该参数,但仍然直接请求远端接口。
25
+ * 这里按 RequestPlugin 实际使用的 baseUrl 检查已注册路由,避免 OS Server 与客户端重复执行
26
+ * Data Variant 评估。
27
+ */
28
+ private isProductQueryHandledByOsServer;
29
+ /**
30
+ * 未启用商品 OS 路由时,在客户端补做 Data Variant 解析。
31
+ * OS Server 已接管时直接信任服务端结果,确保同一批商品只评估一次。
32
+ */
33
+ private resolveClientDataVariants;
21
34
  storeChange(path?: string, value?: any): Promise<void>;
22
35
  /**
23
36
  * 获取加时商品列表。
@@ -25,11 +38,11 @@ export declare class ProductList extends BaseModule implements Module {
25
38
  * @example
26
39
  * const products = await productList.getAddTimeProducts({ schedule_date: '2026-06-16' });
27
40
  */
28
- getAddTimeProducts(params?: ProductListLoadProductsParams): Promise<any>;
41
+ getAddTimeProducts(params?: ProductListLoadProductsParams): Promise<ProductData[]>;
29
42
  loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status, strategy_context, }?: ProductListLoadProductsParams, options?: {
30
43
  callback?: (result: any) => void;
31
44
  subscriberId?: string;
32
- }): Promise<any>;
45
+ }): Promise<ProductData[]>;
33
46
  loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
34
47
  ids?: number[];
35
48
  customer_id?: number;
@@ -1,6 +1,6 @@
1
- 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); }
2
1
  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; }
3
2
  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; }
3
+ 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); }
4
4
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
5
5
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
6
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -78,6 +78,64 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
78
78
  value: function updateOtherParams(params) {
79
79
  this.otherParams = params || {};
80
80
  }
81
+
82
+ /**
83
+ * 判断当前商品查询是否会被本地 OS Server 接管。
84
+ *
85
+ * 不能只看请求参数中的 osServer=true:H5 RequestPlugin 会透传该参数,但仍然直接请求远端接口。
86
+ * 这里按 RequestPlugin 实际使用的 baseUrl 检查已注册路由,避免 OS Server 与客户端重复执行
87
+ * Data Variant 评估。
88
+ */
89
+ }, {
90
+ key: "isProductQueryHandledByOsServer",
91
+ value: function isProductQueryHandledByOsServer() {
92
+ var _this$core, _this$request;
93
+ var server = (_this$core = this.core) === null || _this$core === void 0 ? void 0 : _this$core.server;
94
+ if (!server || typeof server.hasRoute !== 'function') return false;
95
+ var requestBaseUrl = String(((_this$request = this.request) === null || _this$request === void 0 ? void 0 : _this$request.baseUrl) || '/shop').replace(/\/+$/, '');
96
+ var routePath = "".concat(requestBaseUrl, "/product/query");
97
+ return server.hasRoute('post', routePath) === true;
98
+ }
99
+
100
+ /**
101
+ * 未启用商品 OS 路由时,在客户端补做 Data Variant 解析。
102
+ * OS Server 已接管时直接信任服务端结果,确保同一批商品只评估一次。
103
+ */
104
+ }, {
105
+ key: "resolveClientDataVariants",
106
+ value: function resolveClientDataVariants(products, queryPayload, handledByOsServer) {
107
+ var _this$core2, _this$otherParams, _scheduleModule$getSc, _this$core3, _this$core4, _this$otherParams2, _strategyContext$busi;
108
+ if (handledByOsServer || products.length === 0) return products;
109
+ var evaluator = (_this$core2 = this.core) === null || _this$core2 === void 0 || (_this$core2 = _this$core2.context) === null || _this$core2 === void 0 ? void 0 : _this$core2.dataVariantEvaluator;
110
+ if (!evaluator || typeof evaluator.resolveProducts !== 'function') {
111
+ return products;
112
+ }
113
+ var strategyContext = queryPayload.strategy_context && _typeof(queryPayload.strategy_context) === 'object' ? queryPayload.strategy_context : {};
114
+ var fatherModule = String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.fatherModule) || '').trim();
115
+ var scheduleModule = (fatherModule ? this.core.getModule("".concat(fatherModule, "_schedule")) : null) || this.core.getModule('schedule');
116
+ var scheduleList = scheduleModule === null || scheduleModule === void 0 || (_scheduleModule$getSc = scheduleModule.getScheduleList) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule);
117
+ var contextScheduleList = (_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 ? void 0 : _this$core3.scheduleList;
118
+ var contextMenuList = (_this$core4 = this.core) === null || _this$core4 === void 0 || (_this$core4 = _this$core4.context) === null || _this$core4 === void 0 ? void 0 : _this$core4.menuList;
119
+ var businessData = {
120
+ products: products,
121
+ scheduleDateTime: queryPayload.schedule_datetime || queryPayload.schedule_date,
122
+ scheduleList: Array.isArray(scheduleList) ? scheduleList : Array.isArray(contextScheduleList) ? contextScheduleList : [],
123
+ menuList: Array.isArray((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.menuList) ? this.otherParams.menuList : Array.isArray(contextMenuList) ? contextMenuList : [],
124
+ customerId: queryPayload.customer_id,
125
+ channel: strategyContext.channel,
126
+ orderType: strategyContext.orderType || strategyContext.order_type,
127
+ businessCode: (_strategyContext$busi = strategyContext.business_code) !== null && _strategyContext$busi !== void 0 ? _strategyContext$busi : strategyContext.businessCode,
128
+ availableWalletIds: strategyContext.available_wallet_ids,
129
+ custom: strategyContext
130
+ };
131
+ try {
132
+ var _result = evaluator.resolveProducts(businessData);
133
+ return Array.isArray(_result === null || _result === void 0 ? void 0 : _result.products) ? _result.products : products;
134
+ } catch (error) {
135
+ console.error('[ProductList] Data Variant 客户端解析失败', error);
136
+ return products;
137
+ }
138
+ }
81
139
  }, {
82
140
  key: "storeChange",
83
141
  value: function () {
@@ -132,7 +190,8 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
132
190
  key: "loadProducts",
133
191
  value: function () {
134
192
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
135
- var _this$otherParams;
193
+ var _this$otherParams3,
194
+ _this2 = this;
136
195
  var _ref,
137
196
  _ref$category_ids,
138
197
  category_ids,
@@ -161,7 +220,10 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
161
220
  rawApplicationCode,
162
221
  mappedApplicationCode,
163
222
  queryPayload,
223
+ handledByOsServer,
224
+ callback,
164
225
  productsData,
226
+ resolvedList,
165
227
  sortedList,
166
228
  _args4 = arguments;
167
229
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
@@ -196,7 +258,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
196
258
  scan_to_order_2: 'mobile_order',
197
259
  scan_to_order_3: 'scantoorder3'
198
260
  };
199
- rawApplicationCode = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel;
261
+ rawApplicationCode = (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.channel;
200
262
  mappedApplicationCode = typeof rawApplicationCode === 'string' ? channelMap[rawApplicationCode] || rawApplicationCode : rawApplicationCode;
201
263
  queryPayload = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
202
264
  open_quotation: 1,
@@ -225,18 +287,35 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
225
287
  is_eject: 1,
226
288
  with_schedule: with_schedule,
227
289
  schedule_datetime: schedule_datetime,
228
- extension_type: extension_type
290
+ extension_type: extension_type,
291
+ strategy_context: strategy_context
229
292
  });
230
- _context4.next = 11;
293
+ handledByOsServer = this.isProductQueryHandledByOsServer();
294
+ callback = !handledByOsServer && typeof (options === null || options === void 0 ? void 0 : options.callback) === 'function' ? function (result) {
295
+ var _result$data, _options$callback2;
296
+ var callbackList = result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.list;
297
+ if (!Array.isArray(callbackList)) {
298
+ var _options$callback;
299
+ (_options$callback = options.callback) === null || _options$callback === void 0 || _options$callback.call(options, result);
300
+ return;
301
+ }
302
+ (_options$callback2 = options.callback) === null || _options$callback2 === void 0 || _options$callback2.call(options, _objectSpread(_objectSpread({}, result), {}, {
303
+ data: _objectSpread(_objectSpread({}, result.data), {}, {
304
+ list: _this2.resolveClientDataVariants(callbackList, queryPayload, false)
305
+ })
306
+ }));
307
+ } : options === null || options === void 0 ? void 0 : options.callback;
308
+ _context4.next = 13;
231
309
  return this.request.post("/product/query", queryPayload, {
232
310
  osServer: true,
233
- callback: options === null || options === void 0 ? void 0 : options.callback,
311
+ callback: callback,
234
312
  subscriberId: options === null || options === void 0 ? void 0 : options.subscriberId,
235
313
  customToast: function customToast() {}
236
314
  });
237
- case 11:
315
+ case 13:
238
316
  productsData = _context4.sent;
239
- sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
317
+ resolvedList = this.resolveClientDataVariants(productsData.data.list || [], queryPayload, handledByOsServer);
318
+ sortedList = resolvedList.slice().sort(function (a, b) {
240
319
  return Number(b.sort) - Number(a.sort);
241
320
  }); // if (sortedList.length) {
242
321
  // sortedList.forEach((n: any) => {
@@ -247,7 +326,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
247
326
  // }
248
327
  this.addProduct(sortedList);
249
328
  return _context4.abrupt("return", sortedList);
250
- case 15:
329
+ case 18:
251
330
  case "end":
252
331
  return _context4.stop();
253
332
  }
@@ -368,7 +447,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
368
447
  key: "addProduct",
369
448
  value: function () {
370
449
  var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(products) {
371
- var _this2 = this;
450
+ var _this3 = this;
372
451
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
373
452
  while (1) switch (_context9.prev = _context9.next) {
374
453
  case 0:
@@ -377,13 +456,13 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
377
456
  this.store.list = [];
378
457
  }
379
458
  products.forEach(function (n) {
380
- var index = _this2.store.list.findIndex(function (m) {
459
+ var index = _this3.store.list.findIndex(function (m) {
381
460
  return m.id === n.id;
382
461
  });
383
462
  if (index === -1) {
384
- _this2.store.list.push(n);
463
+ _this3.store.list.push(n);
385
464
  } else {
386
- _this2.store.list[index] = n;
465
+ _this3.store.list[index] = n;
387
466
  }
388
467
  });
389
468
  // 根据 sort 值做降序排序(数字越大越靠前)
@@ -30,6 +30,7 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
30
30
  taxRate?: number;
31
31
  shopDiscount?: string | number;
32
32
  channel?: string;
33
+ virtualSettlementMode?: boolean;
33
34
  }): Promise<{
34
35
  tax_title: string;
35
36
  tax_rate: number | undefined;
@@ -213,11 +213,11 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
213
213
  value: function () {
214
214
  var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
215
215
  var _this$store$surcharge, _ref;
216
- var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, channel, summaryChannel, taxConfig, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
216
+ var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, channel, _params$virtualSettle, virtualSettlementMode, summaryChannel, taxConfig, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
217
217
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
218
218
  while (1) switch (_context4.prev = _context4.next) {
219
219
  case 0:
220
- _params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount, channel = params.channel;
220
+ _params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount, channel = params.channel, _params$virtualSettle = params.virtualSettlementMode, virtualSettlementMode = _params$virtualSettle === void 0 ? false : _params$virtualSettle;
221
221
  summaryChannel = channel || this.resolveChannel();
222
222
  if (!(summaryChannel !== this.surchargeListChannel)) {
223
223
  _context4.next = 5;
@@ -255,7 +255,8 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
255
255
  surchargeList: this.store.surchargeList,
256
256
  scheduleById: scheduleById,
257
257
  isInScheduleByDate: ScheduleModule.isInScheduleByDate,
258
- shopDiscount: shopDiscount
258
+ shopDiscount: shopDiscount,
259
+ virtualSettlementMode: virtualSettlementMode
259
260
  });
260
261
  summaryWithTaxMeta = _objectSpread(_objectSpread({}, summary), {}, {
261
262
  tax_title: taxConfig.taxTitle || '',
@@ -64,5 +64,6 @@ export interface SalesSummaryModuleAPI {
64
64
  taxRate?: number;
65
65
  shopDiscount?: string | number;
66
66
  channel?: string;
67
+ virtualSettlementMode?: boolean;
67
68
  }): Promise<SalesSummaryData>;
68
69
  }
@@ -8,4 +8,5 @@ export declare function calculateSalesSummary(params: {
8
8
  scheduleById?: Record<string, any>;
9
9
  isInScheduleByDate?: any;
10
10
  shopDiscount?: string | number;
11
+ virtualSettlementMode?: boolean;
11
12
  }): SalesSummaryData;
@@ -1039,12 +1039,32 @@ export function calculateSalesSummary(params) {
1039
1039
  _params$scheduleById = params.scheduleById,
1040
1040
  scheduleById = _params$scheduleById === void 0 ? {} : _params$scheduleById,
1041
1041
  isInScheduleByDate = params.isInScheduleByDate,
1042
- shopDiscount = params.shopDiscount;
1042
+ shopDiscount = params.shopDiscount,
1043
+ _params$virtualSettle = params.virtualSettlementMode,
1044
+ virtualSettlementMode = _params$virtualSettle === void 0 ? false : _params$virtualSettle;
1043
1045
  if (!(products !== null && products !== void 0 && products.length)) return createEmptySalesSummary();
1044
1046
  var summaryProducts = products.filter(function (product) {
1045
1047
  return !isGeneratedVoucherProduct(product);
1046
1048
  });
1047
1049
  if (!summaryProducts.length) return createEmptySalesSummary();
1050
+ if (virtualSettlementMode) {
1051
+ var _productQuantity = summaryProducts.reduce(function (sum, item) {
1052
+ return sum + getSafeNum(item.num);
1053
+ }, 0);
1054
+ var _productAmount = summaryProducts.reduce(function (sum, item) {
1055
+ return sum.plus(toDecimal(item.selling_price).times(getSafeNum(item.num)));
1056
+ }, new Decimal(0));
1057
+ var amount = toFixed2(_productAmount);
1058
+ return _objectSpread(_objectSpread({}, createEmptySalesSummary()), {}, {
1059
+ product_quantity: _productQuantity,
1060
+ product_original_amount: amount,
1061
+ product_amount: amount,
1062
+ product_expect_amount: amount,
1063
+ expect_amount: amount,
1064
+ total_amount: amount,
1065
+ is_price_include_tax: isPriceIncludeTax
1066
+ });
1067
+ }
1048
1068
  var productQuantity = summaryProducts.reduce(function (sum, item) {
1049
1069
  return sum + getSafeNum(item.num);
1050
1070
  }, 0);
@@ -263,6 +263,11 @@ declare class Server {
263
263
  * 对单个商品 query 订阅者重算并推送(定时路径;不新建 schedule timer)。
264
264
  */
265
265
  private recomputeAndNotifySubscriber;
266
+ /**
267
+ * 根据餐牌 ID 获取其绑定日程中的全部时间点。
268
+ * 商品查询定时器与 schedule-time-points 路由共用此逻辑。
269
+ */
270
+ private getMenuScheduleTimePoints;
266
271
  /**
267
272
  * query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
268
273
  */
@@ -518,6 +523,10 @@ declare class Server {
518
523
  private handleOrderDraftSubmit;
519
524
  private handlePendingSyncCheckoutOrder;
520
525
  private buildPendingSyncCheckoutOrder;
526
+ /**
527
+ * Android 结账自动小票由当前设备设置控制;其它平台保持原有行为。
528
+ */
529
+ private shouldAutoPrintCheckoutReceipt;
521
530
  private shouldBuildSmallTicketData;
522
531
  private shouldPrintSyncedOrder;
523
532
  private hasPaymentStatus;