@pisell/pisellos 2.1.118 → 2.1.120
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/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/model/strategy/adapter/index.d.ts +4 -0
- package/dist/model/strategy/adapter/index.js +4 -1
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
- package/dist/model/strategy/adapter/itemRule/adapter.js +439 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
- package/dist/model/strategy/adapter/itemRule/examples.d.ts +64 -0
- package/dist/model/strategy/adapter/itemRule/examples.js +315 -0
- package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/dist/model/strategy/adapter/itemRule/index.js +5 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +206 -0
- package/dist/model/strategy/adapter/itemRule/type.js +101 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +66 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +271 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +1206 -0
- package/dist/model/strategy/adapter/promotion/examples.d.ts +138 -0
- package/dist/model/strategy/adapter/promotion/examples.js +166 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +447 -0
- package/dist/model/strategy/adapter/promotion/type.js +209 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -1
- package/dist/model/strategy/engine.d.ts +106 -0
- package/dist/model/strategy/engine.js +611 -0
- package/dist/model/strategy/index.d.ts +2 -93
- package/dist/model/strategy/index.js +6 -549
- package/dist/modules/Cart/types.d.ts +0 -2
- package/dist/modules/Cart/utils/cartProduct.js +25 -56
- package/dist/modules/Discount/types.d.ts +0 -18
- package/dist/modules/OpenData/index.d.ts +23 -0
- package/dist/modules/OpenData/index.js +167 -0
- package/dist/modules/OpenData/types.d.ts +73 -0
- package/dist/modules/OpenData/types.js +1 -0
- package/dist/modules/OpenData/utils.d.ts +2 -0
- package/dist/modules/OpenData/utils.js +75 -0
- package/dist/modules/Order/index.d.ts +58 -1
- package/dist/modules/Order/index.js +780 -29
- package/dist/modules/Order/types.d.ts +144 -12
- package/dist/modules/Order/utils.d.ts +25 -0
- package/dist/modules/Order/utils.js +225 -1
- package/dist/modules/Payment/index.d.ts +1 -2
- package/dist/modules/Payment/index.js +7 -10
- package/dist/modules/Payment/utils.js +0 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -23
- package/dist/modules/Payment/walletpass.js +95 -191
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +2 -1
- package/dist/modules/Quotation/index.d.ts +48 -0
- package/dist/modules/Quotation/index.js +245 -0
- package/dist/modules/Quotation/types.d.ts +42 -0
- package/dist/modules/Quotation/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +5 -9
- package/dist/modules/Rules/index.js +164 -673
- package/dist/modules/Rules/types.d.ts +0 -2
- package/dist/modules/SalesSummary/index.d.ts +63 -0
- package/dist/modules/SalesSummary/index.js +174 -0
- package/dist/modules/SalesSummary/types.d.ts +59 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +30 -0
- package/dist/modules/SalesSummary/utils.js +513 -0
- package/dist/modules/ScanOrderLogger/index.d.ts +21 -0
- package/dist/modules/ScanOrderLogger/index.js +161 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.js +95 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
- package/dist/modules/ScanOrderLogger/types.d.ts +46 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
- package/dist/modules/Summary/types.d.ts +0 -2
- package/dist/modules/Summary/utils.d.ts +3 -9
- package/dist/modules/Summary/utils.js +4 -25
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/plugins/window.d.ts +0 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -2
- package/dist/solution/BookingByStep/index.js +44 -42
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/Checkout/index.js +0 -2
- package/dist/solution/ScanOrder/index.d.ts +90 -0
- package/dist/solution/ScanOrder/index.js +1853 -0
- package/dist/solution/ScanOrder/types.d.ts +210 -0
- package/dist/solution/ScanOrder/types.js +16 -0
- package/dist/solution/ScanOrder/utils.d.ts +93 -0
- package/dist/solution/ScanOrder/utils.js +397 -0
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +7 -23
- package/dist/solution/ShopDiscount/types.d.ts +0 -1
- package/dist/solution/ShopDiscount/types.js +1 -2
- package/dist/solution/ShopDiscount/utils.js +12 -26
- package/dist/solution/VenueBooking/index.d.ts +158 -0
- package/dist/solution/VenueBooking/index.js +2873 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +130 -0
- package/dist/solution/VenueBooking/types.js +21 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +102 -0
- package/dist/solution/VenueBooking/utils/resource.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/resource.js +94 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +204 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +256 -0
- package/dist/solution/VenueBooking/utils.d.ts +1 -0
- package/dist/solution/VenueBooking/utils.js +1 -0
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/model/strategy/adapter/index.d.ts +4 -0
- package/lib/model/strategy/adapter/index.js +12 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
- package/lib/model/strategy/adapter/itemRule/adapter.js +338 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
- package/lib/model/strategy/adapter/itemRule/examples.d.ts +64 -0
- package/lib/model/strategy/adapter/itemRule/examples.js +269 -0
- package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/lib/model/strategy/adapter/itemRule/index.js +58 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +206 -0
- package/lib/model/strategy/adapter/itemRule/type.js +46 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +66 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +217 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +844 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +138 -0
- package/lib/model/strategy/adapter/promotion/examples.js +192 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +447 -0
- package/lib/model/strategy/adapter/promotion/type.js +51 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -1
- package/lib/model/strategy/engine.d.ts +106 -0
- package/lib/model/strategy/engine.js +450 -0
- package/lib/model/strategy/index.d.ts +2 -93
- package/lib/model/strategy/index.js +6 -381
- package/lib/modules/Cart/types.d.ts +0 -2
- package/lib/modules/Cart/utils/cartProduct.js +12 -39
- package/lib/modules/Discount/types.d.ts +0 -18
- package/lib/modules/OpenData/index.d.ts +23 -0
- package/lib/modules/OpenData/index.js +116 -0
- package/lib/modules/OpenData/types.d.ts +73 -0
- package/lib/modules/OpenData/types.js +17 -0
- package/lib/modules/OpenData/utils.d.ts +2 -0
- package/lib/modules/OpenData/utils.js +111 -0
- package/lib/modules/Order/index.d.ts +58 -1
- package/lib/modules/Order/index.js +423 -1
- package/lib/modules/Order/types.d.ts +144 -12
- package/lib/modules/Order/utils.d.ts +25 -0
- package/lib/modules/Order/utils.js +229 -0
- package/lib/modules/Payment/index.d.ts +1 -2
- package/lib/modules/Payment/index.js +0 -1
- package/lib/modules/Payment/utils.js +0 -3
- package/lib/modules/Payment/walletpass.d.ts +0 -23
- package/lib/modules/Payment/walletpass.js +17 -94
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +2 -1
- package/lib/modules/Quotation/index.d.ts +48 -0
- package/lib/modules/Quotation/index.js +149 -0
- package/lib/modules/Quotation/types.d.ts +42 -0
- package/lib/modules/Quotation/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +5 -9
- package/lib/modules/Rules/index.js +286 -778
- package/lib/modules/Rules/types.d.ts +0 -2
- package/lib/modules/SalesSummary/index.d.ts +63 -0
- package/lib/modules/SalesSummary/index.js +105 -0
- package/lib/modules/SalesSummary/types.d.ts +59 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +30 -0
- package/lib/modules/SalesSummary/utils.js +452 -0
- package/lib/modules/ScanOrderLogger/index.d.ts +21 -0
- package/lib/modules/ScanOrderLogger/index.js +135 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.js +82 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
- package/lib/modules/ScanOrderLogger/types.d.ts +46 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
- package/lib/modules/Summary/types.d.ts +0 -2
- package/lib/modules/Summary/utils.d.ts +3 -9
- package/lib/modules/Summary/utils.js +4 -19
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/plugins/window.d.ts +0 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -2
- package/lib/solution/BookingByStep/index.js +4 -2
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/Checkout/index.js +0 -2
- package/lib/solution/ScanOrder/index.d.ts +90 -0
- package/lib/solution/ScanOrder/index.js +1071 -0
- package/lib/solution/ScanOrder/types.d.ts +210 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +93 -0
- package/lib/solution/ScanOrder/utils.js +359 -0
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +8 -22
- package/lib/solution/ShopDiscount/types.d.ts +0 -1
- package/lib/solution/ShopDiscount/utils.js +6 -10
- package/lib/solution/VenueBooking/index.d.ts +158 -0
- package/lib/solution/VenueBooking/index.js +1545 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +130 -0
- package/lib/solution/VenueBooking/types.js +44 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +101 -0
- package/lib/solution/VenueBooking/utils/resource.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/resource.js +80 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +209 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +200 -0
- package/lib/solution/VenueBooking/utils.d.ts +1 -0
- package/lib/solution/VenueBooking/utils.js +69 -0
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/package.json +1 -1
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { CartItem } from '../Cart/types';
|
|
2
|
+
import type { ScanOrderTempOrder, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderSummary } from '../../solution/ScanOrder/types';
|
|
3
|
+
import type { DiscountModule } from '../Discount';
|
|
4
|
+
import type { RulesModule } from '../Rules';
|
|
5
|
+
import type { Discount } from '../Discount/types';
|
|
2
6
|
export declare enum OrderHooks {
|
|
3
7
|
OnOrderCreate = "order:onOrderCreate",
|
|
4
8
|
OnOrderUpdate = "order:onOrderUpdate",
|
|
@@ -6,6 +10,10 @@ export declare enum OrderHooks {
|
|
|
6
10
|
OnOrderStatusChange = "order:onOrderStatusChange"
|
|
7
11
|
}
|
|
8
12
|
export interface OrderState {
|
|
13
|
+
tempOrder: ScanOrderTempOrder | null;
|
|
14
|
+
discountList: any[];
|
|
15
|
+
discount: DiscountModule | null;
|
|
16
|
+
rules: RulesModule | null;
|
|
9
17
|
}
|
|
10
18
|
/**
|
|
11
19
|
* 订单信息
|
|
@@ -20,6 +28,109 @@ export interface CommitOrderParams {
|
|
|
20
28
|
business_code?: string;
|
|
21
29
|
};
|
|
22
30
|
}
|
|
31
|
+
export interface SubmitScanOrderProduct {
|
|
32
|
+
order_detail_id: number | null;
|
|
33
|
+
product_id: number | null;
|
|
34
|
+
num: number;
|
|
35
|
+
product_variant_id: number;
|
|
36
|
+
product_option_item: any[];
|
|
37
|
+
selling_price: string;
|
|
38
|
+
original_price: string;
|
|
39
|
+
payment_price: string;
|
|
40
|
+
tax_fee: string;
|
|
41
|
+
is_charge_tax: number;
|
|
42
|
+
discount_list: any[];
|
|
43
|
+
product_bundle: any[];
|
|
44
|
+
metadata: Record<string, any>;
|
|
45
|
+
}
|
|
46
|
+
export interface SubmitScanOrderSummary {
|
|
47
|
+
product_quantity: number;
|
|
48
|
+
product_original_amount: string;
|
|
49
|
+
product_amount: string;
|
|
50
|
+
product_expect_amount: string;
|
|
51
|
+
product_tax_fee: string;
|
|
52
|
+
shipping_fee: string;
|
|
53
|
+
shipping_tax_fee: string;
|
|
54
|
+
tax_fee: string;
|
|
55
|
+
surcharge_fee: string;
|
|
56
|
+
discount_amount: string;
|
|
57
|
+
deposit_amount: string;
|
|
58
|
+
expect_amount: string;
|
|
59
|
+
total_amount: string;
|
|
60
|
+
amount_gap: string;
|
|
61
|
+
rounding_amount: string;
|
|
62
|
+
pay_service_charge_amount: string;
|
|
63
|
+
}
|
|
64
|
+
export interface SubmitScanOrderBooking {
|
|
65
|
+
relation_id?: string;
|
|
66
|
+
form_id?: string;
|
|
67
|
+
collect_pax?: number;
|
|
68
|
+
start_time?: string;
|
|
69
|
+
end_time?: string;
|
|
70
|
+
metadata?: Record<string, any>;
|
|
71
|
+
}
|
|
72
|
+
export interface SubmitScanOrderFormRecord {
|
|
73
|
+
form_id: number | string;
|
|
74
|
+
form_record_ids: Array<number | string>;
|
|
75
|
+
}
|
|
76
|
+
export interface SubmitScanOrderParams {
|
|
77
|
+
url?: string;
|
|
78
|
+
query: {
|
|
79
|
+
order_id: number | null;
|
|
80
|
+
relation_id?: string;
|
|
81
|
+
table_form_id?: string;
|
|
82
|
+
resource_id?: string;
|
|
83
|
+
order_number: string;
|
|
84
|
+
shop_order_number: string;
|
|
85
|
+
type: string;
|
|
86
|
+
business_code: string;
|
|
87
|
+
platform: 'H5' | 'PC';
|
|
88
|
+
request_unique_idempotency_token?: string;
|
|
89
|
+
sales_channel: string;
|
|
90
|
+
order_sales_channel: string;
|
|
91
|
+
status: string;
|
|
92
|
+
payment_status: string;
|
|
93
|
+
shipping_status: string;
|
|
94
|
+
customer_id: number | null;
|
|
95
|
+
customer_name: string;
|
|
96
|
+
country_calling_code: string;
|
|
97
|
+
phone: string;
|
|
98
|
+
email: string;
|
|
99
|
+
is_price_include_tax: number;
|
|
100
|
+
tax_title: string;
|
|
101
|
+
tax_country_code: string;
|
|
102
|
+
currency_code: string;
|
|
103
|
+
currency_symbol: string;
|
|
104
|
+
currency_format: string;
|
|
105
|
+
is_deposit: number;
|
|
106
|
+
deposit_amount: string;
|
|
107
|
+
shop_discount: string;
|
|
108
|
+
surcharge_fee: string;
|
|
109
|
+
note: string;
|
|
110
|
+
schedule_date: string;
|
|
111
|
+
created_at?: string;
|
|
112
|
+
products: SubmitScanOrderProduct[];
|
|
113
|
+
bookings: SubmitScanOrderBooking[];
|
|
114
|
+
payments: any[];
|
|
115
|
+
surcharges?: any[];
|
|
116
|
+
discount_list: any[];
|
|
117
|
+
relation_forms: any[];
|
|
118
|
+
form_record_ids?: SubmitScanOrderFormRecord[];
|
|
119
|
+
contacts: any[];
|
|
120
|
+
contacts_info: any[];
|
|
121
|
+
holder: Record<string, any> | null;
|
|
122
|
+
summary?: SubmitScanOrderSummary;
|
|
123
|
+
metadata: Record<string, any>;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export interface ScanOrderMoreParams {
|
|
127
|
+
url?: string;
|
|
128
|
+
query: {
|
|
129
|
+
order_id: number | string;
|
|
130
|
+
products: SubmitScanOrderProduct[];
|
|
131
|
+
request_unique_idempotency_token?: string;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
23
134
|
/**
|
|
24
135
|
* 支付项数据
|
|
25
136
|
*/
|
|
@@ -63,23 +174,11 @@ export interface CheckoutOrderParams {
|
|
|
63
174
|
* 订单模块 API
|
|
64
175
|
*/
|
|
65
176
|
export interface OrderModuleAPI {
|
|
66
|
-
/**
|
|
67
|
-
* 创建订单
|
|
68
|
-
* @param params 订单信息
|
|
69
|
-
* @returns 订单信息
|
|
70
|
-
*/
|
|
71
177
|
createOrder: (params: CommitOrderParams['query']) => any;
|
|
72
|
-
/**
|
|
73
|
-
* 检查购物车提交订单前是否符合条件
|
|
74
|
-
*/
|
|
75
178
|
checkBeforeSubmitOrder: (params: {
|
|
76
179
|
cartItems: CartItem[];
|
|
77
180
|
type: 'holder' | 'account';
|
|
78
181
|
}) => boolean;
|
|
79
|
-
/**
|
|
80
|
-
* 提交订单
|
|
81
|
-
* @param params 订单信息
|
|
82
|
-
*/
|
|
83
182
|
submitOrder: (params: CommitOrderParams) => Promise<void>;
|
|
84
183
|
/**
|
|
85
184
|
* Checkout 专用:创建订单到后端
|
|
@@ -87,4 +186,37 @@ export interface OrderModuleAPI {
|
|
|
87
186
|
* @returns 后端返回的订单数据
|
|
88
187
|
*/
|
|
89
188
|
createOrderByCheckout: (params: CheckoutOrderParams) => Promise<any>;
|
|
189
|
+
submitScanOrder: <T = any>(params: SubmitScanOrderParams) => Promise<T>;
|
|
190
|
+
scanOrderMore: <T = any>(params: ScanOrderMoreParams) => Promise<T>;
|
|
191
|
+
initTempOrder: (params: {
|
|
192
|
+
cacheId?: string;
|
|
193
|
+
salesSummaryModuleName?: string;
|
|
194
|
+
}) => void;
|
|
195
|
+
getTempOrder: () => ScanOrderTempOrder | null;
|
|
196
|
+
ensureTempOrder: () => ScanOrderTempOrder;
|
|
197
|
+
addNewOrder: () => Promise<ScanOrderTempOrder>;
|
|
198
|
+
getOrderProducts: () => ScanOrderOrderProduct[];
|
|
199
|
+
getScanOrderSummary: () => Promise<ScanOrderSummary>;
|
|
200
|
+
recalculateSummary: (options?: {
|
|
201
|
+
createIfMissing?: boolean;
|
|
202
|
+
}) => Promise<ScanOrderSummary | null>;
|
|
203
|
+
updateTempOrderNote: (note: string) => string;
|
|
204
|
+
updateTempOrderContactsInfo: (contactsInfo: any[]) => any[];
|
|
205
|
+
addProductToOrder: (product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity) => Promise<ScanOrderOrderProduct[]>;
|
|
206
|
+
updateProductInOrder: (params: {
|
|
207
|
+
product_id: number | null;
|
|
208
|
+
product_variant_id: number;
|
|
209
|
+
updates: Partial<ScanOrderOrderProduct>;
|
|
210
|
+
}) => Promise<ScanOrderOrderProduct[]>;
|
|
211
|
+
removeProductFromOrder: (identity: ScanOrderOrderProductIdentity) => Promise<ScanOrderOrderProduct[]>;
|
|
212
|
+
persistTempOrder: () => void;
|
|
213
|
+
submitTempOrder: <T = any>(params?: {
|
|
214
|
+
cacheId?: string;
|
|
215
|
+
}) => Promise<T>;
|
|
216
|
+
loadDiscountConfig: (params: {
|
|
217
|
+
customerId: number;
|
|
218
|
+
action?: 'create';
|
|
219
|
+
}) => Promise<void>;
|
|
220
|
+
getDiscountList: () => Discount[];
|
|
221
|
+
applyDiscount: () => void;
|
|
90
222
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CartItem } from "../Cart";
|
|
2
|
+
import type { ScanOrderSubmitPayload, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder } from '../../solution/ScanOrder/types';
|
|
2
3
|
/**
|
|
3
4
|
* 通过 session 类商品的开始时间结束时间生成商品的时长
|
|
4
5
|
* @param {CartItem} cartItem
|
|
@@ -21,3 +22,27 @@ export declare const mergeRelationForms: (relationForms: {
|
|
|
21
22
|
form_record_ids: number[];
|
|
22
23
|
}[];
|
|
23
24
|
export declare const getAllDiscountList: (cartItem: CartItem) => any;
|
|
25
|
+
export declare function createUuidV4(): string;
|
|
26
|
+
export declare function isTempOrder(data: any): data is ScanOrderTempOrder;
|
|
27
|
+
export declare function formatDateTime(date: Date): string;
|
|
28
|
+
export declare function createDefaultTempOrder(params: {
|
|
29
|
+
now: string;
|
|
30
|
+
summary?: ScanOrderSummary;
|
|
31
|
+
}): ScanOrderTempOrder;
|
|
32
|
+
export declare function buildSubmitPayload(params: {
|
|
33
|
+
tempOrder: ScanOrderTempOrder;
|
|
34
|
+
cacheId?: string;
|
|
35
|
+
now?: Date;
|
|
36
|
+
}): ScanOrderSubmitPayload;
|
|
37
|
+
export declare function formatV1Product(products: ScanOrderSubmitProduct[]): {
|
|
38
|
+
bundle: any[];
|
|
39
|
+
key: number | null;
|
|
40
|
+
option: any[];
|
|
41
|
+
product_id: number | null;
|
|
42
|
+
product_variant_id: number;
|
|
43
|
+
quantity: number;
|
|
44
|
+
rowKey: number | null;
|
|
45
|
+
session: null;
|
|
46
|
+
unique: string;
|
|
47
|
+
}[];
|
|
48
|
+
export { createEmptySummary } from '../../solution/ScanOrder/utils';
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
var _excluded = ["_origin", "identity_key"],
|
|
2
|
+
_excluded2 = ["created_at", "summary", "surcharges"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
1
11
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
12
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
13
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -5,6 +15,8 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
5
15
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
16
|
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; }
|
|
7
17
|
import dayjs from "dayjs";
|
|
18
|
+
import { createEmptySummary } from "../../solution/ScanOrder/utils";
|
|
19
|
+
|
|
8
20
|
/**
|
|
9
21
|
* 通过 session 类商品的开始时间结束时间生成商品的时长
|
|
10
22
|
* @param {CartItem} cartItem
|
|
@@ -60,4 +72,216 @@ export var getAllDiscountList = function getAllDiscountList(cartItem) {
|
|
|
60
72
|
item.discount_list = undefined;
|
|
61
73
|
});
|
|
62
74
|
return discountList;
|
|
63
|
-
};
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// ─── 以下为从 ScanOrder/utils.ts 迁入的 Order 专属工具函数 ───
|
|
78
|
+
|
|
79
|
+
export function createUuidV4() {
|
|
80
|
+
var template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
|
81
|
+
return template.replace(/[xy]/g, function (char) {
|
|
82
|
+
var randomValue = Math.floor(Math.random() * 16);
|
|
83
|
+
var value = char === 'x' ? randomValue : randomValue & 0x3 | 0x8;
|
|
84
|
+
return value.toString(16);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export function isTempOrder(data) {
|
|
88
|
+
if (!data || _typeof(data) !== 'object') return false;
|
|
89
|
+
if (!Array.isArray(data.products)) return false;
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
export function formatDateTime(date) {
|
|
93
|
+
var pad = function pad(value) {
|
|
94
|
+
return value.toString().padStart(2, '0');
|
|
95
|
+
};
|
|
96
|
+
var year = date.getFullYear();
|
|
97
|
+
var month = pad(date.getMonth() + 1);
|
|
98
|
+
var day = pad(date.getDate());
|
|
99
|
+
var hours = pad(date.getHours());
|
|
100
|
+
var minutes = pad(date.getMinutes());
|
|
101
|
+
var seconds = pad(date.getSeconds());
|
|
102
|
+
return "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hours, ":").concat(minutes, ":").concat(seconds);
|
|
103
|
+
}
|
|
104
|
+
function normalizeSubmitPlatform(platform) {
|
|
105
|
+
return (platform === null || platform === void 0 ? void 0 : platform.toLowerCase()) === 'pc' ? 'PC' : 'H5';
|
|
106
|
+
}
|
|
107
|
+
function normalizeSubmitProduct(product) {
|
|
108
|
+
var _origin = product._origin,
|
|
109
|
+
identity_key = product.identity_key,
|
|
110
|
+
submitProduct = _objectWithoutProperties(product, _excluded);
|
|
111
|
+
var rawMetadata = submitProduct.metadata || {};
|
|
112
|
+
var bookingUid = rawMetadata.booking_uid;
|
|
113
|
+
var cleanMetadata = {};
|
|
114
|
+
if (rawMetadata.unique_identification_number) {
|
|
115
|
+
cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
|
|
116
|
+
}
|
|
117
|
+
var priceMetaKeys = ['main_product_original_price', 'main_product_selling_price', 'source_product_price'];
|
|
118
|
+
for (var _i = 0, _priceMetaKeys = priceMetaKeys; _i < _priceMetaKeys.length; _i++) {
|
|
119
|
+
var key = _priceMetaKeys[_i];
|
|
120
|
+
if (rawMetadata[key] !== undefined) {
|
|
121
|
+
cleanMetadata[key] = rawMetadata[key];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (rawMetadata.price_breakdown) {
|
|
125
|
+
cleanMetadata.price_breakdown = rawMetadata.price_breakdown;
|
|
126
|
+
}
|
|
127
|
+
return _objectSpread(_objectSpread(_objectSpread({}, submitProduct), bookingUid ? {
|
|
128
|
+
booking_uid: bookingUid
|
|
129
|
+
} : {}), {}, {
|
|
130
|
+
product_option_item: submitProduct.product_option_item || [],
|
|
131
|
+
discount_list: submitProduct.discount_list || [],
|
|
132
|
+
product_bundle: submitProduct.product_bundle || [],
|
|
133
|
+
metadata: cleanMetadata
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
var DEFAULT_TABLE_OCCUPANCY_DURATION = 20;
|
|
137
|
+
function resolveTableOccupancyDuration(tempOrder) {
|
|
138
|
+
var _metadata$table_confi, _metadata$tableConfig, _metadata$resource_co, _metadata$resourceCon;
|
|
139
|
+
var metadata = tempOrder.metadata || {};
|
|
140
|
+
var candidates = [metadata.table_occupancy_duration, metadata.booking_duration, metadata.table_duration, metadata.duration, (_metadata$table_confi = metadata.table_config) === null || _metadata$table_confi === void 0 ? void 0 : _metadata$table_confi.occupancy_duration, (_metadata$tableConfig = metadata.tableConfig) === null || _metadata$tableConfig === void 0 ? void 0 : _metadata$tableConfig.occupancy_duration, (_metadata$resource_co = metadata.resource_config) === null || _metadata$resource_co === void 0 ? void 0 : _metadata$resource_co.occupancy_duration, (_metadata$resourceCon = metadata.resourceConfig) === null || _metadata$resourceCon === void 0 ? void 0 : _metadata$resourceCon.occupancy_duration];
|
|
141
|
+
for (var _i2 = 0, _candidates = candidates; _i2 < _candidates.length; _i2++) {
|
|
142
|
+
var value = _candidates[_i2];
|
|
143
|
+
var duration = Number(value);
|
|
144
|
+
if (Number.isFinite(duration) && duration > 0) {
|
|
145
|
+
return Math.floor(duration);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return DEFAULT_TABLE_OCCUPANCY_DURATION;
|
|
149
|
+
}
|
|
150
|
+
export function createDefaultTempOrder(params) {
|
|
151
|
+
var summary = params.summary || createEmptySummary();
|
|
152
|
+
return {
|
|
153
|
+
order_id: null,
|
|
154
|
+
relation_id: undefined,
|
|
155
|
+
table_form_id: undefined,
|
|
156
|
+
resource_id: undefined,
|
|
157
|
+
order_number: '',
|
|
158
|
+
shop_order_number: '',
|
|
159
|
+
type: 'appointment_booking',
|
|
160
|
+
business_code: 'appointment_booking',
|
|
161
|
+
platform: 'h5',
|
|
162
|
+
sales_channel: 'my_pisel',
|
|
163
|
+
order_sales_channel: 'online_store',
|
|
164
|
+
status: 'normal',
|
|
165
|
+
payment_status: 'payment_processing',
|
|
166
|
+
shipping_status: 'unfulfilled',
|
|
167
|
+
customer_id: null,
|
|
168
|
+
customer_name: '',
|
|
169
|
+
country_calling_code: '',
|
|
170
|
+
phone: '',
|
|
171
|
+
email: '',
|
|
172
|
+
is_price_include_tax: 1,
|
|
173
|
+
tax_title: '',
|
|
174
|
+
tax_country_code: '',
|
|
175
|
+
currency_code: '',
|
|
176
|
+
currency_symbol: '',
|
|
177
|
+
currency_format: 'symbol_first',
|
|
178
|
+
is_deposit: 0,
|
|
179
|
+
deposit_amount: '0.00',
|
|
180
|
+
shop_discount: '0.00',
|
|
181
|
+
surcharge_fee: '0.00',
|
|
182
|
+
note: '',
|
|
183
|
+
schedule_date: params.now,
|
|
184
|
+
created_at: params.now,
|
|
185
|
+
products: [],
|
|
186
|
+
bookings: [],
|
|
187
|
+
payments: [],
|
|
188
|
+
surcharges: [],
|
|
189
|
+
discount_list: [],
|
|
190
|
+
relation_forms: [],
|
|
191
|
+
contacts: [],
|
|
192
|
+
contacts_info: [],
|
|
193
|
+
holder: null,
|
|
194
|
+
summary: summary,
|
|
195
|
+
metadata: {}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
export function buildSubmitPayload(params) {
|
|
199
|
+
var _tempOrder$is_price_i, _tempOrder$is_deposit;
|
|
200
|
+
var tempOrder = params.tempOrder,
|
|
201
|
+
cacheId = params.cacheId,
|
|
202
|
+
_params$now = params.now,
|
|
203
|
+
now = _params$now === void 0 ? new Date() : _params$now;
|
|
204
|
+
var scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
|
|
205
|
+
var summary = tempOrder.summary || createEmptySummary();
|
|
206
|
+
var relationId = tempOrder.relation_id;
|
|
207
|
+
var tableFormId = tempOrder.table_form_id;
|
|
208
|
+
var bookingUuid = createUuidV4();
|
|
209
|
+
var bookingStart = dayjs(now);
|
|
210
|
+
var bookingDuration = resolveTableOccupancyDuration(tempOrder);
|
|
211
|
+
var bookingEnd = bookingStart.add(bookingDuration, 'minute');
|
|
212
|
+
var bookings = relationId && tableFormId ? [{
|
|
213
|
+
relation_id: relationId,
|
|
214
|
+
form_id: tableFormId,
|
|
215
|
+
start_time: bookingStart.format('HH:mm'),
|
|
216
|
+
start_date: bookingStart.format('YYYY-MM-DD'),
|
|
217
|
+
end_time: bookingEnd.format('HH:mm'),
|
|
218
|
+
end_date: bookingEnd.format('YYYY-MM-DD'),
|
|
219
|
+
duration: bookingDuration,
|
|
220
|
+
metadata: {
|
|
221
|
+
unique_identification_number: bookingUuid,
|
|
222
|
+
collect_pax: 1
|
|
223
|
+
},
|
|
224
|
+
select_date: bookingStart.format('YYYY-MM-DD'),
|
|
225
|
+
is_all: false,
|
|
226
|
+
"like_status": "common",
|
|
227
|
+
"schedule_id": 0,
|
|
228
|
+
"relation_type": "form",
|
|
229
|
+
"number": 1
|
|
230
|
+
}] : tempOrder.bookings || [];
|
|
231
|
+
var formRecordIds = relationId && tableFormId ? [{
|
|
232
|
+
form_id: tableFormId,
|
|
233
|
+
form_record_ids: [relationId]
|
|
234
|
+
}] : undefined;
|
|
235
|
+
var _createdAt = tempOrder.created_at,
|
|
236
|
+
_summary = tempOrder.summary,
|
|
237
|
+
_surcharges = tempOrder.surcharges,
|
|
238
|
+
tempOrderRest = _objectWithoutProperties(tempOrder, _excluded2);
|
|
239
|
+
return _objectSpread(_objectSpread({}, tempOrderRest), {}, {
|
|
240
|
+
platform: normalizeSubmitPlatform(tempOrder.platform),
|
|
241
|
+
request_unique_idempotency_token: cacheId,
|
|
242
|
+
type: tempOrder.type || 'table-order',
|
|
243
|
+
business_code: tempOrder.business_code || 'table-order',
|
|
244
|
+
sales_channel: tempOrder.sales_channel || 'my_pisel',
|
|
245
|
+
order_sales_channel: tempOrder.order_sales_channel || 'online_store',
|
|
246
|
+
status: tempOrder.status || 'normal',
|
|
247
|
+
payment_status: tempOrder.payment_status || 'payment_processing',
|
|
248
|
+
// shipping_status: tempOrder.shipping_status || 'unfulfilled',
|
|
249
|
+
is_price_include_tax: (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : 1,
|
|
250
|
+
currency_format: tempOrder.currency_format || 'symbol_first',
|
|
251
|
+
is_deposit: (_tempOrder$is_deposit = tempOrder.is_deposit) !== null && _tempOrder$is_deposit !== void 0 ? _tempOrder$is_deposit : 0,
|
|
252
|
+
deposit_amount: tempOrder.deposit_amount || '0.00',
|
|
253
|
+
shop_discount: tempOrder.shop_discount || '0.00',
|
|
254
|
+
surcharge_fee: summary.surcharge_fee || tempOrder.surcharge_fee || '0.00',
|
|
255
|
+
note: tempOrder.note || '',
|
|
256
|
+
schedule_date: scheduleDate,
|
|
257
|
+
bookings: bookings,
|
|
258
|
+
payments: tempOrder.payments || [],
|
|
259
|
+
// discount_list: tempOrder.discount_list || [],
|
|
260
|
+
relation_forms: tempOrder.relation_forms || [],
|
|
261
|
+
form_record_ids: formRecordIds,
|
|
262
|
+
// contacts: tempOrder.contacts || [],
|
|
263
|
+
contacts_info: tempOrder.contacts_info || [],
|
|
264
|
+
// holder: tempOrder.holder || null,
|
|
265
|
+
// summary,
|
|
266
|
+
metadata: _objectSpread({}, tempOrder.metadata),
|
|
267
|
+
products: (tempOrder.products || []).map(function (product) {
|
|
268
|
+
return normalizeSubmitProduct(product);
|
|
269
|
+
})
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
export function formatV1Product(products) {
|
|
273
|
+
return products.map(function (product) {
|
|
274
|
+
return {
|
|
275
|
+
bundle: product.product_bundle,
|
|
276
|
+
key: product.product_id,
|
|
277
|
+
option: product.product_option_item,
|
|
278
|
+
product_id: product.product_id,
|
|
279
|
+
product_variant_id: product.product_variant_id,
|
|
280
|
+
quantity: product.num,
|
|
281
|
+
rowKey: product.product_id,
|
|
282
|
+
session: null,
|
|
283
|
+
unique: createUuidV4()
|
|
284
|
+
};
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
export { createEmptySummary } from "../../solution/ScanOrder/utils";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
|
-
import { RequestPlugin
|
|
2
|
+
import { RequestPlugin } from '../../plugins';
|
|
3
3
|
import { BaseModule } from '../BaseModule';
|
|
4
4
|
import { PaymentModuleAPI, PaymentMethod, PaymentOrder, PaymentItem, PaymentItemInput, PaymentUpdateFields, PushOrderParams, CashPayment, EftposPayment, WalletPassPayment, RoundingRule, RoundingInterval, RoundingResult } from './types';
|
|
5
5
|
export * from './types';
|
|
@@ -21,7 +21,6 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
21
21
|
request: RequestPlugin;
|
|
22
22
|
private app;
|
|
23
23
|
private store;
|
|
24
|
-
window: WindowPlugin;
|
|
25
24
|
private dbManager;
|
|
26
25
|
private logger;
|
|
27
26
|
protected otherParams: any;
|
|
@@ -81,8 +81,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
81
81
|
_defineProperty(_assertThisInitialized(_this), "app", void 0);
|
|
82
82
|
// App instance
|
|
83
83
|
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
84
|
-
_defineProperty(_assertThisInitialized(_this), "window", void 0);
|
|
85
|
-
// WindowPlugin 实例
|
|
86
84
|
_defineProperty(_assertThisInitialized(_this), "dbManager", void 0);
|
|
87
85
|
// IndexDBManager 实例
|
|
88
86
|
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
@@ -112,27 +110,26 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
112
110
|
// 获取依赖的插件
|
|
113
111
|
this.request = core.getPlugin('request');
|
|
114
112
|
appPlugin = core.getPlugin('app');
|
|
115
|
-
this.window = core.getPlugin('window');
|
|
116
113
|
if (this.request) {
|
|
117
|
-
_context.next =
|
|
114
|
+
_context.next = 7;
|
|
118
115
|
break;
|
|
119
116
|
}
|
|
120
117
|
throw new Error('支付模块需要 request 插件支持');
|
|
121
|
-
case
|
|
118
|
+
case 7:
|
|
122
119
|
if (appPlugin) {
|
|
123
|
-
_context.next =
|
|
120
|
+
_context.next = 9;
|
|
124
121
|
break;
|
|
125
122
|
}
|
|
126
123
|
throw new Error('支付模块需要 app 插件支持');
|
|
127
|
-
case
|
|
124
|
+
case 9:
|
|
128
125
|
this.app = appPlugin.getApp();
|
|
129
126
|
this.dbManager = this.app.dbManager;
|
|
130
127
|
this.logger = this.app.logger;
|
|
131
128
|
|
|
132
129
|
// 确保支付模块所需的对象存储已创建
|
|
133
|
-
_context.next =
|
|
130
|
+
_context.next = 14;
|
|
134
131
|
return this.ensurePaymentTables();
|
|
135
|
-
case
|
|
132
|
+
case 14:
|
|
136
133
|
this.registerNetworkHandlers();
|
|
137
134
|
|
|
138
135
|
// // 预连接数据库
|
|
@@ -140,7 +137,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
140
137
|
|
|
141
138
|
console.log('[PaymentModule] 初始化完成');
|
|
142
139
|
this.logInfo('PaymentModule initialized successfully');
|
|
143
|
-
case
|
|
140
|
+
case 17:
|
|
144
141
|
case "end":
|
|
145
142
|
return _context.stop();
|
|
146
143
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
// 获取walletPass可用最大金额
|
|
2
2
|
export var getAvailableMaxAmount = function getAvailableMaxAmount(data) {
|
|
3
|
-
if (typeof data._available_max_amount === 'number') {
|
|
4
|
-
return data._available_max_amount;
|
|
5
|
-
}
|
|
6
3
|
return data.tag !== 'point_card' ? data.available_max_amount : data === null || data === void 0 ? void 0 : data.recommended_usage_amount;
|
|
7
4
|
};
|
|
8
5
|
|
|
@@ -9,7 +9,6 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
9
9
|
private userIdentificationCodes;
|
|
10
10
|
private searchResults;
|
|
11
11
|
private walletParams;
|
|
12
|
-
private walletInitData;
|
|
13
12
|
constructor(paymentModule: PaymentModule);
|
|
14
13
|
/**
|
|
15
14
|
* 发送事件的辅助方法
|
|
@@ -38,14 +37,7 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
38
37
|
initializeWalletDataFromBusinessAsync(businessData: WalletInitBusinessData): Promise<{
|
|
39
38
|
walletRecommendList: WalletRecommendItem[];
|
|
40
39
|
userIdentificationCodes: UserIdentificationCodeItem[];
|
|
41
|
-
transformList: any[];
|
|
42
|
-
noApplicableVoucher: any[];
|
|
43
|
-
products: any[];
|
|
44
40
|
}>;
|
|
45
|
-
/**
|
|
46
|
-
* 获取订单基础详情
|
|
47
|
-
*/
|
|
48
|
-
getOrderBasicDetailAsync(orderId: string): Promise<any>;
|
|
49
41
|
/**
|
|
50
42
|
* 初始化钱包数据
|
|
51
43
|
* 先获取推荐列表,再获取用户识别码列表(顺序执行)
|
|
@@ -53,9 +45,6 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
53
45
|
initializeWalletDataAsync(baseParams: WalletDeductionRecommendParams): Promise<{
|
|
54
46
|
walletRecommendList: WalletRecommendItem[];
|
|
55
47
|
userIdentificationCodes: UserIdentificationCodeItem[];
|
|
56
|
-
transformList: any[];
|
|
57
|
-
noApplicableVoucher: any[];
|
|
58
|
-
products: any[];
|
|
59
48
|
}>;
|
|
60
49
|
getWalletPassRecommendListAsync(params: WalletDeductionRecommendParams): Promise<WalletRecommendItem[]>;
|
|
61
50
|
formatWalletPassList2PreparePayments(list: WalletRecommendItem[]): {
|
|
@@ -103,18 +92,6 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
103
92
|
* 清除搜索结果缓存
|
|
104
93
|
*/
|
|
105
94
|
clearSearchResults(): void;
|
|
106
|
-
/**
|
|
107
|
-
* 获取存储的钱包初始化数据
|
|
108
|
-
*/
|
|
109
|
-
getStoredWalletInitData(): {
|
|
110
|
-
transformList: any[];
|
|
111
|
-
noApplicableVoucher: any[];
|
|
112
|
-
products: any[];
|
|
113
|
-
} | null;
|
|
114
|
-
/**
|
|
115
|
-
* 清除存储的钱包初始化数据
|
|
116
|
-
*/
|
|
117
|
-
clearStoredWalletInitData(): void;
|
|
118
95
|
/**
|
|
119
96
|
* 清除所有缓存数据
|
|
120
97
|
*/
|