@pisell/pisellos 2.3.38 → 2.3.40

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 (229) hide show
  1. package/dist/core/index.d.ts +0 -2
  2. package/dist/core/index.js +0 -7
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  4. package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
  8. package/dist/model/strategy/adapter/promotion/examples.js +0 -99
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
  11. package/dist/model/strategy/adapter/promotion/type.js +0 -45
  12. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -5
  13. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +3 -6
  14. package/dist/modules/Discount/index.d.ts +1 -0
  15. package/dist/modules/Discount/index.js +40 -11
  16. package/dist/modules/Discount/types.d.ts +1 -0
  17. package/dist/modules/Holder/index.d.ts +48 -0
  18. package/dist/modules/Holder/index.js +640 -0
  19. package/dist/modules/Holder/types.d.ts +123 -0
  20. package/dist/modules/Holder/types.js +1 -0
  21. package/dist/modules/Holder/utils.d.ts +13 -0
  22. package/dist/modules/Holder/utils.js +34 -0
  23. package/dist/modules/OpenData/index.d.ts +0 -2
  24. package/dist/modules/OpenData/index.js +2 -10
  25. package/dist/modules/Order/index.d.ts +11 -28
  26. package/dist/modules/Order/index.js +509 -750
  27. package/dist/modules/Order/types.d.ts +10 -33
  28. package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
  29. package/dist/modules/Order/utils.d.ts +10 -0
  30. package/dist/modules/Order/utils.js +41 -13
  31. package/dist/modules/Payment/index.d.ts +0 -2
  32. package/dist/modules/Payment/index.js +50 -79
  33. package/dist/modules/Payment/types.d.ts +28 -99
  34. package/dist/modules/Payment/types.js +3 -20
  35. package/dist/modules/Payment/walletpass.d.ts +1 -25
  36. package/dist/modules/Payment/walletpass.js +157 -707
  37. package/dist/modules/Product/types.d.ts +1 -0
  38. package/dist/modules/ProductList/index.js +33 -14
  39. package/dist/modules/Quotation/index.d.ts +1 -1
  40. package/dist/modules/Quotation/index.js +2 -2
  41. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  42. package/dist/modules/ResourcePlanner/index.js +181 -0
  43. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  44. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  45. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  46. package/dist/modules/ResourcePlanner/types.js +1 -0
  47. package/dist/modules/Rules/index.d.ts +0 -1
  48. package/dist/modules/Rules/index.js +96 -89
  49. package/dist/modules/SalesSummary/index.js +12 -13
  50. package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
  51. package/dist/modules/ScanOrderLogger/index.js +15 -2
  52. package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
  53. package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
  54. package/dist/modules/Schedule/index.d.ts +3 -1
  55. package/dist/modules/Schedule/index.js +21 -16
  56. package/dist/modules/Summary/utils.js +38 -13
  57. package/dist/modules/index.d.ts +2 -0
  58. package/dist/modules/index.js +3 -1
  59. package/dist/plugins/window.d.ts +1 -0
  60. package/dist/server/index.d.ts +14 -16
  61. package/dist/server/index.js +1148 -1930
  62. package/dist/server/modules/order/index.d.ts +4 -54
  63. package/dist/server/modules/order/index.js +695 -1595
  64. package/dist/server/modules/order/types.d.ts +3 -11
  65. package/dist/server/modules/order/types.js +1 -1
  66. package/dist/solution/BaseSales/index.d.ts +20 -109
  67. package/dist/solution/BaseSales/index.js +481 -1797
  68. package/dist/solution/BaseSales/types.d.ts +0 -52
  69. package/dist/solution/BaseSales/types.js +1 -2
  70. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  71. package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
  72. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  73. package/dist/solution/BookingByStep/index.d.ts +17 -2
  74. package/dist/solution/BookingByStep/index.js +294 -215
  75. package/dist/solution/BookingByStep/types.d.ts +2 -1
  76. package/dist/solution/BookingByStep/types.js +3 -1
  77. package/dist/solution/BookingByStep/utils/capacity.js +17 -1
  78. package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  79. package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
  80. package/dist/solution/BookingTicket/index.d.ts +4 -8
  81. package/dist/solution/BookingTicket/index.js +51 -134
  82. package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -6
  83. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
  84. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +82 -172
  85. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  86. package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
  87. package/dist/solution/Sales/index.d.ts +0 -1
  88. package/dist/solution/Sales/index.js +2 -10
  89. package/dist/solution/ScanOrder/index.d.ts +26 -14
  90. package/dist/solution/ScanOrder/index.js +1148 -756
  91. package/dist/solution/ScanOrder/types.d.ts +21 -1
  92. package/dist/solution/ScanOrder/utils.d.ts +8 -0
  93. package/dist/solution/ScanOrder/utils.js +66 -25
  94. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  95. package/dist/solution/ShopDiscount/index.js +125 -87
  96. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  97. package/dist/solution/UnifiedBookingSales/index.js +1871 -0
  98. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  99. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  100. package/dist/solution/VenueBooking/index.d.ts +39 -11
  101. package/dist/solution/VenueBooking/index.js +1176 -860
  102. package/dist/solution/VenueBooking/types.d.ts +3 -0
  103. package/dist/solution/VenueBooking/utils/resource.js +1 -0
  104. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  105. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
  106. package/dist/solution/index.d.ts +1 -0
  107. package/dist/solution/index.js +2 -1
  108. package/dist/types/index.d.ts +1 -1
  109. package/lib/core/index.d.ts +0 -2
  110. package/lib/core/index.js +0 -4
  111. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  112. package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
  113. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  114. package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
  115. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
  116. package/lib/model/strategy/adapter/promotion/examples.js +0 -91
  117. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  118. package/lib/model/strategy/adapter/promotion/index.js +0 -2
  119. package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
  120. package/lib/model/strategy/adapter/promotion/type.js +0 -2
  121. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -2
  122. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
  123. package/lib/modules/Discount/index.d.ts +1 -0
  124. package/lib/modules/Discount/index.js +9 -0
  125. package/lib/modules/Discount/types.d.ts +1 -0
  126. package/lib/modules/Holder/index.d.ts +48 -0
  127. package/lib/modules/Holder/index.js +402 -0
  128. package/lib/modules/Holder/types.d.ts +123 -0
  129. package/lib/modules/Holder/types.js +17 -0
  130. package/lib/modules/Holder/utils.d.ts +13 -0
  131. package/lib/modules/Holder/utils.js +71 -0
  132. package/lib/modules/OpenData/index.d.ts +0 -2
  133. package/lib/modules/OpenData/index.js +1 -6
  134. package/lib/modules/Order/index.d.ts +11 -28
  135. package/lib/modules/Order/index.js +86 -196
  136. package/lib/modules/Order/types.d.ts +10 -33
  137. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
  138. package/lib/modules/Order/utils.d.ts +10 -0
  139. package/lib/modules/Order/utils.js +40 -16
  140. package/lib/modules/Payment/index.d.ts +0 -2
  141. package/lib/modules/Payment/index.js +13 -34
  142. package/lib/modules/Payment/types.d.ts +28 -99
  143. package/lib/modules/Payment/types.js +3 -4
  144. package/lib/modules/Payment/walletpass.d.ts +1 -25
  145. package/lib/modules/Payment/walletpass.js +21 -470
  146. package/lib/modules/Product/types.d.ts +1 -0
  147. package/lib/modules/ProductList/index.js +40 -31
  148. package/lib/modules/Quotation/index.d.ts +1 -1
  149. package/lib/modules/Quotation/index.js +2 -2
  150. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  151. package/lib/modules/ResourcePlanner/index.js +148 -0
  152. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  153. package/lib/modules/ResourcePlanner/planner.js +933 -0
  154. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  155. package/lib/modules/ResourcePlanner/types.js +17 -0
  156. package/lib/modules/Rules/index.d.ts +0 -1
  157. package/lib/modules/Rules/index.js +40 -47
  158. package/lib/modules/SalesSummary/index.js +6 -7
  159. package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
  160. package/lib/modules/ScanOrderLogger/index.js +13 -1
  161. package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
  162. package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
  163. package/lib/modules/Schedule/index.d.ts +3 -1
  164. package/lib/modules/Schedule/index.js +10 -8
  165. package/lib/modules/Summary/utils.js +21 -1
  166. package/lib/modules/index.d.ts +2 -0
  167. package/lib/modules/index.js +5 -1
  168. package/lib/plugins/window.d.ts +1 -0
  169. package/lib/server/index.d.ts +14 -16
  170. package/lib/server/index.js +83 -675
  171. package/lib/server/modules/order/index.d.ts +4 -54
  172. package/lib/server/modules/order/index.js +66 -679
  173. package/lib/server/modules/order/types.d.ts +3 -11
  174. package/lib/solution/BaseSales/index.d.ts +20 -109
  175. package/lib/solution/BaseSales/index.js +70 -881
  176. package/lib/solution/BaseSales/types.d.ts +0 -52
  177. package/lib/solution/BaseSales/types.js +1 -2
  178. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  179. package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
  180. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  181. package/lib/solution/BookingByStep/index.d.ts +17 -2
  182. package/lib/solution/BookingByStep/index.js +60 -18
  183. package/lib/solution/BookingByStep/types.d.ts +2 -1
  184. package/lib/solution/BookingByStep/types.js +5 -0
  185. package/lib/solution/BookingByStep/utils/capacity.js +20 -1
  186. package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  187. package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
  188. package/lib/solution/BookingTicket/index.d.ts +4 -8
  189. package/lib/solution/BookingTicket/index.js +19 -64
  190. package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -4
  191. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
  192. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +4 -36
  193. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  194. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  195. package/lib/solution/Sales/index.d.ts +0 -1
  196. package/lib/solution/Sales/index.js +3 -5
  197. package/lib/solution/ScanOrder/index.d.ts +26 -14
  198. package/lib/solution/ScanOrder/index.js +449 -190
  199. package/lib/solution/ScanOrder/types.d.ts +21 -1
  200. package/lib/solution/ScanOrder/utils.d.ts +8 -0
  201. package/lib/solution/ScanOrder/utils.js +31 -0
  202. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  203. package/lib/solution/ShopDiscount/index.js +14 -0
  204. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  205. package/lib/solution/UnifiedBookingSales/index.js +1076 -0
  206. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  207. package/lib/solution/UnifiedBookingSales/types.js +33 -0
  208. package/lib/solution/VenueBooking/index.d.ts +39 -11
  209. package/lib/solution/VenueBooking/index.js +328 -123
  210. package/lib/solution/VenueBooking/types.d.ts +3 -0
  211. package/lib/solution/VenueBooking/utils/resource.js +1 -0
  212. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  213. package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
  214. package/lib/solution/index.d.ts +1 -0
  215. package/lib/solution/index.js +3 -1
  216. package/lib/types/index.d.ts +1 -1
  217. package/package.json +1 -1
  218. package/dist/modules/Order/payment-utils.d.ts +0 -26
  219. package/dist/modules/Order/payment-utils.js +0 -225
  220. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
  221. package/dist/solution/BookingTicket/utils/weighingProductSku.js +0 -45
  222. package/dist/utils/payment-number.d.ts +0 -9
  223. package/dist/utils/payment-number.js +0 -69
  224. package/lib/modules/Order/payment-utils.d.ts +0 -26
  225. package/lib/modules/Order/payment-utils.js +0 -224
  226. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
  227. package/lib/solution/BookingTicket/utils/weighingProductSku.js +0 -63
  228. package/lib/utils/payment-number.d.ts +0 -9
  229. package/lib/utils/payment-number.js +0 -64
