@pisell/pisellos 2.3.39 → 2.3.41

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 (226) hide show
  1. package/dist/core/index.d.ts +2 -0
  2. package/dist/core/index.js +7 -0
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  4. package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
  8. package/dist/model/strategy/adapter/promotion/examples.js +99 -0
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  11. package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
  12. package/dist/model/strategy/adapter/promotion/type.js +45 -0
  13. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
  14. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
  15. package/dist/modules/Discount/index.d.ts +0 -1
  16. package/dist/modules/Discount/index.js +11 -40
  17. package/dist/modules/Discount/types.d.ts +0 -1
  18. package/dist/modules/OpenData/index.d.ts +2 -0
  19. package/dist/modules/OpenData/index.js +10 -2
  20. package/dist/modules/Order/index.d.ts +29 -12
  21. package/dist/modules/Order/index.js +750 -509
  22. package/dist/modules/Order/payment-utils.d.ts +26 -0
  23. package/dist/modules/Order/payment-utils.js +225 -0
  24. package/dist/modules/Order/types.d.ts +33 -10
  25. package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
  26. package/dist/modules/Order/utils.d.ts +0 -10
  27. package/dist/modules/Order/utils.js +13 -41
  28. package/dist/modules/Payment/index.d.ts +2 -0
  29. package/dist/modules/Payment/index.js +79 -50
  30. package/dist/modules/Payment/types.d.ts +99 -28
  31. package/dist/modules/Payment/types.js +20 -3
  32. package/dist/modules/Payment/walletpass.d.ts +25 -1
  33. package/dist/modules/Payment/walletpass.js +707 -157
  34. package/dist/modules/Product/types.d.ts +0 -1
  35. package/dist/modules/ProductList/index.js +14 -33
  36. package/dist/modules/Quotation/index.d.ts +1 -1
  37. package/dist/modules/Quotation/index.js +2 -2
  38. package/dist/modules/Rules/index.d.ts +1 -0
  39. package/dist/modules/Rules/index.js +89 -96
  40. package/dist/modules/SalesSummary/index.js +13 -12
  41. package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
  42. package/dist/modules/ScanOrderLogger/index.js +2 -15
  43. package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
  44. package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
  45. package/dist/modules/Schedule/index.d.ts +1 -3
  46. package/dist/modules/Schedule/index.js +16 -21
  47. package/dist/modules/Summary/utils.js +13 -38
  48. package/dist/modules/index.d.ts +0 -2
  49. package/dist/modules/index.js +1 -3
  50. package/dist/plugins/window.d.ts +0 -1
  51. package/dist/server/index.d.ts +16 -14
  52. package/dist/server/index.js +1925 -1143
  53. package/dist/server/modules/order/index.d.ts +54 -4
  54. package/dist/server/modules/order/index.js +1600 -700
  55. package/dist/server/modules/order/types.d.ts +11 -3
  56. package/dist/server/modules/order/types.js +1 -1
  57. package/dist/solution/BaseSales/index.d.ts +109 -20
  58. package/dist/solution/BaseSales/index.js +1800 -480
  59. package/dist/solution/BaseSales/types.d.ts +52 -0
  60. package/dist/solution/BaseSales/types.js +2 -1
  61. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  62. package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
  63. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  64. package/dist/solution/BookingByStep/index.d.ts +2 -17
  65. package/dist/solution/BookingByStep/index.js +215 -294
  66. package/dist/solution/BookingByStep/types.d.ts +1 -2
  67. package/dist/solution/BookingByStep/types.js +1 -3
  68. package/dist/solution/BookingByStep/utils/capacity.js +1 -17
  69. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  70. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  71. package/dist/solution/BookingTicket/index.d.ts +7 -3
  72. package/dist/solution/BookingTicket/index.js +132 -49
  73. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
  74. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  75. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
  76. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  77. package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
  78. package/dist/solution/Sales/index.d.ts +1 -0
  79. package/dist/solution/Sales/index.js +10 -2
  80. package/dist/solution/ScanOrder/index.d.ts +14 -26
  81. package/dist/solution/ScanOrder/index.js +756 -1148
  82. package/dist/solution/ScanOrder/types.d.ts +1 -21
  83. package/dist/solution/ScanOrder/utils.d.ts +0 -8
  84. package/dist/solution/ScanOrder/utils.js +25 -66
  85. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  86. package/dist/solution/ShopDiscount/index.js +87 -125
  87. package/dist/solution/VenueBooking/index.d.ts +11 -39
  88. package/dist/solution/VenueBooking/index.js +860 -1176
  89. package/dist/solution/VenueBooking/types.d.ts +0 -3
  90. package/dist/solution/VenueBooking/utils/resource.js +0 -1
  91. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  92. package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
  93. package/dist/solution/index.d.ts +0 -1
  94. package/dist/solution/index.js +1 -2
  95. package/dist/types/index.d.ts +1 -1
  96. package/dist/utils/payment-number.d.ts +9 -0
  97. package/dist/utils/payment-number.js +69 -0
  98. package/lib/core/index.d.ts +2 -0
  99. package/lib/core/index.js +4 -0
  100. package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  101. package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
  102. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  103. package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
  104. package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
  105. package/lib/model/strategy/adapter/promotion/examples.js +91 -0
  106. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  107. package/lib/model/strategy/adapter/promotion/index.js +51 -0
  108. package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
  109. package/lib/model/strategy/adapter/promotion/type.js +2 -0
  110. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  111. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  112. package/lib/modules/Discount/index.d.ts +0 -1
  113. package/lib/modules/Discount/index.js +0 -9
  114. package/lib/modules/Discount/types.d.ts +0 -1
  115. package/lib/modules/OpenData/index.d.ts +2 -0
  116. package/lib/modules/OpenData/index.js +6 -1
  117. package/lib/modules/Order/index.d.ts +29 -12
  118. package/lib/modules/Order/index.js +196 -86
  119. package/lib/modules/Order/payment-utils.d.ts +26 -0
  120. package/lib/modules/Order/payment-utils.js +224 -0
  121. package/lib/modules/Order/types.d.ts +33 -10
  122. package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
  123. package/lib/modules/Order/utils.d.ts +0 -10
  124. package/lib/modules/Order/utils.js +16 -40
  125. package/lib/modules/Payment/index.d.ts +2 -0
  126. package/lib/modules/Payment/index.js +34 -13
  127. package/lib/modules/Payment/types.d.ts +99 -28
  128. package/lib/modules/Payment/types.js +4 -3
  129. package/lib/modules/Payment/walletpass.d.ts +25 -1
  130. package/lib/modules/Payment/walletpass.js +470 -21
  131. package/lib/modules/Product/types.d.ts +0 -1
  132. package/lib/modules/ProductList/index.js +31 -40
  133. package/lib/modules/Quotation/index.d.ts +1 -1
  134. package/lib/modules/Quotation/index.js +2 -2
  135. package/lib/modules/Rules/index.d.ts +1 -0
  136. package/lib/modules/Rules/index.js +47 -40
  137. package/lib/modules/SalesSummary/index.js +7 -6
  138. package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
  139. package/lib/modules/ScanOrderLogger/index.js +1 -13
  140. package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
  141. package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
  142. package/lib/modules/Schedule/index.d.ts +1 -3
  143. package/lib/modules/Schedule/index.js +8 -10
  144. package/lib/modules/Summary/utils.js +1 -21
  145. package/lib/modules/index.d.ts +0 -2
  146. package/lib/modules/index.js +1 -5
  147. package/lib/plugins/window.d.ts +0 -1
  148. package/lib/server/index.d.ts +16 -14
  149. package/lib/server/index.js +675 -83
  150. package/lib/server/modules/order/index.d.ts +54 -4
  151. package/lib/server/modules/order/index.js +679 -66
  152. package/lib/server/modules/order/types.d.ts +11 -3
  153. package/lib/solution/BaseSales/index.d.ts +109 -20
  154. package/lib/solution/BaseSales/index.js +883 -70
  155. package/lib/solution/BaseSales/types.d.ts +52 -0
  156. package/lib/solution/BaseSales/types.js +2 -1
  157. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  158. package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
  159. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  160. package/lib/solution/BookingByStep/index.d.ts +2 -17
  161. package/lib/solution/BookingByStep/index.js +18 -60
  162. package/lib/solution/BookingByStep/types.d.ts +1 -2
  163. package/lib/solution/BookingByStep/types.js +0 -5
  164. package/lib/solution/BookingByStep/utils/capacity.js +1 -20
  165. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  166. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  167. package/lib/solution/BookingTicket/index.d.ts +7 -3
  168. package/lib/solution/BookingTicket/index.js +62 -9
  169. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
  170. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  171. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
  172. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  173. package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
  174. package/lib/solution/Sales/index.d.ts +1 -0
  175. package/lib/solution/Sales/index.js +5 -3
  176. package/lib/solution/ScanOrder/index.d.ts +14 -26
  177. package/lib/solution/ScanOrder/index.js +190 -449
  178. package/lib/solution/ScanOrder/types.d.ts +1 -21
  179. package/lib/solution/ScanOrder/utils.d.ts +0 -8
  180. package/lib/solution/ScanOrder/utils.js +0 -31
  181. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  182. package/lib/solution/ShopDiscount/index.js +0 -14
  183. package/lib/solution/VenueBooking/index.d.ts +11 -39
  184. package/lib/solution/VenueBooking/index.js +123 -328
  185. package/lib/solution/VenueBooking/types.d.ts +0 -3
  186. package/lib/solution/VenueBooking/utils/resource.js +0 -1
  187. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  188. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
  189. package/lib/solution/index.d.ts +0 -1
  190. package/lib/solution/index.js +1 -3
  191. package/lib/types/index.d.ts +1 -1
  192. package/lib/utils/payment-number.d.ts +9 -0
  193. package/lib/utils/payment-number.js +64 -0
  194. package/package.json +1 -1
  195. package/dist/modules/Holder/index.d.ts +0 -48
  196. package/dist/modules/Holder/index.js +0 -640
  197. package/dist/modules/Holder/types.d.ts +0 -123
  198. package/dist/modules/Holder/types.js +0 -1
  199. package/dist/modules/Holder/utils.d.ts +0 -13
  200. package/dist/modules/Holder/utils.js +0 -34
  201. package/dist/modules/ResourcePlanner/index.d.ts +0 -24
  202. package/dist/modules/ResourcePlanner/index.js +0 -181
  203. package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
  204. package/dist/modules/ResourcePlanner/planner.js +0 -1069
  205. package/dist/modules/ResourcePlanner/types.d.ts +0 -227
  206. package/dist/modules/ResourcePlanner/types.js +0 -1
  207. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
  208. package/dist/solution/UnifiedBookingSales/index.js +0 -1871
  209. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
  210. package/dist/solution/UnifiedBookingSales/types.js +0 -11
  211. package/lib/modules/Holder/index.d.ts +0 -48
  212. package/lib/modules/Holder/index.js +0 -402
  213. package/lib/modules/Holder/types.d.ts +0 -123
  214. package/lib/modules/Holder/types.js +0 -17
  215. package/lib/modules/Holder/utils.d.ts +0 -13
  216. package/lib/modules/Holder/utils.js +0 -71
  217. package/lib/modules/ResourcePlanner/index.d.ts +0 -24
  218. package/lib/modules/ResourcePlanner/index.js +0 -148
  219. package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
  220. package/lib/modules/ResourcePlanner/planner.js +0 -933
  221. package/lib/modules/ResourcePlanner/types.d.ts +0 -227
  222. package/lib/modules/ResourcePlanner/types.js +0 -17
  223. package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
  224. package/lib/solution/UnifiedBookingSales/index.js +0 -1076
  225. package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
  226. package/lib/solution/UnifiedBookingSales/types.js +0 -33
