@pisell/pisellos 2.2.203 → 2.2.205

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 (44) hide show
  1. package/dist/modules/Order/index.d.ts +38 -1
  2. package/dist/modules/Order/index.js +388 -224
  3. package/dist/modules/Order/types.d.ts +2 -0
  4. package/dist/modules/Payment/index.d.ts +0 -13
  5. package/dist/modules/Payment/index.js +449 -833
  6. package/dist/plugins/request.d.ts +1 -0
  7. package/dist/server/index.d.ts +6 -0
  8. package/dist/server/index.js +730 -619
  9. package/dist/server/modules/index.d.ts +2 -0
  10. package/dist/server/modules/index.js +2 -0
  11. package/dist/server/modules/payment/index.d.ts +28 -0
  12. package/dist/server/modules/payment/index.js +305 -0
  13. package/dist/server/modules/payment/types.d.ts +9 -0
  14. package/dist/server/modules/payment/types.js +1 -0
  15. package/dist/solution/BaseSales/index.d.ts +13 -1
  16. package/dist/solution/BaseSales/index.js +132 -60
  17. package/dist/solution/BookingByStep/index.d.ts +1 -1
  18. package/dist/solution/BookingTicket/index.js +1 -1
  19. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +51 -52
  20. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  21. package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
  22. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  23. package/lib/modules/Order/index.d.ts +38 -1
  24. package/lib/modules/Order/index.js +94 -19
  25. package/lib/modules/Order/types.d.ts +2 -0
  26. package/lib/modules/Payment/index.d.ts +0 -13
  27. package/lib/modules/Payment/index.js +6 -149
  28. package/lib/plugins/request.d.ts +1 -0
  29. package/lib/server/index.d.ts +6 -0
  30. package/lib/server/index.js +46 -0
  31. package/lib/server/modules/index.d.ts +2 -0
  32. package/lib/server/modules/index.js +3 -0
  33. package/lib/server/modules/payment/index.d.ts +28 -0
  34. package/lib/server/modules/payment/index.js +192 -0
  35. package/lib/server/modules/payment/types.d.ts +9 -0
  36. package/lib/server/modules/payment/types.js +17 -0
  37. package/lib/solution/BaseSales/index.d.ts +13 -1
  38. package/lib/solution/BaseSales/index.js +62 -9
  39. package/lib/solution/BookingByStep/index.d.ts +1 -1
  40. package/lib/solution/BookingTicket/index.js +1 -1
  41. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -2
  42. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  43. package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
  44. package/package.json +1 -1
@@ -6,11 +6,11 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
6
6
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
7
  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; }
8
8
  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); }
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; }
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; }
11
9
  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; }
12
10
  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); } }
13
11
  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); }); }; }
12
+ 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; }
13
+ 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; }
14
14
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
15
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
16
16
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -91,6 +91,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
91
91
  _defineProperty(_assertThisInitialized(_this), "currentSalesDetail", null);
92
92
  _defineProperty(_assertThisInitialized(_this), "discountConfigCacheKey", null);
93
93
  _defineProperty(_assertThisInitialized(_this), "hasManualDiscountSelection", false);
94
+ _defineProperty(_assertThisInitialized(_this), "paymentMethodsCache", []);
94
95
  return _this;
95
96
  }
96
97
 
@@ -151,6 +152,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
151
152
  });
152
153
  }
153
154
  }
