@pisell/pisellos 2.2.229 → 2.2.231

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/Order/index.d.ts +1 -0
  3. package/dist/modules/Order/index.js +82 -54
  4. package/dist/modules/Order/types.d.ts +14 -2
  5. package/dist/modules/Order/types.js +8 -1
  6. package/dist/modules/ProductList/index.d.ts +9 -12
  7. package/dist/modules/ProductList/index.js +122 -59
  8. package/dist/modules/ProductList/types.d.ts +14 -0
  9. package/dist/server/index.d.ts +21 -0
  10. package/dist/server/index.js +181 -47
  11. package/dist/server/utils/small-ticket.js +113 -29
  12. package/dist/solution/BookingByStep/index.d.ts +1 -1
  13. package/dist/solution/BookingTicket/index.d.ts +8 -0
  14. package/dist/solution/BookingTicket/index.js +191 -154
  15. package/dist/solution/BookingTicket/types.d.ts +4 -0
  16. package/dist/solution/BookingTicket/utils/cartView.js +20 -6
  17. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +189 -0
  18. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +429 -0
  19. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  20. package/lib/modules/Order/index.d.ts +1 -0
  21. package/lib/modules/Order/index.js +30 -6
  22. package/lib/modules/Order/types.d.ts +14 -2
  23. package/lib/modules/ProductList/index.d.ts +9 -12
  24. package/lib/modules/ProductList/index.js +32 -4
  25. package/lib/modules/ProductList/types.d.ts +14 -0
  26. package/lib/server/index.d.ts +21 -0
  27. package/lib/server/index.js +118 -9
  28. package/lib/server/utils/small-ticket.js +78 -1
  29. package/lib/solution/BookingByStep/index.d.ts +1 -1
  30. package/lib/solution/BookingTicket/index.d.ts +8 -0
  31. package/lib/solution/BookingTicket/index.js +16 -0
  32. package/lib/solution/BookingTicket/types.d.ts +4 -0
  33. package/lib/solution/BookingTicket/utils/cartView.js +14 -7
  34. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +189 -0
  35. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +241 -0
  36. package/package.json +1 -1
@@ -1,4 +1,6 @@
1
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
+ 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
+ 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; }
2
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; }
3
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); } }
4
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); }); }; }
@@ -17,6 +19,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
17
19
  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
20
  import { BaseModule } from "../BaseModule";
19
21
  import { cloneDeep } from 'lodash-es';
22
+ import dayjs from 'dayjs';
20
23
  export * from "./types";
21
24
  export var ProductList = /*#__PURE__*/function (_BaseModule) {
22
25
  _inherits(ProductList, _BaseModule);
@@ -92,16 +95,75 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
92
95
  }
93
96
  return storeChange;
94
97
  }()