@@ -12,6 +12,8 @@ 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";
15
17
  /** 固定折扣 */
16
18
  readonly DISCOUNT_RATE: "DISCOUNT_RATE";
17
19
  /** 固定减价 */
@@ -66,6 +68,59 @@ export interface BuyXGetYFreeConfig {
66
68
  /** 可选的赠品列表 */
67
69
  giftProducts?: ProductIdentifier[];
68
70
  }
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
+ }
69
124
  /**
70
125
  * 商品标识
71
126
  *
@@ -102,10 +157,19 @@ export interface BuyXGetYFreeAction extends Omit<ActionEffect, 'type' | 'value'
102
157
  valueType: 'object';
103
158
  config?: BuyXGetYFreeConfig;
104
159
  }
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
+ }
105
169
  /**
106
170
  * 促销活动 Action 联合类型
107
171
  */
108
- export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction;
172
+ export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction | ItemRewardAction;
109
173
  /**
110
174
  * 促销相关运算符
111
175
  */
@@ -170,6 +234,8 @@ export interface PromotionProduct {
170
234
  quantity: number;
171
235
  /** 原价 */
172
236
  original_price?: number;
237
+ /** 内部字段:编辑态订单行只允许参与 ITEM_REWARD,避免旧促销误算历史行 */
238
+ _promotionOnlyForItemReward?: boolean;
173
239
  }
