@pisell/pisellos 2.2.265 → 2.2.267

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 (66) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
  3. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
  4. package/dist/modules/Order/index.d.ts +8 -27
  5. package/dist/modules/Order/index.js +490 -743
  6. package/dist/modules/Order/types.d.ts +1 -33
  7. package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
  8. package/dist/modules/Order/utils.js +5 -8
  9. package/dist/modules/Payment/index.d.ts +0 -2
  10. package/dist/modules/Payment/index.js +50 -79
  11. package/dist/modules/Payment/types.d.ts +27 -29
  12. package/dist/modules/Payment/types.js +3 -5
  13. package/dist/server/index.d.ts +0 -16
  14. package/dist/server/index.js +1036 -1933
  15. package/dist/server/modules/order/index.d.ts +4 -49
  16. package/dist/server/modules/order/index.js +695 -1574
  17. package/dist/server/modules/order/types.d.ts +3 -11
  18. package/dist/server/modules/order/types.js +1 -1
  19. package/dist/solution/BaseSales/index.d.ts +11 -42
  20. package/dist/solution/BaseSales/index.js +385 -676
  21. package/dist/solution/BaseSales/utils/cartPromotion.js +5 -3
  22. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  23. package/dist/solution/BookingTicket/index.d.ts +1 -1
  24. package/dist/solution/BookingTicket/index.js +1 -2
  25. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
  26. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  27. package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
  28. package/dist/solution/Sales/index.d.ts +0 -1
  29. package/dist/solution/Sales/index.js +2 -10
  30. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  31. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  32. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  33. package/lib/modules/Order/index.d.ts +8 -27
  34. package/lib/modules/Order/index.js +69 -184
  35. package/lib/modules/Order/types.d.ts +1 -33
  36. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
  37. package/lib/modules/Order/utils.js +3 -5
  38. package/lib/modules/Payment/index.d.ts +0 -2
  39. package/lib/modules/Payment/index.js +13 -34
  40. package/lib/modules/Payment/types.d.ts +27 -29
  41. package/lib/modules/Payment/types.js +3 -3
  42. package/lib/server/index.d.ts +0 -16
  43. package/lib/server/index.js +18 -670
  44. package/lib/server/modules/order/index.d.ts +4 -49
  45. package/lib/server/modules/order/index.js +66 -657
  46. package/lib/server/modules/order/types.d.ts +3 -11
  47. package/lib/solution/BaseSales/index.d.ts +11 -42
  48. package/lib/solution/BaseSales/index.js +35 -214
  49. package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
  50. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  51. package/lib/solution/BookingTicket/index.d.ts +1 -1
  52. package/lib/solution/BookingTicket/index.js +1 -2
  53. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
  54. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  55. package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
  56. package/lib/solution/Sales/index.d.ts +0 -1
  57. package/lib/solution/Sales/index.js +3 -5
  58. package/package.json +2 -2
  59. package/dist/modules/Order/payment-utils.d.ts +0 -26
  60. package/dist/modules/Order/payment-utils.js +0 -225
  61. package/dist/utils/payment-number.d.ts +0 -9
  62. package/dist/utils/payment-number.js +0 -69
  63. package/lib/modules/Order/payment-utils.d.ts +0 -26
  64. package/lib/modules/Order/payment-utils.js +0 -224
  65. package/lib/utils/payment-number.d.ts +0 -9
  66. package/lib/utils/payment-number.js +0 -64
