@pisell/pisellos 0.10.14 → 0.10.16

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 (301) hide show
  1. package/dist/core/index.js +6 -9
  2. package/dist/model/strategy/adapter/walletPass/example.js +3 -26
  3. package/dist/model/strategy/strategy-example.js +5 -19
  4. package/dist/modules/Cart/index.js +0 -3
  5. package/dist/modules/Cart/utils/cartProduct.js +0 -1
  6. package/dist/modules/Date/index.js +1 -5
  7. package/dist/modules/Discount/index.js +2 -4
  8. package/dist/modules/OpenData/index.js +0 -2
  9. package/dist/modules/Order/index.d.ts +1 -1
  10. package/dist/modules/Order/index.js +75 -91
  11. package/dist/modules/Order/types.d.ts +5 -1
  12. package/dist/modules/Order/utils/virtualSettlement.d.ts +8 -1
  13. package/dist/modules/Order/utils/virtualSettlement.js +15 -2
  14. package/dist/modules/Order/utils.js +7 -1
  15. package/dist/modules/Payment/index.js +97 -162
  16. package/dist/modules/Product/types.d.ts +2 -0
  17. package/dist/modules/Rules/index.js +1 -4
  18. package/dist/modules/Schedule/index.js +0 -1
  19. package/dist/modules/Schedule/utils.js +0 -1
  20. package/dist/modules/Step/index.js +0 -1
  21. package/dist/plugins/request.js +1 -4
  22. package/dist/plugins/window.js +2 -6
  23. package/dist/server/index.js +97 -129
  24. package/dist/server/modules/menu/index.js +32 -41
  25. package/dist/server/modules/order/index.js +2 -4
  26. package/dist/server/modules/products/index.js +24 -42
  27. package/dist/server/modules/quotation/index.js +29 -38
  28. package/dist/server/modules/resource/index.js +3 -4
  29. package/dist/server/modules/schedule/index.js +27 -35
  30. package/dist/server/utils/product.js +0 -1
  31. package/dist/solution/BaseSales/index.js +107 -76
  32. package/dist/solution/BaseSales/types.d.ts +2 -0
  33. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  34. package/dist/solution/BaseSales/utils/cartPromotion.js +15 -6
  35. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  36. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +7 -1
  37. package/dist/solution/BaseSales/utils.js +6 -3
  38. package/dist/solution/BookingByStep/index.d.ts +2 -2
  39. package/dist/solution/BookingByStep/index.js +7 -59
  40. package/dist/solution/BookingByStep/utils/capacity.js +1 -11
  41. package/dist/solution/BookingByStep/utils/resources.js +1 -3
  42. package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
  43. package/dist/solution/BookingTicket/index.js +8 -4
  44. package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -1
  45. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
  46. package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
  47. package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
  48. package/dist/solution/BuyTickets/index.js +9 -12
  49. package/dist/solution/Checkout/index.js +177 -252
  50. package/dist/solution/Checkout/utils/index.js +4 -16
  51. package/dist/solution/RegisterAndLogin/index.js +30 -76
  52. package/dist/solution/ScanOrder/index.js +50 -60
  53. package/dist/solution/ScanOrder/types.d.ts +2 -0
  54. package/dist/solution/ScanOrder/utils.js +6 -3
  55. package/dist/solution/ShopDiscount/index.js +2 -7
  56. package/dist/solution/VenueBooking/index.js +45 -55
  57. package/dist/utils/task.js +15 -18
  58. package/dist/utils/watch.js +0 -1
  59. package/lib/apis/picoding.js +2 -0
  60. package/lib/core/index.js +131 -131
  61. package/lib/effects/index.js +46 -57
  62. package/lib/index.js +82 -49
  63. package/lib/model/index.js +14 -21
  64. package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
  65. package/lib/model/strategy/adapter/dataVariant/evaluator.js +209 -315
  66. package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
  67. package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
  68. package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
  69. package/lib/model/strategy/adapter/index.js +100 -64
  70. package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
  71. package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
  72. package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
  73. package/lib/model/strategy/adapter/itemRule/index.js +83 -57
  74. package/lib/model/strategy/adapter/itemRule/type.js +97 -36
  75. package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
  76. package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
  77. package/lib/model/strategy/adapter/promotion/examples.js +222 -234
  78. package/lib/model/strategy/adapter/promotion/index.js +43 -48
  79. package/lib/model/strategy/adapter/promotion/type.js +243 -36
  80. package/lib/model/strategy/adapter/type.js +4 -16
  81. package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
  82. package/lib/model/strategy/adapter/walletPass/example.js +217 -190
  83. package/lib/model/strategy/adapter/walletPass/index.js +75 -51
  84. package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
  85. package/lib/model/strategy/adapter/walletPass/type.js +4 -16
  86. package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
  87. package/lib/model/strategy/engine.js +270 -168
  88. package/lib/model/strategy/index.js +49 -34
  89. package/lib/model/strategy/strategy-example.js +243 -239
  90. package/lib/model/strategy/type.js +100 -40
  91. package/lib/modules/Account/index.js +39 -53
  92. package/lib/modules/Account/types.js +20 -33
  93. package/lib/modules/AccountList/index.js +116 -154
  94. package/lib/modules/AccountList/types.js +30 -31
  95. package/lib/modules/AccountList/utils.js +18 -30
  96. package/lib/modules/BaseModule.js +23 -42
  97. package/lib/modules/BookingContext/index.js +158 -136
  98. package/lib/modules/BookingContext/types.js +46 -32
  99. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
  100. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
  101. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
  102. package/lib/modules/BookingContext/utils/flexible.js +38 -55
  103. package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
  104. package/lib/modules/BookingContext/utils/index.js +124 -41
  105. package/lib/modules/BookingContext/utils/noResource.js +58 -70
  106. package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
  107. package/lib/modules/BookingContext/utils/productExtend.js +202 -155
  108. package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
  109. package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
  110. package/lib/modules/BookingContext/utils/resources.js +209 -167
  111. package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
  112. package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
  113. package/lib/modules/Cart/index.js +170 -124
  114. package/lib/modules/Cart/types.js +46 -51
  115. package/lib/modules/Cart/utils/cartAccount.js +40 -39
  116. package/lib/modules/Cart/utils/cartDate.js +56 -61
  117. package/lib/modules/Cart/utils/cartDiscount.js +28 -33
  118. package/lib/modules/Cart/utils/cartNote.js +27 -32
  119. package/lib/modules/Cart/utils/cartProduct.js +321 -251
  120. package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
  121. package/lib/modules/Cart/utils/cartResource.js +70 -78
  122. package/lib/modules/Cart/utils/changePrice.js +22 -50
  123. package/lib/modules/Cart/utils/index.js +106 -48
  124. package/lib/modules/Customer/constants.js +13 -34
  125. package/lib/modules/Customer/index.js +235 -172
  126. package/lib/modules/Customer/types.js +38 -35
  127. package/lib/modules/Date/index.js +116 -115
  128. package/lib/modules/Date/types.js +16 -28
  129. package/lib/modules/Date/utils.js +174 -123
  130. package/lib/modules/Discount/index.js +133 -143
  131. package/lib/modules/Discount/types.js +9 -31
  132. package/lib/modules/Guests/index.js +30 -56
  133. package/lib/modules/Guests/types.js +23 -33
  134. package/lib/modules/Holder/index.js +209 -189
  135. package/lib/modules/Holder/types.js +4 -16
  136. package/lib/modules/Holder/utils.js +20 -49
  137. package/lib/modules/OpenData/index.js +70 -76
  138. package/lib/modules/OpenData/types.js +4 -16
  139. package/lib/modules/OpenData/utils.js +44 -78
  140. package/lib/modules/Order/index.d.ts +1 -1
  141. package/lib/modules/Order/index.js +1810 -2238
  142. package/lib/modules/Order/payment-utils.js +77 -120
  143. package/lib/modules/Order/types.d.ts +5 -1
  144. package/lib/modules/Order/types.js +87 -35
  145. package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
  146. package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
  147. package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
  148. package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
  149. package/lib/modules/Order/utils/virtualSettlement.d.ts +8 -1
  150. package/lib/modules/Order/utils/virtualSettlement.js +126 -164
  151. package/lib/modules/Order/utils.js +834 -668
  152. package/lib/modules/Payment/cash.js +20 -33
  153. package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
  154. package/lib/modules/Payment/eftpos.js +16 -30
  155. package/lib/modules/Payment/index.js +532 -399
  156. package/lib/modules/Payment/mx51.js +1 -0
  157. package/lib/modules/Payment/types.js +230 -108
  158. package/lib/modules/Payment/utils.js +52 -51
  159. package/lib/modules/Payment/walletpass.js +485 -660
  160. package/lib/modules/Product/index.js +51 -46
  161. package/lib/modules/Product/types.d.ts +2 -0
  162. package/lib/modules/Product/types.js +4 -16
  163. package/lib/modules/Product/utils.js +32 -33
  164. package/lib/modules/ProductList/index.js +138 -161
  165. package/lib/modules/ProductList/types.js +9 -31
  166. package/lib/modules/Quotation/index.js +66 -100
  167. package/lib/modules/Quotation/types.js +4 -16
  168. package/lib/modules/Resource/index.js +27 -59
  169. package/lib/modules/Resource/types.js +22 -32
  170. package/lib/modules/Resource/utils.js +30 -38
  171. package/lib/modules/ResourcePlanner/index.js +25 -23
  172. package/lib/modules/ResourcePlanner/localClock.js +54 -119
  173. package/lib/modules/ResourcePlanner/planner.js +591 -772
  174. package/lib/modules/ResourcePlanner/types.js +10 -29
  175. package/lib/modules/Rules/index.js +1218 -959
  176. package/lib/modules/Rules/types.js +17 -40
  177. package/lib/modules/SalesSummary/index.js +78 -89
  178. package/lib/modules/SalesSummary/types.js +4 -16
  179. package/lib/modules/SalesSummary/utils.js +359 -442
  180. package/lib/modules/ScanOrderLogger/index.js +59 -79
  181. package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
  182. package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
  183. package/lib/modules/ScanOrderLogger/types.js +4 -16
  184. package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
  185. package/lib/modules/Schedule/index.js +100 -114
  186. package/lib/modules/Schedule/type.js +4 -16
  187. package/lib/modules/Schedule/types.js +4 -16
  188. package/lib/modules/Schedule/utils.js +433 -291
  189. package/lib/modules/Step/index.js +40 -52
  190. package/lib/modules/Step/tyeps.js +4 -16
  191. package/lib/modules/Summary/index.js +66 -71
  192. package/lib/modules/Summary/types.js +4 -16
  193. package/lib/modules/Summary/utils.js +773 -418
  194. package/lib/modules/SurchargeList/index.js +46 -60
  195. package/lib/modules/SurchargeList/types.js +4 -16
  196. package/lib/modules/index.js +245 -63
  197. package/lib/plugins/app.js +4 -16
  198. package/lib/plugins/index.js +36 -25
  199. package/lib/plugins/request.js +137 -126
  200. package/lib/plugins/shopStore.js +4 -16
  201. package/lib/plugins/user.js +4 -16
  202. package/lib/plugins/window.js +171 -179
  203. package/lib/server/index.js +3027 -2655
  204. package/lib/server/modules/floor-plan/index.js +102 -123
  205. package/lib/server/modules/floor-plan/types.js +15 -30
  206. package/lib/server/modules/index.js +106 -68
  207. package/lib/server/modules/menu/index.js +146 -122
  208. package/lib/server/modules/menu/types.js +18 -31
  209. package/lib/server/modules/order/index.js +758 -956
  210. package/lib/server/modules/order/types.js +122 -33
  211. package/lib/server/modules/order/utils/filterBookings.js +219 -194
  212. package/lib/server/modules/order/utils/filterOrders.js +118 -92
  213. package/lib/server/modules/payment/index.js +59 -83
  214. package/lib/server/modules/payment/types.js +4 -16
  215. package/lib/server/modules/products/index.js +575 -459
  216. package/lib/server/modules/products/types.js +44 -34
  217. package/lib/server/modules/quotation/index.js +137 -172
  218. package/lib/server/modules/quotation/types.js +21 -31
  219. package/lib/server/modules/resource/index.js +213 -184
  220. package/lib/server/modules/resource/types.js +42 -33
  221. package/lib/server/modules/schedule/index.js +135 -123
  222. package/lib/server/modules/schedule/types.js +14 -21
  223. package/lib/server/modules/schedule/utils.js +334 -163
  224. package/lib/server/types.js +4 -16
  225. package/lib/server/utils/index.js +25 -23
  226. package/lib/server/utils/product.js +196 -139
  227. package/lib/server/utils/schedule.js +34 -41
  228. package/lib/server/utils/small-ticket.js +479 -456
  229. package/lib/server/utils/time.js +40 -49
  230. package/lib/solution/BaseSales/index.js +1276 -1485
  231. package/lib/solution/BaseSales/types.d.ts +2 -0
  232. package/lib/solution/BaseSales/types.js +42 -38
  233. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  234. package/lib/solution/BaseSales/utils/cartPromotion.js +652 -498
  235. package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
  236. package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
  237. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  238. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +138 -180
  239. package/lib/solution/BaseSales/utils.js +161 -143
  240. package/lib/solution/BookingByStep/index.d.ts +2 -2
  241. package/lib/solution/BookingByStep/index.js +1527 -1340
  242. package/lib/solution/BookingByStep/types.js +40 -99
  243. package/lib/solution/BookingByStep/utils/capacity.js +192 -160
  244. package/lib/solution/BookingByStep/utils/products.js +42 -52
  245. package/lib/solution/BookingByStep/utils/resources.js +527 -330
  246. package/lib/solution/BookingByStep/utils/stock.js +65 -44
  247. package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
  248. package/lib/solution/BookingTicket/index.js +598 -514
  249. package/lib/solution/BookingTicket/types.js +99 -77
  250. package/lib/solution/BookingTicket/utils/addProductDecision.js +229 -190
  251. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
  252. package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
  253. package/lib/solution/BookingTicket/utils/cartView.js +114 -99
  254. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  255. package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
  256. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
  257. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
  258. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
  259. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
  260. package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
  261. package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
  262. package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
  263. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
  264. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
  265. package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
  266. package/lib/solution/BuyTickets/index.js +67 -70
  267. package/lib/solution/BuyTickets/types.js +22 -38
  268. package/lib/solution/Checkout/index.js +1451 -1158
  269. package/lib/solution/Checkout/types.js +91 -61
  270. package/lib/solution/Checkout/utils/index.js +228 -156
  271. package/lib/solution/PlaceOrder/index.js +55 -0
  272. package/lib/solution/RegisterAndLogin/config.js +493 -460
  273. package/lib/solution/RegisterAndLogin/index.js +633 -630
  274. package/lib/solution/RegisterAndLogin/types.js +189 -76
  275. package/lib/solution/RegisterAndLogin/utils.js +183 -125
  276. package/lib/solution/Sales/index.js +328 -324
  277. package/lib/solution/Sales/types.js +27 -33
  278. package/lib/solution/ScanOrder/index.js +822 -852
  279. package/lib/solution/ScanOrder/types.d.ts +2 -0
  280. package/lib/solution/ScanOrder/types.js +33 -34
  281. package/lib/solution/ScanOrder/utils.js +412 -374
  282. package/lib/solution/ShopDiscount/index.js +226 -232
  283. package/lib/solution/ShopDiscount/types.js +15 -37
  284. package/lib/solution/ShopDiscount/utils.js +300 -172
  285. package/lib/solution/UnifiedBookingSales/index.js +1052 -1213
  286. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
  287. package/lib/solution/UnifiedBookingSales/types.js +10 -32
  288. package/lib/solution/VenueBooking/index.js +811 -879
  289. package/lib/solution/VenueBooking/types.js +19 -39
  290. package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
  291. package/lib/solution/VenueBooking/utils/resource.js +31 -54
  292. package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
  293. package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
  294. package/lib/solution/VenueBooking/utils.js +130 -67
  295. package/lib/solution/index.js +124 -41
  296. package/lib/store/createStore.js +32 -29
  297. package/lib/types/index.js +4 -16
  298. package/lib/utils/payment-number.js +26 -46
  299. package/lib/utils/task.js +36 -36
  300. package/lib/utils/watch.js +81 -47
  301. package/package.json +2 -1