@@ -20,7 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var examples_exports = {};
21
21
  __export(examples_exports, {
22
22
  BUY_X_GET_Y_FREE_STRATEGY: () => BUY_X_GET_Y_FREE_STRATEGY,
23
- ITEM_REWARD_STRATEGY: () => ITEM_REWARD_STRATEGY,
24
23
  X_ITEMS_FOR_Y_PRICE_STRATEGY: () => X_ITEMS_FOR_Y_PRICE_STRATEGY
25
24
  });
26
25
  module.exports = __toCommonJS(examples_exports);
@@ -186,98 +185,8 @@ var BUY_X_GET_Y_FREE_STRATEGY = {
186
185
  }
187
186
  ]
188
187
  };
189
- var ITEM_REWARD_STRATEGY = {
190
- metadata: {
191
- id: "STRATEGY_003",
192
- name: {
193
- en: "Infant ticket free with child ticket",
194
- "zh-CN": "儿童票触发婴儿票免费",
195
- "zh-HK": "兒童票觸發嬰兒票免費"
196
- },
197
- type: "promotion",
198
- custom: {
199
- display: {
200
- product_card: {
201
- text: {
202
- en: "Infant ticket free",
203
- "zh-CN": "婴儿票免费",
204
- "zh-HK": "嬰兒票免費"
205
- },
206
- type: "tag"
207
- }
208
- }
209
- }
210
- },
211
- conditions: {
212
- operator: "and",
213
- rules: [
214
- {
215
- type: "operator",
216
- field: "currentDateTime",
217
- value: "2023-01-01 00:00:00",
218
- operator: ">="
219
- },
220
- {
221
- type: "operator",
222
- field: "currentDateTime",
223
- value: "2030-01-01 00:00:00",
224
- operator: "<="
225
- },
226
- {
227
- type: "operator",
228
- field: "productIdAndVariantId",
229
- value: [
230
- {
231
- product_id: 1001,
232
- // 条件商品:儿童票
233
- product_variant_id: 0
234
- // 0 = 匹配任意变体
235
- }
236
- ],
237
- operator: "product_match"
238
- }
239
- ],
240
- actionIds: ["1"]
241
- },
242
- actions: [
243
- {
244
- id: "1",
245
- type: "ITEM_REWARD",
246
- value: {
247
- rewardMethod: "free",
248
- // free | percent_off | amount_off | fixed_price
249
- rewardValue: 0,
250
- // free 可省略;其他 rewardMethod 使用
251
- quantityRule: "per_condition_quantity",
252
- // per_condition_quantity | all_targets | max_per_order
253
- triggerQuantity: 1,
254
- // N:每满足 N 个条件商品
255
- rewardQuantity: 1,
256
- // Y:奖励 Y 个目标商品
257
- maxRewardQuantity: 1
258
- // max_per_order 使用;本例保留为配置示意
259
- },
260
- valueType: "object",
261
- target: "product",
262
- priority: 1,
263
- config: {
264
- rewardTargets: [
265
- {
266
- product_id: 2001,
267
- // 奖励对象:婴儿票
268
- product_variant_id: 0
269
- // 0 = 匹配任意变体
270
- }
271
- ],
272
- targetSelection: "consumer_best"
273
- // consumer_best = 按可节省金额从高到低选择
274
- }
275
- }
276
- ]
277
- };
278
188
  // Annotate the CommonJS export names for ESM import in node:
