@pisell/pisellos 2.2.147 → 2.2.149

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 (247) hide show
  1. package/dist/apis/picoding.d.ts +0 -0
  2. package/dist/apis/picoding.js +1 -0
  3. package/dist/model/strategy/adapter/index.d.ts +2 -0
  4. package/dist/model/strategy/adapter/index.js +3 -1
  5. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
  6. package/dist/model/strategy/adapter/itemRule/adapter.js +483 -0
  7. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
  8. package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
  9. package/dist/model/strategy/adapter/itemRule/examples.d.ts +79 -0
  10. package/dist/model/strategy/adapter/itemRule/examples.js +382 -0
  11. package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
  12. package/dist/model/strategy/adapter/itemRule/index.js +5 -0
  13. package/dist/model/strategy/adapter/itemRule/type.d.ts +225 -0
  14. package/dist/model/strategy/adapter/itemRule/type.js +101 -0
  15. package/dist/modules/Cart/types.d.ts +2 -0
  16. package/dist/modules/Cart/utils/cartProduct.js +22 -1
  17. package/dist/modules/Cart/utils/changePrice.js +6 -0
  18. package/dist/modules/Date/index.d.ts +1 -1
  19. package/dist/modules/Date/index.js +16 -8
  20. package/dist/modules/Date/types.d.ts +3 -1
  21. package/dist/modules/OpenData/index.d.ts +24 -0
  22. package/dist/modules/OpenData/index.js +173 -0
  23. package/dist/modules/OpenData/types.d.ts +73 -0
  24. package/dist/modules/OpenData/types.js +1 -0
  25. package/dist/modules/OpenData/utils.d.ts +2 -0
  26. package/dist/modules/OpenData/utils.js +75 -0
  27. package/dist/modules/Order/index.d.ts +171 -1
  28. package/dist/modules/Order/index.js +2052 -112
  29. package/dist/modules/Order/types.d.ts +441 -20
  30. package/dist/modules/Order/types.js +23 -0
  31. package/dist/modules/Order/utils.d.ts +120 -0
  32. package/dist/modules/Order/utils.js +653 -2
  33. package/dist/modules/Product/utils.js +2 -2
  34. package/dist/modules/ProductList/index.js +2 -1
  35. package/dist/modules/Quotation/index.d.ts +8 -1
  36. package/dist/modules/Quotation/index.js +40 -10
  37. package/dist/modules/Quotation/types.d.ts +5 -0
  38. package/dist/modules/Rules/index.d.ts +3 -1
  39. package/dist/modules/Rules/index.js +136 -50
  40. package/dist/modules/Rules/types.d.ts +6 -0
  41. package/dist/modules/Rules/types.js +8 -0
  42. package/dist/modules/SalesSummary/index.d.ts +70 -0
  43. package/dist/modules/SalesSummary/index.js +175 -0
  44. package/dist/modules/SalesSummary/types.d.ts +64 -0
  45. package/dist/modules/SalesSummary/types.js +1 -0
  46. package/dist/modules/SalesSummary/utils.d.ts +34 -0
  47. package/dist/modules/SalesSummary/utils.js +488 -0
  48. package/dist/modules/ScanOrderLogger/index.d.ts +21 -0
  49. package/dist/modules/ScanOrderLogger/index.js +161 -0
  50. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  51. package/dist/modules/ScanOrderLogger/providers/feishu.js +203 -0
  52. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  53. package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
  54. package/dist/modules/ScanOrderLogger/types.d.ts +52 -0
  55. package/dist/modules/ScanOrderLogger/types.js +1 -0
  56. package/dist/modules/Schedule/getDateIsInSchedule.js +7 -7
  57. package/dist/modules/Schedule/index.d.ts +4 -13
  58. package/dist/modules/Schedule/index.js +6 -23
  59. package/dist/modules/Schedule/utils.d.ts +1 -1
  60. package/dist/modules/Summary/index.d.ts +3 -0
  61. package/dist/modules/Summary/index.js +134 -15
  62. package/dist/modules/Summary/types.d.ts +7 -0
  63. package/dist/modules/Summary/utils.d.ts +104 -1
  64. package/dist/modules/Summary/utils.js +1116 -13
  65. package/dist/modules/index.d.ts +4 -0
  66. package/dist/modules/index.js +5 -1
  67. package/dist/server/index.d.ts +41 -4
  68. package/dist/server/index.js +900 -405
  69. package/dist/server/modules/order/index.d.ts +10 -2
  70. package/dist/server/modules/order/index.js +251 -196
  71. package/dist/server/modules/products/index.d.ts +26 -0
  72. package/dist/server/modules/products/index.js +618 -338
  73. package/dist/server/modules/products/types.d.ts +5 -1
  74. package/dist/solution/BaseSales/index.d.ts +175 -0
  75. package/dist/solution/BaseSales/index.js +1293 -0
  76. package/dist/solution/BaseSales/types.d.ts +305 -0
  77. package/dist/solution/BaseSales/types.js +38 -0
  78. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +143 -0
  79. package/dist/solution/BaseSales/utils/parseSalesResponse.js +159 -0
  80. package/dist/solution/BaseSales/utils.d.ts +40 -0
  81. package/dist/solution/BaseSales/utils.js +222 -0
  82. package/dist/solution/BookingByStep/index.d.ts +14 -0
  83. package/dist/solution/BookingByStep/index.js +699 -212
  84. package/dist/solution/BookingByStep/types.d.ts +3 -1
  85. package/dist/solution/BookingByStep/types.js +5 -1
  86. package/dist/solution/BookingByStep/utils/capacity.js +1 -1
  87. package/dist/solution/BookingByStep/utils/resources.js +6 -1
  88. package/dist/solution/BookingTicket/index.d.ts +113 -15
  89. package/dist/solution/BookingTicket/index.js +534 -196
  90. package/dist/solution/BookingTicket/types.d.ts +69 -6
  91. package/dist/solution/BookingTicket/types.js +40 -9
  92. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +37 -0
  93. package/dist/solution/BookingTicket/utils/bookingStatus.js +66 -0
  94. package/dist/solution/BookingTicket/utils/cartView.d.ts +26 -0
  95. package/dist/solution/BookingTicket/utils/cartView.js +84 -0
  96. package/dist/solution/Sales/index.d.ts +1 -0
  97. package/dist/solution/Sales/index.js +1 -0
  98. package/dist/solution/ScanOrder/index.d.ts +146 -0
  99. package/dist/solution/ScanOrder/index.js +3029 -0
  100. package/dist/solution/ScanOrder/types.d.ts +305 -0
  101. package/dist/solution/ScanOrder/types.js +35 -0
  102. package/dist/solution/ScanOrder/utils.d.ts +167 -0
  103. package/dist/solution/ScanOrder/utils.js +768 -0
  104. package/dist/solution/ShopDiscount/index.d.ts +2 -0
  105. package/dist/solution/ShopDiscount/index.js +9 -5
  106. package/dist/solution/ShopDiscount/types.d.ts +4 -0
  107. package/dist/solution/VenueBooking/index.d.ts +197 -0
  108. package/dist/solution/VenueBooking/index.js +3411 -0
  109. package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
  110. package/dist/solution/VenueBooking/types.d.ts +153 -0
  111. package/dist/solution/VenueBooking/types.js +21 -0
  112. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
  113. package/dist/solution/VenueBooking/utils/dateSummary.js +104 -0
  114. package/dist/solution/VenueBooking/utils/resource.d.ts +14 -0
  115. package/dist/solution/VenueBooking/utils/resource.js +130 -0
  116. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +34 -0
  117. package/dist/solution/VenueBooking/utils/slotMerge.js +224 -0
  118. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
  119. package/dist/solution/VenueBooking/utils/timeSlot.js +453 -0
  120. package/dist/solution/VenueBooking/utils.d.ts +1 -0
  121. package/dist/solution/VenueBooking/utils.js +1 -0
  122. package/dist/solution/index.d.ts +3 -0
  123. package/dist/solution/index.js +4 -1
  124. package/lib/apis/picoding.d.ts +0 -0
  125. package/lib/apis/picoding.js +0 -0
  126. package/lib/model/strategy/adapter/index.d.ts +2 -0
  127. package/lib/model/strategy/adapter/index.js +6 -0
  128. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
  129. package/lib/model/strategy/adapter/itemRule/adapter.js +377 -0
  130. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
  131. package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
  132. package/lib/model/strategy/adapter/itemRule/examples.d.ts +79 -0
  133. package/lib/model/strategy/adapter/itemRule/examples.js +316 -0
  134. package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
  135. package/lib/model/strategy/adapter/itemRule/index.js +60 -0
  136. package/lib/model/strategy/adapter/itemRule/type.d.ts +225 -0
  137. package/lib/model/strategy/adapter/itemRule/type.js +46 -0
  138. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  139. package/lib/modules/Cart/types.d.ts +2 -0
  140. package/lib/modules/Cart/utils/cartProduct.js +17 -1
  141. package/lib/modules/Cart/utils/changePrice.js +5 -0
  142. package/lib/modules/Date/index.d.ts +1 -1
  143. package/lib/modules/Date/index.js +7 -1
  144. package/lib/modules/Date/types.d.ts +3 -1
  145. package/lib/modules/OpenData/index.d.ts +24 -0
  146. package/lib/modules/OpenData/index.js +119 -0
  147. package/lib/modules/OpenData/types.d.ts +73 -0
  148. package/lib/modules/OpenData/types.js +17 -0
  149. package/lib/modules/OpenData/utils.d.ts +2 -0
  150. package/lib/modules/OpenData/utils.js +111 -0
  151. package/lib/modules/Order/index.d.ts +171 -1
  152. package/lib/modules/Order/index.js +1396 -5
  153. package/lib/modules/Order/types.d.ts +441 -20
  154. package/lib/modules/Order/types.js +1 -0
  155. package/lib/modules/Order/utils.d.ts +120 -0
  156. package/lib/modules/Order/utils.js +562 -2
  157. package/lib/modules/Product/utils.js +2 -2
  158. package/lib/modules/ProductList/index.js +2 -1
  159. package/lib/modules/Quotation/index.d.ts +8 -1
  160. package/lib/modules/Quotation/index.js +33 -4
  161. package/lib/modules/Quotation/types.d.ts +5 -0
  162. package/lib/modules/Rules/index.d.ts +3 -1
  163. package/lib/modules/Rules/index.js +46 -6
  164. package/lib/modules/Rules/types.d.ts +6 -0
  165. package/lib/modules/Rules/types.js +11 -2
  166. package/lib/modules/SalesSummary/index.d.ts +70 -0
  167. package/lib/modules/SalesSummary/index.js +106 -0
  168. package/lib/modules/SalesSummary/types.d.ts +64 -0
  169. package/lib/modules/SalesSummary/types.js +17 -0
  170. package/lib/modules/SalesSummary/utils.d.ts +34 -0
  171. package/lib/modules/SalesSummary/utils.js +430 -0
  172. package/lib/modules/ScanOrderLogger/index.d.ts +21 -0
  173. package/lib/modules/ScanOrderLogger/index.js +135 -0
  174. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  175. package/lib/modules/ScanOrderLogger/providers/feishu.js +148 -0
  176. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  177. package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
  178. package/lib/modules/ScanOrderLogger/types.d.ts +52 -0
  179. package/lib/modules/ScanOrderLogger/types.js +17 -0
  180. package/lib/modules/Schedule/getDateIsInSchedule.js +5 -5
  181. package/lib/modules/Schedule/index.d.ts +4 -13
  182. package/lib/modules/Schedule/index.js +4 -15
  183. package/lib/modules/Schedule/utils.d.ts +1 -1
  184. package/lib/modules/Summary/index.d.ts +3 -0
  185. package/lib/modules/Summary/index.js +61 -2
  186. package/lib/modules/Summary/types.d.ts +7 -0
  187. package/lib/modules/Summary/utils.d.ts +104 -1
  188. package/lib/modules/Summary/utils.js +659 -8
  189. package/lib/modules/index.d.ts +4 -0
  190. package/lib/modules/index.js +9 -1
  191. package/lib/server/index.d.ts +41 -4
  192. package/lib/server/index.js +272 -10
  193. package/lib/server/modules/order/index.d.ts +10 -2
  194. package/lib/server/modules/order/index.js +31 -4
  195. package/lib/server/modules/products/index.d.ts +26 -0
  196. package/lib/server/modules/products/index.js +174 -22
  197. package/lib/server/modules/products/types.d.ts +5 -1
  198. package/lib/solution/BaseSales/index.d.ts +175 -0
  199. package/lib/solution/BaseSales/index.js +655 -0
  200. package/lib/solution/BaseSales/types.d.ts +305 -0
  201. package/lib/solution/BaseSales/types.js +40 -0
  202. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +143 -0
  203. package/lib/solution/BaseSales/utils/parseSalesResponse.js +160 -0
  204. package/lib/solution/BaseSales/utils.d.ts +40 -0
  205. package/lib/solution/BaseSales/utils.js +200 -0
  206. package/lib/solution/BookingByStep/index.d.ts +14 -0
  207. package/lib/solution/BookingByStep/index.js +469 -91
  208. package/lib/solution/BookingByStep/types.d.ts +3 -1
  209. package/lib/solution/BookingByStep/types.js +10 -0
  210. package/lib/solution/BookingByStep/utils/capacity.js +1 -1
  211. package/lib/solution/BookingByStep/utils/resources.js +5 -2
  212. package/lib/solution/BookingTicket/index.d.ts +113 -15
  213. package/lib/solution/BookingTicket/index.js +253 -61
  214. package/lib/solution/BookingTicket/types.d.ts +69 -6
  215. package/lib/solution/BookingTicket/types.js +16 -14
  216. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +37 -0
  217. package/lib/solution/BookingTicket/utils/bookingStatus.js +65 -0
  218. package/lib/solution/BookingTicket/utils/cartView.d.ts +26 -0
  219. package/lib/solution/BookingTicket/utils/cartView.js +103 -0
  220. package/lib/solution/Sales/index.d.ts +1 -0
  221. package/lib/solution/ScanOrder/index.d.ts +146 -0
  222. package/lib/solution/ScanOrder/index.js +1820 -0
  223. package/lib/solution/ScanOrder/types.d.ts +305 -0
  224. package/lib/solution/ScanOrder/types.js +36 -0
  225. package/lib/solution/ScanOrder/utils.d.ts +167 -0
  226. package/lib/solution/ScanOrder/utils.js +639 -0
  227. package/lib/solution/ShopDiscount/index.d.ts +2 -0
  228. package/lib/solution/ShopDiscount/index.js +9 -4
  229. package/lib/solution/ShopDiscount/types.d.ts +4 -0
  230. package/lib/solution/VenueBooking/index.d.ts +197 -0
  231. package/lib/solution/VenueBooking/index.js +1892 -0
  232. package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
  233. package/lib/solution/VenueBooking/types.d.ts +153 -0
  234. package/lib/solution/VenueBooking/types.js +44 -0
  235. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
  236. package/lib/solution/VenueBooking/utils/dateSummary.js +110 -0
  237. package/lib/solution/VenueBooking/utils/resource.d.ts +14 -0
  238. package/lib/solution/VenueBooking/utils/resource.js +91 -0
  239. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +34 -0
  240. package/lib/solution/VenueBooking/utils/slotMerge.js +225 -0
  241. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
  242. package/lib/solution/VenueBooking/utils/timeSlot.js +339 -0
  243. package/lib/solution/VenueBooking/utils.d.ts +1 -0
  244. package/lib/solution/VenueBooking/utils.js +69 -0
  245. package/lib/solution/index.d.ts +3 -0
  246. package/lib/solution/index.js +7 -1
  247. package/package.json +1 -1
