@pisell/pisellos 2.2.192 → 2.2.193

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 (36) hide show
  1. package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
  2. package/dist/modules/Order/index.d.ts +12 -10
  3. package/dist/modules/Order/index.js +462 -571
  4. package/dist/modules/Order/types.d.ts +5 -5
  5. package/dist/modules/Order/utils.js +3 -3
  6. package/dist/modules/Payment/utils.js +2 -1
  7. package/dist/modules/SalesSummary/utils.js +1 -1
  8. package/dist/server/index.d.ts +8 -1
  9. package/dist/server/index.js +651 -464
  10. package/dist/server/modules/order/index.d.ts +3 -2
  11. package/dist/server/modules/order/index.js +68 -52
  12. package/dist/solution/BaseSales/index.d.ts +2 -1
  13. package/dist/solution/BaseSales/index.js +116 -122
  14. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +0 -1
  15. package/dist/solution/BookingByStep/index.d.ts +1 -1
  16. package/dist/solution/BookingTicket/index.d.ts +1 -1
  17. package/dist/solution/ScanOrder/index.js +3 -1
  18. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  19. package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
  20. package/lib/modules/Order/index.d.ts +12 -10
  21. package/lib/modules/Order/index.js +94 -118
  22. package/lib/modules/Order/types.d.ts +5 -5
  23. package/lib/modules/Order/utils.js +4 -4
  24. package/lib/modules/Payment/utils.js +2 -1
  25. package/lib/modules/SalesSummary/utils.js +1 -3
  26. package/lib/server/index.d.ts +8 -1
  27. package/lib/server/index.js +143 -24
  28. package/lib/server/modules/order/index.d.ts +3 -2
  29. package/lib/server/modules/order/index.js +25 -15
  30. package/lib/solution/BaseSales/index.d.ts +2 -1
  31. package/lib/solution/BaseSales/index.js +53 -16
  32. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +0 -1
  33. package/lib/solution/BookingByStep/index.d.ts +1 -1
  34. package/lib/solution/BookingTicket/index.d.ts +1 -1
  35. package/lib/solution/ScanOrder/index.js +3 -1
  36. package/package.json +1 -1
@@ -477,6 +477,10 @@ export interface LoadSalesDetailParams {
477
477
  external_sale_number?: string;
478
478
  forceRemote?: boolean;
479
479
  }
