@pisell/pisellos 2.2.147 → 2.2.149
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/model/strategy/adapter/index.d.ts +2 -0
- package/dist/model/strategy/adapter/index.js +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
- package/dist/model/strategy/adapter/itemRule/adapter.js +483 -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 +79 -0
- package/dist/model/strategy/adapter/itemRule/examples.js +382 -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 +225 -0
- package/dist/model/strategy/adapter/itemRule/type.js +101 -0
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.js +22 -1
- package/dist/modules/Cart/utils/changePrice.js +6 -0
- package/dist/modules/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +16 -8
- package/dist/modules/Date/types.d.ts +3 -1
- package/dist/modules/OpenData/index.d.ts +24 -0
- package/dist/modules/OpenData/index.js +173 -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 +171 -1
- package/dist/modules/Order/index.js +2052 -112
- package/dist/modules/Order/types.d.ts +441 -20
- package/dist/modules/Order/types.js +23 -0
- package/dist/modules/Order/utils.d.ts +120 -0
- package/dist/modules/Order/utils.js +653 -2
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.js +2 -1
- package/dist/modules/Quotation/index.d.ts +8 -1
- package/dist/modules/Quotation/index.js +40 -10
- package/dist/modules/Quotation/types.d.ts +5 -0
- package/dist/modules/Rules/index.d.ts +3 -1
- package/dist/modules/Rules/index.js +136 -50
- package/dist/modules/Rules/types.d.ts +6 -0
- package/dist/modules/Rules/types.js +8 -0
- package/dist/modules/SalesSummary/index.d.ts +70 -0
- package/dist/modules/SalesSummary/index.js +175 -0
- package/dist/modules/SalesSummary/types.d.ts +64 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +34 -0
- package/dist/modules/SalesSummary/utils.js +488 -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 +203 -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 +52 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +7 -7
- package/dist/modules/Schedule/index.d.ts +4 -13
- package/dist/modules/Schedule/index.js +6 -23
- package/dist/modules/Schedule/utils.d.ts +1 -1
- package/dist/modules/Summary/index.d.ts +3 -0
- package/dist/modules/Summary/index.js +134 -15
- package/dist/modules/Summary/types.d.ts +7 -0
- package/dist/modules/Summary/utils.d.ts +104 -1
- package/dist/modules/Summary/utils.js +1116 -13
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/server/index.d.ts +41 -4
- package/dist/server/index.js +900 -405
- package/dist/server/modules/order/index.d.ts +10 -2
- package/dist/server/modules/order/index.js +251 -196
- package/dist/server/modules/products/index.d.ts +26 -0
- package/dist/server/modules/products/index.js +618 -338
- package/dist/server/modules/products/types.d.ts +5 -1
- package/dist/solution/BaseSales/index.d.ts +175 -0
- package/dist/solution/BaseSales/index.js +1293 -0
- package/dist/solution/BaseSales/types.d.ts +305 -0
- package/dist/solution/BaseSales/types.js +38 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +143 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +159 -0
- package/dist/solution/BaseSales/utils.d.ts +40 -0
- package/dist/solution/BaseSales/utils.js +222 -0
- package/dist/solution/BookingByStep/index.d.ts +14 -0
- package/dist/solution/BookingByStep/index.js +699 -212
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/BookingByStep/utils/capacity.js +1 -1
- package/dist/solution/BookingByStep/utils/resources.js +6 -1
- package/dist/solution/BookingTicket/index.d.ts +113 -15
- package/dist/solution/BookingTicket/index.js +534 -196
- package/dist/solution/BookingTicket/types.d.ts +69 -6
- package/dist/solution/BookingTicket/types.js +40 -9
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +37 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +66 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +26 -0
- package/dist/solution/BookingTicket/utils/cartView.js +84 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +1 -0
- package/dist/solution/ScanOrder/index.d.ts +146 -0
- package/dist/solution/ScanOrder/index.js +3029 -0
- package/dist/solution/ScanOrder/types.d.ts +305 -0
- package/dist/solution/ScanOrder/types.js +35 -0
- package/dist/solution/ScanOrder/utils.d.ts +167 -0
- package/dist/solution/ScanOrder/utils.js +768 -0
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +9 -5
- package/dist/solution/ShopDiscount/types.d.ts +4 -0
- package/dist/solution/VenueBooking/index.d.ts +197 -0
- package/dist/solution/VenueBooking/index.js +3411 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +153 -0
- package/dist/solution/VenueBooking/types.js +21 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +104 -0
- package/dist/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/dist/solution/VenueBooking/utils/resource.js +130 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +34 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +224 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +453 -0
- package/dist/solution/VenueBooking/utils.d.ts +1 -0
- package/dist/solution/VenueBooking/utils.js +1 -0
- package/dist/solution/index.d.ts +3 -0
- package/dist/solution/index.js +4 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/model/strategy/adapter/index.d.ts +2 -0
- package/lib/model/strategy/adapter/index.js +6 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
- package/lib/model/strategy/adapter/itemRule/adapter.js +377 -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 +79 -0
- package/lib/model/strategy/adapter/itemRule/examples.js +316 -0
- package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/lib/model/strategy/adapter/itemRule/index.js +60 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +225 -0
- package/lib/model/strategy/adapter/itemRule/type.js +46 -0
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.js +17 -1
- package/lib/modules/Cart/utils/changePrice.js +5 -0
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +7 -1
- package/lib/modules/Date/types.d.ts +3 -1
- package/lib/modules/OpenData/index.d.ts +24 -0
- package/lib/modules/OpenData/index.js +119 -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 +171 -1
- package/lib/modules/Order/index.js +1396 -5
- package/lib/modules/Order/types.d.ts +441 -20
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/Order/utils.d.ts +120 -0
- package/lib/modules/Order/utils.js +562 -2
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.js +2 -1
- package/lib/modules/Quotation/index.d.ts +8 -1
- package/lib/modules/Quotation/index.js +33 -4
- package/lib/modules/Quotation/types.d.ts +5 -0
- package/lib/modules/Rules/index.d.ts +3 -1
- package/lib/modules/Rules/index.js +46 -6
- package/lib/modules/Rules/types.d.ts +6 -0
- package/lib/modules/Rules/types.js +11 -2
- package/lib/modules/SalesSummary/index.d.ts +70 -0
- package/lib/modules/SalesSummary/index.js +106 -0
- package/lib/modules/SalesSummary/types.d.ts +64 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +34 -0
- package/lib/modules/SalesSummary/utils.js +430 -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 +148 -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 +52 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +5 -5
- package/lib/modules/Schedule/index.d.ts +4 -13
- package/lib/modules/Schedule/index.js +4 -15
- package/lib/modules/Schedule/utils.d.ts +1 -1
- package/lib/modules/Summary/index.d.ts +3 -0
- package/lib/modules/Summary/index.js +61 -2
- package/lib/modules/Summary/types.d.ts +7 -0
- package/lib/modules/Summary/utils.d.ts +104 -1
- package/lib/modules/Summary/utils.js +659 -8
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/server/index.d.ts +41 -4
- package/lib/server/index.js +272 -10
- package/lib/server/modules/order/index.d.ts +10 -2
- package/lib/server/modules/order/index.js +31 -4
- package/lib/server/modules/products/index.d.ts +26 -0
- package/lib/server/modules/products/index.js +174 -22
- package/lib/server/modules/products/types.d.ts +5 -1
- package/lib/solution/BaseSales/index.d.ts +175 -0
- package/lib/solution/BaseSales/index.js +655 -0
- package/lib/solution/BaseSales/types.d.ts +305 -0
- package/lib/solution/BaseSales/types.js +40 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +143 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +160 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +200 -0
- package/lib/solution/BookingByStep/index.d.ts +14 -0
- package/lib/solution/BookingByStep/index.js +469 -91
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/BookingByStep/utils/capacity.js +1 -1
- package/lib/solution/BookingByStep/utils/resources.js +5 -2
- package/lib/solution/BookingTicket/index.d.ts +113 -15
- package/lib/solution/BookingTicket/index.js +253 -61
- package/lib/solution/BookingTicket/types.d.ts +69 -6
- package/lib/solution/BookingTicket/types.js +16 -14
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +37 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +65 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +26 -0
- package/lib/solution/BookingTicket/utils/cartView.js +103 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/ScanOrder/index.d.ts +146 -0
- package/lib/solution/ScanOrder/index.js +1820 -0
- package/lib/solution/ScanOrder/types.d.ts +305 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +167 -0
- package/lib/solution/ScanOrder/utils.js +639 -0
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +9 -4
- package/lib/solution/ShopDiscount/types.d.ts +4 -0
- package/lib/solution/VenueBooking/index.d.ts +197 -0
- package/lib/solution/VenueBooking/index.js +1892 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +153 -0
- package/lib/solution/VenueBooking/types.js +44 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +110 -0
- package/lib/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/lib/solution/VenueBooking/utils/resource.js +91 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +34 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +225 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +339 -0
- package/lib/solution/VenueBooking/utils.d.ts +1 -0
- package/lib/solution/VenueBooking/utils.js +69 -0
- package/lib/solution/index.d.ts +3 -0
- package/lib/solution/index.js +7 -1
- package/package.json +1 -1
|
@@ -1,12 +1,191 @@
|
|
|
1
1
|
import { CartItem } from '../Cart/types';
|
|
2
|
+
import type { DiscountModule } from '../Discount';
|
|
3
|
+
import type { RulesModule } from '../Rules';
|
|
4
|
+
import type { Discount } from '../Discount/types';
|
|
5
|
+
import type { SubmitPayloadEnhancer } from './utils';
|
|
6
|
+
import type { PaymentItem } from '../Payment/types';
|
|
7
|
+
import type { ICustomer } from '../AccountList/types';
|
|
2
8
|
export declare enum OrderHooks {
|
|
3
9
|
OnOrderCreate = "order:onOrderCreate",
|
|
4
10
|
OnOrderUpdate = "order:onOrderUpdate",
|
|
5
11
|
OnOrderCancel = "order:onOrderCancel",
|
|
6
|
-
OnOrderStatusChange = "order:onOrderStatusChange"
|
|
12
|
+
OnOrderStatusChange = "order:onOrderStatusChange",
|
|
13
|
+
OnOrderCustomerChange = "order:onOrderCustomerChange"
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* tempOrder 上的下单客户协议字段视图。
|
|
17
|
+
* 这些字段会随订单提交到后端。
|
|
18
|
+
*
|
|
19
|
+
* customer_id 与 OrderTempOrder.customer_id 保持一致(number | null),
|
|
20
|
+
* 调用方若持有 string id(如 ICustomer.id 联合类型),需自行 Number() 转型。
|
|
21
|
+
*/
|
|
22
|
+
export interface OrderCustomerView {
|
|
23
|
+
customer_id: number | null;
|
|
24
|
+
customer_name: string;
|
|
25
|
+
phone: string;
|
|
26
|
+
email: string;
|
|
27
|
+
country_calling_code: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 写入下单客户的协议字段输入。
|
|
31
|
+
* `customer_id` 必传(null 表示无客户);其余字段缺省视为「清空」(全量覆盖语义)。
|
|
32
|
+
*/
|
|
33
|
+
export interface OrderCustomerPatch {
|
|
34
|
+
customer_id: number | null;
|
|
35
|
+
id?: number | null;
|
|
36
|
+
customer_name?: string;
|
|
37
|
+
phone?: string;
|
|
38
|
+
email?: string;
|
|
39
|
+
country_calling_code?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 下单客户变更事件 payload。
|
|
43
|
+
* - `patch`:tempOrder 上的协议字段视图(会随订单提交)
|
|
44
|
+
* - `snapshot`:UI 富字段快照(仅本地,不随订单提交)
|
|
45
|
+
* 清空时整个 payload 为 null。
|
|
46
|
+
*/
|
|
47
|
+
export interface OrderCustomerChangePayload {
|
|
48
|
+
patch: OrderCustomerView;
|
|
49
|
+
snapshot: ICustomer | null;
|
|
50
|
+
}
|
|
51
|
+
export interface OrderProductIdentity {
|
|
52
|
+
product_id: number | null;
|
|
53
|
+
product_variant_id: number;
|
|
54
|
+
unique_identification_number?: string;
|
|
55
|
+
product_option_item?: any[];
|
|
56
|
+
product_bundle?: any[];
|
|
57
|
+
}
|
|
58
|
+
export interface OrderProduct extends OrderProductIdentity {
|
|
59
|
+
order_detail_id: number | null;
|
|
60
|
+
num: number;
|
|
61
|
+
bundle_edit?: number;
|
|
62
|
+
product_option_item: any[];
|
|
63
|
+
product_sku?: Record<string, any>;
|
|
64
|
+
gift_card?: number;
|
|
65
|
+
selling_price: string;
|
|
66
|
+
original_price: string;
|
|
67
|
+
tax_fee: string;
|
|
68
|
+
is_charge_tax: number;
|
|
69
|
+
discount_list: any[];
|
|
70
|
+
product_bundle: any[];
|
|
71
|
+
booking_uid?: string;
|
|
72
|
+
metadata: Record<string, any>;
|
|
73
|
+
note?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface OrderSummary {
|
|
76
|
+
product_quantity: number;
|
|
77
|
+
product_original_amount: string;
|
|
78
|
+
product_amount: string;
|
|
79
|
+
product_expect_amount: string;
|
|
80
|
+
product_tax_fee: string;
|
|
81
|
+
shipping_fee: string;
|
|
82
|
+
shipping_tax_fee: string;
|
|
83
|
+
tax_fee: string;
|
|
84
|
+
surcharge_fee: string;
|
|
85
|
+
discount_amount: string;
|
|
86
|
+
deposit_amount: string;
|
|
87
|
+
deposit?: {
|
|
88
|
+
total: string;
|
|
89
|
+
deposit_policy_ids: number[];
|
|
90
|
+
hasDeposit: boolean;
|
|
91
|
+
};
|
|
92
|
+
expect_amount: string;
|
|
93
|
+
total_amount: string;
|
|
94
|
+
total_refund_amount: string;
|
|
95
|
+
customer_paid_amount: string;
|
|
96
|
+
order_paid_amount: string;
|
|
97
|
+
amount_gap: string;
|
|
98
|
+
rounding_amount: string;
|
|
99
|
+
pay_service_charge_amount: string;
|
|
100
|
+
tax_title?: string;
|
|
101
|
+
tax_rate?: number;
|
|
102
|
+
}
|
|
103
|
+
export interface OrderTempOrder {
|
|
104
|
+
order_id: number | null;
|
|
105
|
+
external_sale_number: string;
|
|
106
|
+
order_number: string;
|
|
107
|
+
shop_order_number: string;
|
|
108
|
+
shop_full_order_number: string;
|
|
109
|
+
type: string;
|
|
110
|
+
business_code: string;
|
|
111
|
+
platform: string;
|
|
112
|
+
sales_channel: string;
|
|
113
|
+
order_sales_channel: string;
|
|
114
|
+
status: string;
|
|
115
|
+
payment_status: string;
|
|
116
|
+
shipping_status: string;
|
|
117
|
+
customer_id: number | null;
|
|
118
|
+
customer_name: string;
|
|
119
|
+
country_calling_code: string;
|
|
120
|
+
phone: string;
|
|
121
|
+
email: string;
|
|
122
|
+
customer?: Record<string, any> | null;
|
|
123
|
+
is_price_include_tax: number;
|
|
124
|
+
tax_title: string;
|
|
125
|
+
tax_country_code: string;
|
|
126
|
+
currency_code: string;
|
|
127
|
+
currency_symbol: string;
|
|
128
|
+
currency_format: string;
|
|
129
|
+
is_deposit: number;
|
|
130
|
+
deposit_amount: string;
|
|
131
|
+
shop_discount: string;
|
|
132
|
+
surcharge_fee: string;
|
|
133
|
+
note: string;
|
|
134
|
+
buzzer?: string;
|
|
135
|
+
delivery_type?: string;
|
|
136
|
+
table_number?: Record<string, any>;
|
|
137
|
+
schedule_date: string;
|
|
138
|
+
created_at: string;
|
|
139
|
+
request_unique_idempotency_token?: string;
|
|
140
|
+
products: OrderProduct[];
|
|
141
|
+
bookings: any[];
|
|
142
|
+
payments: any[];
|
|
143
|
+
surcharges: any[];
|
|
144
|
+
discount_list: any[];
|
|
145
|
+
relation_forms: any[];
|
|
146
|
+
contacts: any[];
|
|
147
|
+
contacts_info: Record<string, any> | null;
|
|
148
|
+
holder: Record<string, any> | null;
|
|
149
|
+
metadata: Record<string, any>;
|
|
150
|
+
_extend?: {
|
|
151
|
+
productsByUid?: Record<string, Record<string, any>>;
|
|
152
|
+
[key: string]: any;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
export interface OrderSubmitProduct extends Omit<OrderProduct, 'unique_identification_number' | 'num' | 'product_option_item'> {
|
|
156
|
+
product_quantity: number;
|
|
157
|
+
payment_price: string;
|
|
158
|
+
product_sku: Record<string, any>;
|
|
159
|
+
}
|
|
160
|
+
export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | '_extend' | 'customer' | 'shop_full_order_number'> {
|
|
161
|
+
platform: string;
|
|
162
|
+
request_unique_idempotency_token?: string;
|
|
163
|
+
form_record_ids?: Array<{
|
|
164
|
+
form_id: number | string;
|
|
165
|
+
form_record_id: number | string;
|
|
166
|
+
}>;
|
|
167
|
+
products: OrderSubmitProduct[];
|
|
168
|
+
small_ticket_data_flag?: number;
|
|
7
169
|
}
|
|
8
170
|
export interface OrderState {
|
|
171
|
+
tempOrder: OrderTempOrder | null;
|
|
172
|
+
summary?: OrderSummary;
|
|
173
|
+
lastOrderInfo?: Record<string, any>;
|
|
174
|
+
syncState?: OrderSyncState;
|
|
175
|
+
discountList: any[];
|
|
176
|
+
discount: DiscountModule | null;
|
|
177
|
+
rules: RulesModule | null;
|
|
178
|
+
}
|
|
179
|
+
/** 更新购物车行:仅传 SKU 时命中同 SKU 第一行;多行同 SKU 须传 unique_identification_number / 选项指纹等 */
|
|
180
|
+
export interface UpdateProductInOrderParams {
|
|
181
|
+
product_id: number | null;
|
|
182
|
+
product_variant_id: number;
|
|
183
|
+
updates: Partial<OrderProduct>;
|
|
184
|
+
unique_identification_number?: string;
|
|
185
|
+
product_option_item?: any[];
|
|
186
|
+
product_bundle?: any[];
|
|
9
187
|
}
|
|
188
|
+
export type AddProductBookingInput = Record<string, any>;
|
|
10
189
|
/**
|
|
11
190
|
* 订单信息
|
|
12
191
|
*/
|
|
@@ -15,10 +194,74 @@ export interface CommitOrderParams {
|
|
|
15
194
|
query: {
|
|
16
195
|
cartItems: CartItem[];
|
|
17
196
|
type: 'virtual' | 'appointment_booking';
|
|
18
|
-
platform?:
|
|
197
|
+
platform?: string;
|
|
19
198
|
extraData?: Record<string, any>;
|
|
20
199
|
};
|
|
21
200
|
}
|
|
201
|
+
export interface OrderSubmitBooking {
|
|
202
|
+
relation_id?: string;
|
|
203
|
+
form_id?: string;
|
|
204
|
+
collect_pax?: number;
|
|
205
|
+
start_time?: string;
|
|
206
|
+
end_time?: string;
|
|
207
|
+
metadata?: Record<string, any>;
|
|
208
|
+
resources?: Array<Record<string, any>>;
|
|
209
|
+
product_uid?: string;
|
|
210
|
+
}
|
|
211
|
+
export interface OrderSubmitFormRecord {
|
|
212
|
+
form_id: number | string;
|
|
213
|
+
form_record_id: number | string;
|
|
214
|
+
}
|
|
215
|
+
export interface SubmitSalesOrderParams {
|
|
216
|
+
url?: string;
|
|
217
|
+
query: {
|
|
218
|
+
order_id: number | null;
|
|
219
|
+
external_sale_number: string;
|
|
220
|
+
order_number: string;
|
|
221
|
+
shop_order_number: string;
|
|
222
|
+
type: string;
|
|
223
|
+
business_code: string;
|
|
224
|
+
platform: string;
|
|
225
|
+
request_unique_idempotency_token?: string;
|
|
226
|
+
sales_channel: string;
|
|
227
|
+
order_sales_channel: string;
|
|
228
|
+
status: string;
|
|
229
|
+
payment_status: string;
|
|
230
|
+
shipping_status: string;
|
|
231
|
+
customer_id: number | null;
|
|
232
|
+
customer_name: string;
|
|
233
|
+
country_calling_code: string;
|
|
234
|
+
phone: string;
|
|
235
|
+
email: string;
|
|
236
|
+
is_price_include_tax: number;
|
|
237
|
+
tax_title: string;
|
|
238
|
+
tax_country_code: string;
|
|
239
|
+
currency_code: string;
|
|
240
|
+
currency_symbol: string;
|
|
241
|
+
currency_format: string;
|
|
242
|
+
is_deposit: number;
|
|
243
|
+
deposit_amount: string;
|
|
244
|
+
shop_discount: string;
|
|
245
|
+
surcharge_fee: string;
|
|
246
|
+
note: string;
|
|
247
|
+
delivery_type?: string;
|
|
248
|
+
table_number?: Record<string, any>;
|
|
249
|
+
schedule_date: string;
|
|
250
|
+
created_at: string;
|
|
251
|
+
products: OrderSubmitProduct[];
|
|
252
|
+
bookings: OrderSubmitBooking[];
|
|
253
|
+
payments: any[];
|
|
254
|
+
surcharges?: any[];
|
|
255
|
+
discount_list: any[];
|
|
256
|
+
relation_forms: any[];
|
|
257
|
+
form_record_ids?: OrderSubmitFormRecord[];
|
|
258
|
+
contacts: any[];
|
|
259
|
+
contacts_info: Record<string, any> | null;
|
|
260
|
+
holder: Record<string, any> | null;
|
|
261
|
+
metadata: Record<string, any>;
|
|
262
|
+
small_ticket_data_flag?: number;
|
|
263
|
+
};
|
|
264
|
+
}
|
|
22
265
|
/**
|
|
23
266
|
* 支付项数据
|
|
24
267
|
*/
|
|
@@ -29,15 +272,105 @@ export interface PaymentItemData {
|
|
|
29
272
|
amount: string;
|
|
30
273
|
/** 支付类型代码 */
|
|
31
274
|
code: string;
|
|
32
|
-
/**
|
|
33
|
-
id
|
|
275
|
+
/** @deprecated use custom_payment_id */
|
|
276
|
+
id?: number;
|
|
277
|
+
/** 支付方式 ID */
|
|
278
|
+
custom_payment_id?: number;
|
|
34
279
|
/** 支付类型名称 */
|
|
35
280
|
name: string;
|
|
36
281
|
/** 支付类型 */
|
|
37
282
|
type: string;
|
|
38
|
-
/**
|
|
283
|
+
/** @deprecated BaseSales/Sales 协议不提交该字段;旧 Checkout/Payment 内部仍可能使用 */
|
|
39
284
|
isSynced?: boolean;
|
|
40
285
|
}
|
|
286
|
+
export interface OrderPaymentMetadata {
|
|
287
|
+
rounding_rule?: Record<string, any>;
|
|
288
|
+
unique_payment_number?: string;
|
|
289
|
+
shop_wallet_pass_id?: number | string;
|
|
290
|
+
actual_paid_amount?: number | string;
|
|
291
|
+
change_given_amount?: number | string;
|
|
292
|
+
[key: string]: any;
|
|
293
|
+
}
|
|
294
|
+
export interface OrderPaymentData {
|
|
295
|
+
amount: string;
|
|
296
|
+
code: string;
|
|
297
|
+
custom_payment_id: number;
|
|
298
|
+
name: string;
|
|
299
|
+
type: string;
|
|
300
|
+
voucher_id?: string | number;
|
|
301
|
+
origin_amount?: string;
|
|
302
|
+
service_fee?: string;
|
|
303
|
+
status?: 'active' | 'voided' | string;
|
|
304
|
+
payment_time?: string;
|
|
305
|
+
wallet_pass_usage_unit?: unknown;
|
|
306
|
+
wallet_pass_use_value?: string | number | null;
|
|
307
|
+
metadata: OrderPaymentMetadata;
|
|
308
|
+
rounding_amount?: string;
|
|
309
|
+
service_charge?: {
|
|
310
|
+
percentage?: string;
|
|
311
|
+
amount?: string;
|
|
312
|
+
};
|
|
313
|
+
order_payment_type?: 'normal' | 'deposit';
|
|
314
|
+
created_at?: string;
|
|
315
|
+
updated_at?: string;
|
|
316
|
+
}
|
|
317
|
+
export type OrderPaymentSource = PaymentItem | OrderPaymentData | Record<string, any>;
|
|
318
|
+
export interface MapOrderPaymentsOptions {
|
|
319
|
+
includeVoided?: boolean;
|
|
320
|
+
}
|
|
321
|
+
export type OrderSyncState = 'local' | 'submitting' | 'submitted' | 'failed' | 'remoteLoaded';
|
|
322
|
+
export interface LoadSalesDetailParams {
|
|
323
|
+
orderId?: number | string;
|
|
324
|
+
orderNumber?: string;
|
|
325
|
+
externalSaleNumber?: string;
|
|
326
|
+
external_sale_number?: string;
|
|
327
|
+
forceRemote?: boolean;
|
|
328
|
+
}
|
|
329
|
+
export interface SyncPaymentsToOrderParams {
|
|
330
|
+
payments: OrderPaymentSource[];
|
|
331
|
+
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
332
|
+
submitWhenPaid?: boolean;
|
|
333
|
+
smallTicketDataFlag?: number;
|
|
334
|
+
}
|
|
335
|
+
export interface SyncPaymentsToOrderResult<T = any> {
|
|
336
|
+
isFullyPaid: boolean;
|
|
337
|
+
submitResult?: T;
|
|
338
|
+
}
|
|
339
|
+
export interface OrderIdentitySnapshot {
|
|
340
|
+
localId?: string;
|
|
341
|
+
orderId?: number | string | null;
|
|
342
|
+
externalSaleNumber?: string;
|
|
343
|
+
orderNumber?: string;
|
|
344
|
+
shopOrderNumber?: string;
|
|
345
|
+
shopFullOrderNumber?: string;
|
|
346
|
+
isSubmitted: boolean;
|
|
347
|
+
}
|
|
348
|
+
export interface OrderAmountSnapshot {
|
|
349
|
+
isDeposit: boolean;
|
|
350
|
+
depositAmount: string;
|
|
351
|
+
expectAmount: string;
|
|
352
|
+
totalAmount: string;
|
|
353
|
+
amountGap: string;
|
|
354
|
+
summary: OrderSummary;
|
|
355
|
+
}
|
|
356
|
+
export interface OrderSnapshot {
|
|
357
|
+
identity: OrderIdentitySnapshot;
|
|
358
|
+
syncState: OrderSyncState;
|
|
359
|
+
amount: OrderAmountSnapshot;
|
|
360
|
+
status: string;
|
|
361
|
+
paymentStatus: string;
|
|
362
|
+
shippingStatus: string;
|
|
363
|
+
note: string;
|
|
364
|
+
customer: {
|
|
365
|
+
customerId: number | null;
|
|
366
|
+
customerName: string;
|
|
367
|
+
phone: string;
|
|
368
|
+
email: string;
|
|
369
|
+
};
|
|
370
|
+
productCount: number;
|
|
371
|
+
lastOrderInfo?: Record<string, any>;
|
|
372
|
+
tempOrder: OrderTempOrder;
|
|
373
|
+
}
|
|
41
374
|
/**
|
|
42
375
|
* Checkout 专用订单创建参数
|
|
43
376
|
*/
|
|
@@ -75,23 +408,11 @@ export interface ChangeBookingStatusParams {
|
|
|
75
408
|
* 订单模块 API
|
|
76
409
|
*/
|
|
77
410
|
export interface OrderModuleAPI {
|
|
78
|
-
/**
|
|
79
|
-
* 创建订单
|
|
80
|
-
* @param params 订单信息
|
|
81
|
-
* @returns 订单信息
|
|
82
|
-
*/
|
|
83
411
|
createOrder: (params: CommitOrderParams['query']) => any;
|
|
84
|
-
/**
|
|
85
|
-
* 检查购物车提交订单前是否符合条件
|
|
86
|
-
*/
|
|
87
412
|
checkBeforeSubmitOrder: (params: {
|
|
88
413
|
cartItems: CartItem[];
|
|
89
414
|
type: 'holder' | 'account';
|
|
90
415
|
}) => boolean;
|
|
91
|
-
/**
|
|
92
|
-
* 提交订单
|
|
93
|
-
* @param params 订单信息
|
|
94
|
-
*/
|
|
95
416
|
submitOrder: (params: CommitOrderParams) => Promise<void>;
|
|
96
417
|
/**
|
|
97
418
|
* Checkout 专用:创建订单到后端
|
|
@@ -99,11 +420,92 @@ export interface OrderModuleAPI {
|
|
|
99
420
|
* @returns 后端返回的订单数据
|
|
100
421
|
*/
|
|
101
422
|
createOrderByCheckout: (params: CheckoutOrderParams) => Promise<any>;
|
|
423
|
+
submitSalesOrder: <T = any>(params: SubmitSalesOrderParams) => Promise<T>;
|
|
424
|
+
initTempOrder: (params: {
|
|
425
|
+
cacheId?: string;
|
|
426
|
+
salesSummaryModuleName?: string;
|
|
427
|
+
}) => void;
|
|
428
|
+
getTempOrder: () => OrderTempOrder | null;
|
|
429
|
+
ensureTempOrder: () => OrderTempOrder;
|
|
430
|
+
addNewOrder: () => Promise<OrderTempOrder>;
|
|
431
|
+
restoreOrder: () => OrderTempOrder;
|
|
432
|
+
getOrderProducts: () => OrderProduct[];
|
|
433
|
+
getOrderSummary: () => Promise<OrderSummary>;
|
|
434
|
+
recalculateSummary: (options?: {
|
|
435
|
+
createIfMissing?: boolean;
|
|
436
|
+
}) => Promise<OrderSummary | null>;
|
|
437
|
+
getOrderIdentity: () => OrderIdentitySnapshot | null;
|
|
438
|
+
getOrderSnapshot: () => OrderSnapshot | null;
|
|
439
|
+
getOrderSyncState: () => OrderSyncState;
|
|
440
|
+
getOrderAmountSnapshot: () => OrderAmountSnapshot | null;
|
|
441
|
+
getTempOrderNote: () => string;
|
|
442
|
+
updateTempOrderNote: (note: string) => string;
|
|
443
|
+
updateTempOrderShopDiscount: (amount: string | number) => string;
|
|
444
|
+
updateTempOrderCustomer: (customer: UpdateTempOrderCustomerInput) => OrderSnapshot['customer'];
|
|
445
|
+
updateTempOrderBuzzer: (buzzer: string) => string;
|
|
446
|
+
updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
|
|
447
|
+
addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput) => Promise<OrderProduct[]>;
|
|
448
|
+
updateProductInOrder: (params: UpdateProductInOrderParams) => Promise<OrderProduct[]>;
|
|
449
|
+
removeProductFromOrder: (identity: OrderProductIdentity) => Promise<OrderProduct[]>;
|
|
450
|
+
persistTempOrder: () => void;
|
|
451
|
+
submitTempOrder: <T = any>(params?: {
|
|
452
|
+
cacheId?: string;
|
|
453
|
+
platform?: string;
|
|
454
|
+
businessCode?: string;
|
|
455
|
+
channel?: string;
|
|
456
|
+
type?: string;
|
|
457
|
+
payments?: OrderPaymentSource[];
|
|
458
|
+
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
459
|
+
smallTicketDataFlag?: number;
|
|
460
|
+
enhancePayload?: SubmitPayloadEnhancer;
|
|
461
|
+
}) => Promise<T>;
|
|
462
|
+
getOrderPayments: () => OrderPaymentData[];
|
|
463
|
+
setOrderPayments: (payments: OrderPaymentSource[]) => OrderPaymentData[];
|
|
464
|
+
addOrderPayment: (payment: OrderPaymentSource) => OrderPaymentData[];
|
|
465
|
+
updateOrderPayment: (paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>) => OrderPaymentData[];
|
|
466
|
+
deleteOrderPayment: (paymentIdentity: string | number) => OrderPaymentData[];
|
|
467
|
+
updateVoucherOrderPayments: (payments: OrderPaymentSource[]) => OrderPaymentData[];
|
|
468
|
+
sendCustomerPayLink: <T = any>(params: SendCustomerPayLinkParams) => Promise<T>;
|
|
469
|
+
saveDraft: () => Promise<void>;
|
|
470
|
+
hasLocalDatabase: () => boolean;
|
|
471
|
+
getLocalOrderByOrderId: (orderId: number | string) => Promise<Record<string, any> | null>;
|
|
472
|
+
getLocalOrderByExternalSaleNumber: (externalSaleNumber: string) => Promise<Record<string, any> | null>;
|
|
473
|
+
getLocalOrderByOrderNumber: (orderNumber: string) => Promise<Record<string, any> | null>;
|
|
474
|
+
hydrateTempOrderFromRecord: (record: Record<string, any>, options?: {
|
|
475
|
+
recalcOnHydrate?: boolean;
|
|
476
|
+
}) => Promise<OrderTempOrder>;
|
|
477
|
+
syncPaymentsToOrder: <T = any>(params: SyncPaymentsToOrderParams) => Promise<SyncPaymentsToOrderResult<T>>;
|
|
478
|
+
getOrderInfoByRemote: (order_id: number) => Promise<any>;
|
|
479
|
+
getLastOrderInfo: () => Record<string, any> | undefined;
|
|
480
|
+
getOrderInfo: (order_id: number) => Promise<any>;
|
|
102
481
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
482
|
+
* 写入当前下单客户。
|
|
483
|
+
*
|
|
484
|
+
* 语义为「全量覆盖」:`patch` 中未提供的协议字段会被清空(写为 '')。
|
|
485
|
+
* snapshot 用于保存 UI 富字段(wallet/会员/地址等),不会随订单提交。
|
|
486
|
+
*
|
|
487
|
+
* @param patch tempOrder 协议字段;传 null 等价于 clearOrderCustomer。
|
|
488
|
+
* @param snapshot UI 富字段快照。undefined 表示不动既有 snapshot;
|
|
489
|
+
* null 表示显式清空 snapshot;ICustomer 写入并 cloneDeep。
|
|
106
490
|
*/
|
|
491
|
+
setOrderCustomer: (patch: OrderCustomerPatch | null, snapshot?: ICustomer | null) => void;
|
|
492
|
+
/** 读取 tempOrder 的客户协议字段;customer_id 缺失时返回 null。 */
|
|
493
|
+
getOrderCustomer: () => OrderCustomerView | null;
|
|
494
|
+
/** 读取 _extend.customerSnapshot;不存在时返回 null。 */
|
|
495
|
+
getOrderCustomerSnapshot: () => ICustomer | null;
|
|
496
|
+
/** 清空 tempOrder 协议字段 + _extend.customerSnapshot,并 emit 变更事件 payload=null。 */
|
|
497
|
+
clearOrderCustomer: () => void;
|
|
498
|
+
loadDiscountConfig: (params: {
|
|
499
|
+
customerId: number;
|
|
500
|
+
action?: 'create';
|
|
501
|
+
}) => Promise<void>;
|
|
502
|
+
getDiscountList: () => Discount[];
|
|
503
|
+
applyDiscount: () => void;
|
|
504
|
+
/**
|
|
505
|
+
* 取消订单
|
|
506
|
+
* @param params 取消订单参数
|
|
507
|
+
* @returns 后端返回结果
|
|
508
|
+
*/
|
|
107
509
|
cancelOrder: (params: CancelOrderParams) => Promise<any>;
|
|
108
510
|
/**
|
|
109
511
|
* 变更预约状态
|
|
@@ -112,3 +514,22 @@ export interface OrderModuleAPI {
|
|
|
112
514
|
*/
|
|
113
515
|
changeBookingStatus: (params: ChangeBookingStatusParams) => Promise<any>;
|
|
114
516
|
}
|
|
517
|
+
export interface UpdateTempOrderCustomerInput {
|
|
518
|
+
customer_id?: number | string | null;
|
|
519
|
+
customerId?: number | string | null;
|
|
520
|
+
id?: number | string | null;
|
|
521
|
+
customer_name?: string;
|
|
522
|
+
customerName?: string;
|
|
523
|
+
display_name?: string;
|
|
524
|
+
name?: string;
|
|
525
|
+
country_calling_code?: string;
|
|
526
|
+
countryCallingCode?: string;
|
|
527
|
+
phone?: string;
|
|
528
|
+
email?: string;
|
|
529
|
+
}
|
|
530
|
+
export interface SendCustomerPayLinkParams {
|
|
531
|
+
emails: string[];
|
|
532
|
+
orderIds?: Array<number | string>;
|
|
533
|
+
order_ids?: Array<number | string>;
|
|
534
|
+
notify_action?: string;
|
|
535
|
+
}
|
|
@@ -27,6 +27,7 @@ var OrderHooks = /* @__PURE__ */ ((OrderHooks2) => {
|
|
|
27
27
|
OrderHooks2["OnOrderUpdate"] = "order:onOrderUpdate";
|
|
28
28
|
OrderHooks2["OnOrderCancel"] = "order:onOrderCancel";
|
|
29
29
|
OrderHooks2["OnOrderStatusChange"] = "order:onOrderStatusChange";
|
|
30
|
+
OrderHooks2["OnOrderCustomerChange"] = "order:onOrderCustomerChange";
|
|
30
31
|
return OrderHooks2;
|
|
31
32
|
})(OrderHooks || {});
|
|
32
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,4 +1,71 @@
|
|
|
1
|
+
import Decimal from 'decimal.js';
|
|
1
2
|
import { CartItem } from "../Cart";
|
|
3
|
+
import type { OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder } from './types';
|
|
4
|
+
import type { RulesParamsHooks } from '../Rules/types';
|
|
5
|
+
import type { MapOrderPaymentsOptions, OrderPaymentData, OrderPaymentSource } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|
|
8
|
+
*
|
|
9
|
+
* 新语义 v2 约定:
|
|
10
|
+
* - `mainPrice` 必须是**已经包含 option 的主商品单价**(即 `metadata.main_product_selling_price`
|
|
11
|
+
* 或 `metadata.main_product_original_price`),option 价格不由本函数叠加。
|
|
12
|
+
* - 套餐价:Σ((bundle.bundle_selling_price ?? bundle.price) × (bundle.num ?? bundle.quantity ?? 1))
|
|
13
|
+
* 当 `useOriginalBundle=true` 时,改用 `bundle.original_price ?? bundle.product_price ?? bundle.price`。
|
|
14
|
+
* - 返回值:保留 2 位小数的字符串,方便直接写回 `selling_price` / `original_price` 字段。
|
|
15
|
+
*
|
|
16
|
+
* 被 `normalizeOrderProduct`、Rules setProduct 钩子、各 Solution 的 setDiscountSelected 共用,
|
|
17
|
+
* 保证合成逻辑单点来源。
|
|
18
|
+
*/
|
|
19
|
+
export declare function composeLinePrice(params: {
|
|
20
|
+
mainPrice: string | number | null | undefined;
|
|
21
|
+
bundle?: Array<{
|
|
22
|
+
bundle_selling_price?: any;
|
|
23
|
+
price?: any;
|
|
24
|
+
num?: any;
|
|
25
|
+
quantity?: any;
|
|
26
|
+
original_price?: any;
|
|
27
|
+
product_price?: any;
|
|
28
|
+
}> | null;
|
|
29
|
+
useOriginalBundle?: boolean;
|
|
30
|
+
}): string;
|
|
31
|
+
/**
|
|
32
|
+
* 计算 option 单价合计:Σ(option.price × option.num)。
|
|
33
|
+
* 在新语义 v2 下,main_product_original_price = source_product_price + 本函数结果。
|
|
34
|
+
*/
|
|
35
|
+
export declare function sumOptionUnitPrice(options?: Array<{
|
|
36
|
+
price?: any;
|
|
37
|
+
num?: any;
|
|
38
|
+
}> | null): Decimal;
|
|
39
|
+
/**
|
|
40
|
+
* OrderModule 默认 Rules 钩子工厂。
|
|
41
|
+
*
|
|
42
|
+
* 价格语义约定(订单域,v2 composite 口径):
|
|
43
|
+
* - `selling_price`:券后 **行 composite 单价**
|
|
44
|
+
* = `metadata.main_product_selling_price` + Σ(bundle_selling_price × num)。
|
|
45
|
+
* - `original_price`:券前 **行 composite 单价**
|
|
46
|
+
* = `metadata.main_product_original_price` + Σ(bundle 原价 × num)。
|
|
47
|
+
* - `metadata.source_product_price`:主商品/variant 基础价(已应用报价单),不含 option、
|
|
48
|
+
* 不含折扣。**权威源**。
|
|
49
|
+
* - `metadata.main_product_original_price` = source + Σ(option.price × option.num)(含 option、不含折扣)。
|
|
50
|
+
* - `metadata.main_product_selling_price` = main_original − 主商品券 per-unit amount(含 option、含折扣)。
|
|
51
|
+
* - `payment_price`:出站 payload 中由 `selling_price` 派生以兼容后端(composite)。
|
|
52
|
+
*
|
|
53
|
+
* Rules 钩子契约(hook_adapt 方案,Rules 内部保持不变):
|
|
54
|
+
* - `getProduct.price` / `getProduct.original_price` 回传 **source-level 主价**
|
|
55
|
+
* (`metadata.source_product_price`)。Rules 内部 `getProductTotalPrice` /
|
|
56
|
+
* `getProductOriginTotalPrice` 会自行叠加 option + bundle,喂 source 可避免 option 双加。
|
|
57
|
+
* - `getProduct.total` = `selling_price × num`(行 composite × num),与 Rules 内部产出的
|
|
58
|
+
* total(source + option + bundle)对齐。
|
|
59
|
+
* - `setProduct` 反向流程:把 Rules 返回的 source-level `main_product_selling_price` / `price`
|
|
60
|
+
* 加回 Σoptions,重新合成含 option 的 main_product_* 并派生 composite。
|
|
61
|
+
* 优先级:
|
|
62
|
+
* 1. `values.main_product_selling_price`(券应用分支,per-unit 券后 source-level 主价)
|
|
63
|
+
* 2. `values.price`(还原分支 `restoredPrice`、good_pass 归零)
|
|
64
|
+
* 3. `values.total / num`(仅当 Rules 只给出总价时的兜底)
|
|
65
|
+
*
|
|
66
|
+
* 导出为纯函数方便单测直接驱动钩子,不依赖 OrderModule 实例。
|
|
67
|
+
*/
|
|
68
|
+
export declare function createDefaultOrderRulesHooks(): RulesParamsHooks;
|
|
2
69
|
/**
|
|
3
70
|
* 通过 session 类商品的开始时间结束时间生成商品的时长
|
|
4
71
|
* @param {CartItem} cartItem
|
|
@@ -21,3 +88,56 @@ export declare const mergeRelationForms: (relationForms: {
|
|
|
21
88
|
form_record_ids: number[];
|
|
22
89
|
}[];
|
|
23
90
|
export declare const getAllDiscountList: (cartItem: CartItem) => any;
|
|
91
|
+
export declare function createUuidV4(): string;
|
|
92
|
+
export declare function isTempOrder(data: any): data is OrderTempOrder;
|
|
93
|
+
export declare function formatDateTime(date: Date): string;
|
|
94
|
+
export declare function normalizeBookingIsAll(booking: Record<string, any>): 0 | 1;
|
|
95
|
+
export declare function normalizeBookingSubType(booking: Record<string, any>): string;
|
|
96
|
+
export declare function normalizeSubmitBooking<T extends {
|
|
97
|
+
metadata?: Record<string, any>;
|
|
98
|
+
}>(booking: T): T;
|
|
99
|
+
/** 提交用人数:有限且为正则向下取整,否则为 1 */
|
|
100
|
+
export declare function normalizeSubmitCollectPaxValue(value: unknown): number;
|
|
101
|
+
/** 从临时订单 metadata 解析合成 booking 的 collect_pax */
|
|
102
|
+
export declare function resolveSubmitCollectPax(tempOrder: OrderTempOrder): number;
|
|
103
|
+
export declare function createDefaultTempOrder(params: {
|
|
104
|
+
now: string;
|
|
105
|
+
summary?: OrderSummary;
|
|
106
|
+
}): OrderTempOrder;
|
|
107
|
+
export interface SubmitPayloadEnhancerContext {
|
|
108
|
+
tempOrder: OrderTempOrder;
|
|
109
|
+
bookingUuid: string;
|
|
110
|
+
now: Date;
|
|
111
|
+
}
|
|
112
|
+
export type SubmitPayloadEnhancer = (payload: OrderSubmitPayload, ctx: SubmitPayloadEnhancerContext) => OrderSubmitPayload;
|
|
113
|
+
export declare function buildSubmitPayload(params: {
|
|
114
|
+
tempOrder: OrderTempOrder;
|
|
115
|
+
cacheId?: string;
|
|
116
|
+
now?: Date;
|
|
117
|
+
platform?: string;
|
|
118
|
+
businessCode?: string;
|
|
119
|
+
channel?: string;
|
|
120
|
+
type?: string;
|
|
121
|
+
enhance?: SubmitPayloadEnhancer;
|
|
122
|
+
}): OrderSubmitPayload;
|
|
123
|
+
export declare function mapPaymentItemToOrderPayment(paymentItem: OrderPaymentSource): OrderPaymentData;
|
|
124
|
+
export declare function mapPaymentItemsToOrderPayments(paymentItems: OrderPaymentSource[], options?: MapOrderPaymentsOptions): OrderPaymentData[];
|
|
125
|
+
/**
|
|
126
|
+
* 历史 V1 加餐结构映射器。
|
|
127
|
+
*
|
|
128
|
+
* @deprecated 标准 Sales checkout 已统一提交结构。
|
|
129
|
+
* 本函数仅保留以兼容历史接入方,未来会移除。新代码请勿再调用。
|
|
130
|
+
*/
|
|
131
|
+
export declare function formatV1Product(products: OrderSubmitProduct[]): {
|
|
132
|
+
bundle: any[];
|
|
133
|
+
key: number | null;
|
|
134
|
+
option: any;
|
|
135
|
+
product_id: number | null;
|
|
136
|
+
product_variant_id: number;
|
|
137
|
+
num: number;
|
|
138
|
+
note: string;
|
|
139
|
+
rowKey: number | null;
|
|
140
|
+
session: null;
|
|
141
|
+
unique: string;
|
|
142
|
+
}[];
|
|
143
|
+
export { createEmptySummary } from '../../solution/ScanOrder/utils';
|