@@ -189,6 +189,8 @@ export interface OrderLocalizedText {
189
189
  export interface OrderProduct extends OrderProductIdentity {
190
190
  order_detail_id: number | null;
191
191
  num: number;
192
+ /** Product 或当前 Variant 的生产编码 */
193
+ production_code?: string;
192
194
  bundle_edit?: number;
193
195
  product_sku: OrderProductSku;
194
196
  gift_card?: number;
@@ -332,6 +334,8 @@ export type AddProductBookingInput = Record<string, any>;
332
334
  */
333
335
  export interface AddProductToOrderOptions {
334
336
  insertAfterProductUid?: string;
337
+ /** 跳过同商品/规格匹配,始终新增购物车行。 */
338
+ disableMerge?: boolean;
335
339
  }
336
340
  /**
337
341
  * 删除商品后的可选位置保持策略。
@@ -827,7 +831,7 @@ export interface OrderModuleAPI {
827
831
  saveDraft: () => Promise<void>;
828
832
  hydrateTempOrderFromRecord: (record: Record<string, any>, options?: {
829
833
  recalcOnHydrate?: boolean;
830
- source?: 'salesDetail' | 'sessionStorage';
834
+ source?: 'salesDetail' | 'mergedSalesDetail' | 'sessionStorage';
831
835
  }) => Promise<OrderTempOrder>;
832
836
  syncPaymentsToOrder: <T = any>(params: SyncPaymentsToOrderParams) => Promise<SyncPaymentsToOrderResult<T>>;
833
837
  getSalesOrderByLookup: (params: SalesOrderLookupParams) => Promise<any>;
@@ -12,6 +12,12 @@ export interface LegalCurrencySnapshot {
12
12
  currency_symbol: string;
13
13
  currency_format: string;
14
14
  }
15
+ export interface CurrencyDisplaySnapshot {
16
+ amount_format: string;
17
+ symbol: unknown;
18
+ unit_label: unknown;
19
+ }
20
+ export declare function buildCurrencyDisplaySnapshot(snapshot: Pick<SelectedSettlementSnapshot, 'amount_format' | 'symbol' | 'unit_label'>): CurrencyDisplaySnapshot;
15
21
  export declare function resolveSettlementDisplayValue(value: unknown): string;
16
22
  export declare class OrderSettlementConflictError extends Error {
17
23
  readonly currentSettlementKey: string;
@@ -43,7 +49,8 @@ export declare function isVirtualSettlementOrder(tempOrder: OrderTempOrder | nul
43
49
  export declare function isVirtualSettlementDisplayOrder(tempOrder: OrderTempOrder | null | undefined): boolean;
44
50
  /**
45
51
  * 将购物车锁定的结算单位提升为订单级状态。
46
- * 商品行快照只负责价格归一化;展示与提交统一读取 tempOrder.currency_*。
52
+ * 商品行快照同时负责价格归一化和生成订单级多语言展示快照;
53
+ * 交易中的即时展示仍统一读取 tempOrder.currency_*。
47
54
  */
48
55
  export declare function applyTempOrderSettlementState(tempOrder: OrderTempOrder, snapshot: SelectedSettlementSnapshot): void;
49
56
  /** 清空购物车结算锁,并恢复进入虚拟币结算前的店铺法币。 */
@@ -18,6 +18,15 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
18
18
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
19
19
  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); }
