@pisell/pisellos 2.1.149 → 2.1.151

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 (197) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/model/strategy/adapter/promotion/evaluator.js +99 -26
  4. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  5. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
  6. package/dist/model/strategy/adapter/walletPass/evaluator.js +61 -8
  7. package/dist/model/strategy/adapter/walletPass/locales.js +12 -3
  8. package/dist/model/strategy/engine.d.ts +18 -5
  9. package/dist/model/strategy/engine.js +145 -45
  10. package/dist/model/strategy/type.d.ts +17 -0
  11. package/dist/model/strategy/type.js +4 -0
  12. package/dist/modules/Cart/types.d.ts +2 -0
  13. package/dist/modules/Cart/utils/cartProduct.js +56 -25
  14. package/dist/modules/Discount/types.d.ts +19 -1
  15. package/dist/modules/Order/index.d.ts +1 -65
  16. package/dist/modules/Order/index.js +30 -899
  17. package/dist/modules/Order/types.d.ts +12 -174
  18. package/dist/modules/Order/types.js +0 -2
  19. package/dist/modules/Order/utils.d.ts +0 -118
  20. package/dist/modules/Order/utils.js +2 -586
  21. package/dist/modules/Payment/index.d.ts +2 -1
  22. package/dist/modules/Payment/index.js +10 -7
  23. package/dist/modules/Payment/utils.js +3 -0
  24. package/dist/modules/Payment/walletpass.d.ts +23 -0
  25. package/dist/modules/Payment/walletpass.js +191 -95
  26. package/dist/modules/Product/utils.js +2 -2
  27. package/dist/modules/ProductList/index.d.ts +1 -1
  28. package/dist/modules/ProductList/index.js +3 -4
  29. package/dist/modules/Rules/index.d.ts +9 -5
  30. package/dist/modules/Rules/index.js +677 -168
  31. package/dist/modules/Rules/types.d.ts +2 -0
  32. package/dist/modules/Schedule/getDateIsInSchedule.js +18 -11
  33. package/dist/modules/Schedule/utils.d.ts +1 -1
  34. package/dist/modules/Summary/types.d.ts +2 -0
  35. package/dist/modules/Summary/utils.d.ts +9 -3
  36. package/dist/modules/Summary/utils.js +52 -41
  37. package/dist/modules/index.d.ts +0 -4
  38. package/dist/modules/index.js +1 -5
  39. package/dist/plugins/window.d.ts +2 -0
  40. package/dist/solution/BookingByStep/index.d.ts +3 -2
  41. package/dist/solution/BookingByStep/index.js +43 -46
  42. package/dist/solution/BookingByStep/types.d.ts +1 -3
  43. package/dist/solution/BookingByStep/types.js +1 -5
  44. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  45. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  46. package/dist/solution/Checkout/index.js +2 -0
  47. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  48. package/dist/solution/ShopDiscount/index.js +23 -7
  49. package/dist/solution/ShopDiscount/types.d.ts +1 -0
  50. package/dist/solution/ShopDiscount/types.js +2 -1
  51. package/dist/solution/ShopDiscount/utils.js +26 -12
  52. package/dist/solution/index.d.ts +0 -2
  53. package/dist/solution/index.js +1 -3
  54. package/lib/index.d.ts +1 -0
  55. package/lib/index.js +3 -1
  56. package/lib/model/strategy/adapter/promotion/evaluator.js +57 -8
  57. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
  58. package/lib/model/strategy/adapter/walletPass/evaluator.js +34 -3
  59. package/lib/model/strategy/adapter/walletPass/locales.js +12 -3
  60. package/lib/model/strategy/engine.d.ts +18 -5
  61. package/lib/model/strategy/engine.js +85 -21
  62. package/lib/model/strategy/type.d.ts +17 -0
  63. package/lib/modules/Cart/types.d.ts +2 -0
  64. package/lib/modules/Cart/utils/cartProduct.js +39 -12
  65. package/lib/modules/Discount/types.d.ts +19 -1
  66. package/lib/modules/Order/index.d.ts +1 -65
  67. package/lib/modules/Order/index.js +1 -513
  68. package/lib/modules/Order/types.d.ts +12 -174
  69. package/lib/modules/Order/utils.d.ts +0 -118
  70. package/lib/modules/Order/utils.js +2 -483
  71. package/lib/modules/Payment/index.d.ts +2 -1
  72. package/lib/modules/Payment/index.js +1 -0
  73. package/lib/modules/Payment/utils.js +3 -0
  74. package/lib/modules/Payment/walletpass.d.ts +23 -0
  75. package/lib/modules/Payment/walletpass.js +94 -17
  76. package/lib/modules/Product/utils.js +2 -2
  77. package/lib/modules/ProductList/index.d.ts +1 -1
  78. package/lib/modules/ProductList/index.js +3 -5
  79. package/lib/modules/Rules/index.d.ts +9 -5
  80. package/lib/modules/Rules/index.js +780 -288
  81. package/lib/modules/Rules/types.d.ts +2 -0
  82. package/lib/modules/Schedule/getDateIsInSchedule.js +11 -9
  83. package/lib/modules/Schedule/utils.d.ts +1 -1
  84. package/lib/modules/Summary/types.d.ts +2 -0
  85. package/lib/modules/Summary/utils.d.ts +9 -3
  86. package/lib/modules/Summary/utils.js +31 -22
  87. package/lib/modules/index.d.ts +0 -4
  88. package/lib/modules/index.js +1 -9
  89. package/lib/plugins/window.d.ts +2 -0
  90. package/lib/solution/BookingByStep/index.d.ts +3 -2
  91. package/lib/solution/BookingByStep/index.js +4 -6
  92. package/lib/solution/BookingByStep/types.d.ts +1 -3
  93. package/lib/solution/BookingByStep/types.js +0 -10
  94. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  95. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  96. package/lib/solution/Checkout/index.js +2 -0
  97. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  98. package/lib/solution/ShopDiscount/index.js +22 -8
  99. package/lib/solution/ShopDiscount/types.d.ts +1 -0
  100. package/lib/solution/ShopDiscount/utils.js +10 -6
  101. package/lib/solution/index.d.ts +0 -2
  102. package/lib/solution/index.js +1 -5
  103. package/package.json +1 -1
  104. package/dist/apis/picoding.d.ts +0 -0
  105. package/dist/apis/picoding.js +0 -1
  106. package/dist/modules/OpenData/index.d.ts +0 -24
  107. package/dist/modules/OpenData/index.js +0 -173
  108. package/dist/modules/OpenData/types.d.ts +0 -73
  109. package/dist/modules/OpenData/types.js +0 -1
  110. package/dist/modules/OpenData/utils.d.ts +0 -2
  111. package/dist/modules/OpenData/utils.js +0 -75
  112. package/dist/modules/Quotation/index.d.ts +0 -48
  113. package/dist/modules/Quotation/index.js +0 -248
  114. package/dist/modules/Quotation/types.d.ts +0 -42
  115. package/dist/modules/Quotation/types.js +0 -1
  116. package/dist/modules/SalesSummary/index.d.ts +0 -63
  117. package/dist/modules/SalesSummary/index.js +0 -174
  118. package/dist/modules/SalesSummary/types.d.ts +0 -60
  119. package/dist/modules/SalesSummary/types.js +0 -1
  120. package/dist/modules/SalesSummary/utils.d.ts +0 -30
  121. package/dist/modules/SalesSummary/utils.js +0 -480
  122. package/dist/modules/ScanOrderLogger/index.d.ts +0 -23
  123. package/dist/modules/ScanOrderLogger/index.js +0 -174
  124. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
  125. package/dist/modules/ScanOrderLogger/providers/feishu.js +0 -221
  126. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
  127. package/dist/modules/ScanOrderLogger/providers/grafana.js +0 -50
  128. package/dist/modules/ScanOrderLogger/types.d.ts +0 -53
  129. package/dist/modules/ScanOrderLogger/types.js +0 -1
  130. package/dist/solution/ScanOrder/index.d.ts +0 -152
  131. package/dist/solution/ScanOrder/index.js +0 -3132
  132. package/dist/solution/ScanOrder/types.d.ts +0 -287
  133. package/dist/solution/ScanOrder/types.js +0 -35
  134. package/dist/solution/ScanOrder/utils.d.ts +0 -167
  135. package/dist/solution/ScanOrder/utils.js +0 -764
  136. package/dist/solution/VenueBooking/index.d.ts +0 -199
  137. package/dist/solution/VenueBooking/index.js +0 -3459
  138. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -343
  139. package/dist/solution/VenueBooking/types.d.ts +0 -154
  140. package/dist/solution/VenueBooking/types.js +0 -21
  141. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
  142. package/dist/solution/VenueBooking/utils/dateSummary.js +0 -104
  143. package/dist/solution/VenueBooking/utils/resource.d.ts +0 -14
  144. package/dist/solution/VenueBooking/utils/resource.js +0 -131
  145. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -38
  146. package/dist/solution/VenueBooking/utils/slotMerge.js +0 -239
  147. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -32
  148. package/dist/solution/VenueBooking/utils/timeSlot.js +0 -453
  149. package/dist/solution/VenueBooking/utils.d.ts +0 -1
  150. package/dist/solution/VenueBooking/utils.js +0 -1
  151. package/lib/apis/picoding.d.ts +0 -0
  152. package/lib/apis/picoding.js +0 -0
  153. package/lib/modules/OpenData/index.d.ts +0 -24
  154. package/lib/modules/OpenData/index.js +0 -119
  155. package/lib/modules/OpenData/types.d.ts +0 -73
  156. package/lib/modules/OpenData/types.js +0 -17
  157. package/lib/modules/OpenData/utils.d.ts +0 -2
  158. package/lib/modules/OpenData/utils.js +0 -111
  159. package/lib/modules/Quotation/index.d.ts +0 -48
  160. package/lib/modules/Quotation/index.js +0 -152
  161. package/lib/modules/Quotation/types.d.ts +0 -42
  162. package/lib/modules/Quotation/types.js +0 -17
  163. package/lib/modules/SalesSummary/index.d.ts +0 -63
  164. package/lib/modules/SalesSummary/index.js +0 -105
  165. package/lib/modules/SalesSummary/types.d.ts +0 -60
  166. package/lib/modules/SalesSummary/types.js +0 -17
  167. package/lib/modules/SalesSummary/utils.d.ts +0 -30
  168. package/lib/modules/SalesSummary/utils.js +0 -420
  169. package/lib/modules/ScanOrderLogger/index.d.ts +0 -23
  170. package/lib/modules/ScanOrderLogger/index.js +0 -147
  171. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
  172. package/lib/modules/ScanOrderLogger/providers/feishu.js +0 -157
  173. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
  174. package/lib/modules/ScanOrderLogger/providers/grafana.js +0 -52
  175. package/lib/modules/ScanOrderLogger/types.d.ts +0 -53
  176. package/lib/modules/ScanOrderLogger/types.js +0 -17
  177. package/lib/solution/ScanOrder/index.d.ts +0 -152
  178. package/lib/solution/ScanOrder/index.js +0 -1901
  179. package/lib/solution/ScanOrder/types.d.ts +0 -287
  180. package/lib/solution/ScanOrder/types.js +0 -36
  181. package/lib/solution/ScanOrder/utils.d.ts +0 -167
  182. package/lib/solution/ScanOrder/utils.js +0 -635
  183. package/lib/solution/VenueBooking/index.d.ts +0 -199
  184. package/lib/solution/VenueBooking/index.js +0 -1926
  185. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -343
  186. package/lib/solution/VenueBooking/types.d.ts +0 -154
  187. package/lib/solution/VenueBooking/types.js +0 -44
  188. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
  189. package/lib/solution/VenueBooking/utils/dateSummary.js +0 -110
  190. package/lib/solution/VenueBooking/utils/resource.d.ts +0 -14
  191. package/lib/solution/VenueBooking/utils/resource.js +0 -92
  192. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -38
  193. package/lib/solution/VenueBooking/utils/slotMerge.js +0 -237
  194. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -32
  195. package/lib/solution/VenueBooking/utils/timeSlot.js +0 -339
  196. package/lib/solution/VenueBooking/utils.d.ts +0 -1
  197. package/lib/solution/VenueBooking/utils.js +0 -69
