@pisell/pisellos 2.3.37 → 2.3.39

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 (169) hide show
  1. package/dist/modules/Discount/index.d.ts +1 -0
  2. package/dist/modules/Discount/index.js +40 -11
  3. package/dist/modules/Discount/types.d.ts +1 -0
  4. package/dist/modules/Holder/index.d.ts +48 -0
  5. package/dist/modules/Holder/index.js +640 -0
  6. package/dist/modules/Holder/types.d.ts +123 -0
  7. package/dist/modules/Holder/types.js +1 -0
  8. package/dist/modules/Holder/utils.d.ts +13 -0
  9. package/dist/modules/Holder/utils.js +34 -0
  10. package/dist/modules/OpenData/index.js +2 -2
  11. package/dist/modules/Order/index.d.ts +11 -28
  12. package/dist/modules/Order/index.js +513 -747
  13. package/dist/modules/Order/types.d.ts +10 -33
  14. package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
  15. package/dist/modules/Order/utils.d.ts +10 -0
  16. package/dist/modules/Order/utils.js +40 -11
  17. package/dist/modules/Payment/index.d.ts +0 -2
  18. package/dist/modules/Payment/index.js +49 -78
  19. package/dist/modules/Payment/types.d.ts +24 -26
  20. package/dist/modules/Payment/types.js +0 -2
  21. package/dist/modules/Product/types.d.ts +1 -0
  22. package/dist/modules/ProductList/index.js +33 -14
  23. package/dist/modules/Quotation/index.d.ts +1 -1
  24. package/dist/modules/Quotation/index.js +2 -2
  25. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  26. package/dist/modules/ResourcePlanner/index.js +181 -0
  27. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  28. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  29. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  30. package/dist/modules/ResourcePlanner/types.js +1 -0
  31. package/dist/modules/Rules/index.js +48 -15
  32. package/dist/modules/SalesSummary/index.js +12 -13
  33. package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
  34. package/dist/modules/ScanOrderLogger/index.js +15 -2
  35. package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
  36. package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
  37. package/dist/modules/Schedule/index.d.ts +3 -1
  38. package/dist/modules/Schedule/index.js +21 -16
  39. package/dist/modules/Summary/utils.js +38 -13
  40. package/dist/modules/index.d.ts +2 -0
  41. package/dist/modules/index.js +3 -1
  42. package/dist/plugins/window.d.ts +1 -0
  43. package/dist/server/index.d.ts +14 -16
  44. package/dist/server/index.js +1162 -1943
  45. package/dist/server/modules/order/index.d.ts +4 -49
  46. package/dist/server/modules/order/index.js +695 -1574
  47. package/dist/server/modules/order/types.d.ts +3 -11
  48. package/dist/server/modules/order/types.js +1 -1
  49. package/dist/solution/BaseSales/index.d.ts +10 -33
  50. package/dist/solution/BaseSales/index.js +385 -676
  51. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  52. package/dist/solution/BookingByStep/index.d.ts +17 -2
  53. package/dist/solution/BookingByStep/index.js +294 -215
  54. package/dist/solution/BookingByStep/types.d.ts +2 -1
  55. package/dist/solution/BookingByStep/types.js +3 -1
  56. package/dist/solution/BookingByStep/utils/capacity.js +17 -1
  57. package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  58. package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
  59. package/dist/solution/BookingTicket/index.js +1 -2
  60. package/dist/solution/Sales/index.d.ts +0 -1
  61. package/dist/solution/Sales/index.js +2 -10
  62. package/dist/solution/ScanOrder/index.d.ts +26 -14
  63. package/dist/solution/ScanOrder/index.js +1140 -737
  64. package/dist/solution/ScanOrder/types.d.ts +21 -1
  65. package/dist/solution/ScanOrder/utils.d.ts +8 -0
  66. package/dist/solution/ScanOrder/utils.js +66 -25
  67. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  68. package/dist/solution/ShopDiscount/index.js +125 -87
  69. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  70. package/dist/solution/UnifiedBookingSales/index.js +1871 -0
  71. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  72. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  73. package/dist/solution/VenueBooking/index.d.ts +39 -11
  74. package/dist/solution/VenueBooking/index.js +1177 -850
  75. package/dist/solution/VenueBooking/types.d.ts +3 -0
  76. package/dist/solution/VenueBooking/utils/resource.js +1 -0
  77. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  78. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
  79. package/dist/solution/index.d.ts +1 -0
  80. package/dist/solution/index.js +2 -1
  81. package/dist/types/index.d.ts +1 -0
  82. package/lib/modules/Discount/index.d.ts +1 -0
  83. package/lib/modules/Discount/index.js +9 -0
  84. package/lib/modules/Discount/types.d.ts +1 -0
  85. package/lib/modules/Holder/index.d.ts +48 -0
  86. package/lib/modules/Holder/index.js +402 -0
  87. package/lib/modules/Holder/types.d.ts +123 -0
  88. package/lib/modules/Holder/types.js +17 -0
  89. package/lib/modules/Holder/utils.d.ts +13 -0
  90. package/lib/modules/Holder/utils.js +71 -0
  91. package/lib/modules/OpenData/index.js +1 -1
  92. package/lib/modules/Order/index.d.ts +11 -28
  93. package/lib/modules/Order/index.js +83 -187
  94. package/lib/modules/Order/types.d.ts +10 -33
  95. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
  96. package/lib/modules/Order/utils.d.ts +10 -0
  97. package/lib/modules/Order/utils.js +39 -10
  98. package/lib/modules/Payment/index.d.ts +0 -2
  99. package/lib/modules/Payment/index.js +12 -33
  100. package/lib/modules/Payment/types.d.ts +24 -26
  101. package/lib/modules/Product/types.d.ts +1 -0
  102. package/lib/modules/ProductList/index.js +40 -31
  103. package/lib/modules/Quotation/index.d.ts +1 -1
  104. package/lib/modules/Quotation/index.js +2 -2
  105. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  106. package/lib/modules/ResourcePlanner/index.js +148 -0
  107. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  108. package/lib/modules/ResourcePlanner/planner.js +933 -0
  109. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  110. package/lib/modules/ResourcePlanner/types.js +17 -0
  111. package/lib/modules/Rules/index.js +34 -18
  112. package/lib/modules/SalesSummary/index.js +6 -7
  113. package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
  114. package/lib/modules/ScanOrderLogger/index.js +13 -1
  115. package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
  116. package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
  117. package/lib/modules/Schedule/index.d.ts +3 -1
  118. package/lib/modules/Schedule/index.js +10 -8
  119. package/lib/modules/Summary/utils.js +21 -1
  120. package/lib/modules/index.d.ts +2 -0
  121. package/lib/modules/index.js +5 -1
  122. package/lib/plugins/window.d.ts +1 -0
  123. package/lib/server/index.d.ts +14 -16
  124. package/lib/server/index.js +88 -678
  125. package/lib/server/modules/order/index.d.ts +4 -49
  126. package/lib/server/modules/order/index.js +66 -657
  127. package/lib/server/modules/order/types.d.ts +3 -11
  128. package/lib/solution/BaseSales/index.d.ts +10 -33
  129. package/lib/solution/BaseSales/index.js +33 -201
  130. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  131. package/lib/solution/BookingByStep/index.d.ts +17 -2
  132. package/lib/solution/BookingByStep/index.js +60 -18
  133. package/lib/solution/BookingByStep/types.d.ts +2 -1
  134. package/lib/solution/BookingByStep/types.js +5 -0
  135. package/lib/solution/BookingByStep/utils/capacity.js +20 -1
  136. package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  137. package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
  138. package/lib/solution/BookingTicket/index.js +1 -2
  139. package/lib/solution/Sales/index.d.ts +0 -1
  140. package/lib/solution/Sales/index.js +3 -5
  141. package/lib/solution/ScanOrder/index.d.ts +26 -14
  142. package/lib/solution/ScanOrder/index.js +449 -182
  143. package/lib/solution/ScanOrder/types.d.ts +21 -1
  144. package/lib/solution/ScanOrder/utils.d.ts +8 -0
  145. package/lib/solution/ScanOrder/utils.js +31 -0
  146. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  147. package/lib/solution/ShopDiscount/index.js +14 -0
  148. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  149. package/lib/solution/UnifiedBookingSales/index.js +1076 -0
  150. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  151. package/lib/solution/UnifiedBookingSales/types.js +33 -0
  152. package/lib/solution/VenueBooking/index.d.ts +39 -11
  153. package/lib/solution/VenueBooking/index.js +328 -115
  154. package/lib/solution/VenueBooking/types.d.ts +3 -0
  155. package/lib/solution/VenueBooking/utils/resource.js +1 -0
  156. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  157. package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
  158. package/lib/solution/index.d.ts +1 -0
  159. package/lib/solution/index.js +3 -1
  160. package/lib/types/index.d.ts +1 -0
  161. package/package.json +2 -2
  162. package/dist/modules/Order/payment-utils.d.ts +0 -26
  163. package/dist/modules/Order/payment-utils.js +0 -225
  164. package/dist/utils/payment-number.d.ts +0 -9
  165. package/dist/utils/payment-number.js +0 -69
  166. package/lib/modules/Order/payment-utils.d.ts +0 -26
  167. package/lib/modules/Order/payment-utils.js +0 -224
  168. package/lib/utils/payment-number.d.ts +0 -9
  169. package/lib/utils/payment-number.js +0 -64
