@pisell/pisellos 3.0.55 → 3.0.57

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 (268) hide show
  1. package/dist/core/index.js +2 -1
  2. package/dist/effects/index.d.ts +4 -3
  3. package/dist/effects/index.js +15 -6
  4. package/dist/modules/AccountList/index.d.ts +7 -1
  5. package/dist/modules/AccountList/index.js +81 -14
  6. package/dist/modules/AccountList/types.d.ts +28 -0
  7. package/dist/modules/AccountList/types.js +8 -0
  8. package/dist/modules/Cart/index.js +1 -1
  9. package/dist/modules/Cart/utils/changePrice.d.ts +2 -2
  10. package/dist/modules/Cart/utils/changePrice.js +1 -1
  11. package/dist/modules/Customer/constants.d.ts +7 -0
  12. package/dist/modules/Customer/constants.js +12 -0
  13. package/dist/modules/Customer/index.d.ts +122 -0
  14. package/dist/modules/Customer/index.js +697 -0
  15. package/dist/modules/Customer/types.d.ts +146 -0
  16. package/dist/modules/Customer/types.js +41 -0
  17. package/dist/modules/Payment/cash.d.ts +11 -0
  18. package/dist/modules/Payment/cash.js +78 -0
  19. package/dist/modules/Payment/eftpos.d.ts +11 -0
  20. package/dist/modules/Payment/eftpos.js +80 -0
  21. package/dist/modules/Payment/index.d.ts +273 -9
  22. package/dist/modules/Payment/index.js +2525 -109
  23. package/dist/modules/Payment/types.d.ts +382 -30
  24. package/dist/modules/Payment/types.js +116 -14
  25. package/dist/modules/Payment/wallet.d.ts +11 -0
  26. package/dist/modules/Payment/wallet.js +78 -0
  27. package/dist/modules/Payment/walletpass.d.ts +0 -0
  28. package/dist/modules/Payment/walletpass.js +0 -0
  29. package/dist/modules/ProductList/index.d.ts +14 -3
  30. package/dist/modules/ProductList/index.js +58 -44
  31. package/dist/modules/ProductList/types.d.ts +0 -1
  32. package/dist/modules/Rules/index.js +27 -14
  33. package/dist/modules/Rules/types.d.ts +1 -0
  34. package/dist/modules/index.d.ts +1 -0
  35. package/dist/modules/index.js +1 -0
  36. package/dist/plugins/app-types/app/app.d.ts +83 -0
  37. package/dist/plugins/app-types/app/const.d.ts +4 -0
  38. package/dist/plugins/app-types/app/index.d.ts +14 -0
  39. package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
  40. package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
  41. package/dist/plugins/app-types/config.d.ts +3 -0
  42. package/dist/plugins/app-types/cookie/index.d.ts +13 -0
  43. package/dist/plugins/app-types/data/index.d.ts +8 -0
  44. package/dist/plugins/app-types/history/config.d.ts +24 -0
  45. package/dist/plugins/app-types/history/index.d.ts +20 -0
  46. package/dist/plugins/app-types/history/type.d.ts +2 -0
  47. package/dist/plugins/app-types/hooks/index.d.ts +12 -0
  48. package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  49. package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  50. package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  51. package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  52. package/dist/plugins/app-types/index.d.ts +6 -0
  53. package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
  54. package/dist/plugins/app-types/locales/en.d.ts +3 -0
  55. package/dist/plugins/app-types/locales/index.d.ts +37 -0
  56. package/dist/plugins/app-types/locales/original.d.ts +3 -0
  57. package/dist/plugins/app-types/locales/type.d.ts +19 -0
  58. package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
  59. package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
  60. package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
  61. package/dist/plugins/app-types/logger/index.d.ts +122 -0
  62. package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
  63. package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
  64. package/dist/plugins/app-types/models/global.d.ts +32 -0
  65. package/dist/plugins/app-types/models/index.d.ts +45 -0
  66. package/dist/plugins/app-types/models/type.d.ts +2 -0
  67. package/dist/plugins/app-types/package.json +15 -0
  68. package/dist/plugins/app-types/plugin/index.d.ts +0 -0
  69. package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
  70. package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
  71. package/dist/plugins/app-types/request/cache.d.ts +46 -0
  72. package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
  73. package/dist/plugins/app-types/request/config.d.ts +3 -0
  74. package/dist/plugins/app-types/request/constants.d.ts +2 -0
  75. package/dist/plugins/app-types/request/index.d.ts +24 -0
  76. package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
  77. package/dist/plugins/app-types/request/type.d.ts +41 -0
  78. package/dist/plugins/app-types/request/utils.d.ts +46 -0
  79. package/dist/plugins/app-types/routes/config.d.ts +7 -0
  80. package/dist/plugins/app-types/routes/index.d.ts +28 -0
  81. package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  82. package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
  83. package/dist/plugins/app-types/socket/constants.d.ts +33 -0
  84. package/dist/plugins/app-types/socket/events.d.ts +31 -0
  85. package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
  86. package/dist/plugins/app-types/socket/index.d.ts +61 -0
  87. package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
  88. package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
  89. package/dist/plugins/app-types/socket/socket.d.ts +129 -0
  90. package/dist/plugins/app-types/socket/types.d.ts +85 -0
  91. package/dist/plugins/app-types/storage/index.d.ts +17 -0
  92. package/dist/plugins/app-types/tasks/index.d.ts +77 -0
  93. package/dist/plugins/app-types/tasks/type.d.ts +62 -0
  94. package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
  95. package/dist/plugins/app-types/type.d.ts +2 -0
  96. package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  97. package/dist/plugins/app-types/variables/config.d.ts +3 -0
  98. package/dist/plugins/app-types/variables/index.d.ts +6 -0
  99. package/dist/plugins/app-types/variables/type.d.ts +2 -0
  100. package/dist/plugins/app-types/website/index.d.ts +6 -0
  101. package/dist/plugins/app.d.ts +8 -0
  102. package/dist/plugins/app.js +1 -0
  103. package/dist/plugins/window.d.ts +1 -0
  104. package/dist/solution/BookingByStep/index.js +59 -35
  105. package/dist/solution/BookingByStep/types.d.ts +3 -2
  106. package/dist/solution/BookingTicket/index.d.ts +172 -0
  107. package/dist/solution/BookingTicket/index.js +665 -0
  108. package/dist/solution/BookingTicket/types.d.ts +68 -0
  109. package/dist/solution/BookingTicket/types.js +43 -0
  110. package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  111. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
  112. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
  113. package/dist/solution/BookingTicket/utils/scan/handleScan.js +174 -0
  114. package/dist/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  115. package/dist/solution/BookingTicket/utils/scan/index.js +285 -0
  116. package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  117. package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
  118. package/dist/solution/BuyTickets/index.d.ts +2 -2
  119. package/dist/solution/BuyTickets/index.js +1 -1
  120. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  121. package/dist/solution/Checkout/index.d.ts +181 -0
  122. package/dist/solution/Checkout/index.js +1596 -0
  123. package/dist/solution/Checkout/types.d.ts +550 -0
  124. package/dist/solution/Checkout/types.js +132 -0
  125. package/dist/solution/Checkout/utils/index.d.ts +73 -0
  126. package/dist/solution/Checkout/utils/index.js +371 -0
  127. package/dist/solution/ShopDiscount/index.js +4 -2
  128. package/dist/solution/index.d.ts +2 -0
  129. package/dist/solution/index.js +3 -1
  130. package/dist/types/index.d.ts +3 -1
  131. package/dist/utils/task.d.ts +40 -0
  132. package/dist/utils/task.js +171 -0
  133. package/dist/utils/watch.d.ts +102 -0
  134. package/dist/utils/watch.js +294 -0
  135. package/lib/core/index.js +1 -1
  136. package/lib/effects/index.d.ts +4 -3
  137. package/lib/effects/index.js +4 -1
  138. package/lib/modules/AccountList/index.d.ts +7 -1
  139. package/lib/modules/AccountList/index.js +27 -0
  140. package/lib/modules/AccountList/types.d.ts +28 -0
  141. package/lib/modules/Cart/index.js +1 -1
  142. package/lib/modules/Cart/utils/changePrice.d.ts +2 -2
  143. package/lib/modules/Cart/utils/changePrice.js +1 -1
  144. package/lib/modules/Customer/constants.d.ts +7 -0
  145. package/lib/modules/Customer/constants.js +39 -0
  146. package/lib/modules/Customer/index.d.ts +122 -0
  147. package/lib/modules/Customer/index.js +440 -0
  148. package/lib/modules/Customer/types.d.ts +146 -0
  149. package/lib/modules/Customer/types.js +37 -0
  150. package/lib/modules/Payment/cash.d.ts +11 -0
  151. package/lib/modules/Payment/cash.js +51 -0
  152. package/lib/modules/Payment/eftpos.d.ts +11 -0
  153. package/lib/modules/Payment/eftpos.js +51 -0
  154. package/lib/modules/Payment/index.d.ts +273 -9
  155. package/lib/modules/Payment/index.js +1285 -50
  156. package/lib/modules/Payment/types.d.ts +382 -30
  157. package/lib/modules/Payment/types.js +41 -6
  158. package/lib/modules/Payment/wallet.d.ts +11 -0
  159. package/lib/modules/Payment/wallet.js +51 -0
  160. package/lib/modules/Payment/walletpass.d.ts +0 -0
  161. package/lib/modules/Payment/walletpass.js +0 -0
  162. package/lib/modules/ProductList/index.d.ts +14 -3
  163. package/lib/modules/ProductList/index.js +42 -28
  164. package/lib/modules/ProductList/types.d.ts +0 -1
  165. package/lib/modules/Rules/index.js +20 -12
  166. package/lib/modules/Rules/types.d.ts +1 -0
  167. package/lib/modules/index.d.ts +1 -0
  168. package/lib/modules/index.js +2 -0
  169. package/lib/plugins/app-types/app/app.d.ts +83 -0
  170. package/lib/plugins/app-types/app/const.d.ts +4 -0
  171. package/lib/plugins/app-types/app/index.d.ts +14 -0
  172. package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
  173. package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
  174. package/lib/plugins/app-types/config.d.ts +3 -0
  175. package/lib/plugins/app-types/cookie/index.d.ts +13 -0
  176. package/lib/plugins/app-types/data/index.d.ts +8 -0
  177. package/lib/plugins/app-types/history/config.d.ts +24 -0
  178. package/lib/plugins/app-types/history/index.d.ts +20 -0
  179. package/lib/plugins/app-types/history/type.d.ts +2 -0
  180. package/lib/plugins/app-types/hooks/index.d.ts +12 -0
  181. package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
  182. package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
  183. package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
  184. package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
  185. package/lib/plugins/app-types/index.d.ts +6 -0
  186. package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
  187. package/lib/plugins/app-types/locales/en.d.ts +3 -0
  188. package/lib/plugins/app-types/locales/index.d.ts +37 -0
  189. package/lib/plugins/app-types/locales/original.d.ts +3 -0
  190. package/lib/plugins/app-types/locales/type.d.ts +19 -0
  191. package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
  192. package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
  193. package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
  194. package/lib/plugins/app-types/logger/index.d.ts +122 -0
  195. package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
  196. package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
  197. package/lib/plugins/app-types/models/global.d.ts +32 -0
  198. package/lib/plugins/app-types/models/index.d.ts +45 -0
  199. package/lib/plugins/app-types/models/type.d.ts +2 -0
  200. package/lib/plugins/app-types/package.json +15 -0
  201. package/lib/plugins/app-types/plugin/index.d.ts +0 -0
  202. package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
  203. package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
  204. package/lib/plugins/app-types/request/cache.d.ts +46 -0
  205. package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
  206. package/lib/plugins/app-types/request/config.d.ts +3 -0
  207. package/lib/plugins/app-types/request/constants.d.ts +2 -0
  208. package/lib/plugins/app-types/request/index.d.ts +24 -0
  209. package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
  210. package/lib/plugins/app-types/request/type.d.ts +41 -0
  211. package/lib/plugins/app-types/request/utils.d.ts +46 -0
  212. package/lib/plugins/app-types/routes/config.d.ts +7 -0
  213. package/lib/plugins/app-types/routes/index.d.ts +28 -0
  214. package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
  215. package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
  216. package/lib/plugins/app-types/socket/constants.d.ts +33 -0
  217. package/lib/plugins/app-types/socket/events.d.ts +31 -0
  218. package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
  219. package/lib/plugins/app-types/socket/index.d.ts +61 -0
  220. package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
  221. package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
  222. package/lib/plugins/app-types/socket/socket.d.ts +129 -0
  223. package/lib/plugins/app-types/socket/types.d.ts +85 -0
  224. package/lib/plugins/app-types/storage/index.d.ts +17 -0
  225. package/lib/plugins/app-types/tasks/index.d.ts +77 -0
  226. package/lib/plugins/app-types/tasks/type.d.ts +62 -0
  227. package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
  228. package/lib/plugins/app-types/type.d.ts +2 -0
  229. package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
  230. package/lib/plugins/app-types/variables/config.d.ts +3 -0
  231. package/lib/plugins/app-types/variables/index.d.ts +6 -0
  232. package/lib/plugins/app-types/variables/type.d.ts +2 -0
  233. package/lib/plugins/app-types/website/index.d.ts +6 -0
  234. package/lib/plugins/app.d.ts +8 -0
  235. package/lib/plugins/app.js +17 -0
  236. package/lib/plugins/window.d.ts +1 -0
  237. package/lib/solution/BookingByStep/index.js +40 -29
  238. package/lib/solution/BookingByStep/types.d.ts +3 -2
  239. package/lib/solution/BookingTicket/index.d.ts +172 -0
  240. package/lib/solution/BookingTicket/index.js +399 -0
  241. package/lib/solution/BookingTicket/types.d.ts +68 -0
  242. package/lib/solution/BookingTicket/types.js +72 -0
  243. package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
  244. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
  245. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
  246. package/lib/solution/BookingTicket/utils/scan/handleScan.js +125 -0
  247. package/lib/solution/BookingTicket/utils/scan/index.d.ts +81 -0
  248. package/lib/solution/BookingTicket/utils/scan/index.js +210 -0
  249. package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
  250. package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
  251. package/lib/solution/BuyTickets/index.d.ts +2 -2
  252. package/lib/solution/BuyTickets/index.js +1 -1
  253. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  254. package/lib/solution/Checkout/index.d.ts +181 -0
  255. package/lib/solution/Checkout/index.js +864 -0
  256. package/lib/solution/Checkout/types.d.ts +550 -0
  257. package/lib/solution/Checkout/types.js +75 -0
  258. package/lib/solution/Checkout/utils/index.d.ts +73 -0
  259. package/lib/solution/Checkout/utils/index.js +266 -0
  260. package/lib/solution/ShopDiscount/index.js +2 -1
  261. package/lib/solution/index.d.ts +2 -0
  262. package/lib/solution/index.js +5 -1
  263. package/lib/types/index.d.ts +3 -1
  264. package/lib/utils/task.d.ts +40 -0
  265. package/lib/utils/task.js +109 -0
  266. package/lib/utils/watch.d.ts +102 -0
  267. package/lib/utils/watch.js +217 -0
  268. package/package.json +4 -2
