@pisell/pisellos 2.1.118 → 2.1.120

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 (232) hide show
  1. package/dist/apis/picoding.d.ts +0 -0
  2. package/dist/apis/picoding.js +1 -0
  3. package/dist/index.d.ts +0 -1
  4. package/dist/index.js +0 -1
  5. package/dist/model/strategy/adapter/index.d.ts +4 -0
  6. package/dist/model/strategy/adapter/index.js +4 -1
  7. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
  8. package/dist/model/strategy/adapter/itemRule/adapter.js +439 -0
  9. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
  10. package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
  11. package/dist/model/strategy/adapter/itemRule/examples.d.ts +64 -0
  12. package/dist/model/strategy/adapter/itemRule/examples.js +315 -0
  13. package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
  14. package/dist/model/strategy/adapter/itemRule/index.js +5 -0
  15. package/dist/model/strategy/adapter/itemRule/type.d.ts +206 -0
  16. package/dist/model/strategy/adapter/itemRule/type.js +101 -0
  17. package/dist/model/strategy/adapter/promotion/adapter.d.ts +66 -0
  18. package/dist/model/strategy/adapter/promotion/adapter.js +271 -0
  19. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
  20. package/dist/model/strategy/adapter/promotion/evaluator.js +1206 -0
  21. package/dist/model/strategy/adapter/promotion/examples.d.ts +138 -0
  22. package/dist/model/strategy/adapter/promotion/examples.js +166 -0
  23. package/dist/model/strategy/adapter/promotion/index.d.ts +4 -0
  24. package/dist/model/strategy/adapter/promotion/index.js +0 -0
  25. package/dist/model/strategy/adapter/promotion/type.d.ts +447 -0
  26. package/dist/model/strategy/adapter/promotion/type.js +209 -0
  27. package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -1
  28. package/dist/model/strategy/engine.d.ts +106 -0
  29. package/dist/model/strategy/engine.js +611 -0
  30. package/dist/model/strategy/index.d.ts +2 -93
  31. package/dist/model/strategy/index.js +6 -549
  32. package/dist/modules/Cart/types.d.ts +0 -2
  33. package/dist/modules/Cart/utils/cartProduct.js +25 -56
  34. package/dist/modules/Discount/types.d.ts +0 -18
  35. package/dist/modules/OpenData/index.d.ts +23 -0
  36. package/dist/modules/OpenData/index.js +167 -0
  37. package/dist/modules/OpenData/types.d.ts +73 -0
  38. package/dist/modules/OpenData/types.js +1 -0
  39. package/dist/modules/OpenData/utils.d.ts +2 -0
  40. package/dist/modules/OpenData/utils.js +75 -0
  41. package/dist/modules/Order/index.d.ts +58 -1
  42. package/dist/modules/Order/index.js +780 -29
  43. package/dist/modules/Order/types.d.ts +144 -12
  44. package/dist/modules/Order/utils.d.ts +25 -0
  45. package/dist/modules/Order/utils.js +225 -1
  46. package/dist/modules/Payment/index.d.ts +1 -2
  47. package/dist/modules/Payment/index.js +7 -10
  48. package/dist/modules/Payment/utils.js +0 -3
  49. package/dist/modules/Payment/walletpass.d.ts +0 -23
  50. package/dist/modules/Payment/walletpass.js +95 -191
  51. package/dist/modules/Product/utils.js +2 -2
  52. package/dist/modules/ProductList/index.d.ts +1 -1
  53. package/dist/modules/ProductList/index.js +2 -1
  54. package/dist/modules/Quotation/index.d.ts +48 -0
  55. package/dist/modules/Quotation/index.js +245 -0
  56. package/dist/modules/Quotation/types.d.ts +42 -0
  57. package/dist/modules/Quotation/types.js +1 -0
  58. package/dist/modules/Rules/index.d.ts +5 -9
  59. package/dist/modules/Rules/index.js +164 -673
  60. package/dist/modules/Rules/types.d.ts +0 -2
  61. package/dist/modules/SalesSummary/index.d.ts +63 -0
  62. package/dist/modules/SalesSummary/index.js +174 -0
  63. package/dist/modules/SalesSummary/types.d.ts +59 -0
  64. package/dist/modules/SalesSummary/types.js +1 -0
  65. package/dist/modules/SalesSummary/utils.d.ts +30 -0
  66. package/dist/modules/SalesSummary/utils.js +513 -0
  67. package/dist/modules/ScanOrderLogger/index.d.ts +21 -0
  68. package/dist/modules/ScanOrderLogger/index.js +161 -0
  69. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  70. package/dist/modules/ScanOrderLogger/providers/feishu.js +95 -0
  71. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  72. package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
  73. package/dist/modules/ScanOrderLogger/types.d.ts +46 -0
  74. package/dist/modules/ScanOrderLogger/types.js +1 -0
  75. package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
  76. package/dist/modules/Summary/types.d.ts +0 -2
  77. package/dist/modules/Summary/utils.d.ts +3 -9
  78. package/dist/modules/Summary/utils.js +4 -25
  79. package/dist/modules/index.d.ts +4 -0
  80. package/dist/modules/index.js +5 -1
  81. package/dist/plugins/window.d.ts +0 -2
  82. package/dist/solution/BookingByStep/index.d.ts +1 -2
  83. package/dist/solution/BookingByStep/index.js +44 -42
  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/timeslots.d.ts +3 -1
  87. package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
  88. package/dist/solution/Checkout/index.js +0 -2
  89. package/dist/solution/ScanOrder/index.d.ts +90 -0
  90. package/dist/solution/ScanOrder/index.js +1853 -0
  91. package/dist/solution/ScanOrder/types.d.ts +210 -0
  92. package/dist/solution/ScanOrder/types.js +16 -0
  93. package/dist/solution/ScanOrder/utils.d.ts +93 -0
  94. package/dist/solution/ScanOrder/utils.js +397 -0
  95. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  96. package/dist/solution/ShopDiscount/index.js +7 -23
  97. package/dist/solution/ShopDiscount/types.d.ts +0 -1
  98. package/dist/solution/ShopDiscount/types.js +1 -2
  99. package/dist/solution/ShopDiscount/utils.js +12 -26
  100. package/dist/solution/VenueBooking/index.d.ts +158 -0
  101. package/dist/solution/VenueBooking/index.js +2873 -0
  102. package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
  103. package/dist/solution/VenueBooking/types.d.ts +130 -0
  104. package/dist/solution/VenueBooking/types.js +21 -0
  105. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
  106. package/dist/solution/VenueBooking/utils/dateSummary.js +102 -0
  107. package/dist/solution/VenueBooking/utils/resource.d.ts +4 -0
  108. package/dist/solution/VenueBooking/utils/resource.js +94 -0
  109. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
  110. package/dist/solution/VenueBooking/utils/slotMerge.js +204 -0
  111. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
  112. package/dist/solution/VenueBooking/utils/timeSlot.js +256 -0
  113. package/dist/solution/VenueBooking/utils.d.ts +1 -0
  114. package/dist/solution/VenueBooking/utils.js +1 -0
  115. package/dist/solution/index.d.ts +2 -0
  116. package/dist/solution/index.js +3 -1
  117. package/lib/apis/picoding.d.ts +0 -0
  118. package/lib/apis/picoding.js +0 -0
  119. package/lib/index.d.ts +0 -1
  120. package/lib/index.js +1 -3
  121. package/lib/model/strategy/adapter/index.d.ts +4 -0
  122. package/lib/model/strategy/adapter/index.js +12 -0
  123. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
  124. package/lib/model/strategy/adapter/itemRule/adapter.js +338 -0
  125. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
  126. package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
  127. package/lib/model/strategy/adapter/itemRule/examples.d.ts +64 -0
  128. package/lib/model/strategy/adapter/itemRule/examples.js +269 -0
  129. package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
  130. package/lib/model/strategy/adapter/itemRule/index.js +58 -0
  131. package/lib/model/strategy/adapter/itemRule/type.d.ts +206 -0
  132. package/lib/model/strategy/adapter/itemRule/type.js +46 -0
  133. package/lib/model/strategy/adapter/promotion/adapter.d.ts +66 -0
  134. package/lib/model/strategy/adapter/promotion/adapter.js +217 -0
  135. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
  136. package/lib/model/strategy/adapter/promotion/evaluator.js +844 -0
  137. package/lib/model/strategy/adapter/promotion/examples.d.ts +138 -0
  138. package/lib/model/strategy/adapter/promotion/examples.js +192 -0
  139. package/lib/model/strategy/adapter/promotion/index.d.ts +4 -0
  140. package/lib/model/strategy/adapter/promotion/index.js +0 -0
  141. package/lib/model/strategy/adapter/promotion/type.d.ts +447 -0
  142. package/lib/model/strategy/adapter/promotion/type.js +51 -0
  143. package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -1
  144. package/lib/model/strategy/engine.d.ts +106 -0
  145. package/lib/model/strategy/engine.js +450 -0
  146. package/lib/model/strategy/index.d.ts +2 -93
  147. package/lib/model/strategy/index.js +6 -381
  148. package/lib/modules/Cart/types.d.ts +0 -2
  149. package/lib/modules/Cart/utils/cartProduct.js +12 -39
  150. package/lib/modules/Discount/types.d.ts +0 -18
  151. package/lib/modules/OpenData/index.d.ts +23 -0
  152. package/lib/modules/OpenData/index.js +116 -0
  153. package/lib/modules/OpenData/types.d.ts +73 -0
  154. package/lib/modules/OpenData/types.js +17 -0
  155. package/lib/modules/OpenData/utils.d.ts +2 -0
  156. package/lib/modules/OpenData/utils.js +111 -0
  157. package/lib/modules/Order/index.d.ts +58 -1
  158. package/lib/modules/Order/index.js +423 -1
  159. package/lib/modules/Order/types.d.ts +144 -12
  160. package/lib/modules/Order/utils.d.ts +25 -0
  161. package/lib/modules/Order/utils.js +229 -0
  162. package/lib/modules/Payment/index.d.ts +1 -2
  163. package/lib/modules/Payment/index.js +0 -1
  164. package/lib/modules/Payment/utils.js +0 -3
  165. package/lib/modules/Payment/walletpass.d.ts +0 -23
  166. package/lib/modules/Payment/walletpass.js +17 -94
  167. package/lib/modules/Product/utils.js +2 -2
  168. package/lib/modules/ProductList/index.d.ts +1 -1
  169. package/lib/modules/ProductList/index.js +2 -1
  170. package/lib/modules/Quotation/index.d.ts +48 -0
  171. package/lib/modules/Quotation/index.js +149 -0
  172. package/lib/modules/Quotation/types.d.ts +42 -0
  173. package/lib/modules/Quotation/types.js +17 -0
  174. package/lib/modules/Rules/index.d.ts +5 -9
  175. package/lib/modules/Rules/index.js +286 -778
  176. package/lib/modules/Rules/types.d.ts +0 -2
  177. package/lib/modules/SalesSummary/index.d.ts +63 -0
  178. package/lib/modules/SalesSummary/index.js +105 -0
  179. package/lib/modules/SalesSummary/types.d.ts +59 -0
  180. package/lib/modules/SalesSummary/types.js +17 -0
  181. package/lib/modules/SalesSummary/utils.d.ts +30 -0
  182. package/lib/modules/SalesSummary/utils.js +452 -0
  183. package/lib/modules/ScanOrderLogger/index.d.ts +21 -0
  184. package/lib/modules/ScanOrderLogger/index.js +135 -0
  185. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  186. package/lib/modules/ScanOrderLogger/providers/feishu.js +82 -0
  187. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  188. package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
  189. package/lib/modules/ScanOrderLogger/types.d.ts +46 -0
  190. package/lib/modules/ScanOrderLogger/types.js +17 -0
  191. package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
  192. package/lib/modules/Summary/types.d.ts +0 -2
  193. package/lib/modules/Summary/utils.d.ts +3 -9
  194. package/lib/modules/Summary/utils.js +4 -19
  195. package/lib/modules/index.d.ts +4 -0
  196. package/lib/modules/index.js +9 -1
  197. package/lib/plugins/window.d.ts +0 -2
  198. package/lib/solution/BookingByStep/index.d.ts +1 -2
  199. package/lib/solution/BookingByStep/index.js +4 -2
  200. package/lib/solution/BookingByStep/types.d.ts +3 -1
  201. package/lib/solution/BookingByStep/types.js +10 -0
  202. package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  203. package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
  204. package/lib/solution/Checkout/index.js +0 -2
  205. package/lib/solution/ScanOrder/index.d.ts +90 -0
  206. package/lib/solution/ScanOrder/index.js +1071 -0
  207. package/lib/solution/ScanOrder/types.d.ts +210 -0
  208. package/lib/solution/ScanOrder/types.js +36 -0
  209. package/lib/solution/ScanOrder/utils.d.ts +93 -0
  210. package/lib/solution/ScanOrder/utils.js +359 -0
  211. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  212. package/lib/solution/ShopDiscount/index.js +8 -22
  213. package/lib/solution/ShopDiscount/types.d.ts +0 -1
  214. package/lib/solution/ShopDiscount/utils.js +6 -10
  215. package/lib/solution/VenueBooking/index.d.ts +158 -0
  216. package/lib/solution/VenueBooking/index.js +1545 -0
  217. package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
  218. package/lib/solution/VenueBooking/types.d.ts +130 -0
  219. package/lib/solution/VenueBooking/types.js +44 -0
  220. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
  221. package/lib/solution/VenueBooking/utils/dateSummary.js +101 -0
  222. package/lib/solution/VenueBooking/utils/resource.d.ts +4 -0
  223. package/lib/solution/VenueBooking/utils/resource.js +80 -0
  224. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
  225. package/lib/solution/VenueBooking/utils/slotMerge.js +209 -0
  226. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
  227. package/lib/solution/VenueBooking/utils/timeSlot.js +200 -0
  228. package/lib/solution/VenueBooking/utils.d.ts +1 -0
  229. package/lib/solution/VenueBooking/utils.js +69 -0
  230. package/lib/solution/index.d.ts +2 -0
  231. package/lib/solution/index.js +5 -1
  232. package/package.json +1 -1