98
+ /**
99
+ * 获取加时商品列表。
100
+ *
101
+ * @example
102
+ * const products = await productList.getAddTimeProducts({ schedule_date: '2026-06-16' });
103
+ */
104
+ }, {
105
+ key: "getAddTimeProducts",
106
+ value: (function () {
107
+ var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
108
+ var params,
109
+ _args3 = arguments;
110
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
111
+ while (1) switch (_context3.prev = _context3.next) {
112
+ case 0:
113
+ params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
114
+ return _context3.abrupt("return", this.loadProducts(_objectSpread(_objectSpread({
115
+ schedule_date: dayjs().format('YYYY-MM-DD'),
116
+ status: 'published'
117
+ }, params), {}, {
118
+ extension_type: ['product_add_time']
119
+ })));
120
+ case 2:
121
+ case "end":
122
+ return _context3.stop();
123
+ }
124
+ }, _callee3, this);
125
+ }));
126
+ function getAddTimeProducts() {
127
+ return _getAddTimeProducts.apply(this, arguments);
128
+ }
129
+ return getAddTimeProducts;
130
+ }())
95
131
  }, {
96
132
  key: "loadProducts",
97
133
  value: function () {
98
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref, options) {
134
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
99
135
  var _this$otherParams;
100
- var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$menu_list_ids, menu_list_ids, paramsCustomerId, _ref$with_count, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, userPlugin, customer_id, _userPlugin$get, productsData, sortedList;
101
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
102
- while (1) switch (_context3.prev = _context3.next) {
136
+ var _ref,
137
+ _ref$category_ids,
138
+ category_ids,
139
+ _ref$product_ids,
140
+ product_ids,
141
+ _ref$collection,
142
+ collection,
143
+ _ref$menu_list_ids,
144
+ menu_list_ids,
145
+ paramsCustomerId,
146
+ _ref$with_count,
147
+ with_count,
148
+ schedule_datetime,
149
+ schedule_date,
150
+ cacheId,
151
+ with_schedule,
152
+ extension_type,
153
+ _ref$status,
154
+ status,
155
+ options,
156
+ userPlugin,
157
+ customer_id,
158
+ _userPlugin$get,
159
+ productsData,
160
+ sortedList,
161
+ _args4 = arguments;
162
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
163
+ while (1) switch (_context4.prev = _context4.next) {
103
164
  case 0:
104
- _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule;
165
+ _ref = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule, extension_type = _ref.extension_type, _ref$status = _ref.status, status = _ref$status === void 0 ? 'published' : _ref$status;
166
+ options = _args4.length > 1 ? _args4[1] : undefined;
105
167
  // // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
106
168
  // if (!schedule_ids?.length) {
107
169
  // const schedule_ids_data = this.store.schedule
@@ -122,13 +184,13 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
122
184
  console.error(error);
123
185
  }
124
186
  // 如果没传schedule_date,则从
125
- _context3.next = 6;
187
+ _context4.next = 7;
126
188
  return this.request.post("/product/query", {
127
189
  open_quotation: 1,
128
190
  open_bundle: 0,
129
191
  exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
130
192
  with: ['category', 'collection', 'resourceRelation'],
131
- status: 'published',
193
+ status: status,
132
194
  num: 500,
133
195
  skip: 1,
134
196
  customer_id: customer_id,
@@ -143,15 +205,16 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
143
205
  application_code: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel,
144
206
  is_eject: 1,
145
207
  with_schedule: with_schedule,
146
- schedule_datetime: schedule_datetime
208
+ schedule_datetime: schedule_datetime,
209
+ extension_type: extension_type
147
210
  }, {
148
211
  osServer: true,
149
212
  callback: options === null || options === void 0 ? void 0 : options.callback,
150
213
  subscriberId: options === null || options === void 0 ? void 0 : options.subscriberId,
151
214
  customToast: function customToast() {}
152
215
  });
153
- case 6:
154
- productsData = _context3.sent;
216
+ case 7:
217
+ productsData = _context4.sent;
155
218
  sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
156
219
  return Number(b.sort) - Number(a.sort);
157
220
  }); // if (sortedList.length) {
@@ -162,14 +225,14 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
162
225
  // })
163
226
  // }
164
227
  this.addProduct(sortedList);
165
- return _context3.abrupt("return", sortedList);
166
- case 10:
228
+ return _context4.abrupt("return", sortedList);
229
+ case 11:
167
230
  case "end":
168
- return _context3.stop();
231
+ return _context4.stop();
169
232
  }
170
- }, _callee3, this);
233
+ }, _callee4, this);
171
234
  }));
172
- function loadProducts(_x5, _x6) {
235
+ function loadProducts() {
173
236
  return _loadProducts.apply(this, arguments);
174
237
  }
175
238
  return loadProducts;
@@ -177,13 +240,13 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
177
240
  }, {
178
241
  key: "loadProductsPrice",
179
242
  value: function () {
180
- var _loadProductsPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref2) {
243
+ var _loadProductsPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref2) {
181
244
  var _ref2$ids, ids, customer_id, schedule_date, channel, productsData;
182
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
183
- while (1) switch (_context4.prev = _context4.next) {
245
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
246
+ while (1) switch (_context5.prev = _context5.next) {
184
247
  case 0:
185
248
  _ref2$ids = _ref2.ids, ids = _ref2$ids === void 0 ? [] : _ref2$ids, customer_id = _ref2.customer_id, schedule_date = _ref2.schedule_date, channel = _ref2.channel;
186
- _context4.next = 3;
249
+ _context5.next = 3;
187
250
  return this.request.post("/product/query/price", {
188
251
  ids: ids,
189
252
  customer_id: customer_id,
@@ -193,15 +256,15 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
193
256
  useCache: true
194
257
  });
195
258
  case 3:
196
- productsData = _context4.sent;
197
- return _context4.abrupt("return", productsData.data);
259
+ productsData = _context5.sent;
260
+ return _context5.abrupt("return", productsData.data);
198
261
  case 5:
199
262
  case "end":
200
- return _context4.stop();
263
+ return _context5.stop();
201
264
  }
202
- }, _callee4, this);
265
+ }, _callee5, this);
203
266
  }));