@@ -0,0 +1,78 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _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
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ 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); }); }; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ 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); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ 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); }
10
+ /**
11
+ * 钱包支付实现
12
+ */
13
+ export var WalletPaymentImpl = /*#__PURE__*/function () {
14
+ function WalletPaymentImpl(paymentModule) {
15
+ _classCallCheck(this, WalletPaymentImpl);
16
+ this.paymentModule = paymentModule;
17
+ }
18
+ _createClass(WalletPaymentImpl, [{
19
+ key: "processWalletPayment",
20
+ value: function () {
21
+ var _processWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(amount, orderUuid, voucherId) {
22
+ var walletMethod, paymentItem;
23
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
24
+ while (1) switch (_context.prev = _context.next) {
25
+ case 0:
26
+ _context.next = 2;
27
+ return this.paymentModule.getWalletPaymentMethod();
28
+ case 2:
29
+ walletMethod = _context.sent;
30
+ if (walletMethod) {
31
+ _context.next = 5;
32
+ break;
33
+ }
34
+ throw new Error('钱包支付方式未找到');
35
+ case 5:
36
+ paymentItem = {
37
+ amount: amount.toString(),
38
+ code: walletMethod.code,
39
+ id: walletMethod.id,
40
+ name: walletMethod.name,
41
+ type: walletMethod.type,
42
+ voucher_id: voucherId || ''
43
+ };
44
+ _context.next = 8;
45
+ return this.paymentModule.pushPaymentAsync(orderUuid, paymentItem);
46
+ case 8:
47
+ case "end":
48
+ return _context.stop();
49
+ }
50
+ }, _callee, this);
51
+ }));
52
+ function processWalletPayment(_x, _x2, _x3) {
53
+ return _processWalletPayment.apply(this, arguments);
54
+ }
55
+ return processWalletPayment;
56
+ }()
57
+ }, {
58
+ key: "getWalletBalance",
59
+ value: function () {
60
+ var _getWalletBalance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(voucherId) {
61
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
62
+ while (1) switch (_context2.prev = _context2.next) {
63
+ case 0:
64
+ return _context2.abrupt("return", 0);
65
+ case 1:
66
+ case "end":
67
+ return _context2.stop();
68
+ }
69
+ }, _callee2);
70
+ }));
71
+ function getWalletBalance(_x4) {
72
+ return _getWalletBalance.apply(this, arguments);
73
+ }
74
+ return getWalletBalance;
75
+ }()
76
+ }]);
77
+ return WalletPaymentImpl;
78
+ }();
File without changes
File without changes
@@ -1,6 +1,5 @@
1
1
  import { Module, PisellCore } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