155
+ }, {
156
+ key: "hydrateOrderPaymentNames",
157
+ value: function hydrateOrderPaymentNames(payments) {
158
+ if (!payments.length) return [];
159
+ if (!this.paymentMethodsCache.length) {
160
+ return payments.map(function (payment) {
161
+ return _objectSpread({}, payment);
162
+ });
163
+ }
164
+ var paymentMethodById = new Map();
165
+ var paymentMethodByCode = new Map();
166
+ this.paymentMethodsCache.forEach(function (method) {
167
+ if ((method === null || method === void 0 ? void 0 : method.id) !== undefined && (method === null || method === void 0 ? void 0 : method.id) !== null) {
168
+ paymentMethodById.set(String(method.id), method);
169
+ }
170
+ if (method !== null && method !== void 0 && method.code) {
171
+ paymentMethodByCode.set(String(method.code), method);
172
+ }
173
+ });
174
+ return payments.map(function (payment) {
175
+ var nextPayment = _objectSpread({}, payment);
176
+ if (nextPayment.name) return nextPayment;
177
+ var paymentMethod = paymentMethodById.get(String(nextPayment.custom_payment_id)) || paymentMethodByCode.get(String(nextPayment.code));
178
+ if (!(paymentMethod !== null && paymentMethod !== void 0 && paymentMethod.name)) return nextPayment;
179
+ return _objectSpread(_objectSpread({}, nextPayment), {}, {
180
+ name: paymentMethod.name
181
+ });
182
+ });
183
+ }
154
184
  }, {
155
185
  key: "payment",
156
186
  get: function get() {
@@ -566,8 +596,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
566
596
  if (this.store.order && typeof ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.enableTempOrderPersist) === 'boolean') {
567
597
  this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
568
598
  }
599
+ _context3.next = 21;
600
+ return this.getPaymentMethodsAsync();
601
+ case 21:
569
602
  this.core.effects.emit("".concat(this.name, ":onInited"), {});
570
- case 20:
603
+ case 22:
571
604
  case "end":
572
605
  return _context3.stop();
573
606
  }
@@ -1836,9 +1869,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1836
1869
  } : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
1837
1870
  enhancePayload: params.enhancePayload
1838
1871
  } : {});
1839
- console.log(submitParams, 'submitParams123');
1840
1872
  return _context18.abrupt("return", this.store.order.submitTempOrder(submitParams));
1841
- case 7:
1873
+ case 6:
1842
1874
  case "end":
1843
1875
  return _context18.stop();
1844
1876
  }
@@ -1945,7 +1977,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1945
1977
  key: "getOrderPayments",
1946
1978
  value: function getOrderPayments() {
1947
1979
  if (!this.store.order) return [];
1948
- return this.store.order.getOrderPayments();
1980
+ var payments = this.store.order.getOrderPayments();
1981
+ return this.hydrateOrderPaymentNames(payments);
1949
1982
  }
1950
1983
 
1951
1984
  /** 覆盖当前订单支付项,内部由 OrderModule 清洗为 Sales 协议字段。 */
@@ -2183,32 +2216,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2183
2216
  key: "getPaymentMethodsAsync",
2184
2217
  value: (function () {
2185
2218
  var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2186
- var response;
2219
+ var response, paymentMethods;
2187
2220
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2188
2221
  while (1) switch (_context21.prev = _context21.next) {
2189
2222
  case 0:
2190
- if (!this.store.payment) {
2191
- _context21.next = 2;
2192
- break;
2193
- }
2194
- return _context21.abrupt("return", this.store.payment.getPayMethodListAsync());
2195
- case 2:
2196
- _context21.next = 4;
2197
- return this.request.get('/pay/custom-payment/all');
2198
- case 4:
2223
+ _context21.prev = 0;
2224
+ _context21.next = 3;
2225
+ return this.request.get('/pay/custom-payment/all', {
2226
+ filterPaymentMethods: true
2227
+ }, {
2228
+ osServer: true
2229
+ });
2230
+ case 3:
2199
2231
  response = _context21.sent;
2200
- return _context21.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
2201
- case 6:
2232
+ paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
2233
+ this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
2234
+ return _context21.abrupt("return", this.getPaymentMethods());
2235
+ case 9:
2236
+ _context21.prev = 9;
2237
+ _context21.t0 = _context21["catch"](0);
2238
+ this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
2239
+ error: _context21.t0 instanceof Error ? _context21.t0.message : String(_context21.t0)
2240
+ });
2241
+ return _context21.abrupt("return", this.getPaymentMethods());
2242
+ case 13:
2202
2243
  case "end":
2203
2244
  return _context21.stop();
2204
2245
  }