20
20
  import Decimal from 'decimal.js';
21
+ import { cloneDeep } from 'lodash-es';
22
+ export function buildCurrencyDisplaySnapshot(snapshot) {
23
+ var _snapshot$symbol, _snapshot$unit_label;
24
+ return cloneDeep({
25
+ amount_format: String(snapshot.amount_format || '').trim(),
26
+ symbol: (_snapshot$symbol = snapshot.symbol) !== null && _snapshot$symbol !== void 0 ? _snapshot$symbol : {},
27
+ unit_label: (_snapshot$unit_label = snapshot.unit_label) !== null && _snapshot$unit_label !== void 0 ? _snapshot$unit_label : {}
28
+ });
29
+ }
21
30
  export function resolveSettlementDisplayValue(value) {
22
31
  var _ref, _ref2, _ref3, _ref4, _ref5, _localized$auto;
23
32
  if (value === undefined || value === null) return '';
@@ -140,17 +149,21 @@ function captureLegalCurrencySnapshot(tempOrder) {
140
149
 
141
150
  /**
142
151
  * 将购物车锁定的结算单位提升为订单级状态。
143
- * 商品行快照只负责价格归一化;展示与提交统一读取 tempOrder.currency_*。
152
+ * 商品行快照同时负责价格归一化和生成订单级多语言展示快照;
153
+ * 交易中的即时展示仍统一读取 tempOrder.currency_*。
144
154
  */
145
155
  export function applyTempOrderSettlementState(tempOrder, snapshot) {
146
156
  tempOrder.metadata = tempOrder.metadata || {};
147
157
  var settlementKey = getSettlementKey(snapshot) || 'legal_currency';
148
158
  if (snapshot.settlement_type === 'virtual_currency') {
159
+ var _tempOrder$metadata$c;
149
160
  captureLegalCurrencySnapshot(tempOrder);
150
161
  var _currencyProductId = Number(snapshot.currency_product_id);
162
+ var existingDisplaySnapshot = (_tempOrder$metadata$c = tempOrder.metadata.currency_settlement_config) === null || _tempOrder$metadata$c === void 0 ? void 0 : _tempOrder$metadata$c.currency_display_snapshot;
151
163
  tempOrder.metadata.currency_settlement_config = {
152
164
  settlement_type: 'virtual_currency',
153
- settlement_ids: Number.isFinite(_currencyProductId) && _currencyProductId > 0 ? [_currencyProductId] : []
165
+ settlement_ids: Number.isFinite(_currencyProductId) && _currencyProductId > 0 ? [_currencyProductId] : [],
166
+ currency_display_snapshot: existingDisplaySnapshot ? cloneDeep(existingDisplaySnapshot) : buildCurrencyDisplaySnapshot(snapshot)
154
167
  };
155
168
  } else {
156
169
  delete tempOrder.metadata.currency_settlement_config;
@@ -873,6 +873,7 @@ function formatSubmitBundleItems(bundle) {
873
873
  return {
874
874
  is_charge_tax: formatOptions.virtualSettlementMode ? 0 : (_rawBundle$is_charge_ = rawBundle.is_charge_tax) !== null && _rawBundle$is_charge_ !== void 0 ? _rawBundle$is_charge_ : 0,
875
875
  bundle_variant_id: (_rawBundle$bundle_var = rawBundle.bundle_variant_id) !== null && _rawBundle$bundle_var !== void 0 ? _rawBundle$bundle_var : 0,
876
+ production_code: rawBundle.production_code,
876
877
  num: num,
877
878
  quantity: toBundleNumber((_rawBundle$quantity = rawBundle.quantity) !== null && _rawBundle$quantity !== void 0 ? _rawBundle$quantity : rawBundle.num, num),
878
879
  extension_id: (_rawBundle$extension_ = rawBundle.extension_id) !== null && _rawBundle$extension_ !== void 0 ? _rawBundle$extension_ : 0,
@@ -1155,7 +1156,12 @@ export function buildSubmitPayload(params) {
1155
1156
  var _tempOrder$bookings;
1156
1157
  // 如果外部没有传递 types,根据订单里当前是否有 bookings 来决定是 appointment_booking 还是 virtual
1157
1158
  if (tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length) {
1158
- submitType = 'appointment_booking';
1159
+ // 260807 如果 biz 是堂食,type 使用table-order
1160
+ if (businessCode === 'dine_in') {
1161
+ submitType = 'table-order';
1162
+ } else {
1163
+ submitType = 'appointment_booking';
1164
+ }
1159
1165
  } else {
1160
1166
  submitType = 'virtual';
1161
1167
  }
@@ -207,9 +207,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
207
207
  // // 预连接数据库
208
208
  // this.dbManager.connect()
209
209
 
210
- console.log('[PaymentModule] 初始化完成');
211
210
  this.logInfo('PaymentModule initialized successfully');
212
- case 16:
211
+ case 15:
213
212
  case "end":
214
213
  return _context.stop();
215
214
  }
@@ -341,7 +340,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
341
340
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
342
341
  while (1) switch (_context2.prev = _context2.next) {
343
342
  case 0:
344
- console.log('网络状态:', status.connected);
345
343
  _this3.logInfo('Network status changed', {
346
344
  connected: status.connected,
347
345
  previousStatus: status.previousStatus
@@ -350,7 +348,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
350
348
  _this3.logInfo('Network reconnected');
351
349
  // 网络恢复时的处理逻辑可以在这里添加
352
350
  }
353
- case 3:
351
+ case 2:
354
352
  case "end":
355
353
  return _context2.stop();
356
354
  }
@@ -627,7 +625,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
627
625
  case 3:
628
626
  order = _context7.sent;
629
627
  if (!order) {
630
- _context7.next = 10;
628
+ _context7.next = 9;
631
629
  break;
632
630
  }
633
631
  _context7.next = 7;
@@ -636,20 +634,18 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
636
634
  _context7.next = 9;
637
635
  return this.core.effects.emit("".concat(this.name, ":onOrderDeleted"), order);
638
636
  case 9:
639
- console.log('[PaymentModule] 支付订单删除成功:', orderUuid);
640
- case 10:
641
- _context7.next = 16;
637
+ _context7.next = 15;
642
638
  break;
643
- case 12:
644
- _context7.prev = 12;
639
+ case 11:
640
+ _context7.prev = 11;
645
641
  _context7.t0 = _context7["catch"](0);
646
642
  console.error('[PaymentModule] 删除支付订单失败', _context7.t0);
647
643
  throw _context7.t0;
648
- case 16:
644
+ case 15:
649
645
  case "end":
650
646
  return _context7.stop();
651
647
  }
652
- }, _callee7, this, [[0, 12]]);
648
+ }, _callee7, this, [[0, 11]]);
653
649
  }));