- import { Product } from '../Product';
4
3
  import { ProductData } from '../Product/types';
5
4
  export * from './types';
6
5
  export declare class ProductList extends BaseModule implements Module {
@@ -8,15 +7,21 @@ export declare class ProductList extends BaseModule implements Module {
8
7
  protected defaultVersion: string;
9
8
  private store;
10
9
  private request;
10
+ private otherParams;
11
11
  constructor(name?: string, version?: string);
12
12
  initialize(core: PisellCore, options: any): Promise<void>;
13
13
  storeChange(path?: string, value?: any): Promise<void>;
14
- loadProducts({ category_ids, product_ids, collection, schedule_date, cacheId }: {
14
+ loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, }: {
15
15
  category_ids?: number[];
16
16
  product_ids?: number[];
17
17
  collection?: number | string[];
18
18
  schedule_date?: string;
19
19
  cacheId?: string;
20
+ customer_id?: number;
21
+ menu_list_ids?: number[];
22
+ schedule_datetime?: string;
23
+ with_count?: string[];
24
+ with_schedule?: number;
20
25
  }): Promise<any>;
21
26
  loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
22
27
  ids?: number[];
@@ -25,7 +30,13 @@ export declare class ProductList extends BaseModule implements Module {
25
30
  channel?: string;
26
31
  }): Promise<any>;
27
32
  getProducts(): Promise<ProductData[]>;
28
- getProduct(id: number): Promise<Product | undefined>;
33
+ getProduct(id: number): Promise<ProductData | undefined>;
29
34
  addProduct(products: ProductData[]): Promise<void>;
30
35
  selectProducts(products: ProductData[]): Promise<void>;
36
+ /**
37
+ * 根据商品编码或条码搜索商品
38
+ * @param code 商品编码或条码
39
+ * @returns 匹配的商品列表,如果没有匹配则返回空数组
40
+ */
41
+ findProductsByCodeOrBarcode(code: string): ProductData[];
31
42
  }