2205
- }, _callee21, this);
2246
+ }, _callee21, this, [[0, 9]]);
2206
2247
  }));
2207
2248
  function getPaymentMethodsAsync() {
2208
2249
  return _getPaymentMethodsAsync.apply(this, arguments);
2209
2250
  }
2210
2251
  return getPaymentMethodsAsync;
2211
- }() /** 轻量舍入能力,供现金支付 UI 计算 rounding_amount。 */)
2252
+ }() /** 同步读取初始化时缓存的支付方式列表。 */)
2253
+ }, {
2254
+ key: "getPaymentMethods",
2255
+ value: function getPaymentMethods() {
2256
+ return _toConsumableArray(this.paymentMethodsCache);
2257
+ }
2258
+
2259
+ /** 轻量舍入能力,供现金支付 UI 计算 rounding_amount。 */
2212
2260
  }, {
2213
2261
  key: "roundAmount",
2214
2262
  value: function roundAmount(params) {
@@ -2497,12 +2545,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2497
2545
  return _setOrderProductLineNote.apply(this, arguments);
2498
2546
  }
2499
2547
  return setOrderProductLineNote;
2500
- }())
2548
+ }()
2549
+ /**
2550
+ * 批量删除购物车行,末尾仅一次促销重算。
2551
+ *
2552
+ * @example
2553
+ * await baseSales.removeProductsFromOrder([identityA, identityB]);
2554
+ */
2555
+ )
2501
2556
  }, {
2502
- key: "removeProductFromOrder",
2503
- value: function () {
2504
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
2505
- var products;
2557
+ key: "removeProductsFromOrder",
2558
+ value: (function () {
2559
+ var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identities) {
2506
2560
  return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2507
2561
  while (1) switch (_context28.prev = _context28.next) {
2508
2562
  case 0:
@@ -2514,21 +2568,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2514
2568
  throw new Error('order 模块未初始化');
2515
2569
  case 3:
2516
2570
  _context28.next = 5;
2517
- return this.store.order.removeProductFromOrder(identity);
2571
+ return this.store.order.removeProductsFromOrder(identities);
2518
2572
  case 5:
2519
- products = _context28.sent;
2520
- return _context28.abrupt("return", products);
2521
- case 9:
2522
- _context28.prev = 9;
2573
+ return _context28.abrupt("return", _context28.sent);
2574
+ case 8:
2575
+ _context28.prev = 8;
2523
2576
  _context28.t0 = _context28["catch"](0);
2524
2577
  throw _context28.t0;
2525
- case 12:
2578
+ case 11:
2526
2579
  case "end":
2527
2580
  return _context28.stop();
2528
2581
  }
2529
- }, _callee28, this, [[0, 9]]);
2582
+ }, _callee28, this, [[0, 8]]);
2530
2583
  }));
2531
- function removeProductFromOrder(_x25) {
2584
+ function removeProductsFromOrder(_x25) {
2585
+ return _removeProductsFromOrder.apply(this, arguments);
2586
+ }
2587
+ return removeProductsFromOrder;
2588
+ }())
2589
+ }, {
2590
+ key: "removeProductFromOrder",
2591
+ value: function () {
2592
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(identity) {
2593
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2594
+ while (1) switch (_context29.prev = _context29.next) {
2595
+ case 0:
2596
+ return _context29.abrupt("return", this.removeProductsFromOrder([identity]));
2597
+ case 1:
2598
+ case "end":
2599
+ return _context29.stop();
2600
+ }
2601
+ }, _callee29, this);
2602
+ }));
2603
+ function removeProductFromOrder(_x26) {
2532
2604
  return _removeProductFromOrder.apply(this, arguments);
2533
2605
  }
2534
2606
  return removeProductFromOrder;