@@ -1,12 +1,24 @@
1
+ var _excluded = ["id"],
2
+ _excluded2 = ["product_id"];
1
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); }
2
- 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
4
  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; }
4
5
  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; }
6
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
7
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
+ function _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
9
  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
10
  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); }); }; }
11
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
12
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
15
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
16
+ 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; }
7
17
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
18
  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); } }
9
19
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
20
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
21
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
10
22
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
11
23
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
24
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -17,13 +29,15 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
17
29
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
30
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
19
31
  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); }
20
- import { BaseModule } from "../../modules/BaseModule";
21
- import { createModule } from "./types";
32
+ import { createBookingTicketModule } from "./types";
33
+ import { BaseSalesImpl } from "../BaseSales";
22
34
  import Scan from "./utils/scan";
23
35
  import { handleGlobalScan, handleCustomerScan, handleUniversalScan } from "./utils/scan/handleScan";
24
36
  import scanCache from "./utils/scan/scanCache";
25
- export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
26
- _inherits(BookingTicketImpl, _BaseModule);
37
+ import { buildCartItemViews, buildCustomerView, indexBookingsByProductUid } from "./utils/cartView";
38
+ import { applyBookingsStatus, resolveScheduleId, restoreBookingsStatus } from "./utils/bookingStatus";
39
+ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
40
+ _inherits(BookingTicketImpl, _BaseSalesImpl);
27
41
  var _super = _createSuper(BookingTicketImpl);