@@ -16,7 +16,6 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
16
16
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
17
17
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
18
  import { BaseModule } from "../BaseModule";
19
- import { Product } from "../Product";
20
19
  import { ProductListHooks } from "./types";
21
20
  import { cloneDeep } from 'lodash-es';
22
21
  export * from "./types";
@@ -31,6 +30,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
31
30
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
32
31
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
33
32
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
33
+ _defineProperty(_assertThisInitialized(_this), "otherParams", {});
34
34
  return _this;
35
35
  }
36
36
  _createClass(ProductList, [{
@@ -43,17 +43,18 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
43
43
  case 0:
44
44
  this.core = core;
45
45
  this.store = options.store;
46
+ this.otherParams = options.otherParams || {};
46
47
  if (Array.isArray((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.list)) {
47
- this.store.list = options.initialState.list;
48
+ this.store.list = options.initialState.list.slice().sort(function (a, b) {
49
+ return Number(b.sort) - Number(a.sort);
50
+ });
48
51
  this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
49
- this.storeChange();
50
52
  } else {
51
53
  this.store.list = [];
52
- this.store.productMap = new Map();
53
54
  this.store.selectProducts = [];
54
55
  }
55
56
  this.request = core.getPlugin('request');
56
- case 4:
57
+ case 5:
57
58
  case "end":
58
59
  return _context.stop();
59
60
  }
@@ -68,28 +69,13 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
68
69
  key: "storeChange",
69
70
  value: function () {
70
71
  var _storeChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path, value) {
71
- var _this$store$list,
72
- _this2 = this;
73
72
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
74
73
  while (1) switch (_context2.prev = _context2.next) {
75
74
  case 0:
76
- (_this$store$list = this.store.list) === null || _this$store$list === void 0 || _this$store$list.forEach(function (product) {
77
- var productModule = _this2.store.productMap.get("product-".concat(product.id));
78
- if (!productModule) {
79
- var newProductModule = new Product("product_".concat(product.id.toString()));
80
- _this2.core.registerModule(newProductModule, {
81
- initialState: product
82
- });
83
- _this2.store.productMap.set(product.id.toString(), newProductModule);
84
- } else {
85
- productModule.updateData(product);
86
- }
87
- });
88
- case 1:
89
75
  case "end":
90
76
  return _context2.stop();
91
77
  }
92
- }, _callee2, this);
78
+ }, _callee2);
93
79
  }));