@@ -2578,23 +2650,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2578
2650
  }, {
2579
2651
  key: "applyPromotion",
2580
2652
  value: (function () {
2581
- var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2582
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2583
- while (1) switch (_context29.prev = _context29.next) {
2653
+ var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2654
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2655
+ while (1) switch (_context30.prev = _context30.next) {
2584
2656
  case 0:
2585
2657
  if (this.store.order) {
2586
- _context29.next = 2;
2658
+ _context30.next = 2;
2587
2659
  break;
2588
2660
  }
2589
2661
  throw new Error('order 模块未初始化');
2590
2662
  case 2:
2591
- _context29.next = 4;
2663
+ _context30.next = 4;
2592
2664
  return this.store.order.applyPromotion();
2593
2665
  case 4:
2594
2666
  case "end":
2595
- return _context29.stop();
2667
+ return _context30.stop();
2596
2668
  }
2597
- }, _callee29, this);
2669
+ }, _callee30, this);
2598
2670
  }));
2599
2671
  function applyPromotion() {
2600
2672
  return _applyPromotion.apply(this, arguments);
@@ -2621,18 +2693,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2621
2693
  }, {
2622
2694
  key: "getProductList",
2623
2695
  value: function () {
2624
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2696
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2625
2697
  var _this$otherParams13;
2626
2698
  var menu_list_ids, _this$store$products, res;
2627
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2628
- while (1) switch (_context30.prev = _context30.next) {
2699
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2700
+ while (1) switch (_context31.prev = _context31.next) {
2629
2701
  case 0:
2630
2702
  // 可以直接通过配置里的 menu 读取
2631
2703
  menu_list_ids = ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.dineInConfig) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13['menu.associated_menus'].map(function (n) {
2632
2704
  return Number(n.value);
2633
2705
  })) || [];
2634
- _context30.prev = 1;
2635
- _context30.next = 4;
2706
+ _context31.prev = 1;
2707
+ _context31.next = 4;
2636
2708
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
2637
2709
  menu_list_ids: menu_list_ids,
2638
2710
  cacheId: this.cacheId,
@@ -2640,17 +2712,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2640
2712
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
2641
2713
  });
2642
2714
  case 4:
2643
- res = _context30.sent;
2644
- return _context30.abrupt("return", res);
2715
+ res = _context31.sent;
2716
+ return _context31.abrupt("return", res);
2645
2717
  case 8:
2646
- _context30.prev = 8;
2647
- _context30.t0 = _context30["catch"](1);
2648
- throw _context30.t0;
2718
+ _context31.prev = 8;
2719
+ _context31.t0 = _context31["catch"](1);
2720
+ throw _context31.t0;
2649
2721
  case 11:
2650
2722
  case "end":
2651
- return _context30.stop();
2723
+ return _context31.stop();
2652
2724
  }
2653
- }, _callee30, this, [[1, 8]]);
2725
+ }, _callee31, this, [[1, 8]]);
2654
2726
  }));
2655
2727
  function getProductList() {
2656
2728
  return _getProductList.apply(this, arguments);
@@ -2665,15 +2737,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2665
2737
  }, {
2666
2738
  key: "setOtherParams",
2667
2739
  value: function () {
2668
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
2740
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
2669
2741
  var _ref14,
2670
2742
  _ref14$cover,
2671
2743
  cover,
2672
- _args31 = arguments;
2673
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2674
- while (1) switch (_context31.prev = _context31.next) {
2744
+ _args32 = arguments;
2745
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2746
+ while (1) switch (_context32.prev = _context32.next) {
2675
2747
  case 0:
2676
- _ref14 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref14$cover = _ref14.cover, cover = _ref14$cover === void 0 ? false : _ref14$cover;
2748
+ _ref14 = _args32.length > 1 && _args32[1] !== undefined ? _args32[1] : {}, _ref14$cover = _ref14.cover, cover = _ref14$cover === void 0 ? false : _ref14$cover;
2677
2749
  if (cover) {
2678
2750
  this.otherParams = params;
2679
2751
  } else {
@@ -2681,11 +2753,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2681
2753
  }
2682
2754
  case 2:
2683
2755
  case "end":
2684
- return _context31.stop();
2756
+ return _context32.stop();
2685
2757
  }
2686
- }, _callee31, this);
2758
+ }, _callee32, this);
2687
2759
  }));