28
42
  function BookingTicketImpl() {
29
43
  var _this;
@@ -34,102 +48,263 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
34
48
  _this = _super.call.apply(_super, [this].concat(args));
35
49
  _defineProperty(_assertThisInitialized(_this), "defaultName", 'bookingTicket');
36
50
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
37
- _defineProperty(_assertThisInitialized(_this), "isSolution", true);
38
- _defineProperty(_assertThisInitialized(_this), "request", void 0);
39
- _defineProperty(_assertThisInitialized(_this), "window", void 0);
51
+ /**
52
+ * 子类覆盖 store 类型为 BookingTicket 子模块清单(在父类基础上追加 customer)。
53
+ * 父类按 `getRegisteredModuleNames` 注入成员到该 store。
54
+ */
55
+ _defineProperty(_assertThisInitialized(_this), "store", {});
40
56
  _defineProperty(_assertThisInitialized(_this), "shopStore", void 0);
41
- _defineProperty(_assertThisInitialized(_this), "store", void 0);
42
- _defineProperty(_assertThisInitialized(_this), "otherParams", {});
43
- _defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
44
57
  _defineProperty(_assertThisInitialized(_this), "platform", void 0);
45
- // 平台类型,用于判断是 PC / H5
46
58
  _defineProperty(_assertThisInitialized(_this), "scan", void 0);
59
+ _defineProperty(_assertThisInitialized(_this), "productCatalog", []);
47
60
  return _this;
48
61
  }
