@pisell/pisellos 2.2.192 → 2.2.194

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 (41) hide show
  1. package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
  2. package/dist/modules/Order/index.d.ts +12 -9
  3. package/dist/modules/Order/index.js +503 -580
  4. package/dist/modules/Order/types.d.ts +5 -5
  5. package/dist/modules/Order/utils/manualProductDiscount.js +1 -1
  6. package/dist/modules/Order/utils.js +3 -3
  7. package/dist/modules/Payment/utils.js +2 -1
  8. package/dist/modules/SalesSummary/index.d.ts +0 -25
  9. package/dist/modules/SalesSummary/types.d.ts +1 -0
  10. package/dist/modules/SalesSummary/utils.d.ts +2 -25
  11. package/dist/modules/SalesSummary/utils.js +529 -160
  12. package/dist/server/index.d.ts +8 -1
  13. package/dist/server/index.js +653 -466
  14. package/dist/server/modules/order/index.d.ts +3 -2
  15. package/dist/server/modules/order/index.js +68 -52
  16. package/dist/server/modules/products/index.js +4 -4
  17. package/dist/solution/BaseSales/index.d.ts +2 -1
  18. package/dist/solution/BaseSales/index.js +116 -122
  19. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +0 -1
  20. package/dist/solution/ScanOrder/index.js +3 -1
  21. package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
  22. package/lib/modules/Order/index.d.ts +12 -9
  23. package/lib/modules/Order/index.js +124 -120
  24. package/lib/modules/Order/types.d.ts +5 -5
  25. package/lib/modules/Order/utils/manualProductDiscount.js +1 -1
  26. package/lib/modules/Order/utils.js +4 -4
  27. package/lib/modules/Payment/utils.js +2 -1
  28. package/lib/modules/SalesSummary/index.d.ts +0 -25
  29. package/lib/modules/SalesSummary/types.d.ts +1 -0
  30. package/lib/modules/SalesSummary/utils.d.ts +2 -25
  31. package/lib/modules/SalesSummary/utils.js +420 -92
  32. package/lib/server/index.d.ts +8 -1
  33. package/lib/server/index.js +145 -26
  34. package/lib/server/modules/order/index.d.ts +3 -2
  35. package/lib/server/modules/order/index.js +25 -15
  36. package/lib/server/modules/products/index.js +0 -4
  37. package/lib/solution/BaseSales/index.d.ts +2 -1
  38. package/lib/solution/BaseSales/index.js +53 -16
  39. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +0 -1
  40. package/lib/solution/ScanOrder/index.js +3 -1
  41. 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
  /**
@@ -179,7 +179,7 @@ export function buildManualProductDiscountItem(params) {
179
179
  var diff = origin.minus(selling);
180
180
  var quantity = resolveSafeProductNum(params.quantity);
181
181
  return {
182
- amount: diff.abs().toDecimalPlaces(2).toNumber(),
182
+ amount: diff.toDecimalPlaces(2).toNumber(),
183
183
  type: 'product',
184
184
  discount: {
185
185
  message: (_params$message = params.message) !== null && _params$message !== void 0 ? _params$message : '',
@@ -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
  /**
@@ -43,30 +43,5 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
43
43
  rounding_amount: string;
44
44
  pay_service_charge_amount: string;
45
45
  is_price_include_tax?: number | undefined;
46
- } | {
47
- tax_title: string;
48
- tax_rate: number | undefined;
49
- product_quantity: number;
50
- product_original_amount: string;
51
- product_amount: string;
52
- product_expect_amount: string;
53
- product_tax_fee: string;
54
- shipping_fee: string;
55
- shipping_tax_fee: string;
56
- tax_fee: string;
57
- surcharge_fee: string;
58
- surcharges: any;
59
- discount_amount: string;
60
- deposit_amount: string;
61
- deposit: import("./types").DepositInfo | undefined;
62
- expect_amount: string;
63
- total_amount: string;
64
- total_refund_amount: string;
65
- customer_paid_amount: string;
66
- order_paid_amount: string;
67
- amount_gap: string;
68
- rounding_amount: string;
69
- pay_service_charge_amount: string;
70
- is_price_include_tax: number;
71
46
  }>;
72
47
  }
@@ -1,4 +1,5 @@
1
1
  export interface SalesSummaryProduct {
2
+ order_detail_id?: number | string | null;
2
3
  product_id: number | null;
3
4
  product_variant_id: number;
4
5
  num: number;
@@ -1,4 +1,4 @@
1
- import type { DepositInfo, SalesSummaryData, SalesSummaryProduct } from './types';
1
+ import type { SalesSummaryData, SalesSummaryProduct } from './types';
2
2
  export declare function createEmptySalesSummary(): SalesSummaryData;
3
3
  export declare function calculateSalesSummary(params: {
4
4
  products: SalesSummaryProduct[];
@@ -8,27 +8,4 @@ export declare function calculateSalesSummary(params: {
8
8
  scheduleById?: Record<string, any>;
9
9
  isInScheduleByDate?: any;
10
10
  shopDiscount?: string | number;
11
- }): SalesSummaryData | {
12
- product_quantity: number;
13
- product_original_amount: string;
14
- product_amount: string;
15
- product_expect_amount: string;
16
- product_tax_fee: string;
17
- shipping_fee: string;
18
- shipping_tax_fee: string;
19
- tax_fee: string;
20
- surcharge_fee: string;
21
- surcharges: any;
22
- discount_amount: string;
23
- deposit_amount: string;
24
- deposit: DepositInfo | undefined;
25
- expect_amount: string;
26
- total_amount: string;
27
- total_refund_amount: string;
28
- customer_paid_amount: string;
29
- order_paid_amount: string;
30
- amount_gap: string;
31
- rounding_amount: string;
32
- pay_service_charge_amount: string;
33
- is_price_include_tax: number;
34
- };
11
+ }): SalesSummaryData;