174
240
  /**
175
241
  * 促销活动适配器转换结果
@@ -195,7 +261,7 @@ export interface PromotionTransformResult {
195
261
  /**
196
262
  * Action 详情联合类型
197
263
  */
198
- export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail;
264
+ export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail | ItemRewardActionDetail;
199
265
  /**
200
266
  * X件Y元 Action 详情
201
267
  */
@@ -226,6 +292,28 @@ export interface BuyXGetYFreeActionDetail {
226
292
  /** 可选的赠品列表 */
227
293
  giftProducts: ProductIdentifier[];
228
294
  }
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
+ }
229
317
  /**
230
318
  * X件Y元 - 业务层计算结果
231
319
  *
@@ -16,6 +16,8 @@ export var PROMOTION_ACTION_TYPES = {
16
16
  X_ITEMS_FOR_Y_PRICE: 'X_ITEMS_FOR_Y_PRICE',
17
17
  /** 买X送Y(买X件送Y件,可累计) */
18
18
  BUY_X_GET_Y_FREE: 'BUY_X_GET_Y_FREE',
19
+ /** 商品奖励(满足条件后,订单内指定目标商品享优惠) */
20
+ ITEM_REWARD: 'ITEM_REWARD',
19
21
  /** 固定折扣 */
20
22
  DISCOUNT_RATE: 'DISCOUNT_RATE',