654
650
  function deletePaymentOrderAsync(_x6) {
655
651
  return _deletePaymentOrderAsync.apply(this, arguments);
@@ -799,10 +795,9 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
799
795
  originalOrderId: originalOrderId,
800
796
  newOrderId: newOrderId
801
797
  });
802
- console.log("[PaymentModule] \u8BA2\u5355ID\u66FF\u6362\u6210\u529F: ".concat(originalOrderId, " \u2192 ").concat(newOrderId));
803
798
  return _context9.abrupt("return", updatedOrder);
804
- case 28:
805
- _context9.prev = 28;
799
+ case 27:
800
+ _context9.prev = 27;
806
801
  _context9.t0 = _context9["catch"](1);
807
802
  console.error('[PaymentModule] 替换订单ID失败', _context9.t0);
808
803
  this.logError('replaceOrderIdByUuidAsync failed', _context9.t0, {
@@ -810,11 +805,11 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
810
805
  newOrderId: newOrderId
811
806
  });
812
807
  throw _context9.t0;
813
- case 33:
808
+ case 32:
814
809
  case "end":
815
810
  return _context9.stop();
816
811
  }
817
- }, _callee9, this, [[1, 28]]);
812
+ }, _callee9, this, [[1, 27]]);
818
813
  }));
819
814
  function replaceOrderIdByUuidAsync(_x9, _x10) {
820
815
  return _replaceOrderIdByUuidAsync.apply(this, arguments);
@@ -1105,42 +1100,36 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1105
1100
  paymentItem.origin_amount = paymentItem.amount; // 保存原始金额
1106
1101
  paymentItem.amount = '0.00'; // 将金额设为0,不参与订单金额计算
1107
1102
 
1108
- console.log("[PaymentModule] \u652F\u4ED8\u9879\u6807\u8BB0\u4E3A\u5220\u9664:", {
1109
- uuid: paymentItem.uuid,
1110
- originalAmount: paymentItem.origin_amount,
1111
- status: paymentItem.status
1112
- });
1113
-
1114
1103
  // 重新计算待付金额
1115
1104
  this.recalculateOrderAmount(order);
1116
1105
 
1117
1106
  // 更新到 IndexDB
1118
- _context13.next = 20;
1107
+ _context13.next = 19;
1119
1108
  return this.dbManager.update('order', order);
1120
- case 20:
1121
- _context13.next = 22;
1109
+ case 19:
1110
+ _context13.next = 21;
1122
1111
  return this.core.effects.emit("".concat(this.name, ":onPaymentDeleted"), {
1123
1112
  order: order,
1124
1113
  paymentItem: paymentItem
1125
1114
  });
1126
- case 22:
1127
- _context13.next = 24;
1115
+ case 21:
1116
+ _context13.next = 23;
1128
1117
  return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
1129
1118
  action: 'payment_delete',
1130
1119
  order: order,
1131
1120
  paymentItem: paymentItem
1132
1121
  });
