@pisell/pisellos 2.3.225 → 2.3.226

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 (32) hide show
  1. package/dist/modules/Customer/types.d.ts +4 -0
  2. package/dist/modules/Order/index.js +123 -79
  3. package/dist/modules/Order/types.d.ts +2 -0
  4. package/dist/modules/Order/utils/bookingUuid.d.ts +4 -0
  5. package/dist/modules/Order/utils/bookingUuid.js +24 -0
  6. package/dist/modules/Order/utils.js +2 -0
  7. package/dist/modules/Product/index.d.ts +1 -1
  8. package/dist/modules/Summary/utils.d.ts +1 -1
  9. package/dist/solution/BaseSales/index.js +3 -0
  10. package/dist/solution/BookingByStep/index.d.ts +2 -2
  11. package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +8 -8
  12. package/dist/solution/Checkout/index.js +104 -69
  13. package/dist/solution/Checkout/types.d.ts +1 -0
  14. package/dist/solution/ScanOrder/index.js +10 -2
  15. package/dist/solution/VenueBooking/index.js +522 -490
  16. package/lib/model/strategy/adapter/promotion/index.js +1 -46
  17. package/lib/modules/Customer/types.d.ts +4 -0
  18. package/lib/modules/Order/index.js +44 -6
  19. package/lib/modules/Order/types.d.ts +2 -0
  20. package/lib/modules/Order/utils/bookingUuid.d.ts +4 -0
  21. package/lib/modules/Order/utils/bookingUuid.js +25 -0
  22. package/lib/modules/Order/utils.js +5 -1
  23. package/lib/modules/Product/index.d.ts +1 -1
  24. package/lib/modules/Summary/utils.d.ts +1 -1
  25. package/lib/solution/BaseSales/index.js +3 -0
  26. package/lib/solution/BookingByStep/index.d.ts +2 -2
  27. package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +8 -8
  28. package/lib/solution/Checkout/index.js +21 -0
  29. package/lib/solution/Checkout/types.d.ts +1 -0
  30. package/lib/solution/ScanOrder/index.js +6 -0
  31. package/lib/solution/VenueBooking/index.js +6 -1
  32. package/package.json +1 -1
@@ -1,46 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
7
- enumerable: true,
8
- get: function () {
9
- return _examples.BUY_X_GET_Y_FREE_STRATEGY;
10
- }
11
- });
12
- Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
13
- enumerable: true,
14
- get: function () {
15
- return _examples.ITEM_REWARD_STRATEGY;
16
- }
17
- });
18
- Object.defineProperty(exports, "PromotionAdapter", {
19
- enumerable: true,
20
- get: function () {
21
- return _adapter.PromotionAdapter;
22
- }
23
- });
24
- Object.defineProperty(exports, "PromotionEvaluator", {
25
- enumerable: true,
26
- get: function () {
27
- return _evaluator.PromotionEvaluator;
28
- }
29
- });
30
- Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
31
- enumerable: true,
32
- get: function () {
33
- return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
34
- }
35
- });
36
- Object.defineProperty(exports, "default", {
37
- enumerable: true,
38
- get: function () {
39
- return _adapter.default;
40
- }
41
- });
42
- var _evaluator = require("./evaluator");
43
- var _adapter = _interopRequireWildcard(require("./adapter"));
44
- var _examples = require("./examples");
45
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
46
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
1
+ "use strict";
@@ -44,6 +44,10 @@ export interface ShopGetCustomerListParams {
44
44
  num?: number;
45
45
  /** 搜索关键词 */
46
46
  search?: string;
47
+ /** Full national phone number, without the international calling code. */
48
+ phone?: string;
49
+ /** Exact email lookup, independent from the generic search keyword. */
50
+ email?: string;
47
51
  /** 关联查询参数 */
48
52
  with?: CustomerWith[];
49
53
  /** wallet搜索标识 */
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "isFulfillmentTimingBooking", {
11
11
  }
12
12
  });
13
13
  var _loadSalesOrderSnapshot = require("../../shared/sales/loadSalesOrderSnapshot");
14
+ var _bookingUuid = require("./utils/bookingUuid");
14
15
  var _localEftposState = require("./localEftposState");
15
16
  var _BaseModule = require("../BaseModule");
16
17
  var _types = require("./types");