21
23
  /** 固定减价 */
@@ -54,6 +56,41 @@ export var PROMOTION_ACTION_TYPES = {
54
56
  * 买X送Y - Action Config
55
57
  */
56
58
 
59
+ /**
60
+ * 商品奖励优惠方式
61
+ *
62
+ * - free: 目标商品最终价为 0
63
+ * - percent_off: 目标商品按百分比折扣,rewardValue 为 0-100
64
+ * - amount_off: 每个目标商品固定减免 rewardValue
65
+ * - fixed_price: 目标商品改为固定价 rewardValue
66
+ */
67
+
68
+ /**
69
+ * 商品奖励数量规则
70
+ *
71
+ * - per_condition_quantity: 每满足 N 个条件商品,奖励 Y 个目标商品
72
+ * - all_targets: 满足条件后奖励全部目标商品
73
+ * - max_per_order: 满足条件后每单最多奖励固定数量目标商品
74
+ */
75
+
76
+ /** 商品奖励目标选择规则 */
77
+
78
+ /**
79
+ * 商品奖励 - Action Value
80
+ *
81
+ * @example
82
+ * value: {
83
+ * rewardMethod: 'free',
84
+ * quantityRule: 'per_condition_quantity',
85
+ * triggerQuantity: 1,
86
+ * rewardQuantity: 1,
87
+ * }
88
+ */
89
+
90
+ /**
91
+ * 商品奖励 - Action Config
92
+ */
93
+
57
94
  // ============================================
58
95
  // 商品标识
59
96
  // ============================================
@@ -78,6 +115,10 @@ export var PROMOTION_ACTION_TYPES = {
78
115
  * 买X送Y Action
79
116
  */
80
117
 
118
+ /**
119
+ * 商品奖励 Action
120
+ */
121
+
81
122
  /**
82
123
  * 促销活动 Action 联合类型
83
124
  */
@@ -146,6 +187,10 @@ var obj = {
146
187
  * 买X送Y Action 详情
147
188
  */
148
189
 
190
+ /**
191
+ * 商品奖励 Action 详情
192
+ */
193
+
149
194
  // ============================================
150
195
  // 业务层输出类型(供参考)
151
196
  // ============================================
@@ -190,7 +190,7 @@ function synthesizeProductResourceFromBooking(booking) {
190
190
  * 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
191
191
  */
192
192
  export function buildCacheItemFromOrderLine(input) {
193
- var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num, _ref10, _product$note, _booking$detail2, _product$metadata, _product$metadata2, _ref11, _extension_type, _booking$product2, _booking$product3, _price, _product$order_detail, _ref12, _booking$id;
193
+ var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num, _ref10, _product$note, _booking$detail2, _product$metadata, _product$metadata2, _ref11, _extension_type, _booking$product2, _booking$product3, _price, _product$product_sku, _product$order_detail, _ref12, _booking$id;
194
194
  var product = input.product,
195
195
  booking = input.booking,
196
196
  sourceProduct = input.sourceProduct;
@@ -257,7 +257,7 @@ export function buildCacheItemFromOrderLine(input) {
257
257
  if (Array.isArray(booking.relation_forms)) {
258
258
  extend.relation_forms = booking.relation_forms;
259
259
  }
260
- var base = _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
260
+ var base = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
261
261
  id: resolvedId,
262
262
  product_id: resolvedId,
263
263
  extension_type: (_ref11 = (_extension_type = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type) !== null && _extension_type !== void 0 ? _extension_type : booking === null || booking === void 0 || (_booking$product2 = booking.product) === null || _booking$product2 === void 0 ? void 0 : _booking$product2.extension_type) !== null && _ref11 !== void 0 ? _ref11 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type,
@@ -265,7 +265,9 @@ export function buildCacheItemFromOrderLine(input) {
265
265
  price: (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : selling,
266
266
  selling_price: product.selling_price,
267
267
  original_price: product.original_price
268
- }, productOptionString ? {
268
+ }, Number(((_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.open_sold_weight) || 0) === 1 ? {
269
+ product_sku: JSON.parse(JSON.stringify(product.product_sku))
270
+ } : {}), productOptionString ? {
269
271
  product_option_string: productOptionString
270
272
  } : {}), {}, {
271
273
  _extend: extend,
@@ -75,7 +75,7 @@ function mapOrderBundleToOtherBundle(bundle) {
75
75
  });
76
76
  }
77
77
  export function buildNormalProductCacheItemFromOrderLine(input) {
78
- var _product$product_id, _product$selling_pric2, _product$original_pri, _product$metadata, _product$metadata2, _product$product_vari, _originExtend$other, _product$num, _product$product_vari2, _product$num2, _title, _product$note, _originExtend$price, _originExtend$total, _originExtend$origin_, _product$metadata3, _ref6, _title2, _ref7, _cover, _price3, _product$order_detail;
78
+ var _product$product_id, _product$selling_pric2, _product$original_pri, _product$metadata, _product$metadata2, _product$product_vari, _originExtend$other, _product$num, _product$product_vari2, _product$num2, _title, _product$note, _originExtend$price, _originExtend$total, _originExtend$origin_, _product$metadata3, _ref6, _title2, _ref7, _cover, _price3, _product$order_detail, _product$product_sku;
79
79
  var product = input.product,
80
80
  sourceProduct = input.sourceProduct;
81
81
  var resolvedId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id;
@@ -127,7 +127,7 @@ export function buildNormalProductCacheItemFromOrderLine(input) {
127
127
  extend.skuValue = JSON.parse(JSON.stringify(originExtend.skuValue || originExtend._skuValue));
128
128
  extend._skuValue = JSON.parse(JSON.stringify(extend.skuValue));
129
129
  }
130
- return _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
130
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
131
131
  id: resolvedId,
132
132
  product_id: resolvedId,
133
133
  _id: uid,
@@ -141,7 +141,10 @@ export function buildNormalProductCacheItemFromOrderLine(input) {
141
141
  } : {}), {}, {
142
142
  note: product.note,
143
143
  order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
144
- discount_list: discountList,
144
+ discount_list: discountList
145
+ }, Number(((_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.open_sold_weight) || 0) === 1 ? {
146
+ product_sku: JSON.parse(JSON.stringify(product.product_sku))
147
+ } : {}), {}, {
145
148
  new: 0,
146
149
  autoClose: true,
147
150
  _extend: extend
@@ -32,7 +32,6 @@ 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>;
36
35
  filterEnabledDiscountList(discountList: Discount[]): Discount[];
37
36
  private checkUsageCreditsLimit;
38
37
  filterEnabledDiscountListWithReason(discountList: Discount[]): DiscountWithReason;
@@ -244,35 +244,6 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
244
244
  }
245
245
  return batchSearch;
246
246
  }()
247
- }, {
248
- key: "batchSearchByProductIds",
249
- value: function () {
250
- var _batchSearchByProductIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(productIds) {
251
- var result;
252
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
253
- while (1) switch (_context6.prev = _context6.next) {
254
- case 0:
255
- _context6.next = 2;
256
- return this.request.get("/machinecode/batch-search", {
257
- ids: productIds,
258
- translate_flag: 1,
259
- tags: ['good_pass', 'product_discount_card'],
260
- relation_product: 1
261
- });
262
- case 2:
263
- result = _context6.sent;
264
- return _context6.abrupt("return", (result === null || result === void 0 ? void 0 : result.data) || []);
265
- case 4:
266
- case "end":
267
- return _context6.stop();
268
- }
269
- }, _callee6, this);
270
- }));
271
- function batchSearchByProductIds(_x8) {
272
- return _batchSearchByProductIds.apply(this, arguments);
273
- }
274
- return batchSearchByProductIds;
275
- }()
276
247
  }, {
277
248
  key: "filterEnabledDiscountList",
278
249
  value: function filterEnabledDiscountList(discountList) {
@@ -459,22 +430,22 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
459
430
  }, {
460
431
  key: "destroy",
461
432
  value: function () {
462
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
463
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
464
- while (1) switch (_context7.prev = _context7.next) {
433
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
434
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
435
+ while (1) switch (_context6.prev = _context6.next) {
465
436
  case 0:
466
437
  this.store.discountList = [];
467
438
  this.core.effects.offByModuleDestroy(this.name);
468
- _context7.next = 4;
439
+ _context6.next = 4;
469
440
  return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
470
441
  case 4:
471
442
  console.log('[Discount] 已销毁');
472
443
  _get(_getPrototypeOf(DiscountModule.prototype), "destroy", this).call(this);
473
444
  case 6:
474
445
  case "end":
475
- return _context7.stop();
446
+ return _context6.stop();
476
447
  }
477
- }, _callee7, this);
448
+ }, _callee6, this);
478
449
  }));