49
62
  _createClass(BookingTicketImpl, [{
63
+ key: "getRegisteredModuleNames",
64
+ value:
65
+ /**
66
+ * 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer。
67
+ */
68
+ function getRegisteredModuleNames() {
69
+ return [].concat(_toConsumableArray(_get(_getPrototypeOf(BookingTicketImpl.prototype), "getRegisteredModuleNames", this).call(this)), ['customer']);
70
+ }
71
+
72
+ /**
73
+ * 业务侧子模块工厂:BookingTicket 自带的 createBookingTicketModule 优先匹配;
74
+ * 未识别的模块名(如 BookingByStep 公共类型)回退到父类工厂。
75
+ */
76
+ }, {
77
+ key: "createSubModule",
78
+ value: function createSubModule(moduleName) {
79
+ var localModule = createBookingTicketModule(moduleName, this.name);
80
+ if (localModule) return localModule;
81
+ return _get(_getPrototypeOf(BookingTicketImpl.prototype), "createSubModule", this).call(this, moduleName);
82
+ }
83
+ }, {
50
84
  key: "initialize",
51
85
  value: function () {
52
- var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
53
- var _this$otherParams,
54
- _this$otherParams2,
55
- _this$otherParams3,
56
- _this2 = this;
57
- var targetCacheData, sessionData, _data, moduleArr;
86
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core) {
87
+ var _this$otherParams;
88
+ var options,
89
+ _args = arguments;
58
90
  return _regeneratorRuntime().wrap(function _callee$(_context) {
59
91
  while (1) switch (_context.prev = _context.next) {
60
92
  case 0:
61
- this.core = core;
62
- this.store = options.store || {};
63
- this.otherParams = options.otherParams || {};
64
- console.log('[BookingTicket] 初始化完成');
65
-
66
- // 获取依赖的插件
67
- this.request = core.getPlugin('request');
68
- this.window = core.getPlugin('window');
93
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
94
+ this.scan = new Scan(this, 'BOOKING_TICKET_SCAN');
69
95
  this.shopStore = core.getPlugin('shopStore');
96
+ if (this.shopStore) {
97
+ _context.next = 5;
98
+ break;
99
+ }
100
+ throw new Error('bookingTicket解决方案需要 shopStore 插件支持');
101
+ case 5:
102
+ _context.next = 7;
103
+ return _get(_getPrototypeOf(BookingTicketImpl.prototype), "initialize", this).call(this, core, options);
104
+ case 7:
70
105
  if (this.request) {
71
106
  _context.next = 9;
72
107
  break;
73
108
  }
74
109
  throw new Error('bookingTicket解决方案需要 request 插件支持');
75
110
  case 9:
76
- if (this.shopStore) {
77
- _context.next = 11;
78
- break;
79
- }
80
- throw new Error('bookingTicket解决方案需要 shopStore 插件支持');
111
+ this.platform = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform;
112
+ console.log('[BookingTicket] 初始化完成');
81
113
  case 11:
82
- // 如果有传 cacheid,默认需要收集上面这些模块里用户操作选中的数据
83
- targetCacheData = {};
84
- this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
85
- this.platform = (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.platform;
86
- this.scan = new Scan(this, 'BOOKING_TICKET_SCAN');
87
- if ((_this$otherParams3 = this.otherParams) !== null && _this$otherParams3 !== void 0 && _this$otherParams3.cacheId) {
88
- sessionData = this.window.sessionStorage.getItem(this.name);
89
- if (sessionData) {
90
- _data = JSON.parse(sessionData);
91
- targetCacheData = _data[this.otherParams.cacheId];
92
- }
93
- }
94
- moduleArr = ['cart', 'products', 'accountList', 'customer', 'order'];
95
- moduleArr.forEach(function (step) {
96
- var targetModule = createModule(step, _this2.name);
97
- if (targetModule) {
98
- var _targetCacheData, _this2$otherParams, _this2$otherParams2;
99
- _this2.store[step] = targetModule;
100
- _this2.core.registerModule(targetModule, {
101
- initialState: (_targetCacheData = targetCacheData) === null || _targetCacheData === void 0 ? void 0 : _targetCacheData[targetModule.name],
102
- otherParams: _objectSpread(_objectSpread({}, _this2.otherParams), {}, {
103
- fatherModule: _this2.name,
104
- openCache: (_this2$otherParams = _this2.otherParams) !== null && _this2$otherParams !== void 0 && _this2$otherParams.cacheId ? true : false,
105
- cacheId: (_this2$otherParams2 = _this2.otherParams) === null || _this2$otherParams2 === void 0 ? void 0 : _this2$otherParams2.cacheId
106
- })
107
- });
108
- } else {
109
- throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
110
- }
111
- });
112
- this.core.effects.emit("".concat(this.name, ":onInited"), {});
113
- case 19:
114
114
  case "end":
115
115
  return _context.stop();
116
116
  }
117
117
  }, _callee, this);
118
118
  }));
119
- function initialize(_x, _x2) {
119
+ function initialize(_x) {
120
120
  return _initialize.apply(this, arguments);
121
121
  }
122
122
  return initialize;
123
123
  }()
124
+ /**
125
+ * 加载销售详情,并在父类基础上把 customer 信息装配到 CustomerModule。
126
+ *
127
+ * 业务上 ticketBooking 进入「编辑/查看」时需要 active customer 状态,因此从
128
+ * sales.customer / sales.header / tempOrder 顶层字段中拼装 ICustomer 后调 setSelectedCustomer,
129
+ * 让现有 setActiveCustomer / getActiveCustomer 调用方零成本拿到详情态客户。
130
+ */
131
+ }, {
132
+ key: "loadSalesDetail",
133
+ value: (function () {
134
+ var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(orderIdOrParams) {
135
+ var sales, customerModule, detailCustomer, _detailCustomer$name, _ref, detailCustomerId, detailCustomerRest, rawId, customer;
136
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
137
+ while (1) switch (_context2.prev = _context2.next) {
138
+ case 0:
139
+ _context2.next = 2;
140
+ return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
141
+ case 2:
142
+ sales = _context2.sent;
143
+ console.log(sales, '1234sales');
144
+ customerModule = this.store.customer;
145
+ detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
146
+ if (customerModule && detailCustomer) {
147
+ _ref = detailCustomer !== null && detailCustomer !== void 0 ? detailCustomer : {}, detailCustomerId = _ref.id, detailCustomerRest = _objectWithoutProperties(_ref, _excluded);
148
+ rawId = detailCustomerId !== null && detailCustomerId !== void 0 ? detailCustomerId : '';
149
+ customer = _objectSpread(_objectSpread({}, detailCustomerRest), {}, {
150
+ id: rawId == null ? '' : rawId,
151
+ name: (_detailCustomer$name = detailCustomer === null || detailCustomer === void 0 ? void 0 : detailCustomer.name) !== null && _detailCustomer$name !== void 0 ? _detailCustomer$name : '',
152
+ phone: detailCustomer === null || detailCustomer === void 0 ? void 0 : detailCustomer.phone,
153
+ email: detailCustomer === null || detailCustomer === void 0 ? void 0 : detailCustomer.email,
154
+ country_calling_code: detailCustomer === null || detailCustomer === void 0 ? void 0 : detailCustomer.country_calling_code
155
+ });
156
+ customerModule.setSelectedCustomer(customer);
157
+ this.setOrderCustomer(customer, detailCustomer);
158
+ }
159
+ return _context2.abrupt("return", sales);
160
+ case 8:
161
+ case "end":
162
+ return _context2.stop();
163
+ }
164
+ }, _callee2, this);
165
+ }));
166
+ function loadSalesDetail(_x2) {
167
+ return _loadSalesDetail.apply(this, arguments);
168
+ }
169
+ return loadSalesDetail;
170
+ }()
171
+ /**
172
+ * 更新当前预约的 appointment_status。
173
+ *
174
+ * 数据源:从 OrderModule.tempOrder 内部读取,调用方无需传 orderId / scheduleId。
175
+ * schedule id 解析优先级:
176
+ * 1. `tempOrder.metadata.appointment_booking_parent_schedule_id`
177
+ * 2. `tempOrder.bookings` 中 `parent_id === 0` 的 `schedule_event_id`
178
+ *
179
+ * 流程:先乐观更新本地 bookings 的 appointment_status,再调 PUT 接口,
180
+ * 接口成功后强制刷新销售详情;任一步失败都回滚本地状态并抛错。
181
+ *
182
+ * @param status 目标状态(如 'confirmed')
183
+ * @returns 接口返回的 data
184
+ */
185
+ )
186
+ }, {
187
+ key: "setBookingStatus",
188
+ value: (function () {
189
+ var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(status) {
190
+ var _this$store$order, _this$store$order$get;
191
+ var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
192
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
193
+ while (1) switch (_context3.prev = _context3.next) {
194
+ case 0:
195
+ tempOrder = (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$get = _this$store$order.getTempOrder) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.call(_this$store$order);
196
+ if (tempOrder) {
197
+ _context3.next = 3;
198
+ break;
199
+ }
200
+ throw new Error('setBookingStatus: tempOrder 未加载');
201
+ case 3:
202
+ orderId = tempOrder.order_id;
203
+ if (!(orderId === undefined || orderId === null)) {
204
+ _context3.next = 6;
205
+ break;
206
+ }
207
+ throw new Error('setBookingStatus: tempOrder.order_id 缺失');
208
+ case 6:
209
+ scheduleId = resolveScheduleId(tempOrder);
210
+ if (!(scheduleId === null)) {
211
+ _context3.next = 9;
212
+ break;
213
+ }
214
+ throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
215
+ case 9:
216
+ bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
217
+ previous = applyBookingsStatus(bookings, status);
218
+ _context3.prev = 11;
219
+ _context3.next = 14;
220
+ return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
221
+ appointment_status: status
222
+ });
223
+ case 14:
224
+ res = _context3.sent;
225
+ _context3.next = 17;
226
+ return this.refreshSalesDetail();
227
+ case 17:
228
+ this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
229
+ orderId: orderId,
230
+ status: status
231
+ });
232
+ return _context3.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
233
+ case 21:
234
+ _context3.prev = 21;
235
+ _context3.t0 = _context3["catch"](11);
236
+ restoreBookingsStatus(bookings, previous);
237
+ throw _context3.t0;
238
+ case 25:
239
+ case "end":
240
+ return _context3.stop();
241
+ }
242
+ }, _callee3, this, [[11, 21]]);
243
+ }));
244
+ function setBookingStatus(_x3) {
245
+ return _setBookingStatus.apply(this, arguments);
246
+ }
247
+ return setBookingStatus;
248
+ }()
249
+ /**
250
+ * 基于当前 tempOrder.order_id 强制从远端重新拉取销售详情。
251
+ *
252
+ * 适用场景:在 BookingTicket 内执行了「修改服务端订单状态」的动作(如改预约状态、
253
+ * 改下单客户、改商品行等)后,统一刷新本地销售详情,保证 UI 与服务端一致。
254
+ *
255
+ * 约束:调用前必须已有 tempOrder 且 order_id 存在,否则视为非法调用并抛错。
256
+ *
257
+ * @returns loadSalesDetail 的返回值
258
+ */
259
+ )
260
+ }, {
261
+ key: "refreshSalesDetail",
262
+ value: (function () {
263
+ var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
264
+ var _this$store$order2, _this$store$order2$ge;
265
+ var tempOrder, orderId;
266
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
267
+ while (1) switch (_context4.prev = _context4.next) {
268
+ case 0:
269
+ tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$ge = _this$store$order2.getTempOrder) === null || _this$store$order2$ge === void 0 ? void 0 : _this$store$order2$ge.call(_this$store$order2);
270
+ if (tempOrder) {
271
+ _context4.next = 3;
272
+ break;
273
+ }
274
+ throw new Error('refreshSalesDetail: tempOrder 未加载');
275
+ case 3:
276
+ orderId = tempOrder.order_id;
277
+ if (!(orderId === undefined || orderId === null)) {
278
+ _context4.next = 6;
279
+ break;
280
+ }
281
+ throw new Error('refreshSalesDetail: tempOrder.order_id 缺失');
282
+ case 6:
283
+ return _context4.abrupt("return", this.loadSalesDetail({
284
+ orderId: Number(orderId),
285
+ forceRemote: true
286
+ }));
287
+ case 7:
288
+ case "end":
289
+ return _context4.stop();
290
+ }
291
+ }, _callee4, this);
292
+ }));
293
+ function refreshSalesDetail() {
294
+ return _refreshSalesDetail.apply(this, arguments);
295
+ }
296
+ return refreshSalesDetail;
297
+ }()
124
298
  /**
125
299
  * 获取商品列表
126
300
  * @param params 包含 schedule_date 的参数
127
301
  * @returns 商品列表
128
302
  */