1133
- case 24:
1122
+ case 23:
1134
1123
  this.logInfo('deletePaymentAsync completed successfully (marked as voided)', {
1135
1124
  orderUuid: orderUuid,
1136
1125
  paymentUuid: paymentUuid,
1137
1126
  originalAmount: paymentItem.origin_amount,
1138
1127
  newExpectAmount: order.expect_amount
1139
1128
  });
1140
- _context13.next = 32;
1129
+ _context13.next = 31;
1141
1130
  break;
1142
- case 27:
1143
- _context13.prev = 27;
1131
+ case 26:
1132
+ _context13.prev = 26;
1144
1133
  _context13.t0 = _context13["catch"](1);
1145
1134
  console.error('[PaymentModule] 删除支付项失败', _context13.t0);
1146
1135
  this.logError('deletePaymentAsync failed', _context13.t0, {
@@ -1148,11 +1137,11 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1148
1137
  paymentUuid: paymentUuid
1149
1138
  });
1150
1139
  throw _context13.t0;
1151
- case 32:
1140
+ case 31:
1152
1141
  case "end":
1153
1142
  return _context13.stop();
1154
1143
  }
1155
- }, _callee13, this, [[1, 27]]);
1144
+ }, _callee13, this, [[1, 26]]);
1156
1145
  }));