@@ -1,9 +1,4 @@
1
1
  import { CartItem } from '../Cart/types';
2
- import type { ScanOrderTempOrder, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderSummary } from '../../solution/ScanOrder/types';
3
- import type { DiscountModule } from '../Discount';
4
- import type { RulesModule } from '../Rules';
5
- import type { Discount } from '../Discount/types';
6
- import type { SubmitPayloadEnhancer } from './utils';
7
2
  export declare enum OrderHooks {
8
3
  OnOrderCreate = "order:onOrderCreate",
9
4
  OnOrderUpdate = "order:onOrderUpdate",
@@ -11,19 +6,6 @@ export declare enum OrderHooks {
11
6
  OnOrderStatusChange = "order:onOrderStatusChange"
12
7
  }
13
8
  export interface OrderState {
14
- tempOrder: ScanOrderTempOrder | null;
15
- discountList: any[];
16
- discount: DiscountModule | null;
17
- rules: RulesModule | null;
18
- }
19
- /** 更新购物车行:仅传 SKU 时命中同 SKU 第一行;多行同 SKU 须传 identity_key / 选项指纹等 */
20
- export interface UpdateProductInOrderParams {
21
- product_id: number | null;
22
- product_variant_id: number;
23
- updates: Partial<ScanOrderOrderProduct>;
24
- identity_key?: string;
25
- product_option_item?: any[];
26
- product_bundle?: any[];
27
9
  }
28
10
  /**
29
11
  * 订单信息
@@ -38,126 +20,6 @@ export interface CommitOrderParams {
38
20
  business_code?: string;
39
21
  };
40
22
  }
41
- export interface SubmitScanOrderProduct {
42
- order_detail_id: number | null;
43
- product_id: number | null;
44
- num: number;
45
- product_variant_id: number;
46
- product_option_item: any[];
47
- /**
48
- * 行 composite 券后单价。
49
- * 公式:`metadata.main_product_selling_price` + Σ(bundle_selling_price × num)。
50
- * 主商品(含 option、含主商品折扣)的单价存在 `metadata.main_product_selling_price`。
51
- */
52
- selling_price: string;
53
- /**
54
- * 行 composite 券前单价。
55
- * 公式:`metadata.main_product_original_price` + Σ(bundle 原价 × num)。
56
- * 主商品(含 option、不含折扣)的单价存在 `metadata.main_product_original_price`。
57
- */
58
- original_price: string;
59
- /** 出站兼容字段,直接由 `selling_price` 派生,语义同 composite。 */
60
- payment_price: string;
61
- tax_fee: string;
62
- is_charge_tax: number;
63
- discount_list: any[];
64
- product_bundle: any[];
65
- metadata: Record<string, any>;
66
- /** 商品行备注 */
67
- note?: string;
68
- }
69
- export interface SubmitScanOrderSummary {
70
- product_quantity: number;
71
- product_original_amount: string;
72
- product_amount: string;
73
- product_expect_amount: string;
74
- product_tax_fee: string;
75
- shipping_fee: string;
76
- shipping_tax_fee: string;
77
- tax_fee: string;
78
- surcharge_fee: string;
79
- discount_amount: string;
80
- deposit_amount: string;
81
- expect_amount: string;
82
- total_amount: string;
83
- amount_gap: string;
84
- rounding_amount: string;
85
- pay_service_charge_amount: string;
86
- }
87
- export interface SubmitScanOrderBooking {
88
- relation_id?: string;
89
- form_id?: string;
90
- collect_pax?: number;
91
- start_time?: string;
92
- end_time?: string;
93
- metadata?: Record<string, any>;
94
- resources?: Array<Record<string, any>>;
95
- product_uid?: string;
96
- }
97
- export interface SubmitScanOrderFormRecord {
98
- form_id: number | string;
99
- form_record_id: number | string;
100
- }
101
- export interface SubmitScanOrderParams {
102
- url?: string;
103
- query: {
104
- order_id: number | null;
105
- relation_id?: string;
106
- table_form_id?: string;
107
- resource_id?: string;
108
- order_number: string;
109
- shop_order_number: string;
110
- type: string;
111
- business_code: string;
112
- platform: 'H5' | 'PC';
113
- request_unique_idempotency_token?: string;
114
- sales_channel: string;
115
- order_sales_channel: string;
116
- status: string;
117
- payment_status: string;
118
- shipping_status: string;
119
- customer_id: number | null;
120
- customer_name: string;
121
- country_calling_code: string;
122
- phone: string;
123
- email: string;
124
- is_price_include_tax: number;
125
- tax_title: string;
126
- tax_country_code: string;
127
- currency_code: string;
128
- currency_symbol: string;
129
- currency_format: string;
130
- is_deposit: number;
131
- deposit_amount: string;
132
- shop_discount: string;
133
- surcharge_fee: string;
134
- note: string;
135
- delivery_type?: string;
136
- table_number?: Record<string, any>;
137
- schedule_date: string;
138
- created_at?: string;
139
- products: SubmitScanOrderProduct[];
140
- bookings: SubmitScanOrderBooking[];
141
- payments: any[];
142
- surcharges?: any[];
143
- discount_list: any[];
144
- relation_forms: any[];
145
- form_record_ids?: SubmitScanOrderFormRecord[];
146
- contacts: any[];
147
- contacts_info: any[];
148
- holder: Record<string, any> | null;
149
- summary?: SubmitScanOrderSummary;
150
- metadata: Record<string, any>;
151
- };
152
- }
153
- export interface ScanOrderMoreParams {
154
- url?: string;
155
- query: {
156
- order_id: number | string;
157
- products: SubmitScanOrderProduct[];
158
- request_unique_idempotency_token?: string;
159
- };
160
- }
161
23
  /**
162
24
  * 支付项数据
163
25
  */