303
+ )
129
304
  }, {
130
305
  key: "loadProducts",
131
306
  value: (function () {
132
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
307
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
133
308
  var params,
134
309
  options,
135
310
  schedule_date,
@@ -137,15 +312,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
137
312
  menu_list_ids,
138
313
  schedule_datetime,
139
314
  _result,
140
- _args2 = arguments;
141
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
142
- while (1) switch (_context2.prev = _context2.next) {
315
+ _args5 = arguments;
316
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
317
+ while (1) switch (_context5.prev = _context5.next) {
143
318
  case 0:
144
- params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
145
- options = _args2.length > 1 ? _args2[1] : undefined;
319
+ params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
320
+ options = _args5.length > 1 ? _args5[1] : undefined;
146
321
  schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime;
147
- _context2.prev = 3;
148
- _context2.next = 6;
322
+ _context5.prev = 3;
323
+ _context5.next = 6;
149
324
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
150
325
  with_count: ['bundleGroup', 'optionGroup'],
151
326
  with_schedule: 1
@@ -153,25 +328,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
153
328
  cacheId: this.cacheId
154
329
  }), options);
155
330
  case 6:
156
- _result = _context2.sent;
331
+ _result = _context5.sent;
332
+ this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
157
333
  this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
158
- return _context2.abrupt("return", _result);
159
- case 11:
160
- _context2.prev = 11;
161
- _context2.t0 = _context2["catch"](3);
162
- console.error('Failed to load products:', _context2.t0);
163
- throw _context2.t0;
164
- case 15:
334
+ return _context5.abrupt("return", _result);
335
+ case 12:
336
+ _context5.prev = 12;
337
+ _context5.t0 = _context5["catch"](3);
338
+ console.error('Failed to load products:', _context5.t0);
339
+ throw _context5.t0;
340
+ case 16:
165
341
  case "end":
166
- return _context2.stop();
342
+ return _context5.stop();
167
343
  }
168
- }, _callee2, this, [[3, 11]]);
344
+ }, _callee5, this, [[3, 12]]);
169
345
  }));
170
346
  function loadProducts() {
171
347
  return _loadProducts.apply(this, arguments);
172
348
  }
173
349
  return loadProducts;
174
350
  }()
