@pisell/pisellos 3.0.89 → 3.0.91
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/index.d.ts +1 -0
- package/dist/model/index.js +1 -0
- package/dist/model/strategy/adapter/index.d.ts +7 -0
- package/dist/model/strategy/adapter/index.js +7 -0
- 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/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/type.d.ts +28 -0
- package/dist/model/strategy/adapter/type.js +1 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +502 -0
- package/dist/model/strategy/adapter/walletPass/example.d.ts +4 -0
- package/dist/model/strategy/adapter/walletPass/example.js +258 -0
- package/dist/model/strategy/adapter/walletPass/index.d.ts +32 -0
- package/dist/model/strategy/adapter/walletPass/index.js +182 -0
- package/dist/model/strategy/adapter/walletPass/locales.d.ts +1 -0
- package/dist/model/strategy/adapter/walletPass/locales.js +26 -0
- package/dist/model/strategy/adapter/walletPass/type.d.ts +187 -0
- package/dist/model/strategy/adapter/walletPass/type.js +1 -0
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +50 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +1104 -0
- package/dist/model/strategy/engine.d.ts +106 -0
- package/dist/model/strategy/engine.js +611 -0
- package/dist/model/strategy/index.d.ts +3 -0
- package/dist/model/strategy/index.js +8 -0
- package/dist/model/strategy/strategy-example.d.ts +5 -0
- package/dist/model/strategy/strategy-example.js +331 -0
- package/dist/model/strategy/type.d.ts +228 -0
- package/dist/model/strategy/type.js +94 -0
- package/dist/modules/Cart/utils/cartProduct.js +1 -0
- package/dist/modules/Discount/index.d.ts +4 -2
- package/dist/modules/Discount/index.js +90 -3
- package/dist/modules/Discount/types.d.ts +6 -0
- 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 +66 -1
- package/dist/modules/Order/index.js +884 -10
- package/dist/modules/Order/types.d.ts +174 -12
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +118 -0
- package/dist/modules/Order/utils.js +586 -2
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.d.ts +3 -1
- package/dist/modules/ProductList/index.js +19 -11
- package/dist/modules/Quotation/index.d.ts +48 -0
- package/dist/modules/Quotation/index.js +248 -0
- package/dist/modules/Quotation/types.d.ts +42 -0
- package/dist/modules/Quotation/types.js +1 -0
- package/dist/modules/Rules/index.js +17 -18
- package/dist/modules/SalesSummary/index.d.ts +63 -0
- package/dist/modules/SalesSummary/index.js +174 -0
- package/dist/modules/SalesSummary/types.d.ts +60 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +30 -0
- package/dist/modules/SalesSummary/utils.js +480 -0
- package/dist/modules/ScanOrderLogger/index.d.ts +23 -0
- package/dist/modules/ScanOrderLogger/index.js +174 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.js +221 -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 +53 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
- package/dist/modules/Schedule/utils.d.ts +1 -1
- package/dist/modules/Summary/utils.d.ts +3 -3
- package/dist/modules/Summary/utils.js +41 -31
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/solution/BookingByStep/index.d.ts +3 -3
- package/dist/solution/BookingByStep/index.js +2 -1
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/ScanOrder/index.d.ts +158 -0
- package/dist/solution/ScanOrder/index.js +3474 -0
- package/dist/solution/ScanOrder/types.d.ts +306 -0
- package/dist/solution/ScanOrder/types.js +35 -0
- package/dist/solution/ScanOrder/utils.d.ts +172 -0
- package/dist/solution/ScanOrder/utils.js +796 -0
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +23 -18
- package/dist/solution/VenueBooking/index.d.ts +201 -0
- package/dist/solution/VenueBooking/index.js +3472 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +154 -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 +131 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +38 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +239 -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 +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/model/index.d.ts +1 -0
- package/lib/model/index.js +23 -0
- package/lib/model/strategy/adapter/index.d.ts +7 -0
- package/lib/model/strategy/adapter/index.js +57 -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/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/type.d.ts +28 -0
- package/lib/model/strategy/adapter/type.js +17 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +424 -0
- package/lib/model/strategy/adapter/walletPass/example.d.ts +4 -0
- package/lib/model/strategy/adapter/walletPass/example.js +207 -0
- package/lib/model/strategy/adapter/walletPass/index.d.ts +32 -0
- package/lib/model/strategy/adapter/walletPass/index.js +142 -0
- package/lib/model/strategy/adapter/walletPass/locales.d.ts +1 -0
- package/lib/model/strategy/adapter/walletPass/locales.js +54 -0
- package/lib/model/strategy/adapter/walletPass/type.d.ts +187 -0
- package/lib/model/strategy/adapter/walletPass/type.js +17 -0
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +50 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +791 -0
- package/lib/model/strategy/engine.d.ts +106 -0
- package/lib/model/strategy/engine.js +450 -0
- package/lib/model/strategy/index.d.ts +3 -0
- package/lib/model/strategy/index.js +38 -0
- package/lib/model/strategy/strategy-example.d.ts +5 -0
- package/lib/model/strategy/strategy-example.js +318 -0
- package/lib/model/strategy/type.d.ts +228 -0
- package/lib/model/strategy/type.js +44 -0
- package/lib/modules/Cart/utils/cartProduct.js +1 -0
- package/lib/modules/Discount/index.d.ts +4 -2
- package/lib/modules/Discount/index.js +60 -2
- package/lib/modules/Discount/types.d.ts +6 -0
- 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 +66 -1
- package/lib/modules/Order/index.js +525 -0
- package/lib/modules/Order/types.d.ts +174 -12
- package/lib/modules/Order/utils.d.ts +118 -0
- package/lib/modules/Order/utils.js +483 -2
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +3 -1
- package/lib/modules/ProductList/index.js +45 -34
- package/lib/modules/Quotation/index.d.ts +48 -0
- package/lib/modules/Quotation/index.js +152 -0
- package/lib/modules/Quotation/types.d.ts +42 -0
- package/lib/modules/Quotation/types.js +17 -0
- package/lib/modules/Rules/index.js +17 -18
- package/lib/modules/SalesSummary/index.d.ts +63 -0
- package/lib/modules/SalesSummary/index.js +105 -0
- package/lib/modules/SalesSummary/types.d.ts +60 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +30 -0
- package/lib/modules/SalesSummary/utils.js +420 -0
- package/lib/modules/ScanOrderLogger/index.d.ts +23 -0
- package/lib/modules/ScanOrderLogger/index.js +147 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.js +157 -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 +53 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
- package/lib/modules/Schedule/utils.d.ts +1 -1
- package/lib/modules/Summary/utils.d.ts +3 -3
- package/lib/modules/Summary/utils.js +22 -16
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/solution/BookingByStep/index.d.ts +3 -3
- package/lib/solution/BookingByStep/index.js +2 -2
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/ScanOrder/index.d.ts +158 -0
- package/lib/solution/ScanOrder/index.js +2135 -0
- package/lib/solution/ScanOrder/types.d.ts +306 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +172 -0
- package/lib/solution/ScanOrder/utils.js +658 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +4 -2
- package/lib/solution/VenueBooking/index.d.ts +201 -0
- package/lib/solution/VenueBooking/index.js +1937 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +154 -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 +92 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +38 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +237 -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 +2 -0
- package/lib/solution/index.js +5 -1
- package/package.json +1 -1
|
@@ -1,4 +1,9 @@
|
|
|
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';
|
|
6
|
+
import type { SubmitPayloadEnhancer } from './utils';
|
|
2
7
|
export declare enum OrderHooks {
|
|
3
8
|
OnOrderCreate = "order:onOrderCreate",
|
|
4
9
|
OnOrderUpdate = "order:onOrderUpdate",
|
|
@@ -6,6 +11,19 @@ export declare enum OrderHooks {
|
|
|
6
11
|
OnOrderStatusChange = "order:onOrderStatusChange"
|
|
7
12
|
}
|
|
8
13
|
export interface OrderState {
|
|
14
|
+
tempOrder: ScanOrderTempOrder | null;
|
|
15
|
+
discountList: any[];
|
|
16
|
+
discount: DiscountModule | null;
|
|
17
|
+
rules: RulesModule | null;
|
|
18
|
+
}
|
|
19
|
+
/** 更新购物车行:仅传 SKU 时命中同 SKU 第一行;多行同 SKU 须传 identity_key / 选项指纹等 */
|
|
20
|
+
export interface UpdateProductInOrderParams {
|
|
21
|
+
product_id: number | null;
|
|
22
|
+
product_variant_id: number;
|
|
23
|
+
updates: Partial<ScanOrderOrderProduct>;
|
|
24
|
+
identity_key?: string;
|
|
25
|
+
product_option_item?: any[];
|
|
26
|
+
product_bundle?: any[];
|
|
9
27
|
}
|
|
10
28
|
/**
|
|
11
29
|
* 订单信息
|
|
@@ -19,26 +37,170 @@ export interface CommitOrderParams {
|
|
|
19
37
|
extraData?: Record<string, any>;
|
|
20
38
|
};
|
|
21
39
|
}
|
|
40
|
+
export interface SubmitScanOrderProduct {
|
|
41
|
+
order_detail_id: number | null;
|
|
42
|
+
product_id: number | null;
|
|
43
|
+
num: number;
|
|
44
|
+
product_variant_id: number;
|
|
45
|
+
product_option_item: any[];
|
|
46
|
+
/**
|
|
47
|
+
* 行 composite 券后单价。
|
|
48
|
+
* 公式:`metadata.main_product_selling_price` + Σ(bundle_selling_price × num)。
|
|
49
|
+
* 主商品(含 option、含主商品折扣)的单价存在 `metadata.main_product_selling_price`。
|
|
50
|
+
*/
|
|
51
|
+
selling_price: string;
|
|
52
|
+
/**
|
|
53
|
+
* 行 composite 券前单价。
|
|
54
|
+
* 公式:`metadata.main_product_original_price` + Σ(bundle 原价 × num)。
|
|
55
|
+
* 主商品(含 option、不含折扣)的单价存在 `metadata.main_product_original_price`。
|
|
56
|
+
*/
|
|
57
|
+
original_price: string;
|
|
58
|
+
/** 出站兼容字段,直接由 `selling_price` 派生,语义同 composite。 */
|
|
59
|
+
payment_price: string;
|
|
60
|
+
tax_fee: string;
|
|
61
|
+
is_charge_tax: number;
|
|
62
|
+
discount_list: any[];
|
|
63
|
+
product_bundle: any[];
|
|
64
|
+
metadata: Record<string, any>;
|
|
65
|
+
/** 商品行备注 */
|
|
66
|
+
note?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface SubmitScanOrderSummary {
|
|
69
|
+
product_quantity: number;
|
|
70
|
+
product_original_amount: string;
|
|
71
|
+
product_amount: string;
|
|
72
|
+
product_expect_amount: string;
|
|
73
|
+
product_tax_fee: string;
|
|
74
|
+
shipping_fee: string;
|
|
75
|
+
shipping_tax_fee: string;
|
|
76
|
+
tax_fee: string;
|
|
77
|
+
surcharge_fee: string;
|
|
78
|
+
discount_amount: string;
|
|
79
|
+
deposit_amount: string;
|
|
80
|
+
expect_amount: string;
|
|
81
|
+
total_amount: string;
|
|
82
|
+
amount_gap: string;
|
|
83
|
+
rounding_amount: string;
|
|
84
|
+
pay_service_charge_amount: string;
|
|
85
|
+
}
|
|
86
|
+
export interface SubmitScanOrderBooking {
|
|
87
|
+
relation_id?: string;
|
|
88
|
+
form_id?: string;
|
|
89
|
+
collect_pax?: number;
|
|
90
|
+
start_time?: string;
|
|
91
|
+
end_time?: string;
|
|
92
|
+
metadata?: Record<string, any>;
|
|
93
|
+
resources?: Array<Record<string, any>>;
|
|
94
|
+
product_uid?: string;
|
|
95
|
+
}
|
|
96
|
+
export interface SubmitScanOrderFormRecord {
|
|
97
|
+
form_id: number | string;
|
|
98
|
+
form_record_id: number | string;
|
|
99
|
+
}
|
|
100
|
+
export interface SubmitScanOrderParams {
|
|
101
|
+
url?: string;
|
|
102
|
+
query: {
|
|
103
|
+
order_id: number | null;
|
|
104
|
+
relation_id?: string;
|
|
105
|
+
table_form_id?: string;
|
|
106
|
+
resource_id?: string;
|
|
107
|
+
order_number: string;
|
|
108
|
+
shop_order_number: string;
|
|
109
|
+
type: string;
|
|
110
|
+
business_code: string;
|
|
111
|
+
platform: 'H5' | 'PC';
|
|
112
|
+
request_unique_idempotency_token?: string;
|
|
113
|
+
sales_channel: string;
|
|
114
|
+
order_sales_channel: string;
|
|
115
|
+
status: string;
|
|
116
|
+
payment_status: string;
|
|
117
|
+
shipping_status: string;
|
|
118
|
+
customer_id: number | null;
|
|
119
|
+
customer_name: string;
|
|
120
|
+
country_calling_code: string;
|
|
121
|
+
phone: string;
|
|
122
|
+
email: string;
|
|
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
|
+
delivery_type?: string;
|
|
135
|
+
table_number?: Record<string, any>;
|
|
136
|
+
schedule_date: string;
|
|
137
|
+
created_at?: string;
|
|
138
|
+
products: SubmitScanOrderProduct[];
|
|
139
|
+
bookings: SubmitScanOrderBooking[];
|
|
140
|
+
payments: any[];
|
|
141
|
+
surcharges?: any[];
|
|
142
|
+
discount_list: any[];
|
|
143
|
+
relation_forms: any[];
|
|
144
|
+
form_record_ids?: SubmitScanOrderFormRecord[];
|
|
145
|
+
contacts: any[];
|
|
146
|
+
contacts_info: any[];
|
|
147
|
+
holder: Record<string, any> | null;
|
|
148
|
+
summary?: SubmitScanOrderSummary;
|
|
149
|
+
metadata: Record<string, any>;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
export interface ScanOrderMoreParams {
|
|
153
|
+
url?: string;
|
|
154
|
+
query: {
|
|
155
|
+
order_id: number | string;
|
|
156
|
+
products: SubmitScanOrderProduct[];
|
|
157
|
+
request_unique_idempotency_token?: string;
|
|
158
|
+
};
|
|
159
|
+
}
|
|
22
160
|
/**
|
|
23
161
|
* 订单模块 API
|
|
24
162
|
*/
|
|
25
163
|
export interface OrderModuleAPI {
|
|
26
|
-
/**
|
|
27
|
-
* 创建订单
|
|
28
|
-
* @param params 订单信息
|
|
29
|
-
* @returns 订单信息
|
|
30
|
-
*/
|
|
31
164
|
createOrder: (params: CommitOrderParams['query']) => any;
|
|
32
|
-
/**
|
|
33
|
-
* 检查购物车提交订单前是否符合条件
|
|
34
|
-
*/
|
|
35
165
|
checkBeforeSubmitOrder: (params: {
|
|
36
166
|
cartItems: CartItem[];
|
|
37
167
|
type: 'holder' | 'account';
|
|
38
168
|
}) => boolean;
|
|
39
|
-
/**
|
|
40
|
-
* 提交订单
|
|
41
|
-
* @param params 订单信息
|
|
42
|
-
*/
|
|
43
169
|
submitOrder: (params: CommitOrderParams) => Promise<void>;
|
|
170
|
+
submitScanOrder: <T = any>(params: SubmitScanOrderParams) => Promise<T>;
|
|
171
|
+
scanOrderMore: <T = any>(params: ScanOrderMoreParams) => Promise<T>;
|
|
172
|
+
initTempOrder: (params: {
|
|
173
|
+
cacheId?: string;
|
|
174
|
+
salesSummaryModuleName?: string;
|
|
175
|
+
}) => void;
|
|
176
|
+
getTempOrder: () => ScanOrderTempOrder | null;
|
|
177
|
+
ensureTempOrder: () => ScanOrderTempOrder;
|
|
178
|
+
addNewOrder: () => Promise<ScanOrderTempOrder>;
|
|
179
|
+
restoreOrder: () => ScanOrderTempOrder;
|
|
180
|
+
getOrderProducts: () => ScanOrderOrderProduct[];
|
|
181
|
+
getScanOrderSummary: () => Promise<ScanOrderSummary>;
|
|
182
|
+
recalculateSummary: (options?: {
|
|
183
|
+
createIfMissing?: boolean;
|
|
184
|
+
}) => Promise<ScanOrderSummary | null>;
|
|
185
|
+
updateTempOrderNote: (note: string) => string;
|
|
186
|
+
updateTempOrderBuzzer: (buzzer: string) => string;
|
|
187
|
+
updateTempOrderContactsInfo: (contactsInfo: any[]) => any[];
|
|
188
|
+
addProductToOrder: (product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity) => Promise<ScanOrderOrderProduct[]>;
|
|
189
|
+
updateProductInOrder: (params: UpdateProductInOrderParams) => Promise<ScanOrderOrderProduct[]>;
|
|
190
|
+
removeProductFromOrder: (identity: ScanOrderOrderProductIdentity) => Promise<ScanOrderOrderProduct[]>;
|
|
191
|
+
persistTempOrder: () => void;
|
|
192
|
+
submitTempOrder: <T = any>(params?: {
|
|
193
|
+
cacheId?: string;
|
|
194
|
+
platform?: string;
|
|
195
|
+
businessCode?: string;
|
|
196
|
+
channel?: string;
|
|
197
|
+
type?: string;
|
|
198
|
+
enhancePayload?: SubmitPayloadEnhancer;
|
|
199
|
+
}) => Promise<T>;
|
|
200
|
+
loadDiscountConfig: (params: {
|
|
201
|
+
customerId: number;
|
|
202
|
+
action?: 'create';
|
|
203
|
+
}) => Promise<void>;
|
|
204
|
+
getDiscountList: () => Discount[];
|
|
205
|
+
applyDiscount: () => void;
|
|
44
206
|
}
|
|
@@ -1,4 +1,70 @@
|
|
|
1
|
+
import Decimal from 'decimal.js';
|
|
1
2
|
import { CartItem } from "../Cart";
|
|
3
|
+
import type { ScanOrderSubmitPayload, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder } from '../../solution/ScanOrder/types';
|
|
4
|
+
import type { RulesParamsHooks } from '../Rules/types';
|
|
5
|
+
/**
|
|
6
|
+
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|
|
7
|
+
*
|
|
8
|
+
* 新语义 v2 约定:
|
|
9
|
+
* - `mainPrice` 必须是**已经包含 option 的主商品单价**(即 `metadata.main_product_selling_price`
|
|
10
|
+
* 或 `metadata.main_product_original_price`),option 价格不由本函数叠加。
|
|
11
|
+
* - 套餐价:Σ((bundle.bundle_selling_price ?? bundle.price) × (bundle.num ?? bundle.quantity ?? 1))
|
|
12
|
+
* 当 `useOriginalBundle=true` 时,改用 `bundle.original_price ?? bundle.product_price ?? bundle.price`。
|
|
13
|
+
* - 返回值:保留 2 位小数的字符串,方便直接写回 `selling_price` / `original_price` 字段。
|
|
14
|
+
*
|
|
15
|
+
* 被 `normalizeOrderProduct`、Rules setProduct 钩子、各 Solution 的 setDiscountSelected 共用,
|
|
16
|
+
* 保证合成逻辑单点来源。
|
|
17
|
+
*/
|
|
18
|
+
export declare function composeLinePrice(params: {
|
|
19
|
+
mainPrice: string | number | null | undefined;
|
|
20
|
+
bundle?: Array<{
|
|
21
|
+
bundle_selling_price?: any;
|
|
22
|
+
price?: any;
|
|
23
|
+
num?: any;
|
|
24
|
+
quantity?: any;
|
|
25
|
+
original_price?: any;
|
|
26
|
+
product_price?: any;
|
|
27
|
+
}> | null;
|
|
28
|
+
useOriginalBundle?: boolean;
|
|
29
|
+
}): string;
|
|
30
|
+
/**
|
|
31
|
+
* 计算 option 单价合计:Σ(option.price × option.num)。
|
|
32
|
+
* 在新语义 v2 下,main_product_original_price = source_product_price + 本函数结果。
|
|
33
|
+
*/
|
|
34
|
+
export declare function sumOptionUnitPrice(options?: Array<{
|
|
35
|
+
price?: any;
|
|
36
|
+
num?: any;
|
|
37
|
+
}> | null): Decimal;
|
|
38
|
+
/**
|
|
39
|
+
* OrderModule 默认 Rules 钩子工厂。
|
|
40
|
+
*
|
|
41
|
+
* 价格语义约定(订单域,v2 composite 口径):
|
|
42
|
+
* - `selling_price`:券后 **行 composite 单价**
|
|
43
|
+
* = `metadata.main_product_selling_price` + Σ(bundle_selling_price × num)。
|
|
44
|
+
* - `original_price`:券前 **行 composite 单价**
|
|
45
|
+
* = `metadata.main_product_original_price` + Σ(bundle 原价 × num)。
|
|
46
|
+
* - `metadata.source_product_price`:主商品/variant 基础价(已应用报价单),不含 option、
|
|
47
|
+
* 不含折扣。**权威源**。
|
|
48
|
+
* - `metadata.main_product_original_price` = source + Σ(option.price × option.num)(含 option、不含折扣)。
|
|
49
|
+
* - `metadata.main_product_selling_price` = main_original − 主商品券 per-unit amount(含 option、含折扣)。
|
|
50
|
+
* - `payment_price`:出站 payload 中由 `selling_price` 派生以兼容后端(composite)。
|
|
51
|
+
*
|
|
52
|
+
* Rules 钩子契约(hook_adapt 方案,Rules 内部保持不变):
|
|
53
|
+
* - `getProduct.price` / `getProduct.original_price` 回传 **source-level 主价**
|
|
54
|
+
* (`metadata.source_product_price`)。Rules 内部 `getProductTotalPrice` /
|
|
55
|
+
* `getProductOriginTotalPrice` 会自行叠加 option + bundle,喂 source 可避免 option 双加。
|
|
56
|
+
* - `getProduct.total` = `selling_price × num`(行 composite × num),与 Rules 内部产出的
|
|
57
|
+
* total(source + option + bundle)对齐。
|
|
58
|
+
* - `setProduct` 反向流程:把 Rules 返回的 source-level `main_product_selling_price` / `price`
|
|
59
|
+
* 加回 Σoptions,重新合成含 option 的 main_product_* 并派生 composite。
|
|
60
|
+
* 优先级:
|
|
61
|
+
* 1. `values.main_product_selling_price`(券应用分支,per-unit 券后 source-level 主价)
|
|
62
|
+
* 2. `values.price`(还原分支 `restoredPrice`、good_pass 归零)
|
|
63
|
+
* 3. `values.total / num`(仅当 Rules 只给出总价时的兜底)
|
|
64
|
+
*
|
|
65
|
+
* 导出为纯函数方便单测直接驱动钩子,不依赖 OrderModule 实例。
|
|
66
|
+
*/
|
|
67
|
+
export declare function createDefaultOrderRulesHooks(): RulesParamsHooks;
|
|
2
68
|
/**
|
|
3
69
|
* 通过 session 类商品的开始时间结束时间生成商品的时长
|
|
4
70
|
* @param {CartItem} cartItem
|
|
@@ -21,3 +87,55 @@ export declare const mergeRelationForms: (relationForms: {
|
|
|
21
87
|
form_record_ids: number[];
|
|
22
88
|
}[];
|
|
23
89
|
export declare const getAllDiscountList: (cartItem: CartItem) => any;
|
|
90
|
+
export declare function createUuidV4(): string;
|
|
91
|
+
export declare function isTempOrder(data: any): data is ScanOrderTempOrder;
|
|
92
|
+
export declare function formatDateTime(date: Date): string;
|
|
93
|
+
export declare function normalizeSubmitBooking<T extends {
|
|
94
|
+
metadata?: Record<string, any>;
|
|
95
|
+
}>(booking: T): T;
|
|
96
|
+
/** 提交用人数:有限且为正则向下取整,否则为 1 */
|
|
97
|
+
export declare function normalizeSubmitCollectPaxValue(value: unknown): number;
|
|
98
|
+
/** 从临时订单 metadata 解析合成 booking 的 collect_pax */
|
|
99
|
+
export declare function resolveSubmitCollectPax(tempOrder: ScanOrderTempOrder): number;
|
|
100
|
+
export declare function createDefaultTempOrder(params: {
|
|
101
|
+
now: string;
|
|
102
|
+
summary?: ScanOrderSummary;
|
|
103
|
+
}): ScanOrderTempOrder;
|
|
104
|
+
export interface SubmitPayloadEnhancerContext {
|
|
105
|
+
tempOrder: ScanOrderTempOrder;
|
|
106
|
+
bookingUuid: string;
|
|
107
|
+
now: Date;
|
|
108
|
+
}
|
|
109
|
+
export type SubmitPayloadEnhancer = (payload: ScanOrderSubmitPayload, ctx: SubmitPayloadEnhancerContext) => ScanOrderSubmitPayload;
|
|
110
|
+
export declare function buildSubmitPayload(params: {
|
|
111
|
+
tempOrder: ScanOrderTempOrder;
|
|
112
|
+
cacheId?: string;
|
|
113
|
+
now?: Date;
|
|
114
|
+
platform?: string;
|
|
115
|
+
businessCode?: string;
|
|
116
|
+
channel?: string;
|
|
117
|
+
type?: string;
|
|
118
|
+
enhance?: SubmitPayloadEnhancer;
|
|
119
|
+
}): ScanOrderSubmitPayload;
|
|
120
|
+
/** 加单(scanOrderMore)不应提交 booking 关联的虚拟规则商品行 */
|
|
121
|
+
export declare function filterProductsForScanOrderMore(products: ScanOrderSubmitProduct[]): ScanOrderSubmitProduct[];
|
|
122
|
+
/**
|
|
123
|
+
* 历史 V1 加餐结构映射器。
|
|
124
|
+
*
|
|
125
|
+
* @deprecated 加餐(`PUT /order/order/product/:id`)已改为与正常 checkout 共用
|
|
126
|
+
* `ScanOrderSubmitProduct` 新结构(见 `OrderModule.submitTempOrder` 的加餐分支)。
|
|
127
|
+
* 本函数仅保留以兼容历史接入方,未来会移除。新代码请勿再调用。
|
|
128
|
+
*/
|
|
129
|
+
export declare function formatV1Product(products: ScanOrderSubmitProduct[]): {
|
|
130
|
+
bundle: any[];
|
|
131
|
+
key: number | null;
|
|
132
|
+
option: any[];
|
|
133
|
+
product_id: number | null;
|
|
134
|
+
product_variant_id: number;
|
|
135
|
+
num: number;
|
|
136
|
+
note: string;
|
|
137
|
+
rowKey: number | null;
|
|
138
|
+
session: null;
|
|
139
|
+
unique: string;
|
|
140
|
+
}[];
|
|
141
|
+
export { createEmptySummary } from '../../solution/ScanOrder/utils';
|