@@ -201,11 +63,23 @@ export interface CheckoutOrderParams {
201
63
  * 订单模块 API
202
64
  */
203
65
  export interface OrderModuleAPI {
66
+ /**
67
+ * 创建订单
68
+ * @param params 订单信息
69
+ * @returns 订单信息
70
+ */
204
71
  createOrder: (params: CommitOrderParams['query']) => any;
72
+ /**
73
+ * 检查购物车提交订单前是否符合条件
74
+ */
205
75
  checkBeforeSubmitOrder: (params: {
206
76
  cartItems: CartItem[];
207
77
  type: 'holder' | 'account';
208
78
  }) => boolean;
79
+ /**
80
+ * 提交订单
81
+ * @param params 订单信息
82
+ */
209
83
  submitOrder: (params: CommitOrderParams) => Promise<void>;
210
84
  /**
211
85
  * Checkout 专用:创建订单到后端
@@ -213,40 +87,4 @@ export interface OrderModuleAPI {
213
87
  * @returns 后端返回的订单数据
214
88
  */
215
89
  createOrderByCheckout: (params: CheckoutOrderParams) => Promise<any>;
216
- submitScanOrder: <T = any>(params: SubmitScanOrderParams) => Promise<T>;
217
- scanOrderMore: <T = any>(params: ScanOrderMoreParams) => Promise<T>;
218
- initTempOrder: (params: {
219
- cacheId?: string;
220
- salesSummaryModuleName?: string;
221
- }) => void;
222
- getTempOrder: () => ScanOrderTempOrder | null;
223
- ensureTempOrder: () => ScanOrderTempOrder;
224
- addNewOrder: () => Promise<ScanOrderTempOrder>;
225
- restoreOrder: () => ScanOrderTempOrder;
226
- getOrderProducts: () => ScanOrderOrderProduct[];
227
- getScanOrderSummary: () => Promise<ScanOrderSummary>;
228
- recalculateSummary: (options?: {
229
- createIfMissing?: boolean;
230
- }) => Promise<ScanOrderSummary | null>;
231
- updateTempOrderNote: (note: string) => string;
232
- updateTempOrderBuzzer: (buzzer: string) => string;
233
- updateTempOrderContactsInfo: (contactsInfo: any[]) => any[];
234
- addProductToOrder: (product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity) => Promise<ScanOrderOrderProduct[]>;
235
- updateProductInOrder: (params: UpdateProductInOrderParams) => Promise<ScanOrderOrderProduct[]>;
236
- removeProductFromOrder: (identity: ScanOrderOrderProductIdentity) => Promise<ScanOrderOrderProduct[]>;
237
- persistTempOrder: () => void;
238
- submitTempOrder: <T = any>(params?: {
239
- cacheId?: string;
240
- platform?: string;
241
- businessCode?: string;
242
- channel?: string;
243
- type?: string;
244
- enhancePayload?: SubmitPayloadEnhancer;
245
- }) => Promise<T>;
246
- loadDiscountConfig: (params: {
247
- customerId: number;
248
- action?: 'create';
249
- }) => Promise<void>;
250
- getDiscountList: () => Discount[];
251
- applyDiscount: () => void;
252
90
  }
@@ -6,8 +6,6 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
6
6
  return OrderHooks;
7
7
  }({});