2688
- function setOtherParams(_x26) {
2760
+ function setOtherParams(_x27) {
2689
2761
  return _setOtherParams.apply(this, arguments);
2690
2762
  }
2691
2763
  return setOtherParams;
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 6 | 3 | 4 | 5;
314
+ weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -119,7 +119,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
119
119
  while (1) switch (_context.prev = _context.next) {
120
120
  case 0:
121
121
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
122
- this.scan = new Scan(this, 'BOOKING_TICKET_SCAN');
122
+ this.scan = new Scan(this, "BOOKING_TICKET_SCAN:".concat(this.name));
123
123
  _context.next = 4;
124
124
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "initialize", this).call(this, core, options);
125
125
  case 4:
@@ -192,18 +192,17 @@ export function applyGlobalScan(_x14, _x15, _x16) {
192
192
  }
193
193
  function _applyGlobalScan() {
194
194
  _applyGlobalScan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(host, formatted, bridge) {
195
- var searchType, data, scanCode, _bridge$onNotify2, _bridge$onNotify, _bridge$onNotify4, _bridge$onNotify3, snapshot, result, list, _bridge$onNotify5, addedCount, _iterator, _step, _item, outcome, _bridge$onNotify6, _data$order_id, orderId, _bridge$onNotify7;
195
+ var searchType, data, scanCode, _bridge$onNotify2, _bridge$onNotify, _bridge$onNotify4, _bridge$onNotify3, snapshot, result, list, _bridge$onNotify5, addedCount, _iterator, _step, _item, outcome, _bridge$onNotify6, _data$order_id, _data$business_code, orderId, _bridge$onNotify7;
196
196
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
197
197
  while (1) switch (_context4.prev = _context4.next) {
198
198
  case 0:
199
199
  searchType = formatted.searchType, data = formatted.data, scanCode = formatted.scanCode;
200
- debugger;
201
200
  if (!(searchType === 'wallet')) {
202
- _context4.next = 9;
201
+ _context4.next = 8;
203
202
  break;
204
203
  }
205
204
  if (data) {
206
- _context4.next = 6;
205
+ _context4.next = 5;
207
206
  break;
208
207
  }
209
208
  bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
@@ -211,20 +210,20 @@ function _applyGlobalScan() {
211
210
  status: 'failed',
212
211
  reason: 'invalid_data'
213
212
  });
214
- case 6:
213
+ case 5:
215
214
  host.setOrderCustomer(data);
216
215
  bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'success', 'pisell2.text.add-client-success');
217
216
  return _context4.abrupt("return", {
218
217
  status: 'success',
219
218
  kind: 'customer'
220
219
  });
221
- case 9:
220
+ case 8:
222
221
  if (!(searchType === 'walletPass')) {
223
- _context4.next = 26;
222
+ _context4.next = 25;
224
223
  break;
225
224
  }
226
225
  if (data) {
227
- _context4.next = 13;
226
+ _context4.next = 12;
228
227
  break;
229
228
  }
230
229
  bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
@@ -232,53 +231,53 @@ function _applyGlobalScan() {
232
231
  status: 'failed',
233
232
  reason: 'invalid_data'
234
233
  });
235
- case 13:
234
+ case 12:
236
235
  snapshot = host.getOrderCustomerSnapshot();
237
236
  if (!isWalkInCustomer(snapshot)) {
238
- _context4.next = 23;
237
+ _context4.next = 22;
239
238
  break;
240
239
  }
241
240
  if (bridge !== null && bridge !== void 0 && bridge.applyPromotionCode) {
242
- _context4.next = 17;
241
+ _context4.next = 16;
243
242
  break;
244
243
  }
245
244
  return _context4.abrupt("return", {
246
245
  status: 'failed',
247
246
  reason: 'no_bridge'
248
247
  });
249
- case 17:
250
- _context4.next = 19;
248
+ case 16:
249
+ _context4.next = 18;
251
250
  return bridge.applyPromotionCode(scanCode);
252
- case 19:
251
+ case 18:
253
252
  result = _context4.sent;
254
253
  if (!(result !== null && result !== void 0 && result.isAvailable)) {
255
- _context4.next = 22;
254
+ _context4.next = 21;
256
255
  break;
257
256
  }
258
257
  return _context4.abrupt("return", {
259
258
  status: 'success',
260
259
  kind: 'promotion'
261
260
  });
262
- case 22:
261
+ case 21:
263
262
  return _context4.abrupt("return", {
264
263
  status: 'failed',
265
264
  reason: 'invalid_data'
266
265
  });
267
- case 23:
266
+ case 22:
268
267
  host.setOrderCustomer(data);
269
268
  bridge === null || bridge === void 0 || (_bridge$onNotify4 = bridge.onNotify) === null || _bridge$onNotify4 === void 0 || _bridge$onNotify4.call(bridge, 'success', 'pisell2.text.add-client-success');
270
269
  return _context4.abrupt("return", {
271
270
  status: 'success',
272
271
  kind: 'customer'
273
272
  });
274
- case 26:
273
+ case 25:
275
274
  if (!(searchType === 'product' || searchType === 'local_product')) {
276
- _context4.next = 59;
275
+ _context4.next = 58;
277
276
  break;
278
277
  }
279
278
  list = data === null || data === void 0 ? void 0 : data.list;
280
279
  if (!(!Array.isArray(list) || list.length === 0)) {
281
- _context4.next = 31;
280
+ _context4.next = 30;
282
281
  break;
283
282
  }
284
283
  bridge === null || bridge === void 0 || (_bridge$onNotify5 = bridge.onNotify) === null || _bridge$onNotify5 === void 0 || _bridge$onNotify5.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
@@ -286,57 +285,57 @@ function _applyGlobalScan() {
286
285
  status: 'failed',
287
286
  reason: 'invalid_data'
288
287
  });