351
+ /**
352
+ * 按预约时间加载单个商品详情。
353
+ * 价格仍由 server products 的报价单桥接统一计算,避免 solution 实例重复请求报价单。
354
+ */
355
+ )
356
+ }, {
357
+ key: "loadProductDetail",
358
+ value: (function () {
359
+ var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params, options) {
360
+ var product_id, queryParams, products;
361
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
362
+ while (1) switch (_context6.prev = _context6.next) {
363
+ case 0:
364
+ product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
365
+ _context6.next = 3;
366
+ return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
367
+ product_ids: [product_id]
368
+ }), options);
369
+ case 3:
370
+ products = _context6.sent;
371
+ return _context6.abrupt("return", products.find(function (product) {
372
+ return Number(product.id) === Number(product_id);
373
+ }));
374
+ case 5:
375
+ case "end":
376
+ return _context6.stop();
377
+ }
378
+ }, _callee6, this);
379
+ }));
380
+ function loadProductDetail(_x4, _x5) {
381
+ return _loadProductDetail.apply(this, arguments);
382
+ }
383
+ return loadProductDetail;
384
+ }()
175
385
  /**
176
386
  * 取消商品查询订阅
177
387
  * @param subscriberId 订阅时传入的 subscriberId
@@ -200,42 +410,93 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
200
410
  }, {
201
411
  key: "getProducts",
202
412
  value: (function () {
203
- var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
204
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
205
- while (1) switch (_context3.prev = _context3.next) {
413
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
414
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
415
+ while (1) switch (_context7.prev = _context7.next) {
206
416
  case 0:
207
- return _context3.abrupt("return", this.store.products.getProducts());
417
+ return _context7.abrupt("return", this.store.products.getProducts());
208
418
  case 1:
209
419
  case "end":
210
- return _context3.stop();
420
+ return _context7.stop();
211
421
  }
212
- }, _callee3, this);
422
+ }, _callee7, this);
213
423
  }));
214
424
  function getProducts() {
215
425
  return _getProducts.apply(this, arguments);
216
426
  }
217
427
  return getProducts;
218
428
  }()
429
+ /**
430
+ * 获取当前已加载的商品池 UI 视图。
431
+ *
432
+ * ProductList.getProducts 是异步 API;BookingTicket 维护最近一次 loadProducts 结果,
433
+ * 供 UI 同步 getter 使用。未加载时返回空列表。
434
+ */
435
+ )
436
+ }, {
437
+ key: "getProductCatalog",
438
+ value: function getProductCatalog() {
439
+ return {
440
+ products: _toConsumableArray(this.productCatalog)
441
+ };
442
+ }
443
+
444
+ /**
445
+ * 获取购物车 UI 视图。
446
+ *
447
+ * tempOrder 仍是 checkout 协议对象;本方法只输出 UI 直接消费的数据,
448
+ * 商品行展示字段在 Solution 层合并,避免 UI 直接读取 tempOrder 原始结构。
449
+ */
450
+ }, {
451
+ key: "getCart",
452
+ value: function getCart() {
453
+ var _this$store$order$get2, _this$store$order3, _salesDetail$bookings;
454
+ var tempOrder = (_this$store$order$get2 = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 ? void 0 : _this$store$order3.getTempOrder()) !== null && _this$store$order$get2 !== void 0 ? _this$store$order$get2 : null;
455
+ var salesDetail = this.getSalesOrder();
456
+ var bookings = (_salesDetail$bookings = salesDetail === null || salesDetail === void 0 ? void 0 : salesDetail.bookings) !== null && _salesDetail$bookings !== void 0 ? _salesDetail$bookings : (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) || [];
457
+ var salesDetailBookingMap = salesDetail === null || salesDetail === void 0 ? void 0 : salesDetail.bookingsByProductUid;
458
+ var bookingsByProductUid = salesDetailBookingMap && Object.keys(salesDetailBookingMap).length > 0 ? salesDetailBookingMap : indexBookingsByProductUid(bookings);
459
+ return {
460
+ items: buildCartItemViews((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [], {
461
+ bookingDetailMap: bookingsByProductUid,
462
+ productsCatalog: this.productCatalog
463
+ })
464
+ };
465
+ }
466
+
467
+ /**
468
+ * 获取客户 UI 视图。
469
+ *
470
+ * 优先使用 CustomerModule 的 selected customer;缺失时回退到 tempOrder 顶层客户字段。
471
+ */
472
+ }, {
473
+ key: "getCustomer",
474
+ value: function getCustomer() {
475
+ var _this$store$customer$, _this$store$customer, _this$store$customer$2, _this$store$order$get3, _this$store$order4, _this$store$order4$ge;
476
+ var selected = (_this$store$customer$ = (_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || (_this$store$customer$2 = _this$store$customer.getSelectedCustomer) === null || _this$store$customer$2 === void 0 ? void 0 : _this$store$customer$2.call(_this$store$customer)) !== null && _this$store$customer$ !== void 0 ? _this$store$customer$ : null;
477
+ var tempOrder = (_this$store$order$get3 = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || (_this$store$order4$ge = _this$store$order4.getTempOrder) === null || _this$store$order4$ge === void 0 ? void 0 : _this$store$order4$ge.call(_this$store$order4)) !== null && _this$store$order$get3 !== void 0 ? _this$store$order$get3 : null;
478
+ return buildCustomerView(selected, tempOrder);
479
+ }
480
+
219
481
  /**
220
482
  * 通过 ids 获取商品列表(不加载到模块中)
221
483
  * @returns 商品列表
222
484
  */
223
- )
224
485
  }, {
225
486
  key: "getProductByIds",
226
487
  value: (function () {
227
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(ids) {
228
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
229
- while (1) switch (_context4.prev = _context4.next) {
488
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(ids) {
489
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
490
+ while (1) switch (_context8.prev = _context8.next) {
230
491
  case 0:
231
- return _context4.abrupt("return", this.store.products.getProductByIds(ids));
492
+ return _context8.abrupt("return", this.store.products.getProductByIds(ids));
232
493
  case 1:
233
494
  case "end":
234
- return _context4.stop();
495
+ return _context8.stop();
235
496
  }
236
- }, _callee4, this);
497
+ }, _callee8, this);
237
498
  }));
238
- function getProductByIds(_x3) {
499
+ function getProductByIds(_x6) {
239
500
  return _getProductByIds.apply(this, arguments);
240
501
  }
241
502
  return getProductByIds;
@@ -249,27 +510,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
249
510
  }, {
250
511
  key: "getScheduleTimePoints",
251
512
  value: (function () {
252
- var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
513
+ var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
253
514
  var result;
254
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
255
- while (1) switch (_context5.prev = _context5.next) {
515
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
516
+ while (1) switch (_context9.prev = _context9.next) {
256
517
  case 0:
257
- _context5.next = 2;
518
+ _context9.next = 2;
258
519
  return this.request.post('/menu/schedule-time-points', {
259
520
  menu_list_ids: params.menu_list_ids
260
521
  }, {
261
522
  osServer: true
262
523
  });
263
524
  case 2:
264
- result = _context5.sent;
265
- return _context5.abrupt("return", result.data || []);
525
+ result = _context9.sent;
526
+ return _context9.abrupt("return", result.data || []);
266
527
  case 4:
267
528
  case "end":
268
- return _context5.stop();
529
+ return _context9.stop();
269
530
  }
270
- }, _callee5, this);
531
+ }, _callee9, this);
271
532
  }));