@@ -0,0 +1,397 @@
1
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
+ function _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; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
5
+ 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); }
6
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
7
+ 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."); }
8
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+ 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); }
11
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
12
+ 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); }
13
+ 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; }
14
+ /**
15
+ * 构建金额全为 0 的空 summary。
16
+ * 作为尚未计算金额时的兜底默认值,避免下游因 undefined 报错。
17
+ */
18
+ export function createEmptySummary() {
19
+ return {
20
+ product_quantity: 0,
21
+ product_original_amount: '0.00',
22
+ product_amount: '0.00',
23
+ product_expect_amount: '0.00',
24
+ product_tax_fee: '0.00',
25
+ shipping_fee: '0.00',
26
+ shipping_tax_fee: '0.00',
27
+ tax_fee: '0.00',
28
+ surcharge_fee: '0.00',
29
+ discount_amount: '0.00',
30
+ deposit_amount: '0.00',
31
+ expect_amount: '0.00',
32
+ total_amount: '0.00',
33
+ amount_gap: '0.00',
34
+ rounding_amount: '0.00',
35
+ pay_service_charge_amount: '0.00'
36
+ };
37
+ }
38
+
39
+ /**
40
+ * 商品数量安全取值。
41
+ * - NaN / undefined / < 1 均视作 1(最低起订量)
42
+ * - 有值时取整(不支持小数数量)
43
+ */
44
+ export function getSafeProductNum(num) {
45
+ if (!num || Number.isNaN(num)) return 1;
46
+ if (num < 1) return 1;
47
+ return Math.floor(num);
48
+ }
49
+
50
+ /**
51
+ * 宽松布尔值转换。
52
+ * 兼容后端/配置中心常见的 boolean / number / string 表达,统一归一成 true/false。
53
+ */
54
+ export function toBoolean(value) {
55
+ if (typeof value === 'boolean') return value;
56
+ if (typeof value === 'number') return value !== 0;
57
+ if (typeof value === 'string') {
58
+ var normalized = value.trim().toLowerCase();
59
+ return ['1', 'true', 'yes', 'y', 'on'].includes(normalized);
60
+ }
61
+ return false;
62
+ }
63
+
64
+ /**
65
+ * 将值归一化为有效的正向字符串。
66
+ * null / undefined / 空串 / '0' / 'null' 统一视为无效值并返回 undefined。
67
+ */
68
+ export function toPositiveString(value) {
69
+ if (value === null || value === undefined || value === '') return undefined;
70
+ var normalized = String(value).trim();
71
+ if (!normalized || normalized === '0' || normalized.toLowerCase() === 'null') {
72
+ return undefined;
73
+ }
74
+ return normalized;
75
+ }
76
+
77
+ /**
78
+ * 归一化 item rule 策略模型 ID 列表。
79
+ * - 支持 string / number 混合输入
80
+ * - 仅保留 > 0 的合法数字
81
+ * - 自动去重
82
+ */
83
+ export function normalizeEnabledItemRuleIds(rawIds) {
84
+ if (!Array.isArray(rawIds)) return [];
85
+ var uniqueIds = new Set();
86
+ var _iterator = _createForOfIteratorHelper(rawIds),
87
+ _step;
88
+ try {
89
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
90
+ var item = _step.value;
91
+ var strategyId = Number(item);
92
+ if (Number.isFinite(strategyId) && strategyId > 0) {
93
+ uniqueIds.add(strategyId);
94
+ }
95
+ }
96
+ } catch (err) {
97
+ _iterator.e(err);
98
+ } finally {
99
+ _iterator.f();
100
+ }
101
+ return Array.from(uniqueIds);
102
+ }
103
+
104
+ /**
105
+ * 从 tableConfig 中提取合法策略模型 ID 列表。
106
+ */
107
+ export function extractStrategyModelIdsFromTableConfig(tableConfig) {
108
+ var rawIds = Array.isArray(tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.strategy_model_ids) ? tableConfig.strategy_model_ids : [];
109
+ return rawIds.map(function (id) {
110
+ return Number(id);
111
+ }).filter(function (id) {
112
+ return Number.isFinite(id) && id > 0;
113
+ });
114
+ }
115
+
116
+ /**
117
+ * 仅保留 item_rule 类型策略。
118
+ */
119
+ export function normalizeItemRuleStrategies(configs) {
120
+ if (!Array.isArray(configs)) return [];
121
+ return configs.filter(function (config) {
122
+ var _metadata;
123
+ return Boolean(config && _typeof(config) === 'object' && (config === null || config === void 0 || (_metadata = config.metadata) === null || _metadata === void 0 ? void 0 : _metadata.type) === 'item_rule');
124
+ });
125
+ }
126
+ export function toNonNegativeNumber(value) {
127
+ if (typeof value === 'number') {
128
+ return Number.isFinite(value) && value >= 0 ? value : 0;
129
+ }
130
+ if (typeof value === 'string') {
131
+ var parsed = Number(value);
132
+ return Number.isFinite(parsed) && parsed >= 0 ? parsed : 0;
133
+ }
134
+ return 0;
135
+ }
136
+ export function toNonNegativeInt(value) {
137
+ return Math.floor(toNonNegativeNumber(value));
138
+ }
139
+ export function toPriceString(value) {
140
+ var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0.00';
141
+ var parsedValue = Number(value);
142
+ if (Number.isNaN(parsedValue)) return fallback;
143
+ return parsedValue.toFixed(2);
144
+ }
145
+ export function buildProductKey(productId, productVariantId) {
146
+ return "".concat(productId, "_").concat(productVariantId);
147
+ }
148
+ export function getTopLevelProductId(product) {
149
+ var _product$product_id;
150
+ var rawProductId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id;
151
+ var productId = Number(rawProductId);
152
+ if (!Number.isFinite(productId) || productId <= 0) return null;
153
+ return productId;
154
+ }
155
+ export function getTopLevelVariantId(product) {
156
+ var _product$product_vari;
157
+ var rawVariantId = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product.variant_id;
158
+ if (rawVariantId === undefined || rawVariantId === null || rawVariantId === '') {
159
+ return null;
160
+ }
161
+ var variantId = Number(rawVariantId);
162
+ if (!Number.isFinite(variantId) || variantId <= 0) return null;
163
+ return variantId;
164
+ }
165
+ export function buildQuantityLimitIndex(limits) {
166
+ var exactLimitMap = new Map();
167
+ var productLimitMap = new Map();
168
+ var _iterator2 = _createForOfIteratorHelper(limits),
169
+ _step2;
170
+ try {
171
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
172
+ var limit = _step2.value;
173
+ var _iterator3 = _createForOfIteratorHelper(limit.targets || []),
174
+ _step3;
175
+ try {
176
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
177
+ var target = _step3.value;
178
+ var productId = Number(target.product_id);
179
+ if (!Number.isFinite(productId) || productId <= 0) continue;
180
+ var variantId = Number(target.product_variant_id);
181
+ var hasVariant = Number.isFinite(variantId) && variantId > 0;
182
+ if (hasVariant) {
183
+ var exactKey = buildProductKey(productId, variantId);
184
+ var _existed = exactLimitMap.get(exactKey) || [];
185
+ exactLimitMap.set(exactKey, [].concat(_toConsumableArray(_existed), [limit]));
186
+ continue;
187
+ }
188
+ var existed = productLimitMap.get(productId) || [];
189
+ productLimitMap.set(productId, [].concat(_toConsumableArray(existed), [limit]));
190
+ }
191
+ } catch (err) {
192
+ _iterator3.e(err);
193
+ } finally {
194
+ _iterator3.f();
195
+ }
196
+ }
197
+ } catch (err) {
198
+ _iterator2.e(err);
199
+ } finally {
200
+ _iterator2.f();
201
+ }
202
+ return {
203
+ exactLimitMap: exactLimitMap,
204
+ productLimitMap: productLimitMap
205
+ };
206
+ }
207
+ export function resolveSkuMatchedQuantityLimits(params) {
208
+ var productId = params.productId,
209
+ variantId = params.variantId,
210
+ limitIndex = params.limitIndex;
211
+ var exactMatched = variantId && variantId > 0 ? limitIndex.exactLimitMap.get(buildProductKey(productId, variantId)) || [] : [];
212
+ var productMatched = limitIndex.productLimitMap.get(productId) || [];
213
+ return [].concat(_toConsumableArray(exactMatched), _toConsumableArray(productMatched));
214
+ }
215
+ export function aggregateItemRuleLimit(matchedLimits) {
216
+ if (!matchedLimits.length) return null;
217
+ var min;
218
+ var max;
219
+ var exact;
220
+ var mustInclude = false;
221
+ var _iterator4 = _createForOfIteratorHelper(matchedLimits),
222
+ _step4;
223
+ try {
224
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
225
+ var limit = _step4.value;
226
+ if (typeof limit.requiredMin === 'number' && Number.isFinite(limit.requiredMin)) {
227
+ min = min === undefined ? limit.requiredMin : Math.max(min, limit.requiredMin);
228
+ }
229
+ if (typeof limit.requiredMax === 'number' && Number.isFinite(limit.requiredMax)) {
230
+ max = max === undefined ? limit.requiredMax : Math.min(max, limit.requiredMax);
231
+ }
232
+ if (typeof limit.requiredExact === 'number' && Number.isFinite(limit.requiredExact)) {
233
+ exact = limit.requiredExact;
234
+ }
235
+ mustInclude = mustInclude || Boolean(limit.mustInclude);
236
+ }
237
+ } catch (err) {
238
+ _iterator4.e(err);
239
+ } finally {
240
+ _iterator4.f();
241
+ }
242
+ if (typeof exact === 'number' && Number.isFinite(exact)) {
243
+ min = exact;
244
+ max = exact;
245
+ }
246
+ return {
247
+ min: min,
248
+ max: max,
249
+ exact: exact,
250
+ mustInclude: mustInclude
251
+ };
252
+ }
253
+ export function buildItemRuleBusinessData(params) {
254
+ var tempOrder = params.tempOrder,
255
+ runtimeConfig = params.runtimeConfig,
256
+ itemRuleConfigs = params.itemRuleConfigs;
257
+ var rawPax = runtimeConfig.pax || {};
258
+ var adultPax = toNonNegativeInt(rawPax.adult);
259
+ var childPax = toNonNegativeInt(rawPax.child);
260
+ var totalPax = toNonNegativeInt(rawPax.total) || adultPax + childPax || 1;
261
+ var cartItems = tempOrder.products.reduce(function (result, product) {
262
+ if (typeof product.product_id !== 'number') return result;
263
+ result.push(_objectSpread({
264
+ product_id: product.product_id,
265
+ quantity: toNonNegativeInt(product.num)
266
+ }, typeof product.product_variant_id === 'number' ? {
267
+ product_variant_id: product.product_variant_id
268
+ } : {}));
269
+ return result;
270
+ }, []);
271
+ var historicalItems = Array.isArray(runtimeConfig.historicalItems) ? runtimeConfig.historicalItems.reduce(function (result, item) {
272
+ if (typeof (item === null || item === void 0 ? void 0 : item.product_id) !== 'number') return result;
273
+ result.push(_objectSpread({
274
+ product_id: item.product_id,
275
+ quantity: toNonNegativeInt(item.quantity)
276
+ }, typeof item.product_variant_id === 'number' ? {
277
+ product_variant_id: item.product_variant_id
278
+ } : {}));
279
+ return result;
280
+ }, []) : [];
281
+ return {
282
+ pax: {
283
+ total: totalPax,
284
+ adult: adultPax,
285
+ child: childPax
286
+ },
287
+ cartItems: cartItems,
288
+ historicalItems: historicalItems,
289
+ serviceType: runtimeConfig.serviceType || 'dine-in',
290
+ submissionIndex: typeof runtimeConfig.submissionIndex === 'number' ? toNonNegativeInt(runtimeConfig.submissionIndex) : tempOrder.order_id ? 1 : 0,
291
+ custom: runtimeConfig.custom || {},
292
+ strategyConfigs: itemRuleConfigs
293
+ };
294
+ }
295
+ export function attachItemRuleLimitsToTopLevelProducts(productList, limits) {
296
+ if (!Array.isArray(productList)) return productList;
297
+ var limitIndex = buildQuantityLimitIndex(limits || []);
298
+ var _iterator5 = _createForOfIteratorHelper(productList),
299
+ _step5;
300
+ try {
301
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
302
+ var item = _step5.value;
303
+ if (!item || _typeof(item) !== 'object') continue;
304
+ var productItem = item;
305
+ var productId = getTopLevelProductId(productItem);
306
+ if (productId === null) continue;
307
+ var variantId = getTopLevelVariantId(productItem);
308
+ var matchedLimits = limits.length ? resolveSkuMatchedQuantityLimits({
309
+ productId: productId,
310
+ variantId: variantId,
311
+ limitIndex: limitIndex
312
+ }) : [];
313
+ var aggregatedLimit = aggregateItemRuleLimit(matchedLimits);
314
+ if (aggregatedLimit) {
315
+ productItem.item_rule_limit = aggregatedLimit;
316
+ } else if ('item_rule_limit' in productItem) {
317
+ delete productItem.item_rule_limit;
318
+ }
319
+ }
320
+ } catch (err) {
321
+ _iterator5.e(err);
322
+ } finally {
323
+ _iterator5.f();
324
+ }
325
+ return productList;
326
+ }
327
+
328
+ /**
329
+ * 判断两个商品 identity 是否匹配。
330
+ * 当双方都没有 identity_key 时回退到 product_id + product_variant_id 比较(向后兼容);
331
+ * 一旦有一方携带 identity_key,则必须严格相等。
332
+ */
333
+ export function isIdentityMatch(a, b) {
334
+ if (a.product_id !== b.product_id || a.product_variant_id !== b.product_variant_id) return false;
335
+ if (!a.identity_key && !b.identity_key) return true;
336
+ return a.identity_key === b.identity_key;
337
+ }
338
+
339
+ /**
340
+ * 根据 identity 在商品列表中定位下标。
341
+ * 用于判断商品是否已存在(已存在则累加数量,否则新增)。
342
+ */
343
+ export function getProductIdentityIndex(products, identity) {
344
+ return products.findIndex(function (item) {
345
+ return isIdentityMatch(item, identity);
346
+ });
347
+ }
348
+
349
+ /**
350
+ * 对外部传入的商品对象做归一化:
351
+ * - 补全可选字段默认值(未传则使用兜底值,避免后续计算时因 undefined 导致异常)
352
+ * - 对 num 调用 getSafeProductNum 做安全处理
353
+ * - 保留 _origin 供后续业务流程(如促销规则)使用
354
+ */
355
+ export function normalizeOrderProduct(product) {
356
+ var _product$is_charge_ta;
357
+ var metadata = _objectSpread({}, product.metadata || {});
358
+ if (product.identity_key && !metadata.unique_identification_number) {
359
+ metadata.unique_identification_number = product.identity_key;
360
+ }
361
+ var resolvedOriginalPrice = product.original_price || '0.00';
362
+ var resolvedSellingPrice = product.selling_price || '0.00';
363
+ if (metadata.main_product_original_price === undefined) {
364
+ metadata.main_product_original_price = resolvedOriginalPrice;
365
+ }
366
+ if (metadata.main_product_selling_price === undefined) {
367
+ metadata.main_product_selling_price = resolvedSellingPrice;
368
+ }
369
+ if (metadata.source_product_price === undefined) {
370
+ var _product$_origin$orig, _product$_origin;
371
+ metadata.source_product_price = (_product$_origin$orig = (_product$_origin = product._origin) === null || _product$_origin === void 0 ? void 0 : _product$_origin.original_price) !== null && _product$_origin$orig !== void 0 ? _product$_origin$orig : resolvedOriginalPrice;
372
+ }
373
+ var normalizedBundle = (product.product_bundle || []).map(function (item) {
374
+ var _ref, _item$bundle_selling_, _ref2, _ref3, _item$custom_price;
375
+ return _objectSpread(_objectSpread({}, item), {}, {
376
+ bundle_selling_price: (_ref = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref !== void 0 ? _ref : '0.00',
377
+ custom_price: (_ref2 = (_ref3 = (_item$custom_price = item.custom_price) !== null && _item$custom_price !== void 0 ? _item$custom_price : item.bundle_selling_price) !== null && _ref3 !== void 0 ? _ref3 : item.price) !== null && _ref2 !== void 0 ? _ref2 : '0.00'
378
+ });
379
+ });
380
+ return {
381
+ order_detail_id: product.order_detail_id || null,
382
+ product_id: product.product_id,
383
+ num: getSafeProductNum(product.num),
384
+ product_variant_id: product.product_variant_id,
385
+ identity_key: product.identity_key,
386
+ product_option_item: product.product_option_item || [],
387
+ selling_price: resolvedSellingPrice,
388
+ original_price: resolvedOriginalPrice,
389
+ payment_price: product.payment_price || '0.00',
390
+ tax_fee: product.tax_fee || '0.00',
391
+ is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
392
+ discount_list: product.discount_list || [],
393
+ product_bundle: normalizedBundle,
394
+ metadata: metadata,
395
+ _origin: product._origin
396
+ };
397
+ }
@@ -22,7 +22,6 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
22
22
  getCurrentBookingTime(): string | null;
23
23
  private filterDiscountListByBookingTime;
24
24
  setCustomer(customer: Customer): Promise<void>;
25
- setOriginTotalAmount(amount: number): void;
26
25
  setHolders(holders: {
27
26
  form_record_id: number;
28
27
  }[]): void;
@@ -56,8 +56,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
56
56
  originalDiscountList: [],
57
57
  currentBookingTime: "",
58
58
  filteredDiscountList: [],
59
- bookingSubject: undefined,
60
- orderTotalAmount: 0
59
+ bookingSubject: undefined
61
60
  };