@@ -1,9 +0,0 @@
1
- // 导出评估器
2
- export { PromotionEvaluator } from "./evaluator";
3
-
4
- // 导出适配器
5
- export { PromotionAdapter } from "./adapter";
6
- export { default } from "./adapter";
7
-
8
- // 导出策略配置示例常量
9
- export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
@@ -190,7 +190,7 @@ function synthesizeProductResourceFromBooking(booking) {
190
190
  * 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
191
191
  */
192
192
  export function buildCacheItemFromOrderLine(input) {
193
- var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num, _ref10, _product$note, _booking$detail2, _product$metadata, _product$metadata2, _ref11, _extension_type, _booking$product2, _booking$product3, _price, _product$order_detail, _ref12, _booking$id;
193
+ var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num, _ref10, _product$note, _booking$detail2, _product$metadata, _product$metadata2, _ref11, _extension_type, _booking$product2, _booking$product3, _price, _product$product_sku, _product$order_detail, _ref12, _booking$id;
194
194
  var product = input.product,
195
195
  booking = input.booking,
196
196
  sourceProduct = input.sourceProduct;
@@ -257,7 +257,7 @@ export function buildCacheItemFromOrderLine(input) {
257
257
  if (Array.isArray(booking.relation_forms)) {
258
258
  extend.relation_forms = booking.relation_forms;
259
259
  }
260
- var base = _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
260
+ var base = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
261
261
  id: resolvedId,
262
262
  product_id: resolvedId,
263
263
  extension_type: (_ref11 = (_extension_type = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type) !== null && _extension_type !== void 0 ? _extension_type : booking === null || booking === void 0 || (_booking$product2 = booking.product) === null || _booking$product2 === void 0 ? void 0 : _booking$product2.extension_type) !== null && _ref11 !== void 0 ? _ref11 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type,
@@ -265,7 +265,9 @@ export function buildCacheItemFromOrderLine(input) {
265
265
  price: (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : selling,
266
266
  selling_price: product.selling_price,
267
267
  original_price: product.original_price
268
- }, productOptionString ? {
268
+ }, Number(((_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.open_sold_weight) || 0) === 1 ? {
269
+ product_sku: JSON.parse(JSON.stringify(product.product_sku))
270
+ } : {}), productOptionString ? {
269
271
  product_option_string: productOptionString
270
272
  } : {}), {}, {
271
273
  _extend: extend,
@@ -75,7 +75,7 @@ function mapOrderBundleToOtherBundle(bundle) {
75
75
  });
76
76
  }
77
77
  export function buildNormalProductCacheItemFromOrderLine(input) {
78
- var _product$product_id, _product$selling_pric2, _product$original_pri, _product$metadata, _product$metadata2, _product$product_vari, _originExtend$other, _product$num, _product$product_vari2, _product$num2, _title, _product$note, _originExtend$price, _originExtend$total, _originExtend$origin_, _product$metadata3, _ref6, _title2, _ref7, _cover, _price3, _product$order_detail;
78
+ var _product$product_id, _product$selling_pric2, _product$original_pri, _product$metadata, _product$metadata2, _product$product_vari, _originExtend$other, _product$num, _product$product_vari2, _product$num2, _title, _product$note, _originExtend$price, _originExtend$total, _originExtend$origin_, _product$metadata3, _ref6, _title2, _ref7, _cover, _price3, _product$order_detail, _product$product_sku;
79
79
  var product = input.product,
80
80
  sourceProduct = input.sourceProduct;
81
81
  var resolvedId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id;
@@ -127,7 +127,7 @@ export function buildNormalProductCacheItemFromOrderLine(input) {
127
127
  extend.skuValue = JSON.parse(JSON.stringify(originExtend.skuValue || originExtend._skuValue));
128
128
  extend._skuValue = JSON.parse(JSON.stringify(extend.skuValue));
129
129
  }
130
- return _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
130
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
131
131
  id: resolvedId,
132
132
  product_id: resolvedId,
133
133
  _id: uid,
@@ -141,7 +141,10 @@ export function buildNormalProductCacheItemFromOrderLine(input) {
141
141
  } : {}), {}, {
142
142
  note: product.note,
143
143
  order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
144
- discount_list: discountList,
144
+ discount_list: discountList
145
+ }, Number(((_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.open_sold_weight) || 0) === 1 ? {
146
+ product_sku: JSON.parse(JSON.stringify(product.product_sku))
147
+ } : {}), {}, {
145
148
  new: 0,
146
149
  autoClose: true,
147
150
  _extend: extend
@@ -3,7 +3,7 @@ import { BaseModule } from '../BaseModule';
3
3
  import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CheckoutOrderParams, CancelOrderParams, ChangeBookingStatusParams } from './types';
4
4
  import { CartItem } from '../Cart/types';
5
5
  import { type SubmitPayloadEnhancer } from './utils';
6
- import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from './types';
6
+ import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from './types';
7
7
  import type { ICustomer } from '../AccountList/types';
8
8
  import type { Discount } from '../Discount/types';
9
9
  import { UnavailableReason } from '../Rules/types';
@@ -14,7 +14,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
14
14
  private request;
15
15
  private logger;
16
16
  private window;
17
- private appPlugin;
18
17
  private cacheId;
19
18
  private salesSummaryModuleName;
20
19
  private rulesHooksOverride?;
@@ -177,9 +176,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
177
176
  };
178
177
  private calculateDepositPaidAmount;
179
178
  private resolveNextOrderPaymentType;
180
- private getPaymentNumberAppData;
181
- private getPaymentNumberDevicePrefixSync;
182
- private getPaymentNumberDevicePrefixAsync;
183
179
  private normalizePaymentSource;
184
180
  private updateTempOrderPaymentStatus;
185
181
  private shouldKeepPaymentStatusAfterAmountRecalc;
@@ -311,20 +307,19 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
311
307
  * 用一组支付来源覆盖当前订单支付项。
312
308
  *
313
309
  * 入参允许来自 PaymentModule 的 PaymentItem,内部统一映射为 Sales 协议:
314
- * 新支付来源的 uuid 会作为 payment_number 的唯一号段,id -> custom_payment_id,
310
+ * uuid -> metadata.unique_payment_number,id -> custom_payment_id,
315
311
  * isSynced 等运行态字段不会进入 tempOrder.payments。
316
312
  */
317
313
  setOrderPayments(payments: OrderPaymentSource[]): OrderPaymentData[];
318
- /** 同步兼容入口:按调用当下的 device_id 或 LOCAL 生成支付编号。 */
314
+ /** 追加单个支付项,并立即持久化当前 tempOrder。 */
319
315
  addOrderPayment(payment: OrderPaymentSource): OrderPaymentData[];
320
- /** 异步入口:创建支付项时读取最新 IoT 设备短号。 */
321
- addOrderPaymentAsync(payment: OrderPaymentSource): Promise<OrderPaymentData[]>;
322
- private addOrderPaymentWithDevicePrefix;
323
316
  /**
324
- * 默认按支付唯一号精确更新;仅显式指定 legacy 时兼容历史支付标识。
325
- * metadata 与 transactions 会分别合并,避免覆盖支付会话号和已有交易记录。
317
+ * 按支付唯一号、后端支付 ID、自定义支付方式 ID 或旧 uuid 更新支付项。
318
+ *
319
+ * 该方法服务 PaymentModal 的 void / 编辑场景;更新 metadata 时会做浅合并,
320
+ * 避免覆盖 unique_payment_number、现金实付/找零等已有元数据。
326
321
  */
327
- updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>, options?: OrderPaymentUpdateOptions): Promise<OrderPaymentUpdateResult>;
322
+ updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>): OrderPaymentData[];
328
323
  /** 从当前订单支付项中移除指定支付项。 */