94
80
  function storeChange(_x3, _x4) {
95
81
  return _storeChange.apply(this, arguments);
@@ -100,11 +86,12 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
100
86
  key: "loadProducts",
101
87
  value: function () {
102
88
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
103
- var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, schedule_date, cacheId, userPlugin, customer_id, _userPlugin$get, productsData;
89
+ var _this$otherParams;
90
+ var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$menu_list_ids, menu_list_ids, paramsCustomerId, _ref$with_count, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, userPlugin, customer_id, _userPlugin$get, productsData, sortedList;
104
91
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
105
92
  while (1) switch (_context3.prev = _context3.next) {
106
93
  case 0:
107
- _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId;
94
+ _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule;
108
95
  // // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
109
96
  // if (!schedule_ids?.length) {
110
97
  // const schedule_ids_data = this.store.schedule
@@ -120,7 +107,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
120
107
  userPlugin = this.core.getPlugin('user');
121
108
  customer_id = undefined;
122
109
  try {
123
- customer_id = userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get()) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id;
110
+ customer_id = paramsCustomerId || (userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get()) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id);
124
111
  } catch (error) {
125
112
  console.error(error);
126
113
  }
@@ -139,16 +126,24 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
139
126
  ids: product_ids,
140
127
  collection: collection,
141
128
  front_end_cache_id: cacheId,
129
+ menu_list_ids: menu_list_ids,
130
+ with_count: with_count,
142
131
  // client_schedule_ids: schedule_ids,
143
- schedule_date: schedule_date
132
+ schedule_date: schedule_date,
133
+ with_schedule: with_schedule,
134
+ schedule_datetime: schedule_datetime,
135
+ application_code: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel
144
136
  }, {
145
137
  useCache: true
146
138
  });
147
139
  case 6:
148
140
  productsData = _context3.sent;
149
- this.addProduct(productsData.data.list);
150
- return _context3.abrupt("return", productsData.data.list);
151
- case 9:
141
+ sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
142
+ return Number(b.sort) - Number(a.sort);
143
+ });
144
+ this.addProduct(sortedList);
145
+ return _context3.abrupt("return", sortedList);
146
+ case 10:
152
147
  case "end":
153
148
  return _context3.stop();
154
149
  }
@@ -224,15 +219,11 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
224
219
  _context6.next = 2;
225
220
  return this.core.effects.emit(ProductListHooks.onGetProduct, this.store.list);
226
221
  case 2:
227
- product = this.store.productMap.get("".concat(id));
228
- if (!product) {
229
- _context6.next = 5;
230
- break;
231
- }
232
- return _context6.abrupt("return", product);
233
- case 5:
234
- return _context6.abrupt("return", undefined);
235
- case 6:
222
+ product = this.store.list.find(function (product) {
223
+ return product.id === id;
224
+ });
225
+ return _context6.abrupt("return", product ? cloneDeep(product) : undefined);
226
+ case 4:
236
227
  case "end":