289
- case 31:
288
+ case 30:
290
289
  addedCount = 0;
291
290
  _iterator = _createForOfIteratorHelper(list);
292
- _context4.prev = 33;
291
+ _context4.prev = 32;
293
292
  _iterator.s();
294
- case 35:
293
+ case 34:
295
294
  if ((_step = _iterator.n()).done) {
296
- _context4.next = 47;
295
+ _context4.next = 46;
297
296
  break;
298
297
  }
299
298
  _item = _step.value;
300
- _context4.next = 39;
299
+ _context4.next = 38;
301
300
  return processScannedProductItem(host, _item, scanCode, bridge);
302
- case 39:
301
+ case 38:
303
302
  outcome = _context4.sent;
304
303
  if (outcome === 'added') {
305
304
  addedCount += 1;
306
305
  }
307
306
  if (!(outcome === 'cancelled')) {
308
- _context4.next = 43;
307
+ _context4.next = 42;
309
308
  break;
310
309
  }
311
310
  return _context4.abrupt("return", {
312
311
  status: 'cancelled'
313
312
  });
314
- case 43:
313
+ case 42:
315
314
  if (!(outcome === 'pending')) {
316
- _context4.next = 45;
315
+ _context4.next = 44;
317
316
  break;
318
317
  }
319
318
  return _context4.abrupt("return", {
320
319
  status: 'pending',
321
320
  kind: 'requiresDetail'
322
321
  });
323
- case 45:
324
- _context4.next = 35;
322
+ case 44:
323
+ _context4.next = 34;
325
324
  break;
326
- case 47:
327
- _context4.next = 52;
325
+ case 46:
326
+ _context4.next = 51;
328
327
  break;
329
- case 49:
330
- _context4.prev = 49;
331
- _context4.t0 = _context4["catch"](33);
328
+ case 48:
329
+ _context4.prev = 48;
330
+ _context4.t0 = _context4["catch"](32);
332
331
  _iterator.e(_context4.t0);