479
450
  function destroy() {
480
451
  return _destroy.apply(this, arguments);
@@ -484,18 +455,18 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
484
455
  }, {
485
456
  key: "clear",
486
457
  value: function () {
487
- var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
488
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
489
- while (1) switch (_context8.prev = _context8.next) {
458
+ var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
459
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
460
+ while (1) switch (_context7.prev = _context7.next) {
490
461
  case 0:
491
462
  this.store.discountList = [];
492
463
  this.store.originalDiscountList = [];
493
464
  console.log('[Discount] clear');
494
465
  case 3:
495
466
  case "end":
496
- return _context8.stop();
467
+ return _context7.stop();
497
468
  }
498
- }, _callee8, this);
469
+ }, _callee7, this);
499
470
  }));
500
471
  function clear() {
501
472
  return _clear.apply(this, arguments);
@@ -157,7 +157,6 @@ export interface Discount {
157
157
  num?: number;
158
158
  start_date?: string;
159
159
  start_time?: string;
160
- discount_rule_uncheck_flag?: boolean;
161
160
  usageLimitFailKey?: string | null;
162
161
  unified_available_status?: number | undefined | null;
163
162
  }
@@ -27,6 +27,8 @@ export declare class OpenDataModule extends BaseModule implements Module {
27
27
  fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
28
28
  getOpenData(): OpenDataConfig | null;
29
29
  getLastFetchedAt(): number | null;
30
+ /** 清除内存与 sessionStorage 镜像中的 OpenData,供宿主切店时调用。 */
31
+ clearCache(): void;
30
32
  checkAvailability(scheduleModule?: ScheduleModule): OpenDataAvailabilityResult;
31
33
  storeChange(): void;
32
34
  }
@@ -105,12 +105,12 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
105
105
  key: "fetchOpenData",
106
106
  value: function () {
107
107
  var _fetchOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
108
- var _this$appPlugin, _this$appPlugin$getDa;
108
+ var _this$appPlugin$getDa, _this$appPlugin;
109
109
  var getData, shopId, tenantId, headers, response, data;
110
110
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
111
111
  while (1) switch (_context2.prev = _context2.next) {
112
112
  case 0:
113
- getData = (_this$appPlugin = this.appPlugin) === null || _this$appPlugin === void 0 || (_this$appPlugin$getDa = _this$appPlugin.getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
113
+ getData = (_this$appPlugin$getDa = (_this$appPlugin = this.appPlugin).getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
114
114
  shopId = getData === null || getData === void 0 ? void 0 : getData('shop_id');
115
115
  if (shopId) {
116
116
  _context2.next = 4;
@@ -166,6 +166,14 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
166
166
  var _this$store$lastFetch;
167
167
  return (_this$store$lastFetch = this.store.lastFetchedAt) !== null && _this$store$lastFetch !== void 0 ? _this$store$lastFetch : null;
168
168
  }
169
+
170
+ /** 清除内存与 sessionStorage 镜像中的 OpenData,供宿主切店时调用。 */
171
+ }, {
172
+ key: "clearCache",
173
+ value: function clearCache() {
174
+ this.store.data = null;
175
+ this.store.lastFetchedAt = null;
176
+ }
169
177
  }, {
170
178
  key: "checkAvailability",
171
179
  value: function checkAvailability(scheduleModule) {
@@ -1,9 +1,9 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
- import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CancelOrderParams, ChangeBookingStatusParams, CheckoutOrderParams } from './types';
3
+ import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CheckoutOrderParams, CancelOrderParams, ChangeBookingStatusParams } from './types';
4
4
  import { CartItem } from '../Cart/types';
5
5
  import { type SubmitPayloadEnhancer } from './utils';
6
- import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from './types';
6
+ import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from './types';
7
7
  import type { ICustomer } from '../AccountList/types';
8
8
  import type { Discount } from '../Discount/types';
9
9
  import { UnavailableReason } from '../Rules/types';
@@ -14,6 +14,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
14
14
  private request;
15
15
  private logger;
16
16
  private window;
17
+ private appPlugin;
17
18
  private cacheId;
18
19
  private salesSummaryModuleName;
19
20
  private rulesHooksOverride?;
@@ -145,7 +146,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
145
146
  isTempOrderPersistEnabled(): boolean;
146
147
  /** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化;草稿保存请使用 IndexedDB saveDraft。 */
147
148
  persistTempOrder(): void;
148
- notifyTempOrderChanged(): void;
149
149
  private createDefaultTempOrderInstance;
150
150
  private createExternalSaleNumber;
151
151
  private ensureExternalSaleNumber;
@@ -177,6 +177,9 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
177
177
  };
178
178
  private calculateDepositPaidAmount;
179
179
  private resolveNextOrderPaymentType;
180
+ private getPaymentNumberAppData;
181
+ private getPaymentNumberDevicePrefixSync;
182
+ private getPaymentNumberDevicePrefixAsync;
180
183
  private normalizePaymentSource;
181
184
  private updateTempOrderPaymentStatus;
182
185
  private shouldKeepPaymentStatusAfterAmountRecalc;
@@ -308,19 +311,20 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
308
311
  * 用一组支付来源覆盖当前订单支付项。
309
312
  *
310
313
  * 入参允许来自 PaymentModule 的 PaymentItem,内部统一映射为 Sales 协议:
311
- * uuid -> metadata.unique_payment_number,id -> custom_payment_id,
314
+ * 新支付来源的 uuid 会作为 payment_number 的唯一号段,id -> custom_payment_id,
312
315
  * isSynced 等运行态字段不会进入 tempOrder.payments。
313
316
  */
314
317
  setOrderPayments(payments: OrderPaymentSource[]): OrderPaymentData[];
315
- /** 追加单个支付项,并立即持久化当前 tempOrder。 */
318
+ /** 同步兼容入口:按调用当下的 device_id 或 LOCAL 生成支付编号。 */
316
319
  addOrderPayment(payment: OrderPaymentSource): OrderPaymentData[];
320
+ /** 异步入口:创建支付项时读取最新 IoT 设备短号。 */
321
+ addOrderPaymentAsync(payment: OrderPaymentSource): Promise<OrderPaymentData[]>;
322
+ private addOrderPaymentWithDevicePrefix;
317
323
  /**
318
- * 按支付唯一号、后端支付 ID、自定义支付方式 ID 或旧 uuid 更新支付项。
319
- *
320
- * 该方法服务 PaymentModal 的 void / 编辑场景;更新 metadata 时会做浅合并,
321
- * 避免覆盖 unique_payment_number、现金实付/找零等已有元数据。
324
+ * 默认按支付唯一号精确更新;仅显式指定 legacy 时兼容历史支付标识。
325
+ * metadata 与 transactions 会分别合并,避免覆盖支付会话号和已有交易记录。
322
326
  */
323
- updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>): OrderPaymentData[];
327
+ updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>, options?: OrderPaymentUpdateOptions): Promise<OrderPaymentUpdateResult>;
324
328
  /** 从当前订单支付项中移除指定支付项。 */
325
329
  deleteOrderPayment(paymentIdentity: string | number): OrderPaymentData[];
326
330
  private confirmPendingVoucherPaymentsInList;
@@ -343,7 +347,11 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
343
347
  */
344
348
  updateVoucherOrderPayments(payments: OrderPaymentSource[], options?: {
345
349
  status?: 'paid' | 'payment_pending';
350
+ devicePrefix?: string;
346
351
  }): OrderPaymentData[];
352
+ updateVoucherOrderPaymentsAsync(payments: OrderPaymentSource[], options?: {
353
+ status?: 'paid' | 'payment_pending';
354
+ }): Promise<OrderPaymentData[]>;
347
355
  private shouldMergeProductToOrder;
348
356
  private hasOrderProductLineNote;
349
357
  /**
@@ -428,6 +436,14 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
428
436
  type?: string;
429
437
  }): import("./types").OrderSubmitPayload;
430
438
  applyLocalPrintOrderNumbers(order?: Record<string, any> | null): Promise<OrderTempOrder>;
439
+ saveTempOrderAsDraft<T = any>(params?: {
440
+ cacheId?: string;
441
+ platform?: string;
442
+ businessCode?: string;
443
+ channel?: string;
444
+ type?: string;
445
+ enhancePayload?: SubmitPayloadEnhancer;
446
+ }): Promise<T>;
431
447
  /**
432
448
  * 提交当前 Sales tempOrder。
433
449
  *
@@ -469,7 +485,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
469
485
  generateIdempotencyToken(): string;
470
486
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
471
487
  createOrder(params: CommitOrderParams['query']): {
472
- type: "virtual" | "appointment_booking";
488
+ type: "appointment_booking" | "virtual";
473
489
  platform: string;
474
490
  sales_channel: string;
475
491
  order_sales_channel: string;
@@ -479,7 +495,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
479
495
  is_deposit: number;
480
496
  relation_products: any[];
481
497
  relation_forms: any[];
482
- business_code: string | undefined;
483
498
  };
484
499
  checkBeforeSubmitOrder(params: {
485
500
  cartItems: CartItem[];
@@ -533,6 +548,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
533
548
  */
534
549
  private seedAnonymousBookingUidsFromProducts;
535
550
  private normalizeTempOrderForRuntime;
551
+ private isSyntheticDraftOrderIdForRuntime;
552
+ private withoutSyntheticDraftOrderIdForRuntime;
536
553
  private hydrateLinkedBookingIdentity;
537
554
  private pickHydratedDisplayText;
538
555
  private formatHydratedNamePair;