237
228
  return _context6.stop();
238
229
  }
@@ -247,27 +238,30 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
247
238
  key: "addProduct",
248
239
  value: function () {
249
240
  var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(products) {
250
- var _this3 = this;
241
+ var _this2 = this;
251
242
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
252
243
  while (1) switch (_context7.prev = _context7.next) {
253
244
  case 0:
254
- // 加到 list 以后上面的storeChange 会自动初始化商品详情的 module 实例
255
245
  // list 需要根据 id 去重
256
246
  if (!this.store.list) {
257
247
  this.store.list = [];
258
248
  }
259
249
  products.forEach(function (n) {
260
- var index = _this3.store.list.findIndex(function (m) {
250
+ var index = _this2.store.list.findIndex(function (m) {
261
251
  return m.id === n.id;
262
252
  });
263
253
  if (index === -1) {
264
- _this3.store.list.push(n);
254
+ _this2.store.list.push(n);
265
255
  } else {
266
- _this3.store.list[index] = n;
256
+ _this2.store.list[index] = n;
267
257
  }
268
258
  });
269
- this.storeChange();
270
- case 3:
259
+ // 根据 sort 值做降序排序(数字越大越靠前)
260
+ this.store.list.sort(function (a, b) {
261
+ return Number(b.sort) - Number(a.sort);
262
+ });
263
+ this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
264
+ case 4:
271
265
  case "end":
272
266
  return _context7.stop();
273
267
  }
@@ -297,6 +291,26 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
297
291
  }
298
292
  return selectProducts;
299
293
  }()
294
+ /**
295
+ * 根据商品编码或条码搜索商品
296
+ * @param code 商品编码或条码
297
+ * @returns 匹配的商品列表,如果没有匹配则返回空数组
298
+ */
299
+ }, {
300
+ key: "findProductsByCodeOrBarcode",
301
+ value: function findProductsByCodeOrBarcode(code) {
302
+ if (!code || typeof code !== 'string') {
303
+ return [];
304
+ }
305
+ var trimmedCode = code.trim();
306
+ if (!trimmedCode) {
307
+ return [];
308
+ }
309
+ var matchingProducts = this.store.list.filter(function (product) {
310
+ return product.code && product.code.trim() === trimmedCode || product.barcode && product.barcode.trim() === trimmedCode;
311
+ });
312
+ return cloneDeep(matchingProducts);
313
+ }
300
314
  }]);
301
315
  return ProductList;
302
316
  }(BaseModule);
@@ -1,7 +1,6 @@
1
1
  import { ProductData } from '../Product/types';
2
2
  export interface ProductListData {
3
3
  list: ProductData[];
4
- productMap: Map<string, any>;
5
4
  selectProducts: ProductData[];
6
5
  }
7
6
  export declare enum ProductListHooks {
@@ -28,6 +28,7 @@ import { RulesHooks } from "./types";
28
28
  import { uniqueById } from "../../solution/ShopDiscount/utils";
29
29
  import { getProductOriginTotalPrice, getProductTotalPrice } from "../Cart/utils";
30
30
  import Decimal from 'decimal.js';
31
+ import { isBoolean } from 'lodash-es';
31
32
  export var RulesModule = /*#__PURE__*/function (_BaseModule) {
32
33
  _inherits(RulesModule, _BaseModule);
33
34
  var _super = _createSuper(RulesModule);
@@ -296,19 +297,25 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
296
297
 
297
298
  // 记录可抵扣的商品详情
298
299
  var applicableProducts = discountApplicableProducts.get(discount.id) || [];
299
- applicableProducts.push({
300
+ var discountType = discount.tag || discount.type;
301
+ var productData = {
300
302
  amount: product.price,
301
- type: discount.tag || discount.type,
302
- tag: discount.tag || discount.type,
303
+ type: discountType,
304
+ tag: discountType,
303
305
  discount: {
304
306
  resource_id: discount.id,
305
307
  title: discount.format_title,
306
308
  original_amount: product.origin_total,
307
309
  pre_value: discount.par_value,
308
310
  product_id: originProduct.id
309
- },
310
- num: product.num || 1
311
- });
311
+ }
312
+ };
313
+
314
+ // 如果 discount.tag 或者 discount.type 是 good_pass,则不需要添加 num 属性
315
+ if (discountType !== 'good_pass') {
316
+ productData.num = product.num || 1;
317
+ }
318
+ applicableProducts.push(productData);
312
319
  discountApplicableProducts.set(discount.id, applicableProducts);
313
320
  }
314
321
  });