@@ -2584,7 +2585,7 @@ class OrderModule extends _BaseModule.BaseModule {
2584
2585
  booking_uid: bookingUid
2585
2586
  },
2586
2587
  booking: {
2587
- ...params.booking,
2588
+ ...(0, _bookingUuid.ensureBookingUuid)(params.booking),
2588
2589
  is_all: (0, _utils.normalizeBookingIsAll)(params.booking),
2589
2590
  product_uid: productUid,
2590
2591
  sub_type: (0, _utils.normalizeBookingSubType)(params.booking),
@@ -3199,7 +3200,7 @@ class OrderModule extends _BaseModule.BaseModule {
3199
3200
  const tempOrder = this.ensureTempOrder();
3200
3201
  const bookings = tempOrder.bookings || [];
3201
3202
  const firstIndex = bookings.findIndex(_pickupTiming.isFulfillmentTimingBooking);
3202
- const nextBooking = (0, _pickupTiming.buildPickupTimingBooking)(input, bookings[firstIndex]);
3203
+ const nextBooking = (0, _bookingUuid.ensureBookingUuid)((0, _pickupTiming.buildPickupTimingBooking)(input, bookings[firstIndex]));
3203
3204
  // Keep the first row's identity and position; repair duplicate marked rows only.
3204
3205
  tempOrder.bookings = firstIndex === -1 ? [...bookings, nextBooking] : bookings.flatMap((booking, index) => index === firstIndex ? [nextBooking] : (0, _pickupTiming.isFulfillmentTimingBooking)(booking) ? [] : [booking]);
3205
3206
  this.notifyTempOrderChanged();
@@ -3851,6 +3852,16 @@ class OrderModule extends _BaseModule.BaseModule {
3851
3852
  * if (pending) await pending;
3852
3853
  */
3853
3854
  appendProductLineToTempOrder(tempOrder, product, booking, options) {
3855
+ const incomingBookingUuid = booking?.uuid;
3856
+ if (booking && incomingBookingUuid && tempOrder.bookings?.some(item => item.uuid === incomingBookingUuid)) {
3857
+ // Appending a copy creates a different booking; editing uses the update path below.
3858
+ booking = {
3859
+ ...booking,
3860
+ uuid: (0, _utils.createUuidV4)(),
3861
+ id: undefined,
3862
+ schedule_event_id: undefined
3863
+ };
3864
+ }
3854
3865
  const linked = booking ? this.createLinkedProductAndBooking({
3855
3866
  product,
3856
3867
  booking
@@ -4015,6 +4026,12 @@ class OrderModule extends _BaseModule.BaseModule {
4015
4026
  singleLine.num = 1;
4016
4027
  delete singleLine.product_quantity;
4017
4028
  const singleBooking = (0, _lodashEs.cloneDeep)(booking);
4029
+ if (index > 0) {
4030
+ // Both single-add and batch-add quantity splits create separate appointments.
4031
+ delete singleBooking.uuid;
4032
+ delete singleBooking.schedule_event_id;
4033
+ delete singleBooking.id;
4034
+ }
4018
4035
  const bookingHolder = booking?.holder && typeof booking.holder === 'object' ? booking.holder : null;
4019
4036
  const metadataHolder = booking?.metadata?.holder && typeof booking.metadata.holder === 'object' ? booking.metadata.holder : null;
4020
4037
  const rawHolderIds = bookingHolder?.form_record ?? booking?.metadata?.holder_id ?? metadataHolder?.form_record ?? product?.metadata?.holder_id;
@@ -4265,7 +4282,8 @@ class OrderModule extends _BaseModule.BaseModule {
4265
4282
  const target = live.products[targetIndex];
4266
4283
  const scopeKey = String(target?.metadata?.venue_booking_scope_key || '');
4267
4284
  const targetBookingUid = String(target?.booking_uid || target?.metadata?.booking_uid || '');
4268
- if (!uid || !target || !scopeKey || live.order_id || target.order_detail_id != null || Number(target.num) !== 1 || Number(params.product.num ?? 1) !== 1 || target.metadata?.venue_booking_role !== 'party_main' || params.product.metadata?.venue_booking_role !== 'party_main' || params.product.metadata?.venue_booking_scope_key !== scopeKey || !Array.isArray(params.relatedRetailProducts) || (live.payments || []).length > 0 || !targetBookingUid || String(params.booking.metadata?.unique_identification_number || '') !== targetBookingUid || (live.bookings || []).filter(booking => this.getBookingUniqueIdentificationNumber(booking) === targetBookingUid).length !== 1 || live.products.filter(line => line.metadata?.venue_booking_role === 'party_main' && line.metadata?.venue_booking_scope_key === scopeKey).length !== 1) {
4285
+ const targetBookings = (live.bookings || []).filter(row => this.getBookingUniqueIdentificationNumber(row) === targetBookingUid);
4286
+ if (!uid || !target || !scopeKey || live.order_id || target.order_detail_id != null || Number(target.num) !== 1 || Number(params.product.num ?? 1) !== 1 || target.metadata?.venue_booking_role !== 'party_main' || params.product.metadata?.venue_booking_role !== 'party_main' || params.product.metadata?.venue_booking_scope_key !== scopeKey || !Array.isArray(params.relatedRetailProducts) || (live.payments || []).length > 0 || !targetBookingUid || String(params.booking.metadata?.unique_identification_number || '') !== targetBookingUid || targetBookings.length !== 1 || live.products.filter(line => line.metadata?.venue_booking_role === 'party_main' && line.metadata?.venue_booking_scope_key === scopeKey).length !== 1) {
4269
4287
  throw new Error('[Order] Party replacement requires one unsubmitted, unpaid main booking in the same scope');
4270
4288
  }
4271
4289
  const children = live.products.filter(line => line.metadata?.venue_booking_role === 'party_extra' && String(line.metadata?.venue_booking_parent_uid || '') === uid);
@@ -4325,7 +4343,9 @@ class OrderModule extends _BaseModule.BaseModule {
4325
4343
  venue_booking_service_datetime: serviceDatetime
4326
4344
  };
4327
4345
  replacement.unique_identification_number = uid;
4328
- await this.appendProductLineToTempOrder(draft, replacement, (0, _lodashEs.cloneDeep)(params.booking), {
4346
+ const replacementBooking = (0, _lodashEs.cloneDeep)(params.booking);
4347
+ replacementBooking.uuid = targetBookings[0].uuid || replacementBooking.uuid;
4348
+ await this.appendProductLineToTempOrder(draft, replacement, replacementBooking, {
4329
4349
  insertAtIndex: targetIndex,
4330
4350
  disableMerge: true,
4331
4351
  beforeCommit
@@ -4733,12 +4753,22 @@ class OrderModule extends _BaseModule.BaseModule {
4733
4753
  ...(normalizedProduct.metadata || {}),
4734
4754
  unique_identification_number: productUid
4735
4755
  };
4756
+ const originalBookingUid = targetProduct.booking_uid || targetProduct.metadata?.booking_uid || preservedBookingUid;
4757
+ const bookings = tempOrder.bookings || [];
4758
+ const eventId = booking.schedule_event_id;
4759
+ const originalBooking = bookings.find(row => Number(eventId) > 0 && String(row.schedule_event_id) === String(eventId)) ?? bookings.find(row => originalBookingUid && row.metadata?.unique_identification_number === originalBookingUid);
4760
+ const {
4761
+ uuid: incomingUuid = originalBooking?.uuid
4762
+ } = booking;
4736
4763
  const linked = this.createLinkedProductAndBooking({
4737
4764
  product: {
4738
4765
  ...normalizedProduct,
4739
4766
  unique_identification_number: productUid
4740
4767
  },
4741
- booking
4768
+ booking: {
4769
+ ...booking,
4770
+ uuid: originalBooking?.uuid || incomingUuid
4771
+ }
4742
4772
  });
4743
4773
  this.removeLinkedBookingsForProduct(tempOrder, targetProduct);
4744
4774
  normalizedProduct = {
@@ -5000,9 +5030,13 @@ class OrderModule extends _BaseModule.BaseModule {
5000
5030
  throw new Error('[Order] 目标 booking 不存在,无法更新');
5001
5031
  }
5002
5032
  const targetBooking = tempOrder.bookings[bookingIndex] || {};
5033
+ const {
5034
+ uuid: incomingUuid = targetBooking.uuid
5035
+ } = updates;
5003
5036
  const nextBooking = {
5004
5037
  ...targetBooking,
5005
5038
  ...updates,
5039
+ uuid: targetBooking.uuid || incomingUuid,
5006
5040
  metadata: {
5007
5041
  ...(targetBooking.metadata || {}),
5008
5042
  ...(updates.metadata || {}),
@@ -5012,6 +5046,7 @@ class OrderModule extends _BaseModule.BaseModule {
5012
5046
  unique_identification_number: bookingUid
5013
5047
  }
5014
5048
  };
5049
+ (0, _bookingUuid.assignBookingUuid)(nextBooking);
5015
5050
  this.syncBookingMetadataHolder(nextBooking, nextBooking.metadata);
5016
5051
  nextBooking.is_all = (0, _utils.normalizeBookingIsAll)(nextBooking);
5017
5052
  nextBooking.sub_type = (0, _utils.normalizeBookingSubType)(nextBooking);
@@ -5712,6 +5747,7 @@ class OrderModule extends _BaseModule.BaseModule {
5712
5747
  * @returns 后端返回的订单数据(包含订单ID等)
5713
5748
  */
5714
5749
  async createOrderByCheckout(params) {
5750
+ params.bookings?.forEach(_bookingUuid.assignBookingUuid);
5715
5751
  // 过滤掉由在线店铺下单的 payment 支付数据
5716
5752
  const onlineStorePaymentCodeList = ['WXPAY', 'WECHAT', 'ALIPAY', 'APPLE_PAY', 'CREDIT_CARD_3DS', 'CREDIT_CARD_TOKEN', 'GOOGLE_PAY', 'GOOGLE_PAY_3DS', 'CREDIT_CARD'];
5717
5753
  params.payments = params.payments?.filter(p => !onlineStorePaymentCodeList.includes(p.code));
@@ -5799,6 +5835,7 @@ class OrderModule extends _BaseModule.BaseModule {
5799
5835
  url,
5800
5836
  query
5801
5837
  } = params;
5838
+ query.bookings?.forEach(_bookingUuid.assignBookingUuid);
5802
5839
  const fetchUrl = url || '/order/sales/checkout';
5803
5840
  const handledByOsServer = this.isSalesCheckoutHandledByOsServer(fetchUrl);
5804
5841
  const requestQuery = handledByOsServer ? query : (0, _localEftposState.stripLocalEftposState)((0, _osPrivatePayload.stripOsPrivatePayloadFields)(query));
@@ -6153,8 +6190,9 @@ class OrderModule extends _BaseModule.BaseModule {
6153
6190
  })) : [];
6154
6191
  nextTempOrder.bookings = Array.isArray(raw.bookings) ? raw.bookings.map(b => {
6155
6192
  const booking = this.normalizeHydratedBookingHolder(b || {});
6193
+ const submitted = (0, _pickupTiming.isFulfillmentTimingBooking)(booking) || Number(booking.parent_id) !== 0;
6156
6194
  return {
6157
- ...booking,
6195
+ ...(submitted ? (0, _bookingUuid.ensureBookingUuid)(booking) : booking),
6158
6196
  is_all: (0, _utils.normalizeBookingIsAll)(booking),
6159
6197
  sub_type: (0, _utils.normalizeBookingSubType)(booking)
6160
6198
  };
@@ -617,6 +617,8 @@ export interface CommitOrderParams {
617
617
  };
618
618
  }
619
619
  export interface OrderSubmitBooking {
620
+ /** Stable booking identity, created once and shared with external allocations. */
621
+ uuid?: string | null;
620
622
  relation_id?: string;
621
623
  form_id?: string;
622
624
  collect_pax?: number;
@@ -0,0 +1,4 @@
1
+ /** Cross-system booking identity; independent from the legacy cart-line UID. */
2
+ export declare function ensureBookingUuid<T extends Record<string, any>>(booking: T): T;
3
+ /** Retain a generated UUID on the draft so a checkout retry sends the same value. */
4
+ export declare function assignBookingUuid(booking: Record<string, any> | null | undefined): void;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.assignBookingUuid = assignBookingUuid;
7
+ exports.ensureBookingUuid = ensureBookingUuid;
8
+ var _orderCollectionIdentity = require("./orderCollectionIdentity");
9
+ /** Cross-system booking identity; independent from the legacy cart-line UID. */
10
+ function ensureBookingUuid(booking) {
11
+ if (booking.uuid) return booking;
12
+ // Only an explicit null confirms that an existing booking needs a UUID when saved.
13
+ if (booking.uuid !== null && Number(booking.schedule_event_id || booking.id) > 0) return booking;
14
+ return {
15
+ ...booking,
16
+ uuid: (0, _orderCollectionIdentity.createUuidV4)()
17
+ };
18
+ }
19
+
20
+ /** Retain a generated UUID on the draft so a checkout retry sends the same value. */
21
+ function assignBookingUuid(booking) {
22
+ if (!booking) return;
23
+ const resolved = ensureBookingUuid(booking);
24
+ if (resolved !== booking) booking.uuid = resolved.uuid;
25
+ }
@@ -140,6 +140,7 @@ var _manualProductDiscount = require("./utils/manualProductDiscount");
140
140
  var _utils = require("../Holder/utils");
141
141
  var _utils2 = require("../../solution/ScanOrder/utils");
142
142
  var _orderCollectionIdentity = require("./utils/orderCollectionIdentity");
143
+ var _bookingUuid = require("./utils/bookingUuid");
143
144
  var _salesNotes = require("./salesNotes");
144
145
  var _pickupTiming = require("./pickupTiming");
145
146
  var _holderRelations = require("./holderRelations");
@@ -1664,7 +1665,10 @@ function buildSubmitPayload(params) {
1664
1665
  delivery_type: tempOrder.delivery_type || 'shop_service',
1665
1666
  schedule_date: scheduleDate,
1666
1667
  // created_at: tempOrder.created_at || formatDateTime(now), 和后端协定这个字段先不提交到接口
1667
- bookings: (tempOrder.bookings || []).filter(booking => (0, _pickupTiming.isFulfillmentTimingBooking)(booking) || Number(booking.parent_id) !== 0).map(booking => normalizeSubmitBooking(booking)),
1668
+ bookings: (tempOrder.bookings || []).filter(booking => (0, _pickupTiming.isFulfillmentTimingBooking)(booking) || Number(booking.parent_id) !== 0).map(booking => {
1669
+ (0, _bookingUuid.assignBookingUuid)(booking);
1670
+ return normalizeSubmitBooking(booking);
1671
+ }),
1668
1672
  payments: tempOrder.payments || [],
1669
1673
  relation_forms: tempOrder.relation_forms || [],
1670
1674
  // contacts: tempOrder.contacts || [],
@@ -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(): "normal" | "duration" | "session";
52
+ getProductType(): "duration" | "normal" | "session";
53
53
  }
@@ -72,7 +72,7 @@ export declare const calculateOriginSubtotal: (items: CartItem[]) => string;
72
72
  * @return {*}
73
73
  * @Author: xiangfeng.xue
74
74
  */
75
- export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => "0.00" | Decimal;
75
+ export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => Decimal | "0.00";
76
76
  /**
77
77
  * @title: 计算定金
78
78
  * @param items - 购物车商品数组
@@ -223,6 +223,9 @@ function mergeBaseSalesCollectionItem(kind, currentItem, incomingItem, uidRemaps
223
223
  }
224
224
  }
225
225
  const mergedItem = mergedUid ? (0, _orderCollectionIdentity.setOrderCollectionUid)(kind, incomingItem, mergedUid) : (0, _lodashEs.cloneDeep)(incomingItem);
226
+ if (kind === 'booking' && !mergedItem.uuid && currentItem.uuid !== undefined) {
227
+ mergedItem.uuid = currentItem.uuid;
228
+ }
226
229
  const persistentIdField = BASE_SALES_PERSISTENT_ID_FIELD_BY_KIND[kind];
227
230
  if (isBaseSalesBlankValue(mergedItem[persistentIdField]) && !isBaseSalesBlankValue(identityMergedItem[persistentIdField])) {
228
231
  mergedItem[persistentIdField] = identityMergedItem[persistentIdField];
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
342
342
  date: string;
343
343
  status: string;
344
344
  week: string;
345
- weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
345
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
346
346
  }[]>;
347
347
  submitTimeSlot(timeSlots: TimeSliceItem): void;
348
348
  private getScheduleDataByIds;
@@ -389,7 +389,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
389
389
  };
390
390
  setOtherData(key: string, value: any): void;
391
391
  getOtherData(key: string): any;
392
- getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
392
+ getProductTypeById(id: number): Promise<"duration" | "normal" | "session">;
393
393
  /**
394
394
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
395
395
  *
@@ -25,27 +25,28 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
25
25
  notes?: import("../../../modules/Order/types").SalesNote[] | undefined;
26
26
  summary?: import("../../../modules/Order/types").OrderSummary | undefined;
27
27
  small_ticket_data_flag?: number | undefined;
28
+ status: string;
28
29
  metadata: Record<string, any>;
30
+ business_code?: string | undefined;
31
+ customer_id: number | null;
29
32
  type: string;
30
- note: string;
31
33
  holder: Record<string, any> | null;
34
+ email: string;
35
+ phone: string;
36
+ note: string;
32
37
  relation_forms: any[];
33
38
  holder_relations?: import("../../../modules/Order/types").OrderHolderRelation[] | undefined;
39
+ country_calling_code: string;
40
+ contacts_info: Record<string, any> | null;
34
41
  order_id: number | null;
35
42
  external_sale_number: string;
36
43
  order_number: string | null;
37
44
  shop_order_number: string | null;
38
45
  shop_full_order_number: string | null;
39
- business_code?: string | undefined;
40
46
  sales_channel: string;
41
47
  order_sales_channel: string;
42
- status: string;
43
48
  shipping_status: string;
44
- customer_id: number | null;
45
49
  customer_name: string;
46
- country_calling_code: string;
47
- phone: string;
48
- email: string;
49
50
  is_price_include_tax: number;
50
51
  tax_title: string;
51
52
  tax_country_code: string;
@@ -62,7 +63,6 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
62
63
  schedule_date: string;
63
64
  bookings: any[];
64
65
  payments: any[];
65
- contacts_info: Record<string, any> | null;
66
66
  order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
67
67
  refunds?: any[] | undefined;
68
68
  surcharges: any[];
@@ -10,6 +10,8 @@ exports.CheckoutImpl = void 0;
10
10
  var _BaseModule = require("../../modules/BaseModule");
11
11
  var _decimal = _interopRequireDefault(require("decimal.js"));
12
12
  var _Order = require("../../modules/Order");
13
+ var _bookingUuid = require("../../modules/Order/utils/bookingUuid");
14
+ var _orderCollectionIdentity = require("../../modules/Order/utils/orderCollectionIdentity");
13
15
  var _Payment = require("../../modules/Payment");
14
16
  var _types = require("./types");
15
17
  Object.keys(_types).forEach(function (key) {
@@ -458,6 +460,7 @@ class CheckoutImpl extends _BaseModule.BaseModule {
458
460
  params.orderData.tax_fee = params.totalInfo?.total?.tax;
459
461
 
460
462
  // 保存原始订单数据和小计数据到状态中
463
+ params.orderData.bookings?.forEach(_bookingUuid.assignBookingUuid);
461
464
  this.store.localOrderData = params.orderData;
462
465
  this.store.cartSummary = params.cartSummary;
463
466
 
@@ -590,6 +593,24 @@ class CheckoutImpl extends _BaseModule.BaseModule {
590
593
  // 保留原有支付项:通过 orderId 找到现有订单(按 id 或 order_id 匹配)
591
594
  const allOrders = await this.payment.getOrderListAsync();
592
595
  const existingOrder = allOrders.find(o => String(o.id) === String(params.orderId) || String(o.order_id) === String(params.orderId));
596
+
597
+ // POS 再次保存会重建预约行;按已有行标识复用上次保存的 UUID。
598
+ const previousBookings = existingOrder?.order_info?.original_order_data?.bookings;
599
+ const previousUuids = new Map();
600
+ if (Array.isArray(previousBookings)) {
601
+ for (const booking of previousBookings) {
602
+ const uid = (0, _orderCollectionIdentity.getOrderCollectionUid)('booking', booking);
603
+ if (uid && booking.uuid !== undefined) previousUuids.set(uid, booking.uuid);
604
+ }
605
+ }
606
+ for (const booking of params.orderData.bookings || []) {
607
+ const uid = (0, _orderCollectionIdentity.getOrderCollectionUid)('booking', booking);
608
+ if (uid && previousUuids.has(uid)) {
609
+ booking.uuid ?? (booking.uuid = previousUuids.get(uid));
610
+ previousUuids.delete(uid);
611
+ }
612
+ (0, _bookingUuid.assignBookingUuid)(booking);
613
+ }
593
614
  if (existingOrder) {
594
615
  // 🔧 新增: 如果传入了 existPayment,需要更新支付项列表
595
616
  if (params.existPayment && params.existPayment.length > 0) {
@@ -149,6 +149,7 @@ export interface LocalOrderData {
149
149
  * 本地预订项
150
150
  */
151
151
  export interface LocalBookingItem {
152
+ uuid?: string | null;
152
153
  /** ID */
153
154
  id: number;
154
155
  /** 数量 */
@@ -876,10 +876,16 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
876
876
  const bookingCapacityDimensionId = (0, _utils.pickFirstCustomCapacityDimensionId)(this.enabledReservationRuleProducts) ?? 0;
877
877
  let bookings = payload.bookings || [];
878
878
  if (!tempOrder.order_id && bookings.length === 0) {
879
+ const extend = tempOrder._extend ?? (tempOrder._extend = {});
880
+ if (!extend.scanOrderBookingUuid) {
881
+ extend.scanOrderBookingUuid = (0, _utils2.createUuidV4)();
882
+ this.store.order?.persistTempOrder?.();
883
+ }
879
884
  const bookingStart = (0, _dayjs.default)(now);
880
885
  const bookingDuration = (0, _utils2.resolveTableOccupancyDuration)(tempOrder);
881
886
  const bookingEnd = bookingStart.add(bookingDuration, 'minute');
882
887
  bookings = [(0, _utils2.normalizeSubmitBooking)({
888
+ uuid: extend.scanOrderBookingUuid,
883
889
  relation_id: 0,
884
890
  form_id: 0,
885
891
  start_time: bookingStart.format('HH:mm'),
@@ -38,6 +38,7 @@ var _smartPricing = require("./utils/smartPricing");
38
38
  var _slotMerge = require("./utils/slotMerge");
39
39
  var _utils3 = require("../../modules/Order/utils");
40
40
  var _Order = require("../../modules/Order");
41
+ var _bookingUuid = require("../../modules/Order/utils/bookingUuid");
41
42
  var _types4 = require("../RegisterAndLogin/types");
42
43
  var _decimal = _interopRequireDefault(require("decimal.js"));
43
44
  var _Holder = require("../../modules/Holder");
@@ -1197,6 +1198,7 @@ class VenueBookingImpl extends _BaseSales.BaseSalesImpl {
1197
1198
  if (!mapping) return;
1198
1199
  const tempOrder = this.store.order.ensureTempOrder();
1199
1200
  const matchesCurrent = (meta, pid) => !!meta?.venue_booking && String(meta?.resource_id) === String(resourceId) && Number(pid) === Number(productId);
1201
+ const previousBookings = (tempOrder.bookings || []).filter(row => row.uuid && matchesCurrent(row.metadata, row.metadata?.product_id ?? row.product?.product_id));
1200
1202
  tempOrder.products = tempOrder.products.filter(p => !matchesCurrent(p.metadata, p.product_id));
1201
1203
  tempOrder.bookings = (tempOrder.bookings || []).filter(b => {
1202
1204
  if (!b.metadata?.venue_booking) return true;
@@ -1332,7 +1334,10 @@ class VenueBookingImpl extends _BaseSales.BaseSalesImpl {
1332
1334
  productUid,
1333
1335
  childResources: childRawResources
1334
1336
  });
1335
- tempOrder.bookings.push(booking);
1337
+ // A resized or split interval can reuse its original UUID once.
1338
+ const original = previousBookings.findIndex(row => `${row.start_date} ${String(row.start_time).slice(0, 5)}` < group.endTime && `${row.end_date} ${String(row.end_time).slice(0, 5)}` > group.startTime);
1339
+ if (original >= 0) booking.uuid = previousBookings.splice(original, 1)[0].uuid;
1340
+ tempOrder.bookings.push((0, _bookingUuid.ensureBookingUuid)(booking));
1336
1341
  }
1337
1342
 
1338
1343
  // 获取表单信息
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.225",
4
+ "version": "2.3.226",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",