@pisell/pisellos 2.1.119 → 2.1.121

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 (231) hide show
  1. package/dist/apis/picoding.d.ts +0 -0
  2. package/dist/apis/picoding.js +1 -0
  3. package/dist/model/index.d.ts +1 -0
  4. package/dist/model/index.js +1 -0
  5. package/dist/model/strategy/adapter/index.d.ts +7 -0
  6. package/dist/model/strategy/adapter/index.js +7 -0
  7. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
  8. package/dist/model/strategy/adapter/itemRule/adapter.js +439 -0
  9. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
  10. package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
  11. package/dist/model/strategy/adapter/itemRule/examples.d.ts +64 -0
  12. package/dist/model/strategy/adapter/itemRule/examples.js +315 -0
  13. package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
  14. package/dist/model/strategy/adapter/itemRule/index.js +5 -0
  15. package/dist/model/strategy/adapter/itemRule/type.d.ts +206 -0
  16. package/dist/model/strategy/adapter/itemRule/type.js +101 -0
  17. package/dist/model/strategy/adapter/promotion/adapter.d.ts +66 -0
  18. package/dist/model/strategy/adapter/promotion/adapter.js +271 -0
  19. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
  20. package/dist/model/strategy/adapter/promotion/evaluator.js +1206 -0
  21. package/dist/model/strategy/adapter/promotion/examples.d.ts +138 -0
  22. package/dist/model/strategy/adapter/promotion/examples.js +166 -0
  23. package/dist/model/strategy/adapter/promotion/index.d.ts +4 -0
  24. package/dist/model/strategy/adapter/promotion/index.js +0 -0
  25. package/dist/model/strategy/adapter/promotion/type.d.ts +447 -0
  26. package/dist/model/strategy/adapter/promotion/type.js +209 -0
  27. package/dist/model/strategy/adapter/type.d.ts +28 -0
  28. package/dist/model/strategy/adapter/type.js +1 -0
  29. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
  30. package/dist/model/strategy/adapter/walletPass/evaluator.js +502 -0
  31. package/dist/model/strategy/adapter/walletPass/example.d.ts +4 -0
  32. package/dist/model/strategy/adapter/walletPass/example.js +258 -0
  33. package/dist/model/strategy/adapter/walletPass/index.d.ts +32 -0
  34. package/dist/model/strategy/adapter/walletPass/index.js +182 -0
  35. package/dist/model/strategy/adapter/walletPass/locales.d.ts +1 -0
  36. package/dist/model/strategy/adapter/walletPass/locales.js +26 -0
  37. package/dist/model/strategy/adapter/walletPass/type.d.ts +187 -0
  38. package/dist/model/strategy/adapter/walletPass/type.js +1 -0
  39. package/dist/model/strategy/adapter/walletPass/utils.d.ts +50 -0
  40. package/dist/model/strategy/adapter/walletPass/utils.js +1104 -0
  41. package/dist/model/strategy/engine.d.ts +106 -0
  42. package/dist/model/strategy/engine.js +611 -0
  43. package/dist/model/strategy/index.d.ts +3 -0
  44. package/dist/model/strategy/index.js +8 -0
  45. package/dist/model/strategy/strategy-example.d.ts +5 -0
  46. package/dist/model/strategy/strategy-example.js +331 -0
  47. package/dist/model/strategy/type.d.ts +228 -0
  48. package/dist/model/strategy/type.js +94 -0
  49. package/dist/modules/Cart/utils/cartProduct.js +1 -0
  50. package/dist/modules/OpenData/index.d.ts +24 -0
  51. package/dist/modules/OpenData/index.js +173 -0
  52. package/dist/modules/OpenData/types.d.ts +73 -0
  53. package/dist/modules/OpenData/types.js +1 -0
  54. package/dist/modules/OpenData/utils.d.ts +2 -0
  55. package/dist/modules/OpenData/utils.js +75 -0
  56. package/dist/modules/Order/index.d.ts +58 -1
  57. package/dist/modules/Order/index.js +796 -29
  58. package/dist/modules/Order/types.d.ts +144 -12
  59. package/dist/modules/Order/utils.d.ts +28 -0
  60. package/dist/modules/Order/utils.js +250 -1
  61. package/dist/modules/Product/index.d.ts +1 -1
  62. package/dist/modules/Product/utils.js +2 -2
  63. package/dist/modules/ProductList/index.d.ts +1 -1
  64. package/dist/modules/ProductList/index.js +2 -1
  65. package/dist/modules/Quotation/index.d.ts +48 -0
  66. package/dist/modules/Quotation/index.js +245 -0
  67. package/dist/modules/Quotation/types.d.ts +42 -0
  68. package/dist/modules/Quotation/types.js +1 -0
  69. package/dist/modules/Rules/index.js +4 -1
  70. package/dist/modules/SalesSummary/index.d.ts +63 -0
  71. package/dist/modules/SalesSummary/index.js +174 -0
  72. package/dist/modules/SalesSummary/types.d.ts +59 -0
  73. package/dist/modules/SalesSummary/types.js +1 -0
  74. package/dist/modules/SalesSummary/utils.d.ts +30 -0
  75. package/dist/modules/SalesSummary/utils.js +513 -0
  76. package/dist/modules/ScanOrderLogger/index.d.ts +21 -0
  77. package/dist/modules/ScanOrderLogger/index.js +161 -0
  78. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  79. package/dist/modules/ScanOrderLogger/providers/feishu.js +95 -0
  80. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  81. package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
  82. package/dist/modules/ScanOrderLogger/types.d.ts +46 -0
  83. package/dist/modules/ScanOrderLogger/types.js +1 -0
  84. package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
  85. package/dist/modules/Summary/utils.d.ts +3 -3
  86. package/dist/modules/Summary/utils.js +4 -4
  87. package/dist/modules/index.d.ts +4 -0
  88. package/dist/modules/index.js +5 -1
  89. package/dist/solution/BookingByStep/index.d.ts +1 -1
  90. package/dist/solution/BookingByStep/types.d.ts +3 -1
  91. package/dist/solution/BookingByStep/types.js +5 -1
  92. package/dist/solution/BookingTicket/index.d.ts +1 -1
  93. package/dist/solution/ScanOrder/index.d.ts +90 -0
  94. package/dist/solution/ScanOrder/index.js +1853 -0
  95. package/dist/solution/ScanOrder/types.d.ts +210 -0
  96. package/dist/solution/ScanOrder/types.js +16 -0
  97. package/dist/solution/ScanOrder/utils.d.ts +93 -0
  98. package/dist/solution/ScanOrder/utils.js +397 -0
  99. package/dist/solution/VenueBooking/index.d.ts +163 -0
  100. package/dist/solution/VenueBooking/index.js +2931 -0
  101. package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
  102. package/dist/solution/VenueBooking/types.d.ts +130 -0
  103. package/dist/solution/VenueBooking/types.js +21 -0
  104. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
  105. package/dist/solution/VenueBooking/utils/dateSummary.js +102 -0
  106. package/dist/solution/VenueBooking/utils/resource.d.ts +4 -0
  107. package/dist/solution/VenueBooking/utils/resource.js +94 -0
  108. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
  109. package/dist/solution/VenueBooking/utils/slotMerge.js +203 -0
  110. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
  111. package/dist/solution/VenueBooking/utils/timeSlot.js +256 -0
  112. package/dist/solution/VenueBooking/utils.d.ts +1 -0
  113. package/dist/solution/VenueBooking/utils.js +1 -0
  114. package/dist/solution/index.d.ts +2 -0
  115. package/dist/solution/index.js +3 -1
  116. package/lib/apis/picoding.d.ts +0 -0
  117. package/lib/apis/picoding.js +0 -0
  118. package/lib/model/index.d.ts +1 -0
  119. package/lib/model/index.js +23 -0
  120. package/lib/model/strategy/adapter/index.d.ts +7 -0
  121. package/lib/model/strategy/adapter/index.js +57 -0
  122. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
  123. package/lib/model/strategy/adapter/itemRule/adapter.js +338 -0
  124. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
  125. package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
  126. package/lib/model/strategy/adapter/itemRule/examples.d.ts +64 -0
  127. package/lib/model/strategy/adapter/itemRule/examples.js +269 -0
  128. package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
  129. package/lib/model/strategy/adapter/itemRule/index.js +58 -0
  130. package/lib/model/strategy/adapter/itemRule/type.d.ts +206 -0
  131. package/lib/model/strategy/adapter/itemRule/type.js +46 -0
  132. package/lib/model/strategy/adapter/promotion/adapter.d.ts +66 -0
  133. package/lib/model/strategy/adapter/promotion/adapter.js +217 -0
  134. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
  135. package/lib/model/strategy/adapter/promotion/evaluator.js +844 -0
  136. package/lib/model/strategy/adapter/promotion/examples.d.ts +138 -0
  137. package/lib/model/strategy/adapter/promotion/examples.js +192 -0
  138. package/lib/model/strategy/adapter/promotion/index.d.ts +4 -0
  139. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  140. package/lib/model/strategy/adapter/promotion/type.d.ts +447 -0
  141. package/lib/model/strategy/adapter/promotion/type.js +51 -0
  142. package/lib/model/strategy/adapter/type.d.ts +28 -0
  143. package/lib/model/strategy/adapter/type.js +17 -0
  144. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
  145. package/lib/model/strategy/adapter/walletPass/evaluator.js +424 -0
  146. package/lib/model/strategy/adapter/walletPass/example.d.ts +4 -0
  147. package/lib/model/strategy/adapter/walletPass/example.js +207 -0
  148. package/lib/model/strategy/adapter/walletPass/index.d.ts +32 -0
  149. package/lib/model/strategy/adapter/walletPass/index.js +142 -0
  150. package/lib/model/strategy/adapter/walletPass/locales.d.ts +1 -0
  151. package/lib/model/strategy/adapter/walletPass/locales.js +54 -0
  152. package/lib/model/strategy/adapter/walletPass/type.d.ts +187 -0
  153. package/lib/model/strategy/adapter/walletPass/type.js +17 -0
  154. package/lib/model/strategy/adapter/walletPass/utils.d.ts +50 -0
  155. package/lib/model/strategy/adapter/walletPass/utils.js +791 -0
  156. package/lib/model/strategy/engine.d.ts +106 -0
  157. package/lib/model/strategy/engine.js +450 -0
  158. package/lib/model/strategy/index.d.ts +3 -0
  159. package/lib/model/strategy/index.js +38 -0
  160. package/lib/model/strategy/strategy-example.d.ts +5 -0
  161. package/lib/model/strategy/strategy-example.js +318 -0
  162. package/lib/model/strategy/type.d.ts +228 -0
  163. package/lib/model/strategy/type.js +44 -0
  164. package/lib/modules/Cart/utils/cartProduct.js +1 -0
  165. package/lib/modules/OpenData/index.d.ts +24 -0
  166. package/lib/modules/OpenData/index.js +119 -0
  167. package/lib/modules/OpenData/types.d.ts +73 -0
  168. package/lib/modules/OpenData/types.js +17 -0
  169. package/lib/modules/OpenData/utils.d.ts +2 -0
  170. package/lib/modules/OpenData/utils.js +111 -0
  171. package/lib/modules/Order/index.d.ts +58 -1
  172. package/lib/modules/Order/index.js +437 -1
  173. package/lib/modules/Order/types.d.ts +144 -12
  174. package/lib/modules/Order/utils.d.ts +28 -0
  175. package/lib/modules/Order/utils.js +250 -2
  176. package/lib/modules/Product/index.d.ts +1 -1
  177. package/lib/modules/Product/utils.js +2 -2
  178. package/lib/modules/ProductList/index.d.ts +1 -1
  179. package/lib/modules/ProductList/index.js +2 -1
  180. package/lib/modules/Quotation/index.d.ts +48 -0
  181. package/lib/modules/Quotation/index.js +149 -0
  182. package/lib/modules/Quotation/types.d.ts +42 -0
  183. package/lib/modules/Quotation/types.js +17 -0
  184. package/lib/modules/Rules/index.js +4 -1
  185. package/lib/modules/SalesSummary/index.d.ts +63 -0
  186. package/lib/modules/SalesSummary/index.js +105 -0
  187. package/lib/modules/SalesSummary/types.d.ts +59 -0
  188. package/lib/modules/SalesSummary/types.js +17 -0
  189. package/lib/modules/SalesSummary/utils.d.ts +30 -0
  190. package/lib/modules/SalesSummary/utils.js +452 -0
  191. package/lib/modules/ScanOrderLogger/index.d.ts +21 -0
  192. package/lib/modules/ScanOrderLogger/index.js +135 -0
  193. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  194. package/lib/modules/ScanOrderLogger/providers/feishu.js +82 -0
  195. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  196. package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
  197. package/lib/modules/ScanOrderLogger/types.d.ts +46 -0
  198. package/lib/modules/ScanOrderLogger/types.js +17 -0
  199. package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
  200. package/lib/modules/Summary/utils.d.ts +3 -3
  201. package/lib/modules/Summary/utils.js +4 -4
  202. package/lib/modules/index.d.ts +4 -0
  203. package/lib/modules/index.js +9 -1
  204. package/lib/solution/BookingByStep/index.d.ts +1 -1
  205. package/lib/solution/BookingByStep/types.d.ts +3 -1
  206. package/lib/solution/BookingByStep/types.js +10 -0
  207. package/lib/solution/BookingTicket/index.d.ts +1 -1
  208. package/lib/solution/ScanOrder/index.d.ts +90 -0
  209. package/lib/solution/ScanOrder/index.js +1071 -0
  210. package/lib/solution/ScanOrder/types.d.ts +210 -0
  211. package/lib/solution/ScanOrder/types.js +36 -0
  212. package/lib/solution/ScanOrder/utils.d.ts +93 -0
  213. package/lib/solution/ScanOrder/utils.js +359 -0
  214. package/lib/solution/VenueBooking/index.d.ts +163 -0
  215. package/lib/solution/VenueBooking/index.js +1578 -0
  216. package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
  217. package/lib/solution/VenueBooking/types.d.ts +130 -0
  218. package/lib/solution/VenueBooking/types.js +44 -0
  219. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
  220. package/lib/solution/VenueBooking/utils/dateSummary.js +101 -0
  221. package/lib/solution/VenueBooking/utils/resource.d.ts +4 -0
  222. package/lib/solution/VenueBooking/utils/resource.js +80 -0
  223. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
  224. package/lib/solution/VenueBooking/utils/slotMerge.js +208 -0
  225. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
  226. package/lib/solution/VenueBooking/utils/timeSlot.js +200 -0
  227. package/lib/solution/VenueBooking/utils.d.ts +1 -0
  228. package/lib/solution/VenueBooking/utils.js +69 -0
  229. package/lib/solution/index.d.ts +2 -0
  230. package/lib/solution/index.js +5 -1
  231. package/package.json +1 -1