204
- function loadProductsPrice(_x7) {
267
+ function loadProductsPrice(_x5) {
205
268
  return _loadProductsPrice.apply(this, arguments);
206
269
  }
207
270
  return loadProductsPrice;
@@ -209,19 +272,19 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
209
272
  }, {
210
273
  key: "getProducts",
211
274
  value: function () {
212
- var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
213
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
214
- while (1) switch (_context5.prev = _context5.next) {
275
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
276
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
277
+ while (1) switch (_context6.prev = _context6.next) {
215
278
  case 0:
216
- _context5.next = 2;
279
+ _context6.next = 2;
217
280
  return this.core.effects.emit("".concat(this.name, ":onGetProducts"), this.store.list);
218
281
  case 2:
219
- return _context5.abrupt("return", cloneDeep(this.store.list));
282
+ return _context6.abrupt("return", cloneDeep(this.store.list));
220
283
  case 3:
221
284
  case "end":
222
- return _context5.stop();
285
+ return _context6.stop();
223
286
  }
224
- }, _callee5, this);
287
+ }, _callee6, this);
225
288
  }));
226
289
  function getProducts() {
227
290
  return _getProducts.apply(this, arguments);
@@ -231,25 +294,25 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
231
294
  }, {
232
295
  key: "getProduct",
233
296
  value: function () {
234
- var _getProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(id) {
297
+ var _getProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(id) {
235
298
  var product;
236
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
237
- while (1) switch (_context6.prev = _context6.next) {
299
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
300
+ while (1) switch (_context7.prev = _context7.next) {
238
301
  case 0:
239
- _context6.next = 2;
302
+ _context7.next = 2;
240
303
  return this.core.effects.emit("".concat(this.name, ":onGetProduct"), this.store.list);
241
304
  case 2:
242
305
  product = this.store.list.find(function (product) {
243
306
  return product.id === id;
244
307
  });
245
- return _context6.abrupt("return", product ? cloneDeep(product) : undefined);
308
+ return _context7.abrupt("return", product ? cloneDeep(product) : undefined);
246
309
  case 4:
247
310
  case "end":
248
- return _context6.stop();
311
+ return _context7.stop();
249
312
  }
250
- }, _callee6, this);
313
+ }, _callee7, this);
251
314
  }));
252
- function getProduct(_x8) {
315
+ function getProduct(_x6) {
253
316
  return _getProduct.apply(this, arguments);
254
317
  }
255
318
  return getProduct;
@@ -257,25 +320,25 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
257
320
  }, {
258
321
  key: "getProductByIds",
259
322
  value: function () {
260
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(ids) {
323
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(ids) {
261
324
  var products;
262
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
263
- while (1) switch (_context7.prev = _context7.next) {
325
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
326
+ while (1) switch (_context8.prev = _context8.next) {
264
327
  case 0:
265
- _context7.next = 2;
328
+ _context8.next = 2;
266
329
  return this.core.effects.emit("".concat(this.name, ":onGetProductByIds"), this.store.list);
267
330
  case 2:
268
331
  products = this.store.list.filter(function (product) {
269
332
  return ids.includes(product.id);
270
333
  });
271
- return _context7.abrupt("return", products);
334
+ return _context8.abrupt("return", products);
272
335
  case 4:
273
336
  case "end":
274
- return _context7.stop();
337
+ return _context8.stop();
275
338
  }
276
- }, _callee7, this);
339
+ }, _callee8, this);
277
340
  }));