480
+ export interface SalesOrderLookupParams {
481
+ lookup: number | string;
482
+ forceRemote?: boolean;
483
+ }
480
484
  export interface SyncPaymentsToOrderParams {
481
485
  payments: OrderPaymentSource[];
482
486
  paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
@@ -635,15 +639,11 @@ export interface OrderModuleAPI {
635
639
  updateVoucherOrderPayments: (payments: OrderPaymentSource[]) => OrderPaymentData[];
636
640
  sendCustomerPayLink: <T = any>(params: SendCustomerPayLinkParams) => Promise<T>;
637
641
  saveDraft: () => Promise<void>;
638
- hasLocalDatabase: () => boolean;
639
- getLocalOrderByOrderId: (orderId: number | string) => Promise<Record<string, any> | null>;
640
- getLocalOrderByExternalSaleNumber: (externalSaleNumber: string) => Promise<Record<string, any> | null>;
641
- getLocalOrderByOrderNumber: (orderNumber: string) => Promise<Record<string, any> | null>;
642
642
  hydrateTempOrderFromRecord: (record: Record<string, any>, options?: {
643
643
  recalcOnHydrate?: boolean;
644
644
  }) => Promise<OrderTempOrder>;
645
645
  syncPaymentsToOrder: <T = any>(params: SyncPaymentsToOrderParams) => Promise<SyncPaymentsToOrderResult<T>>;
646
- getOrderInfoByRemote: (order_id: number) => Promise<any>;
646
+ getSalesOrderByLookup: (params: SalesOrderLookupParams) => Promise<any>;
647
647
  getLastOrderInfo: () => Record<string, any> | undefined;
648
648
  getOrderInfo: (order_id: number) => Promise<any>;
649
649
  /**
@@ -240,18 +240,18 @@ export function resolveEffectivePerUnitDiscount(product) {
240
240
  });
241
241
  if (hasPromoDiscountItem) return fromList;
242
242
  var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
243
+ var promo = metadata._promotion;
244
+ if ((promo === null || promo === void 0 ? void 0 : promo.inPromotion) !== true) return fromList;
243
245
  var optionSum = sumOptionUnitPrice(getProductSkuOptions(product)).toNumber();
244
246
 
245
247
  // applyPromotion 写价后、Rules 剥离 promotion discount 的兜底
246
- if (metadata.source_product_price != null && metadata.main_product_selling_price != null) {
248
+ if (!discountList.length && metadata.source_product_price != null && metadata.main_product_selling_price != null) {
247
249
  var source = Number(metadata.source_product_price);
248
250
  var selling = Number(metadata.main_product_selling_price) - optionSum;
249
251
  if (Number.isFinite(source) && Number.isFinite(selling) && source !== selling) {
250
252
  return fromList + (source - selling);
251
253
  }
252
254
  }
253
- var promo = metadata._promotion;
254
- if ((promo === null || promo === void 0 ? void 0 : promo.inPromotion) !== true) return fromList;
255
255
  var originalPrice = Number(promo.originalPrice);
256
256
  var finalPrice = Number(promo.finalPrice);
257
257
  if (!Number.isFinite(originalPrice) || !Number.isFinite(finalPrice)) return fromList;
@@ -11,7 +11,7 @@ export var getAvailableMaxAmount = function getAvailableMaxAmount(data) {
11
11
  * @param list
12
12
  */
13
13
  export var formatWalletPassList2PreparePayments = function formatWalletPassList2PreparePayments(list) {
14
- return (list || []).map(function (item) {
14
+ var formatted = (list || []).map(function (item) {
15
15
  return {
16
16
  voucher_id: item.id || 0,
17
17
  amount: Number(item.edit_current_amount || getAvailableMaxAmount(item)) || 0,
@@ -20,6 +20,7 @@ export var formatWalletPassList2PreparePayments = function formatWalletPassList2
20
20
  wallet_pass_use_value: item.wallet_pass_use_value || undefined
21
21
  };
22
22
  });
23
+ return formatted;
23
24
  };
24
25
 
25
26
  /**
@@ -490,7 +490,7 @@ export function calculateSalesSummary(params) {
490
490
  tax_fee: toFixed2(productTaxFee),
491
491
  surcharge_fee: toFixed2(surchargeAmount),
492
492
  surcharges: surcharge,
493
- discount_amount: toFixed2(Decimal.max(productOriginalAmount.minus(productAmount), 0).plus(shopDiscountAmount)),
493
+ discount_amount: toFixed2(shopDiscountAmount),
494
494
  deposit_amount: deposit ? deposit.total : '0.00',
495
495
  deposit: deposit,
496
496
  expect_amount: toFixed2(totalAmount),
@@ -284,6 +284,9 @@ declare class Server {
284
284
  * @example 批量:GET /update/localOrder?order_ids=96971,96972,96973
285
285
  */
286
286
  private handleUpdateLocalOrder;
287
+ private handleOrderSalesCheckout;
288
+ private handleOrderCheckout;
289
+ private handleOrderCheckoutSubmit;
287
290
  private handleOrderSalesDetail;
288
291
  /**
289
292
  * 解析 order_ids 入参,兼容 url query / data 字段、字符串(csv) / 数组两种形态。
@@ -311,8 +314,12 @@ declare class Server {
311
314
  * 从 url 中解析指定 query 参数,兼容相对路径与绝对路径
312
315
  */
313
316
  private extractQueryParam;
314
- private extractOrderSalesDetailId;
317
+ private extractOrderSalesDetailLookup;
318
+ private shouldForceRemoteSalesDetail;
315
319
  private buildOrderSalesDetailBackendPath;
320
+ private extractOrderDataFromCheckoutResponse;
321
+ private normalizeCheckoutResponse;
322
+ private extractBackendErrorResponse;
316
323
  /**
317
324
  * 从 url 或路由 path 解析 pathname(不含 query,去掉末尾 /)
318
325
  */