1157
1146
  function deletePaymentAsync(_x15, _x16) {
1158
1147
  return _deletePaymentAsync.apply(this, arguments);
@@ -1216,80 +1205,61 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1216
1205
  existingVoucherItems = order.payment.filter(function (payment) {
1217
1206
  return payment.voucher_id && payment.status !== 'voided' && !payment.isSynced;
1218
1207
  });
1219
- console.log('[PaymentModule] 发现现有代金券支付项:', {
1220
- orderUuid: orderUuid,
1221
- existingVoucherCount: existingVoucherItems.length,
1222
- existingItems: existingVoucherItems.map(function (item) {
1223
- return {
1224
- uuid: item.uuid,
1225
- code: item.code,
1226
- amount: item.amount,
1227
- voucher_id: item.voucher_id,
1228
- isSynced: item.isSynced
1229
- };
1230
- })
1231
- });
1232
-
1233
1208
  // 2. 删除所有现有的代金券支付项(仅删除未同步的)
1234
1209
  _iterator2 = _createForOfIteratorHelper(existingVoucherItems);
1235
- _context14.prev = 12;
1210
+ _context14.prev = 11;
1236
1211
  _iterator2.s();
1237
- case 14:
1212
+ case 13:
1238
1213
  if ((_step2 = _iterator2.n()).done) {
1239
- _context14.next = 21;
1214
+ _context14.next = 19;
1240
1215
  break;
1241
1216
  }
1242
1217
  voucherItem = _step2.value;
1243
- console.log("[PaymentModule] \u5220\u9664\u73B0\u6709\u4EE3\u91D1\u5238\u652F\u4ED8\u9879: ".concat(voucherItem.uuid));
1244
- _context14.next = 19;
1218
+ _context14.next = 17;
1245
1219
  return _this6.deletePaymentAsync(orderUuid, voucherItem.uuid);
1220
+ case 17:
1221
+ _context14.next = 13;
1222
+ break;
1246
1223
  case 19:
1247
- _context14.next = 14;
1224
+ _context14.next = 24;
1248
1225
  break;
1249
1226
  case 21:
1250
- _context14.next = 26;
1251
- break;
1252
- case 23:
1253
- _context14.prev = 23;
1254
- _context14.t0 = _context14["catch"](12);
1227
+ _context14.prev = 21;
1228
+ _context14.t0 = _context14["catch"](11);
1255
1229
  _iterator2.e(_context14.t0);
1256
- case 26:
1257
- _context14.prev = 26;
1230
+ case 24:
1231
+ _context14.prev = 24;
1258
1232
  _iterator2.f();
1259
- return _context14.finish(26);
1260
- case 29:
1261
- _context14.next = 31;
1233
+ return _context14.finish(24);
1234
+ case 27:
1235
+ _context14.next = 29;
1262
1236
  return _this6.getPaymentOrderByUuidAsync(orderUuid);
1263
- case 31:
1237
+ case 29:
1264
1238
  orderAfterDelete = _context14.sent;
1265
1239
  if (orderAfterDelete) {
1266
- _context14.next = 34;
1240
+ _context14.next = 32;
1267
1241
  break;
1268
1242
  }
1269
1243
  throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728: ".concat(orderUuid));
1270
- case 34:
1244
+ case 32:
1271
1245
  existingActiveVoucherKeys = new Set(orderAfterDelete.payment.filter(function (p) {
1272
1246
  return p.voucher_id && p.status !== 'voided' && !p.isSynced;
1273
1247
  }).map(function (p) {
1274
1248
  return "".concat(p.voucher_id, "|").concat(p.order_payment_type || 'normal');
1275
1249
  }));
1276
- console.log('[PaymentModule] 添加新的代金券支付项:', {
1277
- orderUuid: orderUuid,
1278
- newItemCount: normalizedVoucherItems.length
1279
- });
1280
1250
  _iterator3 = _createForOfIteratorHelper(normalizedVoucherItems);
1281
- _context14.prev = 37;
1251
+ _context14.prev = 34;
1282
1252
  _iterator3.s();
1283
- case 39:
1253
+ case 36:
1284
1254
  if ((_step3 = _iterator3.n()).done) {
1285
- _context14.next = 52;
1255
+ _context14.next = 48;
1286
1256
  break;
1287
1257
  }
1288
1258
  _voucherItem = _step3.value;
1289
1259
  orderPaymentType = _voucherItem.order_payment_type || 'normal';
1290
1260
  key = "".concat(_voucherItem.voucher_id, "|").concat(orderPaymentType);
1291
1261
  if (!existingActiveVoucherKeys.has(key)) {
1292
- _context14.next = 46;
1262
+ _context14.next = 43;
1293
1263
  break;
1294
1264
  }
1295
1265
  console.warn('[PaymentModule] Skip adding voucher payment item because it already exists (active)', {
@@ -1297,54 +1267,48 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1297
1267
  voucher_id: _voucherItem.voucher_id,
1298
1268
  order_payment_type: orderPaymentType
1299
1269
  });
1300
- return _context14.abrupt("continue", 50);
1301
- case 46:
1302
- console.log("[PaymentModule] \u6DFB\u52A0\u4EE3\u91D1\u5238\u652F\u4ED8\u9879:", _objectSpread(_objectSpread({}, _voucherItem), {}, {
1303
- code: _voucherItem.code,
1304
- amount: _voucherItem.amount,
1305
- voucher_id: _voucherItem.voucher_id,
1306
- order_payment_type: orderPaymentType
1307
- }));
1308
- _context14.next = 49;
1270
+ return _context14.abrupt("continue", 46);
1271
+ case 43:
1272
+ _context14.next = 45;
1309
1273
  return _this6.addPaymentItemAsync(orderUuid, _voucherItem);
1310
- case 49:
1274
+ case 45:
1311
1275
  existingActiveVoucherKeys.add(key);
1312
- case 50:
1313
- _context14.next = 39;
1276
+ case 46:
1277
+ _context14.next = 36;
1314
1278
  break;
1315
- case 52:
1316
- _context14.next = 57;
1279
+ case 48:
1280
+ _context14.next = 53;
1317
1281
  break;
1318
- case 54:
1319
- _context14.prev = 54;
1320
- _context14.t1 = _context14["catch"](37);
1282
+ case 50:
1283
+ _context14.prev = 50;
1284
+ _context14.t1 = _context14["catch"](34);
1321
1285
  _iterator3.e(_context14.t1);
1322
- case 57:
1323
- _context14.prev = 57;
1286
+ case 53:
1287
+ _context14.prev = 53;
1324
1288
  _iterator3.f();
1325
- return _context14.finish(57);
1326
- case 60:
1327
- _context14.next = 62;
1289
+ return _context14.finish(53);
1290
+ case 56:
1291
+ _context14.next = 58;
1328
1292
  return _this6.getPaymentOrderByUuidAsync(orderUuid);
1329
- case 62:
1293
+ case 58:
1330
1294
  updatedOrder = _context14.sent;
1331
- _context14.next = 65;
1295
+ _context14.next = 61;
1332
1296
  return _this6.core.effects.emit("".concat(_this6.name, ":onPaymentAdded"), {
1333
1297
  orderUuid: orderUuid,
1334
1298
  order: updatedOrder,
1335
1299
  payment: null // 批量操作不提供单个支付项
1336
1300
  });
1337
- case 65:
1301
+ case 61:
1338
1302
  _this6.logInfo('updateVoucherPaymentItemsAsync completed successfully', {
1339
1303
  orderUuid: orderUuid,
1340
1304
  removedVoucherCount: existingVoucherItems.length,
1341
1305
  addedVoucherCount: normalizedVoucherItems.length,
1342
1306
  finalExpectAmount: updatedOrder === null || updatedOrder === void 0 ? void 0 : updatedOrder.expect_amount
1343
1307
  });
1344
- _context14.next = 73;
1308
+ _context14.next = 69;
1345
1309
  break;
1346
- case 68:
1347
- _context14.prev = 68;
1310
+ case 64:
1311
+ _context14.prev = 64;
1348
1312
  _context14.t2 = _context14["catch"](3);
1349
1313
  console.error('[PaymentModule] 批量更新代金券支付项失败:', _context14.t2);
1350
1314
  _this6.logError('updateVoucherPaymentItemsAsync failed', _context14.t2, {
@@ -1352,11 +1316,11 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1352
1316
  voucherPaymentItems: voucherPaymentItems
1353
1317
  });
1354
1318
  throw _context14.t2;
1355
- case 73:
1319
+ case 69:
1356
1320
  case "end":
1357
1321
  return _context14.stop();
1358
1322
  }