272
- function getScheduleTimePoints(_x4) {
533
+ function getScheduleTimePoints(_x7) {
273
534
  return _getScheduleTimePoints.apply(this, arguments);
274
535
  }
275
536
  return getScheduleTimePoints;
@@ -283,30 +544,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
283
544
  }, {
284
545
  key: "getCustomerList",
285
546
  value: (function () {
286
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
547
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
287
548
  var params,
288
549
  _result2,
289
- _args6 = arguments;
290
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
291
- while (1) switch (_context6.prev = _context6.next) {
550
+ _args10 = arguments;
551
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
552
+ while (1) switch (_context10.prev = _context10.next) {
292
553
  case 0:
293
- params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
294
- _context6.prev = 1;
295
- _context6.next = 4;
554
+ params = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
555
+ _context10.prev = 1;
556
+ _context10.next = 4;
296
557
  return this.store.customer.getCustomerList(params);
297
558
  case 4:
298
- _result2 = _context6.sent;
299
- return _context6.abrupt("return", _result2);
559
+ _result2 = _context10.sent;
560
+ return _context10.abrupt("return", _result2);
300
561
  case 8:
301
- _context6.prev = 8;
302
- _context6.t0 = _context6["catch"](1);
303
- console.error('Failed to get customer list:', _context6.t0);
304
- throw _context6.t0;
562
+ _context10.prev = 8;
563
+ _context10.t0 = _context10["catch"](1);
564
+ console.error('Failed to get customer list:', _context10.t0);
565
+ throw _context10.t0;
305
566
  case 12:
306
567
  case "end":
307
- return _context6.stop();
568
+ return _context10.stop();
308
569
  }
309
- }, _callee6, this, [[1, 8]]);
570
+ }, _callee10, this, [[1, 8]]);
310
571
  }));
311
572
  function getCustomerList() {
312
573
  return _getCustomerList.apply(this, arguments);
@@ -393,6 +654,70 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
393
654
  this.store.customer.addCustomerToFirst(customer);
394
655
  }
395
656
 
657
+ // ─── 下单客户(基于 OrderModule.tempOrder,单一真源)───
658
+ // 与老的 setActiveCustomer/getActiveCustomer 解耦:
659
+ // - 老路:写入 CustomerModule.selectedCustomer(保留兼容,存量调用方不动)
660
+ // - 新路:写入 tempOrder 的 customer 协议字段 + _extend.customerSnapshot
661
+ // 新业务(如 SalesSdk)应优先使用本组方法。
662
+
663
+ /**
664
+ * 设置当前下单客户。
665
+ *
666
+ * @param patch tempOrder 协议字段(customer_id 必填,其余缺省视为清空)
667
+ * @param snapshot UI 富字段快照;undefined 不动;null 清空;ICustomer 写入
668
+ *
669
+ * 同时透传 OrderModule 内部 emit 的 `order:onOrderCustomerChange` 之外,
670
+ * 在 BookingTicket 命名空间也 emit 一次,方便上层统一从 Solution 订阅。
671
+ */
672
+ }, {
673
+ key: "setOrderCustomer",
674
+ value: function setOrderCustomer(patch, snapshot) {
675
+ this.store.order.setOrderCustomer(patch, snapshot);
676
+ var next = this.buildOrderCustomerPayload();
677
+ console.log('setOrderCustomer1234', patch, snapshot, next);
678
+ this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), next);
679
+ }
680
+
681
+ /**
682
+ * 读取 tempOrder 上的下单客户协议字段;customer_id 缺失时返回 null。
683
+ */
684
+ }, {
685
+ key: "getOrderCustomer",
686
+ value: function getOrderCustomer() {
687
+ return this.store.order.getOrderCustomer();
688
+ }
689
+
690
+ /**
691
+ * 读取 tempOrder._extend.customerSnapshot 中的完整客户对象。
692
+ */
693
+ }, {
694
+ key: "getOrderCustomerSnapshot",
695
+ value: function getOrderCustomerSnapshot() {
696
+ return this.store.order.getOrderCustomerSnapshot();
697
+ }
698
+
699
+ /**
700
+ * 清空下单客户(协议字段 + snapshot)。
701
+ */
702
+ }, {
703
+ key: "clearOrderCustomer",
704
+ value: function clearOrderCustomer() {
705
+ this.store.order.clearOrderCustomer();
706
+ this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), null);
707
+ }
708
+
709
+ /** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */
710
+ }, {
711
+ key: "buildOrderCustomerPayload",
712
+ value: function buildOrderCustomerPayload() {
713
+ var patch = this.store.order.getOrderCustomer();
714
+ if (!patch) return null;
715
+ return {
716
+ patch: patch,
717
+ snapshot: this.store.order.getOrderCustomerSnapshot()
718
+ };
719
+ }
720
+
396
721
  /**
397
722
  * 获取客户分页信息
398
723
  * @returns 分页信息
@@ -433,29 +758,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
433
758
  }, {
434
759
  key: "changeCustomerPage",
435
760
  value: (function () {
436
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(page, pageSize) {
761
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(page, pageSize) {
437
762
  var _result3;
438
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
439
- while (1) switch (_context7.prev = _context7.next) {
763
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
764
+ while (1) switch (_context11.prev = _context11.next) {
440
765
  case 0:
441
- _context7.prev = 0;
442
- _context7.next = 3;
766
+ _context11.prev = 0;
767
+ _context11.next = 3;
443
768
  return this.store.customer.changeCustomerPage(page, pageSize);
444
769
  case 3:
445
- _result3 = _context7.sent;
446
- return _context7.abrupt("return", _result3);
770
+ _result3 = _context11.sent;
771
+ return _context11.abrupt("return", _result3);
447
772
  case 7:
448
- _context7.prev = 7;
449
- _context7.t0 = _context7["catch"](0);
450
- console.error('Failed to change customer page:', _context7.t0);
451
- throw _context7.t0;
773
+ _context11.prev = 7;
774
+ _context11.t0 = _context11["catch"](0);
775
+ console.error('Failed to change customer page:', _context11.t0);
776
+ throw _context11.t0;
452
777
  case 11:
453
778
  case "end":
454
- return _context7.stop();
779
+ return _context11.stop();
455
780
  }
456
- }, _callee7, this, [[0, 7]]);
781
+ }, _callee11, this, [[0, 7]]);
457
782
  }));
458
- function changeCustomerPage(_x5, _x6) {
783
+ function changeCustomerPage(_x8, _x9) {
459
784
  return _changeCustomerPage.apply(this, arguments);
460
785
  }
461
786
  return changeCustomerPage;
@@ -468,28 +793,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
468
793
  }, {
469
794
  key: "loadMoreCustomers",
470
795
  value: (function () {
471
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
796
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
472
797
  var _result4;
473
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
474
- while (1) switch (_context8.prev = _context8.next) {
798
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
799
+ while (1) switch (_context12.prev = _context12.next) {
475
800
  case 0:
476
- _context8.prev = 0;
477
- _context8.next = 3;
801
+ _context12.prev = 0;
802
+ _context12.next = 3;
478
803
  return this.store.customer.loadMoreCustomers();
479
804
  case 3:
480
- _result4 = _context8.sent;
805
+ _result4 = _context12.sent;
481
806
  this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result4);
482
- return _context8.abrupt("return", _result4);
807
+ return _context12.abrupt("return", _result4);
483
808
  case 8:
484
- _context8.prev = 8;
485
- _context8.t0 = _context8["catch"](0);
486
- console.error('Failed to load more customers:', _context8.t0);
487
- throw _context8.t0;
809
+ _context12.prev = 8;
810
+ _context12.t0 = _context12["catch"](0);
811
+ console.error('Failed to load more customers:', _context12.t0);
812
+ throw _context12.t0;
488
813
  case 12:
489
814
  case "end":
490
- return _context8.stop();
815
+ return _context12.stop();
491
816
  }
492
- }, _callee8, this, [[0, 8]]);
817
+ }, _callee12, this, [[0, 8]]);
493
818
  }));
494
819
  function loadMoreCustomers() {
495
820
  return _loadMoreCustomers.apply(this, arguments);
@@ -505,31 +830,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
505
830
  }, {
506
831
  key: "resetAndLoadCustomers",
507
832
  value: (function () {
508
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
833
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
509
834
  var params,
510
835
  _result5,
511
- _args9 = arguments;
512
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
513
- while (1) switch (_context9.prev = _context9.next) {
836
+ _args13 = arguments;
837
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
838
+ while (1) switch (_context13.prev = _context13.next) {
514
839
  case 0:
515
- params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
516
- _context9.prev = 1;
517
- _context9.next = 4;
840
+ params = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
841
+ _context13.prev = 1;
842
+ _context13.next = 4;
518
843
  return this.store.customer.resetAndLoadCustomers(params);
519
844
  case 4:
520
- _result5 = _context9.sent;
845
+ _result5 = _context13.sent;
521
846
  this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result5);
522
- return _context9.abrupt("return", _result5);
847
+ return _context13.abrupt("return", _result5);
523
848
  case 9:
524
- _context9.prev = 9;
525
- _context9.t0 = _context9["catch"](1);
526
- console.error('Failed to reset and load customers:', _context9.t0);
527
- throw _context9.t0;
849
+ _context13.prev = 9;
850
+ _context13.t0 = _context13["catch"](1);
851
+ console.error('Failed to reset and load customers:', _context13.t0);
852
+ throw _context13.t0;
528
853
  case 13:
529
854
  case "end":
530
- return _context9.stop();
855
+ return _context13.stop();
531
856
  }
532
- }, _callee9, this, [[1, 9]]);
857
+ }, _callee13, this, [[1, 9]]);
533
858
  }));
534
859
  function resetAndLoadCustomers() {
535
860
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -574,9 +899,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
574
899
  }, {
575
900
  key: "scanGlobalListener",
576
901
  value: function scanGlobalListener(callback) {
577
- var _this3 = this;
902
+ var _this2 = this;
578
903
  var localSearch = function localSearch(v) {
579
- return _this3.store.products.findProductsByCodeOrBarcode(v);
904
+ return _this2.store.products.findProductsByCodeOrBarcode(v);
580
905
  };
581
906
  var scanCallback = handleGlobalScan(this.request, localSearch);
582
907
  var safeCallback = function safeCallback(d) {
@@ -691,15 +1016,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
691
1016
  }, {
692
1017
  key: "setOtherParams",
693
1018
  value: (function () {
694
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
695
- var _ref,
696
- _ref$cover,
1019
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
1020
+ var _ref2,
1021
+ _ref2$cover,
697
1022
  cover,
698
- _args10 = arguments;
699
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
700
- while (1) switch (_context10.prev = _context10.next) {
1023
+ _args14 = arguments;
1024
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1025
+ while (1) switch (_context14.prev = _context14.next) {
701
1026
  case 0:
702
- _ref = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {}, _ref$cover = _ref.cover, cover = _ref$cover === void 0 ? false : _ref$cover;
1027
+ _ref2 = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {}, _ref2$cover = _ref2.cover, cover = _ref2$cover === void 0 ? false : _ref2$cover;
703
1028
  if (cover) {
704
1029
  this.otherParams = params;
705
1030
  } else {
@@ -707,11 +1032,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
707
1032
  }
708
1033
  case 2:
709
1034
  case "end":
710
- return _context10.stop();
1035
+ return _context14.stop();
711
1036
  }
712
- }, _callee10, this);
1037
+ }, _callee14, this);
713
1038
  }));
714
- function setOtherParams(_x7) {
1039
+ function setOtherParams(_x10) {
715
1040
  return _setOtherParams.apply(this, arguments);
716
1041
  }
717
1042
  return setOtherParams;
@@ -724,16 +1049,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
724
1049
  }, {
725
1050
  key: "getOtherParams",
726
1051
  value: (function () {
727
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
728
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
729
- while (1) switch (_context11.prev = _context11.next) {
1052
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1053
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1054
+ while (1) switch (_context15.prev = _context15.next) {
730
1055
  case 0:
731
- return _context11.abrupt("return", this.otherParams);
1056
+ return _context15.abrupt("return", this.otherParams);
732
1057
  case 1:
733
1058
  case "end":
734
- return _context11.stop();
1059
+ return _context15.stop();
735
1060
  }
736
- }, _callee11, this);
1061
+ }, _callee15, this);
737
1062
  }));
738
1063
  function getOtherParams() {
739
1064
  return _getOtherParams.apply(this, arguments);
@@ -741,28 +1066,41 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
741
1066
  return getOtherParams;
742
1067
  }()
743
1068
  /**
744
- * 销毁模块
1069
+ * 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
1070
+ * 再清理 BookingTicket 自有资源(scan 监听 + scan 内存缓存)。
745
1071
  */
746
1072
  )
