@pisell/pisellos 2.3.38 → 2.3.40
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.
- package/dist/core/index.d.ts +0 -2
- package/dist/core/index.js +0 -7
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -5
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +3 -6
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.d.ts +0 -2
- package/dist/modules/OpenData/index.js +2 -10
- package/dist/modules/Order/index.d.ts +11 -28
- package/dist/modules/Order/index.js +509 -750
- package/dist/modules/Order/types.d.ts +10 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +41 -13
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +28 -99
- package/dist/modules/Payment/types.js +3 -20
- package/dist/modules/Payment/walletpass.d.ts +1 -25
- package/dist/modules/Payment/walletpass.js +157 -707
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -14
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +0 -1
- package/dist/modules/Rules/index.js +96 -89
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +14 -16
- package/dist/server/index.js +1148 -1930
- package/dist/server/modules/order/index.d.ts +4 -54
- package/dist/server/modules/order/index.js +695 -1595
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +20 -109
- package/dist/solution/BaseSales/index.js +481 -1797
- package/dist/solution/BaseSales/types.d.ts +0 -52
- package/dist/solution/BaseSales/types.js +1 -2
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.d.ts +4 -8
- package/dist/solution/BookingTicket/index.js +51 -134
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -6
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +82 -172
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1148 -756
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +66 -25
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1176 -860
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -2
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -2
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.d.ts +0 -2
- package/lib/modules/OpenData/index.js +1 -6
- package/lib/modules/Order/index.d.ts +11 -28
- package/lib/modules/Order/index.js +86 -196
- package/lib/modules/Order/types.d.ts +10 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +40 -16
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +28 -99
- package/lib/modules/Payment/types.js +3 -4
- package/lib/modules/Payment/walletpass.d.ts +1 -25
- package/lib/modules/Payment/walletpass.js +21 -470
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +40 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +0 -1
- package/lib/modules/Rules/index.js +40 -47
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +14 -16
- package/lib/server/index.js +83 -675
- package/lib/server/modules/order/index.d.ts +4 -54
- package/lib/server/modules/order/index.js +66 -679
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +20 -109
- package/lib/solution/BaseSales/index.js +70 -881
- package/lib/solution/BaseSales/types.d.ts +0 -52
- package/lib/solution/BaseSales/types.js +1 -2
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.d.ts +4 -8
- package/lib/solution/BookingTicket/index.js +19 -64
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -4
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +4 -36
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -190
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +31 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +328 -123
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +0 -45
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +0 -63
- package/lib/utils/payment-number.d.ts +0 -9
- 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
|
-
|
|
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
|
|
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(((
|
|
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
|
/**
|
|
@@ -533,8 +534,7 @@ export function resolveEffectivePerUnitDiscount(product) {
|
|
|
533
534
|
return sum + Number((discount === null || discount === void 0 ? void 0 : discount.amount) || 0);
|
|
534
535
|
}, 0);
|
|
535
536
|
var hasPromoDiscountItem = discountList.some(function (item) {
|
|
536
|
-
|
|
537
|
-
return (item === null || item === void 0 ? void 0 : item.type) === 'promotion' || (item === null || item === void 0 ? void 0 : item.type) === 'product' && (item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.source) === 'promotion' && (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.actionType) === 'ITEM_REWARD';
|
|
537
|
+
return (item === null || item === void 0 ? void 0 : item.type) === 'promotion';
|
|
538
538
|
});
|
|
539
539
|
if (hasPromoDiscountItem) return fromList;
|
|
540
540
|
var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
|
|
@@ -744,10 +744,41 @@ export var mergeRelationForms = function mergeRelationForms(relationForms) {
|
|
|
744
744
|
return item.form_record_ids.length > 0;
|
|
745
745
|
}); // 过滤掉没有有效记录的表单
|
|
746
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
|
+
;
|
|
747
778
|
export var getAllDiscountList = function getAllDiscountList(cartItem) {
|
|
748
|
-
var _cartItem$
|
|
749
|
-
var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$
|
|
750
|
-
((cartItem === null || cartItem === void 0 || (_cartItem$
|
|
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) {
|
|
751
782
|
discountList = [].concat(_toConsumableArray(discountList), _toConsumableArray((item === null || item === void 0 ? void 0 : item.discount_list) || []));
|
|
752
783
|
item.discount_list = undefined;
|
|
753
784
|
});
|
|
@@ -1048,7 +1079,7 @@ export function createDefaultTempOrder(params) {
|
|
|
1048
1079
|
};
|
|
1049
1080
|
}
|
|
1050
1081
|
export function buildSubmitPayload(params) {
|
|
1051
|
-
var _tempOrder$customer_i, _tempOrder$
|
|
1082
|
+
var _tempOrder$customer_i, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref30, _tempOrder$is_price_i, _tempOrder$is_deposit, _enhancedPayload$summ;
|
|
1052
1083
|
var tempOrder = params.tempOrder,
|
|
1053
1084
|
cacheId = params.cacheId,
|
|
1054
1085
|
_params$now = params.now,
|
|
@@ -1094,9 +1125,6 @@ export function buildSubmitPayload(params) {
|
|
|
1094
1125
|
var payload = _objectSpread(_objectSpread({}, tempOrderRest), {}, {
|
|
1095
1126
|
customer_id: (_tempOrder$customer_i = tempOrder.customer_id) !== null && _tempOrder$customer_i !== void 0 ? _tempOrder$customer_i : 1,
|
|
1096
1127
|
customer_name: tempOrder.customer_name || 'Walk-In',
|
|
1097
|
-
country_calling_code: String((_tempOrder$country_ca = tempOrder.country_calling_code) !== null && _tempOrder$country_ca !== void 0 ? _tempOrder$country_ca : ''),
|
|
1098
|
-
phone: String((_tempOrder$phone = tempOrder.phone) !== null && _tempOrder$phone !== void 0 ? _tempOrder$phone : ''),
|
|
1099
|
-
email: String((_tempOrder$email = tempOrder.email) !== null && _tempOrder$email !== void 0 ? _tempOrder$email : ''),
|
|
1100
1128
|
order_number: (_tempOrder$order_numb = tempOrder.order_number) !== null && _tempOrder$order_numb !== void 0 ? _tempOrder$order_numb : null,
|
|
1101
1129
|
shop_order_number: (_tempOrder$shop_order = tempOrder.shop_order_number) !== null && _tempOrder$shop_order !== void 0 ? _tempOrder$shop_order : null,
|
|
1102
1130
|
shop_full_order_number: (_tempOrder$shop_full_ = tempOrder.shop_full_order_number) !== null && _tempOrder$shop_full_ !== void 0 ? _tempOrder$shop_full_ : null,
|
|
@@ -1156,7 +1184,9 @@ export function mapPaymentItemToOrderPayment(paymentItem) {
|
|
|
1156
1184
|
var item = paymentItem;
|
|
1157
1185
|
var customPaymentId = (_item$custom_payment_ = item.custom_payment_id) !== null && _item$custom_payment_ !== void 0 ? _item$custom_payment_ : item.id;
|
|
1158
1186
|
var metadata = item.metadata && _typeof(item.metadata) === 'object' ? _objectSpread({}, item.metadata) : {};
|
|
1159
|
-
|
|
1187
|
+
if (item.uuid && !metadata.unique_payment_number) {
|
|
1188
|
+
metadata.unique_payment_number = String(item.uuid);
|
|
1189
|
+
}
|
|
1160
1190
|
var paymentMetadataKeys = ['rounding_rule', 'shop_wallet_pass_id', 'actual_paid_amount', 'change_given_amount'];
|
|
1161
1191
|
for (var _i3 = 0, _paymentMetadataKeys = paymentMetadataKeys; _i3 < _paymentMetadataKeys.length; _i3++) {
|
|
1162
1192
|
var key = _paymentMetadataKeys[_i3];
|
|
@@ -1167,10 +1197,8 @@ export function mapPaymentItemToOrderPayment(paymentItem) {
|
|
|
1167
1197
|
var timestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
1168
1198
|
var paymentTime = (_item$payment_time = item.payment_time) !== null && _item$payment_time !== void 0 ? _item$payment_time : timestamp;
|
|
1169
1199
|
var createdAt = (_item$created_at = item.created_at) !== null && _item$created_at !== void 0 ? _item$created_at : timestamp;
|
|
1170
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(
|
|
1200
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, item.order_payment_id !== undefined ? {
|
|
1171
1201
|
order_payment_id: item.order_payment_id
|
|
1172
|
-
} : {}), paymentNumber !== undefined && paymentNumber !== null && paymentNumber !== '' ? {
|
|
1173
|
-
payment_number: String(paymentNumber)
|
|
1174
1202
|
} : {}), {}, {
|
|
1175
1203
|
amount: String((_item$amount = item.amount) !== null && _item$amount !== void 0 ? _item$amount : '0.00'),
|
|
1176
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
|
-
|
|
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 (
|
|
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 =
|
|
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
|
|
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
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
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
|
-
|
|
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 =
|
|
980
|
+
_context12.next = 25;
|
|
1006
981
|
return this.dbManager.update('order', order, true);
|
|
1007
|
-
case
|
|
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 =
|
|
1003
|
+
_context12.next = 35;
|
|
1029
1004
|
break;
|
|
1030
|
-
case
|
|
1031
|
-
_context12.prev =
|
|
1032
|
-
_context12.
|
|
1033
|
-
console.error('[PaymentModule] 添加支付项失败', _context12.
|
|
1034
|
-
this.logError('addPaymentItemAsync failed', _context12.
|
|
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.
|
|
1039
|
-
case
|
|
1013
|
+
throw _context12.t0;
|
|
1014
|
+
case 35:
|
|
1040
1015
|
case "end":
|
|
1041
1016
|
return _context12.stop();
|
|
1042
1017
|
}
|
|
1043
|
-
}, _callee12, this, [[1,
|
|
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
|
|
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
|
|
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
|
-
|
|
1173
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
1293
|
+
return _this5.getPaymentOrderByUuidAsync(orderUuid);
|
|
1319
1294
|
case 62:
|
|
1320
1295
|
updatedOrder = _context14.sent;
|
|
1321
1296
|
_context14.next = 65;
|
|
1322
|
-
return
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
1378
|
+
_context16.next = 14;
|
|
1407
1379
|
return this.dbManager.update('order', order);
|
|
1408
|
-
case
|
|
1409
|
-
_context16.next =
|
|
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
|
|
1415
|
-
_context16.next =
|
|
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
|
|
1422
|
-
_context16.next =
|
|
1393
|
+
case 18:
|
|
1394
|
+
_context16.next = 24;
|
|
1423
1395
|
break;
|
|
1424
|
-
case
|
|
1425
|
-
_context16.prev =
|
|
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
|
|
1401
|
+
case 24:
|
|
1430
1402
|
case "end":
|
|
1431
1403
|
return _context16.stop();
|
|
1432
1404
|
}
|
|
1433
|
-
}, _callee16, this, [[0,
|
|
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,
|
|
@@ -2009,7 +1980,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2009
1980
|
baseValue = amount.div(roundingInterval);
|
|
2010
1981
|
console.log("[PaymentModule] \u820D\u5165\u8BA1\u7B97 - \u539F\u59CB\u91D1\u989D: ".concat(amount.toString(), ", \u95F4\u9694: ").concat(intervalValue, ", \u57FA\u7840\u503C: ").concat(baseValue.toString(), ", \u89C4\u5219: ").concat(rule));
|
|
2011
1982
|
_context26.t0 = rule;
|
|
2012
|
-
_context26.next = _context26.t0 === RoundingRule.Standard ? 13 : _context26.t0 === 'standard' ? 13 : _context26.t0 === RoundingRule.StandardDown ? 15 : _context26.t0 === '
|
|
1983
|
+
_context26.next = _context26.t0 === RoundingRule.Standard ? 13 : _context26.t0 === 'standard' ? 13 : _context26.t0 === RoundingRule.StandardDown ? 15 : _context26.t0 === 'standard_down' ? 15 : _context26.t0 === RoundingRule.AlwaysUp ? 17 : _context26.t0 === 'always_up' ? 17 : _context26.t0 === RoundingRule.AlwaysDown ? 19 : _context26.t0 === 'always_down' ? 19 : 21;
|
|
2013
1984
|
break;
|
|
2014
1985
|
case 13:
|
|
2015
1986
|
// 标准舍入(中点向上)
|