1359
- }, _callee14, null, [[3, 68], [12, 23, 26, 29], [37, 54, 57, 60]]);
1323
+ }, _callee14, null, [[3, 64], [11, 21, 24, 27], [34, 50, 53, 56]]);
1360
1324
  }))));
1361
1325
  case 1:
1362
1326
  case "end":
@@ -1577,11 +1541,9 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1577
1541
  if (totalPaidAmount.gte(orderTotalAmount)) {
1578
1542
  // 支付金额足够,标记为已完成
1579
1543
  order.payment_status = PaymentStatus.Finished;
1580
- console.log("[PaymentModule] \u8BA2\u5355 ".concat(order.uuid, " \u652F\u4ED8\u5B8C\u6210\uFF0C\u91D1\u989D: ").concat(totalPaidAmount.toString(), "/").concat(orderTotalAmount.toString()));
1581
1544
  } else {
1582
1545
  // 支付金额不足,标记为部分支付
1583
1546
  order.payment_status = PaymentStatus.PartiallyPaid;
1584
- console.log("[PaymentModule] \u8BA2\u5355 ".concat(order.uuid, " \u90E8\u5206\u652F\u4ED8\uFF0C\u91D1\u989D: ").concat(totalPaidAmount.toString(), "/").concat(orderTotalAmount.toString()));
1585
1547
  }
1586
1548
 
1587
1549
  // 给后端标记一下是全部支付(paid)还是部分支付
@@ -1592,37 +1554,36 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1592
1554
  return this.dbManager.update('order', order);
1593
1555
  case 8:
1594
1556
  if (!(paymentData.payments.length === 0)) {
1595
- _context18.next = 12;
1557
+ _context18.next = 11;
1596
1558
  break;
1597
1559
  }
1598
- console.log("[PaymentModule] \u8BA2\u5355 ".concat(order.uuid, " \u652F\u4ED8\u5217\u8868\u4E3A\u7A7A\uFF0C\u8DF3\u8FC7\u652F\u4ED8\u5904\u7406"));
1599
1560
  this.logWarning('Empty payment list', {
1600
1561
  orderUuid: order.uuid,
1601
1562
  orderId: order.order_id
1602
1563
  });
1603
1564
  return _context18.abrupt("return");
1604
- case 12:
1605
- _context18.next = 14;
1565
+ case 11:
1566
+ _context18.next = 13;
1606
1567
  return this.core.effects.emit("".concat(this.name, ":onPaymentSubmitted"), order);
1607
- case 14:
1608
- _context18.next = 16;
1568
+ case 13:
1569
+ _context18.next = 15;
1609
1570
  return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
1610
1571
  action: 'submit',
1611
1572
  order: order
1612
1573
  });
1613
- case 16:
1614
- _context18.next = 22;
1574
+ case 15:
1575
+ _context18.next = 21;
1615
1576
  break;
1616
- case 18:
1617
- _context18.prev = 18;
1577
+ case 17:
1578
+ _context18.prev = 17;
1618
1579
  _context18.t0 = _context18["catch"](0);
1619
1580
  console.error("[PaymentModule] \u8BA2\u5355 ".concat(order.uuid, " \u652F\u4ED8\u63D0\u4EA4\u5931\u8D25"), _context18.t0);
1620
1581
  throw _context18.t0;
1621
- case 22:
1582
+ case 21:
1622
1583
  case "end":
1623
1584
  return _context18.stop();
1624
1585
  }
1625
- }, _callee18, this, [[0, 18]]);
1586
+ }, _callee18, this, [[0, 17]]);
1626
1587
  }));
1627
1588
  function submitSingleOrderPayment(_x23) {
1628
1589
  return _submitSingleOrderPayment.apply(this, arguments);
@@ -1764,29 +1725,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1764
1725
  // 如果是定金模式,则使用deposit_amount 去减已付款金额
1765
1726
  var remainingAmount = order.is_deposit === 1 ? new Decimal(order.deposit_amount).minus(paidAmount) : totalAmount.minus(paidAmount);
1766
1727
  order.expect_amount = Decimal.max(0, remainingAmount).toFixed(2);
1767
- console.log("[PaymentModule] \u91CD\u65B0\u8BA1\u7B97\u8BA2\u5355\u91D1\u989D:", {
1768
- orderUuid: order.uuid,
1769
- totalAmount: order.total_amount,
1770
- effectivePaidAmount: paidAmount.toFixed(2),
1771
- remainingAmount: order.expect_amount,
1772
- activePayments: order.payment.filter(function (p) {
1773
- return p.status !== 'voided';
1774
- }).length,
1775
- voidedPayments: order.payment.filter(function (p) {
1776
- return p.status === 'voided';
1777
- }).length,
1778
- paymentDetails: order.payment.filter(function (p) {
1779
- return p.status !== 'voided';
1780
- }).map(function (p) {
1781
- return {
1782
- code: p.code,
1783
- amount: p.amount,
1784
- rounding_amount: p.rounding_amount || '0.00',
1785
- effective_amount: new Decimal(p.amount || 0).minus(new Decimal(p.rounding_amount || 0)).toFixed(2)
1786
- };
1787
- }),
1788
- 说明: '有效支付金额包含抹零计算(amount + |rounding_amount|)'
1789
- });
1790
1728
  }