@@ -1,4 +1,8 @@
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';
2
6
  export declare enum OrderHooks {
3
7
  OnOrderCreate = "order:onOrderCreate",
4
8
  OnOrderUpdate = "order:onOrderUpdate",
@@ -6,6 +10,10 @@ export declare enum OrderHooks {
6
10
  OnOrderStatusChange = "order:onOrderStatusChange"
7
11
  }
8
12
  export interface OrderState {
13
+ tempOrder: ScanOrderTempOrder | null;
14
+ discountList: any[];
15
+ discount: DiscountModule | null;
16
+ rules: RulesModule | null;
9
17
  }
10
18
  /**
11
19
  * 订单信息
@@ -20,6 +28,109 @@ export interface CommitOrderParams {
20
28
  business_code?: string;
21
29
  };
22
30
  }
31
+ export interface SubmitScanOrderProduct {
32
+ order_detail_id: number | null;
33
+ product_id: number | null;
34
+ num: number;
35
+ product_variant_id: number;
36
+ product_option_item: any[];
37
+ selling_price: string;
38
+ original_price: string;
39
+ payment_price: string;
40
+ tax_fee: string;
41
+ is_charge_tax: number;
42
+ discount_list: any[];
43
+ product_bundle: any[];
44
+ metadata: Record<string, any>;
45
+ }
46
+ export interface SubmitScanOrderSummary {
47
+ product_quantity: number;
48
+ product_original_amount: string;
49
+ product_amount: string;
50
+ product_expect_amount: string;
51
+ product_tax_fee: string;
52
+ shipping_fee: string;
53
+ shipping_tax_fee: string;
54
+ tax_fee: string;
55
+ surcharge_fee: string;
56
+ discount_amount: string;
57
+ deposit_amount: string;
58
+ expect_amount: string;
59
+ total_amount: string;
60
+ amount_gap: string;
61
+ rounding_amount: string;
62
+ pay_service_charge_amount: string;
63
+ }
64
+ export interface SubmitScanOrderBooking {
65
+ relation_id?: string;
66
+ form_id?: string;
67
+ collect_pax?: number;
68
+ start_time?: string;
69
+ end_time?: string;
70
+ metadata?: Record<string, any>;
71
+ }
72
+ export interface SubmitScanOrderFormRecord {
73
+ form_id: number | string;
74
+ form_record_ids: Array<number | string>;
75
+ }
76
+ export interface SubmitScanOrderParams {
77
+ url?: string;
78
+ query: {
79
+ order_id: number | null;
80
+ relation_id?: string;
81
+ table_form_id?: string;
82
+ resource_id?: string;
83
+ order_number: string;
84
+ shop_order_number: string;
85
+ type: string;
86
+ business_code: string;
87
+ platform: 'H5' | 'PC';
88
+ request_unique_idempotency_token?: string;
89
+ sales_channel: string;
90
+ order_sales_channel: string;
91
+ status: string;
92
+ payment_status: string;
93
+ shipping_status: string;
94
+ customer_id: number | null;
95
+ customer_name: string;
96
+ country_calling_code: string;
97
+ phone: string;
98
+ email: string;
99
+ is_price_include_tax: number;
100
+ tax_title: string;
101
+ tax_country_code: string;
102
+ currency_code: string;
103
+ currency_symbol: string;
104
+ currency_format: string;
105
+ is_deposit: number;
106
+ deposit_amount: string;
107
+ shop_discount: string;
108
+ surcharge_fee: string;
109
+ note: string;
110
+ schedule_date: string;
111
+ created_at?: string;
112
+ products: SubmitScanOrderProduct[];
113
+ bookings: SubmitScanOrderBooking[];
114
+ payments: any[];
115
+ surcharges?: any[];
116
+ discount_list: any[];
117
+ relation_forms: any[];
118
+ form_record_ids?: SubmitScanOrderFormRecord[];
119
+ contacts: any[];
120
+ contacts_info: any[];
121
+ holder: Record<string, any> | null;
122
+ summary?: SubmitScanOrderSummary;
123
+ metadata: Record<string, any>;
124
+ };
125
+ }
126
+ export interface ScanOrderMoreParams {
127
+ url?: string;
128
+ query: {
129
+ order_id: number | string;
130
+ products: SubmitScanOrderProduct[];
131
+ request_unique_idempotency_token?: string;
132
+ };
133
+ }
23
134
  /**
24
135
  * 支付项数据
25
136
  */
@@ -63,23 +174,11 @@ export interface CheckoutOrderParams {
63
174
  * 订单模块 API
64
175
  */
65
176
  export interface OrderModuleAPI {
66
- /**
67
- * 创建订单
68
- * @param params 订单信息
69
- * @returns 订单信息
70
- */
71
177
  createOrder: (params: CommitOrderParams['query']) => any;
72
- /**
73
- * 检查购物车提交订单前是否符合条件
74
- */
75
178
  checkBeforeSubmitOrder: (params: {
76
179
  cartItems: CartItem[];
77
180
  type: 'holder' | 'account';
78
181
  }) => boolean;
79
- /**
80
- * 提交订单
81
- * @param params 订单信息
82
- */
83
182
  submitOrder: (params: CommitOrderParams) => Promise<void>;
84
183
  /**
85
184
  * Checkout 专用:创建订单到后端
@@ -87,4 +186,37 @@ export interface OrderModuleAPI {
87
186
  * @returns 后端返回的订单数据
88
187
  */
89
188
  createOrderByCheckout: (params: CheckoutOrderParams) => Promise<any>;
189
+ submitScanOrder: <T = any>(params: SubmitScanOrderParams) => Promise<T>;
190
+ scanOrderMore: <T = any>(params: ScanOrderMoreParams) => Promise<T>;
191
+ initTempOrder: (params: {
192
+ cacheId?: string;
193
+ salesSummaryModuleName?: string;
194
+ }) => void;
195
+ getTempOrder: () => ScanOrderTempOrder | null;
196
+ ensureTempOrder: () => ScanOrderTempOrder;
197
+ addNewOrder: () => Promise<ScanOrderTempOrder>;
198
+ getOrderProducts: () => ScanOrderOrderProduct[];
199
+ getScanOrderSummary: () => Promise<ScanOrderSummary>;
200
+ recalculateSummary: (options?: {
201
+ createIfMissing?: boolean;
202
+ }) => Promise<ScanOrderSummary | null>;
203
+ updateTempOrderNote: (note: string) => string;
204
+ updateTempOrderContactsInfo: (contactsInfo: any[]) => any[];
205
+ addProductToOrder: (product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity) => Promise<ScanOrderOrderProduct[]>;
206
+ updateProductInOrder: (params: {
207
+ product_id: number | null;
208
+ product_variant_id: number;
209
+ updates: Partial<ScanOrderOrderProduct>;
210
+ }) => Promise<ScanOrderOrderProduct[]>;
211
+ removeProductFromOrder: (identity: ScanOrderOrderProductIdentity) => Promise<ScanOrderOrderProduct[]>;
212
+ persistTempOrder: () => void;
213
+ submitTempOrder: <T = any>(params?: {
214
+ cacheId?: string;
215
+ }) => Promise<T>;
216
+ loadDiscountConfig: (params: {
217
+ customerId: number;
218
+ action?: 'create';
219
+ }) => Promise<void>;
220
+ getDiscountList: () => Discount[];
221
+ applyDiscount: () => void;
90
222
  }
@@ -1,4 +1,5 @@
1
1
  import { CartItem } from "../Cart";
2
+ import type { ScanOrderSubmitPayload, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder } from '../../solution/ScanOrder/types';
2
3
  /**
3
4
  * 通过 session 类商品的开始时间结束时间生成商品的时长
4
5
  * @param {CartItem} cartItem
@@ -21,3 +22,30 @@ export declare const mergeRelationForms: (relationForms: {
21
22
  form_record_ids: number[];
22
23
  }[];
23
24
  export declare const getAllDiscountList: (cartItem: CartItem) => any;
25
+ export declare function createUuidV4(): string;
26
+ export declare function isTempOrder(data: any): data is ScanOrderTempOrder;
27
+ export declare function formatDateTime(date: Date): string;
28
+ export declare function normalizeSubmitBooking<T extends {
29
+ metadata?: Record<string, any>;
30
+ }>(booking: T): T;
31
+ export declare function createDefaultTempOrder(params: {
32
+ now: string;
33
+ summary?: ScanOrderSummary;
34
+ }): ScanOrderTempOrder;
35
+ export declare function buildSubmitPayload(params: {
36
+ tempOrder: ScanOrderTempOrder;
37
+ cacheId?: string;
38
+ now?: Date;
39
+ }): ScanOrderSubmitPayload;
40
+ export declare function formatV1Product(products: ScanOrderSubmitProduct[]): {
41
+ bundle: any[];
42
+ key: number | null;
43
+ option: any[];
44
+ product_id: number | null;
45
+ product_variant_id: number;
46
+ quantity: number;
47
+ rowKey: number | null;
48
+ session: null;
49
+ unique: string;
50
+ }[];
51
+ export { createEmptySummary } from '../../solution/ScanOrder/utils';
@@ -1,3 +1,14 @@
1
+ var _excluded = ["_origin", "identity_key"],
2
+ _excluded2 = ["created_at", "summary", "surcharges"];
3
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
1
12
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
13
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
14
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -5,6 +16,8 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
5
16
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
17
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
18
  import dayjs from "dayjs";
19
+ import { createEmptySummary } from "../../solution/ScanOrder/utils";
20
+
8
21
  /**
9
22
  * 通过 session 类商品的开始时间结束时间生成商品的时长
10
23
  * @param {CartItem} cartItem
@@ -60,4 +73,240 @@ export var getAllDiscountList = function getAllDiscountList(cartItem) {
60
73
  item.discount_list = undefined;
61
74
  });
62
75
  return discountList;
63
- };
76
+ };
77
+
78
+ // ─── 以下为从 ScanOrder/utils.ts 迁入的 Order 专属工具函数 ───
79
+
80
+ export function createUuidV4() {
81
+ var template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
82
+ return template.replace(/[xy]/g, function (char) {
83
+ var randomValue = Math.floor(Math.random() * 16);
84
+ var value = char === 'x' ? randomValue : randomValue & 0x3 | 0x8;
85
+ return value.toString(16);
86
+ });
87
+ }
88
+ export function isTempOrder(data) {
89
+ if (!data || _typeof(data) !== 'object') return false;
90
+ if (!Array.isArray(data.products)) return false;
91
+ return true;
92
+ }
93
+ export function formatDateTime(date) {
94
+ var pad = function pad(value) {
95
+ return value.toString().padStart(2, '0');
96
+ };
97
+ var year = date.getFullYear();
98
+ var month = pad(date.getMonth() + 1);
99
+ var day = pad(date.getDate());
100
+ var hours = pad(date.getHours());
101
+ var minutes = pad(date.getMinutes());
102
+ var seconds = pad(date.getSeconds());
103
+ return "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hours, ":").concat(minutes, ":").concat(seconds);
104
+ }
105
+ function normalizeSubmitPlatform(platform) {
106
+ return (platform === null || platform === void 0 ? void 0 : platform.toLowerCase()) === 'pc' ? 'PC' : 'H5';
107
+ }
108
+ function normalizeSubmitProduct(product) {
109
+ var _origin = product._origin,
110
+ identity_key = product.identity_key,
111
+ submitProduct = _objectWithoutProperties(product, _excluded);
112
+ var rawMetadata = submitProduct.metadata || {};
113
+ var bookingUid = rawMetadata.booking_uid;
114
+ var cleanMetadata = {};
115
+ if (rawMetadata.unique_identification_number) {
116
+ cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
117
+ }
118
+ var priceMetaKeys = ['main_product_original_price', 'main_product_selling_price', 'source_product_price'];
119
+ for (var _i = 0, _priceMetaKeys = priceMetaKeys; _i < _priceMetaKeys.length; _i++) {
120
+ var key = _priceMetaKeys[_i];
121
+ if (rawMetadata[key] !== undefined) {
122
+ cleanMetadata[key] = rawMetadata[key];
123
+ }
124
+ }
125
+ if (rawMetadata.price_breakdown) {
126
+ cleanMetadata.price_breakdown = rawMetadata.price_breakdown;
127
+ }
128
+ return _objectSpread(_objectSpread(_objectSpread({}, submitProduct), bookingUid ? {
129
+ booking_uid: bookingUid
130
+ } : {}), {}, {
131
+ product_option_item: submitProduct.product_option_item || [],
132
+ discount_list: submitProduct.discount_list || [],
133
+ product_bundle: submitProduct.product_bundle || [],
134
+ metadata: cleanMetadata
135
+ });
136
+ }
137
+ var SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax'];
138
+ export function normalizeSubmitBooking(booking) {
139
+ var rawMetadata = booking.metadata || {};
140
+ var cleanMetadata = {};
141
+ var _iterator = _createForOfIteratorHelper(SUBMIT_BOOKING_METADATA_WHITELIST),
142
+ _step;
143
+ try {
144
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
145
+ var key = _step.value;
146
+ if (rawMetadata[key] !== undefined) {
147
+ cleanMetadata[key] = rawMetadata[key];
148
+ }
149
+ }
150
+ } catch (err) {
151
+ _iterator.e(err);
152
+ } finally {
153
+ _iterator.f();
154
+ }
155
+ return _objectSpread(_objectSpread({}, booking), {}, {
156
+ metadata: cleanMetadata
157
+ });
158
+ }
159
+ var DEFAULT_TABLE_OCCUPANCY_DURATION = 20;
160
+ function resolveTableOccupancyDuration(tempOrder) {
161
+ var _metadata$table_confi, _metadata$tableConfig, _metadata$resource_co, _metadata$resourceCon;
162
+ var metadata = tempOrder.metadata || {};
163
+ var candidates = [metadata.table_occupancy_duration, metadata.booking_duration, metadata.table_duration, metadata.duration, (_metadata$table_confi = metadata.table_config) === null || _metadata$table_confi === void 0 ? void 0 : _metadata$table_confi.occupancy_duration, (_metadata$tableConfig = metadata.tableConfig) === null || _metadata$tableConfig === void 0 ? void 0 : _metadata$tableConfig.occupancy_duration, (_metadata$resource_co = metadata.resource_config) === null || _metadata$resource_co === void 0 ? void 0 : _metadata$resource_co.occupancy_duration, (_metadata$resourceCon = metadata.resourceConfig) === null || _metadata$resourceCon === void 0 ? void 0 : _metadata$resourceCon.occupancy_duration];
164
+ for (var _i2 = 0, _candidates = candidates; _i2 < _candidates.length; _i2++) {
165
+ var value = _candidates[_i2];
166
+ var duration = Number(value);
167
+ if (Number.isFinite(duration) && duration > 0) {
168
+ return Math.floor(duration);
169
+ }
170
+ }
171
+ return DEFAULT_TABLE_OCCUPANCY_DURATION;
172
+ }
173
+ export function createDefaultTempOrder(params) {
174
+ var summary = params.summary || createEmptySummary();
175
+ return {
176
+ order_id: null,
177
+ relation_id: undefined,
178
+ table_form_id: undefined,
179
+ resource_id: undefined,
180
+ order_number: '',
181
+ shop_order_number: '',
182
+ type: 'appointment_booking',
183
+ business_code: 'appointment_booking',
184
+ platform: 'h5',
185
+ sales_channel: 'my_pisel',
186
+ order_sales_channel: 'online_store',
187
+ status: 'normal',
188
+ payment_status: 'payment_processing',
189
+ shipping_status: 'unfulfilled',
190
+ customer_id: null,
191
+ customer_name: '',
192
+ country_calling_code: '',
193
+ phone: '',
194
+ email: '',
195
+ is_price_include_tax: 1,
196
+ tax_title: '',
197
+ tax_country_code: '',
198
+ currency_code: '',
199
+ currency_symbol: '',
200
+ currency_format: 'symbol_first',
201
+ is_deposit: 0,
202
+ deposit_amount: '0.00',
203
+ shop_discount: '0.00',
204
+ surcharge_fee: '0.00',
205
+ note: '',
206
+ schedule_date: params.now,
207
+ created_at: params.now,
208
+ products: [],
209
+ bookings: [],
210
+ payments: [],
211
+ surcharges: [],
212
+ discount_list: [],
213
+ relation_forms: [],
214
+ contacts: [],
215
+ contacts_info: [],
216
+ holder: null,
217
+ summary: summary,
218
+ metadata: {}
219
+ };
220
+ }
221
+ export function buildSubmitPayload(params) {
222
+ var _tempOrder$is_price_i, _tempOrder$is_deposit;
223
+ var tempOrder = params.tempOrder,
224
+ cacheId = params.cacheId,
225
+ _params$now = params.now,
226
+ now = _params$now === void 0 ? new Date() : _params$now;
227
+ var scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
228
+ var summary = tempOrder.summary || createEmptySummary();
229
+ var relationId = tempOrder.relation_id;
230
+ var tableFormId = tempOrder.table_form_id;
231
+ var bookingUuid = createUuidV4();
232
+ var bookingStart = dayjs(now);
233
+ var bookingDuration = resolveTableOccupancyDuration(tempOrder);
234
+ var bookingEnd = bookingStart.add(bookingDuration, 'minute');
235
+ var bookings = relationId && tableFormId ? [{
236
+ relation_id: relationId,
237
+ form_id: tableFormId,
238
+ start_time: bookingStart.format('HH:mm'),
239
+ start_date: bookingStart.format('YYYY-MM-DD'),
240
+ end_time: bookingEnd.format('HH:mm'),
241
+ end_date: bookingEnd.format('YYYY-MM-DD'),
242
+ duration: bookingDuration,
243
+ metadata: {
244
+ unique_identification_number: bookingUuid,
245
+ collect_pax: 1
246
+ },
247
+ select_date: bookingStart.format('YYYY-MM-DD'),
248
+ is_all: false,
249
+ "like_status": "common",
250
+ "schedule_id": 0,
251
+ "relation_type": "form",
252
+ "number": 1
253
+ }] : tempOrder.bookings || [];
254
+ var formRecordIds = relationId && tableFormId ? [{
255
+ form_id: tableFormId,
256
+ form_record_ids: [relationId]
257
+ }] : undefined;
258
+ var _createdAt = tempOrder.created_at,
259
+ _summary = tempOrder.summary,
260
+ _surcharges = tempOrder.surcharges,
261
+ tempOrderRest = _objectWithoutProperties(tempOrder, _excluded2);
262
+ return _objectSpread(_objectSpread({}, tempOrderRest), {}, {
263
+ platform: normalizeSubmitPlatform(tempOrder.platform),
264
+ request_unique_idempotency_token: cacheId,
265
+ type: tempOrder.type || 'table-order',
266
+ business_code: tempOrder.business_code || 'table-order',
267
+ sales_channel: tempOrder.sales_channel || 'my_pisel',
268
+ order_sales_channel: tempOrder.order_sales_channel || 'online_store',
269
+ status: tempOrder.status || 'normal',
270
+ payment_status: tempOrder.payment_status || 'payment_processing',
271
+ // shipping_status: tempOrder.shipping_status || 'unfulfilled',
272
+ is_price_include_tax: (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : 1,
273
+ currency_format: tempOrder.currency_format || 'symbol_first',
274
+ is_deposit: (_tempOrder$is_deposit = tempOrder.is_deposit) !== null && _tempOrder$is_deposit !== void 0 ? _tempOrder$is_deposit : 0,
275
+ deposit_amount: tempOrder.deposit_amount || '0.00',
276
+ shop_discount: tempOrder.shop_discount || '0.00',
277
+ surcharge_fee: summary.surcharge_fee || tempOrder.surcharge_fee || '0.00',
278
+ note: tempOrder.note || '',
279
+ schedule_date: scheduleDate,
280
+ bookings: bookings.map(function (booking) {
281
+ return normalizeSubmitBooking(booking);
282
+ }),
283
+ payments: tempOrder.payments || [],
284
+ // discount_list: tempOrder.discount_list || [],
285
+ relation_forms: tempOrder.relation_forms || [],
286
+ form_record_ids: formRecordIds,
287
+ // contacts: tempOrder.contacts || [],
288
+ contacts_info: tempOrder.contacts_info || [],
289
+ // holder: tempOrder.holder || null,
290
+ // summary,
291
+ metadata: _objectSpread({}, tempOrder.metadata),
292
+ products: (tempOrder.products || []).map(function (product) {
293
+ return normalizeSubmitProduct(product);
294
+ })
295
+ });
296
+ }
297
+ export function formatV1Product(products) {
298
+ return products.map(function (product) {
299
+ return {
300
+ bundle: product.product_bundle,
301
+ key: product.product_id,
302
+ option: product.product_option_item,
303
+ product_id: product.product_id,
304
+ product_variant_id: product.product_variant_id,
305
+ quantity: product.num,
306
+ rowKey: product.product_id,
307
+ session: null,
308
+ unique: createUuidV4()
309
+ };
310
+ });
311
+ }
312
+ export { createEmptySummary } from "../../solution/ScanOrder/utils";
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -8,12 +8,12 @@
8
8
  export function isNormalProduct(product) {
9
9
  var _product$scheduleIds;
10
10
  // 如果有 duration 配置,则不是普通商品
11
- if (product.duration) {
11
+ if (product !== null && product !== void 0 && product.duration) {
12
12
  return false;
13
13
  }
14
14
 
15
15
  // 如果有 schedule.ids 且长度大于0,则不是普通商品
16
- if ((_product$scheduleIds = product['schedule.ids']) !== null && _product$scheduleIds !== void 0 && _product$scheduleIds.length) {
16
+ if (product !== null && product !== void 0 && (_product$scheduleIds = product['schedule.ids']) !== null && _product$scheduleIds !== void 0 && _product$scheduleIds.length) {
17
17
  return false;
18
18
  }
19
19
 
@@ -16,10 +16,10 @@ export declare class ProductList extends BaseModule implements Module {
16
16
  product_ids?: number[];
17
17
  collection?: number | string[];
18
18
  schedule_date?: string;
19
+ schedule_datetime?: string;
19
20
  cacheId?: string;
20
21
  customer_id?: number;
21
22
  menu_list_ids?: number[];
22
- schedule_datetime?: string;
23
23
  with_count?: string[];
24
24
  with_schedule?: number;
25
25
  }): Promise<any>;
@@ -134,7 +134,8 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
134
134
  schedule_datetime: schedule_datetime,
135
135
  is_eject: 1
136
136
  }, {
137
- useCache: true
137
+ useCache: true,
138
+ customToast: function customToast() {}
138
139
  });
139
140
  case 6:
140
141
  productsData = _context3.sent;
@@ -0,0 +1,48 @@
1
+ import { Module, PisellCore, ModuleOptions } from '../../types';
2
+ import { BaseModule } from '../BaseModule';
3
+ import type { ScheduleItem } from '../Schedule/types';
4
+ import type { QuotationItem } from './types';
5
+ export type { QuotationItem, QuotationProductData, QuotationSchedule, QuotationState } from './types';
6
+ export declare class QuotationModule extends BaseModule implements Module {
7
+ protected defaultName: string;
8
+ protected defaultVersion: string;
9
+ private request;
10
+ private store;
11
+ private scheduleResolver?;
12
+ constructor(name?: string, version?: string);
13
+ initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
14
+ loadQuotations(params?: {
15
+ channel?: string;
16
+ }): Promise<void>;
17
+ getQuotationList(): QuotationItem[];
18
+ /**
19
+ * Look up the quotation price for a specific product (+ optional variant) at a given datetime.
20
+ * Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
21
+ *
22
+ * Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
23
+ * First matching quotation whose schedule covers `datetime` and whose product_data contains
24
+ * the requested productId wins.
25
+ */
26
+ getPriceForProduct(params: {
27
+ productId: number;
28
+ variantId?: number;
29
+ datetime: string;
30
+ }): string | null;
31
+ getQuotationShelfId(params: {
32
+ productId: number;
33
+ variantId?: number;
34
+ datetime: string;
35
+ }): number;
36
+ /**
37
+ * Batch pre-compute quotation prices for a set of products across multiple time points.
38
+ * Key format: `${productId}:${timePoint}`
39
+ * This avoids repeated schedule matching when the same product appears in multiple resource rows.
40
+ */
41
+ buildProductPriceMap(params: {
42
+ productIds: number[];
43
+ timePoints: string[];
44
+ }): Map<string, string | null>;
45
+ setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
46
+ private isQuotationActiveAt;
47
+ private findProductData;
48
+ }