@@ -394,6 +394,7 @@ export interface CommitOrderParams {
394
394
  type: 'virtual' | 'appointment_booking';
395
395
  platform?: string;
396
396
  extraData?: Record<string, any>;
397
+ business_code?: string;
397
398
  };
398
399
  }
399
400
  export interface OrderSubmitBooking {
@@ -468,8 +469,6 @@ export interface SubmitSalesOrderParams {
468
469
  export interface PaymentItemData {
469
470
  /** 当前支付项的唯一 ID */
470
471
  uuid: string;
471
- /** 支付项稳定唯一号 */
472
- payment_number?: string;
473
472
  /** 当前支付方式付出去多少钱 */
474
473
  amount: string;
475
474
  /** 支付类型代码 */
@@ -492,22 +491,13 @@ export interface PaymentItemData {
492
491
  export interface OrderPaymentMetadata {
493
492
  rounding_rule?: Record<string, any>;
494
493
  unique_payment_number?: string;
495
- /** 刷卡机设备快照;OS 不解析内部字段,仅透传并持久化 */
496
- card_reader_snapshot?: Record<string, unknown>;
497
494
  shop_wallet_pass_id?: number | string;
498
495
  actual_paid_amount?: number | string;
499
496
  change_given_amount?: number | string;
500
- transactions?: OrderPaymentTransaction[];
501
497
  [key: string]: any;
502
498
  }
503
- export interface OrderPaymentTransaction {
504
- number: string;
505
- status: 'success' | 'fail';
506
- }
507
499
  export interface OrderPaymentData {
508
500
  order_payment_id?: number | string;
509
- /** 支付项稳定唯一号;历史支付项允许缺失 */
510
- payment_number?: string;
511
501
  amount: string;
512
502
  code: string;
513
503
  custom_payment_id: number;
@@ -534,15 +524,6 @@ export interface OrderPaymentData {
534
524
  created_at?: string;
535
525
  updated_at?: string;
536
526
  }
537
- export interface OrderPaymentUpdateOptions {
538
- matchBy?: 'payment_number' | 'compat' | 'legacy';
539
- }
540
- export interface OrderPaymentUpdateResult {
541
- updated: boolean;
542
- payment: OrderPaymentData | null;
543
- payments: OrderPaymentData[];
544
- summary: OrderSummary | null;
545
- }
546
527
  export type OrderPaymentSource = PaymentItem | OrderPaymentData | Record<string, any>;
547
528
  export interface MapOrderPaymentsOptions {
548
529
  includeVoided?: boolean;
@@ -569,6 +550,12 @@ export interface SyncPaymentsToOrderParams {
569
550
  payments: OrderPaymentSource[];
570
551
  paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
571
552
  submitWhenPaid?: boolean;
553
+ /**
554
+ * Whether the checkout should be queued as the local `sync_sales` task.
555
+ * Defaults to true to preserve the WebPOS retry path. Set to false when
556
+ * the caller must wait for the cloud checkout response before proceeding.
557
+ */
558
+ checkoutSyncTaskEnabled?: boolean;
572
559
  smallTicketDataFlag?: number;
573
560
  businessCode?: string;
574
561
  channel?: string;
@@ -693,14 +680,6 @@ export interface OrderModuleAPI {
693
680
  channel?: string;
694
681
  type?: string;
695
682
  }) => OrderSubmitPayload;
696
- saveTempOrderAsDraft: <T = any>(params?: {
697
- cacheId?: string;
698
- platform?: string;
699
- businessCode?: string;
700
- channel?: string;
701
- type?: string;
702
- enhancePayload?: SubmitPayloadEnhancer;
703
- }) => Promise<T>;
704
683
  applyLocalPrintOrderNumbers: (order?: Record<string, any> | null) => Promise<OrderTempOrder>;
705
684
  getTempOrderNote: () => string;
706
685
  updateTempOrderNote: {
@@ -731,6 +710,8 @@ export interface OrderModuleAPI {
731
710
  setEnableTempOrderPersist: (enabled: boolean) => void;
732
711
  /** 是否允许 saveDraft 写入 IndexedDB 草稿。 */
733
712
  isTempOrderPersistEnabled: () => boolean;
713
+ /** 提交 tempOrder 变更并触发 `{moduleName}:changed` 事件 */
714
+ notifyTempOrderChanged: () => void;
734
715
  submitTempOrder: <T = any>(params?: {
735
716
  cacheId?: string;
736
717
  platform?: string;
@@ -758,15 +739,11 @@ export interface OrderModuleAPI {
758
739
  getOrderPayments: () => OrderPaymentData[];
759
740
  setOrderPayments: (payments: OrderPaymentSource[]) => OrderPaymentData[];
760
741
  addOrderPayment: (payment: OrderPaymentSource) => OrderPaymentData[];
761
- addOrderPaymentAsync: (payment: OrderPaymentSource) => Promise<OrderPaymentData[]>;
762
- updateOrderPayment: (paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>, options?: OrderPaymentUpdateOptions) => Promise<OrderPaymentUpdateResult>;
742
+ updateOrderPayment: (paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>) => OrderPaymentData[];
763
743
  deleteOrderPayment: (paymentIdentity: string | number) => OrderPaymentData[];
764
744
  updateVoucherOrderPayments: (payments: OrderPaymentSource[], options?: {
765
745
  status?: 'paid' | 'payment_pending';
766
746
  }) => OrderPaymentData[];
767
- updateVoucherOrderPaymentsAsync: (payments: OrderPaymentSource[], options?: {
768
- status?: 'paid' | 'payment_pending';
769
- }) => Promise<OrderPaymentData[]>;
770
747
  confirmPendingVoucherPayments: (options?: {
771
748
  persist?: boolean;
772
749
  recalculateSummary?: boolean;
@@ -209,11 +209,6 @@ export function normalizeOrderCollection(kind, items, options) {
209
209
  var persistentId = getOrderCollectionPersistentId(kind, item);
210
210
  var uid = getOrderCollectionUid(kind, item);
211
211
  if (!uid) {
212
- var _item;
213
- if (kind === 'payment' && !isBlankOrderCollectionIdentity((_item = item) === null || _item === void 0 ? void 0 : _item.payment_number)) {
214
- // payment_number 已提供稳定身份,不占用真实交易流水字段作为内部 UID。
215
- continue;
216
- }
217
212
  uid = persistentId ? buildOrderCollectionFallbackUid(kind, persistentId) : allocateAnonymousUid(occupiedUids, createAnonymousUid);
218
213
  item = setOrderCollectionUid(kind, item, uid);
219
214
  result[index] = item;
@@ -221,7 +216,7 @@ export function normalizeOrderCollection(kind, items, options) {
221
216
  if (!persistentId) stats.anonymousRowCount += 1;
222
217
  }
223
218
  if (occupiedUids.has(uid)) {
224
- var _item2, _item3, _item4, _item5;
219
+ var _item, _item2, _item3, _item4;
225
220
  var replacementUid = persistentId ? allocatePersistentConflictUid(kind, persistentId, occupiedUids) : allocateAnonymousUid(occupiedUids, createAnonymousUid);
226
221
  result[index] = setOrderCollectionUid(kind, item, replacementUid);
227
222
  uidRemaps.push({
@@ -230,7 +225,7 @@ export function normalizeOrderCollection(kind, items, options) {
230
225
  to: replacementUid,
231
226
  persistentId: persistentId,
232
227
  scope: 'linked-owner',
233
- referenceOwnerUid: kind === 'product' ? String(((_item2 = item) === null || _item2 === void 0 ? void 0 : _item2.booking_uid) || ((_item3 = item) === null || _item3 === void 0 || (_item3 = _item3.metadata) === null || _item3 === void 0 ? void 0 : _item3.booking_uid) || '') || null : kind === 'booking' ? String(((_item4 = item) === null || _item4 === void 0 ? void 0 : _item4.product_uid) || ((_item5 = item) === null || _item5 === void 0 || (_item5 = _item5.metadata) === null || _item5 === void 0 ? void 0 : _item5.product_uid) || '') || null : null
228
+ referenceOwnerUid: kind === 'product' ? String(((_item = item) === null || _item === void 0 ? void 0 : _item.booking_uid) || ((_item2 = item) === null || _item2 === void 0 || (_item2 = _item2.metadata) === null || _item2 === void 0 ? void 0 : _item2.booking_uid) || '') || null : kind === 'booking' ? String(((_item3 = item) === null || _item3 === void 0 ? void 0 : _item3.product_uid) || ((_item4 = item) === null || _item4 === void 0 || (_item4 = _item4.metadata) === null || _item4 === void 0 ? void 0 : _item4.product_uid) || '') || null : null
234
229
  });
235
230
  uid = replacementUid;
236
231
  stats.uidConflictCount += 1;
@@ -15,6 +15,7 @@ export interface OrderProductsDepositSummary {
15
15
  deposit_policy_ids: number[];
16
16
  hasDeposit: boolean;
17
17
  }
18
+ import type { WindowPlugin } from '../../plugins';
18
19
  /**
19
20
  * 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
20
21
  *
@@ -177,6 +178,15 @@ export declare const mergeRelationForms: (relationForms: {
177
178
  form_id: number;
178
179
  form_record_ids: number[];
179
180
  }[];
181
+ export interface CartOrderHolder {
182
+ customer_id?: number;
183
+ form_id: number | string;
184
+ form_record: (number | string)[] | null;
185
+ }
186
+ /**
187
+ * 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
188
+ */
189
+ export declare function ensureCartItemOriginHolder(cartItem: CartItem, window?: WindowPlugin): void;
180
190
  export declare const getAllDiscountList: (cartItem: CartItem) => any;
181
191
  export { createUuidV4 };
182
192
  export declare function isTempOrder(data: any): data is OrderTempOrder;
@@ -20,6 +20,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
20
20
  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; }
21
21
  import dayjs from "dayjs";
22
22
  import Decimal from 'decimal.js';
23
+ import { getProductHolderConfig } from "../Holder/utils";
23
24
  import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
24
25
  import { createUuidV4 } from "./utils/orderCollectionIdentity";
25
26
  /**
@@ -743,10 +744,41 @@ export var mergeRelationForms = function mergeRelationForms(relationForms) {
743
744
  return item.form_record_ids.length > 0;
744
745
  }); // 过滤掉没有有效记录的表单
745
746
  };
747
+ function getCustomerIdFromStorage(window) {
748
+ try {
749
+ var _window$getLocalStora;
750
+ var customer = JSON.parse((window === null || window === void 0 || (_window$getLocalStora = window.getLocalStorage) === null || _window$getLocalStora === void 0 ? void 0 : _window$getLocalStora.call(window, 'customer')) || '{}');
751
+ var customerId = Number(customer === null || customer === void 0 ? void 0 : customer.id);
752
+ return Number.isFinite(customerId) && customerId > 0 ? customerId : undefined;
753
+ } catch (_unused) {
754
+ return undefined;
755
+ }
756
+ }
757
+
758
+ /**
759
+ * 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
760
+ */
761
+ export function ensureCartItemOriginHolder(cartItem, window) {
762
+ var _cartItem$_origin, _cartItem$_productIni;
763
+ if (cartItem !== null && cartItem !== void 0 && (_cartItem$_origin = cartItem._origin) !== null && _cartItem$_origin !== void 0 && _cartItem$_origin.holder) {
764
+ return;
765
+ }
766
+ var holderConfig = getProductHolderConfig((_cartItem$_productIni = cartItem === null || cartItem === void 0 ? void 0 : cartItem._productInit) !== null && _cartItem$_productIni !== void 0 ? _cartItem$_productIni : cartItem === null || cartItem === void 0 ? void 0 : cartItem._productOrigin);
767
+ var formRecordId = cartItem === null || cartItem === void 0 ? void 0 : cartItem.holder_id;
768
+ if (!(holderConfig !== null && holderConfig !== void 0 && holderConfig.resource_id) || formRecordId == null) {
769
+ return;
770
+ }
771
+ cartItem._origin.holder = {
772
+ customer_id: getCustomerIdFromStorage(window),
773
+ form_id: holderConfig.resource_id,
774
+ form_record: [formRecordId]
775
+ };
776
+ }
777
+ ;
746
778
  export var getAllDiscountList = function getAllDiscountList(cartItem) {
747
- var _cartItem$_origin, _cartItem$_origin2;
748
- var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$_origin = cartItem._origin) === null || _cartItem$_origin === void 0 || (_cartItem$_origin = _cartItem$_origin.product) === null || _cartItem$_origin === void 0 ? void 0 : _cartItem$_origin.discount_list) || [];
749
- ((cartItem === null || cartItem === void 0 || (_cartItem$_origin2 = cartItem._origin) === null || _cartItem$_origin2 === void 0 || (_cartItem$_origin2 = _cartItem$_origin2.product) === null || _cartItem$_origin2 === void 0 ? void 0 : _cartItem$_origin2.product_bundle) || []).forEach(function (item) {
779
+ var _cartItem$_origin2, _cartItem$_origin3;
780
+ var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$_origin2 = cartItem._origin) === null || _cartItem$_origin2 === void 0 || (_cartItem$_origin2 = _cartItem$_origin2.product) === null || _cartItem$_origin2 === void 0 ? void 0 : _cartItem$_origin2.discount_list) || [];
781
+ ((cartItem === null || cartItem === void 0 || (_cartItem$_origin3 = cartItem._origin) === null || _cartItem$_origin3 === void 0 || (_cartItem$_origin3 = _cartItem$_origin3.product) === null || _cartItem$_origin3 === void 0 ? void 0 : _cartItem$_origin3.product_bundle) || []).forEach(function (item) {
750
782
  discountList = [].concat(_toConsumableArray(discountList), _toConsumableArray((item === null || item === void 0 ? void 0 : item.discount_list) || []));
751
783
  item.discount_list = undefined;
752
784
  });
@@ -1047,7 +1079,7 @@ export function createDefaultTempOrder(params) {
1047
1079
  };
1048
1080
  }
1049
1081
  export function buildSubmitPayload(params) {
1050
- var _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref30, _tempOrder$is_price_i, _tempOrder$is_deposit, _enhancedPayload$summ;
1082
+ var _tempOrder$customer_i, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref30, _tempOrder$is_price_i, _tempOrder$is_deposit, _enhancedPayload$summ;
1051
1083
  var tempOrder = params.tempOrder,
1052
1084
  cacheId = params.cacheId,
1053
1085
  _params$now = params.now,
@@ -1093,9 +1125,6 @@ export function buildSubmitPayload(params) {
1093
1125
  var payload = _objectSpread(_objectSpread({}, tempOrderRest), {}, {
1094
1126
  customer_id: (_tempOrder$customer_i = tempOrder.customer_id) !== null && _tempOrder$customer_i !== void 0 ? _tempOrder$customer_i : 1,
1095
1127
  customer_name: tempOrder.customer_name || 'Walk-In',
1096
- country_calling_code: String((_tempOrder$country_ca = tempOrder.country_calling_code) !== null && _tempOrder$country_ca !== void 0 ? _tempOrder$country_ca : ''),
1097
- phone: String((_tempOrder$phone = tempOrder.phone) !== null && _tempOrder$phone !== void 0 ? _tempOrder$phone : ''),
1098
- email: String((_tempOrder$email = tempOrder.email) !== null && _tempOrder$email !== void 0 ? _tempOrder$email : ''),
1099
1128
  order_number: (_tempOrder$order_numb = tempOrder.order_number) !== null && _tempOrder$order_numb !== void 0 ? _tempOrder$order_numb : null,
1100
1129
  shop_order_number: (_tempOrder$shop_order = tempOrder.shop_order_number) !== null && _tempOrder$shop_order !== void 0 ? _tempOrder$shop_order : null,
1101
1130
  shop_full_order_number: (_tempOrder$shop_full_ = tempOrder.shop_full_order_number) !== null && _tempOrder$shop_full_ !== void 0 ? _tempOrder$shop_full_ : null,
@@ -1155,7 +1184,9 @@ export function mapPaymentItemToOrderPayment(paymentItem) {
1155
1184
  var item = paymentItem;
1156
1185
  var customPaymentId = (_item$custom_payment_ = item.custom_payment_id) !== null && _item$custom_payment_ !== void 0 ? _item$custom_payment_ : item.id;
1157
1186
  var metadata = item.metadata && _typeof(item.metadata) === 'object' ? _objectSpread({}, item.metadata) : {};
1158
- var paymentNumber = item.payment_number;
1187
+ if (item.uuid && !metadata.unique_payment_number) {
1188
+ metadata.unique_payment_number = String(item.uuid);
1189
+ }
1159
1190
  var paymentMetadataKeys = ['rounding_rule', 'shop_wallet_pass_id', 'actual_paid_amount', 'change_given_amount'];
1160
1191
  for (var _i3 = 0, _paymentMetadataKeys = paymentMetadataKeys; _i3 < _paymentMetadataKeys.length; _i3++) {
1161
1192
  var key = _paymentMetadataKeys[_i3];
@@ -1166,10 +1197,8 @@ export function mapPaymentItemToOrderPayment(paymentItem) {
1166
1197
  var timestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
1167
1198
  var paymentTime = (_item$payment_time = item.payment_time) !== null && _item$payment_time !== void 0 ? _item$payment_time : timestamp;
1168
1199
  var createdAt = (_item$created_at = item.created_at) !== null && _item$created_at !== void 0 ? _item$created_at : timestamp;
1169
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, item.order_payment_id !== undefined ? {
1200
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, item.order_payment_id !== undefined ? {
1170
1201
  order_payment_id: item.order_payment_id
1171
- } : {}), paymentNumber !== undefined && paymentNumber !== null && paymentNumber !== '' ? {
1172
- payment_number: String(paymentNumber)
1173
1202
  } : {}), {}, {
1174
1203
  amount: String((_item$amount = item.amount) !== null && _item$amount !== void 0 ? _item$amount : '0.00'),
1175
1204
  code: String(item.code || ''),
@@ -20,7 +20,6 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
20
20
  protected defaultVersion: string;
21
21
  request: RequestPlugin;
22
22
  private app;
23
- private appPlugin;
24
23
  private store;
25
24
  window: WindowPlugin;
26
25
  private dbManager;
@@ -41,7 +40,6 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
41
40
  * paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
42
41
  */
43
42
  updateOtherParams(params: Record<string, any>): void;
44
- private getPaymentNumberAppData;
45
43
  /**
46
44
  * 记录信息日志
47
45
  */
@@ -27,9 +27,6 @@ import { CashPaymentImpl } from "./cash";
27
27
  import { EftposPaymentImpl } from "./eftpos";
28
28
  import { WalletPassPaymentImpl } from "./walletpass";
29
29
  import { Decimal } from 'decimal.js';
30
- import { ensureOrderPaymentNumber } from "../Order/payment-utils";
31
- import { createUuidV4 } from "../Order/utils";
32
- import { resolvePaymentNumberDevicePrefix } from "../../utils/payment-number";
33
30
  export * from "./types";
34
31
  export { generateRequestUniqueId };
35
32
 
@@ -105,7 +102,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
105
102
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
106
103
  _defineProperty(_assertThisInitialized(_this), "app", void 0);
107
104
  // App instance
108
- _defineProperty(_assertThisInitialized(_this), "appPlugin", void 0);
109
105
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
110
106
  _defineProperty(_assertThisInitialized(_this), "window", void 0);
111
107
  // WindowPlugin 实例
@@ -172,6 +168,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
172
168
  key: "initialize",
173
169
  value: function () {
174
170
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
171
+ var appPlugin;
175
172
  return _regeneratorRuntime().wrap(function _callee$(_context) {
176
173
  while (1) switch (_context.prev = _context.next) {
177
174
  case 0:
@@ -181,7 +178,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
181
178
 
182
179
  // 获取依赖的插件
183
180
  this.request = core.getPlugin('request');
184
- this.appPlugin = core.getPlugin('app');
181
+ appPlugin = core.getPlugin('app');
185
182
  this.window = core.getPlugin('window');
186
183
  if (this.request) {
187
184
  _context.next = 8;
@@ -189,13 +186,13 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
189
186
  }
190
187
  throw new Error('支付模块需要 request 插件支持');
191
188
  case 8:
192
- if (this.appPlugin) {
189
+ if (appPlugin) {
193
190
  _context.next = 10;
194
191
  break;
195
192
  }
196
193
  throw new Error('支付模块需要 app 插件支持');
197
194
  case 10:
198
- this.app = this.appPlugin.getApp();
195
+ this.app = appPlugin.getApp();
199
196
  this.dbManager = this.app.dbManager;
200
197
  this.logger = this.app.logger;
201
198
 
@@ -231,15 +228,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
231
228
  value: function updateOtherParams(params) {
232
229
  this.otherParams = params || {};
233
230
  }
234
- }, {
235
- key: "getPaymentNumberAppData",
236
- value: function getPaymentNumberAppData(key) {
237
- var _this$appPlugin, _this$appPlugin$getDa, _this$app, _this$app$getStore, _this$app$getStore$ca, _this$app$getStore$ca2;
238
- var getData = (_this$appPlugin = this.appPlugin) === null || _this$appPlugin === void 0 || (_this$appPlugin$getDa = _this$appPlugin.getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
239
- if (typeof getData === 'function') return getData(key);
240
- var coreData = (_this$app = this.app) === null || _this$app === void 0 || (_this$app = _this$app.models) === null || _this$app === void 0 || (_this$app$getStore = _this$app.getStore) === null || _this$app$getStore === void 0 || (_this$app$getStore$ca = (_this$app$getStore$ca2 = _this$app$getStore.call(_this$app)).getDataByModel) === null || _this$app$getStore$ca === void 0 ? void 0 : _this$app$getStore$ca.call(_this$app$getStore$ca2, 'core', 'core');
241
- return coreData === null || coreData === void 0 ? void 0 : coreData[key];
242
- }
243
231
 
244
232
  /**
245
233
  * 记录信息日志
@@ -896,8 +884,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
896
884
  key: "addPaymentItemAsync",
897
885
  value: (function () {
898
886
  var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(orderUuid, paymentItem) {
899
- var _this5 = this;
900
- var _paymentItem$metadata, _newPaymentItem$metad, _newPaymentItem$metad2, _newPaymentItem$metad3, order, expectAmount, paidDepositAmount, expectedDepositAmount, warningMessage, paymentUuid, currentTime, hasPaymentNumber, paymentNumberDevicePrefix, paymentNumber, newPaymentItem;
887
+ var _paymentItem$metadata, _newPaymentItem$metad, _newPaymentItem$metad2, _newPaymentItem$metad3, order, expectAmount, paidDepositAmount, expectedDepositAmount, warningMessage, paymentUuid, currentTime, newPaymentItem;
901
888
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
902
889
  while (1) switch (_context12.prev = _context12.next) {
903
890
  case 0:
@@ -953,29 +940,14 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
953
940
  });
954
941
  throw new Error(warningMessage);
955
942
  case 17:
956
- paymentUuid = paymentItem.uuid || ((_paymentItem$metadata = paymentItem.metadata) === null || _paymentItem$metadata === void 0 ? void 0 : _paymentItem$metadata.unique_payment_number) || getUniqueId('payment_');
957
- currentTime = formatDateTime(new Date());
958
- hasPaymentNumber = String(paymentItem.payment_number || '').trim() !== '';
959
- if (!hasPaymentNumber) {
960
- _context12.next = 24;
961
- break;
943
+ if ((_paymentItem$metadata = paymentItem.metadata) !== null && _paymentItem$metadata !== void 0 && _paymentItem$metadata.unique_payment_number) {
944
+ paymentUuid = paymentItem.metadata.unique_payment_number;
945
+ } else {
946
+ paymentUuid = getUniqueId('payment_');
962
947
  }
963
- _context12.t0 = 'LOCAL';
964
- _context12.next = 27;
965
- break;
966
- case 24:
967
- _context12.next = 26;
968
- return resolvePaymentNumberDevicePrefix(function (key) {
969
- return _this5.getPaymentNumberAppData(key);
970
- });
971
- case 26:
972
- _context12.t0 = _context12.sent;
973
- case 27:
974
- paymentNumberDevicePrefix = _context12.t0;
975
- paymentNumber = ensureOrderPaymentNumber(paymentItem, paymentNumberDevicePrefix, createUuidV4).payment_number;
948
+ currentTime = formatDateTime(new Date());
976
949
  newPaymentItem = {
977
950
  uuid: paymentUuid,
978
- payment_number: paymentNumber,
979
951
  custom_payment_id: normalizeCustomPaymentId(paymentItem),
980
952
  name: paymentItem.name,
981
953
  code: paymentItem.code,
@@ -994,7 +966,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
994
966
  // 创建时间
995
967
  updated_at: currentTime,
996
968
  // 更新时间
997
- metadata: _objectSpread({}, paymentItem.metadata)
969
+ metadata: _objectSpread(_objectSpread({}, paymentItem.metadata), {}, {
970
+ // 保留传入的所有 metadata 字段
971
+ unique_payment_number: paymentUuid // 设置唯一支付号为支付项的 uuid
972
+ })
998
973
  };
999
974
  order.payment.push(newPaymentItem);
1000
975
  this.recalculateOrderAmount(order);
@@ -1002,9 +977,9 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1002
977
  orderUuid: orderUuid,
1003
978
  order: order
1004
979
  });
1005
- _context12.next = 35;
980
+ _context12.next = 25;
1006
981
  return this.dbManager.update('order', order, true);
1007
- case 35:
982
+ case 25:
1008
983
  this.logInfo('更新订单支付项完成', {
1009
984
  orderUuid: orderUuid
1010
985
  });
@@ -1025,22 +1000,22 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1025
1000
  actualPaidAmount: (_newPaymentItem$metad2 = newPaymentItem.metadata) === null || _newPaymentItem$metad2 === void 0 ? void 0 : _newPaymentItem$metad2.actual_paid_amount,
1026
1001
  changeGivenAmount: (_newPaymentItem$metad3 = newPaymentItem.metadata) === null || _newPaymentItem$metad3 === void 0 ? void 0 : _newPaymentItem$metad3.change_given_amount
1027
1002
  });
1028
- _context12.next = 45;
1003
+ _context12.next = 35;
1029
1004
  break;
1030
- case 40:
1031
- _context12.prev = 40;
1032
- _context12.t1 = _context12["catch"](1);
1033
- console.error('[PaymentModule] 添加支付项失败', _context12.t1);
1034
- this.logError('addPaymentItemAsync failed', _context12.t1, {
1005
+ case 30:
1006
+ _context12.prev = 30;
1007
+ _context12.t0 = _context12["catch"](1);
1008
+ console.error('[PaymentModule] 添加支付项失败', _context12.t0);
1009
+ this.logError('addPaymentItemAsync failed', _context12.t0, {
1035
1010
  orderUuid: orderUuid,
1036
1011
  paymentItem: paymentItem
1037
1012
  });
1038
- throw _context12.t1;
1039
- case 45:
1013
+ throw _context12.t0;
1014
+ case 35:
1040
1015
  case "end":
1041
1016
  return _context12.stop();
1042
1017
  }
1043
- }, _callee12, this, [[1, 40]]);
1018
+ }, _callee12, this, [[1, 30]]);
1044
1019
  }));
1045
1020
  function addPaymentItemAsync(_x13, _x14) {
1046
1021
  return _addPaymentItemAsync.apply(this, arguments);
@@ -1160,17 +1135,17 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1160
1135
  key: "updateVoucherPaymentItemsAsync",
1161
1136
  value: (function () {
1162
1137
  var _updateVoucherPaymentItemsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(orderUuid, voucherPaymentItems) {
1163
- var _this6 = this;
1138
+ var _this5 = this;
1164
1139
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1165
1140
  while (1) switch (_context15.prev = _context15.next) {
1166
1141
  case 0:
1167
1142
  return _context15.abrupt("return", this.runVoucherUpdateLocked(orderUuid, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
1168
- var _this6$normalizeVouch, normalizedVoucherItems, originalCount, normalizedCount, order, existingVoucherItems, _iterator2, _step2, voucherItem, orderAfterDelete, existingActiveVoucherKeys, _iterator3, _step3, _voucherItem, orderPaymentType, key, updatedOrder;
1143
+ var _this5$normalizeVouch, normalizedVoucherItems, originalCount, normalizedCount, order, existingVoucherItems, _iterator2, _step2, voucherItem, orderAfterDelete, existingActiveVoucherKeys, _iterator3, _step3, _voucherItem, orderPaymentType, key, updatedOrder;
1169
1144
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1170
1145
  while (1) switch (_context14.prev = _context14.next) {
1171
1146
  case 0:
1172
- _this6$normalizeVouch = _this6.normalizeVoucherPaymentItems(voucherPaymentItems), normalizedVoucherItems = _this6$normalizeVouch.items, originalCount = _this6$normalizeVouch.originalCount, normalizedCount = _this6$normalizeVouch.normalizedCount;
1173
- _this6.logInfo('Starting updateVoucherPaymentItemsAsync', {
1147
+ _this5$normalizeVouch = _this5.normalizeVoucherPaymentItems(voucherPaymentItems), normalizedVoucherItems = _this5$normalizeVouch.items, originalCount = _this5$normalizeVouch.originalCount, normalizedCount = _this5$normalizeVouch.normalizedCount;
1148
+ _this5.logInfo('Starting updateVoucherPaymentItemsAsync', {
1174
1149
  orderUuid: orderUuid,
1175
1150
  originalVoucherCount: originalCount,
1176
1151
  normalizedVoucherCount: normalizedCount,
@@ -1192,7 +1167,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1192
1167
  }
1193
1168
  _context14.prev = 3;
1194
1169
  _context14.next = 6;
1195
- return _this6.getPaymentOrderByUuidAsync(orderUuid);
1170
+ return _this5.getPaymentOrderByUuidAsync(orderUuid);
1196
1171
  case 6:
1197
1172
  order = _context14.sent;
1198
1173
  if (order) {
@@ -1232,7 +1207,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1232
1207
  voucherItem = _step2.value;
1233
1208
  console.log("[PaymentModule] \u5220\u9664\u73B0\u6709\u4EE3\u91D1\u5238\u652F\u4ED8\u9879: ".concat(voucherItem.uuid));
1234
1209
  _context14.next = 19;
1235
- return _this6.deletePaymentAsync(orderUuid, voucherItem.uuid);
1210
+ return _this5.deletePaymentAsync(orderUuid, voucherItem.uuid);
1236
1211
  case 19:
1237
1212
  _context14.next = 14;
1238
1213
  break;
@@ -1249,7 +1224,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1249
1224
  return _context14.finish(26);
1250
1225
  case 29:
1251
1226
  _context14.next = 31;
1252
- return _this6.getPaymentOrderByUuidAsync(orderUuid);
1227
+ return _this5.getPaymentOrderByUuidAsync(orderUuid);
1253
1228
  case 31:
1254
1229
  orderAfterDelete = _context14.sent;
1255
1230
  if (orderAfterDelete) {
@@ -1296,7 +1271,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1296
1271
  order_payment_type: orderPaymentType
1297
1272
  }));
1298
1273
  _context14.next = 49;
1299
- return _this6.addPaymentItemAsync(orderUuid, _voucherItem);
1274
+ return _this5.addPaymentItemAsync(orderUuid, _voucherItem);
1300
1275
  case 49:
1301
1276
  existingActiveVoucherKeys.add(key);
1302
1277
  case 50:
@@ -1315,17 +1290,17 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1315
1290
  return _context14.finish(57);
1316
1291
  case 60:
1317
1292
  _context14.next = 62;
1318
- return _this6.getPaymentOrderByUuidAsync(orderUuid);
1293
+ return _this5.getPaymentOrderByUuidAsync(orderUuid);
1319
1294
  case 62:
1320
1295
  updatedOrder = _context14.sent;
1321
1296
  _context14.next = 65;
1322
- return _this6.core.effects.emit("".concat(_this6.name, ":onPaymentAdded"), {
1297
+ return _this5.core.effects.emit("".concat(_this5.name, ":onPaymentAdded"), {
1323
1298
  orderUuid: orderUuid,
1324
1299
  order: updatedOrder,
1325
1300
  payment: null // 批量操作不提供单个支付项
1326
1301
  });
1327
1302
  case 65:
1328
- _this6.logInfo('updateVoucherPaymentItemsAsync completed successfully', {
1303
+ _this5.logInfo('updateVoucherPaymentItemsAsync completed successfully', {
1329
1304
  orderUuid: orderUuid,
1330
1305
  removedVoucherCount: existingVoucherItems.length,
1331
1306
  addedVoucherCount: normalizedVoucherItems.length,
@@ -1337,7 +1312,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1337
1312
  _context14.prev = 68;
1338
1313
  _context14.t2 = _context14["catch"](3);
1339
1314
  console.error('[PaymentModule] 批量更新代金券支付项失败:', _context14.t2);
1340
- _this6.logError('updateVoucherPaymentItemsAsync failed', _context14.t2, {
1315
+ _this5.logError('updateVoucherPaymentItemsAsync failed', _context14.t2, {
1341
1316
  orderUuid: orderUuid,
1342
1317
  voucherPaymentItems: voucherPaymentItems
1343
1318
  });
@@ -1386,7 +1361,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1386
1361
  return payment.uuid === paymentUuid;
1387
1362
  });
1388
1363
  if (!paymentItem) {
1389
- _context16.next = 19;
1364
+ _context16.next = 18;
1390
1365
  break;
1391
1366
  }
1392
1367
  // 如果更新参数中包含 amount,先格式化
@@ -1394,43 +1369,40 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1394
1369
  if ('amount' in formattedParams && formattedParams.amount !== undefined) {
1395
1370
  formattedParams.amount = formatAmount(formattedParams.amount);
1396
1371
  }
1397
- if (formattedParams.metadata && _typeof(formattedParams.metadata) === 'object') {
1398
- formattedParams.metadata = _objectSpread(_objectSpread({}, paymentItem.metadata || {}), formattedParams.metadata);
1399
- }
1400
1372
  Object.assign(paymentItem, formattedParams);
1401
1373
 
1402
1374
  // 重新计算待付金额
1403
1375
  this.recalculateOrderAmount(order);
1404
1376
 
1405
1377
  // 更新到 IndexDB
1406
- _context16.next = 15;
1378
+ _context16.next = 14;
1407
1379
  return this.dbManager.update('order', order);
1408
- case 15:
1409
- _context16.next = 17;
1380
+ case 14:
1381
+ _context16.next = 16;
1410
1382
  return this.core.effects.emit("".concat(this.name, ":onPaymentUpdated"), {
1411
1383
  order: order,
1412
1384
  paymentItem: paymentItem
1413
1385
  });
1414
- case 17:
1415
- _context16.next = 19;
1386
+ case 16:
1387
+ _context16.next = 18;
1416
1388
  return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
1417
1389
  action: 'payment_update',
1418
1390
  order: order,
1419
1391
  paymentItem: paymentItem
1420
1392
  });
1421
- case 19:
1422
- _context16.next = 25;
1393
+ case 18:
1394
+ _context16.next = 24;
1423
1395
  break;
1424
- case 21:
1425
- _context16.prev = 21;
1396
+ case 20:
1397
+ _context16.prev = 20;
1426
1398
  _context16.t0 = _context16["catch"](0);
1427
1399
  console.error('[PaymentModule] 更新支付项失败', _context16.t0);
1428
1400
  throw _context16.t0;
1429
- case 25:
1401
+ case 24:
1430
1402
  case "end":
1431
1403
  return _context16.stop();
1432
1404
  }
1433
- }, _callee16, this, [[0, 21]]);
1405
+ }, _callee16, this, [[0, 20]]);
1434
1406
  }));
1435
1407
  function updatePaymentAsync(_x19, _x20, _x21) {
1436
1408
  return _updatePaymentAsync.apply(this, arguments);
@@ -1546,7 +1518,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
1546
1518
  payments: order.payment.map(function (payment) {
1547
1519
  return {
1548
1520
  uuid: payment.uuid,
1549
- payment_number: payment.payment_number,
1550
1521
  amount: payment.amount,
1551
1522
  code: payment.code,
1552
1523
  custom_payment_id: payment.custom_payment_id,