@@ -330,10 +337,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
330
337
  var applicableDiscounts = sortedDiscountList.filter(function (discount) {
331
338
  var _product$discount_lis6;
332
339
  // 如果商品价格为 0,其实不需要使用任何优惠券,直接 return true
333
- // 商品券时主商品价格为0不可用
334
- if ((Number(product.price) === 0 || !product.price) && (discount.tag || discount.type) === 'good_pass') return false;
335
- // 折扣卡时总价为0时不可用
336
- if ((Number(product.total) === 0 || !product.total) && !((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.find(function (n) {
340
+ // 商品券时主商品价格小于等于0不可用
341
+ if ((Number(product.price) <= 0 || !product.price) && (discount.tag || discount.type) === 'good_pass') return false;
342
+ // 折扣卡时总价小于等于0时不可用
343
+ if ((Number(product.total) <= 0 || !product.total) && !((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.find(function (n) {
337
344
  var _n$discount;
338
345
  return ((_n$discount = n.discount) === null || _n$discount === void 0 ? void 0 : _n$discount.resource_id) === discount.id;
339
346
  })) && (discount.tag || discount.type) !== 'good_pass') return false;
@@ -373,7 +380,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
373
380
  }
374
381
 
375
382
  // 如果没有适用的优惠券,或者手动折扣,则不适用优惠券
376
- if (applicableDiscounts.length === 0 || isManualDiscount) {
383
+ // 自定义商品:如果未开启适用折扣卡(product.vouchersApplicable),则不适用优惠券
384
+ if (applicableDiscounts.length === 0 || isManualDiscount || isBoolean(product.vouchersApplicable) && !product.vouchersApplicable) {
377
385
  if (product.isClient) {
378
386
  processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {} : {
379
387
  origin_total: getProductOriginTotalPrice({
@@ -449,18 +457,23 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
449
457
 
450
458
  // 计算使用折扣卡/商品券以后,单个商品的总 total
451
459
  var targetProductTotal = _selectedDiscount.tag === 'good_pass' ? new Decimal(productOriginTotal).minus(new Decimal(product.price || 0)).toNumber() : new Decimal(100).minus(_selectedDiscount.par_value || 0).div(100).mul(new Decimal(productOriginTotal)).toNumber();
460
+ var discountType = _selectedDiscount.tag === 'product_discount_card' ? 'discount_card' : _selectedDiscount.tag;
452
461
  var discountDetail = {
453
462
  amount: new Decimal(productOriginTotal).minus(new Decimal(targetProductTotal)).toNumber(),
454
- type: _selectedDiscount.tag === 'product_discount_card' ? 'discount_card' : _selectedDiscount.tag,
463
+ type: discountType,
455
464
  discount: {
456
465
  resource_id: _selectedDiscount.id,
457
466
  title: _selectedDiscount.format_title,
458
467
  original_amount: productOriginTotal,
459
468
  product_id: originProduct.id,
460
469
  percent: _selectedDiscount.par_value
461
- },
462
- num: product.num || 1
470
+ }
463
471
  };
472
+
473
+ // 如果 discount.tag 或者 discount.type 是 good_pass,则不需要添加 num 属性
474
+ if ((_selectedDiscount.tag || _selectedDiscount.type) !== 'good_pass') {
475
+ discountDetail.num = product.num || 1;
476
+ }
464
477
  appliedProducts.push(discountDetail);
465
478
  appliedDiscountProducts.set(_selectedDiscount.id, appliedProducts);
466
479
 
@@ -39,6 +39,7 @@ type ProductDetail = {
39
39
  original_price?: number | string;
40
40
  num?: number;
41
41
  quantity: number;
42
+ vouchersApplicable?: boolean;
42
43
  };
43
44
  export interface RulesParamsHooks {
44
45
  getProduct: (product: Record<string, any>) => ProductDetail;
@@ -3,6 +3,7 @@ export * from './ProductList';
3
3
  export * from './Cart';
4
4
  export * from './Account';
5
5
  export * from './AccountList';
6
+ export * from './Customer';
6
7
  export * from './Date';
7
8
  export * from './Guests';
8
9
  export * from './Order';
@@ -3,6 +3,7 @@ export * from "./ProductList";
3
3
  export * from "./Cart";
4
4
  export * from "./Account";
5
5
  export * from "./AccountList";
6
+ export * from "./Customer";
6
7
  export * from "./Date";
7
8
  export * from "./Guests";
8
9
  export * from "./Order";
@@ -0,0 +1,83 @@
1
+ import { RouterManager } from '../routes';
2
+ import { ApplicationManager } from '../applicationManager';
3
+ import { History, HistoryOptions } from '../history';
4
+ import { Data } from '../data';
5
+ import { Locales, LocalesOptions } from '../locales';
6
+ import { Storage, StorageOptions } from '../storage';
7
+ import { MenuManager } from '../menuManager';
8
+ import LoggerManager, { LoggerOptions } from '../logger';
9
+ import { TasksManager } from '../tasks';
10
+ import IndexDBManager, { DBOptions } from '../indexDB';
11
+ declare global {
12
+ interface Window {
13
+ app: App;
14
+ }
15
+ }
16
+ export interface AppOptions {
17
+ logger?: LoggerOptions;
18
+ db?: DBOptions;
19
+ constants?: any;
20
+ history?: HistoryOptions;
21
+ storage?: StorageOptions;
22
+ locales?: LocalesOptions;
23
+ }
24
+ declare class App {
25
+ private static instance;
26
+ private plugins;
27
+ globalData: any;
28
+ router: RouterManager;
29
+ applicationManager: ApplicationManager;
30
+ history: History;
31
+ data: Data;
32
+ hooks: import("../hooks").HooksExport;
33
+ locales: Locales;
34
+ models: {
35
+ getStore: () => import("../models").Store;
36
+ StoreProvider: typeof import("react-redux").Provider;
37
+ setConfig: (models: any[]) => void;
38
+ };
39
+ request: {
40
+ get: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
41
+ post: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
42
+ put: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
43
+ remove: (url: import("../request").RequestWrapperProps["url"], data: import("../request").RequestWrapperProps["data"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
44
+ custom: (url: import("../request").RequestWrapperProps["url"], config: import("../request").RequestWrapperProps["config"]) => Promise<any>;
45
+ setConfig: (newConfig: Partial<import("../request").RequestConfig>) => void;
46
+ getConfig: () => import("../request").RequestConfig;
47
+ };
48
+ storage: Storage;
49
+ menuManager: MenuManager;
50
+ cookie: {
51
+ setCookie: (name: string, value: string, domain?: string) => void;
52
+ getCookie: (name: string) => string | null;
53
+ deleteCookie: (name: string, domain?: string) => void;
54
+ checkCookie: (name: string) => boolean;
55
+ updateCookie: (name: string, value: string, domain?: string) => void;
56
+ };
57
+ website: {
58
+ setTitle: (title: string) => void;
59
+ setIcon: (paramsIcon: string) => void;
60
+ setAppleWebAppTitle: (title: string) => void;
61
+ };
62
+ logger: LoggerManager;
63
+ pubsub: import("../pubsub").PubSub;
64
+ tasksManager: TasksManager;
65
+ dbManager: IndexDBManager | null;
66
+ constants: {
67
+ channel: string;
68
+ [key: string]: string;
69
+ };
70
+ private constructor();
71
+ static getInstance(options?: AppOptions): App;
72
+ setGlobalData(globalData: any): void;
73
+ usePlugin(name: string, plugin: any): void;
74
+ usePlugins(plugins: {
75
+ name: string;
76
+ plugin: any;
77
+ }[]): void;
78
+ getPlugin(name: string): any;
79
+ getGlobalData(): any;
80
+ install(): void;
81
+ unInstall(): void;
82
+ }
83
+ export default App;
@@ -0,0 +1,4 @@
1
+ export declare enum APPEvent {
2
+ APP_INSTALL = "app.install",
3
+ APP_UNINSTALL = "app.uninstall"
4
+ }
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import App, { AppOptions } from "./app";
3
+ type AppContextType = {
4
+ globalData: any;
5
+ setGlobalData: React.Dispatch<React.SetStateAction<any>>;
6
+ app: App;
7
+ };
8
+ export declare const AppProvider: React.FC<{
9
+ children: React.ReactNode;
10
+ options: AppOptions;
11
+ }>;
12
+ export declare const useApp: () => AppContextType;
13
+ export declare const getApp: typeof App.getInstance;
14
+ export default App;
@@ -0,0 +1,50 @@
1
+ import App from "../app";
2
+ import { LoadLibraryByUrlParams } from "../locales/type";
3
+ import { MenuItem } from "../menuManager/index";
4
+ export type ApplicationInterface = {
5
+ page_type: "low_code" | "code";
6
+ page_id: number | string;
7
+ page_code: string;
8
+ page_version?: string;
9
+ page_name: string;
10
+ router: string;
11
+ category: "page" | "component" | "function";
12
+ Component?: any;
13
+ children?: any;
14
+ layout?: string;
15
+ originalUrl?: string;
16
+ };
17
+ export type ApplicationData = {
18
+ app_id: number;
19
+ app_name: string;
20
+ app_type: "system" | "custom";
21
+ interfaces: ApplicationInterface[];
22
+ functions?: any[];
23
+ menu?: {
24
+ [key: string]: MenuItem[];
25
+ };
26
+ locales?: LoadLibraryByUrlParams;
27
+ [key: string]: any;
28
+ };
29
+ export declare class Application {
30
+ options: ApplicationData;
31
+ name: ApplicationData["app_name"];
32
+ interfaces: Map<ApplicationInterface["page_name"], ApplicationInterface>;
33
+ components: Map<string, any>;
34
+ functions: Map<string, any>;
35
+ app: App;
36
+ constructor(options: ApplicationData, app: App);
37
+ afterAdd(application: Application): Promise<void>;
38
+ beforeLoad(): Promise<void>;
39
+ load(): Promise<void>;
40
+ initInterfaces(interfaces: ApplicationData["interfaces"]): void;
41
+ initFunctions(functions: ApplicationData["functions"]): void;
42
+ loadInterface(interfaceItem: ApplicationInterface): Promise<ApplicationInterface>;
43
+ setInterface(code: string, interfaceItem: ApplicationInterface): void;
44
+ setComponent(code: string, component: ApplicationInterface): void;
45
+ setFunction(code: string, functionItem: ApplicationInterface): void;
46
+ getInterface(code: string): ApplicationInterface | undefined;
47
+ getComponent(code: string): any;
48
+ getFunction(code: string): any;
49
+ runFunction(code: string, params?: any, ...args: any): any;
50
+ }