8
8
 
9
- /** 更新购物车行:仅传 SKU 时命中同 SKU 第一行;多行同 SKU 须传 identity_key / 选项指纹等 */
10
-
11
9
  /**
12
10
  * 订单信息
13
11
  */
@@ -1,70 +1,4 @@
1
- import Decimal from 'decimal.js';
2
1
  import { CartItem } from "../Cart";
3
- import type { ScanOrderSubmitPayload, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder } from '../../solution/ScanOrder/types';
4
- import type { RulesParamsHooks } from '../Rules/types';
5
- /**
6
- * 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
7
- *
8
- * 新语义 v2 约定:
9
- * - `mainPrice` 必须是**已经包含 option 的主商品单价**(即 `metadata.main_product_selling_price`
10
- * 或 `metadata.main_product_original_price`),option 价格不由本函数叠加。
11
- * - 套餐价:Σ((bundle.bundle_selling_price ?? bundle.price) × (bundle.num ?? bundle.quantity ?? 1))
12
- * 当 `useOriginalBundle=true` 时,改用 `bundle.original_price ?? bundle.product_price ?? bundle.price`。
13
- * - 返回值:保留 2 位小数的字符串,方便直接写回 `selling_price` / `original_price` 字段。
14
- *
15
- * 被 `normalizeOrderProduct`、Rules setProduct 钩子、各 Solution 的 setDiscountSelected 共用,
16
- * 保证合成逻辑单点来源。
17
- */
18
- export declare function composeLinePrice(params: {
19
- mainPrice: string | number | null | undefined;
20
- bundle?: Array<{
21
- bundle_selling_price?: any;
22
- price?: any;
23
- num?: any;
24
- quantity?: any;
25
- original_price?: any;
26
- product_price?: any;
27
- }> | null;
28
- useOriginalBundle?: boolean;
29
- }): string;
30
- /**
31
- * 计算 option 单价合计:Σ(option.price × option.num)。
32
- * 在新语义 v2 下,main_product_original_price = source_product_price + 本函数结果。
33
- */
34
- export declare function sumOptionUnitPrice(options?: Array<{
35
- price?: any;
36
- num?: any;
37
- }> | null): Decimal;
38
- /**
39
- * OrderModule 默认 Rules 钩子工厂。
40
- *
41
- * 价格语义约定(订单域,v2 composite 口径):
42
- * - `selling_price`:券后 **行 composite 单价**
43
- * = `metadata.main_product_selling_price` + Σ(bundle_selling_price × num)。
44
- * - `original_price`:券前 **行 composite 单价**
45
- * = `metadata.main_product_original_price` + Σ(bundle 原价 × num)。
46
- * - `metadata.source_product_price`:主商品/variant 基础价(已应用报价单),不含 option、
47
- * 不含折扣。**权威源**。
48
- * - `metadata.main_product_original_price` = source + Σ(option.price × option.num)(含 option、不含折扣)。
49
- * - `metadata.main_product_selling_price` = main_original − 主商品券 per-unit amount(含 option、含折扣)。
50
- * - `payment_price`:出站 payload 中由 `selling_price` 派生以兼容后端(composite)。
51
- *
52
- * Rules 钩子契约(hook_adapt 方案,Rules 内部保持不变):
53
- * - `getProduct.price` / `getProduct.original_price` 回传 **source-level 主价**
54
- * (`metadata.source_product_price`)。Rules 内部 `getProductTotalPrice` /
55
- * `getProductOriginTotalPrice` 会自行叠加 option + bundle,喂 source 可避免 option 双加。
56
- * - `getProduct.total` = `selling_price × num`(行 composite × num),与 Rules 内部产出的
57
- * total(source + option + bundle)对齐。
58
- * - `setProduct` 反向流程:把 Rules 返回的 source-level `main_product_selling_price` / `price`
59
- * 加回 Σoptions,重新合成含 option 的 main_product_* 并派生 composite。
60
- * 优先级:
61
- * 1. `values.main_product_selling_price`(券应用分支,per-unit 券后 source-level 主价)
62
- * 2. `values.price`(还原分支 `restoredPrice`、good_pass 归零)
63
- * 3. `values.total / num`(仅当 Rules 只给出总价时的兜底)
64
- *
65
- * 导出为纯函数方便单测直接驱动钩子,不依赖 OrderModule 实例。
66
- */
67
- export declare function createDefaultOrderRulesHooks(): RulesParamsHooks;
68
2
  /**
69
3
  * 通过 session 类商品的开始时间结束时间生成商品的时长
70
4
  * @param {CartItem} cartItem
@@ -87,55 +21,3 @@ export declare const mergeRelationForms: (relationForms: {
87
21
  form_record_ids: number[];
88
22
  }[];
89
23
  export declare const getAllDiscountList: (cartItem: CartItem) => any;
90
- export declare function createUuidV4(): string;
91
- export declare function isTempOrder(data: any): data is ScanOrderTempOrder;
92
- export declare function formatDateTime(date: Date): string;
93
- export declare function normalizeSubmitBooking<T extends {
94
- metadata?: Record<string, any>;
95
- }>(booking: T): T;
96
- /** 提交用人数:有限且为正则向下取整,否则为 1 */
97
- export declare function normalizeSubmitCollectPaxValue(value: unknown): number;
98
- /** 从临时订单 metadata 解析合成 booking 的 collect_pax */
99
- export declare function resolveSubmitCollectPax(tempOrder: ScanOrderTempOrder): number;
100
- export declare function createDefaultTempOrder(params: {
101
- now: string;
102
- summary?: ScanOrderSummary;
103
- }): ScanOrderTempOrder;
104
- export interface SubmitPayloadEnhancerContext {
105
- tempOrder: ScanOrderTempOrder;
106
- bookingUuid: string;
107
- now: Date;
108
- }
109
- export type SubmitPayloadEnhancer = (payload: ScanOrderSubmitPayload, ctx: SubmitPayloadEnhancerContext) => ScanOrderSubmitPayload;
110
- export declare function buildSubmitPayload(params: {
111
- tempOrder: ScanOrderTempOrder;
112
- cacheId?: string;
113
- now?: Date;
114
- platform?: string;
115
- businessCode?: string;
116
- channel?: string;
117
- type?: string;
118
- enhance?: SubmitPayloadEnhancer;
119
- }): ScanOrderSubmitPayload;
120
- /** 加单(scanOrderMore)不应提交 booking 关联的虚拟规则商品行 */
121
- export declare function filterProductsForScanOrderMore(products: ScanOrderSubmitProduct[]): ScanOrderSubmitProduct[];
122
- /**
123
- * 历史 V1 加餐结构映射器。
124
- *
125
- * @deprecated 加餐(`PUT /order/order/product/:id`)已改为与正常 checkout 共用
126
- * `ScanOrderSubmitProduct` 新结构(见 `OrderModule.submitTempOrder` 的加餐分支)。
127
- * 本函数仅保留以兼容历史接入方,未来会移除。新代码请勿再调用。
128
- */
129
- export declare function formatV1Product(products: ScanOrderSubmitProduct[]): {
130
- bundle: any[];
131
- key: number | null;
132
- option: any[];
133
- product_id: number | null;
134
- product_variant_id: number;
135
- num: number;
136
- note: string;
137
- rowKey: number | null;
138
- session: null;
139
- unique: string;
140
- }[];
141
- export { createEmptySummary } from '../../solution/ScanOrder/utils';