62
61
  return _this;
63
62
  }
@@ -289,14 +288,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
289
288
  return _setCustomer.apply(this, arguments);
290
289
  }
291
290
  return setCustomer;
292
- }()
293
- }, {
294
- key: "setOriginTotalAmount",
295
- value: function setOriginTotalAmount(amount) {
296
- this.store.orderTotalAmount = amount;
297
- }
298
-
299
- // 设置holders
291
+ }() // 设置holders
300
292
  }, {
301
293
  key: "setHolders",
302
294
  value: function setHolders(holders) {
@@ -324,7 +316,6 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
324
316
  var _ref = rulesModule.calcDiscount({
325
317
  productList: productList,
326
318
  discountList: this.getDiscountList(),
327
- orderTotalAmount: this.store.orderTotalAmount || 0,
328
319
  holders: this.store.holders || [],
329
320
  isFormSubject: ((_this$store$bookingSu = this.store.bookingSubject) === null || _this$store$bookingSu === void 0 ? void 0 : _this$store$bookingSu.type) === 'form'
330
321
  }, options) || {
@@ -504,7 +495,6 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
504
495
  productList: this.store.productList || [],
505
496
  oldDiscountList: this.getDiscountList(),
506
497
  newDiscountList: withScanList,
507
- orderTotalAmount: this.store.orderTotalAmount || 0,
508
498
  holders: this.store.holders || [],
509
499
  isFormSubject: ((_this$store$bookingSu2 = this.store.bookingSubject) === null || _this$store$bookingSu2 === void 0 ? void 0 : _this$store$bookingSu2.type) === 'form'
510
500
  }) || {
@@ -618,27 +608,21 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
618
608
  return n.id === (((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id);
619
609
  });
620
610
  if (index !== -1) {
621
- var _editModeDiscountList, _discount$metadata, _discount$metadata2;
611
+ var _discount$metadata;
622
612
  editModeDiscountList[index] = _objectSpread(_objectSpread({}, editModeDiscountList[index]), {}, {
623
- metadata: _objectSpread(_objectSpread({}, discount.metadata || {}), {}, {
624
- num: ((editModeDiscountList === null || editModeDiscountList === void 0 || (_editModeDiscountList = editModeDiscountList[index]) === null || _editModeDiscountList === void 0 || (_editModeDiscountList = _editModeDiscountList.metadata) === null || _editModeDiscountList === void 0 ? void 0 : _editModeDiscountList.num) || 1) + (((_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.num) || 1)
625
- }),
626
613
  amount: new Decimal(discount.amount || 0).plus(new Decimal(editModeDiscountList[index].amount || 0)).toNumber(),
627
- savedAmount: new Decimal(discount.amount || 0).times((product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.num) || 1).plus((discount === null || discount === void 0 || (_discount$metadata2 = discount.metadata) === null || _discount$metadata2 === void 0 ? void 0 : _discount$metadata2.product_discount_difference) || 0).plus(new Decimal(editModeDiscountList[index].savedAmount || 0)).toNumber()
614
+ savedAmount: new Decimal(discount.amount || 0).times((product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.num) || 1).plus((discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.product_discount_difference) || 0).plus(new Decimal(editModeDiscountList[index].savedAmount || 0)).toNumber()
628
615
  });
629
616
  } else {
630
- var _discount$metadata3, _discount$metadata4, _discount$discount2, _discount$discount3, _discount$discount4;
617
+ var _discount$metadata2, _discount$discount2, _discount$discount3, _discount$discount4;
631
618
  if (discount.type && !discount.tag) {
632
619
  discount.tag = discount.type;
633
620
  }
634
621
  editModeDiscountList.push(_objectSpread(_objectSpread({}, discount), {}, {
635
- metadata: _objectSpread(_objectSpread({}, discount.metadata || {}), {}, {
636
- num: ((_discount$metadata3 = discount.metadata) === null || _discount$metadata3 === void 0 ? void 0 : _discount$metadata3.num) || 1
637
- }),
638
622
  name: discount.name || discount.discount.title.auto,
639
623
  isEditMode: true,
640
624
  limited_relation_product_data: {},
641
- savedAmount: new Decimal(discount.amount || 0).times((product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.num) || 1).plus((discount === null || discount === void 0 || (_discount$metadata4 = discount.metadata) === null || _discount$metadata4 === void 0 ? void 0 : _discount$metadata4.product_discount_difference) || 0).toNumber(),
625
+ savedAmount: new Decimal(discount.amount || 0).times((product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.num) || 1).plus((discount === null || discount === void 0 || (_discount$metadata2 = discount.metadata) === null || _discount$metadata2 === void 0 ? void 0 : _discount$metadata2.product_discount_difference) || 0).toNumber(),
642
626
  isAvailable: true,
643
627
  id: ((_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.resource_id) || discount.id,
644
628
  format_title: ((_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.title) || discount.format_title,
@@ -831,7 +815,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
831
815
  return this.core.effects.emit("".concat(this.name, ":onLoadPrepareCalcResult"), _result3);
832
816
  case 19:
833
817
  _context10.next = 21;
834
- return this.core.effects.emit("".concat(this.name, ":onLoadDiscountList"), newDiscountList);
818
+ return this.core.effects.emit("".concat(this.name, ":onLoadDiscountList"), filteredDiscountList);
835
819
  case 21:
836
820
  _context10.next = 26;
837
821
  break;
@@ -23,7 +23,6 @@ export interface ShopDiscountState {
23
23
  discount: DiscountModule | null;
24
24
  rules: RulesModule | null;
25
25
  productList: Record<string, any>[];
26
- orderTotalAmount?: number;
27
26
  holders?: {
28
27
  form_record_id: number;
29
28
  form_id?: number;
@@ -8,5 +8,4 @@ export var ShopDiscountHooks = /*#__PURE__*/function (ShopDiscountHooks) {
8
8
  ShopDiscountHooks["onRulesListChange"] = "shopDiscount:onRulesListChange";
9
9
  ShopDiscountHooks["onLoadPrepareCalcResult"] = "shopDiscount:onLoadPrepareCalcResult";
10
10
  return ShopDiscountHooks;
11
- }({});
12
- ;
11
+ }({});
@@ -40,37 +40,23 @@ export var isAllNormalProduct = function isAllNormalProduct(items) {
40
40
  * @returns
41
41
  */
42
42
  export var getDiscountAmount = function getDiscountAmount(discount, total, price) {
43
- var discountedPrice = 0;
44
-
43
+ var _discount$metadata;
45
44
  // 商品券
46
45
  if (discount.tag === 'good_pass') {
47
- discountedPrice = new Decimal(price).minus(new Decimal(price || 0)).toNumber();
48
- } else {
49
- var _discount$metadata;
50
- // 判断是否是固定金额
51
- var isFixedAmount = (discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.discount_card_type) === 'fixed_amount';
52
-
53
- // 固定金额 小于0时返回0
54
- if (isFixedAmount) {
55
- discountedPrice = Math.max(new Decimal(price).minus(new Decimal(discount.par_value || 0)).toNumber(), 0);
56
- } else {
57
- // 百分比:根据折扣卡金额计算
58
- discountedPrice = new Decimal(100).minus(discount.par_value || 0).div(100).mul(new Decimal(price)).toNumber();
59
- }
46
+ return new Decimal(price).minus(new Decimal(price || 0)).toNumber();
60
47
  }
61
48
 
62
- /*
63
- // 🔥 如果有 maxDeductionAmount 限制,确保折扣金额不超过限制
64
- if (discount.config?.maxDeductionAmount) {
65
- const actualDiscountAmount = new Decimal(price).minus(discountedPrice).toNumber();
66
- if (actualDiscountAmount > discount.config.maxDeductionAmount) {
67
- // 折扣金额超过限制,重新计算折扣后价格
68
- discountedPrice = new Decimal(price).minus(discount.config.maxDeductionAmount).toNumber();
69
- }
70
- }
71
- */
49
+ // 判断是否是固定金额
50
+ var isFixedAmount = (discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.discount_card_type) === 'fixed_amount';
51
+
52
+ // 固定金额 小于0时返回0
53
+ if (isFixedAmount) {
54
+ var _discount$amount;
55
+ return Math.max(new Decimal(price).minus(new Decimal(((_discount$amount = discount.amount) !== null && _discount$amount !== void 0 ? _discount$amount : discount.par_value) || 0)).toNumber(), 0);
56
+ }
72
57
 
73
- return discountedPrice;
58
+ // 百分比:根据折扣卡金额计算
59
+ return new Decimal(100).minus(discount.par_value || 0).div(100).mul(new Decimal(price)).toNumber();
74
60
  };
75
61
  export var getDiscountListAmountTotal = function getDiscountListAmountTotal(discount) {
76
62
  return discount.reduce(function (acc, cur) {