747
1073
  }, {
748
1074
  key: "destroy",
749
- value: function destroy() {
750
- var _this$store$cart, _this$store$products, _this$store$accountLi, _this$store$customer, _this$store$order;
751
- (_this$store$cart = this.store.cart) === null || _this$store$cart === void 0 || _this$store$cart.destroy();
752
- (_this$store$products = this.store.products) === null || _this$store$products === void 0 || _this$store$products.destroy();
753
- (_this$store$accountLi = this.store.accountList) === null || _this$store$accountLi === void 0 || _this$store$accountLi.destroy();
754
- (_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.destroy();
755
- (_this$store$order = this.store.order) === null || _this$store$order === void 0 || _this$store$order.destroy();
756
- this.core.effects.offByModuleDestroy(this.name);
757
- this.core.unregisterModule(this);
758
- // 清除所有的监听
759
- this.scan.removeAllListeners();
760
- // 清除scan数据内存缓存
761
- scanCache.clear();
762
- }
1075
+ value: (function () {
1076
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1077
+ var _this$scan;
1078
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1079
+ while (1) switch (_context16.prev = _context16.next) {
1080
+ case 0:
1081
+ _context16.next = 2;
1082
+ return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
1083
+ case 2:
1084
+ try {
1085
+ (_this$scan = this.scan) === null || _this$scan === void 0 || _this$scan.removeAllListeners();
1086
+ } catch (error) {
1087
+ console.warn('[BookingTicket] scan removeAllListeners 失败', error);
1088
+ }
1089
+ scanCache.clear();
1090
+ case 4:
1091
+ case "end":
1092
+ return _context16.stop();
1093
+ }
1094
+ }, _callee16, this);
1095
+ }));
1096
+ function destroy() {
1097
+ return _destroy.apply(this, arguments);
1098
+ }
1099
+ return destroy;
1100
+ }())
763
1101
  }]);
764
1102
  return BookingTicketImpl;
765
- }(BaseModule);
1103
+ }(BaseSalesImpl);
766
1104
 
767
1105
  // 导出相关类型和实现
768
1106
  export * from "./types";