329
324
  deleteOrderPayment(paymentIdentity: string | number): OrderPaymentData[];
330
325
  private confirmPendingVoucherPaymentsInList;
@@ -347,11 +342,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
347
342
  */
348
343
  updateVoucherOrderPayments(payments: OrderPaymentSource[], options?: {
349
344
  status?: 'paid' | 'payment_pending';
350
- devicePrefix?: string;
351
345
  }): OrderPaymentData[];
352
- updateVoucherOrderPaymentsAsync(payments: OrderPaymentSource[], options?: {
353
- status?: 'paid' | 'payment_pending';
354
- }): Promise<OrderPaymentData[]>;
355
346
  private shouldMergeProductToOrder;
356
347
  private hasOrderProductLineNote;
357
348
  /**
@@ -436,14 +427,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
436
427
  type?: string;
437
428
  }): import("./types").OrderSubmitPayload;
438
429
  applyLocalPrintOrderNumbers(order?: Record<string, any> | null): Promise<OrderTempOrder>;
439
- saveTempOrderAsDraft<T = any>(params?: {
440
- cacheId?: string;
441
- platform?: string;
442
- businessCode?: string;
443
- channel?: string;
444
- type?: string;
445
- enhancePayload?: SubmitPayloadEnhancer;
446
- }): Promise<T>;
447
430
  /**
448
431
  * 提交当前 Sales tempOrder。
449
432
  *
@@ -548,8 +531,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
548
531
  */
549
532
  private seedAnonymousBookingUidsFromProducts;
550
533
  private normalizeTempOrderForRuntime;
551
- private isSyntheticDraftOrderIdForRuntime;
552
- private withoutSyntheticDraftOrderIdForRuntime;
553
534
  private hydrateLinkedBookingIdentity;
554
535
  private pickHydratedDisplayText;
555
536
  private formatHydratedNamePair;