333
- case 52:
334
- _context4.prev = 52;
332
+ case 51:
333
+ _context4.prev = 51;
335
334
  _iterator.f();
336
- return _context4.finish(52);
337
- case 55:
335
+ return _context4.finish(51);
336
+ case 54:
338
337
  if (!(addedCount > 0)) {
339
- _context4.next = 58;
338
+ _context4.next = 57;
340
339
  break;
341
340
  }
342
341
  bridge === null || bridge === void 0 || (_bridge$onNotify6 = bridge.onNotify) === null || _bridge$onNotify6 === void 0 || _bridge$onNotify6.call(bridge, 'success');
@@ -347,19 +346,19 @@ function _applyGlobalScan() {
347
346
  count: addedCount
348
347
  }
349
348
  });
350
- case 58:
349
+ case 57:
351
350
  return _context4.abrupt("return", {
352
351
  status: 'failed',
353
352
  reason: 'no_bridge'
354
353
  });
355
- case 59:
354
+ case 58:
356
355
  if (!(searchType === 'order')) {
357
- _context4.next = 68;
356
+ _context4.next = 67;
358
357
  break;
359
358
  }
360
359
  orderId = (_data$order_id = data === null || data === void 0 ? void 0 : data.order_id) !== null && _data$order_id !== void 0 ? _data$order_id : data === null || data === void 0 ? void 0 : data.id;
361
360
  if (orderId) {
362
- _context4.next = 64;
361
+ _context4.next = 63;
363
362
  break;
364
363
  }
365
364
  bridge === null || bridge === void 0 || (_bridge$onNotify7 = bridge.onNotify) === null || _bridge$onNotify7 === void 0 || _bridge$onNotify7.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
@@ -367,34 +366,34 @@ function _applyGlobalScan() {
367
366
  status: 'failed',
368
367
  reason: 'invalid_data'
369
368
  });
370
- case 64:
369
+ case 63:
371
370
  if (bridge !== null && bridge !== void 0 && bridge.openOrder) {
372
- _context4.next = 66;
371
+ _context4.next = 65;
373
372
  break;
374
373
  }
375
374
  return _context4.abrupt("return", {
376
375
  status: 'pending',
377
376
  kind: 'openOrder'
378
377
  });
379
- case 66:
378
+ case 65:
380
379
  bridge.openOrder({
381
380
  order_id: Number(orderId),
382
- business_code: host.getBusinessCode()
381
+ business_code: (_data$business_code = data === null || data === void 0 ? void 0 : data.business_code) !== null && _data$business_code !== void 0 ? _data$business_code : host.getBusinessCode()
383
382
  });
384
383
  return _context4.abrupt("return", {
385
384
  status: 'pending',
386
385
  kind: 'openOrder'
387
386
  });
388
- case 68:
387
+ case 67:
389
388
  return _context4.abrupt("return", {
390
389
  status: 'failed',
391
390
  reason: 'invalid_data'
392
391
  });
393
- case 69:
392
+ case 68:
394
393
  case "end":
395
394
  return _context4.stop();
396
395
  }
397
- }, _callee4, null, [[33, 49, 52, 55]]);
396
+ }, _callee4, null, [[32, 48, 51, 54]]);
398
397
  }));
399
398
  return _applyGlobalScan.apply(this, arguments);
400
399
  }
@@ -14,12 +14,17 @@ declare enum ScanResultType {
14
14
  NativeScanner = "nativeScanner"
15
15
  }
16
16
  export default class Scan {
17
+ private static scanInstances;
18
+ private static peripheralsListenerMounted;
17
19
  private solution;
18
20
  private watchKey;
19
21
  private listenerConfig;
20
22
  constructor(solution: BookingTicketImpl, watchKey: string);
21
23
  /**
22
24
  * 初始化外设扫码结果监听
25
+ *
26
+ * @example
27
+ * scan.initPeripheralsListener();
23
28
  */
24
29
  initPeripheralsListener(): void;
25
30
  /**