278
- function getProductByIds(_x9) {
341
+ function getProductByIds(_x7) {
279
342
  return _getProductByIds.apply(this, arguments);
280
343
  }
281
344
  return getProductByIds;
@@ -283,10 +346,10 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
283
346
  }, {
284
347
  key: "addProduct",
285
348
  value: function () {
286
- var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(products) {
349
+ var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(products) {
287
350
  var _this2 = this;
288
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
289
- while (1) switch (_context8.prev = _context8.next) {
351
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
352
+ while (1) switch (_context9.prev = _context9.next) {
290
353
  case 0:
291
354
  // list 需要根据 id 去重
292
355
  if (!this.store.list) {
@@ -309,11 +372,11 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
309
372
  this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
310
373
  case 4:
311
374
  case "end":
312
- return _context8.stop();
375
+ return _context9.stop();
313
376
  }
314
- }, _callee8, this);
377
+ }, _callee9, this);
315
378
  }));
316
- function addProduct(_x10) {
379
+ function addProduct(_x8) {
317
380
  return _addProduct.apply(this, arguments);
318
381
  }
319
382
  return addProduct;
@@ -321,18 +384,18 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
321
384
  }, {
322
385
  key: "selectProducts",
323
386
  value: function () {
324
- var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(products) {
325
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
326
- while (1) switch (_context9.prev = _context9.next) {
387
+ var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(products) {
388
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
389
+ while (1) switch (_context10.prev = _context10.next) {
327
390
  case 0:
328
391
  this.store.selectProducts = products;
329
392
  case 1:
330
393
  case "end":
331
- return _context9.stop();
394
+ return _context10.stop();
332
395
  }
333
- }, _callee9, this);
396
+ }, _callee10, this);
334
397
  }));
335
- function selectProducts(_x11) {
398
+ function selectProducts(_x9) {
336
399
  return _selectProducts.apply(this, arguments);
337
400
  }
338
401
  return selectProducts;
@@ -1,4 +1,18 @@
1
1
  import { ProductData } from '../Product/types';
2
+ export interface ProductListLoadProductsParams {
3
+ category_ids?: number[];
4
+ product_ids?: number[];
5
+ collection?: number | string[];
6
+ schedule_date?: string;
7
+ cacheId?: string;
8
+ customer_id?: number;
9
+ menu_list_ids?: number[];
10
+ schedule_datetime?: string;
11
+ with_count?: string[];
12
+ with_schedule?: number;
13
+ extension_type?: string[];
14
+ status?: string;
15
+ }
2
16
  export interface ProductListData {
3
17
  list: ProductData[];
4
18
  selectProducts: ProductData[];
@@ -496,6 +496,27 @@ declare class Server {
496
496
  * 从订单中展开 bookings,再按条件筛选 + 分页
497
497
  */
498
498
  private computeBookingQueryResult;
499
+ /**
500
+ * 规范商品扩展类型过滤参数。
501
+ *
502
+ * @example
503
+ * const types = this.normalizeProductExtensionTypes(['product_add_time']);
504
+ */
505
+ private normalizeProductExtensionTypes;
506
+ /**
507
+ * 请求包含 product_add_time 时,按传入 extension_type 数组配置过滤商品。
508
+ *
509
+ * @example
510
+ * const list = this.filterProductsByExtensionTypes(products, ['product_add_time']);
511
+ */
512
+ private filterProductsByExtensionTypes;
513
+ /**
514
+ * 判断本次查询是否需要跳过餐牌过滤,直接按扩展类型拉商品。
515
+ *
516
+ * @example
517
+ * const skipMenu = this.shouldQueryProductsByExtensionTypes(['product_add_time']);
518
+ */
519
+ private shouldQueryProductsByExtensionTypes;
499
520
  /**
500
521
  * 商品查询的核心计算逻辑(编排 Products、Menu、Schedule 模块)
501
522
  * 供 handleProductQuery 首次返回及 pubsub 变更推送复用