1791
1729
 
1792
1730
  /**
@@ -2017,62 +1955,59 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
2017
1955
 
2018
1956
  // 计算基础值:x / interval
2019
1957
  baseValue = amount.div(roundingInterval);
2020
- console.log("[PaymentModule] \u820D\u5165\u8BA1\u7B97 - \u539F\u59CB\u91D1\u989D: ".concat(amount.toString(), ", \u95F4\u9694: ").concat(intervalValue, ", \u57FA\u7840\u503C: ").concat(baseValue.toString(), ", \u89C4\u5219: ").concat(rule));
2021
1958
  _context26.t0 = rule;
2022
- _context26.next = _context26.t0 === RoundingRule.Standard ? 13 : _context26.t0 === 'standard' ? 13 : _context26.t0 === RoundingRule.StandardDown ? 15 : _context26.t0 === 'standard_rounding_midpoint_down' ? 15 : _context26.t0 === RoundingRule.AlwaysUp ? 17 : _context26.t0 === 'always_up' ? 17 : _context26.t0 === RoundingRule.AlwaysDown ? 19 : _context26.t0 === 'always_down' ? 19 : 21;
1959
+ _context26.next = _context26.t0 === RoundingRule.Standard ? 12 : _context26.t0 === 'standard' ? 12 : _context26.t0 === RoundingRule.StandardDown ? 14 : _context26.t0 === 'standard_rounding_midpoint_down' ? 14 : _context26.t0 === RoundingRule.AlwaysUp ? 16 : _context26.t0 === 'always_up' ? 16 : _context26.t0 === RoundingRule.AlwaysDown ? 18 : _context26.t0 === 'always_down' ? 18 : 20;
2023
1960
  break;
2024
- case 13:
1961
+ case 12:
2025
1962
  // 标准舍入(中点向上)
2026
1963
  roundedValue = this.standardRound(baseValue, true);
2027
- return _context26.abrupt("break", 22);
2028
- case 15:
1964
+ return _context26.abrupt("break", 21);
1965
+ case 14:
2029
1966
  // 标准舍入(中点向下)
2030
1967
  roundedValue = this.standardRound(baseValue, false);
2031
- return _context26.abrupt("break", 22);
2032
- case 17:
1968
+ return _context26.abrupt("break", 21);
1969
+ case 16:
2033
1970
  // 总是向上舍入
2034
1971
  roundedValue = baseValue.ceil();
2035
- return _context26.abrupt("break", 22);
2036
- case 19:
1972
+ return _context26.abrupt("break", 21);
1973
+ case 18:
2037
1974
  // 总是向下舍入
2038
1975
  roundedValue = baseValue.floor();
2039
- return _context26.abrupt("break", 22);
2040
- case 21:
1976
+ return _context26.abrupt("break", 21);
1977
+ case 20:
2041
1978
  throw new Error("\u4E0D\u652F\u6301\u7684\u820D\u5165\u89C4\u5219: ".concat(rule));
2042
- case 22:
1979
+ case 21:
2043
1980
  // 计算最终金额:roundedValue * interval
2044
1981
  finalAmount = roundedValue.mul(roundingInterval);
2045
1982
  originalAmountStr = amount.toFixed(2); // 如果最终金额是 0 元,则不采用舍入金额,返回原始金额
2046
1983
  if (!finalAmount.eq(0)) {
2047
- _context26.next = 27;
1984
+ _context26.next = 25;
2048
1985
  break;
2049
1986
  }
2050
- console.log("[PaymentModule] \u6700\u7EC8\u91D1\u989D\u4E3A0\uFF0C\u8FD4\u56DE\u539F\u59CB\u91D1\u989D: ".concat(originalAmountStr));
2051
1987
  return _context26.abrupt("return", {
2052
1988
  originalAmount: originalAmountStr,
2053
1989
  roundedAmount: originalAmountStr,
2054
1990
  roundingDifference: '0.00'
2055
1991
  });
2056
- case 27:
1992
+ case 25:
2057
1993
  roundedAmountStr = finalAmount.toFixed(2); // 计算舍入差额
2058
1994
  roundingDifference = finalAmount.sub(amount);
2059
1995
  roundingDifferenceStr = roundingDifference.toFixed(2);
2060
- console.log("[PaymentModule] \u820D\u5165\u7ED3\u679C - \u539F\u59CB\u91D1\u989D: ".concat(originalAmountStr, ", \u820D\u5165\u540E\u91D1\u989D: ").concat(roundedAmountStr, ", \u820D\u5165\u5DEE\u989D: ").concat(roundingDifferenceStr));
2061
1996
  return _context26.abrupt("return", {
2062
1997
  originalAmount: originalAmountStr,
2063
1998
  roundedAmount: roundedAmountStr,
2064
1999
  roundingDifference: roundingDifferenceStr
2065
2000
  });
2066
- case 34:
2067
- _context26.prev = 34;
2001
+ case 31:
2002
+ _context26.prev = 31;
2068
2003
  _context26.t1 = _context26["catch"](0);
2069
2004
  console.error('[PaymentModule] 金额舍入失败:', _context26.t1);
2070
2005
  throw new Error("\u91D1\u989D\u820D\u5165\u5931\u8D25: ".concat(_context26.t1 instanceof Error ? _context26.t1.message : String(_context26.t1)));
2071
- case 38:
2006
+ case 35:
2072
2007
  case "end":
2073
2008
  return _context26.stop();
2074
2009
  }
2075
- }, _callee26, this, [[0, 34]]);
2010
+ }, _callee26, this, [[0, 31]]);
2076
2011
  }));
2077
2012
  function roundAmountAsync(_x27, _x28, _x29) {
2078
2013
  return _roundAmountAsync.apply(this, arguments);
@@ -92,6 +92,8 @@ export interface ProductData {
92
92
  is_gst: number;
93
93
  /** 商品编码 */
94
94
  code: string;
95
+ /** ERP/生产侧商品编码;有规格时以选中 Variant 的值为准 */
96
+ production_code?: string;
95
97
  /** 商品条码 */
96
98
  barcode: string;
97
99
  /** 是否支持配送 */