279
189
  0 && (module.exports = {
280
190
  BUY_X_GET_Y_FREE_STRATEGY,
281
- ITEM_REWARD_STRATEGY,
282
191
  X_ITEMS_FOR_Y_PRICE_STRATEGY
283
192
  });
@@ -1,4 +1,4 @@
1
1
  export { PromotionEvaluator } from './evaluator';
2
2
  export { PromotionAdapter } from './adapter';
3
3
  export { default } from './adapter';
4
- export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY, } from './examples';
4
+ export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, } from './examples';
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var promotion_exports = {};
31
31
  __export(promotion_exports, {
32
32
  BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
- ITEM_REWARD_STRATEGY: () => import_examples.ITEM_REWARD_STRATEGY,
34
33
  PromotionAdapter: () => import_adapter.PromotionAdapter,
35
34
  PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
36
35
  X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
@@ -44,7 +43,6 @@ var import_examples = require("./examples");
44
43
  // Annotate the CommonJS export names for ESM import in node:
45
44
  0 && (module.exports = {
46
45
  BUY_X_GET_Y_FREE_STRATEGY,
47
- ITEM_REWARD_STRATEGY,
48
46
  PromotionAdapter,
49
47
  PromotionEvaluator,
50
48
  X_ITEMS_FOR_Y_PRICE_STRATEGY
@@ -12,8 +12,6 @@ export declare const PROMOTION_ACTION_TYPES: {
12
12
  readonly X_ITEMS_FOR_Y_PRICE: "X_ITEMS_FOR_Y_PRICE";
13
13
  /** 买X送Y(买X件送Y件,可累计) */
14
14
  readonly BUY_X_GET_Y_FREE: "BUY_X_GET_Y_FREE";
15
- /** 商品奖励(满足条件后,订单内指定目标商品享优惠) */
16
- readonly ITEM_REWARD: "ITEM_REWARD";
17
15
  /** 固定折扣 */
18
16
  readonly DISCOUNT_RATE: "DISCOUNT_RATE";
19
17
  /** 固定减价 */
@@ -68,59 +66,6 @@ export interface BuyXGetYFreeConfig {
68
66
  /** 可选的赠品列表 */
69
67
  giftProducts?: ProductIdentifier[];
70
68
  }
71
- /**
72
- * 商品奖励优惠方式
73
- *
74
- * - free: 目标商品最终价为 0
75
- * - percent_off: 目标商品按百分比折扣,rewardValue 为 0-100
76
- * - amount_off: 每个目标商品固定减免 rewardValue
77
- * - fixed_price: 目标商品改为固定价 rewardValue
78
- */
79
- export type ItemRewardMethod = 'free' | 'percent_off' | 'amount_off' | 'fixed_price';
80
- /**
81
- * 商品奖励数量规则
82
- *
83
- * - per_condition_quantity: 每满足 N 个条件商品,奖励 Y 个目标商品
84
- * - all_targets: 满足条件后奖励全部目标商品
85
- * - max_per_order: 满足条件后每单最多奖励固定数量目标商品
86
- */
87
- export type ItemRewardQuantityRule = 'per_condition_quantity' | 'all_targets' | 'max_per_order';
88
- /** 商品奖励目标选择规则 */
89
- export type ItemRewardTargetSelection = 'consumer_best';
90
- /**
91
- * 商品奖励 - Action Value
92
- *
93
- * @example
94
- * value: {
95
- * rewardMethod: 'free',
96
- * quantityRule: 'per_condition_quantity',
97
- * triggerQuantity: 1,
98
- * rewardQuantity: 1,
99
- * }
100
- */
101
- export interface ItemRewardValue {
102
- /** 奖励方式 */
103
- rewardMethod: ItemRewardMethod;
104
- /** 奖励值:percent_off/amount_off/fixed_price 使用,free 可省略 */
105
- rewardValue?: number;
106
- /** 奖励数量规则 */
107
- quantityRule: ItemRewardQuantityRule;
108
- /** 每满足 N 个条件商品;默认 1 */
109
- triggerQuantity?: number;
110
- /** 奖励 Y 个目标商品;默认 1 */
111
- rewardQuantity?: number;
112
- /** 每单最多奖励 Y 个目标商品;max_per_order 使用 */
113
- maxRewardQuantity?: number;
114
- }
115
- /**
116
- * 商品奖励 - Action Config
117
- */
118
- export interface ItemRewardConfig {
119
- /** 奖励对象,本期支持指定商品/变体;product_variant_id=0 表示任意变体 */
120
- rewardTargets?: ProductIdentifier[];
121
- /** 目标商品超额时的选择规则;本期支持 consumer_best */
122
- targetSelection?: ItemRewardTargetSelection;
123
- }
124
69
  /**
125
70
  * 商品标识
126
71
  *
@@ -157,19 +102,10 @@ export interface BuyXGetYFreeAction extends Omit<ActionEffect, 'type' | 'value'
157
102
  valueType: 'object';
158
103
  config?: BuyXGetYFreeConfig;
159
104
  }
160
- /**
161
- * 商品奖励 Action
162
- */
163
- export interface ItemRewardAction extends Omit<ActionEffect, 'type' | 'value' | 'config'> {
164
- type: typeof PROMOTION_ACTION_TYPES.ITEM_REWARD;
165
- value: ItemRewardValue;
166
- valueType: 'object';
167
- config?: ItemRewardConfig;
168
- }
169
105
  /**
170
106
  * 促销活动 Action 联合类型
171
107
  */
172
- export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction | ItemRewardAction;
108
+ export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction;
173
109
  /**
174
110
  * 促销相关运算符
175
111
  */
@@ -234,8 +170,6 @@ export interface PromotionProduct {
234
170
  quantity: number;
235
171
  /** 原价 */
236
172
  original_price?: number;
237
- /** 内部字段:编辑态订单行只允许参与 ITEM_REWARD,避免旧促销误算历史行 */
238
- _promotionOnlyForItemReward?: boolean;
239
173
  }
240
174
  /**
241
175
  * 促销活动适配器转换结果
@@ -261,7 +195,7 @@ export interface PromotionTransformResult {
261
195
  /**
262
196
  * Action 详情联合类型
263
197
  */
264
- export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail | ItemRewardActionDetail;
198
+ export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail;
265
199
  /**
266
200
  * X件Y元 Action 详情
267
201
  */
@@ -292,28 +226,6 @@ export interface BuyXGetYFreeActionDetail {
292
226
  /** 可选的赠品列表 */
293
227
  giftProducts: ProductIdentifier[];
294
228
  }
295
- /**
296
- * 商品奖励 Action 详情
297
- */
298
- export interface ItemRewardActionDetail {
299
- type: typeof PROMOTION_ACTION_TYPES.ITEM_REWARD;
300
- /** 奖励方式 */
301
- rewardMethod: ItemRewardMethod;
302
- /** 奖励值:percent_off/amount_off/fixed_price 使用,free 为 0 */
303
- rewardValue: number;
304
- /** 奖励数量规则 */
305
- quantityRule: ItemRewardQuantityRule;
306
- /** 每满足 N 个条件商品;默认 1 */
307
- triggerQuantity: number;
308
- /** 奖励 Y 个目标商品;默认 1 */
309
- rewardQuantity: number;
310
- /** 每单最多奖励 Y 个目标商品;max_per_order 使用 */
311
- maxRewardQuantity?: number;
312
- /** 奖励对象,本期支持指定商品/变体 */
313
- rewardTargets: ProductIdentifier[];
314
- /** 目标商品超额时的选择规则 */
315
- targetSelection: ItemRewardTargetSelection;
316
- }
317
229
  /**
318
230
  * X件Y元 - 业务层计算结果
319
231
  *
@@ -28,8 +28,6 @@ var PROMOTION_ACTION_TYPES = {
28
28
  X_ITEMS_FOR_Y_PRICE: "X_ITEMS_FOR_Y_PRICE",
29
29
  /** 买X送Y(买X件送Y件,可累计) */
30
30
  BUY_X_GET_Y_FREE: "BUY_X_GET_Y_FREE",
31
- /** 商品奖励(满足条件后,订单内指定目标商品享优惠) */
32
- ITEM_REWARD: "ITEM_REWARD",
33
31
  /** 固定折扣 */
34
32
  DISCOUNT_RATE: "DISCOUNT_RATE",
35
33
  /** 固定减价 */
@@ -184,7 +184,7 @@ function synthesizeProductResourceFromBooking(booking) {
184
184
  };
185
185
  }
186
186
  function buildCacheItemFromOrderLine(input) {
187
- var _a, _b, _c, _d, _e, _f, _g;
187
+ var _a, _b, _c, _d, _e, _f;
188
188
  const { product, booking, sourceProduct } = input;
189
189
  const resolvedId = product.product_id ?? (sourceProduct == null ? void 0 : sourceProduct.id);
190
190
  const selling = Number(product.selling_price ?? 0);
@@ -259,7 +259,6 @@ function buildCacheItemFromOrderLine(input) {
259
259
  price: (sourceProduct == null ? void 0 : sourceProduct.price) ?? selling,
260
260
  selling_price: product.selling_price,
261
261
  original_price: product.original_price,
262
- ...Number(((_g = product.product_sku) == null ? void 0 : _g.open_sold_weight) || 0) === 1 ? { product_sku: JSON.parse(JSON.stringify(product.product_sku)) } : {},
263
262
  ...productOptionString ? { product_option_string: productOptionString } : {},
264
263
  _extend: extend,
265
264
  new: 0,
@@ -78,7 +78,7 @@ function mapOrderBundleToOtherBundle(bundle) {
78
78
  });
79
79
  }
80
80
  function buildNormalProductCacheItemFromOrderLine(input) {
81
- var _a, _b, _c, _d, _e, _f;
81
+ var _a, _b, _c, _d, _e;
82
82
  const { product, sourceProduct } = input;
83
83
  const resolvedId = product.product_id ?? (sourceProduct == null ? void 0 : sourceProduct.id);
84
84
  const sourcePrice = resolveSourceProductPrice(product, sourceProduct);
@@ -144,7 +144,6 @@ function buildNormalProductCacheItemFromOrderLine(input) {
144
144
  note: product.note,
145
145
  order_detail_id: product.order_detail_id ?? null,
146
146
  discount_list: discountList,
147
- ...Number(((_f = product.product_sku) == null ? void 0 : _f.open_sold_weight) || 0) === 1 ? { product_sku: JSON.parse(JSON.stringify(product.product_sku)) } : {},
148
147
  new: 0,
149
148
  autoClose: true,
150
149
  _extend: extend
@@ -32,6 +32,7 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
32
32
  customerId?: number;
33
33
  orderId?: number;
34
34
  }): Promise<DiscountWithReason>;
35
+ batchSearchByProductIds(productIds: number[]): Promise<any>;
35
36
  filterEnabledDiscountList(discountList: Discount[]): Discount[];
36
37
  private checkUsageCreditsLimit;
37
38
  filterEnabledDiscountListWithReason(discountList: Discount[]): DiscountWithReason;
@@ -147,6 +147,15 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
147
147
  const resultDiscountWithReason = this.filterEnabledDiscountListWithReason((result == null ? void 0 : result.data) || []) || [];
148
148
  return resultDiscountWithReason;
149
149
  }
150
+ async batchSearchByProductIds(productIds) {
151
+ const result = await this.request.get(`/machinecode/batch-search`, {
152
+ ids: productIds,
153
+ translate_flag: 1,
154
+ tags: ["good_pass", "product_discount_card"],
155
+ relation_product: 1
156
+ });
157
+ return (result == null ? void 0 : result.data) || [];
158
+ }
150
159
  filterEnabledDiscountList(discountList) {
151
160
  return discountList.filter(
152
161
  (discount) => discount.limit_status === "enable" && new import_decimal.default((discount == null ? void 0 : discount.par_value) || 0).minus(new import_decimal.default((discount == null ? void 0 : discount.used_par_value) || 0)).greaterThan(0) && this.checkUsageCreditsLimit(discount)
@@ -157,6 +157,7 @@ export interface Discount {
157
157
  num?: number;
158
158
  start_date?: string;
159
159
  start_time?: string;
160
+ discount_rule_uncheck_flag?: boolean;
160
161
  usageLimitFailKey?: string | null;
161
162
  unified_available_status?: number | undefined | null;
162
163
  }
@@ -0,0 +1,48 @@
1
+ import { Module, PisellCore, ModuleOptions } from '../../types';
2
+ import { BaseModule } from '../BaseModule';
3
+ import { IFormInfo, IFormRecord, IFormItemData, IFetchFormInfoParams, IFetchFormRecordsParams, IAddFormRecordParams, IAppendFormRecordParams, IEnsureFormDataParams, IEnsureFormByProductParams, IRefreshAllFormRecordsParams, HolderModuleAPI, HolderFormMap } from './types';
4
+ export * from './types';
5
+ export * from './utils';
6
+ export declare class HolderModule extends BaseModule implements Module, HolderModuleAPI {
7
+ protected defaultName: string;
8
+ protected defaultVersion: string;
9
+ private store;
10
+ private request;
11
+ private cacheId;
12
+ private openCache;
13
+ private fatherModule;
14
+ private isLoading;
15
+ private error;
16
+ /** 已加载过表单数据的 form_id 缓存标记 */
17
+ private loadedFormIds;
18
+ private window;
19
+ constructor(name?: string, version?: string);
20
+ initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
21
+ /** 统一提交 formMap,仅此处触发 store changed */
22
+ private commitFormMap;
23
+ /** 通知 UI 刷新(数据未变但需要 re-read 的场景) */
24
+ private notifyFormMapChanged;
25
+ getHolderFormMap(): HolderFormMap;
26
+ getHolderFormData(formId: number | string): IFormItemData | undefined;
27
+ setFormData(formId: number | string, data: Partial<IFormItemData>): void;
28
+ private ensureFormItem;
29
+ private hasFormData;
30
+ private patchFormMap;
31
+ fetchFormInfo(params: IFetchFormInfoParams): Promise<IFormInfo | IFormInfo[]>;
32
+ fetchRecords(params: IFetchFormRecordsParams): Promise<any>;
33
+ ensureFormData(params: IEnsureFormDataParams): Promise<IFormItemData>;
34
+ ensureFormByProduct(params: IEnsureFormByProductParams): Promise<IFormItemData | null>;
35
+ addFormRecord(params: IAddFormRecordParams): Promise<any>;
36
+ /**
37
+ * UI 层自行请求添加接口后,将返回记录合并到 holderMap 对应 form_id 的 records 中
38
+ */
39
+ appendFormRecord(params: IAppendFormRecordParams): IFormRecord;
40
+ removeFormRecord(formId: number | string, formRecordId: number): void;
41
+ clearFormData(formId?: number | string): void;
42
+ /**
43
+ * 登录后按当前 holderMap 批量刷新所有表单的 records。
44
+ * 遍历 holderMap,从 form.form 中读取 form_id、shop_id,结合 customer_id 重新拉取记录。
45
+ */
46
+ refreshAllFormRecords(params?: IRefreshAllFormRecordsParams): Promise<HolderFormMap>;
47
+ storeChange(path?: string): void;
48
+ }